< prev index next >

test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NullPointerExceptionTest.java

Print this page

 287                          (hasDebugInfo ? "\"ia1\"" : "\"<local1>\"") + " is null");
 288         }
 289         // fastore
 290         try {
 291             fa1[0] = 0.7f;
 292             System.out.println(fa1[0]);
 293             Asserts.fail();
 294         } catch (NullPointerException e) {
 295             checkMessage(e, "fa1[0] = 0.7f;", e.getMessage(),
 296                          "Cannot store to float array because " +
 297                          (hasDebugInfo ? "\"fa1\"" : "\"<local2>\"") + " is null");
 298         }
 299         // aastore
 300         try {
 301             oa1[0] = new Object();
 302             System.out.println(oa1[0]);
 303             Asserts.fail();
 304         } catch (NullPointerException e) {
 305             checkMessage(e, "oa1[0] = new Object();", e.getMessage(),
 306                          "Cannot store to object array because " +
 307                          (hasDebugInfo ? "\"oa1\"" : "\"<local3>\"") + " is null");
 308         }
 309         // bastore (boolean)
 310         try {
 311             za1[0] = false;
 312             System.out.println(za1[0]);
 313             Asserts.fail();
 314         } catch (NullPointerException e) {
 315             checkMessage(e, "za1[0] = false;", e.getMessage(),
 316                          "Cannot store to byte/boolean array because " +
 317                          (hasDebugInfo ? "\"za1\"" : "\"<local4>\"") + " is null");
 318         }
 319         // bastore (byte)
 320         try {
 321             ba1[0] = 0;
 322             System.out.println(ba1[0]);
 323             Asserts.fail();
 324         } catch (NullPointerException e) {
 325             checkMessage(e, "ba1[0] = 0;", e.getMessage(),
 326                          "Cannot store to byte/boolean array because " +
 327                          (hasDebugInfo ? "\"ba1\"" : "\"<local5>\"") + " is null");

 287                          (hasDebugInfo ? "\"ia1\"" : "\"<local1>\"") + " is null");
 288         }
 289         // fastore
 290         try {
 291             fa1[0] = 0.7f;
 292             System.out.println(fa1[0]);
 293             Asserts.fail();
 294         } catch (NullPointerException e) {
 295             checkMessage(e, "fa1[0] = 0.7f;", e.getMessage(),
 296                          "Cannot store to float array because " +
 297                          (hasDebugInfo ? "\"fa1\"" : "\"<local2>\"") + " is null");
 298         }
 299         // aastore
 300         try {
 301             oa1[0] = new Object();
 302             System.out.println(oa1[0]);
 303             Asserts.fail();
 304         } catch (NullPointerException e) {
 305             checkMessage(e, "oa1[0] = new Object();", e.getMessage(),
 306                          "Cannot store to object array because " +
 307                          (hasDebugInfo ? "\"oa1\"" : "\"<local3>\"") + " is null or is a null-free array and there's an attempt to store null in it");
 308         }
 309         // bastore (boolean)
 310         try {
 311             za1[0] = false;
 312             System.out.println(za1[0]);
 313             Asserts.fail();
 314         } catch (NullPointerException e) {
 315             checkMessage(e, "za1[0] = false;", e.getMessage(),
 316                          "Cannot store to byte/boolean array because " +
 317                          (hasDebugInfo ? "\"za1\"" : "\"<local4>\"") + " is null");
 318         }
 319         // bastore (byte)
 320         try {
 321             ba1[0] = 0;
 322             System.out.println(ba1[0]);
 323             Asserts.fail();
 324         } catch (NullPointerException e) {
 325             checkMessage(e, "ba1[0] = 0;", e.getMessage(),
 326                          "Cannot store to byte/boolean array because " +
 327                          (hasDebugInfo ? "\"ba1\"" : "\"<local5>\"") + " is null");
< prev index next >