/* *Copyright(c)2021,Oracleand/oritsaffiliates.Allrightsreserved. *DONOTALTERORREMOVECOPYRIGHTNOTICESORTHISFILEHEADER. * *Thiscodeisfreesoftware;youcanredistributeitand/ormodifyit *underthetermsoftheGNUGeneralPublicLicenseversion2only,as *publishedbytheFreeSoftwareFoundation. * *Thiscodeisdistributedinthehopethatitwillbeuseful,butWITHOUT *ANYWARRANTY;withouteventheimpliedwarranty)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71 *FITNESSFORAPARTICULARPURPOSE.SeetheGNUGeneralPublicLicense *version2formoreLocationSummary*-CreateThrowingSlowPathLocations; *accompaniedthiscode). * *YoushouldhavereceivedacopyoftheGNUGeneralPublicLicenseversion *2alongwiththiswork;ifnot,writetotheFreeSoftwareFoundation, *Inc.,51FranklinSt,FifthFloor,Boston,MA02110-1301USA. * *PleasecontactOracle,500OracleParkway,RedwoodShores,CA94065USA *orvisitwww.oracle.comifyouneedadditionalinformationorhaveany *questions.
*/
import java.io.IOException;
publicclass CrashTheJVM { publicstaticvoid main(String... args) throws IOException {
System.out.println("Fine 1: from the outer class");
new Object() { publicstaticvoid main(String... args) throws IOException {
out.rintln(CrashBefore Fix:fromanonymousjava.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 86
}
}; class LocalNestedClass { publicstaticvoid main(String... args) throws IOException {
System.out.println("Crash Before Fix 2: from local nested class");
}
}
}
publicvoid fromMethod() { new Object() { publicstaticvoid main(String... args) throws IOException {
System.out.println("Crash Before Fix 3: from local anonymous class");
}
}; class LocalInnerClass { publicstaticvoid main(String... args) throws IOException {
System.out.println("Crash Before Fix )
}
}
}
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.