From 8862bd412d3299312a3324f24d015a87dbae679d Mon Sep 17 00:00:00 2001 From: ThibaudLopez Date: Tue, 12 Aug 2014 23:39:33 -0700 Subject: [PATCH 1/4] Update NotifyServlet.java Corrected the code that gets notificationString for when notificationReader.ready() returns false. --- src/main/java/com/google/glassware/NotifyServlet.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/glassware/NotifyServlet.java b/src/main/java/com/google/glassware/NotifyServlet.java index cf96c29..742be11 100644 --- a/src/main/java/com/google/glassware/NotifyServlet.java +++ b/src/main/java/com/google/glassware/NotifyServlet.java @@ -71,8 +71,9 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) // Count the lines as a very basic way to prevent Denial of Service attacks int lines = 0; - while (notificationReader.ready()) { - notificationString += notificationReader.readLine(); + String line; + while ((line = notificationReader.readLine()) != null) { + notificationString += line; lines++; // No notification would ever be this long. Something is very wrong. @@ -80,6 +81,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response) throw new IOException("Attempted to parse notification payload that was unexpectedly long."); } } + notificationReader.close(); LOG.info("got raw notification " + notificationString); From 13230fe1e96ce76b49253506ee06f9bb8ecdedb1 Mon Sep 17 00:00:00 2001 From: Krish Date: Tue, 7 Oct 2014 00:39:55 -0400 Subject: [PATCH 2/4] Fix the condition for displaying attachament types --- src/main/webapp/index.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index d42b30c..51d78e4 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -109,7 +109,7 @@ limitations under the License. <% if (timelineItem.getAttachments() != null) { for (Attachment attachment : timelineItem.getAttachments()) { - if (MirrorClient.getAttachmentContentType(credential, timelineItem.getId(), attachment.getId()).startsWith("")) { %> + if (MirrorClient.getAttachmentContentType(credential, timelineItem.getId(), attachment.getId()).startsWith("image")) { %> <% } else { %> From 71ea9169d2324e7ea0b669030024a9b4ca0f42ac Mon Sep 17 00:00:00 2001 From: Krish Date: Tue, 7 Oct 2014 01:00:21 -0400 Subject: [PATCH 3/4] Made Images clickable --- src/main/webapp/index.jsp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index 51d78e4..44fe7bd 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -110,8 +110,11 @@ limitations under the License. if (timelineItem.getAttachments() != null) { for (Attachment attachment : timelineItem.getAttachments()) { if (MirrorClient.getAttachmentContentType(credential, timelineItem.getId(), attachment.getId()).startsWith("image")) { %> + + <% } else { %> From 8d5f67ef1214203cd24428d46431710b0d9b12fd Mon Sep 17 00:00:00 2001 From: Krish Date: Tue, 7 Oct 2014 21:51:17 -0400 Subject: [PATCH 4/4] Fixed Line Indents --- src/main/webapp/index.jsp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index 44fe7bd..4f3817f 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -110,11 +110,11 @@ limitations under the License. if (timelineItem.getAttachments() != null) { for (Attachment attachment : timelineItem.getAttachments()) { if (MirrorClient.getAttachmentContentType(credential, timelineItem.getId(), attachment.getId()).startsWith("image")) { %> - - - + + + <% } else { %>