This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-tooling-support-install.git

commit c72ad519b8b0fb9741cfeb9f728605fa0e67f7ca
Author: Robert Munteanu <[email protected]>
AuthorDate: Tue Oct 22 14:31:50 2013 +0000

    SLING-3019 - Provide a mechanism to install a bundle based on a
    directory
    
    Code cleanups:
    
    - Use IOUtils.closeQuietly where applicable
    - Use logAndWriteError consistently
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1534646 
13f79535-47bb-0310-9956-ffa450edef68
---
 .../tooling/support/install/impl/InstallServlet.java  | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/tooling/support/install/impl/InstallServlet.java
 
b/src/main/java/org/apache/sling/tooling/support/install/impl/InstallServlet.java
index 47b3bc0..dd0239e 100644
--- 
a/src/main/java/org/apache/sling/tooling/support/install/impl/InstallServlet.java
+++ 
b/src/main/java/org/apache/sling/tooling/support/install/impl/InstallServlet.java
@@ -212,33 +212,24 @@ public class InstallServlet extends HttpServlet {
                                 result.render(resp.getWriter());
                                 return;
                             } catch ( final BundleException be ) {
-                                logger.info("Unable to install/update bundle 
from dir " + dir, be);
-                                result = new InstallationResult(false,
-                                        "Unable to install/update bundle from 
dir " + dir);
+                                logAndWriteError("Unable to install/update 
bundle from dir " + dir, be, resp);
                             }
                         } finally {
                             tempFile.delete();
                         }
                     } else {
-                        logger.info("Manifest in {} does not have a symbolic 
name", dir);
-                        result = new InstallationResult(false, "Manifest in " 
+ dir + " does not have a symbolic name");
+                        logAndWriteError("Manifest in " + dir + " does not 
have a symbolic name", resp);
                     }
                 } finally {
-                    if ( fis != null ) {
-                        fis.close();
-                    }
+                    IOUtils.closeQuietly(fis);
                 }
             } else {
                 result = new InstallationResult(false, "Dir " + dir + " does 
not have a manifest");
-                logger.info("Dir {} does not have a manifest", dir);
+                logAndWriteError("Dir " + dir + " does have a manifest", resp);
             }
         } else {
             result = new InstallationResult(false, "Dir " + dir + " does not 
exist");
-            logger.info("Dir {} does not exist", dir);
-        }
-        resp.setStatus(500);
-        if (result != null) {
-            result.render(resp.getWriter());
+            logAndWriteError("Dir " + dir + " does not exist", resp);
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to