chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r893590 - in /incubator/chemistry/trunk/chemistry: chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/ chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ chemistry-atompub/src/main/java/org/a...
Date Wed, 23 Dec 2009 18:14:15 GMT
Author: fguillaume
Date: Wed Dec 23 18:14:11 2009
New Revision: 893590

URL: http://svn.apache.org/viewvc?rev=893590&view=rev
Log:
Fix fetch of null values

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java?rev=893590&r1=893589&r2=893590&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObjectEntry.java
Wed Dec 23 18:14:11 2009
@@ -199,6 +199,8 @@
             properties.put(pd.getId(), p);
         } else {
             // TODO not fetched...
+            p = new XmlProperty(pd);
+            properties.put(pd.getId(), p);
         }
         return p;
     }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java?rev=893590&r1=893589&r2=893590&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
Wed Dec 23 18:14:11 2009
@@ -347,8 +347,16 @@
                     if (ct == org.apache.abdera.model.Content.Type.MEDIA) {
                         stream = content.getDataHandler().getInputStream();
                     } else {
-                        stream = new ByteArrayInputStream(
-                                content.getValue().getBytes("UTF-8"));
+                        String value = content.getValue();
+                        if (ct == org.apache.abdera.model.Content.Type.TEXT
+                                && "".equals(value)) {
+                            // stupid Abdera generates an empty <content> by
+                            // itself
+                            stream = null;
+                        } else {
+                            stream = new ByteArrayInputStream(
+                                    value.getBytes("UTF-8"));
+                        }
                     }
                 } catch (IOException e1) {
                     throw new ResponseContextException("cannot get stream", 500);

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java?rev=893590&r1=893589&r2=893590&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/abdera/PropertiesElement.java
Wed Dec 23 18:14:11 2009
@@ -123,12 +123,15 @@
             if (pd.isMultiValued()) {
                 value = list.toArray(va.createArray(list.size()));
             } else {
-                if (list.size() != 1) {
+                if (list.isEmpty()) {
+                    value = null;
+                } else if (list.size() == 1) {
+                    value = list.get(0);
+                } else {
                     throw new RuntimeException("Property: " + name
                             + " for type: " + typeId
                             + " cannot have multi-values: " + list);
                 }
-                value = list.get(0);
             }
             properties.put(name, value);
         }

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java?rev=893590&r1=893589&r2=893590&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
Wed Dec 23 18:14:11 2009
@@ -219,6 +219,7 @@
                 assertNotNull(descr);
             }
             assertNull(date);
+            assertNotNull(child.getProperty("date"));
         }
     }
 



Mime
View raw message