karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [karaf-cave] branch master updated: Avoid NPE with no URI is provided
Date Wed, 07 Mar 2018 10:18:33 GMT
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é <jbonofre@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
jbonofre@apache.org.

Mime
View raw message