WeBankFinTech / DataSphereStudio

DataSphereStudio is a one stop data application development& management portal, covering scenarios including data exchange, desensitization/cleansing, analysis/mining, quality measurement, visualization, and task scheduling.
https://github.com/WeBankFinTech/DataSphereStudio-Doc
Apache License 2.0
3.09k stars 1k forks source link

dss1.0 visualis - display 增加辅助图形报错 #454

Open xiaoxd opened 3 years ago

xiaoxd commented 3 years ago

报错信息: Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 3 path $[0] at com.google.gson.Gson.fromJson(Gson.java:975) at com.google.gson.Gson.fromJson(Gson.java:928) at com.google.gson.Gson.fromJson(Gson.java:877) at com.google.gson.Gson.fromJson(Gson.java:848) at pers.xiaoxd.druidsample.DruidSampleApplication.main(DruidSampleApplication.java:28) Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 3 path $[0] at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:349) at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:172) at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145) at com.google.gson.Gson.fromJson(Gson.java:963) ... 4 more

示例代码: ` Gson gson = new Gson(); Map<String, MemDisplaySlideWidgetCreate> obj = new LinkedHashMap<>(); obj = gson.fromJson("[{\"widgetId\":1,\"name\":\"企业规模分布饼图\",\"type\":1,\"params\":\"{\\"width\\":460,\\"height\\":250,\\"positionX\\":16,\\"positionY\\":16,\\"backgroundColor\\":[255,255,255,0],\\"borderColor\\":[0,0,0],\\"borderWidth\\":null,\\"borderStyle\\":\\"solid\\",\\"borderRadius\\":null,\\"polling\\":\\"false\\",\\"frequency\\":60}\",\"index\":1,\"displaySlideId\":3}]", obj.getClass());

public class MemDisplaySlideWidgetCreate {

private Long id;

private String name;

private Long displaySlideId;

private Long widgetId;

private Short type;

private Short subType;

private Integer index = 0;

private String params;

private List<Long> roleIds;

} `

报错的代码: \DataSphereStudio\plugins\linkis\dss-gateway-support\src\main\scala\com\webank\wedatasphere\linkis\gateway\parser\DSSGatewayParser.scala getServiceNameFromLabel方法 val json = BDPJettyServerHelper.gson.fromJson(body, classOf[java.util.Map[String, Object]])

wushengyeyouya commented 2 years ago

Can you give us more information about this usage?