15 years ago
bug in RemoveEmptyContentRequestFilter
Hi,
I really like the huge amount of functionality your product provides, keep up the good work.
Method: com.eviware.soapui.impl.wsdl.submit.filters.RemoveEmptyContentRequestFilter.removeEmptyContent()
Problem: if( attributes.getLength() == 0 && cursor.getTextValue() == null
|| cursor.getTextValue().trim().length() == 0 && XmlUtils.getFirstChildElement( elm ) == null )
the logical OR (||) has a lower precedence than the logical AND (&&) and the entire expression actually ends up being two AND clauses. The result is that items which have attributes, but DO NOT HAVE children are deleted INCORRECTLY.
Solution: if( attributes.getLength() == 0
&& (cursor.getTextValue() == null || cursor.getTextValue().trim().length() == 0)
&& XmlUtils.getFirstChildElement( elm ) == null )
Another Problem: Items that have children which end up being removed, WILL NOT be removed. I have a fix for this and if you are interested I can just send you the body of the method, but you will probably come up with your own solution. My solution is basically to remember the parents of removed nodes, and then to check if they did not become empty as a result of the removal.
Hope this helps,
Tervel
I really like the huge amount of functionality your product provides, keep up the good work.
Method: com.eviware.soapui.impl.wsdl.submit.filters.RemoveEmptyContentRequestFilter.removeEmptyContent()
Problem: if( attributes.getLength() == 0 && cursor.getTextValue() == null
|| cursor.getTextValue().trim().length() == 0 && XmlUtils.getFirstChildElement( elm ) == null )
the logical OR (||) has a lower precedence than the logical AND (&&) and the entire expression actually ends up being two AND clauses. The result is that items which have attributes, but DO NOT HAVE children are deleted INCORRECTLY.
Solution: if( attributes.getLength() == 0
&& (cursor.getTextValue() == null || cursor.getTextValue().trim().length() == 0)
&& XmlUtils.getFirstChildElement( elm ) == null )
Another Problem: Items that have children which end up being removed, WILL NOT be removed. I have a fix for this and if you are interested I can just send you the body of the method, but you will probably come up with your own solution. My solution is basically to remember the parents of removed nodes, and then to check if they did not become empty as a result of the removal.
Hope this helps,
Tervel