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

Make Xerces DatatypeException stackless

    XMLWordPrintable

Details

    Backports

      Description

        Profiling of SPECjvm2008:xml.validation shows there are lots of InvalidateDataTypeValueExceptions are thrown from Xerces. See screenshot for async-profiler stack trace.

        It does not look like those exceptions leak outside javax.xml. The uses of exception or its subclasses (`InvalidDatatypeValueException`, `InvalidDatatypeFacetException`) take the form of:

        ```
                        catch (InvalidDatatypeValueException ex) {
                            fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                       ex.getKey(),
                                                       ex.getArgs(),
                                                       XMLErrorReporter.SEVERITY_ERROR );
                        }
        ```

        ...so they don't seem to use the stack traces: only key, args, message is used. Which means we can turn `DatatypeException` stackless, and save some cycles on throws.

        This improves xml.validation performance for about +3%.

        Attachments

          Issue Links

            Activity

              People

                shade Aleksey Shipilev
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: