Author: fmui
Date: Mon Mar 18 16:19:09 2013
New Revision: 1457844

URL: http://svn.apache.org/r1457844
Log:
Added empty atom:content tags for all Atom entries that don't have content for  
Atom spec compliance

Modified:
    
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java

Modified: 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
URL: 
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java?rev=1457844&r1=1457843&r2=1457844&view=diff
==============================================================================
--- 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
 (original)
+++ 
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
 Mon Mar 18 16:19:09 2013
@@ -36,6 +36,8 @@ public class AtomEntry extends AtomDocum
 
     private static final String DEFAULT_AUTHOR = "unknown";
 
+    private boolean contentTagAdded;
+
     /**
      * Creates an Atom entry document.
      */
@@ -65,12 +67,18 @@ public class AtomEntry extends AtomDocum
 
             writeAllCustomNamespace();
         }
+
+        contentTagAdded = false;
     }
 
     /**
      * Closes the entry tag.
      */
     public void endEntry() throws XMLStreamException {
+        if (!contentTagAdded) {
+            writeEmptyContent(); // for Atom spec compliance
+        }
+
         getWriter().writeEndElement();
     }
 
@@ -160,5 +168,18 @@ public class AtomEntry extends AtomDocum
         }
 
         xsw.writeEndElement();
+
+        contentTagAdded = true;
+    }
+
+    /**
+     * Writes an empty content tag for Atom spec compliance.
+     */
+    public void writeEmptyContent() throws XMLStreamException {
+        XMLStreamWriter xsw = getWriter();
+        xsw.writeStartElement(XMLConstants.PREFIX_ATOM, "content", 
XMLConstants.NAMESPACE_ATOM);
+        xsw.writeEndElement();
+
+        contentTagAdded = true;
     }
 }


Reply via email to