[jboss-jira] [JBoss JIRA] (AS7-6432) Incorrect evaluation of system property for expression substitution
Brian Stansberry (JIRA)
jira-events at lists.jboss.org
Thu Jan 31 12:23:51 EST 2013
[ https://issues.jboss.org/browse/AS7-6432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12751657#comment-12751657 ]
Brian Stansberry commented on AS7-6432:
---------------------------------------
I haven't fully analyzed this, but I suspect this is a similar issue to AS7-6431.
When you invoke /system-property=foo:add(value=bar), as part of executing that operation "bar" is evaluated and if it is an expression, the expression is resolved. The resolved value is then passed to System.setProperty(). There's no mechanism to monitor any subsequent changes to the system property map / environment variables / security vault and then re-resolve and re-invoke System.getProperty() whenever new data comes in. The same applies to all other uses of expressions -- when the value of the configuration attribute needs to be provided to a runtime service (e.g. a port # to a web connector) the expression is resolved at that point, the resolved value is provided to the runtime service and that's it. The AS and EAP have never supported anything beyond this and trying to do so is not part of this feature.
When you use the resolve-expression operation, what you are doing is providing a string to the operation handler, which resolves any expressions in it at that moment in time. So you shouldn't expect to get the same result that a resolution in at an earlier point in time would have gotten.
> Incorrect evaluation of system property for expression substitution
> -------------------------------------------------------------------
>
> Key: AS7-6432
> URL: https://issues.jboss.org/browse/AS7-6432
> Project: Application Server 7
> Issue Type: Bug
> Components: Domain Management
> Affects Versions: 7.2.0.Alpha1
> Reporter: Ondřej Chaloupka
> Assignee: Brian Stansberry
>
> Finally I think that I've got a way how to resolve expressions on VM where container resides.
> My test case:
> https://github.com/ochaloup/jboss-as/blob/expression-substitution-run-in-server/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/management/api/expression/ExpressionSubstitutionInContainerTestCase.java
> From this I've found issues for system property evaluation. I mean the case when System.getProperty(someName) is called.
> The application should get the evaluated value from expression but instead of it it gets the default value from expression.
> The problematic test cases are
> testSystemPropertyEvaluation - there is defined system property by calling System.setProperty and it's expected that the expression which uses this defined property will evaluate itself to the value of the System.setProperty. For the way of :resolve-expression it works fine but for getting value with System.getProperty the old default value is returned.
> setInnerExpression - it defines two levels of evaluation of expression and it seems that then the System.getProperty on the second level of evaluation does not get the evaluated/substituted value
> I hope that the test code will be more comprehensible than my explanation.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list