You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/04/25 16:52:00 UTC
svn commit: r1330322 -
/archiva/trunk/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java
Author: olamy
Date: Wed Apr 25 14:51:59 2012
New Revision: 1330322
URL: http://svn.apache.org/viewvc?rev=1330322&view=rev
Log:
restore 1.5 compat
Modified:
archiva/trunk/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java
Modified: archiva/trunk/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java?rev=1330322&r1=1330321&r2=1330322&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java Wed Apr 25 14:51:59 2012
@@ -19,6 +19,10 @@ package org.apache.archiva.xml;
* under the License.
*/
+import junit.framework.Assert;
+import org.dom4j.DocumentException;
+import org.dom4j.io.SAXReader;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -29,14 +33,8 @@ import java.io.Reader;
import java.io.StringWriter;
import java.net.URL;
-import junit.framework.Assert;
-
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.io.SAXReader;
-
/**
- * LatinEntityResolutionReaderTest
+ * LatinEntityResolutionReaderTest
*
* @version $Id$
*/
@@ -46,10 +44,10 @@ public class LatinEntityResolutionReader
/**
* A method to obtain the content of a reader as a String,
* while allowing for specifing the buffer size of the operation.
- *
+ * <p/>
* This method is only really useful for testing a Reader implementation.
- *
- * @param input the reader to get the input from.
+ *
+ * @param input the reader to get the input from.
* @param bufsize the buffer size to use.
* @return the contents of the reader as a String.
* @throws IOException if there was an I/O error.
@@ -73,7 +71,7 @@ public class LatinEntityResolutionReader
/**
* This reads a text file from the src/test/examples directory,
* normalizes the end of lines, and returns the contents as a big String.
- *
+ *
* @param examplePath the name of the file in the src/test/examples directory.
* @return the contents of the provided file
* @throws IOException if there was an I/O error.
@@ -202,29 +200,32 @@ public class LatinEntityResolutionReader
assertProperRead( expected, "no-prolog-with-entities.xml", 409600 );
}
-
-
+
public void testReaderLeftOver()
- throws IOException
- {
- File inputFile = getExampleXml( "maven-metadata-leftover.xml" );
- //Bits from RepositoryMetadataReader.read
- InputStream in = null;
- SAXReader reader = new SAXReader();
- URL url = inputFile.toURL();
- in = url.openStream();
- InputStreamReader inReader = new InputStreamReader( in, "UTF-8" );
- LatinEntityResolutionReader latinReader = new LatinEntityResolutionReader( inReader );
- try {
- reader.read( latinReader );
- } catch (DocumentException e) {
- Assert.fail("Should not have failed here." + e);
- throw new IOException(e);
- }
- }
+ throws IOException
+ {
+ File inputFile = getExampleXml( "maven-metadata-leftover.xml" );
+ //Bits from RepositoryMetadataReader.read
+ InputStream in = null;
+ SAXReader reader = new SAXReader();
+ URL url = inputFile.toURL();
+ in = url.openStream();
+ InputStreamReader inReader = new InputStreamReader( in, "UTF-8" );
+ LatinEntityResolutionReader latinReader = new LatinEntityResolutionReader( inReader );
+ try
+ {
+ reader.read( latinReader );
+ }
+ catch ( DocumentException e )
+ {
+ Assert.fail( "Should not have failed here." + e );
+ IOException ioe = new IOException();
+ ioe.initCause( e );
+ throw ioe;
+ }
+ }
-
public void testNoLatinEntitiesHugeLine()
{
assertProperRead( "commons-codec-1.2.pom", "commons-codec-1.2.pom", 4096 );