You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2008/03/06 07:58:39 UTC

svn commit: r634178 - in /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util: UtilJavaParse.java UtilPlist.java

Author: jonesde
Date: Wed Mar  5 22:58:36 2008
New Revision: 634178

URL: http://svn.apache.org/viewvc?rev=634178&view=rev
Log:
Small improvements to java checking and wrapping plist files in real valid xml with headers and all

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilJavaParse.java
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilPlist.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilJavaParse.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilJavaParse.java?rev=634178&r1=634177&r2=634178&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilJavaParse.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilJavaParse.java Wed Mar  5 22:58:36 2008
@@ -74,7 +74,7 @@
     }
     
     public static int findServiceMethodBlockStart(String methodName, String javaFile) {
-        Debug.logInfo("In findServiceMethodBlockStart for " + methodName, module);
+        if (Debug.verboseOn()) Debug.logVerbose("In findServiceMethodBlockStart for " + methodName, module);
         
         // starts with something like this: public static Map exportServiceEoModelBundle(DispatchContext dctx, Map context) {
         
@@ -138,6 +138,10 @@
                 // find the service name
                 int openQuoteIndex = javaFile.indexOf("\"", openParenIndex);
                 int closeQuoteIndex = javaFile.indexOf("\"", openQuoteIndex+1);
+                if (openQuoteIndex - openParenIndex > 3 || openQuoteIndex < 0 || closeQuoteIndex < 0) {
+                    //more than two spaces/chars between quote and open paren... consider it something other than what we are looking for
+                    continue;
+                }
                 String serviceName = javaFile.substring(openQuoteIndex+1, closeQuoteIndex).trim();
                 //Debug.logInfo("In findServiceCallsInBlock found serviceName [" + serviceName + "]", module);
                 
@@ -208,6 +212,10 @@
                 // find the entity name
                 int openQuoteIndex = javaFile.indexOf("\"", openParenIndex);
                 int closeQuoteIndex = javaFile.indexOf("\"", openQuoteIndex+1);
+                if (openQuoteIndex - openParenIndex > 3 || openQuoteIndex < 0 || closeQuoteIndex < 0) {
+                    //more than two spaces/chars between quote and open paren... consider it something other than what we are looking for
+                    continue;
+                }
                 String entityName = javaFile.substring(openQuoteIndex+1, closeQuoteIndex).trim();
                 //Debug.logInfo("In findServiceCallsInBlock found valid entityName [" + entityName + "]", module);
                 

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilPlist.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilPlist.java?rev=634178&r1=634177&r2=634178&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilPlist.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilPlist.java Wed Mar  5 22:58:36 2008
@@ -150,7 +150,11 @@
     public static void writePlistFile(Map<String, Object> eoModelMap, String eomodeldFullPath, String filename, boolean useXml) throws FileNotFoundException, UnsupportedEncodingException {
         PrintWriter plistWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(eomodeldFullPath, filename)), "UTF-8")));
         if (useXml) {
+            plistWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+            plistWriter.println("<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
+            plistWriter.println("<plist version=\"1.0\">");
             writePlistPropertyMapXml(eoModelMap, 0, plistWriter);
+            plistWriter.println("</plist>");
         } else {
             writePlistPropertyMap(eoModelMap, 0, plistWriter, false);
         }