diff --git a/src/main/java/net/vhati/modmanager/core/XMLPatcher.java b/src/main/java/net/vhati/modmanager/core/XMLPatcher.java index 035a97f..3e51c9b 100644 --- a/src/main/java/net/vhati/modmanager/core/XMLPatcher.java +++ b/src/main/java/net/vhati/modmanager/core/XMLPatcher.java @@ -94,12 +94,15 @@ public class XMLPatcher { if ( node.getName().equals( "findName" ) ) { String searchName = node.getAttributeValue( "name" ); + String searchType = node.getAttributeValue( "type" ); boolean searchReverse = getAttributeBooleanValue( node, "reverse", true ); int searchStart = getAttributeIntValue( node, "start", 0 ); int searchLimit = getAttributeIntValue( node, "limit", 1 ); if ( searchName == null || searchName.length() == 0 ) throw new IllegalArgumentException( String.format( "<%s> requires a name attribute (%s).", node.getName(), getPathToRoot(node) ) ); + if ( searchType != null && searchType.length() == 0 ) + throw new IllegalArgumentException( String.format( "<%s> type attribute, when present, can't be empty (%s).", node.getName(), getPathToRoot(node) ) ); if ( searchStart < 0 ) throw new IllegalArgumentException( String.format( "<%s> 'start' attribute is not >= 0 (%s).", node.getName(), getPathToRoot(node) ) ); if ( searchLimit < -1 ) @@ -107,7 +110,7 @@ public class XMLPatcher { Map attrMap = new HashMap(); attrMap.put( "name", searchName ); - LikeFilter searchFilter = new LikeFilter( null, attrMap, null ); + LikeFilter searchFilter = new LikeFilter( searchType, attrMap, null ); List matchedNodes = new ArrayList( contextNode.getContent( searchFilter ) ); if ( searchReverse ) Collections.reverse( matchedNodes );