From bedb00777b4c58b836200e94bf329fa855584243 Mon Sep 17 00:00:00 2001 From: tzolotuhin Date: Wed, 21 Sep 2016 16:44:08 +0700 Subject: [PATCH] Fix bug with java.lang.ArrayIndexOutOfBoundsException: 30 at org.openqa.selenium.remote.server.log.ShortTermMemoryHandler.publish(ShortTermMemoryHandler.java:62) at java.util.logging.Logger.log(Unknown Source) at java.util.logging.Logger.doLog(Unknown Source) at java.util.logging.Logger.log(Unknown Source) at java.util.logging.Logger.info(Unknown Source) at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:108) at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:79) at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:204) at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:166) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:132) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428) at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680) at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571) at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526) at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479) at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920) at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820) at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986) at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837) at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243) at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358) at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537) --- .../remote/server/log/ShortTermMemoryHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/server/src/org/openqa/selenium/remote/server/log/ShortTermMemoryHandler.java b/java/server/src/org/openqa/selenium/remote/server/log/ShortTermMemoryHandler.java index a5eef8829dbba..02efbf98cc66b 100644 --- a/java/server/src/org/openqa/selenium/remote/server/log/ShortTermMemoryHandler.java +++ b/java/server/src/org/openqa/selenium/remote/server/log/ShortTermMemoryHandler.java @@ -55,7 +55,7 @@ public ShortTermMemoryHandler(int capacity, Level minimumLevel, Formatter format @Override - public void publish(LogRecord record) { + public synchronized void publish(LogRecord record) { if (record.getLevel().intValue() < minimumLevel) { return; } @@ -67,12 +67,12 @@ public void publish(LogRecord record) { } @Override - public void flush() { + public synchronized void flush() { /* NOOP */ } @Override - public void close() throws SecurityException { + public synchronized void close() throws SecurityException { for (int i = 0; i < capacity; i++) { lastRecords[i] = null; } @@ -95,7 +95,7 @@ public synchronized LogRecord[] records() { return validRecords.toArray(new LogRecord[validRecords.size()]); } - public String formattedRecords() { + public synchronized String formattedRecords() { final StringWriter writer; writer = new StringWriter();