Hi In a recent snapshot, there is a suspicious condition that may lead to a bug in modules/library/xml/src/main/java/org/geotools/xml/handlers/xsi/ElementTypeHandler.java
292 if ((ref != null) || "".equalsIgnoreCase(ref)) {
293 if (!(((name == null) || "".equalsIgnoreCase(name))
294 && ((type == null) || "".equalsIgnoreCase(type)))) {
295 throw new SAXException(
296 "Elements cannot have both a 'ref' and a 'name' + 'type' attribute");
297 }
298
299 name = type = ref;
300 }
In Line 292, when ref is null, the second condition will be always false. If ref will not be an empty string by a certain contract, this will not be an issue but just a code smell ("if (ref != null)" would be fine?). However, if Line 299 should not be executed when ref is an empty string, it should be (ref != null) && !"".equalsIgnoreCase(ref)? There would be other possible cases. This might be a trivial issue like minor code smell but wanted to report just in case. Thanks! |