pepness commented on code in PR #5444:
URL: https://github.com/apache/netbeans/pull/5444#discussion_r1100718838


##########
java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/unit/PUDataObject.java:
##########
@@ -174,21 +175,15 @@ public boolean parseDocument() {
         } else if (isModified()){//if it's isn't modified and persistenc 
eexits (parsed) no need to reparse
             try{
                 String oldVersion = persistence.getVersion();
-                java.io.InputStream is = getEditorSupport().getInputStream();
                 String version=Persistence.VERSION_1_0;
-                try {
+                try (InputStream is = getEditorSupport().getInputStream()) {
                     version=JPAParseUtils.getVersion(is);
                 } catch (SAXException ex) {
                     LOG.log(Level.INFO, null, ex);//persistence.xml may be 
corrupted, but no need to show exception dialog
                 }
-                finally
-                {
-                    is.close();
-                }
-                is = getEditorSupport().getInputStream();
                 Persistence newPersistence;
                 Persistence cleanPersistence;
-                try {
+                try (java.io.InputStream is = 
getEditorSupport().getInputStream()) {

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to