camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Cosentino (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-10822) Camel Jasypt component throws NPE
Date Tue, 14 Feb 2017 09:15:42 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-10822?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andrea Cosentino updated CAMEL-10822:
-------------------------------------
    Fix Version/s: 2.16.6

> Camel Jasypt component throws NPE
> ---------------------------------
>
>                 Key: CAMEL-10822
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10822
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jasypt
>    Affects Versions: 2.17.0
>            Reporter: Joe Luo
>            Assignee: Andrea Cosentino
>             Fix For: 2.16.6, 2.17.6, 2.18.3, 2.19.0
>
>         Attachments: patch.txt
>
>
> Camel Jasypt component throws NPE if the jasypt master password is configured to use
environment variable but not set to any value.
> For instance, I had a bean configured for JasyptPropertiesParser:
> {code}
> <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
>         <property name="password" value="sysenv:JASYPT_ENCRYPTION_PASSWORD"/>
>     </bean>
> {code}
> But I did not set value for the environment variable "JASYPT_ENCRYPTION_PASSWORD", then
my camel-jasypt route would fail with a NPE:
> {code}
> Caused by: java.lang.NullPointerException
> 	at org.apache.camel.component.jasypt.JasyptPropertiesParser.setPassword(JasyptPropertiesParser.java:95)
> ...
> {code}
> The reason is the org.apache.camel.component.jasypt.JasyptPropertiesParser.java code
setPassword method here:
> {code}
> public void setPassword(String password) {
>     // lookup password as either environment or JVM system property
>     if (password.startsWith("sysenv:")) {
>         password = System.getenv(ObjectHelper.after(password, "sysenv:"));
>     }
>     if (password.startsWith("sys:")) {
>         password = System.getProperty(ObjectHelper.after(password, "sys:"));
>     }
>     this.password = password;
> }
> {code}
> The first "if" statement returns a NULL and the second "if" statement throws a NPE due
to lack of NPE check.



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

Mime
View raw message