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

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cave.git


The following commit(s) were added to refs/heads/master by this push:
     new 795ce66  Avoid NPE with no URI is provided
795ce66 is described below

commit 795ce66f934c616430c66486e1d3afa1d37d75b1
Author: Jean-Baptiste Onofré <jbono...@apache.org>
AuthorDate: Wed Mar 7 11:18:23 2018 +0100

    Avoid NPE with no URI is provided
---
 .../org/apache/karaf/cave/server/http/CaveHttpServlet.java  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git 
a/server/http/src/main/java/org/apache/karaf/cave/server/http/CaveHttpServlet.java
 
b/server/http/src/main/java/org/apache/karaf/cave/server/http/CaveHttpServlet.java
index ff02500..febb8b3 100644
--- 
a/server/http/src/main/java/org/apache/karaf/cave/server/http/CaveHttpServlet.java
+++ 
b/server/http/src/main/java/org/apache/karaf/cave/server/http/CaveHttpServlet.java
@@ -114,6 +114,19 @@ public class CaveHttpServlet extends HttpServlet {
 
         String uri = request.getPathInfo();
 
+        if (uri == null) {
+            response.setContentType("text/html");
+            PrintWriter writer = response.getWriter();
+            writer.println("<html><head><title>Apache Karaf 
Cave</title></head>");
+            writer.println("<body>");
+            writer.println("<center><b>Apache Karaf Cave</b><br>Please provide 
an URI</center>");
+            writer.println("</body>");
+            writer.println("</html>");
+            writer.flush();
+            writer.close();
+            return;
+        }
+
         // Cave Feature gateway
         if (uri.equals("/gateway")) {
             response.setContentType("application/xml");

-- 
To stop receiving notification emails like this one, please contact
jbono...@apache.org.

Reply via email to