1. Sebastian Sdorra
  2. scm-manager

Commits

Sebastian Sdorra  committed 855e9f9

fix possible npes

  • Participants
  • Parent commits 8508f11
  • Branches default

Comments (0)

Files changed (2)

File scm-webapp/src/main/java/sonia/scm/plugin/AetherDependencyFilter.java

View file
  • Ignore whitespace
 
 //~--- non-JDK imports --------------------------------------------------------
 
+import com.google.common.io.Closeables;
+
 import org.sonatype.aether.artifact.Artifact;
 import org.sonatype.aether.graph.DependencyFilter;
 import org.sonatype.aether.graph.DependencyNode;
     try
     {
       scanner = new Scanner(
-          AetherDependencyFilter.class.getResourceAsStream(EXCLUDE_LIST));
+        AetherDependencyFilter.class.getResourceAsStream(EXCLUDE_LIST));
 
       while (scanner.hasNextLine())
       {
     }
     finally
     {
-      scanner.close();
+      Closeables.closeQuietly(scanner);
     }
   }
 

File scm-webapp/src/main/java/sonia/scm/util/DebugServlet.java

View file
  • Ignore whitespace
  *
  */
 
+
+
 package sonia.scm.util;
 
 //~--- non-JDK imports --------------------------------------------------------
 
+import com.google.common.io.Closeables;
 import com.google.inject.Singleton;
 
 //~--- JDK imports ------------------------------------------------------------
    */
   @Override
   protected void doGet(HttpServletRequest request, HttpServletResponse response)
-          throws ServletException, IOException
+    throws ServletException, IOException
   {
     processRequest(request, response);
   }
    */
   @Override
   protected void doPost(HttpServletRequest request,
-                        HttpServletResponse response)
-          throws ServletException, IOException
+    HttpServletResponse response)
+    throws ServletException, IOException
   {
     processRequest(request, response);
   }
    * @param session
    */
   private void appendSessionAttributes(PrintWriter writer,
-          final HttpSession session)
+    final HttpSession session)
   {
     writer.append("<h2>Session Attributes</h2>");
     appendAttributes(writer, new AttributeContext()
    * @throws ServletException
    */
   private void processRequest(HttpServletRequest request,
-                              HttpServletResponse response)
-          throws ServletException, IOException
+    HttpServletResponse response)
+    throws ServletException, IOException
   {
     PrintWriter writer = null;
 
     }
     finally
     {
-      writer.close();
+      Closeables.closeQuietly(writer);
     }
   }