Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-19020

TestXmlParsing exception checking relies on a particular xml implementation without declaring it.

    XMLWordPrintableJSON

    Details

      Description

      The test added in HBASE-17424 is overly specific:

        @Test
        public void testFailOnExternalEntities() throws Exception {
          final String externalEntitiesXml =
              "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
              + " <!DOCTYPE foo [ <!ENTITY xxe SYSTEM \"/tmp/foo\"> ] >"
              + " <ClusterVersion>&xee;</ClusterVersion>";
          Client client = mock(Client.class);
          RemoteAdmin admin = new RemoteAdmin(client, HBaseConfiguration.create(), null);
          Response resp = new Response(200, null, externalEntitiesXml.getBytes());
      
          when(client.get("/version/cluster", Constants.MIMETYPE_XML)).thenReturn(resp);
      
          try {
            admin.getClusterVersion();
            fail("Expected getClusterVersion() to throw an exception");
          } catch (IOException e) {
            final String exceptionText = StringUtils.stringifyException(e);
            final String expectedText = "The entity \"xee\" was referenced, but not declared.";
            LOG.error("exception text: " + exceptionText, e);
            assertTrue("Exception does not contain expected text", exceptionText.contains(expectedText));
          }
        }
      

      Specifically, when running against Hadoop 3.0.0-beta1 this test fails because the exception text is different, though I'm still figuring out why.

        Attachments

        1. HBASE-19020.0.patch
          2 kB
          Sean Busbey

          Issue Links

            Activity

              People

              • Assignee:
                busbey Sean Busbey
                Reporter:
                busbey Sean Busbey
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: