Browse Source

KERNEL-216 JSON全部改为jackson实现

bugfix/10.0
richie 6 years ago
parent
commit
fb9d2f9644
  1. 4
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  2. 2
      designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java
  3. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java
  4. 4
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  5. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java
  6. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java
  7. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java
  8. 5
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java
  9. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java
  10. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  11. 4
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java
  12. 8
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  13. 4
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java

4
designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java

@ -104,7 +104,7 @@ public class PluginWebBridge {
for (String key : keySet) { for (String key : keySet) {
jsonObject.put(key, config.get(key).toString()); jsonObject.put(key, config.get(key).toString());
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return jsonObject.toString(); return jsonObject.toString();
@ -349,7 +349,7 @@ public class PluginWebBridge {
try { try {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info))); Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info)));
threadPoolExecutor.submit(task); threadPoolExecutor.submit(task);
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

2
designer-base/src/main/java/com/fr/design/extra/PluginsReaderFromStore.java

@ -74,7 +74,7 @@ public class PluginsReaderFromStore {
plugins.add(pluginView); plugins.add(pluginView);
} }
} }
} catch (JSONException e) { } catch (Exception e) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Read_Plugin_List_Error")); throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Read_Plugin_List_Error"));
} }
} }

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

@ -218,7 +218,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
break; break;
} }
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
paramLocationComboBox.setSelectedIndex(index); paramLocationComboBox.setSelectedIndex(index);

4
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -168,7 +168,6 @@ public class InformationCollector implements XMLReadable, XMLWriter {
JSONArray startStopArray = new JSONArray(); JSONArray startStopArray = new JSONArray();
for (int i = 0; i < startStop.size(); i++) { for (int i = 0; i < startStop.size(); i++) {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
try {
jo.put(ATTR_START, startStop.get(i).getStartDate()); jo.put(ATTR_START, startStop.get(i).getStartDate());
jo.put(ATTR_STOP, startStop.get(i).getStopDate()); jo.put(ATTR_STOP, startStop.get(i).getStopDate());
startStopArray.put(jo); startStopArray.put(jo);
@ -180,9 +179,6 @@ public class InformationCollector implements XMLReadable, XMLWriter {
content.put(XML_USERNAME, MarketConfig.getInstance().getBbsUsername()); content.put(XML_USERNAME, MarketConfig.getInstance().getBbsUsername());
content.put(XML_KEY, envManager.getActivationKey()); content.put(XML_KEY, envManager.getActivationKey());
content.put(XML_OS, System.getProperty("os.name")); content.put(XML_OS, System.getProperty("os.name"));
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
} }
return content; return content;
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java

@ -53,13 +53,9 @@ public class ActionModel extends AlphaCellModel {
@Override @Override
public JSONObject modelToJson() { public JSONObject modelToJson() {
JSONObject object = JSONObject.create(); JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create(); JSONObject modelObject = JSONObject.create();
modelObject.put("className", getAction().getClass().getName()).put("searchCount", getSearchCount()); modelObject.put("className", getAction().getClass().getName()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue()); object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return object; return object;
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/DocumentModel.java

@ -42,13 +42,9 @@ public class DocumentModel extends AlphaCellModel {
@Override @Override
public JSONObject modelToJson() { public JSONObject modelToJson() {
JSONObject object = JSONObject.create(); JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create(); JSONObject modelObject = JSONObject.create();
modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()).put("searchCount", getSearchCount()); modelObject.put("title", getName()).put("summary", getContent()).put("did", getDocumentId()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue()); object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error("DocumentModel: " + e.getMessage());
}
return object; return object;
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/FileModel.java

@ -37,13 +37,9 @@ public class FileModel extends AlphaCellModel {
@Override @Override
public JSONObject modelToJson() { public JSONObject modelToJson() {
JSONObject object = JSONObject.create(); JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create(); JSONObject modelObject = JSONObject.create();
modelObject.put("filePath", getFilePath()).put("searchCount", getSearchCount()); modelObject.put("filePath", getFilePath()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue()); object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return object; return object;
} }

5
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/PluginModel.java

@ -87,14 +87,9 @@ public class PluginModel extends AlphaCellModel {
@Override @Override
public JSONObject modelToJson() { public JSONObject modelToJson() {
JSONObject object = JSONObject.create(); JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create(); JSONObject modelObject = JSONObject.create();
modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("id", getId()).put("pluginid", getPluginId()).put("type", getType().getTypeValue()).put("price", getPrice()).put("link", getLink()).put("searchCount", getSearchCount()); modelObject.put("name", getName()).put("description", getContent()).put("pic", getImageUrl()).put("version", getVersion()).put("jartime", getJartime()).put("id", getId()).put("pluginid", getPluginId()).put("type", getType().getTypeValue()).put("price", getPrice()).put("link", getLink()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue()); object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return object; return object;
} }

6
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/model/RobotModel.java

@ -55,7 +55,7 @@ public class RobotModel extends AlphaCellModel {
} }
JSONObject jsonObject = new JSONObject(result); JSONObject jsonObject = new JSONObject(result);
return jsonObject.optString("msg"); return jsonObject.optString("msg");
} catch (JSONException | IOException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("get robotmodel content error: " + e.getMessage()); FineLoggerFactory.getLogger().error("get robotmodel content error: " + e.getMessage());
} }
return null; return null;
@ -69,13 +69,9 @@ public class RobotModel extends AlphaCellModel {
@Override @Override
public JSONObject modelToJson() throws JSONException { public JSONObject modelToJson() throws JSONException {
JSONObject object = JSONObject.create(); JSONObject object = JSONObject.create();
try {
JSONObject modelObject = JSONObject.create(); JSONObject modelObject = JSONObject.create();
modelObject.put("title", getTitle()).put("content", getContent()).put("searchCount", getSearchCount()); modelObject.put("title", getTitle()).put("content", getContent()).put("searchCount", getSearchCount());
object.put("result", modelObject).put("cellType", getType().getTypeValue()); object.put("result", modelObject).put("cellType", getType().getTypeValue());
} catch (JSONException e) {
FineLoggerFactory.getLogger().error("RobotModel: " + e.getMessage());
}
return object; return object;
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -976,11 +976,7 @@ public class AlphaFineDialog extends UIDialog {
int resultKind = cellModel.getType().getTypeValue(); int resultKind = cellModel.getType().getTypeValue();
String resultValue = CellModelHelper.getResultValueFromModel(cellModel); String resultValue = CellModelHelper.getResultValueFromModel(cellModel);
JSONObject object = JSONObject.create(); JSONObject object = JSONObject.create();
try {
object.put("uuid", uuid).put("activityKey", activityKey).put("username", username).put("createTime", createTime).put("key", key).put("resultKind", resultKind).put("resultValue", resultValue); object.put("uuid", uuid).put("activityKey", activityKey).put("username", username).put("createTime", createTime).put("key", key).put("resultKind", resultKind).put("resultValue", resultValue);
} catch (JSONException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
final HashMap<String, String> para = new HashMap<>(); final HashMap<String, String> para = new HashMap<>();
String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); String date = new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime());
para.put("token", CodeUtils.md5Encode(date, StringUtils.EMPTY, "MD5")); para.put("token", CodeUtils.md5Encode(date, StringUtils.EMPTY, "MD5"));

4
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java

@ -81,10 +81,8 @@ public class DocumentSearchManager implements AlphaFineSearchProvider {
} }
} }
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("document search error: " + e.getMessage()); FineLoggerFactory.getLogger().error("document search error: " + e.getMessage());
} catch (IOException e) {
FineLoggerFactory.getLogger().error("document search get result error: " + e.getMessage());
} }
} }
lessModelList.clear(); lessModelList.clear();

8
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

@ -126,12 +126,8 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
} }
} }
} }
} catch (JSONException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("plugin search json error :" + e.getMessage()); FineLoggerFactory.getLogger().error("plugin search error :" + e.getMessage());
} catch (UnsupportedEncodingException e) {
FineLoggerFactory.getLogger().error("plugin search encode error :" + e.getMessage());
} catch (IOException e) {
FineLoggerFactory.getLogger().error("plugin search get result error :" + e.getMessage());
} }
} }
if (searchResult.isEmpty()) { if (searchResult.isEmpty()) {

4
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java

@ -100,7 +100,6 @@ public class ErrorInfo {
*/ */
public void saveAsJSON(){ public void saveAsJSON(){
JSONObject jo = JSONObject.create(); JSONObject jo = JSONObject.create();
try {
jo.put("username", username); jo.put("username", username);
jo.put("uuid", uuid); jo.put("uuid", uuid);
jo.put("activekey", activekey); jo.put("activekey", activekey);
@ -108,9 +107,6 @@ public class ErrorInfo {
jo.put("uploadtime", uploadtime); jo.put("uploadtime", uploadtime);
jo.put("logid", logid); jo.put("logid", logid);
jo.put("log", log); jo.put("log", log);
} catch (JSONException ignore) {
}
saveFileToCache(jo); saveFileToCache(jo);
} }

Loading…
Cancel
Save