cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r418862 - in /incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src: cayenne/java/org/objectstyle/cayenne/wocompat/PropertyListSerialization.java tests/java/org/objectstyle/cayenne/wocompat/PropertyListSerializationTst.java
Date Mon, 03 Jul 2006 21:58:38 GMT
Author: aadamchik
Date: Mon Jul  3 14:58:38 2006
New Revision: 418862

URL: http://svn.apache.org/viewvc?rev=418862&view=rev
Log:
CAY-587 (copying the fix to the 3.0 branch)

Modified:
    incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/wocompat/PropertyListSerialization.java
    incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/tests/java/org/objectstyle/cayenne/wocompat/PropertyListSerializationTst.java

Modified: incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/wocompat/PropertyListSerialization.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/wocompat/PropertyListSerialization.java?rev=418862&r1=418861&r2=418862&view=diff
==============================================================================
--- incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/wocompat/PropertyListSerialization.java
(original)
+++ incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/wocompat/PropertyListSerialization.java
Mon Jul  3 14:58:38 2006
@@ -250,7 +250,10 @@
 		String noQuoteExtras = "_$:./";
 		char[] chars = str.toCharArray();
 		int len = chars.length;
-		for (int i = 0; i < len; i++) {
+        if (len == 0) {
+            shouldQuote = true;
+        }
+		for (int i = 0; !shouldQuote && i < len; i++) {
             char c = chars[i];
             
             if ((c >= 'a' && c <= 'z')
@@ -259,10 +262,8 @@
                     || noQuoteExtras.indexOf(c) >= 0) {
                 continue;
             }
-            else {
-                shouldQuote = true;
-                break;
-            }
+
+            shouldQuote = true;
         }
 
 		str = escapeString(str);

Modified: incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/tests/java/org/objectstyle/cayenne/wocompat/PropertyListSerializationTst.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/tests/java/org/objectstyle/cayenne/wocompat/PropertyListSerializationTst.java?rev=418862&r1=418861&r2=418862&view=diff
==============================================================================
--- incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/tests/java/org/objectstyle/cayenne/wocompat/PropertyListSerializationTst.java
(original)
+++ incubator/cayenne/main/branches/PROTO-3.0/cayenne/cayenne-java/src/tests/java/org/objectstyle/cayenne/wocompat/PropertyListSerializationTst.java
Mon Jul  3 14:58:38 2006
@@ -97,6 +97,20 @@
         assertTrue(readMap instanceof Map);
         assertTrue(map.equals(readMap));
     }
+    
+    public void testEmptyString() throws Exception {
+        File plistFile = new File(super.getTestDir(), "test-empty-string.plist");
+        Map map = new HashMap();
+        map.put("a", "");
+
+        assertFalse(plistFile.exists());
+        PropertyListSerialization.propertyListToFile(plistFile, map);
+        assertTrue(plistFile.exists());
+
+        Object readMap = PropertyListSerialization.propertyListFromFile(plistFile);
+        assertTrue(readMap instanceof Map);
+        assertTrue(map.equals(readMap));
+    }
 
     public void testStringWithQuotes() throws Exception {
         File plistFile = new File(super.getTestDir(), "test-quotes.plist");



Mime
View raw message