[jboss-svn-commits] JBoss Common SVN: r4894 - in common-core/branches/2.2.16.GA_JBPAPP-6542/src: test/java/org/jboss/test/util/test/xml/resolver and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon May 23 11:25:21 EDT 2011
Author: klape
Date: 2011-05-23 11:25:20 -0400 (Mon, 23 May 2011)
New Revision: 4894
Modified:
common-core/branches/2.2.16.GA_JBPAPP-6542/src/main/java/org/jboss/util/xml/JBossEntityResolver.java
common-core/branches/2.2.16.GA_JBPAPP-6542/src/test/java/org/jboss/test/util/test/xml/resolver/JBossEntityResolverUnitTestCase.java
Log:
[JBPAPP-6542] Checking for emptiness of filename instead of path in JBossEntityResolver. Adding test case for this bug.
Modified: common-core/branches/2.2.16.GA_JBPAPP-6542/src/main/java/org/jboss/util/xml/JBossEntityResolver.java
===================================================================
--- common-core/branches/2.2.16.GA_JBPAPP-6542/src/main/java/org/jboss/util/xml/JBossEntityResolver.java 2011-05-19 21:19:26 UTC (rev 4893)
+++ common-core/branches/2.2.16.GA_JBPAPP-6542/src/main/java/org/jboss/util/xml/JBossEntityResolver.java 2011-05-23 15:25:20 UTC (rev 4894)
@@ -547,7 +547,7 @@
else
filename = path;
- if(path.length() == 0)
+ if(filename.length() == 0)
return null;
if (trace)
Modified: common-core/branches/2.2.16.GA_JBPAPP-6542/src/test/java/org/jboss/test/util/test/xml/resolver/JBossEntityResolverUnitTestCase.java
===================================================================
--- common-core/branches/2.2.16.GA_JBPAPP-6542/src/test/java/org/jboss/test/util/test/xml/resolver/JBossEntityResolverUnitTestCase.java 2011-05-19 21:19:26 UTC (rev 4893)
+++ common-core/branches/2.2.16.GA_JBPAPP-6542/src/test/java/org/jboss/test/util/test/xml/resolver/JBossEntityResolverUnitTestCase.java 2011-05-23 15:25:20 UTC (rev 4894)
@@ -97,6 +97,29 @@
assertEquals(280, resolvedSize);
}
+ public void testEmptyFilenameResolution()
+ throws Exception
+ {
+ String rootDir = "file:///";
+ URL rootUrl = new URL(rootDir);
+ JBossEntityResolver resolver = new JBossEntityResolver();
+ InputSource resolvedSource = resolver.resolveEntity(rootDir, rootDir);
+
+ InputStream resolverStream = resolvedSource.getByteStream();
+ InputStream rootDirStream = rootUrl.openStream();
+
+ int resolverByte,rootDirByte;
+ while((resolverByte = resolverStream.read()) != -1)
+ {
+ rootDirByte = rootDirStream.read();
+ if(rootDirByte != resolverByte)
+ assertTrue("Empty filename resolution failed. URL: " + rootUrl, false);
+ }
+
+ if(rootDirStream.read() != -1)
+ assertTrue("Empty filename resolution failed. URL: " + rootUrl, false);
+ }
+
private int bytesTotal(InputStream redefinedStream) throws IOException
{
byte[] bytes = new byte[1024];
More information about the jboss-svn-commits
mailing list