[HepData-svn] r1720 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Dec 2 14:37:00 GMT 2013


Author: whalley
Date: Mon Dec  2 14:37:00 2013
New Revision: 1720

Log:
cleaning up the Browse fsp

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Browsing.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Browsing.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Browsing.java	Mon Dec  2 10:20:15 2013	(r1719)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/Browsing.java	Mon Dec  2 14:37:00 2013	(r1720)
@@ -8,6 +8,8 @@
 import org.apache.tapestry5.ioc.annotations.*;
 import org.apache.tapestry5.services.*;
 
+import org.apache.commons.lang.StringUtils;
+
 import org.hibernate.*;
 import org.hibernate.criterion.*;
 import java.util.*;
@@ -152,17 +154,21 @@
 
        List <String> templist = new ArrayList();
        for (int i=0; i<templist0.size(); i++){
-          if(templist0.get(i) != null && templist0.get(i).matches("^[A-Z].*$")){
+           if(templist0.get(i) != null && templist0.get(i).matches("^[A-Z].*$")){
+              int nrb = StringUtils.countMatches(templist0.get(i),")");
+              int nlb = StringUtils.countMatches(templist0.get(i),"(");
+               if(nlb == nrb) {
 //              String temp = templist0.get(i);
-              String temp = templist0.get(i).replace('+','#').replace("#","$002b");
-              temp = temp.replace('(','#').replace("#","$0028");
-              temp = temp.replace(')','#').replace("#","$0029");
-              temp = temp.replace('=','#').replace("#","$003d");
-              temp = temp.replace('*','#').replace("#","$002a");
-              temp = temp.replace('/','#').replace("#","$002f");
+                  String temp = templist0.get(i).replace('+','#').replace("#","$002b");
+                  temp = temp.replace('(','#').replace("#","$0028");
+                  temp = temp.replace(')','#').replace("#","$0029");
+                  temp = temp.replace('=','#').replace("#","$003d");
+                  temp = temp.replace('*','#').replace("#","$002a");
+                  temp = temp.replace('/','#').replace("#","$002f");
 //              System.out.println(" temp -- " + i);
-              templist.add(temp);
-         }
+                  templist.add(temp);
+              }
+           }
        }
 
        int n = templist.size();


More information about the HepData-svn mailing list