git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@442353 13f79535-47bb-0310-9956-ffa450edef68master
@@ -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 | ||||
@@ -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: | ||||
-------------- | -------------- | ||||
@@ -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> | ||||
@@ -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 */ | ||||
@@ -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); | ||||