ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Giroux" <mlgir...@gmail.com>
Subject Re: Invalid use of string utils in
Date Wed, 03 Jan 2007 21:20:37 GMT
Antoine,
Sorry for the long delay in response.  I'm just back from 3 weeks of
vacation.

I have installed ANT 1.7 and retested with the new template.  The good news
is that the new br-replace template does successfully replace newline with
<br> tags.  There is an important difference between the results produced
with this approach, and the approach I posted in the initial message (using
<pre> ... </pre> tags to wrap the output.  The difference is that in HTML,
multiple spaces are suppressed by most browsers resulting in output that is
not indented as originally produced by Exception.printStackTrace().

For example, the results using the ANT 1.7 version of the template is one
very long line of exception trace with <br/> tags as below:
junit.framework.AssertionFailedError: 38 compile Errors in
SimpleClassesJUnitTest project.<br/> at junit.framework.Assert.fail(
Assert.java:47)<br/>

this results in display as below (note lack of indenting for 2nd and
subsequent lines):
junit.framework.AssertionFailedError: Build Errors expected:<0> but was:<38>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:282)
at junit.framework.Assert.assertEquals(Assert.java:64)

The expected output would have been (note indenting):
junit.framework.AssertionFailedError: Build Errors expected:<0> but was:<38>
  at junit.framework.Assert.fail(Assert.java:47)
  at junit.framework.Assert.failNotEquals(Assert.java:282)
  at junit.framework.Assert.assertEquals(Assert.java:64)

The desired output is achieved using the technique I posted in the initial
message and shown here for your convenience.  Note the addition of <pre> ...
</pre> tags, and the xsl:value-of select="." to include the exception data.
If you can view this message in HTML, the changes are color coded tho
highlight them.


<!-- Style for the error and failure in the tescase template -->
<xsl:template name="display-failures">
    <xsl:choose>
        <xsl:when test="not(@message)">N/A</xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="@message"/>
        </xsl:otherwise>
    </xsl:choose>
    <!-- display the stacktrace -->
*    <pre>  <!-- mg -->*
    <code>
        <br/>
     *   <xsl:value-of select="." />  <!-- mg -->*
*        <!--  mg *
*            remove the original call to br-replace template
        <xsl:call-template name="br-replace">
            <xsl:with-param name="word" select="."/>
        </xsl:call-template>
         -->
*    </code>
*    </pre>  <!-- mg -->*
    <!-- the later is better but might be problematic for non-21"
monitors... -->
    <!--pre><xsl:value-of select="."/></pre-->
</xsl:template>


The original code (below) does not use <pre> and calls br-replace to replace
NL w/ <br> tags.

    <!-- display the stacktrace -->
    <code>
        <br/><br/>
        <xsl:call-template name="br-replace">
            <xsl:with-param name="word" select="."/>
        </xsl:call-template>
    </code>
Do you still need this posted to bugzilla?

Michael

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message