Laszlo Hornyak has uploaded a new change for review.

Change subject: engine: java 1.7 resource block for keystore
......................................................................

engine: java 1.7 resource block for keystore

- use java 1.7 try syntax to close the file input stream

Change-Id: If296dfce114b3c98dfce8fe333f034c3ba7ea47b
Signed-off-by: Laszlo Hornyak <[email protected]>
---
M backend/manager/modules/bll/pom.xml
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
2 files changed, 11 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/12721/1

diff --git a/backend/manager/modules/bll/pom.xml 
b/backend/manager/modules/bll/pom.xml
index f21118d..96eb20c 100644
--- a/backend/manager/modules/bll/pom.xml
+++ b/backend/manager/modules/bll/pom.xml
@@ -136,6 +136,14 @@
 
     <plugins>
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.7</source>
+          <target>1.7</target>
+        </configuration>
+      </plugin>
+      <plugin>
         <artifactId>maven-resources-plugin</artifactId>
         <executions>
           <execution>
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
index 0d87efa..3b8ed75 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java
@@ -201,9 +201,9 @@
         final String alias = Config.<String>GetValue(ConfigValues.CertAlias);
         final char[] password = 
Config.<String>GetValue(ConfigValues.keystorePass).toCharArray();
 
-        InputStream in = null;
-        try {
-            in = new FileInputStream(keystoreFile);
+
+        try (
+                final InputStream in = new FileInputStream(keystoreFile)) {
             KeyStore ks = KeyStore.getInstance("PKCS12");
             ks.load(in, password);
 
@@ -242,16 +242,6 @@
                 ),
                 e
             );
-        }
-        finally {
-            if (in != null) {
-                try {
-                    in.close();
-                }
-                catch(IOException e) {
-                    log.error("Cannot close key store", e);
-                }
-            }
         }
     }
 


--
To view, visit http://gerrit.ovirt.org/12721
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If296dfce114b3c98dfce8fe333f034c3ba7ea47b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Laszlo Hornyak <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to