NumberFormatException in EXTERNAL_RESOURCES

Hi,

I hope I'm wrong, but I think there is a little bug in the 
EXTERNAL_RESOURCES test.
This is the stack trace I get.  You can reproduce it by running the 
Tester against http://www.htmlpoint.com/guida/html_11.htm

Exception in thread "main" java.lang.NumberFormatException: For input 
string: "2
                        "
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at 
org.w3c.mwi.mobileok.basic.TestSubResult.<init>(TestSubResult.java:40)
    at 
org.w3c.mwi.mobileok.basic.AbstractTestImplementation.runTest(AbstractTestImplementation.java:28)
    ...

The latest ExternalResourcesTest.xsl in the CVS (1.4) is

...
    <xsl:call-template name="result">
        <xsl:with-param name="name">
            EXTERNAL_RESOURCES-2
        </xsl:with-param>
        ...
    </xsl:call-template>
...

so the following code doesn't work, because the "name" value is 
""\n\t\t\t\t\t\t\tEXTERNAL_RESOURCES-2\n\t\t\t\t\t\t" instead of 
"EXTERNAL_RESOURCES-2"

...
TestSubResult(final Element result) {
        final String name = result.getAttribute("name");
        final int dash = name.indexOf((int) '-');
        this.subResultID = Integer.parseInt(name.substring(dash + 1));  
<= NumberFormatException
                ...

You could fix it by omitting the leading and trailing tabs and line 
breaks in the XSL (or by changing the Java code):

...
    <xsl:call-template name="result">
        <xsl:with-param name="name">EXTERNAL_RESOURCES-2</xsl:with-param>
        ...
    </xsl:call-template>
...

Maybe the same is happening in other tests.

Regards,
guido.

Received on Wednesday, 30 January 2008 09:24:19 UTC