[windup-dev] XmlFile unexpected results?

Jess Sightler jsightle at redhat.com
Fri Jan 29 16:02:17 EST 2016


File.java used to have this problem as well:

https://github.com/windup/windup/blob/master/rules-base/api/src/main/java/org/jboss/windup/rules/files/condition/File.java

Because of this, we changed it a while back so that it actually returns 
a filelocationmodel pointing to the first part of the file. I think that 
works pretty well.

On 01/28/2016 11:21 AM, Matej Briskar wrote:
> A topic from today's meeting, however I thought it will be better understood in text.
> XmlFile may cause confusion, because it may return different results based on what it is queried for and therefore throw exceptions in some cases.
> 1. XmlFile querying for xpath will always return part of the file with the line number etc.
> 2. XmlFile not querying for xpath but other things (used DTD query or something similar), returns the whole file.
>
> The problem here is that using second XmlFile-style without xpath throws exception when used with Hints. Therefore the second condition supports only classifications.
> Is this expected behaviour? That is the my only question.
>
> E.g
> This works:
> <when>
>    <xmlfile matches="*xpath*" />
> <perfom>
>    <hint>
>     ...
>    </hint>
> </perform>
>
> This does not and throws exception (cannot cast to FileLocationModel):
> <when>
>    <xmlfile public-id="*xpath*" />
> <perfom>
>    <hint>
>     ...
>    </hint>
> </perform>
>
> If that is not a problem, it is OK. Just wanted to point it out.
> _______________________________________________
> windup-dev mailing list
> windup-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/windup-dev



More information about the windup-dev mailing list