|
@@ -155,7 +155,7 @@ public class ConfUtil {
|
|
|
type = "i";
|
|
|
}
|
|
|
builder.append("{name=\"").append(obj.getStr("itemName")).append("\", namespace=\"").append(obj.getStr("nodeIndex"))
|
|
|
- .append("\", identifier_type=\"").append(type).append("\", identifier=\"").append(obj.getStr("identifier"))
|
|
|
+ .append("\", identifier_type=\"").append(type).append("\", identifier=\"").append(escapeStr(obj.getStr("identifier")))
|
|
|
.append("\", tags = [[\"DataSource\", \"").append(item.getStr("datasource")).append("\"], [\"ItemGroup\", \"")
|
|
|
.append(item.getStr("itemGroupId")).append("\"]]},\n");
|
|
|
}
|
|
@@ -163,6 +163,19 @@ public class ConfUtil {
|
|
|
return builder.toString();
|
|
|
}
|
|
|
|
|
|
+ private static String escapeStr(String value){
|
|
|
+ if(StrUtil.isEmpty(value)){
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ if(!value.contains("\"")){
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ value = value.replace("\"", "\\\"");
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private static String createOpcUaFast(JSONObject item) {
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
builder.append("[[inputs.opcua_listener]]\n")
|
|
@@ -199,7 +212,7 @@ public class ConfUtil {
|
|
|
type = "i";
|
|
|
}
|
|
|
builder.append("{name=\"").append(obj.getStr("itemName")).append("\", namespace=\"").append(obj.getStr("nodeIndex"))
|
|
|
- .append("\", identifier_type=\"").append(type).append("\", identifier=\"").append(obj.getStr("identifier"))
|
|
|
+ .append("\", identifier_type=\"").append(type).append("\", identifier=\"").append(escapeStr(obj.getStr("identifier")))
|
|
|
.append("\", tags = [[\"DataSource\", \"").append(item.getStr("datasource")).append("\"], [\"ItemGroup\", \"")
|
|
|
.append(item.getStr("itemGroupId")).append("\"]]},\n");
|
|
|
|