JasyptPropertiesParser.parseProperty returns NPE when value of the property is not defined

Solution Verified - Updated -

Issue

  • Once we introduced Jasypt encryption/decryption into our Camel blueprint, when we ask for a property that doesn't exist in CFG file, we started getting NullPointerExceptions. This does not happen when we remove Jasypt from the mix. CamelContext.resolvePropertyPlaceholders() returns null for missing properties if Jasypt parsing isn't involved. When we add Jasypt parsing, we get the following call stack:
java.lang.NullPointerException
                at org.apache.camel.util.ObjectHelper.after(ObjectHelper.java:434)
                at org.apache.camel.util.ObjectHelper.between(ObjectHelper.java:448)
                at org.apache.camel.component.jasypt.JasyptPropertiesParser.parseProperty(JasyptPropertiesParser.java:82)[218:org.apache.camel.camel-jasypt:2.12.0.redhat-610380]
                at org.apache.camel.blueprint.BlueprintPropertiesParser.parseProperty(BlueprintPropertiesParser.java:153)
                at org.apache.camel.component.properties.DefaultPropertiesParser.createPlaceholderPart(DefaultPropertiesParser.java:201)
                at org.apache.camel.component.properties.DefaultPropertiesParser.doParseUri(DefaultPropertiesParser.java:105)
                at org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:51)
                at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:160)
                at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:119)
                at org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:1155)

  • Looking at the JasyptPropertiesParser.parseProperty() method, there is no check for a null value prior to looking for the "ENC()" tag. It would be an easy fix to protect us from the NullPointerException when the property either has no value or is not in the cfg file.

Environment

  • Red Hat JBoss Fuse
    • 6.1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content