allow generateJsonFromGenericResultsetData to handle double quotes in strings
This commit is contained in:
+4
-2
@@ -166,6 +166,8 @@ public class GenericDataServiceImpl implements GenericDataService {
|
|||||||
List<ResultsetDataRow> data = grs.getData();
|
List<ResultsetDataRow> data = grs.getData();
|
||||||
List<String> row;
|
List<String> row;
|
||||||
Integer rSize;
|
Integer rSize;
|
||||||
|
String doubleQuote = "\"";
|
||||||
|
String slashDoubleQuote = "\\\"";
|
||||||
String currColType;
|
String currColType;
|
||||||
String currVal;
|
String currVal;
|
||||||
// logger.info("NO. of Rows: " + data.size());
|
// logger.info("NO. of Rows: " + data.size());
|
||||||
@@ -176,7 +178,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
|||||||
rSize = row.size();
|
rSize = row.size();
|
||||||
for (int j = 0; j < rSize; j++) {
|
for (int j = 0; j < rSize; j++) {
|
||||||
|
|
||||||
writer.append('\"' + columnHeaders.get(j).getColumnName() + '\"' + ": ");
|
writer.append(doubleQuote + columnHeaders.get(j).getColumnName() + doubleQuote + ": ");
|
||||||
currColType = columnHeaders.get(j).getColumnDisplayType();
|
currColType = columnHeaders.get(j).getColumnDisplayType();
|
||||||
currVal = row.get(j);
|
currVal = row.get(j);
|
||||||
if (currVal != null) {
|
if (currVal != null) {
|
||||||
@@ -188,7 +190,7 @@ public class GenericDataServiceImpl implements GenericDataService {
|
|||||||
writer.append("[" + localDate.getYear() + ", " + localDate.getMonthOfYear() + ", " + localDate.getDayOfMonth()
|
writer.append("[" + localDate.getYear() + ", " + localDate.getMonthOfYear() + ", " + localDate.getDayOfMonth()
|
||||||
+ "]");
|
+ "]");
|
||||||
} else
|
} else
|
||||||
writer.append('\"' + currVal + '\"');
|
writer.append(doubleQuote + replace(currVal, doubleQuote,slashDoubleQuote) + doubleQuote);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
writer.append("null");
|
writer.append("null");
|
||||||
|
|||||||
Reference in New Issue
Block a user