[ 
https://issues.apache.org/jira/browse/JXPATH-103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matt Benson closed JXPATH-103.
------------------------------

    Resolution: Invalid

I'm afraid I _must_ ask.  There really isn't much of a way to work around this; 
creating a path without passing in the value to set requires a factory to 
generate the initial value at the path.  In fact you should see that 
createPathAndSetValue() throws the same exception if more than one step of the 
path needs to be created.  Finally, I am at a loss to understand your comment 
that you have to pass around the Pointer as createPathAndSetValue() returns the 
created Pointer.  If this information does not help you, please return the 
discussion to [EMAIL PROTECTED]

Thanks,
Matt

> createPathAndSetValue(...) differs from createPath(...).setValue(...) : 
> "Factory is not set"
> --------------------------------------------------------------------------------------------
>
>                 Key: JXPATH-103
>                 URL: https://issues.apache.org/jira/browse/JXPATH-103
>             Project: Commons JXPath
>          Issue Type: Bug
>    Affects Versions: 1.2 Final
>            Reporter: Hans-Peter Stoerr
>            Priority: Minor
>
> Hi!
> If I have a bean (as shown below), I guess it is an error that the second of 
> the next two calls does not work:
>         JXPathContext.newContext(new 
> TestBean()).createPathAndSetValue("/attrib", "val");
>         JXPathContext.newContext(new 
> TestBean()).createPath("/attrib").setValue("val");
> The first one works, but the second one throws up:
> org.apache.commons.jxpath.JXPathException: Exception trying to create xpath 
> /attrib; Factory is not set on the JXPathContext - cannot create path: /attrib
>       at 
> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPath(JXPathContextReferenceImpl.java:450)
>       at 
> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPath(JXPathContextReferenceImpl.java:427)
> The bean is as follows:
>     public static class TestBean {
>         public String plainattrib;
>         private String attrib;
>         public String getAttrib() {
>             return attrib;
>         }
>         public void setAttrib(String attrib) {
>             this.attrib = attrib;
>         }
>     }
> (Don't ask: I cannot use the first method, since I have to pass around the 
> Pointer.)
> Thanks so much,
> Hans-Peter

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to