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 2017/11/07 10:23:39 UTC

[sling-org-apache-sling-tooling-support-install] 04/07: SLING-3019 - Provide a mechanism to install a bundle based on a directory

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

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

commit 3116ce4519bdc43c262f1c48f16f76d36397decd
Author: Robert Munteanu <ro...@apache.org>
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/tooling/support/install@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
"commits@sling.apache.org" <co...@sling.apache.org>.