Re: Unable to use Resouce value with $

Richard Zowalla <[email protected]>
Newsgroups gmane.comp.java.openejb.user
Message-ID <2ca4e112c6012396bf7e85854adde5813bb4a865.camel__9879.24695234455$1694506110$gmane$org@zowalla.com>
You are right. I looked into the wrong properties in the debugger ;-)

The relevant code fragment is:

https://github.com/apache/tomee/blob/main/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/util/ServiceInfos.java#L176

It seems, that we didn't implement an escape mechanismn, so it tries to
resolve a service for $ in any case resulting in the NULL value.


Am Dienstag, dem 12.09.2023 um 08:44 +0200 schrieb Thomas Butz:
> That didn't work.
> 
> ----- Ursprüngliche Mail -----
> Von: "Richard Zowalla" <[email protected]>
> An: "users" <[email protected]>
> Gesendet: Freitag, 8. September 2023 20:34:38
> Betreff: Re: Unable to use Resouce value with $
> 
> Hi,
> 
> $ is used as an identifier, i.e. for injecting properties.
> 
> You can use 
> 
>    <Resource id="config" class-name="com.exmaple.MyResource">
>         SkipPropertiesFallback = true
>         test = $abc
>     </Resource>
> 
> The `SkipPropertiesFallback` will prevent the resolution of $-values.
> The related code is here: [1]
> 
> Hope it helps.
> Richard
> 
> [1]
> https://github.com/apache/tomee/blob/main/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java#L3083
> 
> 
> Am Freitag, dem 08.09.2023 um 15:44 +0200 schrieb Thomas Butz:
> > I'm trying to implement a custom resources class by implementing
> > setProperties(Properties) as outlined in the documentation:
> > 
> > https://tomee.apache.org/application-resources.html
> > 
> > The resource is defined tomee.xml:
> > 
> > <Resource id="myresource" class-name="com.exmaple.MyResource">
> > myproperty=$omething
> > </Resource>
> > 
> > But as soon as the value starts with a dollar sign, its value is
> > interpreted as null while passed into setProperties().
> > My current theory is that property substitution is interfering
> > here,
> > but I have no clue how to avoid it.
> > 
> > My failed attempts include:
> > 
> > myproperty=\$omething
> > myproperty=$$omething
> > myproperty=\u0024omething
> > myproperty=&#x0024;domething
> > myproperty=${xxx:-$omething}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.