You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2008/01/31 11:04:22 UTC
svn commit: r617085 [14/14] - in /harmony/enhanced/classlib/branches/java6:
depends/build/ depends/build/platform/ depends/libs/ depends/oss/ make/
make/linux.x86_64.libstdc++6/ make/windows.x86/ make/windows.x86_64/
modules/archive/META-INF/ modules/a...
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/BcBandsTest.java Thu Jan 31 02:04:05 2008
@@ -22,19 +22,12 @@
import java.util.ArrayList;
import org.apache.harmony.pack200.AttrDefinitionBands;
-import org.apache.harmony.pack200.AttributeLayoutMap;
-import org.apache.harmony.pack200.BandSet;
import org.apache.harmony.pack200.BcBands;
import org.apache.harmony.pack200.ClassBands;
import org.apache.harmony.pack200.CpBands;
import org.apache.harmony.pack200.Pack200Exception;
import org.apache.harmony.pack200.Segment;
import org.apache.harmony.pack200.SegmentConstantPool;
-import org.apache.harmony.pack200.SegmentHeader;
-import org.apache.harmony.pack200.bytecode.Attribute;
-import org.apache.harmony.pack200.bytecode.LineNumberTableAttribute;
-
-import junit.framework.TestCase;
/**
* Tests for Pack200 bytecode bands
@@ -53,7 +46,7 @@
public MockCpBands(Segment segment) {
super(segment);
}
-
+
public String[] getCpString() {
String[] classes = new String[100];
for(int index=0; index < 100; index++) {
@@ -65,31 +58,31 @@
public String[] getCpClass() {
return getCpString();
}
-
+
public String[] getCpFieldClass() {
return getCpClass();
}
-
+
public String[] getCpFieldDescriptor() {
return getCpString();
}
-
+
public String[] getCpMethodClass() {
return getCpClass();
}
-
+
public String[] getCpMethodDescriptor() {
return getCpString();
}
-
+
public String[] getCpIMethodClass() {
return getCpClass();
}
-
+
public String[] getCpIMethodDescriptor() {
return getCpString();
}
-
+
public int[] getCpInt() {
int[] elements = new int[100];
for(int index=0; index < 100; index++) {
@@ -103,7 +96,7 @@
for(int index=0; index < 100; index++) {
elements[index] = 1.0f;
}
- return elements;
+ return elements;
}
public long[] getCpLong() {
@@ -111,7 +104,7 @@
for(int index=0; index < 100; index++) {
elements[index] = 1L;
}
- return elements;
+ return elements;
}
public double[] getCpDouble() {
@@ -119,7 +112,7 @@
for(int index=0; index < 100; index++) {
elements[index] = 1.0D;
}
- return elements;
+ return elements;
}
}
@@ -127,7 +120,7 @@
public MockClassBands(Segment segment) {
super(segment);
}
-
+
public long[][] getMethodFlags() {
long[][] flags = new long[numClasses][] ;
for (int i = 0; i < flags.length; i++) {
@@ -135,7 +128,7 @@
}
return flags;
}
-
+
public int[] getCodeMaxStack() {
int totalMethods = 0;
for (int i = 0; i < numClasses; i++) {
@@ -143,7 +136,7 @@
}
return new int[totalMethods];
}
-
+
public int[] getCodeMaxNALocals() {
int totalMethods = 0;
for (int i = 0; i < numClasses; i++) {
@@ -151,7 +144,7 @@
}
return new int[totalMethods];
}
-
+
public String[][] getMethodDescr() {
String[][] descr = new String[numClasses][];
for (int i = 0; i < descr.length; i++) {
@@ -162,7 +155,7 @@
}
return descr;
}
-
+
public String[] getClassThis() {
String[] thisClasses = new String[numClasses];
for(int index=0; index < numClasses; index++) {
@@ -189,7 +182,7 @@
}
return attributes;
}
-
+
public ArrayList getOrderedCodeAttributes() {
int totalMethods = 0;
for(int classIndex = 0; classIndex < numMethods.length; classIndex++) {
@@ -209,29 +202,29 @@
protected AttrDefinitionBands getAttrDefinitionBands() {
return new MockAttributeDefinitionBands(this);
}
-
+
protected CpBands getCpBands() {
if(null == cpBands) {
cpBands = new MockCpBands(this);
}
return cpBands;
}
-
+
protected ClassBands getClassBands() {
return new MockClassBands(this);
}
-
+
public SegmentConstantPool getConstantPool() {
return cpBands.getConstantPool();
}
}
BcBands bcBands = new BcBands(new MockSegment());
-
+
/**
* Test with single byte instructions that mean all other bands apart from
* bc_codes will be empty.
- *
+ *
* @throws IOException
* @throws Pack200Exception
*/
@@ -249,16 +242,16 @@
(byte) 140, (byte) 141, (byte) 142, (byte) 143, (byte) 144,
(byte) 145, (byte) 146, (byte) 147, (byte) 148, (byte) 149,
(byte) 150, (byte) 151, (byte) 172, (byte) 173, (byte) 174,
- (byte) 175, (byte) 176, (byte) 177, (byte) 190, (byte) 191,
+ (byte) 175, (byte) 176, (byte) 177, (byte) 190, (byte) 191,
(byte) 194, (byte) 195, (byte) 255 };
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(bytes.length - 1, bcBands.getMethodByteCodePacked()[0][0].length);
}
-
+
/**
* Test with multiple classes but single byte instructions
- *
+ *
* @throws IOException
* @throws Pack200Exception
*/
@@ -270,11 +263,11 @@
bcBands.unpack(in);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
-
+
numClasses = 1;
numMethods = new int[] {1};
}
-
+
/**
* Test with multiple classes and multiple methods but single byte instructions
* @throws IOException
@@ -288,22 +281,22 @@
bcBands.unpack(in);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
-
+
numClasses = 1;
- numMethods = new int[] {1};
+ numMethods = new int[] {1};
}
-
-
+
+
/**
* Test with codes that require entries in the bc_case_count and bc_case_value bands
- * @throws Pack200Exception
- * @throws IOException
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcCaseBands() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] { (byte)170, (byte)171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte)255,
+ byte[] bytes = new byte[] { (byte)170, (byte)171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte)255,
2, 5, // bc_case_count
0, 0, 0, 0, 0, 0, 0, // bc_case_value
- 0, 0, 0, 0, 0, 0, 0, 0, 0}; // bc_label
+ 0, 0, 0, 0, 0, 0, 0, 0, 0}; // bc_label
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(18, bcBands.getMethodByteCodePacked()[0][0].length);
@@ -316,22 +309,22 @@
assertEquals(0, bc_case_value[1]);
assertEquals(9, bcBands.getBcLabel().length);
}
-
+
/**
* Test with codes that should require entries in the bc_byte band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcByteBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {16, (byte)132, (byte)188, (byte)197, (byte)255,
+ byte[] bytes = new byte[] {16, (byte)132, (byte)188, (byte)197, (byte)255,
8, 8, 8, 8, // bc_byte band
8, // bc_locals band (required by iinc (132))
8}; // bc_class band (required by multianewarray (197))
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_byte = bcBands.getBcByte();
+ int[] bc_byte = bcBands.getBcByte();
assertEquals(4, bc_byte.length);
for (int i = 0; i < bc_byte.length; i++) {
assertEquals(8, bc_byte[i]);
@@ -339,16 +332,16 @@
assertEquals(1, bcBands.getBcLocal().length);
assertEquals(1, bcBands.getBcClassRef().length);
}
-
+
/**
* Test with codes that should require entries in the bc_short band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcShortBand() throws IOException, Pack200Exception {
//TODO: Need to fix this testcase so it has enough data to pass.
- byte[] bytes = new byte[] {17, (byte)196, (byte)132, (byte)255,
+ byte[] bytes = new byte[] {17, (byte)196, (byte)132, (byte)255,
8, 8,// bc_short band
8, 8, 8, 8}; // bc_locals band (required by wide iinc (196, 132))
InputStream in = new ByteArrayInputStream(bytes);
@@ -357,15 +350,15 @@
assertEquals(2, bcBands.getBcShort().length);
assertEquals(2, bcBands.getBcLocal().length);
}
-
+
/**
* Test with codes that should require entries in the bc_local band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcLocalBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {21, 22, 23, 24, 25,
+ byte[] bytes = new byte[] {21, 22, 23, 24, 25,
54, 55, 56, 57, 58, (byte)169, (byte) 255,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; // bc_local band
InputStream in = new ByteArrayInputStream(bytes);
@@ -373,12 +366,12 @@
assertEquals(11, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(11, bcBands.getBcLocal().length);
}
-
+
/**
* Test with codes that should require entries in the bc_label band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcLabelBand() throws IOException, Pack200Exception {
byte[] bytes = new byte[] {(byte) 159, (byte) 160, (byte) 161,
@@ -387,267 +380,267 @@
2, 2, // bc_case_count (required by tableswitch (170) and lookupswitch (171))
0, 0, 0, 0, // bc_case_value
// Now that we're actually doing real label lookup, need valid labels
-// 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; // bc_label band
+// 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; // bc_label band
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // bc_label band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(36, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(20, bcBands.getBcLabel().length);
}
-
+
public void testWideForms() throws IOException, Pack200Exception {
byte[] bytes = new byte[] {(byte) 196, (byte) 54, // wide istore
(byte) 196, (byte) 132, // wide iinc
- (byte) 255,
+ (byte) 255,
0, // bc_short band
- 0, 0, 0, 1}; // bc_locals band
+ 0, 0, 0, 1}; // bc_locals band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
assertEquals(4, bcBands.getBcLocal().length);
assertEquals(1, bcBands.getBcShort().length);
}
-
+
/**
* Test with codes that should require entries in the bc_intref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcIntRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {(byte)234, (byte)237, (byte)255,
- 8, 8}; // bc_intref band
+ byte[] bytes = new byte[] {(byte)234, (byte)237, (byte)255,
+ 8, 8}; // bc_intref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_intref = bcBands.getBcIntRef();
+ int[] bc_intref = bcBands.getBcIntRef();
assertEquals(2, bc_intref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_floatref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcFloatRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {(byte)235, (byte)238, (byte)255,
- 8, 8}; // bc_floatref band
+ byte[] bytes = new byte[] {(byte)235, (byte)238, (byte)255,
+ 8, 8}; // bc_floatref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_floatref = bcBands.getBcFloatRef();
+ int[] bc_floatref = bcBands.getBcFloatRef();
assertEquals(2, bc_floatref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_longref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcLongRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {20, (byte)255,
- 8}; // bc_longref band
+ byte[] bytes = new byte[] {20, (byte)255,
+ 8}; // bc_longref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(1, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_longref = bcBands.getBcLongRef();
+ int[] bc_longref = bcBands.getBcLongRef();
assertEquals(1, bc_longref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_doubleref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcDoubleRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {(byte)239, (byte)255,
- 8}; // bc_doubleref band
+ byte[] bytes = new byte[] {(byte)239, (byte)255,
+ 8}; // bc_doubleref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(1, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_doubleref = bcBands.getBcDoubleRef();
- assertEquals(1, bc_doubleref.length);
+ int[] bc_doubleref = bcBands.getBcDoubleRef();
+ assertEquals(1, bc_doubleref.length);
}
-
-
+
+
/**
* Test with codes that should require entries in the bc_stringref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcStringRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {18, 19, (byte)255,
- 8, 8}; // bc_stringref band
+ byte[] bytes = new byte[] {18, 19, (byte)255,
+ 8, 8}; // bc_stringref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_stringref = bcBands.getBcStringRef();
+ int[] bc_stringref = bcBands.getBcStringRef();
assertEquals(2, bc_stringref.length);
}
-
-
+
+
/**
* Test with codes that should require entries in the bc_classref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcClassRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {(byte)233, (byte)236, (byte)255,
- 8, 8}; // bc_classref band
+ byte[] bytes = new byte[] {(byte)233, (byte)236, (byte)255,
+ 8, 8}; // bc_classref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(2, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_classref = bcBands.getBcClassRef();
- assertEquals(2, bc_classref.length);
+ int[] bc_classref = bcBands.getBcClassRef();
+ assertEquals(2, bc_classref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_fieldref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcFieldRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {(byte)178, (byte)179, (byte)180, (byte)181, (byte)255,
- 8, 8, 8, 8}; // bc_fieldref band
+ byte[] bytes = new byte[] {(byte)178, (byte)179, (byte)180, (byte)181, (byte)255,
+ 8, 8, 8, 8}; // bc_fieldref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(4, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_fieldref = bcBands.getBcFieldRef();
+ int[] bc_fieldref = bcBands.getBcFieldRef();
assertEquals(4, bc_fieldref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_methodref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcMethodRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {(byte)182, (byte)183, (byte)184, (byte)255,
- 8, 8, 8}; // bc_methodref band
+ byte[] bytes = new byte[] {(byte)182, (byte)183, (byte)184, (byte)255,
+ 8, 8, 8}; // bc_methodref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(3, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_methodref = bcBands.getBcMethodRef();
+ int[] bc_methodref = bcBands.getBcMethodRef();
assertEquals(3, bc_methodref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_imethodref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcIMethodRefBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {(byte)185, (byte)255,
- 8}; // bc_imethodref band
+ byte[] bytes = new byte[] {(byte)185, (byte)255,
+ 8}; // bc_imethodref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(1, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_imethodref = bcBands.getBcIMethodRef();
- assertEquals(1, bc_imethodref.length);
+ int[] bc_imethodref = bcBands.getBcIMethodRef();
+ assertEquals(1, bc_imethodref.length);
}
-
+
/**
* Test with codes that should require entries in the bc_thisfieldref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcThisFieldBand() throws IOException, Pack200Exception {
byte[] bytes = new byte[] { (byte) 202, (byte) 203, (byte) 204,
(byte) 205, (byte) 209, (byte) 210, (byte) 211, (byte) 212,
- (byte) 255,
+ (byte) 255,
8, 8, 8, 8, 8, 8, 8, 8 }; // bc_thisfieldref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(8, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_thisfield = bcBands.getBcThisField();
+ int[] bc_thisfield = bcBands.getBcThisField();
assertEquals(8, bc_thisfield.length);
}
-
+
/**
* Test with codes that should require entries in the bc_superfield band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcSuperFieldBand() throws IOException, Pack200Exception {
byte[] bytes = new byte[] { (byte) 216, (byte) 217, (byte) 218,
(byte) 219, (byte) 223, (byte) 224, (byte) 225, (byte) 226,
- (byte) 255,
- 8, 8, 8, 8, 8, 8, 8, 8}; // bc_superfield band
+ (byte) 255,
+ 8, 8, 8, 8, 8, 8, 8, 8}; // bc_superfield band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(8, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_superfield = bcBands.getBcSuperField();
- assertEquals(8, bc_superfield.length);
+ int[] bc_superfield = bcBands.getBcSuperField();
+ assertEquals(8, bc_superfield.length);
}
-
+
/**
* Test with codes that should require entries in the bc_thismethod band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcThisMethodBand() throws IOException, Pack200Exception {
- byte[] bytes = new byte[] {(byte)206, (byte)207, (byte)208, (byte)213, (byte)214, (byte)215, (byte)255,
- 8, 8, 8, 8, 8, 8}; // bc_thismethod band
+ byte[] bytes = new byte[] {(byte)206, (byte)207, (byte)208, (byte)213, (byte)214, (byte)215, (byte)255,
+ 8, 8, 8, 8, 8, 8}; // bc_thismethod band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(6, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_thismethod = bcBands.getBcThisMethod();
+ int[] bc_thismethod = bcBands.getBcThisMethod();
assertEquals(6, bc_thismethod.length);
}
-
+
/**
* Test with codes that should require entries in the bc_supermethod band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcSuperMethodBand() throws IOException, Pack200Exception {
//TODO: Need to fix this testcase so it has enough data to pass.
if(true) return;
- byte[] bytes = new byte[] {(byte)220, (byte)221, (byte)222, (byte)227, (byte)228, (byte)229, (byte)255,
- 8, 8, 8, 8, 8, 8}; // bc_supermethod band
+ byte[] bytes = new byte[] {(byte)220, (byte)221, (byte)222, (byte)227, (byte)228, (byte)229, (byte)255,
+ 8, 8, 8, 8, 8, 8}; // bc_supermethod band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(6, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_supermethod = bcBands.getBcSuperMethod();
+ int[] bc_supermethod = bcBands.getBcSuperMethod();
assertEquals(6, bc_supermethod.length);
}
-
+
/**
* Test with codes that should require entries in the bc_initrefref band
- *
- * @throws Pack200Exception
- * @throws IOException
+ *
+ * @throws Pack200Exception
+ * @throws IOException
*/
public void testBcInitRefRefBand() throws IOException, Pack200Exception {
//TODO: Need to fix this testcase so it has enough data to pass.
if(true) return;
- byte[] bytes = new byte[] {(byte)230, (byte)231, (byte)232, (byte)255,
- 8, 8, 8}; // bc_initrefref band
+ byte[] bytes = new byte[] {(byte)230, (byte)231, (byte)232, (byte)255,
+ 8, 8, 8}; // bc_initrefref band
InputStream in = new ByteArrayInputStream(bytes);
bcBands.unpack(in);
assertEquals(3, bcBands.getMethodByteCodePacked()[0][0].length);
- int[] bc_initrefref = bcBands.getBcInitRef();
+ int[] bc_initrefref = bcBands.getBcInitRef();
assertEquals(3, bc_initrefref.length);
}
-
+
public void testBcEscRefBands() throws IOException, Pack200Exception {
// TODO
}
-
+
public void testBcEscBands() throws IOException, Pack200Exception {
// TODO
}
-
+
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java Thu Jan 31 02:04:05 2008
@@ -29,45 +29,45 @@
*
*/
public class ClassBandsTest extends AbstractBandsTestCase {
-
+
private String[] cpClasses;
private String[] cpDescriptor;
private String[] cpUTF8;
-
+
public class MockCpBands extends CpBands {
public MockCpBands(Segment segment) {
super(segment);
}
-
+
public String[] getCpClass() {
return cpClasses;
}
-
+
public String[] getCpDescriptor() {
return cpDescriptor;
}
-
+
public String[] getCpUTF8() {
return cpUTF8;
}
-
+
public int[] getCpInt() {
return new int[0];
}
-
+
public double[] getCpDouble() {
return new double[0];
}
-
+
public long[] getCpLong() {
- return new long[0];
+ return new long[0];
}
-
+
public float[] getCpFloat() {
return new float[0];
}
-
+
public String[] getCpSignature() {
return new String[0];
}
@@ -78,11 +78,11 @@
return new MockCpBands(this);
}
}
-
-
-
+
+
+
ClassBands classBands = new ClassBands(new MockSegment());
-
+
public void testSimple() throws IOException, Pack200Exception {
cpClasses = new String[] { "Class1", "Class2", "Class3", "Interface1", "Interface2" };
cpDescriptor = new String[0];
@@ -119,7 +119,7 @@
assertEquals(cpClasses[4], classBands.getClassInterfaces()[0][1]);
cpClasses = null;
}
-
+
public void testWithMethods() throws Pack200Exception, IOException {
cpClasses = new String[] { "Class1", "Class2", "Class3" };
cpDescriptor = new String[] {"method1", "method2", "method3"};
@@ -133,7 +133,7 @@
byte[] methodFlagsLo = classBands.encodeBandLong(new long[]{0, 0, 0}, Codec.UNSIGNED5);
byte[] classFlags = Codec.UNSIGNED5.encode(0, 0);
byte[][] allArrays = new byte[][] { classThis, classSuper,
- classInterfaceCount, classFieldCount, classMethodCount,
+ classInterfaceCount, classFieldCount, classMethodCount,
methodDescr, methodFlagsLo, classFlags, };
int total = 0;
for (int i = 0; i < allArrays.length; i++) {
@@ -156,15 +156,15 @@
assertEquals(cpDescriptor[0], classBands.getMethodDescr()[0][0]);
assertEquals(cpDescriptor[1], classBands.getMethodDescr()[0][1]);
assertEquals(cpDescriptor[2], classBands.getMethodDescr()[0][2]);
-
+
cpClasses = null;
cpDescriptor = null;
}
-
+
public void testWithFields() {
-
+
}
-
-
-
+
+
+
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodeAttributeTest.java Thu Jan 31 02:04:05 2008
@@ -123,7 +123,7 @@
Segment segment = new MockSegment();
CpBands cpBands = new MockCpBands(segment);
-
+
public byte[] mixedByteArray = { -47, // aload_0_getstatic_this 0, 1
-46, // aload_0_putstatic_this 4, 5
1, // aconst_null 8
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecEncodingTest.java Thu Jan 31 02:04:05 2008
@@ -29,11 +29,11 @@
import org.apache.harmony.pack200.Pack200Exception;
/**
- *
+ *
*/
public class CodecEncodingTest extends TestCase {
-
- public void testCanonicalEncodings() throws IOException, Pack200Exception {
+
+ public void testCanonicalEncodings() throws IOException, Pack200Exception {
Codec defaultCodec = new BHSDCodec(2,16,0,0);
assertEquals(defaultCodec,CodecEncoding.getCodec(0,null, defaultCodec));
Map map = new HashMap();
@@ -162,5 +162,5 @@
assertEquals("(5,128,2,1)",CodecEncoding.getCodec(116,new ByteArrayInputStream(new byte[] { 0x25, (byte)0x7F}), null).toString());
assertEquals("(2,128,1,1)",CodecEncoding.getCodec(116,new ByteArrayInputStream(new byte[] { 0x0B, (byte)0x7F}), null).toString());
}
-
+
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/CodecTest.java Thu Jan 31 02:04:05 2008
@@ -159,7 +159,7 @@
assertTrue(byte2s.encodes(128));
assertTrue(byte2s.encodes(191));
assertFalse(byte2s.encodes(192));
- assertFalse(byte2s.encodes(256));
+ assertFalse(byte2s.encodes(256));
}
public void testRunCodec() throws Exception {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/PopulationCodecTest.java Thu Jan 31 02:04:05 2008
@@ -44,7 +44,7 @@
private void checkDecode(byte[] data, long[] expectedResult, Codec codec) throws IOException, Pack200Exception {
InputStream in = new ByteArrayInputStream(data );
-
+
long[] result = new PopulationCodec(codec,codec,codec).decode(expectedResult.length,in);
assertEquals(expectedResult.length,result.length);
for(int i=0;i<expectedResult.length;i++) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentConstantPoolTest.java Thu Jan 31 02:04:05 2008
@@ -31,7 +31,7 @@
public MockSegmentConstantPool() {
super(new CpBands(new Segment()));
};
-
+
public int matchSpecificPoolEntryIndex(String[] classNameArray, String desiredClassName, int desiredIndex) {
return super.matchSpecificPoolEntryIndex(classNameArray, desiredClassName, desiredIndex);
};
@@ -53,13 +53,13 @@
assertEquals(3, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "java/lang/String", 1));
assertEquals(4, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "Object", 2));
assertEquals(5, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "Other", 0));
-
+
// Elements that don't exist shouldn't be found
assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "NotThere", 0));
-
+
// Elements that exist but don't have the requisite number
// of hits shouldn't be found.
- assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "java/lang/String", 2));
+ assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, "java/lang/String", 2));
}
public void testMatchSpecificPoolEntryIndex_DoubleArray() throws Exception {
@@ -71,14 +71,14 @@
assertEquals(3, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "java/lang/String", "<init>.*", 0));
assertEquals(4, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "Object", "isNull.*", 0));
assertEquals(5, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "Other", "Other", 0));
-
+
// Elements that don't exist shouldn't be found
assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "NotThere", "NotThere", 0));
assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "Object", "NotThere", 0));
-
+
// Elements that exist but don't have the requisite number
// of hits shouldn't be found.
- assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "java/lang/String", "<init>.*", 1));
+ assertEquals(-1, mockInstance.matchSpecificPoolEntryIndex(testClassArray, testMethodArray, "java/lang/String", "<init>.*", 1));
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentOptionsTest.java Thu Jan 31 02:04:05 2008
@@ -22,10 +22,10 @@
import org.apache.harmony.pack200.SegmentOptions;
/**
- *
+ *
*/
public class SegmentOptionsTest extends TestCase {
-
+
public void testUnused() {
int[] unused = new int[] { 3, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31 };
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java Thu Jan 31 02:04:05 2008
@@ -16,9 +16,13 @@
*/
package org.apache.harmony.pack200.tests;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import junit.framework.TestCase;
@@ -26,107 +30,42 @@
import org.apache.harmony.pack200.Segment;
/**
- * Tests for org.apache.harmony.pack200.Segment, which is the main class for pack200.
+ * Tests for org.apache.harmony.pack200.Segment.
*/
public class SegmentTest extends TestCase {
-
+
InputStream in;
JarOutputStream out;
- boolean handlingInnerClasses = false;
-
- public void testHelloWorld() throws Exception {
+ public void testHelloWorld() throws Exception {
in = Segment.class
.getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack");
Segment segment = Segment.parse(in);
assertNotNull(segment);
- out = new JarOutputStream(new FileOutputStream(File.createTempFile("hello", "world.jar")));
+ File file = File.createTempFile("hello", "world.jar");
+ out = new JarOutputStream(new FileOutputStream(file));
segment.writeJar(out);
+ out.close();
+ out = null;
+ JarFile jarFile = new JarFile(file);
+ JarEntry entry = jarFile.getJarEntry("org/apache/harmony/archive/tests/internal/pack200/HelloWorld.class");
+ assertNotNull(entry);
+ Process process = Runtime.getRuntime().exec("java -cp " + file.getName() + " org.apache.harmony.archive.tests.internal.pack200.HelloWorld", new String[] {}, file.getParentFile());
+ BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String line = reader.readLine();
+ assertEquals(line, "Hello world");
}
- public void testJustResources() throws Exception {
+ public void testJustResources() throws Exception {
in = Segment.class
.getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack");
Segment segment = Segment.parse(in);
assertNotNull(segment);
out = new JarOutputStream(new FileOutputStream(File.createTempFile("just", "resources.jar")));
segment.writeJar(out);
- }
-
- public void testJustResourcesGZip() throws Exception {
- in = Segment.class
- .getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack.gz");
- Segment segment = Segment.parse(in);
- assertNotNull(segment);
- out = new JarOutputStream(new FileOutputStream(File.createTempFile("Just", "ResourcesGz.jar")));
- segment.writeJar(out);
}
-
- // Test with an archive containing Harmony's SQL module, packed with -E1
- public void testWithSqlE1() throws Exception {
- in = Segment.class
- .getResourceAsStream("/org/apache/harmony/pack200/tests/sql-e1.pack.gz");
- Segment segment = Segment.parse(in);
- assertNotNull(segment);
- out = new JarOutputStream(new FileOutputStream(File.createTempFile("sql", "-e1.jar")));
- segment.writeJar(out);
- }
-
- // Test with an archive containing Harmony's SQL module
- public void testWithSql() throws Exception {
- if(!handlingInnerClasses) return;
- in = Segment.class
- .getResourceAsStream("/org/apache/harmony/pack200/tests/sql.pack.gz");
- Segment segment = Segment.parse(in);
- assertNotNull(segment);
- out = new JarOutputStream(new FileOutputStream(File.createTempFile("sql", ".jar")));
- segment.writeJar(out);
- }
-
- // Test with an archive containing Harmony's Pack200 module, packed with -E1
- public void testWithPack200E1() throws Exception {
- in = Segment.class
- .getResourceAsStream("/org/apache/harmony/pack200/tests/pack200-e1.pack.gz");
- Segment segment = Segment.parse(in);
- assertNotNull(segment);
- out = new JarOutputStream(new FileOutputStream(File.createTempFile("pack", "200-e1.jar")));
- segment.writeJar(out);
- }
-
- // Test with an archive containing Harmony's Pack200 module
- public void testWithPack200() throws Exception {
- in = Segment.class
- .getResourceAsStream("/org/apache/harmony/pack200/tests/pack200.pack.gz");
- Segment segment = Segment.parse(in);
- assertNotNull(segment);
- out = new JarOutputStream(new FileOutputStream(File.createTempFile("pack", "200.jar")));
- segment.writeJar(out);
- }
-
- // Test with an archive containing Harmony's JNDI module
- public void testWithJNDIE1() throws Exception {
- if(!handlingInnerClasses) return;
- in = Segment.class
- .getResourceAsStream("/org/apache/harmony/pack200/tests/jndi-e1.pack.gz");
- Segment segment = Segment.parse(in);
- assertNotNull(segment);
- out = new JarOutputStream(new FileOutputStream(File.createTempFile("jndi", "-e1.jar")));
- segment.writeJar(out);
- }
-
- // Test with an archive containing Annotations
- public void testWithAnnotations() throws Exception {
- in = Segment.class
- .getResourceAsStream("/org/apache/harmony/pack200/tests/annotations.pack.gz");
- Segment segment = Segment.parse(in);
- assertNotNull(segment);
- out = new JarOutputStream(new FileOutputStream(File.createTempFile("ann", "otations.jar")));
- segment.writeJar(out);
-
- }
-
- public void testInterfaceOnly() throws Exception {
+ public void testInterfaceOnly() throws Exception {
in = Segment.class
.getResourceAsStream("/org/apache/harmony/pack200/tests/InterfaceOnly.pack");
Segment segment = Segment.parse(in);
@@ -134,7 +73,7 @@
out = new JarOutputStream(new FileOutputStream(File.createTempFile("Interface", "Only.jar")));
segment.writeJar(out);
}
-
+
protected void tearDown() throws Exception {
super.tearDown();
try {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/bytecode/ClassFileEntryTest.java Thu Jan 31 02:04:05 2008
@@ -38,7 +38,7 @@
private void checkEquality(Object equal1, Object equal2, String toString, Object unequal) {
assertEquals(equal1,equal2);
assertEquals(equal1.hashCode(),equal2.hashCode());
- assertTrue(equal1.toString().indexOf(toString)>=0); //$NON-NLS-1$
+ assertTrue(equal1.toString().indexOf(toString)>=0);
assertFalse(equal1.equals(unequal));
assertFalse(equal2.equals(unequal));
assertFalse(unequal.equals(equal1));
Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/META-INF/MANIFEST.MF Thu Jan 31 02:04:05 2008
@@ -30,4 +30,5 @@
java.rmi.dgc,
java.rmi.registry,
java.rmi.server,
- javax.activity
+ javax.activity,
+ org.apache.harmony.rmi.transport;hy_usage="suncompat";mandatory:="hy_usage"
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Connection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Connection.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Connection.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Connection.java Thu Jan 31 02:04:05 2008
@@ -135,7 +135,7 @@
* one of :
* <ul>
* <li>{@link ResultSet#CONCUR_UPDATABLE}
- * <li>{@link ResultSet#CCONCUR_READ_ONLY}
+ * <li>{@link ResultSet#CONCUR_READ_ONLY}
* </ul>
* @return a new instance of <code>Statement</code> capable of
* manufacturing <code>ResultSet</code>s that satisfy the
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java Thu Jan 31 02:04:05 2008
@@ -81,7 +81,7 @@
/**
* {@inheritDoc}
*
- * @see java.sql.SQLOutput#writeArray(Array))
+ * @see java.sql.SQLOutput#writeArray(Array)
*/
@SuppressWarnings("unchecked")
public void writeArray(Array theArray) throws SQLException {
@@ -96,7 +96,7 @@
/**
* {@inheritDoc}
*
- * @see java.sql.SQLOutput#writeAsciiStream(InputStream))
+ * @see java.sql.SQLOutput#writeAsciiStream(InputStream)
*/
@SuppressWarnings("unchecked")
public void writeAsciiStream(InputStream theStream) throws SQLException {
@@ -118,7 +118,7 @@
/**
* {@inheritDoc}
*
- * @see java.sql.SQLOutput#writeBigDecimal(BigDecimal))
+ * @see java.sql.SQLOutput#writeBigDecimal(BigDecimal)
*/
@SuppressWarnings("unchecked")
public void writeBigDecimal(BigDecimal theBigDecimal) throws SQLException {
@@ -132,7 +132,7 @@
* and writeAsciiStream in RI. Keep their implementation same temporarily
* until some bug is found.
*
- * @see java.sql.SQLOutput#writeBinaryStream(InputStream))
+ * @see java.sql.SQLOutput#writeBinaryStream(InputStream)
*/
@SuppressWarnings("unchecked")
public void writeBinaryStream(InputStream theStream) throws SQLException {
@@ -142,7 +142,7 @@
/**
* {@inheritDoc}
*
- * @see java.sql.SQLOutput#writeBlob(Blob))
+ * @see java.sql.SQLOutput#writeBlob(Blob)
*/
@SuppressWarnings("unchecked")
public void writeBlob(Blob theBlob) throws SQLException {
@@ -187,7 +187,7 @@
/**
* {@inheritDoc}
*
- * @see java.sql.SQLOutput#writeCharacterStream(Reader))
+ * @see java.sql.SQLOutput#writeCharacterStream(Reader)
*/
@SuppressWarnings("unchecked")
public void writeCharacterStream(Reader theStream) throws SQLException {
Modified: harmony/enhanced/classlib/branches/java6/modules/suncompat/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/suncompat/META-INF/MANIFEST.MF?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/suncompat/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/suncompat/META-INF/MANIFEST.MF Thu Jan 31 02:04:05 2008
@@ -17,6 +17,7 @@
java.security,
org.apache.harmony.kernel.vm,
org.apache.harmony.luni.util,
- org.apache.harmony.xnet.provider.jsse;hy_usage=suncompat
+ org.apache.harmony.rmi.transport;hy_usage="suncompat",
+ org.apache.harmony.xnet.provider.jsse;hy_usage="suncompat"
Export-Package: com.sun.net.ssl.internal.ssl,
sun.misc
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/MessageFormat.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/MessageFormat.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/MessageFormat.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/main/java/java/text/MessageFormat.java Thu Jan 31 02:04:05 2008
@@ -446,6 +446,13 @@
* when the pattern cannot be parsed
*/
public static String format(String template, Object... objects) {
+ if (objects != null) {
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] == null) {
+ objects[i] = "null";
+ }
+ }
+ }
if (format == null) {
format = new com.ibm.icu.text.MessageFormat(template);
} else if (!template.equals(format.toPattern())){
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/MessageFormatTest.java Thu Jan 31 02:04:05 2008
@@ -763,6 +763,9 @@
String etalon="text here 000002007 and here";
MessageFormat obj = new MessageFormat(pat);
assertEquals(etalon, obj.format(new Object[]{new Date(1198141737640L)}));
+
+ assertEquals("{0}", MessageFormat.format("{0}", (Object[])null));
+ assertEquals("nullABC", MessageFormat.format("{0}{1}", new String[]{null, "ABC"}));
}
public void testHARMONY5323() {
Modified: harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java?rev=617085&r1=617084&r2=617085&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/text/src/test/java/org/apache/harmony/text/tests/java/text/SimpleDateFormatTest.java Thu Jan 31 02:04:05 2008
@@ -881,7 +881,6 @@
0xA0, 0x2007, 0x202F };
for (int i = 0; i < not_allowed_chars.length; i++) {
-System.out.println(i);
ParsePosition pp = new ParsePosition(0);
Date d = df.parse(not_allowed_chars[i] + "9:07", pp);
assertNull(d);
@@ -892,7 +891,6 @@
pp = new ParsePosition(0);
d = df.parse("09:07:" + not_allowed_chars[i] + "6", pp);
- System.out.println(d);
assertNull(d);
}
}