build(deps): bump butterfly from 1.0.4 to 1.1.1 (#3699)

* build(deps): bump butterfly from 1.0.4 to 1.1.0

Bumps [butterfly](https://github.com/OpenRefine/simile-butterfly) from 1.0.4 to 1.1.0.
- [Release notes](https://github.com/OpenRefine/simile-butterfly/releases)
- [Commits](https://github.com/OpenRefine/simile-butterfly/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* Update Butterfly configuration after Jetty upgrade

* Fix main class name in web.xml

* Upgrade Butterfly to Jetty 9

* Temporary debugging output to understand why RefineServlet is not found

* Upgrade servlet-api

* Fix javax.servlet-api artifactId

* Reinstate debug logging temporarily

* Update butterfly to 1.1.1 to solve servlet-api version conflict

* Update javax.servlet-api in the rest of the code base

* Silence server logs in ./refine ui_test again

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
This commit is contained in:
dependabot[bot] 2021-03-18 10:12:57 +01:00 committed by GitHub
parent 9e7a30b6e2
commit 0f024d833e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 104 additions and 62 deletions

View File

@ -23,8 +23,8 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -171,14 +171,14 @@
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openrefine.dependencies</groupId>
<artifactId>butterfly</artifactId>
<version>1.0.4</version>
<version>${butterfly.version}</version>
</dependency>
<dependency>
<groupId>org.mozilla</groupId>
@ -367,6 +367,11 @@
<artifactId>juniversalchardet</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty.version}</version>
</dependency>
<!-- test dependencies -->

View File

@ -66,6 +66,7 @@ import com.google.refine.util.JSONUtilities;
import com.google.refine.util.ParsingUtilities;
import com.google.refine.util.TestUtils;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
@ -167,6 +168,21 @@ public class ImportingUtilitiesTests extends ImporterTest {
return delegate.read();
}
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
}
/**

View File

@ -1,10 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
metadata-complete="false"
version="3.1">
<display-name>OpenRefine</display-name>
<description>OpenRefine Webapp</description>
@ -22,7 +22,7 @@
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>org.mortbay.servlet.GzipFilter</filter-class>
<filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
<init-param>
<param-name>mimeTypes</param-name>
<param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,text/javascript,application/javascript,application/json,image/svg+xml</param-value>

View File

@ -61,7 +61,10 @@
<surefireArgs/>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jackson.version>2.12.1</jackson.version>
<servlet-api.version>3.1.0</servlet-api.version>
<butterfly.version>1.1.1</butterfly.version>
<slf4j.version>1.7.30</slf4j.version>
<jetty.version>9.4.26.v20200117</jetty.version>
</properties>

View File

@ -154,18 +154,23 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet-api.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.26</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.26</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.openrefine.dependencies</groupId>
@ -175,7 +180,7 @@
<dependency>
<groupId>org.openrefine.dependencies</groupId>
<artifactId>butterfly</artifactId>
<version>1.0.4</version>
<version>${butterfly.version}</version>
</dependency>
<dependency>
<groupId>org.mozilla</groupId>

View File

@ -51,18 +51,23 @@ import java.util.concurrent.TimeUnit;
import javax.swing.JFrame;
import org.apache.log4j.Level;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.util.Scanner;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.StatisticsHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.thread.ThreadPool;
import com.google.util.threads.ThreadPoolExecutorAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.codeberry.jdatapath.DataPath;
import com.codeberry.jdatapath.JDataPathSystem;
import com.google.util.threads.ThreadPoolExecutorAdapter;
import com.google.refine.Configurations;
/**
* Main class for Refine server application. Starts an instance of the
@ -82,7 +87,7 @@ public class Refine {
// tell jetty to use SLF4J for logging instead of its own stuff
System.setProperty("VERBOSE","false");
System.setProperty("org.mortbay.log.class","org.mortbay.log.Slf4jLog");
System.setProperty("org.eclipse.jetty.log.class","org.eclipse.jetty.util.log.Slf4jLog");
// tell macosx to keep the menu associated with the screen and what the app title is
System.setProperty("apple.laf.useScreenMenuBar", "true");
@ -136,6 +141,18 @@ class RefineServer extends Server {
final static Logger logger = LoggerFactory.getLogger("refine_server");
public RefineServer() {
super(createThreadPool());
}
private static ThreadPool createThreadPool() {
int maxThreads = Configurations.getInteger("refine.queue.size", 30);
int maxQueue = Configurations.getInteger("refine.queue.max_size", 300);
long keepAliveTime = Configurations.getInteger("refine.queue.idle_time", 60);
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(maxQueue);
return new ThreadPoolExecutorAdapter(new ThreadPoolExecutor(maxThreads, maxQueue, keepAliveTime, TimeUnit.SECONDS, queue));
}
private ThreadPoolExecutor threadPool;
public void init(String host, int port) throws Exception {
@ -146,21 +163,13 @@ class RefineServer extends Server {
logger.info("refine.memory size: " + memory + " JVM Max heap: " + Runtime.getRuntime().maxMemory());
}
int maxThreads = Configurations.getInteger("refine.queue.size", 30);
int maxQueue = Configurations.getInteger("refine.queue.max_size", 300);
long keepAliveTime = Configurations.getInteger("refine.queue.idle_time", 60);
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(maxQueue);
threadPool = new ThreadPoolExecutor(maxThreads, maxQueue, keepAliveTime, TimeUnit.SECONDS, queue);
this.setThreadPool(new ThreadPoolExecutorAdapter(threadPool));
Connector connector = new SocketConnector();
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSendServerVersion(false);
HttpConnectionFactory httpFactory = new HttpConnectionFactory(httpConfig);
ServerConnector connector = new ServerConnector(this, httpFactory);
connector.setPort(port);
connector.setHost(host);
connector.setMaxIdleTime(Configurations.getInteger("refine.connection.max_idle_time",60000));
connector.setStatsOn(false);
connector.setIdleTimeout(Configurations.getInteger("server.connection.max_idle_time",60000));
this.addConnector(connector);
File webapp = new File(Configurations.get("refine.webapp","main/webapp"));
@ -185,7 +194,17 @@ class RefineServer extends Server {
this.setHandler(context);
this.setStopAtShutdown(true);
this.setSendServerVersion(true);
StatisticsHandler handler = new StatisticsHandler();
handler.setServer(this);
handler.setHandler(this.getHandler());
this.addBean(handler);
// Tell the server we want to try and shutdown gracefully
// this means that the server will stop accepting new connections
// right away but it will continue to process the ones that
// are in execution for the given timeout before attempting to stop
// NOTE: this is *not* a blocking method, it just sets a parameter
// that _server.stop() will rely on
this.setStopTimeout(30000);
// Enable context autoreloading
if (Configurations.getBoolean("refine.autoreload",false)) {
@ -210,7 +229,7 @@ class RefineServer extends Server {
if (threadPool != null) {
threadPool.shutdown();
}
Thread.sleep(3000);
// then let the parent stop
super.doStop();
} catch (InterruptedException e) {
@ -260,7 +279,11 @@ class RefineServer extends Server {
}
});
scanner.start();
try {
scanner.start();
} catch (Exception e) {
e.printStackTrace();
}
}
static private void findFiles(final String extension, File baseDir, final Collection<File> found) {
@ -502,14 +525,6 @@ class ShutdownSignalHandler implements Runnable {
@Override
public void run() {
// Tell the server we want to try and shutdown gracefully
// this means that the server will stop accepting new connections
// right away but it will continue to process the ones that
// are in execution for the given timeout before attempting to stop
// NOTE: this is *not* a blocking method, it just sets a parameter
// that _server.stop() will rely on
_server.setGracefulShutdown(3000);
try {
_server.stop();
} catch (Exception e) {

View File

@ -19,9 +19,9 @@ import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.mortbay.component.LifeCycle;
import org.mortbay.log.Log;
import org.mortbay.thread.ThreadPool;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.thread.ThreadPool;
/**
* Jetty {@link ThreadPool} that bridges requests to a
@ -36,13 +36,11 @@ public class ThreadPoolExecutorAdapter implements ThreadPool, LifeCycle {
}
@Override
public boolean dispatch(Runnable job) {
public void execute(Runnable job) {
try {
executor.execute(job);
return true;
} catch (RejectedExecutionException e) {
Log.warn(e);
return false;
Log.getLog().warn(e);
}
}