abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r432657 - /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/util/BaseRequestEntity.java
Date Fri, 18 Aug 2006 17:32:02 GMT
Author: jmsnell
Date: Fri Aug 18 10:32:01 2006
New Revision: 432657

URL: http://svn.apache.org/viewvc?rev=432657&view=rev
Log:
Fixing an NPE

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/util/BaseRequestEntity.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/util/BaseRequestEntity.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/util/BaseRequestEntity.java?rev=432657&r1=432656&r2=432657&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/util/BaseRequestEntity.java
(original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/util/BaseRequestEntity.java
Fri Aug 18 10:32:01 2006
@@ -55,7 +55,19 @@
   public String getContentType() {
     String type = null;
     if (base instanceof Document) {
-      type = ((Document)base).getContentType().toString();
+      Document doc = (Document) base;
+      if (doc.getContentType() != null) {
+        type = doc.getContentType().toString();
+      } else {
+        if (doc.getRoot() instanceof Feed ||
+            doc.getRoot() instanceof Entry) {
+          type = "application/atom+xml";
+        } else if (doc.getRoot() instanceof Service) {
+          type = "application/atomserv+xml";
+        } else {
+          type = "application/xml";
+        }
+      }
     } else if (base instanceof Feed || base instanceof Entry) {
       Document doc = ((Element)base).getDocument();
       if (doc != null && doc.getContentType() != null)



Mime
View raw message