You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by qi...@apache.org on 2008/11/27 06:10:42 UTC
svn commit: r721077 [11/12] - in /harmony/enhanced/classlib/branches/java6:
./ depends/files/ depends/jars/ depends/manifests/asm-3.1/
depends/manifests/asm-3.1/META-INF/ depends/manifests/bcel-5.2/ make/
modules/accessibility/ modules/accessibility/sr...
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java Wed Nov 26 21:10:32 2008
@@ -21,44 +21,14 @@
import java.util.Iterator;
import java.util.List;
-import org.apache.bcel.classfile.Attribute;
-import org.apache.bcel.classfile.Code;
-import org.apache.bcel.classfile.CodeException;
-import org.apache.bcel.classfile.ConstantClass;
-import org.apache.bcel.classfile.ConstantDouble;
-import org.apache.bcel.classfile.ConstantFieldref;
-import org.apache.bcel.classfile.ConstantFloat;
-import org.apache.bcel.classfile.ConstantInteger;
-import org.apache.bcel.classfile.ConstantInterfaceMethodref;
-import org.apache.bcel.classfile.ConstantLong;
-import org.apache.bcel.classfile.ConstantMethodref;
-import org.apache.bcel.classfile.ConstantNameAndType;
-import org.apache.bcel.classfile.ConstantPool;
-import org.apache.bcel.classfile.ConstantString;
-import org.apache.bcel.classfile.ConstantUtf8;
-import org.apache.bcel.classfile.ConstantValue;
-import org.apache.bcel.classfile.Deprecated;
-import org.apache.bcel.classfile.DescendingVisitor;
-import org.apache.bcel.classfile.ExceptionTable;
-import org.apache.bcel.classfile.Field;
-import org.apache.bcel.classfile.InnerClass;
-import org.apache.bcel.classfile.InnerClasses;
-import org.apache.bcel.classfile.JavaClass;
-import org.apache.bcel.classfile.LineNumber;
-import org.apache.bcel.classfile.LineNumberTable;
-import org.apache.bcel.classfile.LocalVariable;
-import org.apache.bcel.classfile.LocalVariableTable;
-import org.apache.bcel.classfile.Method;
-import org.apache.bcel.classfile.Signature;
-import org.apache.bcel.classfile.SourceFile;
-import org.apache.bcel.classfile.StackMap;
-import org.apache.bcel.classfile.StackMapEntry;
-import org.apache.bcel.classfile.Synthetic;
-import org.apache.bcel.classfile.Unknown;
-import org.apache.bcel.classfile.Visitor;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
-
-public class Segment implements Visitor {
+public class Segment implements ClassVisitor {
private SegmentHeader segmentHeader;
private CpBands cpBands;
@@ -72,15 +42,23 @@
private String currentClass;
private String superClass;
+ private final SegmentFieldVisitor fieldVisitor = new SegmentFieldVisitor();
+ private final SegmentMethodVisitor methodVisitor = new SegmentMethodVisitor();
+ private final SegmentAnnotationVisitor annotationVisitor = new SegmentAnnotationVisitor();
+ private Pack200ClassReader currentClassReader;
- public void pack(List classes, List files, OutputStream out) throws IOException, Pack200Exception {
+ public void pack(List classes, List files, OutputStream out)
+ throws IOException, Pack200Exception {
segmentHeader = new SegmentHeader();
+ segmentHeader.setFile_count(files.size());
cpBands = new CpBands(segmentHeader);
- attributeDefinitionBands = new AttributeDefinitionBands(segmentHeader, cpBands);
- icBands = new IcBands(segmentHeader);
- classBands = new ClassBands(segmentHeader, cpBands, attributeDefinitionBands, classes.size());
- bcBands = new BcBands(cpBands);
- fileBands = new FileBands(segmentHeader, files);
+ attributeDefinitionBands = new AttributeDefinitionBands(segmentHeader,
+ cpBands);
+ icBands = new IcBands(segmentHeader, cpBands);
+ classBands = new ClassBands(segmentHeader, cpBands,
+ attributeDefinitionBands, classes.size());
+ bcBands = new BcBands(cpBands, this);
+ fileBands = new FileBands(cpBands, segmentHeader, files);
processClasses(classes);
@@ -89,6 +67,7 @@
icBands.finaliseBands();
classBands.finaliseBands();
bcBands.finaliseBands();
+ fileBands.finaliseBands();
segmentHeader.pack(out);
cpBands.pack(out);
@@ -102,172 +81,222 @@
private void processClasses(List classes) {
segmentHeader.setClass_count(classes.size());
for (Iterator iterator = classes.iterator(); iterator.hasNext();) {
- JavaClass javaClass = (JavaClass) iterator.next();
- new DescendingVisitor(javaClass, this).visit();
- }
- }
-
- public void visitCode(Code obj) {
- bcBands.addCode(obj, currentClass, superClass);
- Attribute[] attributes = obj.getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- if(attributes[i] instanceof Unknown) {
- attributeDefinitionBands.addUnknownAttribute((Unknown)attributes[i], obj);
- }
+ Pack200ClassReader classReader = (Pack200ClassReader) iterator
+ .next();
+ currentClassReader = classReader;
+ classReader.accept(this, 0);
}
}
- public void visitCodeException(CodeException obj) {
- // TODO Auto-generated method stub
-
+ public void visit(int version, int access, String name, String signature,
+ String superName, String[] interfaces) {
+ currentClass = name;
+ superClass = superName;
+ bcBands.setCurrentClass(name);
+ bcBands.setSuperClass(superName);
+ segmentHeader.addMajorVersion(version);
+ classBands.addClass(version, access, name, superName, interfaces);
}
- public void visitConstantClass(ConstantClass obj) {
- cpBands.addConstantClass(obj);
+ public void visitSource(String source, String debug) {
+ classBands.addSourceFile(source);
}
- public void visitConstantDouble(ConstantDouble obj) {
- cpBands.addConstantDouble(obj);
+ public void visitOuterClass(String owner, String name, String desc) {
+ classBands.addEnclosingMethod(owner, name, desc);
}
- public void visitConstantFieldref(ConstantFieldref obj) {
- cpBands.addConstantFieldref(obj);
+ public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) {
+ return annotationVisitor;
}
- public void visitConstantFloat(ConstantFloat obj) {
- cpBands.addConstantFloat(obj);
+ public void visitAttribute(Attribute arg0) {
}
- public void visitConstantInteger(ConstantInteger obj) {
- cpBands.addConstantInteger(obj);
+ public void visitInnerClass(String name, String outerName,
+ String innerName, int flags) {
+ icBands.addInnerClass(name, outerName, innerName, flags);
}
- public void visitConstantInterfaceMethodref(ConstantInterfaceMethodref obj) {
- cpBands.addConstantInterfaceMethodref(obj);
+ public FieldVisitor visitField(int flags, String name, String desc,
+ String signature, Object value) {
+ classBands.addField(flags, name, desc, signature, value);
+ return fieldVisitor;
}
- public void visitConstantLong(ConstantLong obj) {
- cpBands.addConstantLong(obj);
+ public MethodVisitor visitMethod(int flags, String name, String desc,
+ String signature, String[] exceptions) {
+ classBands.addMethod(flags, name, desc, signature, exceptions);
+ return methodVisitor;
}
- public void visitConstantMethodref(ConstantMethodref obj) {
- cpBands.addConstantMethodref(obj);
+ public void visitEnd() {
+ classBands.endOfClass();
}
- public void visitConstantNameAndType(ConstantNameAndType obj) {
- cpBands.addConstantNameAndType(obj);
- }
+ /*
+ * This class delegates to BcBands for bytecode related visits and to
+ * ClassBands for everything else
+ */
+ public class SegmentMethodVisitor implements MethodVisitor {
- public void visitConstantPool(ConstantPool obj) {
- }
+ public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) {
+ return annotationVisitor;
+ }
- public void visitConstantString(ConstantString obj) {
- cpBands.addConstantString(obj);
- }
+ public AnnotationVisitor visitAnnotationDefault() {
+ return annotationVisitor;
+ }
- public void visitConstantUtf8(ConstantUtf8 obj) {
- cpBands.addConstantUtf8(obj);
- }
+ public void visitAttribute(Attribute arg0) {
+ classBands.addUnknownMethodAttribute(arg0);
+ }
- public void visitConstantValue(ConstantValue obj) {
+ public void visitCode() {
+ classBands.addCode();
+ }
- }
+ public void visitFrame(int arg0, int arg1, Object[] arg2, int arg3,
+ Object[] arg4) {
+ // TODO Auto-generated method stub
- public void visitDeprecated(Deprecated obj) {
- // TODO Auto-generated method stub
- }
+ }
- public void visitExceptionTable(ExceptionTable obj) {
- // TODO Auto-generated method stub
- }
+ public void visitLabel(Label label) {
+ bcBands.visitLabel(label);
+ }
- public void visitField(Field obj) {
- cpBands.addCPNameAndType(obj.getName(), obj.getSignature());
- Attribute[] attributes = obj.getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- if(attributes[i] instanceof Unknown) {
- attributeDefinitionBands.addUnknownAttribute((Unknown)attributes[i], obj);
- }
+ public void visitLineNumber(int line, Label start) {
+ classBands.addLineNumber(line, start);
}
- }
- public void visitInnerClass(InnerClass obj) {
+ public void visitLocalVariable(String name, String desc,
+ String signature, Label start, Label end, int index) {
+ classBands.addLocalVariable(name, desc, signature, start, end,
+ index);
+ }
- }
+ public void visitMaxs(int maxStack, int maxLocals) {
+ classBands.addMaxStack(maxStack, maxLocals);
+ }
- public void visitInnerClasses(InnerClasses obj) {
- icBands.addInnerClasses(obj);
- }
+ public AnnotationVisitor visitParameterAnnotation(int arg0,
+ String arg1, boolean arg2) {
+ return annotationVisitor;
+ }
- public void visitJavaClass(JavaClass obj) {
- cpBands.setCurrentClass(obj);
- currentClass = obj.getClassName();
- superClass = obj.getSuperclassName();
- classBands.addClass(obj);
- segmentHeader.addMinorVersion(obj.getMinor());
- segmentHeader.addMajorVersion(obj.getMajor());
- Attribute[] attributes = obj.getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- if(attributes[i] instanceof Unknown) {
- attributeDefinitionBands.addUnknownAttribute((Unknown)attributes[i], obj);
- }
+ public void visitTryCatchBlock(Label start, Label end, Label handler,
+ String type) {
+ classBands.addHandler(start, end, handler, type);
}
- }
- public void visitLineNumber(LineNumber obj) {
- // TODO Auto-generated method stub
+ public void visitEnd() {
+ bcBands.visitEnd();
+ }
- }
+ public void visitFieldInsn(int opcode, String owner, String name,
+ String desc) {
+ bcBands.visitFieldInsn(opcode, owner, name, desc);
+ }
- public void visitLineNumberTable(LineNumberTable obj) {
- // TODO Auto-generated method stub
+ public void visitIincInsn(int var, int increment) {
+ bcBands.visitIincInsn(var, increment);
+ }
- }
+ public void visitInsn(int opcode) {
+ bcBands.visitInsn(opcode);
+ }
- public void visitLocalVariable(LocalVariable obj) {
- cpBands.addCPSignature(obj.getSignature());
- }
+ public void visitIntInsn(int opcode, int operand) {
+ bcBands.visitIntInsn(opcode, operand);
+ }
- public void visitLocalVariableTable(LocalVariableTable obj) {
- // TODO Auto-generated method stub
+ public void visitJumpInsn(int opcode, Label label) {
+ bcBands.visitJumpInsn(opcode, label);
+ }
- }
+ public void visitLdcInsn(Object cst) {
+ bcBands.visitLdcInsn(cst);
+ }
- public void visitMethod(Method obj) {
- cpBands.addCPNameAndType(obj.getName(), obj.getSignature());
- Attribute[] attributes = obj.getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- if(attributes[i] instanceof Unknown) {
- attributeDefinitionBands.addUnknownAttribute((Unknown)attributes[i], obj);
- }
+ public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
+ bcBands.visitLookupSwitchInsn(dflt, keys, labels);
+ }
+
+ public void visitMethodInsn(int opcode, String owner, String name,
+ String desc) {
+ bcBands.visitMethodInsn(opcode, owner, name, desc);
+ }
+
+ public void visitMultiANewArrayInsn(String desc, int dimensions) {
+ bcBands.visitMultiANewArrayInsn(desc, dimensions);
+ }
+
+ public void visitTableSwitchInsn(int min, int max, Label dflt,
+ Label[] labels) {
+ bcBands.visitTableSwitchInsn(min, max, dflt, labels);
+ }
+
+ public void visitTypeInsn(int opcode, String type) {
+ bcBands.visitTypeInsn(opcode, type);
}
- }
- public void visitSignature(Signature obj) {
+ public void visitVarInsn(int opcode, int var) {
+ bcBands.visitVarInsn(opcode, var);
+ }
}
- public void visitSourceFile(SourceFile obj) {
- // TODO Auto-generated method stub
+ public ClassBands getClassBands() {
+ return classBands;
}
- public void visitStackMap(StackMap obj) {
- // TODO Auto-generated method stub
+ public class SegmentAnnotationVisitor implements AnnotationVisitor {
- }
+ public void visit(String arg0, Object arg1) {
+ // TODO Auto-generated method stub
+
+ }
- public void visitStackMapEntry(StackMapEntry obj) {
- // TODO Auto-generated method stub
+ public AnnotationVisitor visitAnnotation(String arg0, String arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
- }
+ public AnnotationVisitor visitArray(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
- public void visitSynthetic(Synthetic obj) {
- // TODO Auto-generated method stub
+ public void visitEnd() {
+ // TODO Auto-generated method stub
+ }
+
+ public void visitEnum(String arg0, String arg1, String arg2) {
+ // TODO Auto-generated method stub
+
+ }
}
- public void visitUnknown(Unknown obj) {
+ public class SegmentFieldVisitor implements FieldVisitor {
+
+ public AnnotationVisitor visitAnnotation(String arg0, boolean arg1) {
+ return annotationVisitor;
+ }
+
+ public void visitAttribute(Attribute arg0) {
+ classBands.addUnknownFieldAttribute(arg0);
+ }
+
+ public void visitEnd() {
+ // TODO Auto-generated method stub
+
+ }
}
+ public boolean lastConstantHadWideIndex() {
+ return currentClassReader.lastConstantHadWideIndex();
+ }
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java Wed Nov 26 21:10:32 2008
@@ -46,7 +46,7 @@
private int attribute_definition_count;
private final byte[] band_headers = new byte[0];
- private boolean have_all_code_flags;
+ private boolean have_all_code_flags = true; // true by default
private int archive_size_hi;
private int archive_size_lo;
@@ -56,16 +56,15 @@
private boolean deflate_hint;
private boolean have_file_modtime;
- private boolean have_file_options;
- private boolean have_file_size_hi;
- private boolean have_class_flags_hi;
- private boolean have_field_flags_hi;
- private boolean have_method_flags_hi;
- private boolean have_code_flags_hi;
+ private boolean have_file_options = true;
+ private boolean have_file_size_hi;
+ private boolean have_class_flags_hi;
+ private boolean have_field_flags_hi;
+ private boolean have_method_flags_hi;
+ private boolean have_code_flags_hi;
private int ic_count;
private int class_count;
- private final Counter minverCounter = new Counter();
private final Counter majverCounter = new Counter();
/**
@@ -87,40 +86,41 @@
}
private void calculateArchiveOptions() {
- if(attribute_definition_count > 0 || band_headers.length > 0) {
+ if (attribute_definition_count > 0 || band_headers.length > 0) {
archive_options |= 1;
}
- if(cp_Int_count > 0 || cp_Float_count > 0 || cp_Long_count > 0 || cp_Double_count > 0) {
+ if (cp_Int_count > 0 || cp_Float_count > 0 || cp_Long_count > 0
+ || cp_Double_count > 0) {
archive_options |= (1 << 1);
}
- if(have_all_code_flags) {
+ if (have_all_code_flags) {
archive_options |= (1 << 2);
}
- if(file_count > 0) {
+ if (file_count > 0) {
archive_options |= (1 << 4);
}
- if(deflate_hint) {
+ if (deflate_hint) {
archive_options |= (1 << 5);
}
- if(have_file_modtime) {
+ if (have_file_modtime) {
archive_options |= (1 << 6);
}
- if(have_file_options) {
+ if (have_file_options) {
archive_options |= (1 << 7);
}
- if(have_file_size_hi) {
+ if (have_file_size_hi) {
archive_options |= (1 << 8);
}
- if(have_class_flags_hi) {
+ if (have_class_flags_hi) {
archive_options |= (1 << 9);
}
- if(have_field_flags_hi) {
+ if (have_field_flags_hi) {
archive_options |= (1 << 10);
}
- if(have_method_flags_hi) {
+ if (have_method_flags_hi) {
archive_options |= (1 << 11);
}
- if(have_code_flags_hi) {
+ if (have_code_flags_hi) {
archive_options |= (1 << 12);
}
}
@@ -177,97 +177,78 @@
this.attribute_definition_count = attribute_definition_count;
}
-
public void setHave_all_code_flags(boolean have_all_code_flags) {
this.have_all_code_flags = have_all_code_flags;
}
-
public void setArchive_size_hi(int archive_size_hi) {
this.archive_size_hi = archive_size_hi;
}
-
public void setArchive_size_lo(int archive_size_lo) {
this.archive_size_lo = archive_size_lo;
}
-
public void setArchive_next_count(int archive_next_count) {
this.archive_next_count = archive_next_count;
}
-
public void setArchive_modtime(int archive_modtime) {
this.archive_modtime = archive_modtime;
}
-
public void setFile_count(int file_count) {
this.file_count = file_count;
}
-
public void setDeflate_hint(boolean deflate_hint) {
this.deflate_hint = deflate_hint;
}
-
public void setHave_file_modtime(boolean have_file_modtime) {
this.have_file_modtime = have_file_modtime;
}
-
public void setHave_file_options(boolean have_file_options) {
this.have_file_options = have_file_options;
}
-
public void setHave_file_size_hi(boolean have_file_size_hi) {
this.have_file_size_hi = have_file_size_hi;
}
-
public void setHave_class_flags_hi(boolean have_class_flags_hi) {
this.have_class_flags_hi = have_class_flags_hi;
}
-
public void setHave_field_flags_hi(boolean have_field_flags_hi) {
this.have_field_flags_hi = have_field_flags_hi;
}
-
public void setHave_method_flags_hi(boolean have_method_flags_hi) {
this.have_method_flags_hi = have_method_flags_hi;
}
-
public void setHave_code_flags_hi(boolean have_code_flags_hi) {
this.have_code_flags_hi = have_code_flags_hi;
}
-
public boolean have_class_flags_hi() {
return have_class_flags_hi;
}
-
public boolean have_field_flags_hi() {
return have_field_flags_hi;
}
-
public boolean have_method_flags_hi() {
return have_method_flags_hi;
}
-
public boolean have_code_flags_hi() {
return have_code_flags_hi;
}
-
public void setIc_count(int ic_count) {
this.ic_count = ic_count;
}
@@ -276,9 +257,10 @@
this.class_count = class_count;
}
- private void writeCpCounts(OutputStream out) throws IOException, Pack200Exception {
+ private void writeCpCounts(OutputStream out) throws IOException,
+ Pack200Exception {
out.write(encodeScalar(cp_Utf8_count, Codec.UNSIGNED5));
- if((archive_options & (1 << 1)) != 0) { // have_cp_numbers
+ if ((archive_options & (1 << 1)) != 0) { // have_cp_numbers
out.write(encodeScalar(cp_Int_count, Codec.UNSIGNED5));
out.write(encodeScalar(cp_Float_count, Codec.UNSIGNED5));
out.write(encodeScalar(cp_Long_count, Codec.UNSIGNED5));
@@ -293,8 +275,9 @@
out.write(encodeScalar(cp_Imethod_count, Codec.UNSIGNED5));
}
- private void writeClassCounts(OutputStream out) throws IOException, Pack200Exception {
- int default_class_minver = minverCounter.getMostCommon();
+ private void writeClassCounts(OutputStream out) throws IOException,
+ Pack200Exception {
+ int default_class_minver = 0;
int default_class_majver = majverCounter.getMostCommon();
out.write(encodeScalar(ic_count, Codec.UNSIGNED5));
out.write(encodeScalar(default_class_minver, Codec.UNSIGNED5));
@@ -302,15 +285,19 @@
out.write(encodeScalar(class_count, Codec.UNSIGNED5));
}
- private void writeArchiveSpecialCounts(OutputStream out) throws IOException, Pack200Exception {
- if((archive_options & 1) > 0) { // have_special_formats
+ private void writeArchiveSpecialCounts(OutputStream out)
+ throws IOException, Pack200Exception {
+ if ((archive_options & 1) > 0) { // have_special_formats
out.write(encodeScalar(band_headers.length, Codec.UNSIGNED5));
- out.write(encodeScalar(attribute_definition_count, Codec.UNSIGNED5));
+ out
+ .write(encodeScalar(attribute_definition_count,
+ Codec.UNSIGNED5));
}
}
- private void writeArchiveFileCounts(OutputStream out) throws IOException, Pack200Exception {
- if((archive_options & (1 << 4)) > 0) { // have_file_headers
+ private void writeArchiveFileCounts(OutputStream out) throws IOException,
+ Pack200Exception {
+ if ((archive_options & (1 << 4)) > 0) { // have_file_headers
out.write(encodeScalar(archive_size_hi, Codec.UNSIGNED5));
out.write(encodeScalar(archive_size_lo, Codec.UNSIGNED5));
out.write(encodeScalar(archive_next_count, Codec.UNSIGNED5));
@@ -319,10 +306,6 @@
}
}
- public void addMinorVersion(int minor) {
- minverCounter.add(minor);
- }
-
public void addMajorVersion(int major) {
majverCounter.add(major);
}
@@ -339,16 +322,16 @@
public void add(int obj) {
boolean found = false;
for (int i = 0; i < length; i++) {
- if(objs[i] == obj) {
+ if (objs[i] == obj) {
counts[i]++;
found = true;
}
}
- if(!found) {
+ if (!found) {
objs[length] = obj;
counts[length] = 1;
- length ++;
- if(length > objs.length - 1) {
+ length++;
+ if (length > objs.length - 1) {
Object[] newArray = new Object[objs.length + 8];
System.arraycopy(objs, 0, newArray, 0, length);
}
@@ -358,7 +341,7 @@
public int getMostCommon() {
int returnIndex = 0;
for (int i = 0; i < length; i++) {
- if(counts[i] > counts[returnIndex]) {
+ if (counts[i] > counts[returnIndex]) {
returnIndex = i;
}
}
@@ -367,11 +350,23 @@
}
public int getDefaultMinorVersion() {
- return minverCounter.getMostCommon();
+ return 0;
}
public int getDefaultMajorVersion() {
return majverCounter.getMostCommon();
}
+ public boolean have_file_size_hi() {
+ return have_file_size_hi;
+ }
+
+ public boolean have_file_modtime() {
+ return have_file_modtime;
+ }
+
+ public boolean have_file_options() {
+ return have_file_options;
+ }
+
}
\ No newline at end of file
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/AttrDefinitionBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/AttrDefinitionBands.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/AttrDefinitionBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/AttrDefinitionBands.java Wed Nov 26 21:10:32 2008
@@ -21,6 +21,18 @@
import org.apache.harmony.pack200.Codec;
import org.apache.harmony.pack200.Pack200Exception;
+import org.apache.harmony.unpack200.bytecode.AnnotationDefaultAttribute;
+import org.apache.harmony.unpack200.bytecode.CodeAttribute;
+import org.apache.harmony.unpack200.bytecode.ConstantValueAttribute;
+import org.apache.harmony.unpack200.bytecode.DeprecatedAttribute;
+import org.apache.harmony.unpack200.bytecode.EnclosingMethodAttribute;
+import org.apache.harmony.unpack200.bytecode.ExceptionsAttribute;
+import org.apache.harmony.unpack200.bytecode.InnerClassesAttribute;
+import org.apache.harmony.unpack200.bytecode.LineNumberTableAttribute;
+import org.apache.harmony.unpack200.bytecode.LocalVariableTableAttribute;
+import org.apache.harmony.unpack200.bytecode.LocalVariableTypeTableAttribute;
+import org.apache.harmony.unpack200.bytecode.SignatureAttribute;
+import org.apache.harmony.unpack200.bytecode.SourceFileAttribute;
/**
* Attribute definition bands are the set of bands used to define extra
@@ -76,12 +88,32 @@
attributeDefinitionMap.add(layout, newBands);
}
attributeDefinitionMap.checkMap();
+ setupDefaultAttributeNames();
}
public void unpack() throws Pack200Exception, IOException {
}
+ private void setupDefaultAttributeNames() {
+ AnnotationDefaultAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("AnnotationDefault")); //$NON-NLS-1$
+ CodeAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("Code")); //$NON-NLS-1$
+ ConstantValueAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("ConstantValue")); //$NON-NLS-1$
+ DeprecatedAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("Deprecated")); //$NON-NLS-1$
+ EnclosingMethodAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("EnclosingMethod")); //$NON-NLS-1$
+ ExceptionsAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("Exceptions")); //$NON-NLS-1$
+ InnerClassesAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("InnerClasses")); //$NON-NLS-1$
+ LineNumberTableAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("LineNumberTable")); //$NON-NLS-1$
+ LocalVariableTableAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("LocalVariableTable")); //$NON-NLS-1$
+ LocalVariableTypeTableAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("LocalVariableTypeTable")); //$NON-NLS-1$
+ SignatureAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("Signature")); //$NON-NLS-1$
+ SourceFileAttribute.setAttributeName(segment.getCpBands().cpUTF8Value("SourceFile")); //$NON-NLS-1$
+ MetadataBandGroup.setRvaAttributeName(segment.getCpBands().cpUTF8Value("RuntimeVisibleAnnotations"));
+ MetadataBandGroup.setRiaAttributeName(segment.getCpBands().cpUTF8Value("RuntimeInvisibleAnnotations"));
+ MetadataBandGroup.setRvpaAttributeName(segment.getCpBands().cpUTF8Value("RuntimeVisibleParameterAnnotations"));
+ MetadataBandGroup.setRipaAttributeName(segment.getCpBands().cpUTF8Value("RuntimeInvisibleParameterAnnotations"));
+ }
+
public AttributeLayoutMap getAttributeDefinitionMap() {
return attributeDefinitionMap;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/AttributeLayout.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/AttributeLayout.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/AttributeLayout.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/AttributeLayout.java Wed Nov 26 21:10:32 2008
@@ -171,14 +171,14 @@
}
public Codec getCodec() {
- if (layout.indexOf("O") >= 0) { //$NON-NLS-1$
+ if (layout.indexOf('O') >= 0) {
return Codec.BRANCH5;
- } else if (layout.indexOf("P") >= 0) { //$NON-NLS-1$
+ } else if (layout.indexOf('P') >= 0) {
return Codec.BCI5;
- } else if (layout.indexOf("S") >= 0 && layout.indexOf("KS") < 0 //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (layout.indexOf('S') >= 0 && layout.indexOf("KS") < 0 //$NON-NLS-1$
&& layout.indexOf("RS") < 0) { //$NON-NLS-1$
return Codec.SIGNED5;
- } else if (layout.indexOf("B") >= 0) { //$NON-NLS-1$
+ } else if (layout.indexOf('B') >= 0) {
return Codec.BYTE1;
} else {
return Codec.UNSIGNED5;
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/BandSet.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/BandSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/BandSet.java Wed Nov 26 21:10:32 2008
@@ -268,15 +268,6 @@
return band;
}
- public byte[] encodeBandLong(long[] data, BHSDCodec codec)
- throws IOException, Pack200Exception {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- for (int i = 0; i < data.length; i++) {
- baos.write(codec.encode(data[i], i == 0 ? 0 : data[i - 1]));
- }
- return baos.toByteArray();
- }
-
public long[] parseFlags(String name, InputStream in, int count,
BHSDCodec codec, boolean hasHi) throws IOException,
Pack200Exception {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/ClassBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/ClassBands.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/ClassBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/ClassBands.java Wed Nov 26 21:10:32 2008
@@ -406,9 +406,6 @@
exceptionClasses));
methodExceptionsIndex++;
}
- if (deprecatedLayout.matches(flag)) {
- methodAttributes[i][j].add(new DeprecatedAttribute());
- }
if (methodSignatureLayout.matches(flag)) {
// We've got a signature attribute
long result = methodSignatureRS[methodSignatureIndex];
@@ -425,6 +422,9 @@
.add(new SignatureAttribute(value));
methodSignatureIndex++;
}
+ if (deprecatedLayout.matches(flag)) {
+ methodAttributes[i][j].add(new DeprecatedAttribute());
+ }
// Non-predefined attributes
for (int k = 0; k < otherLayouts.length; k++) {
if (otherLayouts[k] != null
@@ -1003,7 +1003,7 @@
for (int i = 0; i < RxA.length; i++) {
mbg[i] = new MetadataBandGroup(RxA[i], cpBands);
String rxa = RxA[i];
- if (rxa.indexOf("P") >= 0) {
+ if (rxa.indexOf('P') >= 0) {
mbg[i].param_NB = decodeBandInt(contextName + "_" + rxa
+ "_param_NB", in, Codec.BYTE1, RxACount[i]);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcBands.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcBands.java Wed Nov 26 21:10:32 2008
@@ -134,7 +134,7 @@
// this relation is 1:M
// If it's not anon and the outer is not anon, it could be relevant
- if (!tuple.isAnonymous() && !tuple.outerIsAnonymous()) {
+ if ( (!tuple.isAnonymous() && !tuple.outerIsAnonymous()) || (tuple.nestedExplicitFlagSet()) ) {
// add tuple to corresponding bucket
String key = tuple.outerClassString();
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/IcTuple.java Wed Nov 26 21:10:32 2008
@@ -90,6 +90,16 @@
return predictOuter || predictSimple;
}
+
+ /**
+ * Answer true if the receiver's bit 16 is set (indicating
+ * that explicit outer class and name fields are set).
+ * @return boolean
+ */
+ public boolean nestedExplicitFlagSet() {
+ return (F & NESTED_CLASS_FLAG) == NESTED_CLASS_FLAG;
+ }
+
/**
* Break the receiver into components at $ boundaries.
*/
@@ -237,7 +247,7 @@
if (isAllDigits(cachedSimpleClassName)) {
anonymous = true;
member = false;
- if ((F & 65536) == 65536) {
+ if (nestedExplicitFlagSet()) {
// Predicted class - marking as member
member = true;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java Wed Nov 26 21:10:32 2008
@@ -42,12 +42,26 @@
private final String type;
private final CpBands cpBands;
- private final CPUTF8 rvaUTF8 = new CPUTF8("RuntimeVisibleAnnotations");
- private final CPUTF8 riaUTF8 = new CPUTF8("RuntimeInvisibleAnnotations");
- private final CPUTF8 rvpaUTF8 = new CPUTF8(
- "RuntimeVisibleParameterAnnotations");
- private final CPUTF8 ripaUTF8 = new CPUTF8(
- "RuntimeInvisibleParameterAnnotations");
+ private static CPUTF8 rvaUTF8;
+ private static CPUTF8 riaUTF8;
+ private static CPUTF8 rvpaUTF8;
+ private static CPUTF8 ripaUTF8;
+
+ public static void setRvaAttributeName(CPUTF8 cpUTF8Value) {
+ rvaUTF8 = cpUTF8Value;
+ }
+
+ public static void setRiaAttributeName(CPUTF8 cpUTF8Value) {
+ riaUTF8 = cpUTF8Value;
+ }
+
+ public static void setRvpaAttributeName(CPUTF8 cpUTF8Value) {
+ rvpaUTF8 = cpUTF8Value;
+ }
+
+ public static void setRipaAttributeName(CPUTF8 cpUTF8Value) {
+ ripaUTF8 = cpUTF8Value;
+ }
public MetadataBandGroup(String type, CpBands cpBands) {
this.type = type;
@@ -227,7 +241,7 @@
}
return nestedArray;
case '@':
- CPUTF8 type = (CPUTF8) nesttype_RS[nesttype_RS_Index++];
+ CPUTF8 type = nesttype_RS[nesttype_RS_Index++];
int numPairs = nestpair_N[nestpair_N_Index++];
return getAnnotation(type, numPairs, nestname_RU_Iterator);
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java Wed Nov 26 21:10:32 2008
@@ -874,14 +874,14 @@
* @param layoutElement
*/
public BHSDCodec getCodec(String layoutElement) {
- if (layoutElement.indexOf("O") >= 0) { //$NON-NLS-1$
+ if (layoutElement.indexOf('O') >= 0) {
return Codec.BRANCH5;
- } else if (layoutElement.indexOf("P") >= 0) { //$NON-NLS-1$
+ } else if (layoutElement.indexOf('P') >= 0) {
return Codec.BCI5;
- } else if (layoutElement.indexOf("S") >= 0 && layoutElement.indexOf("KS") < 0 //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (layoutElement.indexOf('S') >= 0 && layoutElement.indexOf("KS") < 0 //$NON-NLS-1$
&& layoutElement.indexOf("RS") < 0) { //$NON-NLS-1$
return Codec.SIGNED5;
- } else if (layoutElement.indexOf("B") >= 0) { //$NON-NLS-1$
+ } else if (layoutElement.indexOf('B') >= 0) {
return Codec.BYTE1;
} else {
return Codec.UNSIGNED5;
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/Segment.java Wed Nov 26 21:10:32 2008
@@ -28,6 +28,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.TimeZone;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.zip.GZIPInputStream;
@@ -111,12 +112,15 @@
private ClassFile buildClassFile(int classNum) throws Pack200Exception {
ClassFile classFile = new ClassFile();
- classFile.major = header.getDefaultClassMajorVersion(); // TODO If
- // classVersionMajor[] use
- // that instead
- classFile.minor = header.getDefaultClassMinorVersion(); // TODO if
- // classVersionMinor[] use
- // that instead
+ int[] major = classBands.getClassVersionMajor();
+ int[] minor = classBands.getClassVersionMinor();
+ if(major != null) {
+ classFile.major = major[classNum];
+ classFile.minor = minor[classNum];
+ } else {
+ classFile.major = header.getDefaultClassMajorVersion();
+ classFile.minor = header.getDefaultClassMinorVersion();
+ }
// build constant pool
ClassConstantPool cp = classFile.pool;
int fullNameIndexInCpClass = classBands.getClassThisInts()[classNum];
@@ -532,13 +536,20 @@
for (int i = 0; i < numberOfFiles; i++) {
String name = fileName[i];
- long modtime = archiveModtime + fileModtime[i];
+ // For Pack200 archives, modtime is in seconds
+ // from the epoch. JarEntries need it to be in
+ // milliseconds from the epoch.
+ // Even though we're adding two longs and multiplying
+ // by 1000, we won't overflow because both longs are
+ // always under 2^32.
+ long modtime = 1000 * (archiveModtime + fileModtime[i]);
boolean deflate = fileDeflate[i];
JarEntry entry = new JarEntry(name);
if (deflate)
entry.setMethod(ZipEntry.DEFLATED);
- entry.setTime(modtime);
+ // On Windows at least, need to correct for timezone
+ entry.setTime(modtime - TimeZone.getDefault().getRawOffset());
out.putNextEntry(entry);
if (fileIsClass[i]) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentUtils.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentUtils.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/SegmentUtils.java Wed Nov 26 21:10:32 2008
@@ -42,8 +42,8 @@
* @return integer count
*/
protected static int countArgs(String descriptor, int widthOfLongsAndDoubles) {
- int bra = descriptor.indexOf("(");
- int ket = descriptor.indexOf(")");
+ int bra = descriptor.indexOf('(');
+ int ket = descriptor.indexOf(')');
if (bra == -1 || ket == -1 || ket < bra)
throw new IllegalArgumentException("No arguments");
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java Wed Nov 26 21:10:32 2008
@@ -26,8 +26,11 @@
private final ElementValue element_value;
- private static final CPUTF8 attributeName = new CPUTF8("AnnotationDefault");
+ private static CPUTF8 attributeName;
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public AnnotationDefaultAttribute(ElementValue element_value) {
super(attributeName);
this.element_value = element_value;
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java Wed Nov 26 21:10:32 2008
@@ -33,7 +33,7 @@
public List exceptionTable; // of ExceptionTableEntry
public int maxLocals;
public int maxStack;
- private static final CPUTF8 attributeName = new CPUTF8("Code");
+ private static CPUTF8 attributeName;
public CodeAttribute(int maxStack, int maxLocals, byte codePacked[],
Segment segment, OperandManager operandManager, List exceptionTable) {
@@ -192,4 +192,8 @@
entry.renumber(byteCodeOffsets);
}
}
+
+ public static void setAttributeName(CPUTF8 attributeName) {
+ CodeAttribute.attributeName = attributeName;
+ }
}
\ No newline at end of file
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java Wed Nov 26 21:10:32 2008
@@ -28,8 +28,11 @@
private final ClassFileEntry entry;
- private static final CPUTF8 attributeName = new CPUTF8(
- "ConstantValue"); //$NON-NLS-1$
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public ConstantValueAttribute(ClassFileEntry entry) {
super(attributeName);
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java Wed Nov 26 21:10:32 2008
@@ -24,7 +24,11 @@
*/
public class DeprecatedAttribute extends Attribute {
- private static final CPUTF8 attributeName = new CPUTF8("Deprecated");
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public DeprecatedAttribute() {
super(attributeName);
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java Wed Nov 26 21:10:32 2008
@@ -28,8 +28,11 @@
private int method_index;
private final CPClass cpClass;
private final CPNameAndType method;
- private static final CPUTF8 attributeName = new CPUTF8(
- "EnclosingMethod"); //$NON-NLS-1$
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public EnclosingMethodAttribute(CPClass cpClass, CPNameAndType method) {
super(attributeName);
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java Wed Nov 26 21:10:32 2008
@@ -25,8 +25,7 @@
*/
public class ExceptionsAttribute extends Attribute {
- private static final CPUTF8 attributeName = new CPUTF8(
- "Exceptions"); //$NON-NLS-1$
+ private static CPUTF8 attributeName;
private static int hashCode(Object[] array) {
final int prime = 31;
@@ -102,4 +101,8 @@
}
}
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
+
}
\ No newline at end of file
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java Wed Nov 26 21:10:32 2008
@@ -26,8 +26,11 @@
*/
public class InnerClassesAttribute extends Attribute {
- private static final CPUTF8 attributeName = new CPUTF8(
- "InnerClasses"); //$NON-NLS-1$
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
private static class InnerClassesEntry {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java Wed Nov 26 21:10:32 2008
@@ -27,8 +27,11 @@
private final int line_number_table_length;
private final int[] start_pcs;
private final int[] line_numbers;
- private static final CPUTF8 attributeName = new CPUTF8(
- "LineNumberTable"); //$NON-NLS-1$
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public LineNumberTableAttribute(int line_number_table_length,
int[] start_pcs, int[] line_numbers) {
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java Wed Nov 26 21:10:32 2008
@@ -37,8 +37,11 @@
private final CPUTF8[] names;
private final CPUTF8[] descriptors;
private int codeLength;
- private static final CPUTF8 attributeName = new CPUTF8(
- "LocalVariableTable"); //$NON-NLS-1$
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public LocalVariableTableAttribute(int local_variable_table_length,
int[] start_pcs, int[] lengths, CPUTF8[] names,
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java Wed Nov 26 21:10:32 2008
@@ -37,8 +37,11 @@
private final CPUTF8[] names;
private final CPUTF8[] signatures;
private int codeLength;
- private static final CPUTF8 attributeName = new CPUTF8(
- "LocalVariableTypeTable"); //$NON-NLS-1$
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public LocalVariableTypeTableAttribute(
int local_variable_type_table_length, int[] start_pcs,
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java Wed Nov 26 21:10:32 2008
@@ -27,7 +27,11 @@
private int signature_index;
private final CPUTF8 signature;
- private static final CPUTF8 attributeName = new CPUTF8("Signature");
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public SignatureAttribute(CPUTF8 value) {
super(attributeName);
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SourceFileAttribute.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SourceFileAttribute.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SourceFileAttribute.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/unpack200/bytecode/SourceFileAttribute.java Wed Nov 26 21:10:32 2008
@@ -26,8 +26,11 @@
private final CPUTF8 name;
private int nameIndex;
- private static final CPUTF8 attributeName = new CPUTF8(
- "SourceFile"); //$NON-NLS-1$
+ private static CPUTF8 attributeName;
+
+ public static void setAttributeName(CPUTF8 cpUTF8Value) {
+ attributeName = cpUTF8Value;
+ }
public SourceFileAttribute(CPUTF8 name) {
super(attributeName);
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/unpack200/Pack200PackerAdapter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/unpack200/Pack200PackerAdapter.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/unpack200/Pack200PackerAdapter.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java5/org/apache/harmony/unpack200/Pack200PackerAdapter.java Wed Nov 26 21:10:32 2008
@@ -52,7 +52,7 @@
"Must specify both input and output streams");
completed(0);
try {
- new org.apache.harmony.pack200.Archive(in, out).pack();
+ new org.apache.harmony.pack200.Archive(in, out, true).pack();
} catch (Pack200Exception e) {
throw new IOException("Failed to pack Jar:" + String.valueOf(e));
}
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ClassBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ClassBandsTest.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ClassBandsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/unpack200/tests/ClassBandsTest.java Wed Nov 26 21:10:32 2008
@@ -17,8 +17,10 @@
package org.apache.harmony.unpack200.tests;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import org.apache.harmony.pack200.BHSDCodec;
import org.apache.harmony.pack200.Codec;
import org.apache.harmony.pack200.Pack200Exception;
import org.apache.harmony.unpack200.ClassBands;
@@ -90,7 +92,7 @@
byte[] classThis = Codec.DELTA5.encode(1, 0);
byte[] classSuper = Codec.DELTA5.encode(2, 0);
byte[] classInterfaceCount = Codec.DELTA5.encode(2, 0);
- byte[] classInterfaceRef1 = classBands.encodeBandLong(
+ byte[] classInterfaceRef1 = encodeBandLong(
new long[] { 3, 4 }, Codec.DELTA5);
byte[] classFieldCount = Codec.DELTA5.encode(0, 0);
byte[] classMethodCount = Codec.DELTA5.encode(0, 0);
@@ -130,9 +132,9 @@
byte[] classInterfaceCount = Codec.DELTA5.encode(0, 0);
byte[] classFieldCount = Codec.DELTA5.encode(0, 0);
byte[] classMethodCount = Codec.DELTA5.encode(3, 0);
- byte[] methodDescr = classBands.encodeBandLong(new long[] { 0, 1, 2 },
+ byte[] methodDescr = encodeBandLong(new long[] { 0, 1, 2 },
Codec.MDELTA5);
- byte[] methodFlagsLo = classBands.encodeBandLong(
+ byte[] methodFlagsLo = encodeBandLong(
new long[] { 0, 0, 0 }, Codec.UNSIGNED5);
byte[] classFlags = Codec.UNSIGNED5.encode(0, 0);
byte[][] allArrays = new byte[][] { classThis, classSuper,
@@ -164,4 +166,14 @@
cpDescriptor = null;
}
+ public byte[] encodeBandLong(long[] data, BHSDCodec codec)
+ throws IOException, Pack200Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ for (int i = 0; i < data.length; i++) {
+ baos.write(codec.encode(data[i], i == 0 ? 0 : data[i - 1]));
+ }
+ return baos.toByteArray();
+ }
+
+
}
Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hysock.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hysock.c?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hysock.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hysock.c Wed Nov 26 21:10:32 2008
@@ -2597,7 +2597,7 @@
* \arg null, block indefinitely for a ready descriptor
*
* @param[in] portLibrary The port library.
- * @param[in] nfds Maximum number of file descriptors to be tested.
+ * @param[in] nfds Maximum number of file descriptors to be tested. Ignored by Windows Socket API.
* @param[in] readfds Tthe set of descriptors to be checked if ready for read operations.
* @param[in] writefds The set of descriptors to be checked if ready for write operations.
* @param[in] exceptfds The set of descriptors to be checked for exceptional conditions.
@@ -2778,7 +2778,7 @@
hysock_set_nonblocking (struct HyPortLibrary * portLibrary,
hysocket_t socketP, BOOLEAN nonblocking)
{
- I_32 rc;
+ I_32 rc = 0;
U_32 param = nonblocking;
/* If both the IPv4 and IPv6 socket are open then we want to set the option on both. If only one is open,
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/.classpath?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/.classpath (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/.classpath Wed Nov 26 21:10:32 2008
@@ -4,6 +4,6 @@
<classpathentry output="bin/test" kind="src" path="src/test/java"/>
<classpathentry output="bin/test" kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry sourcepath="JUNIT_SRC_HOME/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin/main"/>
</classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/print/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/.classpath?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/.classpath (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/.classpath Wed Nov 26 21:10:32 2008
@@ -5,6 +5,6 @@
<classpathentry kind="src" output="bin/test" path="src/test/api/java/common"/>
<classpathentry kind="src" output="bin/main" path="src/main/java/windows"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="var" path="JUNIT_HOME/junit.jar" sourcepath="JUNIT_SRC_HOME/junitsrc.zip"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin/main"/>
</classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/javax/print/attribute/AttributeSetUtilities.java Wed Nov 26 21:10:32 2008
@@ -24,7 +24,7 @@
private static class SynchronizedAttributeSet
implements AttributeSet, Serializable {
- static final long serialVersionUID = 8365731020128564925L;
+ private static final long serialVersionUID = 8365731020128564925L;
private AttributeSet aset;
@@ -92,7 +92,7 @@
extends SynchronizedAttributeSet
implements DocAttributeSet, Serializable {
- static final long serialVersionUID = 6455869095246629354L;
+ private static final long serialVersionUID = 6455869095246629354L;
public SynchronizedDocAttributeSet(DocAttributeSet attributeSet) {
super(attributeSet);
@@ -103,7 +103,7 @@
extends SynchronizedAttributeSet
implements PrintJobAttributeSet, Serializable {
- static final long serialVersionUID = 2117188707856965749L;
+ private static final long serialVersionUID = 2117188707856965749L;
public SynchronizedPrintJobAttributeSet
(PrintJobAttributeSet attributeSet) {
@@ -115,7 +115,7 @@
extends SynchronizedAttributeSet
implements PrintRequestAttributeSet, Serializable {
- static final long serialVersionUID = 5671237023971169027L;
+ private static final long serialVersionUID = 5671237023971169027L;
public SynchronizedPrintRequestAttributeSet
(PrintRequestAttributeSet attributeSet) {
@@ -127,7 +127,7 @@
extends SynchronizedAttributeSet
implements PrintServiceAttributeSet, Serializable {
- static final long serialVersionUID = -2830705374001675073L;
+ private static final long serialVersionUID = -2830705374001675073L;
public SynchronizedPrintServiceAttributeSet
(PrintServiceAttributeSet attributeSet) {
@@ -138,7 +138,7 @@
private static class UnmodifiableAttributeSet
implements AttributeSet, Serializable {
- static final long serialVersionUID = -6131802583863447813L;
+ private static final long serialVersionUID = -6131802583863447813L;
private AttributeSet aset;
@@ -206,7 +206,7 @@
extends UnmodifiableAttributeSet
implements DocAttributeSet, Serializable {
- static final long serialVersionUID = -6349408326066898956L;
+ private static final long serialVersionUID = -6349408326066898956L;
public UnmodifiableDocAttributeSet(DocAttributeSet attributeSet) {
super(attributeSet);
@@ -217,7 +217,7 @@
extends UnmodifiableAttributeSet
implements PrintJobAttributeSet, Serializable {
- static final long serialVersionUID = -8002245296274522112L;
+ private static final long serialVersionUID = -8002245296274522112L;
public UnmodifiablePrintJobAttributeSet
(PrintJobAttributeSet attributeSet) {
@@ -229,7 +229,7 @@
extends UnmodifiableAttributeSet
implements PrintRequestAttributeSet, Serializable {
- static final long serialVersionUID = 7799373532614825073L;
+ private static final long serialVersionUID = 7799373532614825073L;
public UnmodifiablePrintRequestAttributeSet
(PrintRequestAttributeSet attributeSet) {
@@ -241,7 +241,7 @@
extends UnmodifiableAttributeSet
implements PrintServiceAttributeSet, Serializable {
- static final long serialVersionUID = -7112165137107826819L;
+ private static final long serialVersionUID = -7112165137107826819L;
public UnmodifiablePrintServiceAttributeSet
(PrintServiceAttributeSet attributeSet) {
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/MimeType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/MimeType.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/MimeType.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/MimeType.java Wed Nov 26 21:10:32 2008
@@ -28,7 +28,7 @@
public class MimeType implements Serializable, Cloneable {
- static final long serialVersionUID = -1062742668693502508L;
+ private static final long serialVersionUID = -1062742668693502508L;
private String aType = null; // Media type
private String aSubtype = null; // Media subtype
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ServiceUIDialog.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ServiceUIDialog.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ServiceUIDialog.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ServiceUIDialog.java Wed Nov 26 21:10:32 2008
@@ -2019,7 +2019,7 @@
*/
private class DestinationChooser extends JFileChooser {
- static final long serialVersionUID = 5429146989329327138L;
+ private static final long serialVersionUID = 5429146989329327138L;
public void approveSelection() {
boolean doesFileExists = false; // Does selected file exist?
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/MediaMargins.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/MediaMargins.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/MediaMargins.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/MediaMargins.java Wed Nov 26 21:10:32 2008
@@ -67,7 +67,7 @@
PrintRequestAttribute
{
- static final long serialVersionUID = -7745492737636484477L;
+ private static final long serialVersionUID = -7745492737636484477L;
public static final int INCH = Size2DSyntax.INCH; // 25 400
public static final int MM = Size2DSyntax.MM; // 1 000
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/PPDMediaSizeName.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/PPDMediaSizeName.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/PPDMediaSizeName.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/PPDMediaSizeName.java Wed Nov 26 21:10:32 2008
@@ -40,7 +40,7 @@
*/
public class PPDMediaSizeName extends MediaSizeName {
- static final long serialVersionUID = -2117680157822011363L;
+ private static final long serialVersionUID = -2117680157822011363L;
public static final PPDMediaSizeName s10x11 = new PPDMediaSizeName(0, 720, 792);
public static final PPDMediaSizeName s10x13 = new PPDMediaSizeName(1, 720, 936);
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroup.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroup.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroup.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroup.java Wed Nov 26 21:10:32 2008
@@ -26,7 +26,7 @@
*/
public class IppAttributeGroup extends Vector {
- static final long serialVersionUID = -2197671478629444252L;
+ private static final long serialVersionUID = -2197671478629444252L;
/* According to RFC2910 (http://ietf.org/rfc/rfc2910.txt?number=2910):
*
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroupSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroupSet.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroupSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroupSet.java Wed Nov 26 21:10:32 2008
@@ -28,7 +28,7 @@
*/
public class IppAttributeGroupSet extends Hashtable {
- static final long serialVersionUID = -1273600082773438491L;
+ private static final long serialVersionUID = -1273600082773438491L;
static protected void sortAttributes(Vector va) {
Object v1, v2;
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppException.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppException.java Wed Nov 26 21:10:32 2008
@@ -18,7 +18,7 @@
public class IppException extends Exception {
- static final long serialVersionUID = -5855422273043510539L;
+ private static final long serialVersionUID = -5855422273043510539L;
IppException(String message) {
super(message);
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/util/IppMimeType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/util/IppMimeType.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/util/IppMimeType.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/util/IppMimeType.java Wed Nov 26 21:10:32 2008
@@ -20,7 +20,7 @@
public class IppMimeType extends MimeType {
- static final long serialVersionUID = 1492779006204043813L;
+ private static final long serialVersionUID = 1492779006204043813L;
/*
* @param mimeType
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java Wed Nov 26 21:10:32 2008
@@ -664,7 +664,7 @@
private static class GDIMediaName extends MediaSizeName {
- static final long serialVersionUID = 8176250163720875699L;
+ private static final long serialVersionUID = 8176250163720875699L;
private static GDIMediaName staticMediaName = new GDIMediaName(-1);
private String mediaName = null;
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/print.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/print.cpp?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/print.cpp (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/print.cpp Wed Nov 26 21:10:32 2008
@@ -51,7 +51,7 @@
return buffer;
} else {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- free(buffer);
+ delete[] buffer;
buffer = new char[buffer_size];
if (GetDefaultPrinter(buffer, &buffer_size)) {
return buffer;
@@ -108,7 +108,7 @@
jstring service = NULL;
if (serviceUTF != NULL) {
service = env->NewStringUTF(serviceUTF);
- free(serviceUTF);
+ delete[] serviceUTF;
}
return service;
}
@@ -162,7 +162,7 @@
}
}
}
- free(editableName);
+ delete[] editableName;
return result;
}
@@ -372,7 +372,7 @@
env->DeleteLocalRef(jname);
}
}
- free(buffer);
+ delete[] buffer;
}
free(info);
}
@@ -397,9 +397,9 @@
intIDs[i] = (int)ids[i];
}
env->SetIntArrayRegion(result, 0, numPapers, (jint *)intIDs);
- free(intIDs);
+ delete[] intIDs;
}
- free(ids);
+ delete[] ids;
}
free(info);
}
@@ -432,16 +432,16 @@
int count = DeviceCapabilities(name, info->pPortName, DC_ENUMRESOLUTIONS, NULL, NULL);
if (count > 0) {
LONG *nativeArray = new LONG[count * 2];
- jint *intArray = new jint[count * 2];
resolutions = env->NewIntArray(count * 2);
if (DeviceCapabilities(name, info->pPortName, DC_ENUMRESOLUTIONS, (LPSTR)nativeArray, NULL) > 0) {
+ jint *intArray = new jint[count * 2];
for (int i = 0; i < count * 2; i++) {
intArray[i] = (jint)((int)nativeArray[i]);
}
- env->SetIntArrayRegion(resolutions, 0, count * 2, intArray);
- free(nativeArray);
- free(intArray);
+ env->SetIntArrayRegion(resolutions, 0, count * 2, intArray);
+ delete[] intArray;
}
+ delete[] nativeArray;
}
free(info);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/win_printer_factory.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/win_printer_factory.c?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/win_printer_factory.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/win_printer_factory.c Wed Nov 26 21:10:32 2008
@@ -28,7 +28,7 @@
static char * getFileName(const char * path) {
char * p = (char *) (path + strlen(path));
- for (; p > path; *p--) {
+ for (; p > path; p--) {
if ((*p == '/') || (*p == '\\')) {
p++;
return p;
@@ -180,7 +180,7 @@
JNIEXPORT jlong JNICALL Java_org_apache_harmony_x_print_WinPrinterFactory_getPrinterProps(JNIEnv * env, jclass c, jstring jprinterName, jlong handle) {
DEVMODEW * dm;
const unsigned short * printerName = (*env)->GetStringChars(env, jprinterName, NULL);
- unsigned long dmSize = DocumentPropertiesW(NULL, JCAST(handle, HANDLE),
+ LONG dmSize = DocumentPropertiesW(NULL, JCAST(handle, HANDLE),
(unsigned short *) printerName, NULL, NULL, 0);
if (dmSize < 0) {
@@ -358,11 +358,13 @@
if ((result == NULL) || (points == NULL)) {
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
handleLastError(__FUNCTION__,__FILE__ , __LINE__, env);
+ free(points);
return NULL;
}
if (getPrinterCapabilities(env, handle, DC_PAPERSIZE, points) == -1) {
handleLastError(__FUNCTION__, __FILE__, __LINE__, env);
+ free(points);
return NULL;
}
@@ -396,11 +398,15 @@
if ((result == NULL) || (buff == NULL) || (resolutions == NULL)) {
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
handleLastError(__FUNCTION__,__FILE__ , __LINE__, env);
+ free(buff);
+ free(resolutions);
return NULL;
}
if (getPrinterCapabilities(env, handle, DC_ENUMRESOLUTIONS, buff) == -1) {
handleLastError(__FUNCTION__, __FILE__, __LINE__, env);
+ free(buff);
+ free(resolutions);
return NULL;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/regex/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/regex/.classpath?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/regex/.classpath (original)
+++ harmony/enhanced/classlib/branches/java6/modules/regex/.classpath Wed Nov 26 21:10:32 2008
@@ -5,6 +5,6 @@
<classpathentry output="bin/test" kind="src" path="src/test/java"/>
<classpathentry output="bin/test" kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry sourcepath="JUNIT_SRC_HOME/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin/main"/>
</classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/.classpath?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/.classpath (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/.classpath Wed Nov 26 21:10:32 2008
@@ -4,6 +4,6 @@
<classpathentry kind="src" output="bin/test" path="src/test/resources"/>
<classpathentry kind="src" output="bin/test" path="src/test/api/java"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="var" path="JUNIT_HOME/junit.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin/main"/>
</classpath>
Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java Wed Nov 26 21:10:32 2008
@@ -68,8 +68,8 @@
assertNull(e.detail);
try {
e.initCause(e);
- fail("No expected IllegalArgumentException");
- } catch (IllegalArgumentException exception) {
+ fail("No expected IllegalStateException");
+ } catch (IllegalStateException exception) {
// expected
}
}