You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stuart Roebuck <st...@adolos.co.uk> on 2001/08/02 22:57:41 UTC

[C2][PATCH] IOUtils.normalizedFilename + JUnit Test

Attached is a patch for IOUtils to fix a bug I ran across today, along 
with a JUnit test case and a patch for build.xml to allow for automatic 
command line testing.

The bug relates to requests for XSP pages from Cocoon from servers without 
a hostname (i.e. only a numeric address).  Such requests result in IOUtils.
normalizedFilename returning a normalized filename with an element 
starting with a number.  This is converted into an XSP Java package name 
and is invalid, resulting in a compile error.  So the patch here appends 
an "_" to the beginning of any element that starts with a non Alpha 
character.

I don't think there are any JUnit tests in Cocoon right now, so I created 
a new parallel directory hierachy mimicking the src directory and called 
it "test" instead of "src".  Inside that I placed the attached 
"IOUtilsTest.java" file.

The patch to build.xml adds a "test" target which relies on "compile" and 
then generates a new build/test directory where it compiles the tests in 
place and uses the JUnit extension to ant to run all the tests.

Stuart.

<Attachment missing><Attachment missing><Attachment missing>

-------------------------------------------------------------------------
Stuart Roebuck                                  stuart.roebuck@adolos.com
Lead Developer                               Java, XML, MacOS X, XP, etc.
ADOLOS                                           <http://www.adolos.com/>