Bug 4763

Summary: SPEC - Parameter substitution syntax
Product: jbatch Reporter: mminella
Component: sourceAssignee: cvignola
Severity: enhancement CC: issues
Priority: P5    
Version: 1   
Target Milestone: ---   
Hardware: All   
OS: All   

Description mminella 2013-03-11 14:30:11 UTC
In section 8.8.2 of the spec, the example that shows the default value has a semicolon at the end.  Can we drop that?  It seems pointless and actually implies that there is some form of evaluation of that statement (which would be a security risk).
Comment 1 cvignola 2013-03-13 00:04:15 UTC
There is no evaluation.  

You need a semi-colon (terminator) in order to allow use of more than one property substitution with defaulting in an attribute expression, such as to construct a file name, and also to be able to concatenate string literals to the end of a defaulted property. You need a way to know that you have reached the end of the defaulting string.

Here's one example:

default.file.name ="defaultfile"

<property name="log.file.name" value="#{jobParameters['unresolving.prop']}?:#{systemProperties['file.separator']};logdir #{systemProperties['file.separator']} #{jobParameters['infile.name']}?:#{systemProperties['default.file.name']};.log" /> 

This property will be able to resolve to something like  "/logdir/myfile.log"  or  "/logdir/defaultfile.log"  

Without the semi-colon you can only have one defaulting property and all literals and non-defaulting must placed before the defaulting property: 

default.file.name ="defaultfile"

#{systemProperties['file.separator']} #{jobParameters['infile.name']}?:#{systemProperties['file.name.junit']}.log   <---- no use of semi-colon
1) if infile.name resolves we get -----> "/myfile"
2) if infile.name doesn't resolve we get ------> /myfile.log 

So we lose the ".log" in the non-defaulting case because  you don't know where the end of the defaulting string is so you can't concatenate  anything after it.