Piotr Klimczak created CAMEL-6204:
-------------------------------------

             Summary: loadResourceAsStream in ObjectHelper could not load 
resource with leading "/"
                 Key: CAMEL-6204
                 URL: https://issues.apache.org/jira/browse/CAMEL-6204
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.11.1
            Reporter: Piotr Klimczak


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.

{code}
    public void testLoadResourceAsStream() {
        // ObjectHelperResourceTestFile.properties
        InputStream res1 = 
ObjectHelper.loadResourceAsStream("ObjectHelperResourceTestFile.properties");
        InputStream res2 = 
ObjectHelper.loadResourceAsStream("org/apache/camel/util/ObjectHelperResourceTestFile.properties");
        InputStream res3 = 
ObjectHelper.loadResourceAsStream("/org/apache/camel/util/ObjectHelperResourceTestFile.properties");

        assertNotNull("Cannot load resource with relative path", res1);
        assertNotNull("Cannot load resource without leading \"/\"", res2);
        assertNotNull("Cannot load resource with leading \"/\"", res3);
    }
{code}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to