ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r726864 - in /ant/ivy/core/branches/2.0.x: ./ src/java/org/apache/ivy/plugins/parser/m2/ test/java/org/apache/ivy/plugins/parser/m2/
Date Mon, 15 Dec 2008 22:36:55 GMT
Author: maartenc
Date: Mon Dec 15 14:36:54 2008
New Revision: 726864

URL: http://svn.apache.org/viewvc?rev=726864&view=rev
Log:
- FIX: IO problem while parsing ivy file (Resetting to invalid mark) (IVY-975) (merged from
trunk)
- FIX: Cannot parse maven2 poms containing an UTF-8 BOM (merged from trunk)

Added:
    ant/ivy/core/branches/2.0.x/test/java/org/apache/ivy/plugins/parser/m2/test-large-pom.pom
      - copied unchanged from r720307, ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-large-pom.pom
Modified:
    ant/ivy/core/branches/2.0.x/   (props changed)
    ant/ivy/core/branches/2.0.x/CHANGES.txt
    ant/ivy/core/branches/2.0.x/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
    ant/ivy/core/branches/2.0.x/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java

Propchange: ant/ivy/core/branches/2.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 15 14:36:54 2008
@@ -1,2 +1,2 @@
 /ant/ivy/core/branches/2.0.0-rc2:707177-709027
-/ant/ivy/core/trunk:695737,696014-696031,696442,698318-706770,709027-709034,709039-710178,711197-718421,720308-720591,721305-723065
+/ant/ivy/core/trunk:695737,696014-696031,696442,698318-706770,709027-709034,709039-710178,711197-718421,720060-720591,721305-723065

Modified: ant/ivy/core/branches/2.0.x/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.0.x/CHANGES.txt?rev=726864&r1=726863&r2=726864&view=diff
==============================================================================
--- ant/ivy/core/branches/2.0.x/CHANGES.txt (original)
+++ ant/ivy/core/branches/2.0.x/CHANGES.txt Mon Dec 15 14:36:54 2008
@@ -89,6 +89,8 @@
 - FIX: Log levels aren't respected in certain cases using the standalone functionality (IVY-960)
(thanks to Patrick Woodworth)
 - FIX: NPE in LogReportOutputter (IVY-961)
 - FIX: NullPointerException when resolving module wihout revision in the pattern (IVY-980)
+- FIX: IO problem while parsing ivy file (Resetting to invalid mark) (IVY-975)
+- FIX: Cannot parse maven2 poms containing an UTF-8 BOM
 
    2.0.0-rc2
 =====================================

Modified: ant/ivy/core/branches/2.0.x/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.0.x/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java?rev=726864&r1=726863&r2=726864&view=diff
==============================================================================
--- ant/ivy/core/branches/2.0.x/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java (original)
+++ ant/ivy/core/branches/2.0.x/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java Mon
Dec 15 14:36:54 2008
@@ -17,6 +17,7 @@
  */
 package org.apache.ivy.plugins.parser.m2;
 
+import java.io.BufferedInputStream;
 import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -514,16 +515,25 @@
         private byte[] prefix = DOCTYPE.getBytes();
         
         private AddDTDFilterInputStream(InputStream in) throws IOException {
-            super(in);
+            super(new BufferedInputStream(in));
             
-            if (!in.markSupported()) {
-                throw new IllegalArgumentException("The inputstream doesn't support mark");
-            }
+            this.in.mark(MARK);
+
+            // TODO: we should really find a better solution for this...
+            // maybe we could use a FilterReader instead of a FilterInputStream?
+            int byte1 = this.in.read();
+            int byte2 = this.in.read();
+            int byte3 = this.in.read();
             
-            in.mark(MARK);
+            if (byte1 == 239 && byte2 == 187 && byte3 == 191) {
+                // skip the UTF-8 BOM
+                this.in.mark(MARK);
+            } else {
+                this.in.reset();
+            }
             
             int bytesToSkip = 0;
-            LineNumberReader reader = new LineNumberReader(new InputStreamReader(in, "UTF-8"));
+            LineNumberReader reader = new LineNumberReader(new InputStreamReader(this.in,
"UTF-8"), 100);
             String firstLine = reader.readLine();
             if (firstLine != null) {
                 String trimmed = firstLine.trim();
@@ -535,9 +545,9 @@
                 }
             }
             
-            in.reset();
+            this.in.reset();
             for (int i = 0; i < bytesToSkip; i++) {
-                in.read();
+                this.in.read();
             }
         }
 

Modified: ant/ivy/core/branches/2.0.x/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.0.x/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java?rev=726864&r1=726863&r2=726864&view=diff
==============================================================================
--- ant/ivy/core/branches/2.0.x/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
(original)
+++ ant/ivy/core/branches/2.0.x/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
Mon Dec 15 14:36:54 2008
@@ -106,6 +106,15 @@
         assertEquals("jar", artifact[0].getType());
     }
 
+    public void testLargePom() throws Exception {
+        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
+            settings, getClass().getResource("test-large-pom.pom"), false);
+        assertNotNull(md);
+
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache.myfaces", "myfaces",
"6");
+        assertEquals(mrid, md.getModuleRevisionId());
+    }
+
     public void testPackaging() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             settings, getClass().getResource("test-packaging.pom"), false);



Mime
View raw message