Browse Source

bugzilla report 38451: handling of html option of aantlr

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@442353 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 19 years ago
parent
commit
d58a8ba786
5 changed files with 38 additions and 6 deletions
  1. +1
    -0
      CONTRIBUTORS
  2. +2
    -0
      WHATSNEW
  3. +10
    -2
      contributors.xml
  4. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  5. +23
    -3
      src/testcases/org/apache/tools/ant/util/ReaderInputStreamTest.java

+ 1
- 0
CONTRIBUTORS View File

@@ -73,6 +73,7 @@ Erik Meade
Ernst de Haan Ernst de Haan
Frank Somers Frank Somers
Frank Harnack Frank Harnack
Frank Zeyda
Frederic Lavigne Frederic Lavigne
Gary S. Weaver Gary S. Weaver
Gautam Guliani Gautam Guliani


+ 2
- 0
WHATSNEW View File

@@ -19,6 +19,8 @@ Fixed bugs:
* Handling of corrupt tar files, TarInputStream.read() never returns EOF. * Handling of corrupt tar files, TarInputStream.read() never returns EOF.
Bugzilla report 39924. Bugzilla report 39924.
* Some bugs in ReaderInputStream. Bugzilla report 39635. * Some bugs in ReaderInputStream. Bugzilla report 39635.
* <antlr> did not recognise whether the target is up-to-date for html option.
Bugzilla report 38451.


Other changes: Other changes:
-------------- --------------


+ 10
- 2
contributors.xml View File

@@ -296,13 +296,21 @@
<last>de Haan</last> <last>de Haan</last>
</name> </name>
<name> <name>
<first>Frederic</first>
<last>Lavigne</last>
<first>Frank</first>
<last>Harnack</last>
</name> </name>
<name> <name>
<first>Frank</first> <first>Frank</first>
<last>Somers</last> <last>Somers</last>
</name> </name>
<name>
<first>Frank</first>
<last>Zeyda</last>
</name>
<name>
<first>Frederic</first>
<last>Lavigne</last>
</name>
<name> <name>
<first>Gary</first> <first>Gary</first>
<middle>S.</middle> <middle>S.</middle>


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -385,7 +385,8 @@ public class ANTLR extends Task {
if (generatedFileName == null) { if (generatedFileName == null) {
throw new BuildException("Unable to determine generated class"); throw new BuildException("Unable to determine generated class");
} }
return new File(outputDirectory, generatedFileName + ".java");
return new File(outputDirectory, generatedFileName
+ (html ? ".html" : ".java"));
} }


/** execute in a forked VM */ /** execute in a forked VM */


+ 23
- 3
src/testcases/org/apache/tools/ant/util/ReaderInputStreamTest.java View File

@@ -37,15 +37,30 @@ public class ReaderInputStreamTest extends TestCase {
compareBytes("a", "utf-16"); compareBytes("a", "utf-16");
} }
public void notAtestSimple16() throws Exception {
public void testSimpleAbc16() throws Exception {
// THIS WILL FAIL. // THIS WILL FAIL.
compareBytes("abc", "utf-16");
//compareBytes("abc", "utf-16");
byte[] bytes = new byte[40];
int pos = 0;
ReaderInputStream r = new ReaderInputStream(
new StringReader("abc"), "utf-16");
for (int i = 0; true; ++i) {
int res = r.read();
if (res == -1) {
break;
}
bytes[pos++] = (byte) res;
}
bytes = "abc".getBytes("utf-16");
// String n = new String(bytes, 0, pos, "utf-16");
String n = new String(bytes, 0, bytes.length, "utf-16");
System.out.println(n);
} }
public void testReadZero() throws Exception { public void testReadZero() throws Exception {
ReaderInputStream r = new ReaderInputStream( ReaderInputStream r = new ReaderInputStream(
new StringReader("abc")); new StringReader("abc"));
byte[] bytes = new byte[10];
byte[] bytes = new byte[30];
// First read in zero bytes // First read in zero bytes
r.read(bytes, 0, 0); r.read(bytes, 0, 0);
// Now read in the string // Now read in the string
@@ -53,6 +68,11 @@ public class ReaderInputStreamTest extends TestCase {
// Make sure that the counts are the same // Make sure that the counts are the same
assertEquals("abc".getBytes().length, readin); assertEquals("abc".getBytes().length, readin);
} }
public void testPreample() throws Exception {
byte[] bytes = "".getBytes("utf-16");
System.out.println("Preample len is " + bytes.length);
}
private void compareBytes(String s, String encoding) throws Exception { private void compareBytes(String s, String encoding) throws Exception {
byte[] expected = s.getBytes(encoding); byte[] expected = s.getBytes(encoding);


Loading…
Cancel
Save