< prev index next >
test/jaxp/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2014, 2016, 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) 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 39,53 ****
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
* @test
! * @bug 6809409
* @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.
*/
@Listeners({jaxp.library.BasePolicy.class})
public class IssueTracker56Test {
@Test
--- 39,54 ----
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
* @test
! * @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 and that Cause can be properly
! * initialized with initCause.
*/
@Listeners({jaxp.library.BasePolicy.class})
public class IssueTracker56Test {
@Test
*** 88,97 ****
--- 89,110 ----
// shouldn't happen
}
}
+ /*
+ * 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 {
}
< prev index next >