Skip to content

Commit 8678bd2

Browse files
committed
check Tomcat version
fixes #1322
1 parent ea96def commit 8678bd2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

opengrok-web/src/main/java/org/opengrok/web/WebappListener.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) {
8989
}
9090
}
9191

92+
String serverInfo = context.getServerInfo();
93+
LOGGER.log(Level.INFO, "running inside {0}", serverInfo);
94+
if (serverInfo.startsWith("Apache Tomcat")) {
95+
int idx;
96+
if ((idx = serverInfo.indexOf('/')) > 0) {
97+
String version = serverInfo.substring(idx + 1);
98+
if (!version.startsWith("10.0")) {
99+
LOGGER.log(Level.SEVERE, "Unsupported Tomcat version: {0}", version);
100+
throw new Error("Unsupported Tomcat version");
101+
}
102+
}
103+
}
104+
92105
/*
93106
* Create a new instance of authorization framework. If the code above
94107
* (reading the configuration) failed then the plugin directory is

0 commit comments

Comments
 (0)