Commit 995e9e20 by jinfeng.wang

fix

parent 5f4e8ee9
......@@ -5,6 +5,7 @@ import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
import org.apache.commons.lang3.StringUtils;
import org.bson.Document;
import java.util.HashSet;
......@@ -36,10 +37,14 @@ public class GetPackageFromMongo {
while (findIterable.hasNext()) {
String json = findIterable.next().toJson();
System.out.println(json);
String packageName = GsonUtil.String2JsonObject(json).get("packageName").getAsString();
set.add(packageName);
if (GsonUtil.String2JsonObject(json).has("packageName")) {
String packageName = GsonUtil.String2JsonObject(json).get("packageName").getAsString();
if (StringUtils.isNotBlank(packageName)) {
set.add(packageName);
}
}
}
System.out.println("packageNames.size ===>>> " + set.size());
MySqlUtil mySqlUtil = new MySqlUtil();
mySqlUtil.insert(set);
} catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment