abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r517348 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
Date Mon, 12 Mar 2007 19:23:31 GMT
Author: jmsnell
Date: Mon Mar 12 12:23:30 2007
New Revision: 517348

URL: http://svn.apache.org/viewvc?view=rev&rev=517348
Log:
If app:accept is missing, it is equivalent to <accept>entry</accept>
An empty <accept /> means nothing is accepted

Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java?view=diff&rev=517348&r1=517347&r2=517348
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
Mon Mar 12 12:23:30 2007
@@ -42,6 +42,9 @@
   extends FOMExtensibleElement 
   implements Collection {
 
+  private static final String[] EMPTY = new String[0];
+  private static final String[] ENTRY = new String[] {"entry"};
+  
   private static final long serialVersionUID = -5291734055253987136L;
 
   public FOMCollection() {
@@ -146,13 +149,16 @@
   
   public String[] getAccept(){
     String accept = _getElementValue(ACCEPT);
-    if (accept == null) return new String[0];
-    String[] list = accept.trim().split("\\s*,\\s*");
+    if (accept == null) return ENTRY;
+    else accept = accept.trim();
+    if (accept.length() == 0) return EMPTY;
+    String[] list = accept.split("\\s*,\\s*");
     return MimeTypeHelper.condense(list);
   }
 
   public void setAccept(String... mediaRanges) {
     if (mediaRanges != null) {
+      mediaRanges = MimeTypeHelper.condense(mediaRanges);
       StringBuffer value = new StringBuffer();
       for (String type : mediaRanges) {
         if (value.length() > 0)



Mime
View raw message