Skip to content

Commit 02d35fd

Browse files
committed
Add Logger and use it
Use try-with-resources
1 parent 3116743 commit 02d35fd

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

enterprise/maven.jaxws/src/org/netbeans/modules/maven/jaxws/wizards/JaxWsClientCreator.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public class JaxWsClientCreator implements ClientCreator {
6363
private boolean isWeb;
6464
private boolean isEJB;
6565
private boolean isJakartaEENameSpace;
66+
67+
private static final Logger LOG = Logger.getLogger(JaxWsClientCreator.class.getCanonicalName());
6668

6769
/**
6870
* Creates a new instance of WebServiceClientCreator
@@ -113,9 +115,7 @@ public void createClient() throws IOException {
113115
MavenModelUtils.addMetroLibrary(project);
114116
MavenModelUtils.addJavadoc(project);
115117
} catch (Exception ex) {
116-
Logger.getLogger(
117-
JaxWsClientCreator.class.getName()).log(
118-
Level.INFO, "Cannot add Metro library to pom file", ex); //NOI18N
118+
LOG.log(Level.INFO, "Cannot add Metro library to pom file", ex); //NOI18N
119119
}
120120
}
121121

@@ -136,6 +136,7 @@ public void performOperation(POMModel model) {
136136
}
137137
}
138138
};
139+
139140
Utilities.performPOMModelOperations(project.getProjectDirectory().getFileObject("pom.xml"),
140141
Collections.singletonList(operation));
141142

@@ -147,7 +148,7 @@ public void performOperation(POMModel model) {
147148
Collections.singletonList("compile")); //NOI18N
148149

149150
RunUtils.executeMaven(cfg);
150-
}
151+
}
151152
}
152153
}
153154

java/maven.model/src/org/netbeans/modules/maven/model/Utilities.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,8 @@ public static void saveChanges(AbstractDocumentModel<?> model) throws IOExceptio
243243
if (fo == null) {
244244
fo = fParentFo.createData(file.getName());
245245
}
246-
OutputStream os = fo.getOutputStream();
247-
try {
246+
try (OutputStream os = fo.getOutputStream()) {
248247
os.write(text.getBytes(StandardCharsets.UTF_8));
249-
} finally {
250-
os.close();
251248
}
252249
}
253250
});

0 commit comments

Comments
 (0)