Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4830302

exceptions unnecessarily used for control-flow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 6
    • 1.3.0
    • core-libs

      in src/share/classes/java/io/ObjectInputStream.java we have the following code:

              try {
                  if ((cl = resolveProxyClass(ifaces)) == null) {
                      throw new ClassNotFoundException("null class");
                  }
              } catch (ClassNotFoundException ex) {
                  resolveEx = ex;
              }

      This code might be more efficient if rewritten as

              try {
                  if ((cl = resolveProxyClass(ifaces)) == null) {
                      resolveEx = ClassNotFoundException("null class");
                  }
              } catch (ClassNotFoundException ex) {
                  resolveEx = ex;
              }

      This pattern occurs once more within that file.

            aozerov Andrey Ozerov
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: