Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8CC3A200D1E for ; Wed, 18 Oct 2017 17:32:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8B3F3160BEA; Wed, 18 Oct 2017 15:32:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D0C9F1609EE for ; Wed, 18 Oct 2017 17:32:08 +0200 (CEST) Received: (qmail 9723 invoked by uid 500); 18 Oct 2017 15:32:08 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 9714 invoked by uid 99); 18 Oct 2017 15:32:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Oct 2017 15:32:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DFD93DFB6F; Wed, 18 Oct 2017 15:32:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: busbey@apache.org To: commits@hbase.apache.org Message-Id: <33799325afe04620adef4cb9376186ad@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-19020 HBase Rest test for xml parsing external entities should not rely on implementation of java XML APIs. Date: Wed, 18 Oct 2017 15:32:07 +0000 (UTC) archived-at: Wed, 18 Oct 2017 15:32:09 -0000 Repository: hbase Updated Branches: refs/heads/branch-1.3 80c14c9b7 -> 90249f110 HBASE-19020 HBase Rest test for xml parsing external entities should not rely on implementation of java XML APIs. Signed-off-by: Chia-Ping Tsai Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/90249f11 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/90249f11 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/90249f11 Branch: refs/heads/branch-1.3 Commit: 90249f1101e1581df8bb93482f952f4bb96270a7 Parents: 80c14c9 Author: Sean Busbey Authored: Mon Oct 16 16:11:39 2017 -0500 Committer: Sean Busbey Committed: Wed Oct 18 10:17:10 2017 -0500 ---------------------------------------------------------------------- .../apache/hadoop/hbase/rest/client/TestXmlParsing.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/90249f11/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestXmlParsing.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestXmlParsing.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestXmlParsing.java index 56dc05e..0b94e9e 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestXmlParsing.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestXmlParsing.java @@ -23,7 +23,10 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.IOException; +import javax.xml.bind.UnmarshalException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.rest.Constants; import org.apache.hadoop.hbase.rest.model.StorageClusterVersionModel; @@ -37,6 +40,7 @@ import org.junit.experimental.categories.Category; */ @Category(SmallTests.class) public class TestXmlParsing { + private static final Log LOG = LogFactory.getLog(TestXmlParsing.class); @Test public void testParsingClusterVersion() throws Exception { @@ -68,8 +72,12 @@ public class TestXmlParsing { admin.getClusterVersion(); fail("Expected getClusterVersion() to throw an exception"); } catch (IOException e) { + assertEquals("Cause of exception ought to be a failure to parse the stream due to our " + + "invalid external entity. Make sure this isn't just a false positive due to " + + "implementation. see HBASE-19020.", UnmarshalException.class, e.getCause().getClass()); final String exceptionText = StringUtils.stringifyException(e); - final String expectedText = "The entity \"xee\" was referenced, but not declared."; + final String expectedText = "\"xee\""; + LOG.debug("exception text: '" + exceptionText + "'", e); assertTrue("Exception does not contain expected text", exceptionText.contains(expectedText)); } }