diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ListClassGroupsController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ListClassGroupsController.java index 73384ba8c..63613b3c2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ListClassGroupsController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ListClassGroupsController.java @@ -64,6 +64,8 @@ public class ListClassGroupsController extends FreemarkerHttpServlet { if ( StringUtils.isBlank(publicName) ) { publicName = "(unnamed group)"; } + publicName = publicName.replace("\"","\\\""); + publicName = publicName.replace("\'","\\\'"); try { json += "{ \"name\": \""+publicName+"\", "; } catch (Exception e) { @@ -90,6 +92,8 @@ public class ListClassGroupsController extends FreemarkerHttpServlet { } String shortDefStr = (vcw.getShortDef() == null) ? "" : vcw.getShortDef(); + shortDefStr = shortDefStr.replace("\"","\\\""); + shortDefStr = shortDefStr.replace("\'","\\\'"); json += "\"data\": { \"shortDef\": \"" + shortDefStr + "\"}, \"children\": [] "; if (classIt.hasNext()) json += "} , "; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ListPropertyGroupsController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ListPropertyGroupsController.java index 2f147fcd8..1cc66879b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ListPropertyGroupsController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ListPropertyGroupsController.java @@ -70,8 +70,10 @@ public class ListPropertyGroupsController extends FreemarkerHttpServlet { if ( StringUtils.isBlank(publicName) ) { publicName = "(unnamed group)"; } + publicName = publicName.replace("\"","\\\""); + publicName = publicName.replace("\'","\\\'"); try { - json += "{ \"name\": \""+publicName+"\", "; + json += "{ \"name\": \"" + publicName + "\", "; } catch (Exception e) { json += "{ \"name\": \"" + publicName + "\", "; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowClassHierarchyController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowClassHierarchyController.java index 40cac772c..1ba366f28 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowClassHierarchyController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowClassHierarchyController.java @@ -208,7 +208,10 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet { tempString += "\" " + ((vcw.getLocalNameWithPrefix() == null) ? "" : vcw.getLocalNameWithPrefix()) + "\", "; } - tempString += "\"data\": { \"shortDef\": \"" + ((vcw.getShortDef() == null) ? "" : vcw.getShortDef()) + "\", "; + String shortDef = ((vcw.getShortDef() == null) ? "" : vcw.getShortDef()) ; + shortDef = shortDef.replace("\"","\\\""); + shortDef = shortDef.replace("\'","\\\'"); + tempString += "\"data\": { \"shortDef\": \"" + shortDef + "\", "; // Get group name if it exists VClassGroupDao groupDao= wadf.getVClassGroupDao();