Skip to content

Commit 8e7e70c

Browse files
committed
XML: fix code style issues
1 parent 695fb86 commit 8e7e70c

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

src/main/java/org/scijava/util/XML.java

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -129,35 +129,38 @@ public XML(final String path, final Document doc) {
129129
System.err.println(ClassUtils.getLocation(XPathFactory.class));
130130
}
131131

132-
XPath xpath = null;
132+
XPath xp = null;
133133
final Thread thread = Thread.currentThread();
134134
final ClassLoader contextClassLoader = thread.getContextClassLoader();
135135
try {
136136
ClassLoader loader = contextClassLoader;
137-
for (;;) try {
138-
xpath = XPathFactory.newInstance().newXPath();
137+
while (true) {
139138
try {
140-
// make sure that the current xalan/xerces pair can evaluate
141-
// expressions (i.e. *not* throw NoSuchMethodErrors).
142-
xpath.evaluate("//dummy", doc);
143-
} catch (Throwable t) {
144-
if (debug) {
145-
System.err.println("There was a problem with " +
146-
xpath.getClass() + " in " +
147-
ClassUtils.getLocation(xpath.getClass()) + ":");
148-
t.printStackTrace();
139+
xp = XPathFactory.newInstance().newXPath();
140+
try {
141+
// make sure that the current xalan/xerces pair can evaluate
142+
// expressions (i.e. *not* throw NoSuchMethodErrors).
143+
xp.evaluate("//dummy", doc);
144+
} catch (Throwable t) {
145+
if (debug) {
146+
System.err.println("There was a problem with " + xp.getClass() +
147+
" in " + ClassUtils.getLocation(xp.getClass()) + ":");
148+
t.printStackTrace();
149+
}
150+
throw new Error(t);
149151
}
150-
throw new Error(t);
152+
break;
153+
}
154+
catch (Error e) {
155+
if (debug) e.printStackTrace();
156+
loader = loader.getParent();
157+
if (loader == null) throw e;
158+
thread.setContextClassLoader(loader);
151159
}
152-
break;
153-
} catch (Error e) {
154-
if (debug) e.printStackTrace();
155-
loader = loader.getParent();
156-
if (loader == null) throw e;
157-
thread.setContextClassLoader(loader);
158160
}
159-
this.xpath = xpath;
160-
} finally {
161+
xpath = xp;
162+
}
163+
finally {
161164
thread.setContextClassLoader(contextClassLoader);
162165
}
163166
}

0 commit comments

Comments
 (0)