< prev index next >

test/jdk/java/lang/Double/ParseDouble.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 554,28 ***
       * proper value; just whether the input is accepted appropriately
       * or not.
       */
      private static void testParsing(String [] input,
                                      boolean exceptionalInput) {
!         for(int i = 0; i < input.length; i++) {
-             double d;
- 
              try {
!                 d = Double.parseDouble(input[i]);
!                 check(input[i]);
!             }
!             catch (NumberFormatException e) {
-                 if (! exceptionalInput) {
                      throw new RuntimeException("Double.parseDouble rejected " +
!                                                "good string `" + input[i] +
                                                 "'.");
                  }
!                 break;
              }
              if (exceptionalInput) {
                  throw new RuntimeException("Double.parseDouble accepted " +
!                                            "bad string `" + input[i] +
                                             "'.");
              }
          }
      }
  
--- 554,25 ---
       * proper value; just whether the input is accepted appropriately
       * or not.
       */
      private static void testParsing(String [] input,
                                      boolean exceptionalInput) {
!         for (String s : input) {
              try {
!                 Double.parseDouble(s);
!                 check(s);
!             } catch (NumberFormatException e) {
!                 if (!exceptionalInput) {
                      throw new RuntimeException("Double.parseDouble rejected " +
!                                                "good string `" + s +
                                                 "'.");
                  }
!                 continue;
              }
              if (exceptionalInput) {
                  throw new RuntimeException("Double.parseDouble accepted " +
!                                            "bad string `" + s +
                                             "'.");
              }
          }
      }
  
< prev index next >