You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Al Byers <by...@automationgroups.com> on 2009/01/16 21:51:19 UTC

Problems with FlexibleStringExpander

We seem to be having trouble with FlexibleStringExpander. We are in the
process of writing up a test case, but I wanted to see if anyone else is
seeing problems.

In one case, it simply does not find the replacement string in the passed
context when it appears to be there. This happens in a line from the
component-load.xml file where i have something like:

    <load-component component-location="${ofbiz.home}/../dojo"/>
the console.log shows:
2009-01-16 11:14:56,376 (main) [ ComponentContainer.java:145:ERROR] Cannot
load component :  @ /../dojo : The given component root location is not a
directory: /../dojo/
2009-01-16 11:14:56,377 (main) [ ComponentContainer.java:148:ERROR] Cannot
load component :  @ /../dojo

In ComponentLoaderConfig I print out the contents of systemsProp and
"ofbiz.home" seems to be there.

 In another, it takes the string "000" and casts it to an integer.

Thanks,

-Al

Re: Problems with FlexibleStringExpander

Posted by Adrian Crum <ad...@yahoo.com>.
Al,

As far as I know, the ${ofbiz.home} identifier is used in OFBiz documentation to represent the home folder for OFBiz. I don't think that identifier was actually used in code.

If you need access to the OFBiz home folder context variable, the correct expression used to be ${env.ofbiz.home} - but that has been replaced with the preferred ${sys:getProperty('ofbiz.home')} expression introduced with the Uniform Expression Language. For more information, see:

http://api.ofbiz.org/org/ofbiz/base/util/string/UelFunctions.html

In the other issue - casting "000" to a zero integer - try taking another look at your code. Now that OFBiz supports UEL, any expression that evaluates to an integer will result in an integer. If you want the expression to be kept as a String, you can either surround it with quotes, or convert it to a String with the UEL function str:toString(Object).

-Adrian


--- On Fri, 1/16/09, Al Byers <by...@automationgroups.com> wrote:

> From: Al Byers <by...@automationgroups.com>
> Subject: Problems with FlexibleStringExpander
> To: dev@ofbiz.apache.org
> Date: Friday, January 16, 2009, 12:51 PM
> We seem to be having trouble with FlexibleStringExpander. We
> are in the
> process of writing up a test case, but I wanted to see if
> anyone else is
> seeing problems.
> 
> In one case, it simply does not find the replacement string
> in the passed
> context when it appears to be there. This happens in a line
> from the
> component-load.xml file where i have something like:
> 
>     <load-component
> component-location="${ofbiz.home}/../dojo"/>
> the console.log shows:
> 2009-01-16 11:14:56,376 (main) [
> ComponentContainer.java:145:ERROR] Cannot
> load component :  @ /../dojo : The given component root
> location is not a
> directory: /../dojo/
> 2009-01-16 11:14:56,377 (main) [
> ComponentContainer.java:148:ERROR] Cannot
> load component :  @ /../dojo
> 
> In ComponentLoaderConfig I print out the contents of
> systemsProp and
> "ofbiz.home" seems to be there.
> 
>  In another, it takes the string "000" and casts
> it to an integer.
> 
> Thanks,
> 
> -Al