abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r656941 - in /incubator/abdera/java/trunk/parser/src: main/java/org/apache/abdera/parser/stax/FOMEntry.java test/java/org/apache/abdera/test/parser/stax/FOMTest.java
Date Fri, 16 May 2008 05:53:40 GMT
Author: jmsnell
Date: Thu May 15 22:53:39 2008
New Revision: 656941

URL: http://svn.apache.org/viewvc?rev=656941&view=rev
Log:
Fix a test broken by the fix for https://issues.apache.org/jira/browse/ABDERA-159

Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java?rev=656941&r1=656940&r2=656941&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
Thu May 15 22:53:39 2008
@@ -301,10 +301,11 @@
     if (MimeTypeHelper.isText(mediatype)) {
       try {
         StringBuilder buf = new StringBuilder();
+        String charset = MimeTypeHelper.getCharset(mediatype);
         Document doc = this.getDocument();
-        String charset = doc != null ? doc.getCharset() : null;
+        charset = charset != null ? charset : doc != null ? doc.getCharset() : null;
         charset = charset != null ? charset : "UTF-8";
-        InputStreamReader isr = new InputStreamReader(in);
+        InputStreamReader isr = new InputStreamReader(in,charset);
         char[] data = new char[500];
         int r = -1;
         while ((r = isr.read(data)) != -1) {
@@ -330,6 +331,7 @@
       FOMFactory factory = (FOMFactory) this.factory;
       Content content = factory.newContent(new MimeType(mediatype));
       content.setValue(value);
+      content.setMimeType(mediatype);
       setContentElement(content);
       return content;
     } catch (javax.activation.MimeTypeParseException e) {

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java?rev=656941&r1=656940&r2=656941&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java
(original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java
Thu May 15 22:53:39 2008
@@ -17,11 +17,9 @@
 */
 package org.apache.abdera.test.parser.stax;
 
-import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.net.URL;
 import java.util.Calendar;
@@ -794,12 +792,7 @@
     in = new ByteArrayInputStream(out.toByteArray());
 
     entry = (Entry) abdera.getParser().parse(in).getRoot();
-    
-    in = entry.getContentStream();
-    
-    InputStreamReader r = new InputStreamReader(in,entry.getContentMimeType().getParameter("charset"));
-    BufferedReader b = new BufferedReader(r);
-    assertEquals(b.readLine(),"tóst");
-    
+
+    assertEquals(entry.getContent(),"tóst");
   }
 }



Mime
View raw message