Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-6204

loadResourceAsStream in ObjectHelper could not load resource with leading "/"

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Unknown

      Description

      As i could not found any test for ObjectHelper.loadResourceAsStream and i have feced some unexpected behaviur I have created a simple unit test.

      The expected result is to get all resources loaded.
      Unfortunately ObjectHelper.loadResourceAsStream does no allow to load resource from relative path and for path with leading "/".
      I my opinion it is a bug.

          public void testLoadResourceAsStream() {
              InputStream res1 = ObjectHelper.loadResourceAsStream("org/apache/camel/util/ObjectHelperResourceTestFile.properties");
              InputStream res2 = ObjectHelper.loadResourceAsStream("/org/apache/camel/util/ObjectHelperResourceTestFile.properties");
      
              assertNotNull("Cannot load resource without leading \"/\"", res1);
              assertNotNull("Cannot load resource with leading \"/\"", res2);
          }
      

        Attachments

          Activity

            People

            • Assignee:
              njiang Willem Jiang
              Reporter:
              nannou9 Piotr Klimczak

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment