File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/main/java/org/scijava/util Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 5252 */
5353public class POM extends XML implements Comparable <POM >, Versioned {
5454
55+ private String version ;
56+
5557 /** Parses a POM from the given file. */
5658 public POM (final File file ) throws ParserConfigurationException ,
5759 SAXException , IOException
@@ -145,9 +147,15 @@ public int compareTo(final POM pom) {
145147 /** Gets the POM's version. */
146148 @ Override
147149 public String getVersion () {
148- final String version = cdata ("//project/version" );
149- if (version != null ) return version ;
150- return cdata ("//project/parent/version" );
150+ if (version == null ) {
151+ synchronized (this ) {
152+ if (version == null ) {
153+ version = cdata ("//project/version" );
154+ if (version == null ) version = cdata ("//project/parent/version" );
155+ }
156+ }
157+ }
158+ return version ;
151159 }
152160
153161 // -- Utility methods --
You can’t perform that action at this time.
0 commit comments