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

Better exception messages for Unicode 7 code

XMLWordPrintable

    • generic
    • generic

      Unicode 7 (JDK-8032446) introduced new exceptions that can be padded out better.

      Here are some examples from the changeset [1]:

      + count = bd.openings.length;
      + bd.openings = new Opening[count * 2];
      + } catch (Exception e) {
      + throw new OutOfMemoryError("Failed to allocate memory for openings");
      + }

      we should print how many Opening objects were being allocated.

      + if (isBigEndian < 0 || 1 < isBigEndian ||
      + charsetFamily != CHAR_SET_ || sizeofUChar != CHAR_SIZE_) {
      + throw new IOException(HEADER_AUTHENTICATION_FAILED_);
      + }

      I would like to see isBigEndian and charsetFamily values printed.

      + if (sizeofUDataInfo < 20 || headerSize < (sizeofUDataInfo + 4)) {
      + throw new IOException("Internal Error: Header size error");
      + }

      Same again, why don't we print sizeofUDataInfo and headSize details in Exception ?

      + if(indexesLength<=IX_MIN_MAYBE_YES) {
      + throw new IOException("Normalizer2 data: not enough indexes");
      + }

      Why don't we print indexesLength ?

      Above are just a few examples. there may be some more.

      [1] http://hg.openjdk.java.net/jdk9/dev/jdk/rev/86206517258d

            coffeys Sean Coffey
            coffeys Sean Coffey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: