From eae6359a6d459ddd9175b21a55d1d2f15927196c Mon Sep 17 00:00:00 2001 From: tworrall Date: Thu, 9 Aug 2012 19:10:49 +0000 Subject: [PATCH] merging r10007 to the trunk --- .../freemarker/ShowDataPropertyHierarchyController.java | 2 ++ .../freemarker/ShowObjectPropertyHierarchyController.java | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowDataPropertyHierarchyController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowDataPropertyHierarchyController.java index 6cb6b42e6..12d128db2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowDataPropertyHierarchyController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowDataPropertyHierarchyController.java @@ -207,6 +207,8 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet { } String nameStr = dp.getPublicName()==null ? dp.getName()==null ? dp.getURI()==null ? "(no name)" : dp.getURI() : dp.getName() : dp.getPublicName(); + nameStr = nameStr.replace("\"","\\\""); + nameStr = nameStr.replace("\'","\\\'"); try { tempString += "\"" + nameStr + "\", "; } catch (Exception e) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowObjectPropertyHierarchyController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowObjectPropertyHierarchyController.java index 659ddb97c..dd2cd1635 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowObjectPropertyHierarchyController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ShowObjectPropertyHierarchyController.java @@ -207,11 +207,15 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet else if ( position < previous_posn ) { tempString += "}, { \"name\": "; } + + String nameStr = getDisplayLabel(op)==null ? "(no name)" : getDisplayLabel(op); + nameStr = nameStr.replace("\"","\\\""); + nameStr = nameStr.replace("\'","\\\'"); try { - tempString += "\"" + getDisplayLabel(op)+"\", "; + tempString += "\"" + nameStr +"\", "; } catch (UnsupportedEncodingException uee) { - tempString += "\"" + getDisplayLabel(op) + "\""; + tempString += "\"" + nameStr + "\""; log.error("Unsupported: URLEncoder.encode() with UTF-8"); }