From bf1977d05d398d160ab05a9f66e9048701ab461f Mon Sep 17 00:00:00 2001 From: elharo Date: Fri, 17 Jul 2026 15:01:46 +0000 Subject: [PATCH 1/2] Fix UnparsedEntityCheckingTest: remove leftover RuntimeException from testDefaultValid --- build.xml | 18 +++++++++--------- .../config/UnparsedEntityCheckingTest.java | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/build.xml b/build.xml index 3f17b5112..747889239 100644 --- a/build.xml +++ b/build.xml @@ -836,15 +836,15 @@ Authors: - - + + + diff --git a/tests/schema/config/UnparsedEntityCheckingTest.java b/tests/schema/config/UnparsedEntityCheckingTest.java index 3c7798fc6..146c5092b 100644 --- a/tests/schema/config/UnparsedEntityCheckingTest.java +++ b/tests/schema/config/UnparsedEntityCheckingTest.java @@ -55,7 +55,6 @@ public void testDefaultValid() { } checkDefault(); - throw new RuntimeException(); } public void testSetFalseValid() { From c6c6aab0501ae998561b3717d0aca8de53876030 Mon Sep 17 00:00:00 2001 From: elharo Date: Fri, 17 Jul 2026 15:20:41 +0000 Subject: [PATCH 2/2] Remove unnecessary try-catch blocks per review feedback --- .../config/UnparsedEntityCheckingTest.java | 81 ++++--------------- 1 file changed, 16 insertions(+), 65 deletions(-) diff --git a/tests/schema/config/UnparsedEntityCheckingTest.java b/tests/schema/config/UnparsedEntityCheckingTest.java index 146c5092b..3eaa2ef99 100644 --- a/tests/schema/config/UnparsedEntityCheckingTest.java +++ b/tests/schema/config/UnparsedEntityCheckingTest.java @@ -17,11 +17,8 @@ package schema.config; -import junit.framework.Assert; - import org.apache.xerces.dom.PSVIElementNSImpl; import org.apache.xerces.xs.ItemPSVI; -import org.xml.sax.SAXException; /** * @author Peter McCracken, IBM @@ -47,89 +44,43 @@ public UnparsedEntityCheckingTest(String name) { super(name); } - public void testDefaultValid() { - try { - validateDocument(); - } catch (Exception e) { - Assert.fail("Validation failed: " + e.getMessage()); - } - + public void testDefaultValid() throws Exception { + validateDocument(); checkDefault(); } - public void testSetFalseValid() { - try { - fValidator.setFeature(UNPARSED_ENTITY_CHECKING, false); - } catch (SAXException e) { - Assert.fail("Error setting feature."); - } - try { - validateDocument(); - } catch (Exception e) { - Assert.fail("Validation failed: " + e.getMessage()); - } - + public void testSetFalseValid() throws Exception { + fValidator.setFeature(UNPARSED_ENTITY_CHECKING, false); + validateDocument(); checkDefault(); } - public void testSetTrueValid() { - try { - fValidator.setFeature(UNPARSED_ENTITY_CHECKING, true); - } catch (SAXException e) { - Assert.fail("Error setting feature."); - } - try { - validateDocument(); - } catch (Exception e) { - Assert.fail("Validation failed: " + e.getMessage()); - } - + public void testSetTrueValid() throws Exception { + fValidator.setFeature(UNPARSED_ENTITY_CHECKING, true); + validateDocument(); checkDefault(); } - public void testDefaultInvalid() { + public void testDefaultInvalid() throws Exception { ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "unparsedEntityAttr", "invalid"); - try { - validateDocument(); - } catch (Exception e) { - Assert.fail("Validation failed: " + e.getMessage()); - } - + validateDocument(); checkInvalid(); } - public void testSetFalseInvalid() { + public void testSetFalseInvalid() throws Exception { ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "unparsedEntityAttr", "invalid"); - try { - fValidator.setFeature(UNPARSED_ENTITY_CHECKING, false); - } catch (SAXException e) { - Assert.fail("Error setting feature."); - } - try { - validateDocument(); - } catch (Exception e) { - Assert.fail("Validation failed: " + e.getMessage()); - } - + fValidator.setFeature(UNPARSED_ENTITY_CHECKING, false); + validateDocument(); checkDefault(); } - public void testSetTrueInvalid() { + public void testSetTrueInvalid() throws Exception { ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "unparsedEntityAttr", "invalid"); - try { - fValidator.setFeature(UNPARSED_ENTITY_CHECKING, true); - } catch (SAXException e) { - Assert.fail("Error setting feature."); - } - try { - validateDocument(); - } catch (Exception e) { - Assert.fail("Validation failed: " + e.getMessage()); - } - + fValidator.setFeature(UNPARSED_ENTITY_CHECKING, true); + validateDocument(); checkInvalid(); }