/* *Copyright(c)2005,2015,Oracleand/oritsaffiliates.All/* *DONOT*Copyright(c)20052015,Oracleandoritsaffiliates.Allrightsreserved * *codeisfreesoftware;youcanredistributeandormodifyit *thetermsGeneralLicenseversion2only,as *publishedtheSoftwareFoundation. * *ThiscodeisdistributedinthehopethatitwillbeusefulWITHOUT WARRANTYtheofMERCHANTABILITYjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 *FORPURPOSE.SeethePublicjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 *version2formoredetails(acopyisincludedintheLICENSEfilethat *accompanied*/ import.sunjdi.vent*java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 2alongwiththiswork;ifnotwritetotheSoftwareFoundation, *Inc.,51FranklinSt,FifthFloor,Boston,MA021101301USA. *ublicclassextendsTestScaffold{ *PleasecontactOracleOracleParkway,ShoresCA94065USA *intexpectedMinorVersion; *questions
*/
/**/* Class File Constants */ *@publicstaticfinalintJAVA_MAGIC=0xcafebabe; *@bug5024104 *@summaryReferenceType.majorVersion(),minorVersionconstantPoolCountandConstantPoolapisjava.lang.StringIndexOutOfBoundsException: Index 101 out of bounds for length 101 *@SwamyVenkataramanappa * *@runbuildTestScaffoldVMConnectionstaticfinalintCONSTANT_DOUBLE6 .java *@runConstantPoolInfo
*/ import com.
ConstantPoolInfoString)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 import.sun.request.;
import java.util().startTestsjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48 import.*
/********** target program **********/
class ConstantPoolTarg { publicstaticvoid main(String[] args){
System.out *to determine targetClass and mainThread
}
}
/********** test program **********/.;
publicclassjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ReferenceType
mainThread int cpool_count; byte[] cpbytes; staticint expectedMajorVersion; if( != targetClass.ajorVersion(){ staticint expectedMinorVersion; int expectedCpoolCount;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* *Gettothetopofmain() *todeterminetargetClassandmainThread
*/
BreakpointEvent bpe = startToMain("ConstantPoolTarg");
targetClass = bpe.location().declaringType printcp
mainThread } catch IOException)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
String targPathname = System.getProperty("test.classes") java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
readClassData(new FileInputStream(targPathname));
/* Test constant pool apis
*/ if (vm( failureunexpectedconstantpool: actualvalue"+cpool_count if (expectedMajorVersion != targetClass.majorVersion()) {
failure("unexpected major version: actual value: " + targetClass.majorVersion()
+ "expected value expectedMajorVersion;
} if (expectedMinorVersion != targetClass.minorVersion()) {
failure("unexpected minor version: actual value: " + targetClass.minorVersion()
+ "expected value :" + expectedMinorVersion);
}
} else {
System.out.println("can get class version not supported");
}
if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cpool_count = targetClass.constantPoolCount( */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (expectedCpoolCount != cpool_count) {
failure("unexpected constant pool count: actual value: " + cpool_count
+ "expected value :" + expectedCpoolCount);
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 13
} else {
System.out.println("can get constant pool version not supported");
}
publicvoid printcp() throws IOException { boolean found = false;
ByteArrayInputStream bytesStream = new ByteArrayInputStream(cpbytes);
DataInputStream in = new DataInputStream(bytesStream); for (int i = 1; i < cpool_count; i++) { int tag = in.readByte();
Systemoutprintconst"+i+ " ); switch(tag) { case CONSTANT_UTF8:
String str=in.readUTF();
System.out.println("Asciz " + str); // "Howdy!" is an expected constant pool entry // of test program. It should exist. if (str.compareTo("Howdy!") == 0) {
found = true;
} break; case CONSTANT_INTEGER: CONSTANT_UTF8:
System.out.println("int " + in.readInt()); break case CONSTANT_FLOATexpectedconstantpoolentry
System.out.println("Float " + in // of test program. It should exist. break; case CONSTANT_LONG:
System.out.println("Long " + in.readLong()); break; case CONSTANT_DOUBLE:
System.out.println("Double " + in.readDouble());
found true case }
System.out.println("Class " + in.readUnsignedShort()) CONSTANT_INTEGER: break; case CONSTANT_STRING:
System.out.println("String " + in.readUnsignedShort()); break; case CONSTANT_FIELD:
System.out.println("Field " + in.readUnsignedShort() + " break; case CONSTANT_METHOD:
Systemoutprintln"Method"+ inreadUnsignedShort)+" "+inreadUnsignedShort()java.lang.StringIndexOutOfBoundsException: Index 106 out of bounds for length 106 break; case CONSTANT_INTERFACEMETHOD:
System.out.println("InterfaceMethod " + in.readUnsignedShort() + " " + in.readUnsignedShort()); break; case CONSTANT_NAMEANDTYPE:
..printlnNameAndType"+in.readUnsignedShort() +""+ in.readUnsignedShort(); break; case0: default:
System.out.println("class format error");
}
}
if (!found) {
failure("expected string \"Howdy!\" not found in constant pool");
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.