ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [2/4] ant git commit: Bug 58661: avoid duplicate characters in stack traces
Date Tue, 06 Dec 2016 16:06:14 GMT
Bug 58661: avoid duplicate characters in stack traces

The problem was that $secondhalflen is actually less than
string-length($secondhalfword) in case the number of chars in word is
even. This leads to $firsthalflen being calculated too long, resulting
in a duplicated character.


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/9eef94a6
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/9eef94a6
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/9eef94a6

Branch: refs/heads/master
Commit: 9eef94a6fc053ee01028fe439149b4a2c4f2fb89
Parents: 0d1928a
Author: barney2k7 <barney2k7@gmail.com>
Authored: Tue Dec 6 15:25:41 2016 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Tue Dec 6 17:04:34 2016 +0100

----------------------------------------------------------------------
 src/etc/junit-frames.xsl   | 6 +++---
 src/etc/junit-noframes.xsl | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/9eef94a6/src/etc/junit-frames.xsl
----------------------------------------------------------------------
diff --git a/src/etc/junit-frames.xsl b/src/etc/junit-frames.xsl
index afea6e0..624fd69 100644
--- a/src/etc/junit-frames.xsl
+++ b/src/etc/junit-frames.xsl
@@ -930,13 +930,13 @@ h6 {
 <xsl:template name="br-replace">
     <xsl:param name="word"/>
     <xsl:param name="splitlimit">32</xsl:param>
-    <xsl:variable name="secondhalflen" select="(string-length($word)+(string-length($word)
mod 2)) div 2"/>
-    <xsl:variable name="secondhalfword" select="substring($word, $secondhalflen)"/>
+    <xsl:variable name="secondhalfstartindex" select="(string-length($word)+(string-length($word)
mod 2)) div 2"/>
+    <xsl:variable name="secondhalfword" select="substring($word, $secondhalfstartindex)"/>
     <!-- When word is very big, a recursive replace is very heap/stack expensive, so subdivide
on line break after middle of string -->
     <xsl:choose>
       <xsl:when test="(string-length($word) > $splitlimit) and (contains($secondhalfword,
'&#xa;'))">
         <xsl:variable name="secondhalfend" select="substring-after($secondhalfword, '&#xa;')"/>
-        <xsl:variable name="firsthalflen" select="string-length($word) - $secondhalflen"/>
+        <xsl:variable name="firsthalflen" select="string-length($word) - string-length($secondhalfword)"/>
         <xsl:variable name="firsthalfword" select="substring($word, 1, $firsthalflen)"/>
         <xsl:variable name="firsthalfend" select="substring-before($secondhalfword, '&#xa;')"/>
         <xsl:call-template name="br-replace">

http://git-wip-us.apache.org/repos/asf/ant/blob/9eef94a6/src/etc/junit-noframes.xsl
----------------------------------------------------------------------
diff --git a/src/etc/junit-noframes.xsl b/src/etc/junit-noframes.xsl
index bd7002a..fa3ac3e 100644
--- a/src/etc/junit-noframes.xsl
+++ b/src/etc/junit-noframes.xsl
@@ -470,13 +470,13 @@
 <xsl:template name="br-replace">
     <xsl:param name="word"/>
     <xsl:param name="splitlimit">32</xsl:param>
-    <xsl:variable name="secondhalflen" select="(string-length($word)+(string-length($word)
mod 2)) div 2"/>
-    <xsl:variable name="secondhalfword" select="substring($word, $secondhalflen)"/>
+    <xsl:variable name="secondhalfstartindex" select="(string-length($word)+(string-length($word)
mod 2)) div 2"/>
+    <xsl:variable name="secondhalfword" select="substring($word, $secondhalfstartindex)"/>
     <!-- When word is very big, a recursive replace is very heap/stack expensive, so subdivide
on line break after middle of string -->
     <xsl:choose>
       <xsl:when test="(string-length($word) > $splitlimit) and (contains($secondhalfword,
'&#xa;'))">
         <xsl:variable name="secondhalfend" select="substring-after($secondhalfword, '&#xa;')"/>
-        <xsl:variable name="firsthalflen" select="string-length($word) - $secondhalflen"/>
+        <xsl:variable name="firsthalflen" select="string-length($word) - string-length($secondhalfword)"/>
         <xsl:variable name="firsthalfword" select="substring($word, 1, $firsthalflen)"/>
         <xsl:variable name="firsthalfend" select="substring-before($secondhalfword, '&#xa;')"/>
         <xsl:call-template name="br-replace">


Mime
View raw message