diff --git a/src/cli/src/main/java/it/geosolutions/geostore/cli/H2ToPgSQLExporter.java b/src/cli/src/main/java/it/geosolutions/geostore/cli/H2ToPgSQLExporter.java index daa036ea..e7cbc4da 100644 --- a/src/cli/src/main/java/it/geosolutions/geostore/cli/H2ToPgSQLExporter.java +++ b/src/cli/src/main/java/it/geosolutions/geostore/cli/H2ToPgSQLExporter.java @@ -35,13 +35,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.TreeMap; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -115,17 +109,15 @@ static Output path(String path) { List orderedTables = Arrays.asList( - new String[] { - "GS_CATEGORY", - "GS_RESOURCE", - "GS_ATTRIBUTE", - "GS_USER", - "GS_USER_ATTRIBUTE", - "GS_USERGROUP", - "GS_USERGROUP_MEMBERS", - "GS_SECURITY", - "GS_STORED_DATA" - }); + "GS_CATEGORY", + "GS_RESOURCE", + "GS_ATTRIBUTE", + "GS_USER", + "GS_USER_ATTRIBUTE", + "GS_USERGROUP", + "GS_USERGROUP_MEMBERS", + "GS_SECURITY", + "GS_STORED_DATA"); Pattern searchInserts = Pattern.compile( @@ -210,7 +202,8 @@ List filterInserts(String script) { if (insertsByTable.containsKey(tableName)) { insertsByTable.get(tableName).add(insert); } else { - insertsByTable.put(tableName, new ArrayList(Arrays.asList(insert))); + insertsByTable.put( + tableName, new ArrayList(Collections.singletonList(insert))); } } return flat(insertsByTable); @@ -226,7 +219,7 @@ Optional exportH2AsScript() throws IOException { try { Script.execute( "jdbc:h2:" + h2path.get() + ";ACCESS_MODE_DATA=r", username, password, os); - String script = new String(os.toByteArray(), StandardCharsets.UTF_8); + String script = os.toString(StandardCharsets.UTF_8); return Optional.of(script); } catch (SQLException e) { System.err.println("Error extracting data from the H2 database: " + e.getMessage()); diff --git a/src/cli/src/test/java/it/geosolutions/geostore/cli/H2ToPgSQLExporterOutputTest.java b/src/cli/src/test/java/it/geosolutions/geostore/cli/H2ToPgSQLExporterOutputTest.java index 293f9f52..88a4afe9 100644 --- a/src/cli/src/test/java/it/geosolutions/geostore/cli/H2ToPgSQLExporterOutputTest.java +++ b/src/cli/src/test/java/it/geosolutions/geostore/cli/H2ToPgSQLExporterOutputTest.java @@ -28,8 +28,7 @@ */ package it.geosolutions.geostore.cli; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import it.geosolutions.geostore.cli.H2ToPgSQLExporter.Output; import it.geosolutions.geostore.cli.H2ToPgSQLExporter.OutputType; @@ -44,7 +43,7 @@ public void existingFolder() throws IOException { Output output = exporter.validateOutputFile(); - assertTrue(output.type == OutputType.FILE); + assertSame(output.type, OutputType.FILE); assertEquals(exporter.outputPath, output.path.get()); } @@ -54,7 +53,7 @@ public void pathWithoutExtension() throws IOException { Output output = exporter.validateOutputFile(); - assertTrue(output.type == OutputType.FILE); + assertSame(output.type, OutputType.FILE); assertTrue(output.path.get().toLowerCase().endsWith(".sql")); } @@ -64,7 +63,7 @@ public void notExistingFolder() throws IOException { Output output = exporter.validateOutputFile(); - assertTrue(output.type == OutputType.INVALID); + assertSame(output.type, OutputType.INVALID); } @Test @@ -73,7 +72,7 @@ public void standardOutput() throws IOException { Output output = exporter.validateOutputFile(); - assertTrue(output.type == OutputType.STDOUT); + assertSame(output.type, OutputType.STDOUT); } private String getValidPath() throws IOException { diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Attribute.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Attribute.java index a1adf31e..b8af4a08 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Attribute.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Attribute.java @@ -110,8 +110,7 @@ public class Attribute implements Serializable { @PrePersist public void onPreUpdate() throws Exception { if (textValue == null && numberValue == null && dateValue == null) { - throw new NullPointerException( - "Null value not allowed in attribute: " + this.toString()); + throw new NullPointerException("Null value not allowed in attribute: " + this); } else if (this.textValue == null && this.numberValue != null ^ this.dateValue != null || this.numberValue == null && this.dateValue == null) { @@ -122,8 +121,7 @@ public void onPreUpdate() throws Exception { } else { throw new Exception( - "Only one DataType can be not-null inside the Attribute entity: " - + this.toString()); + "Only one DataType can be not-null inside the Attribute entity: " + this); } } @@ -192,7 +190,7 @@ public String getValue() { case NUMBER: return numberValue.toString(); case STRING: - return textValue.toString(); + return textValue; default: throw new IllegalStateException("Unknown type " + type); } @@ -347,7 +345,6 @@ public boolean equals(Object obj) { if (textValue == null) { if (other.textValue != null) return false; } else if (!textValue.equals(other.textValue)) return false; - if (type != other.type) return false; - return true; + return type == other.type; } } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Category.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Category.java index a50b3c83..b4d2a1c1 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Category.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Category.java @@ -192,12 +192,8 @@ public boolean equals(Object obj) { return false; } if (resource == null) { - if (other.resource != null) { - return false; - } - } else if (!resource.equals(other.resource)) { - return false; - } + return other.resource == null; + } else return resource.equals(other.resource); // if ( security == null ) { // if ( other.security != null ) { // return false; @@ -205,7 +201,5 @@ public boolean equals(Object obj) { // } else if ( !security.equals(other.security) ) { // return false; // } - - return true; } } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Resource.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Resource.java index db9d5753..10eb073a 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Resource.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/Resource.java @@ -441,11 +441,7 @@ public boolean equals(Object obj) { } if (editor == null) { return other.editor == null; - } else if (!editor.equals(other.editor)) { - return false; - } - - return true; + } else return editor.equals(other.editor); } /* diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/SecurityRule.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/SecurityRule.java index 6445d072..de8dc4f3 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/SecurityRule.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/SecurityRule.java @@ -336,13 +336,7 @@ public boolean equals(Object obj) { return false; } if (user == null) { - if (other.user != null) { - return false; - } - } else if (!user.equals(other.user)) { - return false; - } - - return true; + return other.user == null; + } else return user.equals(other.user); } } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/StoredData.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/StoredData.java index 5c011615..b5f36e81 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/StoredData.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/StoredData.java @@ -159,13 +159,7 @@ public boolean equals(Object obj) { return false; } if (resource == null) { - if (other.resource != null) { - return false; - } - } else if (!resource.equals(other.resource)) { - return false; - } - - return true; + return other.resource == null; + } else return resource.equals(other.resource); } } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/User.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/User.java index 020ba9ba..e26fd319 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/User.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/User.java @@ -90,7 +90,7 @@ public class User implements Serializable { @Enumerated(EnumType.STRING) private Role role; - public User() {}; + public User() {} public User(User user) { this.id = user.id; @@ -294,7 +294,7 @@ public String toString() { if (groups != null) { builder.append(", "); - builder.append("group=").append(groups.toString()); + builder.append("group=").append(groups); } if (role != null) { @@ -380,13 +380,7 @@ public boolean equals(Object obj) { return false; } if (security == null) { - if (other.security != null) { - return false; - } - } else if (!security.equals(other.security)) { - return false; - } - - return true; + return other.security == null; + } else return security.equals(other.security); } } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserAttribute.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserAttribute.java index 9b0343ec..c859996c 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserAttribute.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserAttribute.java @@ -196,13 +196,7 @@ public boolean equals(Object obj) { return false; } if (value == null) { - if (other.value != null) { - return false; - } - } else if (!value.equals(other.value)) { - return false; - } - - return true; + return other.value == null; + } else return value.equals(other.value); } } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroup.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroup.java index 028658d8..b10d81af 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroup.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroup.java @@ -249,13 +249,7 @@ public boolean equals(Object obj) { } if (attributes == null) { - if (other.attributes != null) { - return false; - } - } else if (!attributes.equals(other.attributes)) { - return false; - } - - return true; + return other.attributes == null; + } else return attributes.equals(other.attributes); } } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroupAttribute.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroupAttribute.java index e902745b..54874ece 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroupAttribute.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/UserGroupAttribute.java @@ -158,13 +158,7 @@ public boolean equals(Object obj) { return false; } if (value == null) { - if (other.value != null) { - return false; - } - } else if (!value.equals(other.value)) { - return false; - } - - return true; + return other.value == null; + } else return value.equals(other.value); } } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/DataType.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/DataType.java index a912594d..89f2e9d2 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/DataType.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/DataType.java @@ -36,5 +36,5 @@ public enum DataType { STRING, NUMBER, - DATE; + DATE } diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/GroupReservedNames.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/GroupReservedNames.java index e232d9b0..08fe94a4 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/GroupReservedNames.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/GroupReservedNames.java @@ -47,10 +47,7 @@ public String groupName() { * @return */ public static boolean isAllowedName(String groupNameToCheck) { - if (EVERYONE.groupName().equalsIgnoreCase(groupNameToCheck)) { - return false; - } - return true; + return !EVERYONE.groupName().equalsIgnoreCase(groupNameToCheck); } /** diff --git a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/UserReservedNames.java b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/UserReservedNames.java index b2a8b293..91f64813 100644 --- a/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/UserReservedNames.java +++ b/src/core/model/src/main/java/it/geosolutions/geostore/core/model/enums/UserReservedNames.java @@ -42,9 +42,6 @@ public String userName() { * @return */ public static boolean isAllowedName(String groupNameToCheck) { - if (GUEST.userName().equalsIgnoreCase(groupNameToCheck)) { - return false; - } - return true; + return !GUEST.userName().equalsIgnoreCase(groupNameToCheck); } } diff --git a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/AttributeTest.java b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/AttributeTest.java index 3655801c..32b8c06d 100644 --- a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/AttributeTest.java +++ b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/AttributeTest.java @@ -50,7 +50,7 @@ private void doTheTest(Attribute a0) { System.out.println(a1); System.out.println(s); - assertTrue(a0.equals(a1)); + assertEquals(a0, a1); } @Test diff --git a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/CategoryTest.java b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/CategoryTest.java index 6f34f35a..7d61d479 100644 --- a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/CategoryTest.java +++ b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/CategoryTest.java @@ -19,7 +19,7 @@ */ package it.geosolutions.geostore.core.model; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -34,7 +34,7 @@ public CategoryTest() {} public void testMarshallingString() throws Exception { Category c0 = new Category(); c0.setName("testatt"); - c0.setId(1l); + c0.setId(1L); doTheTest(c0); } @@ -47,6 +47,6 @@ private void doTheTest(Category a0) { System.out.println(a1); System.out.println(s); - assertTrue(a0.equals(a1)); + assertEquals(a0, a1); } } diff --git a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/SecurityRuleTest.java b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/SecurityRuleTest.java index 8f58bc1e..d8ce2b15 100644 --- a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/SecurityRuleTest.java +++ b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/SecurityRuleTest.java @@ -19,7 +19,7 @@ */ package it.geosolutions.geostore.core.model; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -45,6 +45,6 @@ private void doTheTest(SecurityRule a0) { String s = MARSHALER.marshal(a0); SecurityRule a1 = MARSHALER.unmarshal(s); - assertTrue(a0.equals(a1)); + assertEquals(a0, a1); } } diff --git a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/UserGroupTest.java b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/UserGroupTest.java index 62114047..b40657a4 100644 --- a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/UserGroupTest.java +++ b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/UserGroupTest.java @@ -20,9 +20,8 @@ package it.geosolutions.geostore.core.model; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import java.util.Arrays; +import java.util.List; import org.junit.Test; /** @author ETj (etj at geo-solutions.it) */ @@ -42,7 +41,7 @@ public void testMarshallingString() throws Exception { User u0 = new User(); u0.setName("user name"); u0.setEnabled(true); - g0.setUsers(Arrays.asList(u0)); + g0.setUsers(List.of(u0)); doTheTest(g0); } @@ -51,6 +50,6 @@ private void doTheTest(UserGroup g0) { String s = MARSHALER.marshal(g0); UserGroup ug = MARSHALER.unmarshal(s); assertEquals(0, ug.getUsers().size()); - assertTrue(g0.equals(ug)); + assertEquals(g0, ug); } } diff --git a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/UserTest.java b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/UserTest.java index 4a09f03f..0b878112 100644 --- a/src/core/model/src/test/java/it/geosolutions/geostore/core/model/UserTest.java +++ b/src/core/model/src/test/java/it/geosolutions/geostore/core/model/UserTest.java @@ -19,8 +19,7 @@ */ package it.geosolutions.geostore.core.model; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import org.junit.Test; @@ -43,7 +42,7 @@ private void doTheTest(User u0) { String s = MARSHALER.marshal(u0); User u = MARSHALER.unmarshal(s); - assertTrue(u0.equals(u)); + assertEquals(u0, u); assertFalse(u.isTrusted()); } } diff --git a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ResourceDAO.java b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ResourceDAO.java index 99896638..d7343fb9 100644 --- a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ResourceDAO.java +++ b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ResourceDAO.java @@ -44,13 +44,13 @@ public interface ResourceDAO extends RestrictedGenericDAO { * @param resourceId * @return List */ - public List findAttributes(long resourceId); + List findAttributes(long resourceId); /** @param search */ - public void removeResources(ISearch search); + void removeResources(ISearch search); /** @param resourcesIDs A list of resources Ids to search */ - public List findResources(List resourcesIds); + List findResources(List resourcesIds); /** * Gets a resource by name. @@ -58,7 +58,7 @@ public interface ResourceDAO extends RestrictedGenericDAO { * @return the resource with the specified name, or null if none was found * @throws NonUniqueResultException if more than one result */ - public Resource findByName(String resourceName); + Resource findByName(String resourceName); /** * Returns a list of resource names matching the specified pattern @@ -66,5 +66,5 @@ public interface ResourceDAO extends RestrictedGenericDAO { * @param pattern the pattern used to build a LIKE filter * @return a list of resource names */ - public List findResourceNamesMatchingPattern(String pattern); + List findResourceNamesMatchingPattern(String pattern); } diff --git a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/RestrictedGenericDAO.java b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/RestrictedGenericDAO.java index 2371832a..c481da9f 100644 --- a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/RestrictedGenericDAO.java +++ b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/RestrictedGenericDAO.java @@ -32,21 +32,21 @@ */ public interface RestrictedGenericDAO { - public List findAll(); + List findAll(); - public ENTITY find(Long id); + ENTITY find(Long id); - public void persist(ENTITY... entities); + void persist(ENTITY... entities); - public ENTITY[] save(ENTITY... entities); + ENTITY[] save(ENTITY... entities); - public ENTITY merge(ENTITY entity); + ENTITY merge(ENTITY entity); - public boolean remove(ENTITY entity); + boolean remove(ENTITY entity); - public boolean removeById(Long id); + boolean removeById(Long id); - public List search(ISearch search); + List search(ISearch search); - public int count(ISearch search); + int count(ISearch search); } diff --git a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/SecurityDAO.java b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/SecurityDAO.java index 43f40fed..308c0b56 100644 --- a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/SecurityDAO.java +++ b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/SecurityDAO.java @@ -41,18 +41,18 @@ public interface SecurityDAO extends RestrictedGenericDAO { * @param resourceId * @return List */ - public List findUserSecurityRule(String userName, long resourceId); + List findUserSecurityRule(String userName, long resourceId); /** * @param groupNames * @param resourceId * @return */ - public List findGroupSecurityRule(List groupNames, long resourceId); + List findGroupSecurityRule(List groupNames, long resourceId); /** * @param resourceId * @return List */ - public List findSecurityRules(long resourceId); + List findSecurityRules(long resourceId); } diff --git a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/LdapBaseDAOImpl.java b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/LdapBaseDAOImpl.java index 2765488d..aa832faf 100644 --- a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/LdapBaseDAOImpl.java +++ b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/LdapBaseDAOImpl.java @@ -247,10 +247,7 @@ protected boolean isNested(ISearch search) { * @return */ private boolean isNested(Filter filter) { - if (filter.getOperator() == Filter.OP_SOME || filter.getOperator() == Filter.OP_ALL) { - return true; - } - return false; + return filter.getOperator() == Filter.OP_SOME || filter.getOperator() == Filter.OP_ALL; } /** diff --git a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/UserGroupDAOImpl.java b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/UserGroupDAOImpl.java index c7f1f343..62d52911 100644 --- a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/UserGroupDAOImpl.java +++ b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/UserGroupDAOImpl.java @@ -188,7 +188,7 @@ protected UserGroup doMapFromContext(DirContextOperations ctx) { // the users list here if (!"".equals(memberAttribute) && userDAO != null && loadUsers(search)) { String[] memberAttrs = ctx.getStringAttributes(memberAttribute); - if (memberAttrs != null && memberAttrs.length > 0) { + if (memberAttrs != null) { for (String member : memberAttrs) { group.getUsers().add(userDAO.createMemberUser(member)); } @@ -217,6 +217,7 @@ private List addEveryOne(List groups, ISearch search) { for (UserGroup group : groups) { if (group.getGroupName().equals(everyoneGroup.getGroupName())) { everyoneFound = true; + break; } } if (!everyoneFound && addEveryOneGroup) { @@ -283,7 +284,7 @@ protected boolean loadUsers(ISearch search) { if (search instanceof GeoStoreISearchWrapper) { GeoStoreISearchWrapper wrapper = (GeoStoreISearchWrapper) search; Class clazz = wrapper.getCallerContext(); - if (clazz != null && UserDAO.class.isAssignableFrom(clazz)) return false; + return clazz == null || !UserDAO.class.isAssignableFrom(clazz); } return true; } diff --git a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/search/GeoStoreISearchWrapper.java b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/search/GeoStoreISearchWrapper.java index ab9c5cef..c24c5b1a 100644 --- a/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/search/GeoStoreISearchWrapper.java +++ b/src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/search/GeoStoreISearchWrapper.java @@ -29,9 +29,9 @@ /** A wrapper for an ISearch. It is meant to provide the callerContext as a Class. */ public class GeoStoreISearchWrapper implements ISearch { - private ISearch delegate; + private final ISearch delegate; - private Class callerContext; + private final Class callerContext; public GeoStoreISearchWrapper(ISearch delegate, Class callerContext) { this.delegate = delegate; diff --git a/src/core/persistence/src/test/java/it/geosolutions/geostore/core/dao/ldap/BaseDAOTest.java b/src/core/persistence/src/test/java/it/geosolutions/geostore/core/dao/ldap/BaseDAOTest.java index 3a80ce5b..13049814 100644 --- a/src/core/persistence/src/test/java/it/geosolutions/geostore/core/dao/ldap/BaseDAOTest.java +++ b/src/core/persistence/src/test/java/it/geosolutions/geostore/core/dao/ldap/BaseDAOTest.java @@ -305,8 +305,7 @@ public String getStringAttribute(String name) { } }, new BasicAttributes()); - return new IterableNamingEnumeration( - Arrays.asList(new SearchResult[] {sr1, sr2})); + return new IterableNamingEnumeration(Arrays.asList(sr1, sr2)); } else if ("(& (cn=*) (member=cn=username2,ou=users))".contentEquals(filter)) { SearchResult sr = new SearchResult( diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/ldap/MockDirContextOperations.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/ldap/MockDirContextOperations.java index 1161d155..96a2e8cd 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/ldap/MockDirContextOperations.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/ldap/MockDirContextOperations.java @@ -20,7 +20,7 @@ public class MockDirContextOperations implements DirContextOperations { - private Map ldapAttributes = new HashMap(); + private final Map ldapAttributes = new HashMap(); public Map getLdapAttributes() { return ldapAttributes; diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/UserDetailsWithAttributes.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/UserDetailsWithAttributes.java index b373e82c..e6023f40 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/UserDetailsWithAttributes.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/UserDetailsWithAttributes.java @@ -35,5 +35,5 @@ * @author Mauro Bartolomeoli */ public interface UserDetailsWithAttributes extends UserDetails { - public Object getAttribute(String name); + Object getAttribute(String name); } diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/ldap/LdapUserDetailsWithAttributes.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/ldap/LdapUserDetailsWithAttributes.java index fd50929a..4fb7e4cd 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/ldap/LdapUserDetailsWithAttributes.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/ldap/LdapUserDetailsWithAttributes.java @@ -40,9 +40,9 @@ * @author Mauro Bartolomeoli */ public class LdapUserDetailsWithAttributes implements LdapUserDetails, UserDetailsWithAttributes { - private LdapUserDetails delegate; + private final LdapUserDetails delegate; - private Map attributes = new HashMap(); + private final Map attributes = new HashMap(); public LdapUserDetailsWithAttributes(LdapUserDetails delegate) { super(); diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/AbstractGeoStorePasswordEncoder.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/AbstractGeoStorePasswordEncoder.java index 9e782349..60519125 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/AbstractGeoStorePasswordEncoder.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/AbstractGeoStorePasswordEncoder.java @@ -184,7 +184,7 @@ public void setReversible(boolean reversible) { } /** Interface for password encoding when source password is specified as char array. */ - protected static interface CharArrayPasswordEncoder { + protected interface CharArrayPasswordEncoder { String encodePassword(char[] rawPass, Object salt); diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/GeoStoreDigestPasswordEncoder.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/GeoStoreDigestPasswordEncoder.java index dee0e41a..b91e23da 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/GeoStoreDigestPasswordEncoder.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/GeoStoreDigestPasswordEncoder.java @@ -48,7 +48,7 @@ protected PasswordEncoder createStringEncoder() { @Override protected CharArrayPasswordEncoder createCharEncoder() { return new CharArrayPasswordEncoder() { - StandardByteDigester digester = new StandardByteDigester(); + final StandardByteDigester digester = new StandardByteDigester(); { digester.setAlgorithm("SHA-256"); diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/GeoStorePasswordEncoder.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/GeoStorePasswordEncoder.java index bd6824a7..7511a81a 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/GeoStorePasswordEncoder.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/GeoStorePasswordEncoder.java @@ -10,7 +10,7 @@ */ public interface GeoStorePasswordEncoder extends PasswordEncoder, BeanNameAware { - public static final String PREFIX_DELIMTER = ":"; + String PREFIX_DELIMTER = ":"; /** The name of the password encoder. */ String getName(); diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/KeyStoreProvider.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/KeyStoreProvider.java index 4b3ae7ae..75f8406f 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/KeyStoreProvider.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/KeyStoreProvider.java @@ -199,5 +199,5 @@ public interface KeyStoreProvider { */ void commitMasterPasswordChange() throws IOException; - public Enumeration aliases(); + Enumeration aliases(); } diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/KeyStoreProviderImpl.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/KeyStoreProviderImpl.java index 88be14c5..53829381 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/KeyStoreProviderImpl.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/KeyStoreProviderImpl.java @@ -235,8 +235,7 @@ public boolean hasUserGroupKey(String serviceName) throws IOException { public SecretKey getSecretKey(String name) throws IOException { Key key = getKey(name); if (key == null) return null; - if ((key instanceof SecretKey) == false) - throw new IOException("Invalid key type for: " + name); + if (!(key instanceof SecretKey)) throw new IOException("Invalid key type for: " + name); return (SecretKey) key; } @@ -247,8 +246,7 @@ public SecretKey getSecretKey(String name) throws IOException { public PublicKey getPublicKey(String name) throws IOException { Key key = getKey(name); if (key == null) return null; - if ((key instanceof PublicKey) == false) - throw new IOException("Invalid key type for: " + name); + if (!(key instanceof PublicKey)) throw new IOException("Invalid key type for: " + name); return (PublicKey) key; } @@ -259,8 +257,7 @@ public PublicKey getPublicKey(String name) throws IOException { public PrivateKey getPrivateKey(String name) throws IOException { Key key = getKey(name); if (key == null) return null; - if ((key instanceof PrivateKey) == false) - throw new IOException("Invalid key type for: " + name); + if (!(key instanceof PrivateKey)) throw new IOException("Invalid key type for: " + name); return (PrivateKey) key; } @@ -269,10 +266,8 @@ public PrivateKey getPrivateKey(String name) throws IOException { */ @Override public String aliasForGroupService(String serviceName) { - StringBuffer buff = new StringBuffer(USERGROUP_PREFIX); - buff.append(serviceName); - buff.append(USERGROUP_POSTFIX); - return buff.toString(); + String buff = USERGROUP_PREFIX + serviceName + USERGROUP_POSTFIX; + return buff; } /** @@ -288,7 +283,7 @@ protected void assertActivatedKeyStore() throws IOException { char[] passwd = getMasterPassword(); try { ks = KeyStore.getInstance(KEYSTORETYPE); - if (getFile().exists() == false) { // create an empy one + if (!getFile().exists()) { // create an empy one ks.load(null, passwd); addInitialKeys(); try (FileOutputStream fos = new FileOutputStream(getFile())) { @@ -494,9 +489,9 @@ public void commitMasterPasswordChange() throws IOException { File newKSFile = new File(dir, PREPARED_FILE_NAME); File oldKSFile = new File(dir, DEFAULT_FILE_NAME); - if (newKSFile.exists() == false) return; // nothing to do + if (!newKSFile.exists()) return; // nothing to do - if (oldKSFile.exists() == false) return; // not initialized + if (!oldKSFile.exists()) return; // not initialized // Try to open with new password try (FileInputStream fin = new FileInputStream(newKSFile)) { @@ -511,12 +506,12 @@ public void commitMasterPasswordChange() throws IOException { while (enumeration.hasMoreElements()) { newKS.getKey(enumeration.nextElement(), passwd); } - if (oldKSFile.delete() == false) { + if (!oldKSFile.delete()) { LOGGER.error("cannot delete " + getFile().getCanonicalPath()); return; } - if (newKSFile.renameTo(oldKSFile) == false) { + if (!newKSFile.renameTo(oldKSFile)) { String msg = "cannot rename " + newKSFile.getCanonicalPath(); msg += "to " + oldKSFile.getCanonicalPath(); msg += "Try to rename manually and restart"; diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/MasterPasswordProvider.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/MasterPasswordProvider.java index 8794a213..32a7933b 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/MasterPasswordProvider.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/MasterPasswordProvider.java @@ -27,7 +27,7 @@ public interface MasterPasswordProvider { * @return the Master Password * @throws Exception */ - public char[] doGetMasterPassword() throws Exception; + char[] doGetMasterPassword() throws Exception; /** * Set the master password @@ -35,5 +35,5 @@ public interface MasterPasswordProvider { * @param passwd the password to set * @throws Exception */ - public void doSetMasterPassword(char[] passwd) throws Exception; + void doSetMasterPassword(char[] passwd) throws Exception; } diff --git a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/PasswordEncodingType.java b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/PasswordEncodingType.java index 04b9a2c4..ada62e4e 100644 --- a/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/PasswordEncodingType.java +++ b/src/core/security/src/main/java/it/geosolutions/geostore/core/security/password/PasswordEncodingType.java @@ -38,5 +38,5 @@ public enum PasswordEncodingType { PLAIN, ENCRYPT, DIGEST, - GEOSTORE; + GEOSTORE } diff --git a/src/core/security/src/test/java/it/geosolutions/geostore/core/security/password/MasterPasswordProviderTest.java b/src/core/security/src/test/java/it/geosolutions/geostore/core/security/password/MasterPasswordProviderTest.java index bfda4bdf..054599c6 100644 --- a/src/core/security/src/test/java/it/geosolutions/geostore/core/security/password/MasterPasswordProviderTest.java +++ b/src/core/security/src/test/java/it/geosolutions/geostore/core/security/password/MasterPasswordProviderTest.java @@ -21,7 +21,6 @@ import static it.geosolutions.geostore.core.security.password.SecurityUtils.toChars; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import org.junit.Test; @@ -41,7 +40,7 @@ public void testCodec() { // System.out.println(toChars(encPass)); byte[] dec = mp.decode(encPass); mp.setEncrypting(true); - assertTrue(testString.equals(new String(toChars(dec)))); + assertEquals(testString, new String(toChars(dec))); String geostore = "kfn8fAS8YMHgLxR8i3VBhzenrp3lnLLT"; String geoserver1 = "F8fX7L2gs8H5SVD2q7HoC3IKo/0QAbEx"; diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/ResourceService.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/ResourceService.java index bfae93fb..18cc02c1 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/ResourceService.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/ResourceService.java @@ -206,7 +206,7 @@ List getResources( * {@link #getResources(it.geosolutions.geostore.services.dto.search.SearchFilter, it.geosolutions.geostore.core.model.User) getResources) if you * need less data. */ - public List getResourcesFull(SearchFilter filter, User authUser) + List getResourcesFull(SearchFilter filter, User authUser) throws BadRequestServiceEx, InternalErrorServiceEx; /** @@ -215,8 +215,7 @@ public List getResourcesFull(SearchFilter filter, User authUser) * @param id * @return */ - public List getSecurityRules(long id) - throws BadRequestServiceEx, InternalErrorServiceEx; + List getSecurityRules(long id) throws BadRequestServiceEx, InternalErrorServiceEx; /** * Replaces the list of security rules for the given resource. @@ -227,7 +226,7 @@ public List getSecurityRules(long id) * @throws InternalErrorServiceEx * @throws NotFoundServiceEx */ - public void updateSecurityRules(long id, List rules) + void updateSecurityRules(long id, List rules) throws BadRequestServiceEx, InternalErrorServiceEx, NotFoundServiceEx; /** diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserGroupService.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserGroupService.java index 8e69d5f4..c64cd3e4 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserGroupService.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserGroupService.java @@ -105,7 +105,7 @@ List updateSecurityRules( * * @return true if the persist operation finish with success, false otherwise */ - public boolean insertSpecialUsersGroups(); + boolean insertSpecialUsersGroups(); /** * Remove the special UserGroups, those that implies special behavior @@ -114,13 +114,13 @@ List updateSecurityRules( * * @return true if the removal operation finish with success, false otherwise */ - public boolean removeSpecialUsersGroups(); + boolean removeSpecialUsersGroups(); /** * Get The UserGroup from the name * * @param name */ - public UserGroup get(String name); + UserGroup get(String name); /** * Returns the amount of groups that match searching criteria. The 'everyone' group is never diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserService.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserService.java index 7338c4cf..54c02781 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserService.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserService.java @@ -76,7 +76,7 @@ public interface UserService { * @return User * @throws NotFoundWebEx */ - public User get(String name) throws NotFoundServiceEx; + User get(String name) throws NotFoundServiceEx; /** * @param page @@ -117,7 +117,7 @@ List getAll(Integer page, Integer entries, String nameLike, boolean includ * * @return true if the persist operation finish with success, false otherwise */ - public boolean insertSpecialUsers(); + boolean insertSpecialUsers(); /** * Returns all user with the specified attribute (name / value). @@ -125,7 +125,7 @@ List getAll(Integer page, Integer entries, String nameLike, boolean includ * @param attribute * @return */ - public Collection getByAttribute(UserAttribute attribute); + Collection getByAttribute(UserAttribute attribute); - public Collection getByGroup(UserGroup group); + Collection getByGroup(UserGroup group); } diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserSessionService.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserSessionService.java index 498f7c18..46173c19 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserSessionService.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/UserSessionService.java @@ -45,7 +45,7 @@ public interface UserSessionService { * @param sessionId * @return */ - public User getUserData(String sessionId); + User getUserData(String sessionId); /** * Gets refresh token for a given session id (if existing). @@ -53,14 +53,14 @@ public interface UserSessionService { * @param sessionId * @return */ - public String getRefreshToken(String sessionId); + String getRefreshToken(String sessionId); /** * Refresh an expiring session by the given interval. * * @param sessionId */ - public UserSession refreshSession(String sessionId, String refreshToken); + UserSession refreshSession(String sessionId, String refreshToken); /** * Register a new session. The session id is given. @@ -68,7 +68,7 @@ public interface UserSessionService { * @param sessionId * @param session */ - public void registerNewSession(String sessionId, UserSession session); + void registerNewSession(String sessionId, UserSession session); /** * Register a new session. The session id is automatically created and returned. @@ -76,17 +76,17 @@ public interface UserSessionService { * @param session * @return the generated session id */ - public String registerNewSession(UserSession session); + String registerNewSession(UserSession session); /** * Remove a session, given its id. * * @param sessionId */ - public void removeSession(String sessionId); + void removeSession(String sessionId); /** Remove all the sessions. */ - public void removeAllSessions(); + void removeAllSessions(); /** * Checks that owner is the user bound to the given sessionId. @@ -95,5 +95,5 @@ public interface UserSessionService { * @param owner * @return */ - public boolean isOwner(String sessionId, Object owner); + boolean isOwner(String sessionId, Object owner); } diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/UserSession.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/UserSession.java index 8a1e8cde..89a6334a 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/UserSession.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/UserSession.java @@ -38,17 +38,17 @@ */ public interface UserSession { - public void setId(String id); + void setId(String id); - public String getId(); + String getId(); - public void setUser(User user); + void setUser(User user); - public User getUser(); + User getUser(); - public void setRefreshToken(String refreshToken); + void setRefreshToken(String refreshToken); - public String getRefreshToken(); + String getRefreshToken(); void setExpirationInterval(long expirationInterval); @@ -59,8 +59,8 @@ public interface UserSession { * * @return true if it is expired */ - public boolean isExpired(); + boolean isExpired(); /** Update expirationDate adding expiration time (in seconds) */ - public void refresh(); + void refresh(); } diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/UserSessionImpl.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/UserSessionImpl.java index 0aeb38f7..aea453b9 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/UserSessionImpl.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/UserSessionImpl.java @@ -43,7 +43,7 @@ public class UserSessionImpl implements UserSession { private Calendar expiration; - private long expirationInterval = 0l; + private long expirationInterval = 0L; private String refreshToken; diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/AttributeFilter.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/AttributeFilter.java index f87be554..51b2afd2 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/AttributeFilter.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/AttributeFilter.java @@ -112,15 +112,18 @@ public void accept(FilterVisitor visitor) throws BadRequestServiceEx, InternalEr */ @Override public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(getClass().getSimpleName()).append('['); - builder.append('<').append(type != null ? type : "!type!").append('>'); - builder.append(name != null ? name : "!name!"); - builder.append(' '); - builder.append(operator != null ? operator : "!op!"); - builder.append(' '); - builder.append(value != null ? value : "!value!"); - builder.append(']'); - return builder.toString(); + String builder = + getClass().getSimpleName() + + '[' + + '<' + + (type != null ? type : "!type!") + + '>' + + (name != null ? name : "!name!") + + ' ' + + (operator != null ? operator : "!op!") + + ' ' + + (value != null ? value : "!value!") + + ']'; + return builder; } } diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/BaseField.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/BaseField.java index 5b8717f8..70771986 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/BaseField.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/BaseField.java @@ -36,15 +36,14 @@ public enum BaseField { NAME("name", String.class), DESCRIPTION("description", String.class), METADATA("metadata", String.class); - ; - private String fieldName; + private final String fieldName; @SuppressWarnings("rawtypes") - private Class type; + private final Class type; @SuppressWarnings("rawtypes") - private BaseField(String name, Class type) { + BaseField(String name, Class type) { this.fieldName = name; this.type = type; } diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/CategoryFilter.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/CategoryFilter.java index 4adbeecd..45f88574 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/CategoryFilter.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/CategoryFilter.java @@ -86,12 +86,13 @@ public void accept(FilterVisitor visitor) throws BadRequestServiceEx, InternalEr */ @Override public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(getClass().getSimpleName()).append('['); - builder.append(operator != null ? operator : "!op!"); - builder.append(' '); - builder.append(name != null ? name : "!name!"); - builder.append(']'); - return builder.toString(); + String builder = + getClass().getSimpleName() + + '[' + + (operator != null ? operator : "!op!") + + ' ' + + (name != null ? name : "!name!") + + ']'; + return builder; } } diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/FieldFilter.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/FieldFilter.java index 4fdee367..aa039ce6 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/FieldFilter.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/FieldFilter.java @@ -80,14 +80,15 @@ public void accept(FilterVisitor visitor) throws InternalErrorServiceEx { @Override public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(getClass().getSimpleName()).append('['); - builder.append(field != null ? field : "!field!"); - builder.append(' '); - builder.append(operator != null ? operator : "!op!"); - builder.append(' '); - builder.append(value != null ? value : "!value!"); - builder.append(']'); - return builder.toString(); + String builder = + getClass().getSimpleName() + + '[' + + (field != null ? field : "!field!") + + ' ' + + (operator != null ? operator : "!op!") + + ' ' + + (value != null ? value : "!value!") + + ']'; + return builder; } } diff --git a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/SearchOperator.java b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/SearchOperator.java index acdf0733..455b9dfe 100644 --- a/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/SearchOperator.java +++ b/src/core/services-api/src/main/java/it/geosolutions/geostore/services/dto/search/SearchOperator.java @@ -40,5 +40,5 @@ public enum SearchOperator { ILIKE, IS_NULL, - IS_NOT_NULL; + IS_NOT_NULL } diff --git a/src/core/services-api/src/test/java/it/geosolutions/geostore/services/dto/search/SearchFilterTest.java b/src/core/services-api/src/test/java/it/geosolutions/geostore/services/dto/search/SearchFilterTest.java index 4ef88101..89dca7e7 100644 --- a/src/core/services-api/src/test/java/it/geosolutions/geostore/services/dto/search/SearchFilterTest.java +++ b/src/core/services-api/src/test/java/it/geosolutions/geostore/services/dto/search/SearchFilterTest.java @@ -83,7 +83,7 @@ private void marshallUnmarshallSearch(SearchFilter sf) throws JAXBException { StringWriter sw = new StringWriter(); JAXB.marshal(sf, sw); - if (LOGGER.isDebugEnabled()) LOGGER.debug("Marshalled into: " + sw.toString()); + if (LOGGER.isDebugEnabled()) LOGGER.debug("Marshalled into: " + sw); StringReader sr = new StringReader(sw.getBuffer().toString()); diff --git a/src/core/services-impl/src/main/java/it/geosolutions/geostore/services/InMemoryUserSessionServiceImpl.java b/src/core/services-impl/src/main/java/it/geosolutions/geostore/services/InMemoryUserSessionServiceImpl.java index 7ada2227..984c75f2 100644 --- a/src/core/services-impl/src/main/java/it/geosolutions/geostore/services/InMemoryUserSessionServiceImpl.java +++ b/src/core/services-impl/src/main/java/it/geosolutions/geostore/services/InMemoryUserSessionServiceImpl.java @@ -44,12 +44,12 @@ */ public class InMemoryUserSessionServiceImpl implements UserSessionService { - private Map sessions = new ConcurrentHashMap(); + private final Map sessions = new ConcurrentHashMap(); private int cleanUpSeconds = 60; private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); - private Runnable evictionTask = + private final Runnable evictionTask = new Runnable() { @Override public void run() { diff --git a/src/core/services-impl/src/main/java/it/geosolutions/geostore/util/CategorizedCircularBuffer.java b/src/core/services-impl/src/main/java/it/geosolutions/geostore/util/CategorizedCircularBuffer.java index ccab0929..3db945d7 100644 --- a/src/core/services-impl/src/main/java/it/geosolutions/geostore/util/CategorizedCircularBuffer.java +++ b/src/core/services-impl/src/main/java/it/geosolutions/geostore/util/CategorizedCircularBuffer.java @@ -34,7 +34,7 @@ public class CategorizedCircularBuffer { LinkedList> mainList; - private Map> typedLists = new HashMap>(); + private final Map> typedLists = new HashMap>(); public CategorizedCircularBuffer(int maxCount) { if (maxCount < 1) { diff --git a/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/ServiceTestBase.java b/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/ServiceTestBase.java index b6391e06..661a4b72 100644 --- a/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/ServiceTestBase.java +++ b/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/ServiceTestBase.java @@ -405,7 +405,7 @@ protected User buildFakeAdminUser() { // SecurityRuleBuilder class protected class SecurityRuleBuilder { - private SecurityRule rule; + private final SecurityRule rule; public SecurityRuleBuilder() { rule = new SecurityRule(); diff --git a/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/UserGroupServiceImplTest.java b/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/UserGroupServiceImplTest.java index 273a15ee..90f22dba 100644 --- a/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/UserGroupServiceImplTest.java +++ b/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/UserGroupServiceImplTest.java @@ -152,8 +152,8 @@ public void testChangeGroupPermissionsOnResources() listsr = userGroupService.updateSecurityRules(ug1.getId(), listR, false, false); assertEquals(1, listsr.size()); - assertTrue("Expected FALSE", !listsr.get(0).isCanDelete()); - assertTrue("Expected FALSE", !listsr.get(0).isCanEdit()); + assertFalse("Expected FALSE", listsr.get(0).isCanDelete()); + assertFalse("Expected FALSE", listsr.get(0).isCanEdit()); } /** @@ -284,10 +284,10 @@ public void testgetByAttributes() throws BadRequestServiceEx { groupAttribute.setName("organization"); groupAttribute.setValue("value"); Collection groups = - userGroupService.findByAttribute("organization", Arrays.asList("value"), true); + userGroupService.findByAttribute("organization", List.of("value"), true); assertEquals(2, groups.size()); - groups = userGroupService.findByAttribute("organization", Arrays.asList("value"), false); + groups = userGroupService.findByAttribute("organization", List.of("value"), false); assertEquals(1, groups.size()); } } diff --git a/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/UserServiceImplTest.java b/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/UserServiceImplTest.java index 47e48253..fb9083d5 100644 --- a/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/UserServiceImplTest.java +++ b/src/core/services-impl/src/test/java/it/geosolutions/geostore/services/UserServiceImplTest.java @@ -24,8 +24,8 @@ import it.geosolutions.geostore.core.model.UserGroup; import it.geosolutions.geostore.core.model.enums.Role; import it.geosolutions.geostore.core.security.password.PwEncoder; -import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.UUID; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -106,7 +106,7 @@ public void testGetByAttribute() throws Exception { String token = UUID.randomUUID().toString(); attribute.setName("UUID"); attribute.setValue(token); - createUser("test", Role.USER, "tesPW", Arrays.asList(attribute)); + createUser("test", Role.USER, "tesPW", List.of(attribute)); assertEquals(1, userService.getByAttribute(attribute).size()); } diff --git a/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/RESTSessionService.java b/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/RESTSessionService.java index b0b9985c..4763d378 100644 --- a/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/RESTSessionService.java +++ b/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/RESTSessionService.java @@ -73,7 +73,7 @@ User getUser( @Path("/username/{sessionId}") @Produces({MediaType.TEXT_PLAIN}) @Secured({"ROLE_ADMIN", "ROLE_USER", "ROLE_ANONYMOUS"}) - public String getUserName( + String getUserName( @PathParam("sessionId") String sessionId, @DefaultValue("true") @QueryParam("refresh") boolean refresh); @@ -87,7 +87,7 @@ public String getUserName( @Path("/") @Produces({MediaType.TEXT_PLAIN}) @Secured({"ROLE_ADMIN", "ROLE_USER"}) - public String createSession( + String createSession( @DefaultValue("") @QueryParam("expires") String expires, @Context SecurityContext sc) throws ParseException; @@ -101,7 +101,7 @@ public String createSession( @Path("/login") @Produces({MediaType.APPLICATION_JSON}) @Secured({"ROLE_ADMIN", "ROLE_USER"}) - public SessionToken login(@Context SecurityContext sc) throws ParseException; + SessionToken login(@Context SecurityContext sc) throws ParseException; /** * Refresh the session token @@ -116,7 +116,7 @@ public String createSession( @Produces({MediaType.APPLICATION_JSON}) @Secured({"ROLE_ADMIN", "ROLE_USER"}) @Deprecated - public SessionToken refresh( + SessionToken refresh( @Context SecurityContext sc, @PathParam("sessionId") String sessionId, @PathParam("refreshToken") String refreshToken) @@ -130,14 +130,14 @@ public SessionToken refresh( @Path("/{sessionId}") @Secured({"ROLE_ADMIN", "ROLE_USER"}) @Deprecated - public void removeSession(@PathParam("sessionId") String sessionId); + void removeSession(@PathParam("sessionId") String sessionId); @POST @Path("/refreshToken") @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Secured({"ROLE_ADMIN", "ROLE_USER", "ROLE_ANONYMOUS"}) - public SessionToken refresh(SessionToken token) throws ParseException; + SessionToken refresh(SessionToken token) throws ParseException; /** * Removes the given session. * @@ -146,7 +146,7 @@ public SessionToken refresh( @DELETE @Path("/logout") @Secured({"ROLE_ADMIN", "ROLE_USER"}) - public void removeSession(); + void removeSession(); /** * Removes all sessions. @@ -156,7 +156,7 @@ public SessionToken refresh( @DELETE @Path("/") @Secured({"ROLE_ADMIN"}) - public void clear(); + void clear(); void registerDelegate(String key, SessionServiceDelegate delegate); } diff --git a/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/exception/GeoStoreWebEx.java b/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/exception/GeoStoreWebEx.java index fdb8b200..44ecc567 100644 --- a/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/exception/GeoStoreWebEx.java +++ b/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/exception/GeoStoreWebEx.java @@ -26,7 +26,7 @@ /** @author ETj (etj at geo-solutions.it) */ public abstract class GeoStoreWebEx extends WebApplicationException { - private String message; + private final String message; protected GeoStoreWebEx(Status status, String message) { super(Response.status(status).type("text/plain").entity(message).build()); diff --git a/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/utils/GeoStoreJAXBContext.java b/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/utils/GeoStoreJAXBContext.java index 2b928e01..60ca0ca8 100644 --- a/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/utils/GeoStoreJAXBContext.java +++ b/src/modules/rest/api/src/main/java/it/geosolutions/geostore/services/rest/utils/GeoStoreJAXBContext.java @@ -24,6 +24,7 @@ import java.io.Serializable; import java.net.URL; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; @@ -180,7 +181,7 @@ private static List getClasses(String packageName) if (LOGGER.isDebugEnabled()) LOGGER.debug(" adding resource " + fileName); - String fileNameDecoded = URLDecoder.decode(fileName, "UTF-8"); + String fileNameDecoded = URLDecoder.decode(fileName, StandardCharsets.UTF_8); dirs.add(new File(fileNameDecoded)); } ArrayList classes = new ArrayList(); diff --git a/src/modules/rest/auditing/src/main/java/it/geosolutions/geostore/services/rest/auditing/AuditingConfiguration.java b/src/modules/rest/auditing/src/main/java/it/geosolutions/geostore/services/rest/auditing/AuditingConfiguration.java index 6edd01ea..4dd54462 100644 --- a/src/modules/rest/auditing/src/main/java/it/geosolutions/geostore/services/rest/auditing/AuditingConfiguration.java +++ b/src/modules/rest/auditing/src/main/java/it/geosolutions/geostore/services/rest/auditing/AuditingConfiguration.java @@ -58,7 +58,7 @@ final class AuditingConfiguration { private final String outputFilesExtension; AuditingConfiguration() { - this(null, 0l); + this(null, 0L); } AuditingConfiguration(File configurationFile, long configurationFileChecksum) { diff --git a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditInfoExtractorTest.java b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditInfoExtractorTest.java index ed76d76b..1d54d271 100644 --- a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditInfoExtractorTest.java +++ b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditInfoExtractorTest.java @@ -126,7 +126,7 @@ public void testSuccessExecution() { Mockito.when(exchange.getInMessage()).thenReturn(inMessage); Message outSuccessMessage = getOutSuccessMessage(); Mockito.when(exchange.getOutMessage()).thenReturn(outSuccessMessage); - Mockito.when(exchange.get(AuditInfo.START_TIME.getKey())).thenReturn(1000l); + Mockito.when(exchange.get(AuditInfo.START_TIME.getKey())).thenReturn(1000L); Map auditInfo = AuditInfoExtractor.extract(message); assertEquals(auditInfo.size(), 18); assertEquals(auditInfo.get(AuditInfo.HOST.getKey()), "localhost"); @@ -164,7 +164,7 @@ public void testFaultExecution() { Mockito.when(exchange.getInMessage()).thenReturn(inMessage); Message outFaultMessage = getOutFaultMessage(); Mockito.when(exchange.getOutFaultMessage()).thenReturn(outFaultMessage); - Mockito.when(exchange.get(AuditInfo.START_TIME.getKey())).thenReturn(1000l); + Mockito.when(exchange.get(AuditInfo.START_TIME.getKey())).thenReturn(1000L); Map auditInfo = AuditInfoExtractor.extract(message); assertEquals(auditInfo.size(), 20); assertEquals(auditInfo.get(AuditInfo.HOST.getKey()), "localhost"); diff --git a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingConfigurationTest.java b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingConfigurationTest.java index cb7e203f..41fd64ae 100644 --- a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingConfigurationTest.java +++ b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingConfigurationTest.java @@ -27,8 +27,7 @@ */ package it.geosolutions.geostore.services.rest.auditing; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; import java.util.Map; import org.junit.Test; @@ -38,7 +37,7 @@ public final class AuditingConfigurationTest extends AuditingTestsBase { @Test public void testSimpleConfiguration() { AuditingConfiguration auditingConfiguration = new AuditingConfiguration(); - assertEquals(auditingConfiguration.isAuditEnable(), true); + assertTrue(auditingConfiguration.isAuditEnable()); assertEquals(auditingConfiguration.getMaxRequestPerFile(), 3); assertEquals(auditingConfiguration.getTemplatesVersion(), 1); assertEquals( @@ -52,7 +51,7 @@ public void testSimpleConfiguration() { @Test public void testUpdateConfiguration() { AuditingConfiguration auditingConfiguration = new AuditingConfiguration(); - assertEquals(auditingConfiguration.isAuditEnable(), true); + assertTrue(auditingConfiguration.isAuditEnable()); Map properties = AuditingTestsUtils.getDefaultProperties(OUTPUT_DIRECTORY, TEMPLATES_DIRECTORY); properties.put(AuditingConfiguration.AUDIT_ENABLE, "false"); diff --git a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingOutputTest.java b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingOutputTest.java index c361ae20..10f4c67e 100644 --- a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingOutputTest.java +++ b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingOutputTest.java @@ -39,7 +39,7 @@ public final class AuditingOutputTest extends AuditingTestsBase { @Test public void testAuditOutput() throws InterruptedException { AuditingOutput auditingOutput = new AuditingOutput(); - Assert.assertEquals(auditingOutput.isAuditEnable(), true); + Assert.assertTrue(auditingOutput.isAuditEnable()); Map message1 = createTestMessage("1"); Map message2 = createTestMessage("2"); Map message3 = createTestMessage("3"); diff --git a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingTestsBase.java b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingTestsBase.java index 6bdd1b78..cff3c1ca 100644 --- a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingTestsBase.java +++ b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingTestsBase.java @@ -40,9 +40,7 @@ public abstract class AuditingTestsBase { protected final File TESTS_ROOT_DIRECTORY = - new File( - System.getProperty("java.io.tmpdir"), - "auditing-tests-" + UUID.randomUUID().toString()); + new File(System.getProperty("java.io.tmpdir"), "auditing-tests-" + UUID.randomUUID()); protected final File OUTPUT_DIRECTORY = new File(TESTS_ROOT_DIRECTORY, "output"); protected final File TEMPLATES_DIRECTORY = getTemplatesDirectory(); protected final File CONFIGURATION_DIRECTORY = new File(TESTS_ROOT_DIRECTORY, "configuration"); diff --git a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingTestsUtils.java b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingTestsUtils.java index 2f96b3a9..4a596855 100644 --- a/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingTestsUtils.java +++ b/src/modules/rest/auditing/src/test/java/it/geosolutions/geostore/services/rest/auditing/AuditingTestsUtils.java @@ -40,7 +40,7 @@ final class AuditingTestsUtils { static File randomDirectory(File original) { - return new File(original.getPath() + "-" + UUID.randomUUID().toString()); + return new File(original.getPath() + "-" + UUID.randomUUID()); } static void createDefaultConfiguration( diff --git a/src/modules/rest/client/src/test/java/it/geosolutions/geostore/services/rest/AdministratorGeostoreClientTest.java b/src/modules/rest/client/src/test/java/it/geosolutions/geostore/services/rest/AdministratorGeostoreClientTest.java index 8020c80b..494d8c29 100644 --- a/src/modules/rest/client/src/test/java/it/geosolutions/geostore/services/rest/AdministratorGeostoreClientTest.java +++ b/src/modules/rest/client/src/test/java/it/geosolutions/geostore/services/rest/AdministratorGeostoreClientTest.java @@ -20,11 +20,7 @@ package it.geosolutions.geostore.services.rest; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import static org.junit.Assume.assumeTrue; import com.sun.jersey.api.client.UniformInterfaceException; @@ -316,7 +312,7 @@ public void insertGetDeleteAssign_UserGroupTest() { assertEquals("usergroupTest1", ug1.getGroupName()); List userAssigned = ug1.getRestUsers().getList(); - assertEquals(null, userAssigned); + assertNull(userAssigned); geoStoreClient.assignUserGroup(uid1, ug1.getId()); geoStoreClient.assignUserGroup(uid2, ug1.getId()); @@ -628,7 +624,7 @@ public void ListResourcesTest() { // Add group permissions to resources long errorCode = -1; try { - geoStoreClient.updateSecurityRules(new ShortResourceList(listG1), 787687l, true, true); + geoStoreClient.updateSecurityRules(new ShortResourceList(listG1), 787687L, true, true); } catch (UniformInterfaceException e) { errorCode = e.getResponse().getStatus(); } @@ -645,8 +641,8 @@ public void ListResourcesTest() { assertTrue(r.isCanDelete()); assertTrue(r.isCanEdit()); } else { - assertTrue(!r.isCanDelete()); - assertTrue(!r.isCanEdit()); + assertFalse(r.isCanDelete()); + assertFalse(r.isCanEdit()); } } @@ -785,7 +781,7 @@ public void searchGroupTest() { ExtGroupList searchResult = geoStoreClient.searchUserGroup(0, 10, "*" + targetGrpPrefix + "*"); - assertTrue(searchResult.getList().size() == targetGrpNum); + assertEquals(searchResult.getList().size(), targetGrpNum); } @Test @@ -836,13 +832,13 @@ public void allGroupsOfAnUserTest() { public void userGroupsPaginationTest() { int totalGrps = 10; int pageSize = 3; - int expectedItems[] = {3, 3, 3, 1}; + int[] expectedItems = {3, 3, 3, 1}; ExtGroupList result; addSomeUserGroups(totalGrps, "paging"); for (int page = 0; page < expectedItems.length; page++) { result = geoStoreClient.searchUserGroup(page * pageSize, pageSize, "*"); - assertTrue(expectedItems[page] == result.getList().size()); + assertEquals(expectedItems[page], result.getList().size()); } } diff --git a/src/modules/rest/client/src/test/java/it/geosolutions/geostore/services/rest/GeoStoreClientTest.java b/src/modules/rest/client/src/test/java/it/geosolutions/geostore/services/rest/GeoStoreClientTest.java index 830aada9..066cab09 100644 --- a/src/modules/rest/client/src/test/java/it/geosolutions/geostore/services/rest/GeoStoreClientTest.java +++ b/src/modules/rest/client/src/test/java/it/geosolutions/geostore/services/rest/GeoStoreClientTest.java @@ -236,7 +236,7 @@ public void testUpdateResource() { System.out.println("RESOURCE has ID " + rid); // test getResource - String name1 = "rest_test_resource_" + Long.toString(System.currentTimeMillis()); + String name1 = "rest_test_resource_" + System.currentTimeMillis(); { RESTResource updResource = new RESTResource(); updResource.setName(name1); diff --git a/src/web/app/src/main/java/it/geosolutions/geostore/init/LDAPInit.java b/src/web/app/src/main/java/it/geosolutions/geostore/init/LDAPInit.java index 8acd2b17..ee48b302 100644 --- a/src/web/app/src/main/java/it/geosolutions/geostore/init/LDAPInit.java +++ b/src/web/app/src/main/java/it/geosolutions/geostore/init/LDAPInit.java @@ -23,7 +23,7 @@ import org.springframework.beans.factory.InitializingBean; public class LDAPInit implements InitializingBean { - private UserLdapAuthenticationProvider authenticationProvider; + private final UserLdapAuthenticationProvider authenticationProvider; public LDAPInit(UserLdapAuthenticationProvider authenticationProvider) { super();