Skip to content

Commit

Permalink
check Tomcat version
Browse files Browse the repository at this point in the history
fixes #1322
  • Loading branch information
vladak committed Oct 26, 2022
1 parent ea96def commit 8678bd2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions opengrok-web/src/main/java/org/opengrok/web/WebappListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) {
}
}

String serverInfo = context.getServerInfo();
LOGGER.log(Level.INFO, "running inside {0}", serverInfo);
if (serverInfo.startsWith("Apache Tomcat")) {
int idx;
if ((idx = serverInfo.indexOf('/')) > 0) {
String version = serverInfo.substring(idx + 1);
if (!version.startsWith("10.0")) {
LOGGER.log(Level.SEVERE, "Unsupported Tomcat version: {0}", version);
throw new Error("Unsupported Tomcat version");
}
}
}

/*
* Create a new instance of authorization framework. If the code above
* (reading the configuration) failed then the plugin directory is
Expand Down

0 comments on commit 8678bd2

Please sign in to comment.