[HepData-svn] r1902 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Nov 5 09:58:41 GMT 2015


Author: watt
Date: Thu Nov  5 09:58:41 2015
New Revision: 1902

Log:
YamlFormatter: escape single-quote characters in data point values

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Mon Nov  2 15:08:18 2015	(r1901)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Thu Nov  5 09:58:41 2015	(r1902)
@@ -407,7 +407,7 @@
 		    }
 		    if(bin.getDescription() != null ) {  
 			if(!first) { s.append(", "); } 
-			s.append("value: '"+bin.getDescription()+"'");  
+			s.append("value: '"+bin.getDescription().replaceAll("'","''")+"'");  
 			first=false;
 		    }
 		    if (bin.getDescription() == null && bin.getFocus() == null && bin.getLowValue() == null && bin.getHighValue() == null) {
@@ -544,7 +544,7 @@
 			    if(point.getRelation() == Relation.EQUALS){
 				s.append("'");
 			    }
-			    s.append(point.getDescription()+"'");
+			    s.append(point.getDescription().replaceAll("'","''")+"'");
 			} else {
 			    s.append(point.getValue());
 			}


More information about the HepData-svn mailing list