sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1777305 - in /sling/trunk/contrib/extensions/reqanalyzer: ./ src/main/java/org/apache/sling/reqanalyzer/impl/gui/ src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/sling/ src/test/java/org/apach...
Date Wed, 04 Jan 2017 13:04:39 GMT
Author: fmeschbe
Date: Wed Jan  4 13:04:38 2017
New Revision: 1777305

URL: http://svn.apache.org/viewvc?rev=1777305&view=rev
Log:
SLING-6433 Request Processing Analyzer throws IOOB due to old format assumptions of RequestProgressTracker
output

Apply patch by Krystian Nowak (thanks a lot)

Added:
    sling/trunk/contrib/extensions/reqanalyzer/src/test/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/java/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/reqanalyzer/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/reqanalyzer/impl/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/reqanalyzer/impl/gui/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModelTest.java
    sling/trunk/contrib/extensions/reqanalyzer/src/test/resources/
    sling/trunk/contrib/extensions/reqanalyzer/src/test/resources/requesttracker.txt
Modified:
    sling/trunk/contrib/extensions/reqanalyzer/pom.xml
    sling/trunk/contrib/extensions/reqanalyzer/src/main/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModel.java

Modified: sling/trunk/contrib/extensions/reqanalyzer/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/reqanalyzer/pom.xml?rev=1777305&r1=1777304&r2=1777305&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/reqanalyzer/pom.xml (original)
+++ sling/trunk/contrib/extensions/reqanalyzer/pom.xml Wed Jan  4 13:04:38 2017
@@ -82,6 +82,16 @@
 				  </signature>
 				</configuration>
 			</plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <!--  text test resources -->
+                        <exclude>src/test/resources/*.txt</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 

Modified: sling/trunk/contrib/extensions/reqanalyzer/src/main/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModel.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/reqanalyzer/src/main/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModel.java?rev=1777305&r1=1777304&r2=1777305&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/reqanalyzer/src/main/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModel.java
(original)
+++ sling/trunk/contrib/extensions/reqanalyzer/src/main/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModel.java
Wed Jan  4 13:04:38 2017
@@ -30,11 +30,10 @@ public class RequestTableModel implement
     private long previousStamp;
     
     void addRow(String row) {
-        // split row: "%1$7d (%2$tF %2$tT) %3$s%n
+        // split row: "%1$7d %3$s%n
         
         final String stampS = row.substring(0, 7);
-        final int endTimeStamp = row.indexOf(')');
-        final String message = row.substring(endTimeStamp+2); 
+        final String message = row.substring(7); 
         
         long stamp = Long.parseLong(stampS.trim());
         long delta = stamp - this.previousStamp;

Added: sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModelTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModelTest.java?rev=1777305&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModelTest.java
(added)
+++ sling/trunk/contrib/extensions/reqanalyzer/src/test/java/org/apache/sling/reqanalyzer/impl/gui/RequestTableModelTest.java
Wed Jan  4 13:04:38 2017
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.reqanalyzer.impl.gui;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.junit.Test;
+
+public class RequestTableModelTest {
+
+    private RequestTableModel rtm = new RequestTableModel();
+
+    @Test
+    public final void testAddRow() throws IOException {
+
+        BufferedReader r = new BufferedReader(
+                new InputStreamReader(getClass().getResourceAsStream("/requesttracker.txt")));
+
+        String line;
+        while ((line = r.readLine()) != null) {
+            if (line.charAt(0) == '!') {
+                rtm.addRow(line.substring(1));
+            }
+        }
+
+        r.close();
+
+        assertTrue(rtm.getRowCount() > 0);
+    }
+
+}

Added: sling/trunk/contrib/extensions/reqanalyzer/src/test/resources/requesttracker.txt
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/reqanalyzer/src/test/resources/requesttracker.txt?rev=1777305&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/reqanalyzer/src/test/resources/requesttracker.txt (added)
+++ sling/trunk/contrib/extensions/reqanalyzer/src/test/resources/requesttracker.txt Wed Jan
 4 13:04:38 2017
@@ -0,0 +1,7 @@
+:1483519553437:3:GET:/libs/mylib/data.json:application/json; charset=ISO-8859-1:200
+!      0 TIMER_START{Request Processing}
+!      2 COMMENT timer_end format is {<elapsed microseconds>,<timer name>} <optional
message>
+!     11 LOG Method=GET, PathInfo=/libs/mylib/data.json
+!  16431 LOG Including resource MyResource, type=my/ohmy/type, superType=null, path=/libs/mylib:foo
(SlingRequestPathInfo: path='/libs/mylib:foo', selectorString='null', extension='json', suffix='/my/my.html')
+! 925338 TIMER_START{resolveServlet(/my/servlet)}
+! 925353 TIMER_END{13,resolveServlet(/my/servlet)} Using servlet /libs/mylib/mylib.jsp



Mime
View raw message