[jira] [Commented] (CXF-5822) NullPointerException in PropertiesLoaderUtils
[ https://issues.apache.org/jira/browse/CXF-5822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14051109#comment-14051109 ] ASF GitHub Bot commented on CXF-5822: - Github user cehser closed the pull request at: https://github.com/apache/cxf/pull/8 NullPointerException in PropertiesLoaderUtils - Key: CXF-5822 URL: https://issues.apache.org/jira/browse/CXF-5822 Project: CXF Issue Type: Bug Components: Core Affects Versions: 2.6.14 Reporter: Christoph Eßer Assignee: Sergey Beryozkin Priority: Critical Fix For: 2.6.15, 2.7.12, 3.0.1 Under some circumstances in our project {{Thread.currentThread().getContextClasssLoader()}} is {{null}}. This leads to a {{NullPointerException}} when org.apache.cxf.common.util.PropertiesLoaderUtils.loadAllProperties() is called with that as an argument. This is the specific part of the code that contains the problem: {code:title=PropertiesLoaderUtils.java|borderStyle=solid} /** * Load all properties from the given class path resource, using the given * class loader. * p * Merges properties if more than one resource of the same name found in the * class path. * * @param resourceName the name of the class path resource * @param classLoader the ClassLoader to use for loading (or *codenull/code to use the default class loader) * @return the populated Properties instance * @throws IOException if loading failed */ public static Properties loadAllProperties(String resourceName, ClassLoader classLoader) throws IOException { return loadAllProperties(resourceName, classLoader, null, null, null); } public static Properties loadAllProperties(String resourceName, ClassLoader classLoader, Logger logger, Level level, String msg) throws IOException { Properties properties = new Properties(); EnumerationURL urls = classLoader.getResources(resourceName); ... {code} The Javadoc says that {{null}} is a valid value for this argument. However, the code does not check the variable for {{null}} and just calls {{classLoader.getResources(resourceName)}}. This check should be added and {{classLoader}} should be set to a reasonable value in case it is {{null}}. I will add a pull request for a fix of this issue later. Please note that we are bound to Java 1.5 in our project and thus switching to CXF 2.7 or 3.0 is not possible for us. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CXF-5822) NullPointerException in PropertiesLoaderUtils
[ https://issues.apache.org/jira/browse/CXF-5822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14051108#comment-14051108 ] ASF GitHub Bot commented on CXF-5822: - Github user cehser commented on the pull request: https://github.com/apache/cxf/pull/8#issuecomment-47870556 Thanks for the commit. Request closed. NullPointerException in PropertiesLoaderUtils - Key: CXF-5822 URL: https://issues.apache.org/jira/browse/CXF-5822 Project: CXF Issue Type: Bug Components: Core Affects Versions: 2.6.14 Reporter: Christoph Eßer Assignee: Sergey Beryozkin Priority: Critical Fix For: 2.6.15, 2.7.12, 3.0.1 Under some circumstances in our project {{Thread.currentThread().getContextClasssLoader()}} is {{null}}. This leads to a {{NullPointerException}} when org.apache.cxf.common.util.PropertiesLoaderUtils.loadAllProperties() is called with that as an argument. This is the specific part of the code that contains the problem: {code:title=PropertiesLoaderUtils.java|borderStyle=solid} /** * Load all properties from the given class path resource, using the given * class loader. * p * Merges properties if more than one resource of the same name found in the * class path. * * @param resourceName the name of the class path resource * @param classLoader the ClassLoader to use for loading (or *codenull/code to use the default class loader) * @return the populated Properties instance * @throws IOException if loading failed */ public static Properties loadAllProperties(String resourceName, ClassLoader classLoader) throws IOException { return loadAllProperties(resourceName, classLoader, null, null, null); } public static Properties loadAllProperties(String resourceName, ClassLoader classLoader, Logger logger, Level level, String msg) throws IOException { Properties properties = new Properties(); EnumerationURL urls = classLoader.getResources(resourceName); ... {code} The Javadoc says that {{null}} is a valid value for this argument. However, the code does not check the variable for {{null}} and just calls {{classLoader.getResources(resourceName)}}. This check should be added and {{classLoader}} should be set to a reasonable value in case it is {{null}}. I will add a pull request for a fix of this issue later. Please note that we are bound to Java 1.5 in our project and thus switching to CXF 2.7 or 3.0 is not possible for us. -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CXF-5822) NullPointerException in PropertiesLoaderUtils
[ https://issues.apache.org/jira/browse/CXF-5822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14050568#comment-14050568 ] ASF GitHub Bot commented on CXF-5822: - Github user dkulp commented on the pull request: https://github.com/apache/cxf/pull/8#issuecomment-47820434 This pull request was committed by Sergey. Can it be closed please? NullPointerException in PropertiesLoaderUtils - Key: CXF-5822 URL: https://issues.apache.org/jira/browse/CXF-5822 Project: CXF Issue Type: Bug Components: Core Affects Versions: 2.6.14 Reporter: Christoph Eßer Assignee: Sergey Beryozkin Priority: Critical Fix For: 2.6.15, 2.7.12, 3.0.1 Under some circumstances in our project {{Thread.currentThread().getContextClasssLoader()}} is {{null}}. This leads to a {{NullPointerException}} when org.apache.cxf.common.util.PropertiesLoaderUtils.loadAllProperties() is called with that as an argument. This is the specific part of the code that contains the problem: {code:title=PropertiesLoaderUtils.java|borderStyle=solid} /** * Load all properties from the given class path resource, using the given * class loader. * p * Merges properties if more than one resource of the same name found in the * class path. * * @param resourceName the name of the class path resource * @param classLoader the ClassLoader to use for loading (or *codenull/code to use the default class loader) * @return the populated Properties instance * @throws IOException if loading failed */ public static Properties loadAllProperties(String resourceName, ClassLoader classLoader) throws IOException { return loadAllProperties(resourceName, classLoader, null, null, null); } public static Properties loadAllProperties(String resourceName, ClassLoader classLoader, Logger logger, Level level, String msg) throws IOException { Properties properties = new Properties(); EnumerationURL urls = classLoader.getResources(resourceName); ... {code} The Javadoc says that {{null}} is a valid value for this argument. However, the code does not check the variable for {{null}} and just calls {{classLoader.getResources(resourceName)}}. This check should be added and {{classLoader}} should be set to a reasonable value in case it is {{null}}. I will add a pull request for a fix of this issue later. Please note that we are bound to Java 1.5 in our project and thus switching to CXF 2.7 or 3.0 is not possible for us. -- This message was sent by Atlassian JIRA (v6.2#6252)