jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r374706 - in /incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io: ExportContextImpl.java IOUtil.java XmlHandler.java
Date Fri, 03 Feb 2006 16:36:48 GMT
Author: angela
Date: Fri Feb  3 08:36:45 2006
New Revision: 374706

URL: http://svn.apache.org/viewcvs?rev=374706&view=rev
Log:
- ExportContxtImpl: check for null property values when spooling export properties.
- XmlHandler: set content type manually if default handler could not retrieve the jcr:mimetype
property
- IOUtil: don't add charset if mimetype is null.

Modified:
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/ExportContextImpl.java
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/IOUtil.java
    incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/XmlHandler.java

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/ExportContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/ExportContextImpl.java?rev=374706&r1=374705&r2=374706&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/ExportContextImpl.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/ExportContextImpl.java
Fri Feb  3 08:36:45 2006
@@ -168,11 +168,13 @@
                 boolean hasContentLength = false;
                 Iterator it = properties.keySet().iterator();
                 while (it.hasNext()) {
-                    String name = it.next().toString();
-                    String value = properties.get(name).toString();
-                    outputCtx.setProperty(name, value);
+                    Object name = it.next();
+                    Object value = properties.get(name);
+                    if (name != null && value != null) {
+                        outputCtx.setProperty(name.toString(), value.toString());
                     // check for content-length
-                    hasContentLength = DavConstants.HEADER_CONTENT_LENGTH.equals(name);
+                        hasContentLength = DavConstants.HEADER_CONTENT_LENGTH.equals(name.toString());
+                    }
                 }
 
                 if (outputCtx.hasStream() && outFile != null) {

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/IOUtil.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/IOUtil.java?rev=374706&r1=374705&r2=374706&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/IOUtil.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/IOUtil.java
Fri Feb  3 08:36:45 2006
@@ -110,7 +110,7 @@
      */
     public static String buildContentType(String mimeType, String encoding) {
         String contentType = mimeType;
-        if (encoding != null) {
+        if (contentType != null && encoding != null) {
             contentType += "; charset=\"" + encoding + "\"";
         }
         return contentType;

Modified: incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/XmlHandler.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/XmlHandler.java?rev=374706&r1=374705&r2=374706&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/XmlHandler.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-server/server/src/java/org/apache/jackrabbit/server/io/XmlHandler.java
Fri Feb  3 08:36:45 2006
@@ -138,7 +138,7 @@
     }
 
     /**
-     * @see DefaultHandler#exportProperties(ExportContext, boolean, Node)
+     * @see DefaultHandler#exportData(ExportContext, boolean, Node)
      */
     protected void exportData(ExportContext context, boolean isCollection, Node contentNode)
throws IOException, RepositoryException {
         // first child of content is XML document root
@@ -147,5 +147,22 @@
         }
         OutputStream out = context.getOutputStream();
         contentNode.getSession().exportDocumentView(contentNode.getPath(), out, true, false);
+    }
+
+    /**
+     * @see DefaultHandler#exportProperties(ExportContext, boolean, Node)
+     */
+    protected void exportProperties(ExportContext context, boolean isCollection, Node contentNode)
throws IOException {
+        super.exportProperties(context, isCollection, contentNode);
+        // set mimetype if the content node did not provide the
+        // jcr property (thus not handled by super class)
+        try {
+            if (!contentNode.hasProperty(JcrConstants.JCR_MIMETYPE)) {
+                context.setContentType("text/xml", "UTF-8");
+            }
+        } catch (RepositoryException e) {
+            // should never occur
+            throw new IOException(e.getMessage());
+        }
     }
 }



Mime
View raw message