[FIX] socme checks

This commit is contained in:
Edouard DUPIN 2024-06-01 19:49:36 +02:00
parent 6af6f91166
commit c43e283b57
6 changed files with 44 additions and 25 deletions

View File

@ -25,7 +25,7 @@
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

View File

@ -15,10 +15,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
</natures>
<filteredResources>
<filter>

19
pom.xml
View File

@ -120,7 +120,6 @@
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
@ -183,7 +182,6 @@
<version>3.3.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
@ -305,6 +303,23 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.5.0</version>
<configuration>
<includeFilterFile>spotbugs-security-include.xml</includeFilterFile>
<excludeFilterFile>spotbugs-security-exclude.xml</excludeFilterFile>
<!--<plugins>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-plugin</artifactId>
<version>1.12.0</version>
</plugin>
</plugins>
-->
</configuration>
</plugin>
</plugins>
</build>
<!-- Generate Java-docs As Part Of Project Reports -->

View File

@ -4,7 +4,7 @@ import org.kar.archidata.db.DBConfig;
import org.kar.archidata.tools.ConfigBaseVariable;
public class GlobalConfiguration {
public static DBConfig dbConfig = null;
public static final DBConfig dbConfig;
static {
dbConfig = new DBConfig(ConfigBaseVariable.getDBType(), ConfigBaseVariable.getDBHost(),

View File

@ -969,13 +969,12 @@ public class DataAccess {
// uniqueSQLUUID = generatedKeys.getObject(1, UUID.class);
/* final Object obj = generatedKeys.getObject(1); final BigInteger bigint = (BigInteger) generatedKeys.getObject(1); uniqueSQLUUID = UuidUtils.asUuid(bigint); final UUID
* generatedUUID = (UUID) generatedKeys.getObject(1); System.out.println("UUID généré: " + generatedUUID); */
final Object obj = generatedKeys.getObject(1);
//final Object obj = generatedKeys.getObject(1);
final byte[] tmpid = generatedKeys.getBytes(1);
uniqueSQLUUID = UuidUtils.asUuid(tmpid);
} else {
uniqueSQLID = generatedKeys.getLong(1);
}
} else {
throw new SQLException("Creating node failed, no ID obtained (1).");
}
@ -985,6 +984,7 @@ public class DataAccess {
throw new SQLException("Creating node failed, no ID obtained (2).");
}
}
ps.close();
if (primaryKeyField != null) {
if (primaryKeyField.getType() == Long.class) {
primaryKeyField.set(data, uniqueSQLID);
@ -1228,7 +1228,9 @@ public class DataAccess {
}
}
condition.injectQuery(ps, iii);
return ps.executeUpdate();
final int out = ps.executeUpdate();
ps.close();
return out;
}
} catch (final SQLException ex) {
ex.printStackTrace();
@ -1574,10 +1576,6 @@ public class DataAccess {
return getsWhere(clazz, option);
}
public static <ID_TYPE> int delete(final Class<?> clazz, final ID_TYPE id) throws Exception {
return delete(clazz, id, null);
}
/** Delete items with the specific Id (cf @Id) and some options. If the Entity is manage as a softDeleted model, then it is flag as removed (if not already done before).
* @param <ID_TYPE> Type of the reference @Id
* @param clazz Data model that might remove element

View File

@ -47,7 +47,7 @@ public class UuidUtils {
this.base = startingUUID.until(Instant.now(), ChronoUnit.SECONDS);
final String serveurBaseUUID = System.getenv("UUID_SERVER_ID");
if (serveurBaseUUID != null) {
long serverId = Long.valueOf(serveurBaseUUID);
long serverId = Long.parseLong(serveurBaseUUID);
serverId %= 0xFFFF;
this.base += (serverId << (64 - 16));
} else {