aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hao Zhong (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ARIES-1700) A possible null pointer
Date Thu, 16 Mar 2017 11:23:41 GMT
Hao Zhong created ARIES-1700:
--------------------------------

             Summary: A possible null pointer
                 Key: ARIES-1700
                 URL: https://issues.apache.org/jira/browse/ARIES-1700
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
    Affects Versions: blueprint-core-1.7.0
            Reporter: Hao Zhong
            Priority: Minor


The current version of NoOsgiRecipeBuilder has the following code:
 else if (v instanceof IdRefMetadata) {
            // TODO: make it work with property-placeholders?
            String componentName = ((IdRefMetadata) v).getComponentId();
            IdRefRecipe rnr = new IdRefRecipe(getName(null), componentName);
            return rnr;
        } else {
            throw new IllegalStateException("Unsupported value: " + v.getClass().getName());
        }
Here, v.getClass() can return null. The line shall be revised as:
throw new IllegalStateException("Unsupported value: " + (v != null ? v.getClass().getName()
: "null"));

Indeed, I notice that the file, RecipeBuilder, has the following similar code:

else if (v instanceof IdRefMetadata) {
            // TODO: make it work with property-placeholders?
            String componentName = ((IdRefMetadata) v).getComponentId();
            IdRefRecipe rnr = new IdRefRecipe(getName(null), componentName);
            return rnr;
        } else {
            throw new IllegalStateException("Unsupported value: " + (v != null ? v.getClass().getName()
: "null"));
        }
It checks whether v is null or not.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message