From 59912f019fd70127dc89ca56793a8d1a9ec8b188 Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Tue, 23 Jul 2024 16:25:24 +0200
Subject: [PATCH 01/13] =?UTF-8?q?Passer=20=C3=A0=20Jakarta=2010?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md                                     |  8 +-
 .../{tomcat9x => tomcat10x}/conf/context.xml  |  0
 pom.xml                                       | 75 +++++++++++++------
 .../inrae/agroclim/devcas/ErrorServlet.java   |  8 +-
 .../inrae/agroclim/devcas/LoginServlet.java   | 10 +--
 .../inrae/agroclim/devcas/LogoutServlet.java  | 12 +--
 .../agroclim/devcas/ValidateCAS1Servlet.java  | 10 +--
 .../agroclim/devcas/ValidateCAS2Servlet.java  | 10 +--
 .../agroclim/devcas/ValidationService.java    |  2 +-
 src/main/resources/log4j2.xml                 | 11 ++-
 src/main/webapp/WEB-INF/web.xml               | 11 ++-
 11 files changed, 95 insertions(+), 62 deletions(-)
 rename config/{tomcat9x => tomcat10x}/conf/context.xml (100%)

diff --git a/README.md b/README.md
index d426c78..de07aaf 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ with `~/.m2/settings.xml` with something like:
   <server>
     <id>siclima-preprod</id>
     <configuration>
-      <cargo.remote.uri>http://siclima-preprod:8080/manager/text</cargo.remote.uri>
+      <cargo.remote.uri>http://siclima-preprod:8081/manager/text</cargo.remote.uri>
       <cargo.remote.username>tomcat-user</cargo.remote.username>
       <cargo.remote.password>tomcat-password</cargo.remote.password>
     </configuration>
@@ -41,9 +41,9 @@ with `~/.m2/settings.xml` with something like:
 
 Simply use these URL to configure CAS in the app (Example with server `siclima-preprod`):
 
-- <http://siclima-preprod:8080/dev-cas/> : root URL for the CAS server.
-- <http://siclima-preprod:8080/dev-cas/login> : to build the login process URL
-- <http://siclima-preprod:8080/dev-cas/logout> : to logout the user 
+- <http://siclima-preprod:8081/dev-cas/> : root URL for the CAS server.
+- <http://siclima-preprod:8081/dev-cas/login> : to build the login process URL
+- <http://siclima-preprod:8081/dev-cas/logout> : to logout the user 
 
 Project reports are available using Maven: `mvn site` and then see `target/site/index.html`.
 
diff --git a/config/tomcat9x/conf/context.xml b/config/tomcat10x/conf/context.xml
similarity index 100%
rename from config/tomcat9x/conf/context.xml
rename to config/tomcat10x/conf/context.xml
diff --git a/pom.xml b/pom.xml
index 8781524..bfa7c8f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,19 +34,19 @@
 	</ciManagement>
 	<properties>
 		<!-- Dependencies versions -->
-		<jstl.version>1.2</jstl.version>
-		<junit.version>5.10.1</junit.version>
-		<log4j.version>2.22.1</log4j.version>
-		<lombok.version>1.18.30</lombok.version>
-		<servlet-api.version>4.0.1</servlet-api.version>
+		<jstl.version>3.0.0</jstl.version>
+		<junit.version>5.10.2</junit.version>
+		<log4j.version>2.23.1</log4j.version>
+		<lombok.version>1.18.34</lombok.version>
+		<servlet-api.version>6.0.0</servlet-api.version>
 
 		<!-- Maven environment values -->
 		<build.date>${maven.build.timestamp}</build.date>
 		<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
-		<maven.compiler.release>8</maven.compiler.release>
-		<java.version>8</java.version>
-		<maven.compiler.source>8</maven.compiler.source>
-		<maven.compiler.target>8</maven.compiler.target>
+		<maven.compiler.release>17</maven.compiler.release>
+		<java.version>17</java.version>
+		<maven.compiler.source>17</maven.compiler.source>
+		<maven.compiler.target>17</maven.compiler.target>
 
 		<!-- checkStyle -->
 		<checkstyle.config.location>file://${basedir}/config/sun_checks.xml</checkstyle.config.location>
@@ -58,8 +58,8 @@
 		<checkstyle.version>3.3.1</checkstyle.version>
 		<javadoc.version>3.6.2</javadoc.version>
 		<javase.api.link>http://docs.oracle.com/javase/8/docs/api</javase.api.link>
-		<pmd.version>3.21.0</pmd.version>
-		<spotbugs.version>4.8.1.0</spotbugs.version>
+		<pmd.version>3.21.2</pmd.version>
+		<spotbugs.version>4.8.2.0</spotbugs.version>
 
 		<!-- Text format -->
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -67,16 +67,21 @@
 	</properties>
 	<dependencies>
 		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>javax.servlet-api</artifactId>
+			<groupId>jakarta.servlet</groupId>
+			<artifactId>jakarta.servlet-api</artifactId>
 			<version>${servlet-api.version}</version>
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
-			<groupId>javax.servlet</groupId>
-		    <artifactId>jstl</artifactId>
+			<groupId>jakarta.servlet.jsp.jstl</groupId>
+		    <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
 		    <version>${jstl.version}</version>
 		</dependency>
+    <dependency>
+      <groupId>org.glassfish.web</groupId>
+      <artifactId>jakarta.servlet.jsp.jstl</artifactId>
+      <version>3.0.1</version>
+    </dependency>
 		<!-- Log4J -->
 		<dependency>
 			<groupId>org.apache.logging.log4j</groupId>
@@ -110,18 +115,44 @@
 			</resource>
 		</resources>
 		<plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>3.4.1</version>
+        <executions>
+          <execution>
+            <id>enforce-versions</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireJavaVersion>
+                  <version>17</version>
+                </requireJavaVersion>
+              </rules>
+              <rules>
+                <requireMavenVersion>
+                  <version>3.8</version>
+                </requireMavenVersion>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
 			<!-- Running JUnit tests -->
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-surefire-plugin</artifactId>
-				<version>3.1.2</version>
+				<version>3.2.5</version>
 			</plugin>
 
 			<!-- Compute buildNumber -->
 			<plugin>
 				<groupId>org.codehaus.mojo</groupId>
 				<artifactId>buildnumber-maven-plugin</artifactId>
-				<version>3.1.0</version>
+				<version>3.2.0</version>
 				<executions>
 					<execution>
 						<phase>validate</phase>
@@ -145,7 +176,7 @@
 			<plugin>
 				<artifactId>exec-maven-plugin</artifactId>
 				<groupId>org.codehaus.mojo</groupId>
-				<version>3.1.0</version>
+				<version>3.2.0</version>
 				<executions>
 					<execution>
 						<phase>package</phase>
@@ -236,7 +267,7 @@
 				<version>1.10.11</version>
 				<configuration>
 					<container>
-						<containerId>tomcat9x</containerId>
+						<containerId>tomcat10x</containerId>
 						<type>${cargo.container.type}</type>
 						<systemProperties>
 							<java.util.logging.SimpleFormatter.format>%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$-6s %2$s %5$s%6$s%n</java.util.logging.SimpleFormatter.format>
@@ -246,7 +277,7 @@
 						<type>${cargo.configuration.type}</type>
 						<files>
 							<copy>
-								<file>config/tomcat9x/conf/context.xml</file>
+								<file>config/tomcat10x/conf/context.xml</file>
 								<tofile>conf/context.xml</tofile>
 								<configfile>true</configfile>
 								<overwrite>true</overwrite>
@@ -265,7 +296,7 @@
 				<plugin>
 					<groupId>org.jacoco</groupId>
 					<artifactId>jacoco-maven-plugin</artifactId>
-					<version>0.8.10</version>
+					<version>0.8.11</version>
 				</plugin>
 				<plugin>
 					<artifactId>maven-site-plugin</artifactId>
@@ -374,7 +405,7 @@
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-jxr-plugin</artifactId>
-				<version>3.3.0</version>
+				<version>3.3.2</version>
 			</plugin>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/java/fr/inrae/agroclim/devcas/ErrorServlet.java b/src/main/java/fr/inrae/agroclim/devcas/ErrorServlet.java
index 7cd8324..953174d 100644
--- a/src/main/java/fr/inrae/agroclim/devcas/ErrorServlet.java
+++ b/src/main/java/fr/inrae/agroclim/devcas/ErrorServlet.java
@@ -25,10 +25,10 @@ package fr.inrae.agroclim.devcas;
 import java.io.IOException;
 import java.util.Enumeration;
 
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.annotation.WebServlet;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 
 import lombok.extern.log4j.Log4j2;
 
diff --git a/src/main/java/fr/inrae/agroclim/devcas/LoginServlet.java b/src/main/java/fr/inrae/agroclim/devcas/LoginServlet.java
index cf3fa64..8c10811 100644
--- a/src/main/java/fr/inrae/agroclim/devcas/LoginServlet.java
+++ b/src/main/java/fr/inrae/agroclim/devcas/LoginServlet.java
@@ -26,11 +26,11 @@ import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 
-import javax.servlet.ServletException;
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.annotation.WebServlet;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 
 import lombok.extern.log4j.Log4j2;
 
diff --git a/src/main/java/fr/inrae/agroclim/devcas/LogoutServlet.java b/src/main/java/fr/inrae/agroclim/devcas/LogoutServlet.java
index 22c91c7..06b79f2 100644
--- a/src/main/java/fr/inrae/agroclim/devcas/LogoutServlet.java
+++ b/src/main/java/fr/inrae/agroclim/devcas/LogoutServlet.java
@@ -24,12 +24,12 @@ package fr.inrae.agroclim.devcas;
 
 import java.io.IOException;
 
-import javax.servlet.ServletException;
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.annotation.WebServlet;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpSession;
 
 import lombok.extern.log4j.Log4j2;
 
diff --git a/src/main/java/fr/inrae/agroclim/devcas/ValidateCAS1Servlet.java b/src/main/java/fr/inrae/agroclim/devcas/ValidateCAS1Servlet.java
index 1d0b78d..6b360d5 100644
--- a/src/main/java/fr/inrae/agroclim/devcas/ValidateCAS1Servlet.java
+++ b/src/main/java/fr/inrae/agroclim/devcas/ValidateCAS1Servlet.java
@@ -24,11 +24,11 @@ package fr.inrae.agroclim.devcas;
 
 import java.io.IOException;
 
-import javax.servlet.ServletException;
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.annotation.WebServlet;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 
 import fr.inrae.agroclim.devcas.ValidationService.Result;
 import lombok.extern.log4j.Log4j2;
diff --git a/src/main/java/fr/inrae/agroclim/devcas/ValidateCAS2Servlet.java b/src/main/java/fr/inrae/agroclim/devcas/ValidateCAS2Servlet.java
index 04d9c20..3d7da82 100644
--- a/src/main/java/fr/inrae/agroclim/devcas/ValidateCAS2Servlet.java
+++ b/src/main/java/fr/inrae/agroclim/devcas/ValidateCAS2Servlet.java
@@ -24,11 +24,11 @@ package fr.inrae.agroclim.devcas;
 
 import java.io.IOException;
 
-import javax.servlet.ServletException;
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.annotation.WebServlet;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 
 import fr.inrae.agroclim.devcas.ValidationService.Result;
 import lombok.extern.log4j.Log4j2;
diff --git a/src/main/java/fr/inrae/agroclim/devcas/ValidationService.java b/src/main/java/fr/inrae/agroclim/devcas/ValidationService.java
index e7f6fb0..b4e08dc 100644
--- a/src/main/java/fr/inrae/agroclim/devcas/ValidationService.java
+++ b/src/main/java/fr/inrae/agroclim/devcas/ValidationService.java
@@ -28,7 +28,7 @@ import java.util.Map;
 import java.util.StringJoiner;
 import java.util.UUID;
 
-import javax.servlet.ServletContext;
+import jakarta.servlet.ServletContext;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index d2d7911..03d7846 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -9,12 +9,12 @@
   it under the terms of the GNU General Public License as
   published by the Free Software Foundation, either version 3 of the
   License, or (at your option) any later version.
-  
+
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
-  
+
   You should have received a copy of the GNU General Public
   License along with this program.  If not, see
   <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -23,6 +23,9 @@
 
 <!DOCTYPE Configuration>
 <Configuration status="info">
+        <Properties>
+                <Property name="logsdir">${sys:catalina.base}/logs</Property>
+        </Properties>
         <Appenders>
                 <Console name="console" target="SYSTEM_OUT">
                         <PatternLayout>
@@ -30,8 +33,8 @@
                         </PatternLayout>
                 </Console>
                 <!-- https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender -->
-                <RollingFile name="file" fileName="logs/dev-cas.log"
-                        filePattern="logs/$${date:yyyy-MM}/dev-cas-%d{MM-dd-yyyy}-%i.log.gz">
+                <RollingFile name="file" fileName="${logsdir}/dev-cas.log"
+                        filePattern="${logsdir}/$${date:yyyy-MM}/dev-cas-%d{MM-dd-yyyy}-%i.log.gz">
                         <PatternLayout>
                                 <pattern>%d | %-5p | %c#%M() | %L - %m%n</pattern>
                         </PatternLayout>
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index af0120e..44a7a6b 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -9,12 +9,12 @@
   it under the terms of the GNU General Public License as
   published by the Free Software Foundation, either version 3 of the
   License, or (at your option) any later version.
-  
+
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
-  
+
   You should have received a copy of the GNU General Public
   License along with this program.  If not, see
   <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -22,10 +22,9 @@
   -->
 
 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns="http://xmlns.jcp.org/xml/ns/javaee"
-	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
-	http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
-	version="3.1">
+	xmlns="https://jakarta.ee/xml/ns/jakartaee"
+	xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
+	version="5.0">
 	<display-name>dev-cas - Fake CAS server for development purpose</display-name>
 
 	<!-- Default page to serve -->
-- 
GitLab


From 737aa241a7957278bcbad2e53f61d0463c996268 Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 08:47:42 +0200
Subject: [PATCH 02/13] JDK17

---
 .gitlab-ci.yml | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aeda2c8..f4bc7ab 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,8 +12,8 @@ variables:
   # `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
   MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
 
-# This template uses jdk11 for verifying and deploying images
-image: maven:3.6.3-jdk-11
+# This template uses jdk17 for verifying and deploying images
+image: maven:3.8-openjdk-17
 
 # Cache downloaded dependencies and plugins between builds.
 # To keep cache across branches add 'key: "$CI_JOB_NAME"'
@@ -23,17 +23,16 @@ cache:
 
 # Test with coverage report
 # https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html
-test-jdk11:
+test-jdk17:
   stage: test
-  image: maven:3.6.3-jdk-11
   script:
     - mvn $MAVEN_CLI_OPTS clean org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report
   artifacts:
     paths:
       - target/site/jacoco/jacoco.xml
 
-coverage-jdk11:
-  # Must be in a stage later than test-jdk11's stage.
+coverage-jdk17:
+  # Must be in a stage later than test-jdk17's stage.
   # The `visualize` stage does not exist by default.
   # Please define it first, or choose an existing stage like `deploy`.
   stage: deploy
@@ -41,7 +40,7 @@ coverage-jdk11:
   script:
     # convert report from jacoco to cobertura, using relative project path
     - python /opt/cover2cover.py target/site/jacoco/jacoco.xml $CI_PROJECT_DIR/src/main/java/ > target/site/cobertura.xml
-  needs: ["test-jdk11"]
+  needs: ["test-jdk17"]
   artifacts:
     reports:
       coverage_report:
@@ -58,7 +57,7 @@ coverage-jdk11:
     variables:
       - $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
 
-# Verify merge requests using JDK11
-verify:jdk11:
+# Verify merge requests using JDK17
+verify:jdk17:
   <<: *verify
 
-- 
GitLab


From 7c10ca0878a82b791e3d2460ce642622dfc3291a Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 09:54:27 +0200
Subject: [PATCH 03/13] =?UTF-8?q?Mettre=20=C3=A0=20jour=20Tokei?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md         | 10 ++++++-
 bin/sloccount.sh  | 74 ++++++++++++++++++++++++++++++++---------------
 bin/tokei2cloc.py | 43 +++++++++------------------
 pom.xml           | 10 +++----
 4 files changed, 78 insertions(+), 59 deletions(-)

diff --git a/README.md b/README.md
index de07aaf..2a615ae 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,14 @@
 - Use specifications from [Apereo](https://apereo.github.io/cas/6.5.x/protocol/CAS-Protocol-Specification.html).
 - Install it on Tomcat.
 
+## 🛠️ Tech Stack
+
+- Jakarta 10
+- Java 17
+- [Maven](https://maven.apache.org/) 3.8
+- [Log4j2](https://logging.apache.org/log4j/2.x/index.html)
+- [Lombok](https://projectlombok.org/)
+
 ## Development
 
 1. Package with `mvn package`.
@@ -16,7 +24,7 @@
 
 Ensure code is well written with `mvn checkstyle:checkstyle pmd:pmd pmd:cpd spotbugs:spotbugs`.
 
-## Installation
+## 🛠️ Installation
 
 Use Maven to deploy on Tomcat. Eg. with server `siclima-preprod`:
 
diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index b15e580..0de54ed 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -1,30 +1,56 @@
 #!/bin/bash
-
-TOKEI2SLOCCOUNT=$(dirname $0)/tokei2sloccount.py
+ROOT_DIR=$(dirname $(dirname $0))
 TOKEI2CLOC=$(dirname $0)/tokei2cloc.py
-TOKEITGZ=tokei-v7.0.3-x86_64-unknown-linux-gnu.tar.gz
-if [ ! -f bin/tokei ]; then
-	mkdir -p ~/tmp bin
-	if [ ! -f ~/tmp/$TOKEITGZ ]; then
-		wget "https://github.com/Aaronepower/tokei/releases/download/v7.0.3/$TOKEITGZ" -O ~/tmp/$TOKEITGZ
+TOKEI=$(command -v tokei)
+TOKEI_VERSION="12.1.2"
+
+function check_tokei_version() {
+	echo "Checking tokei version"
+	VERSION=$($TOKEI --version | awk '{print $2}')
+	echo "tokei version: $VERSION"
+	echo "tokei expected version: $TOKEI_VERSION"
+	if [ "$TOKEI_VERSION" == "$VERSION" ]; then
+		return 0
+	fi
+	return 1
+}
+
+function download_tokei() {
+	TOKEITGZ=tokei-x86_64-unknown-linux-gnu.tar.gz
+	TOKEITMP=~/tmp/tokei-$TOKEI_VERSION.tar.gz
+	if [ ! -f $TOKEITMP ]; then
+		mkdir -p ~/tmp
+		wget "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -O $TOKEITMP
+	fi
+	tar zxf $TOKEITMP -C bin
+	TOKEI=bin/tokei
+}
+
+if [ -x "$TOKEI" ]; then
+	if [ -f bin/tokei ]; then
+		TOKEI=bin/tokei
 	fi
-	tar zxf ~/tmp/$TOKEITGZ -C bin
-fi
-if [ -f bin/tokei ]; then
-	mkdir -p target
-	#bin/tokei -f -o json src | $TOKEI2SLOCCOUNT > target/sloccount.sc
-	bin/tokei -f -o json src | $TOKEI2CLOC > target/cloc.xml
-	exit
 fi
 
-SLOCCOUNT=$(which sloccount);
-if [ "$SLOCCOUNT" != "" ]; then
-	DATADIR=$(dirname $0)/.slocdata;
-	if [ ! -f $DATADIR ]; then
-		mkdir -p $DATADIR;
+if [ -x "$TOKEI" ]; then
+	check_tokei_version
+	if [ $? -eq 1 ]; then
+		download_tokei
 	fi
-	mkdir -p target ;
-	/usr/bin/sloccount --datadir $DATADIR --duplicates --wide --details src > target/sloccount.sc;
-else 
-	echo "sloccount not found!";
-fi
\ No newline at end of file
+fi
+if [ ! -x "$TOKEI" ]; then
+	download_tokei
+fi
+if [ ! -f $TOKEI ]; then
+	echo "Strange, $TOKEI does not exist!"
+	exit 1
+fi
+
+echo "tokei is installed at $TOKEI"
+$TOKEI --version
+mkdir -p $ROOT_DIR/target
+if [ ! -d $ROOT_DIR/www-client ]; then
+	$TOKEI -f -o json $ROOT_DIR/src | $TOKEI2CLOC > $ROOT_DIR/target/cloc.xml
+	exit
+fi
+$TOKEI -f -o json $ROOT_DIR/www-client/src $ROOT_DIR/www-server/src $ROOT_DIR/www-shared/src | $TOKEI2CLOC > $ROOT_DIR/target/cloc.xml
diff --git a/bin/tokei2cloc.py b/bin/tokei2cloc.py
index 7fd5f60..bc41a97 100755
--- a/bin/tokei2cloc.py
+++ b/bin/tokei2cloc.py
@@ -1,29 +1,12 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: UTF-8 -*-
-#
-# data.pheno.fr - Phenological data portal of TEMPO
-# Copyright © 2019 TEMPO (contact-tempo@inrae.fr)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 
-# $Id: tokei2cloc.py 77 2019-01-11 17:24:18Z omaury $
+# $Id$
 #
 # Author : Olivier Maury
 # Creation Date : 2019-01-15 10:30:29 +0200
-# Last Revision : $Date: 2019-01-11 18:24:18 +0100 (ven., 11 janv. 2019) $
-# Revision : $Rev: 77 $
+# Last Revision : $Date$
+# Revision : $Rev$
 u"""
 NOM
         %prog - Tokei2Cloc
@@ -38,10 +21,10 @@ u"""
         Olivier Maury
 
 VERSION
-        $Date: 2019-01-11 18:24:18 +0100 (ven., 11 janv. 2019) $
+        $Date$
 """
 
-__revision__ = "$Rev: 77 $"
+__revision__ = "$Rev$"
 __author__ = "Olivier Maury"
 import json
 import sys
@@ -52,8 +35,10 @@ results = json.loads(sys.stdin.read())
 nb_files = 0
 nb_lines = 0
 for lang in results:
-    nb_files += len(results[lang]['stats'])
-    nb_lines += int(results[lang]['lines'])
+    nb_files += len(results[lang]['reports'])
+    nb_lines += int(results[lang]['blanks'])
+    nb_lines += int(results[lang]['code'])
+    nb_lines += int(results[lang]['comments'])
 
 print("""<?xml version="1.0"?><results>
 <header>
@@ -73,10 +58,10 @@ total_blank = 0
 total_comment = 0
 total_code = 0
 for lang in results:
-    for result in results[lang]['stats']:
-        blank = int(result['blanks'])
-        comment = int(result['comments'])
-        code = int(result['code'])
+    for result in results[lang]['reports']:
+        blank = int(result['stats']['blanks'])
+        comment = int(result['stats']['comments'])
+        code = int(result['stats']['code'])
         print("""  <file name="%s" blank="%d" comment="%d" code="%d"  language="%s" />""" % 
             (result['name'], blank, comment, code, lang))
         total_blank += blank
diff --git a/pom.xml b/pom.xml
index bfa7c8f..1f87716 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,11 +77,11 @@
 		    <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
 		    <version>${jstl.version}</version>
 		</dependency>
-    <dependency>
-      <groupId>org.glassfish.web</groupId>
-      <artifactId>jakarta.servlet.jsp.jstl</artifactId>
-      <version>3.0.1</version>
-    </dependency>
+		<dependency>
+			<groupId>org.glassfish.web</groupId>
+			<artifactId>jakarta.servlet.jsp.jstl</artifactId>
+			<version>3.0.1</version>
+		</dependency>
 		<!-- Log4J -->
 		<dependency>
 			<groupId>org.apache.logging.log4j</groupId>
-- 
GitLab


From 17bb6c3a199c0c4ca24ba2a0b5dd557417dbe2c4 Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 09:57:28 +0200
Subject: [PATCH 04/13] =?UTF-8?q?Mettre=20=C3=A0=20jour=20Tokei?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bin/sloccount.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index 0de54ed..7572c2a 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -20,7 +20,7 @@ function download_tokei() {
 	TOKEITMP=~/tmp/tokei-$TOKEI_VERSION.tar.gz
 	if [ ! -f $TOKEITMP ]; then
 		mkdir -p ~/tmp
-		wget "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -O $TOKEITMP
+		curl "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -o $TOKEITMP
 	fi
 	tar zxf $TOKEITMP -C bin
 	TOKEI=bin/tokei
-- 
GitLab


From 91f9ddfacd16946627ccb25f6e1b795861904c8d Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 11:42:40 +0200
Subject: [PATCH 05/13] =?UTF-8?q?Mettre=20=C3=A0=20jour=20Tokei?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bin/sloccount.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index 7572c2a..2d40b3d 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -1,6 +1,7 @@
 #!/bin/bash
-ROOT_DIR=$(dirname $(dirname $0))
-TOKEI2CLOC=$(dirname $0)/tokei2cloc.py
+BIN_DIR=$(dirname $0)
+ROOT_DIR=$(dirname $BIN_DIR)
+TOKEI2CLOC=$BIN_DIR/tokei2cloc.py
 TOKEI=$(command -v tokei)
 TOKEI_VERSION="12.1.2"
 
@@ -22,13 +23,13 @@ function download_tokei() {
 		mkdir -p ~/tmp
 		curl "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -o $TOKEITMP
 	fi
-	tar zxf $TOKEITMP -C bin
-	TOKEI=bin/tokei
+	tar zxf $TOKEITMP -C $BIN_DIR
+	TOKEI=$BIN_DIR/tokei
 }
 
 if [ -x "$TOKEI" ]; then
-	if [ -f bin/tokei ]; then
-		TOKEI=bin/tokei
+	if [ -f $BIN_DIR/tokei ]; then
+		TOKEI=$BIN_DIR/tokei
 	fi
 fi
 
-- 
GitLab


From 987623dee5703517f1c6c7816c6186b92e0f81cb Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 11:47:12 +0200
Subject: [PATCH 06/13] =?UTF-8?q?Mettre=20=C3=A0=20jour=20Tokei?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bin/sloccount.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index 2d40b3d..5753eb4 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -21,7 +21,7 @@ function download_tokei() {
 	TOKEITMP=~/tmp/tokei-$TOKEI_VERSION.tar.gz
 	if [ ! -f $TOKEITMP ]; then
 		mkdir -p ~/tmp
-		curl "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -o $TOKEITMP
+		curl --location "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -o $TOKEITMP
 	fi
 	tar zxf $TOKEITMP -C $BIN_DIR
 	TOKEI=$BIN_DIR/tokei
-- 
GitLab


From 32c750a59a6b200a63e762dfcc9ea8ec90d5da92 Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 11:53:54 +0200
Subject: [PATCH 07/13] =?UTF-8?q?Mettre=20=C3=A0=20jour=20Tokei?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bin/sloccount.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index 5753eb4..72a9909 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -27,6 +27,15 @@ function download_tokei() {
 	TOKEI=$BIN_DIR/tokei
 }
 
+PYTHON=$(command -v python)
+if [ ! -x "$PYTHON" ]; then
+	PYTHON=$(command -v python3)
+fi
+if [ ! -x "$PYTHON" ]; then
+	echo "Strange, python not found!"
+	exit 1
+fi
+
 if [ -x "$TOKEI" ]; then
 	if [ -f $BIN_DIR/tokei ]; then
 		TOKEI=$BIN_DIR/tokei
-- 
GitLab


From 76b2afe9966036b921cf2173c73104b92e61ff6b Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 11:56:37 +0200
Subject: [PATCH 08/13] =?UTF-8?q?Mettre=20=C3=A0=20jour=20Tokei?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f4bc7ab..7f77d11 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,7 +13,7 @@ variables:
   MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
 
 # This template uses jdk17 for verifying and deploying images
-image: maven:3.8-openjdk-17
+image: registry.forgemia.inra.fr/agroclim/common/docker-projets-java:latest
 
 # Cache downloaded dependencies and plugins between builds.
 # To keep cache across branches add 'key: "$CI_JOB_NAME"'
-- 
GitLab


From 648933f5d73b9c8e7578a87cc7807eaeeb89798d Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 12:01:07 +0200
Subject: [PATCH 09/13] Tabulations

---
 pom.xml | 50 +++++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1f87716..78675ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -115,31 +115,31 @@
 			</resource>
 		</resources>
 		<plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-enforcer-plugin</artifactId>
-        <version>3.4.1</version>
-        <executions>
-          <execution>
-            <id>enforce-versions</id>
-            <goals>
-              <goal>enforce</goal>
-            </goals>
-            <configuration>
-              <rules>
-                <requireJavaVersion>
-                  <version>17</version>
-                </requireJavaVersion>
-              </rules>
-              <rules>
-                <requireMavenVersion>
-                  <version>3.8</version>
-                </requireMavenVersion>
-              </rules>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-enforcer-plugin</artifactId>
+				<version>3.4.1</version>
+				<executions>
+					<execution>
+						<id>enforce-versions</id>
+						<goals>
+							<goal>enforce</goal>
+						</goals>
+						<configuration>
+							<rules>
+								<requireJavaVersion>
+									<version>17</version>
+								</requireJavaVersion>
+							</rules>
+							<rules>
+								<requireMavenVersion>
+									<version>3.8</version>
+								</requireMavenVersion>
+							</rules>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
 
 			<!-- Running JUnit tests -->
 			<plugin>
-- 
GitLab


From e26480bb9a5318f7b4715a5783dc3e8e85a6a22c Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 17:23:01 +0200
Subject: [PATCH 10/13] verbose

---
 bin/sloccount.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index 72a9909..f0b5c32 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -21,7 +21,7 @@ function download_tokei() {
 	TOKEITMP=~/tmp/tokei-$TOKEI_VERSION.tar.gz
 	if [ ! -f $TOKEITMP ]; then
 		mkdir -p ~/tmp
-		curl --location "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -o $TOKEITMP
+		curl --verbose --location "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -o $TOKEITMP
 	fi
 	tar zxf $TOKEITMP -C $BIN_DIR
 	TOKEI=$BIN_DIR/tokei
-- 
GitLab


From 8b46d20e9e2c8de5e0d7e0bcd8e950be37bd010e Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 17:27:01 +0200
Subject: [PATCH 11/13] Log

---
 bin/sloccount.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index f0b5c32..11af37c 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -17,12 +17,16 @@ function check_tokei_version() {
 }
 
 function download_tokei() {
+	echo "Installing tokei"
 	TOKEITGZ=tokei-x86_64-unknown-linux-gnu.tar.gz
 	TOKEITMP=~/tmp/tokei-$TOKEI_VERSION.tar.gz
 	if [ ! -f $TOKEITMP ]; then
 		mkdir -p ~/tmp
-		curl --verbose --location "https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ" -o $TOKEITMP
+		URL="https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ"
+		echo "Downloading tokei from $URL"
+		curl --verbose --location $URL -o $TOKEITMP
 	fi
+	echo "Extracting tokei"
 	tar zxf $TOKEITMP -C $BIN_DIR
 	TOKEI=$BIN_DIR/tokei
 }
-- 
GitLab


From dcd1f5bf9d4a4c8da91ef07d49d32fdabbc2a8c2 Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 17:36:58 +0200
Subject: [PATCH 12/13] =?UTF-8?q?v=C3=A9rif=20gzip?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 bin/sloccount.sh | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index 11af37c..60a1195 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -16,15 +16,21 @@ function check_tokei_version() {
 	return 1
 }
 
-function download_tokei() {
+function install_tokei() {
 	echo "Installing tokei"
 	TOKEITGZ=tokei-x86_64-unknown-linux-gnu.tar.gz
 	TOKEITMP=~/tmp/tokei-$TOKEI_VERSION.tar.gz
+	if [ -f $TOKEITMP ]; then
+		if ! gzip -t $TOKEITMP; then
+			echo "$TOKEITMP is not a valid gzip archive"
+			rm -f $TOKEITMP
+		fi
+	fi
 	if [ ! -f $TOKEITMP ]; then
 		mkdir -p ~/tmp
 		URL="https://github.com/XAMPPRocky/tokei/releases/download/v$TOKEI_VERSION/$TOKEITGZ"
 		echo "Downloading tokei from $URL"
-		curl --verbose --location $URL -o $TOKEITMP
+		curl --location $URL -o $TOKEITMP
 	fi
 	echo "Extracting tokei"
 	tar zxf $TOKEITMP -C $BIN_DIR
@@ -40,7 +46,7 @@ if [ ! -x "$PYTHON" ]; then
 	exit 1
 fi
 
-if [ -x "$TOKEI" ]; then
+if [ ! -x "$TOKEI" ]; then
 	if [ -f $BIN_DIR/tokei ]; then
 		TOKEI=$BIN_DIR/tokei
 	fi
@@ -49,11 +55,11 @@ fi
 if [ -x "$TOKEI" ]; then
 	check_tokei_version
 	if [ $? -eq 1 ]; then
-		download_tokei
+		install_tokei
 	fi
 fi
 if [ ! -x "$TOKEI" ]; then
-	download_tokei
+	install_tokei
 fi
 if [ ! -f $TOKEI ]; then
 	echo "Strange, $TOKEI does not exist!"
-- 
GitLab


From 6e752df6668e8d5c950fce83ff3010d381a1dfa1 Mon Sep 17 00:00:00 2001
From: Olivier Maury <Olivier.Maury@inrae.fr>
Date: Wed, 24 Jul 2024 17:40:13 +0200
Subject: [PATCH 13/13] Python

---
 bin/sloccount.sh | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/bin/sloccount.sh b/bin/sloccount.sh
index 60a1195..b3d1755 100755
--- a/bin/sloccount.sh
+++ b/bin/sloccount.sh
@@ -69,8 +69,4 @@ fi
 echo "tokei is installed at $TOKEI"
 $TOKEI --version
 mkdir -p $ROOT_DIR/target
-if [ ! -d $ROOT_DIR/www-client ]; then
-	$TOKEI -f -o json $ROOT_DIR/src | $TOKEI2CLOC > $ROOT_DIR/target/cloc.xml
-	exit
-fi
-$TOKEI -f -o json $ROOT_DIR/www-client/src $ROOT_DIR/www-server/src $ROOT_DIR/www-shared/src | $TOKEI2CLOC > $ROOT_DIR/target/cloc.xml
+$TOKEI -f -o json $ROOT_DIR/src | $PYTHON $TOKEI2CLOC > $ROOT_DIR/target/cloc.xml
-- 
GitLab