Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6015

[classlib] [beans] Exceptions should be thrown and handled in XMLDecoder.readObject() rather than XMLDecoder's constructors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.0M7
    • 5.0M9
    • Classlib
    • None
    • Moderate

    Description

      Given a test scenario [1], conduct it on RI and HY.
      RI works well while HY fails.
      This test case illuminates that RI doesn't parse the content of given InputStream in XMLDecoder's constructions, which should be handled in its readObject method.
      I think that we should follow RI's behaviors on this.

      [1]
      public void test_setExceptionListener() throws Exception {
      class MockExceptionListener implements ExceptionListener {
      private boolean isCalled;
      public void exceptionThrown(Exception e)

      { isCalled = true; }

      public boolean isCalled()

      { return isCalled; }

      }
      XMLDecoder xmlDecoder = new XMLDecoder(new ByteArrayInputStream(
      "<java><string/>".getBytes("UTF-8")));
      MockExceptionListener mockListener = new MockExceptionListener();
      xmlDecoder.setExceptionListener(mockListener);
      assertNotNull(xmlDecoder.readObject());
      assertTrue(mockListener.isCalled());
      }

      Attachments

        1. HARMONY-6015.diff
          2 kB
          Kevin Zhou

        Activity

          People

            qiuxiaox Sean Qiu
            zhoukevin Kevin Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 48h
                48h
                Remaining:
                Remaining Estimate - 48h
                48h
                Logged:
                Time Spent - Not Specified
                Not Specified