From 316011e047a6dad7e956f815b97964f154cb113b Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 31 Jan 2019 11:55:43 +0000
Subject: [PATCH] Debian: Fix version detection of Tomcat 9 required for
 reproducible builds

---
 apps/jetty/java/src/net/i2p/servlet/util/JspC.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/apps/jetty/java/src/net/i2p/servlet/util/JspC.java b/apps/jetty/java/src/net/i2p/servlet/util/JspC.java
index c3c9b691e1..6ca591342a 100644
--- a/apps/jetty/java/src/net/i2p/servlet/util/JspC.java
+++ b/apps/jetty/java/src/net/i2p/servlet/util/JspC.java
@@ -39,7 +39,8 @@ import net.i2p.util.VersionComparator;
  */
 public class JspC {
     // First Tomcat version to support multiple threads and -threadCount arg
-    private static final String THREADS_VERSION = "8.5.33";
+    private static final String THREADS_VERSION_8 = "8.5.33";
+    private static final String THREADS_VERSION_9 = "9.0.11";
     // if true, try to make web.xml reproducible
     private static final boolean REPRODUCIBLE = Boolean.valueOf(System.getProperty("build.reproducible"));
     // if true, we must get the Tomcat version out of the jasper jar's manifest
@@ -109,8 +110,12 @@ public class JspC {
                 Attributes atts = attributes(JASPER_JAR);
                 if (atts != null) {
                     String ver = atts.getValue("Implementation-Version");
-                    if (ver != null && ver.startsWith("8.")) {
-                        supportsThreads = VersionComparator.comp(ver, THREADS_VERSION) >= 0;
+                    if (ver != null) {
+                        if (ver.startsWith("8.")) {
+                            supportsThreads = VersionComparator.comp(ver, THREADS_VERSION_8) >= 0;
+                        } else {
+                            supportsThreads = VersionComparator.comp(ver, THREADS_VERSION_9) >= 0;
+                        }
                         System.out.println("Found JspC version: " + ver + ", supports threads? " + supportsThreads);
                     }
                 }
-- 
GitLab