tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (TOMEE-2039) Closing Curly Brace Removed from Custom Resource Properties
Date Thu, 27 Apr 2017 22:12:04 GMT

    [ https://issues.apache.org/jira/browse/TOMEE-2039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15987795#comment-15987795
] 

Romain Manni-Bucau edited comment on TOMEE-2039 at 4/27/17 10:11 PM:
---------------------------------------------------------------------

For backward compatible reasons we cant change that. Idea was to be able to decrypt the key
(doing a lookup for instance). This is quite useful in enterprise and allows easy overrides
and an opiniated default handling (as before ${} support). Think we should support escaping.
Workaround can be to use a placeholder/system prop.


was (Author: romain.manni-bucau):
For backward compatible reasons we cant change that. Idea was to be able to decrypt the key
(doing a lookup for instance). This is quite useful in enterprise and allows easy overrides
and an opiniated default handling (as before ${} support).

> Closing Curly Brace Removed from Custom Resource Properties
> -----------------------------------------------------------
>
>                 Key: TOMEE-2039
>                 URL: https://issues.apache.org/jira/browse/TOMEE-2039
>             Project: TomEE
>          Issue Type: Bug
>    Affects Versions: 7.0.3
>            Reporter: Steve Beatty
>
> In migrating a project from OpenEJB 4.7 to 7, I started getting errors in a custom resource
due the '}' character being removed from a property value.  Looking in the source it appears
that issue is in org/apache/openejb/util/PropertyPlaceHolderHelper.java which is trying to
do variable substitution but is very aggressive about it - all $\{ and } Strings are being
removed in the process.  I believe the issue is the simpleValueAsStringOrCharArray method
and the snippet below should fix it.
> {code}
> public static Object simpleValueAsStringOrCharArray(final String raw) {
> 	if (raw == null) {
> 		return null;
> 	}
> 	
> 	// This will replace ${ or } if either is encountered instead of matching pair
> 	// I don't know why this is useful
> 	//
> 	//if (!raw.contains(PREFIX) || !raw.contains(SUFFIX)) {
> 	//	return decryptIfNeeded(raw.replace(PREFIX, "").replace(SUFFIX, ""), true);
> 	//}
> 	
> 	if (!raw.contains(PREFIX) && !raw.contains(SUFFIX)) {
> 		return decryptIfNeeded(raw, true);
> 	}
> 	String value = SUBSTITUTOR.replace(raw);
> 	if (!value.equals(raw) && value.startsWith("java:")) {
> 		value = value.substring(5);
> 	}
> 	
> 	// not sure the replaces here are useful either
> 	// if there are still markup characters now then the substitution didn't work
> 	// and it's probably more useful for debugging purposes to see those characters
> 	//
> 	// return decryptIfNeeded(value.replace(PREFIX, "").replace(SUFFIX, ""), true);
> 	return decryptIfNeeded(value, true);
> }
> {code}



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

Mime
View raw message