--- old/test/jaxp/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java 2017-12-21 17:10:50.713153261 +0000 +++ new/test/jaxp/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java 2017-12-21 17:10:50.385153273 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, 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 @@ -41,11 +41,12 @@ /* * @test - * @bug 6809409 + * @bug 6809409 6857903 * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @run testng/othervm -DrunSecMngr=true sax.IssueTracker56Test * @run testng/othervm sax.IssueTracker56Test - * @summary Test SAXException has Cause. + * @summary Test SAXException has Cause and that Cause can be properly + * initialized with initCause. */ @Listeners({jaxp.library.BasePolicy.class}) public class IssueTracker56Test { @@ -90,6 +91,18 @@ } + /* + * Test that SAXException::initCause call correctly initializes + * cause and it can be acquired with SAXException::getCause call + */ + @Test + public void testInitCause() { + Exception cause = new Exception(); + SAXException e = new SAXException("SAX exception"); + e.initCause(cause); + Assert.assertSame(e.getCause(),cause,"Cause was not set by initCause:"); + } + public class MyHandler extends DefaultHandler implements ErrorHandler { public void startDocument() throws SAXException {