You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2015/10/06 09:53:56 UTC

svn commit: r1706960 [3/3] - in /sling/trunk/tooling/ide: api/src/org/apache/sling/ide/filter/ api/src/org/apache/sling/ide/osgi/impl/ api/src/org/apache/sling/ide/serialization/ api/src/org/apache/sling/ide/transport/ api/src/org/apache/sling/ide/tran...

Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManager.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManager.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/VltSerializationManager.java Tue Oct  6 07:53:54 2015
@@ -103,15 +103,12 @@ public class VltSerializationManager imp
 
         // TODO - refrain from doing I/O here
         // TODO - copied from TransactionImpl
-        InputStream in = null;
-        try {
-            in = new BufferedInputStream(new FileInputStream(file));
+        
+        try (InputStream in = new BufferedInputStream(new FileInputStream(file))) {
             SerializationType serType = XmlAnalyzer.analyze(new InputSource(in));
             return serType == SerializationType.XML_DOCVIEW;
         } catch (IOException e) {
             throw new RuntimeException(e);
-        } finally {
-            IOUtils.closeQuietly(in);
         }
     }
 
@@ -136,9 +133,8 @@ public class VltSerializationManager imp
 
         // TODO - refrain from doing I/O here
         // TODO - copied from TransactionImpl
-        InputStream in = null;
-        try {
-            in = new BufferedInputStream(new FileInputStream(file));
+        
+        try (InputStream in = new BufferedInputStream(new FileInputStream(file))) {
             SerializationType serType = XmlAnalyzer.analyze(new InputSource(in));
             if (serType == SerializationType.XML_DOCVIEW) {
                 return getPathWithoutXmlExtension(file);
@@ -147,8 +143,6 @@ public class VltSerializationManager imp
             return file.getAbsolutePath();
         } catch (IOException e) {
             throw new RuntimeException(e);
-        } finally {
-            IOUtils.closeQuietly(in);
         }
     }
 
@@ -252,10 +246,7 @@ public class VltSerializationManager imp
             parser.parse(source, handler);
 
             return handler.getRoot();
-        } catch (SAXException e) {
-            // TODO proper error handling
-            throw new IOException(e);
-        } catch (ParserConfigurationException e) {
+        } catch (SAXException | ParserConfigurationException e) {
             // TODO proper error handling
             throw new IOException(e);
         }

Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/jcr/RepositoryUtils.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/jcr/RepositoryUtils.java?rev=1706960&r1=1706959&r2=1706960&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/jcr/RepositoryUtils.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/jcr/RepositoryUtils.java Tue Oct  6 07:53:54 2015
@@ -38,7 +38,7 @@ public abstract class RepositoryUtils {
     private static final Object SYNC = new Object();
     private static final String[] WEBDAV_URL_LOCATIONS = new String[] { "server/-/jcr:root", "crx/-/jcr:root" };
     private static final RepositoryFactory FACTORY = new DAVExRepositoryFactory();
-    private static final Map<RepositoryAddress, Repository> REGISTERED_REPOSITORIES = new HashMap<RepositoryAddress, Repository>();
+    private static final Map<RepositoryAddress, Repository> REGISTERED_REPOSITORIES = new HashMap<>();
     
     public static Repository getRepository(RepositoryInfo repositoryInfo) throws RepositoryException {
         final RepositoryAddress repositoryAddress = getRepositoryAddress(repositoryInfo);