Bug 4763 - SPEC - Parameter substitution syntax
SPEC - Parameter substitution syntax
Status: RESOLVED WORKSFORME
Product: jbatch
Classification: Unclassified
Component: source
1
All All
: P5 enhancement
: ---
Assigned To: cvignola
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-11 14:30 UTC by mminella
Modified: 2013-03-13 00:04 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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:

infile.name="myfile"
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: 


infile.name="myfile"
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.