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

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

    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

        1. CAMEL6204.diff
          4 kB
          Piotr Klimczak

          Activity

            People

            • Assignee:
              njiang Willem Jiang
              Reporter:
              nannou9 Piotr Klimczak
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: