mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 12:33:18 +00:00
Fix new ErrorProne errors from new EP version, and a few ancient warnings.
This commit is contained in:
@@ -503,6 +503,7 @@ public class LDAPAuthentication
|
|||||||
} else {
|
} else {
|
||||||
searchName = ldap_provider_url + ldap_search_context;
|
searchName = ldap_provider_url + ldap_search_context;
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings("BanJNDI")
|
||||||
NamingEnumeration<SearchResult> answer = ctx.search(
|
NamingEnumeration<SearchResult> answer = ctx.search(
|
||||||
searchName,
|
searchName,
|
||||||
"(&({0}={1}))", new Object[] {ldap_id_field,
|
"(&({0}={1}))", new Object[] {ldap_id_field,
|
||||||
@@ -553,7 +554,7 @@ public class LDAPAuthentication
|
|||||||
att = atts.get(attlist[4]);
|
att = atts.get(attlist[4]);
|
||||||
if (att != null) {
|
if (att != null) {
|
||||||
// loop through all groups returned by LDAP
|
// loop through all groups returned by LDAP
|
||||||
ldapGroup = new ArrayList<String>();
|
ldapGroup = new ArrayList<>();
|
||||||
for (NamingEnumeration val = att.getAll(); val.hasMoreElements(); ) {
|
for (NamingEnumeration val = att.getAll(); val.hasMoreElements(); ) {
|
||||||
ldapGroup.add((String) val.next());
|
ldapGroup.add((String) val.next());
|
||||||
}
|
}
|
||||||
@@ -633,7 +634,8 @@ public class LDAPAuthentication
|
|||||||
ctx.addToEnvironment(javax.naming.Context.AUTHORITATIVE, "true");
|
ctx.addToEnvironment(javax.naming.Context.AUTHORITATIVE, "true");
|
||||||
ctx.addToEnvironment(javax.naming.Context.REFERRAL, "follow");
|
ctx.addToEnvironment(javax.naming.Context.REFERRAL, "follow");
|
||||||
// dummy operation to check if authentication has succeeded
|
// dummy operation to check if authentication has succeeded
|
||||||
ctx.getAttributes("");
|
@SuppressWarnings("BanJNDI")
|
||||||
|
Attributes trash = ctx.getAttributes("");
|
||||||
} else if (!useTLS) {
|
} else if (!useTLS) {
|
||||||
// Authenticate
|
// Authenticate
|
||||||
env.put(javax.naming.Context.SECURITY_AUTHENTICATION, "Simple");
|
env.put(javax.naming.Context.SECURITY_AUTHENTICATION, "Simple");
|
||||||
|
@@ -165,7 +165,7 @@ public class Curation extends DSpaceRunnable<CurationScriptConfiguration> {
|
|||||||
* End of curation script; logs script time if -v verbose is set
|
* End of curation script; logs script time if -v verbose is set
|
||||||
*
|
*
|
||||||
* @param timeRun Time script was started
|
* @param timeRun Time script was started
|
||||||
* @throws SQLException If DSpace contextx can't complete
|
* @throws SQLException If DSpace context can't complete
|
||||||
*/
|
*/
|
||||||
private void endScript(long timeRun) throws SQLException {
|
private void endScript(long timeRun) throws SQLException {
|
||||||
context.complete();
|
context.complete();
|
||||||
@@ -300,9 +300,17 @@ public class Curation extends DSpaceRunnable<CurationScriptConfiguration> {
|
|||||||
// scope
|
// scope
|
||||||
if (this.commandLine.getOptionValue('s') != null) {
|
if (this.commandLine.getOptionValue('s') != null) {
|
||||||
this.scope = this.commandLine.getOptionValue('s');
|
this.scope = this.commandLine.getOptionValue('s');
|
||||||
if (this.scope != null && Curator.TxScope.valueOf(this.scope.toUpperCase()) == null) {
|
boolean knownScope;
|
||||||
this.handler.logError("Bad transaction scope '" + this.scope + "': only 'object', 'curation' or " +
|
try {
|
||||||
"'open' recognized");
|
Curator.TxScope.valueOf(this.scope.toUpperCase());
|
||||||
|
knownScope = true;
|
||||||
|
} catch (IllegalArgumentException | NullPointerException e) {
|
||||||
|
knownScope = false;
|
||||||
|
}
|
||||||
|
if (!knownScope) {
|
||||||
|
this.handler.logError("Bad transaction scope '"
|
||||||
|
+ this.scope
|
||||||
|
+ "': only 'object', 'curation' or 'open' recognized");
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Bad transaction scope '" + this.scope + "': only 'object', 'curation' or " +
|
"Bad transaction scope '" + this.scope + "': only 'object', 'curation' or " +
|
||||||
"'open' recognized");
|
"'open' recognized");
|
||||||
|
@@ -50,17 +50,12 @@ public abstract class DSpaceRestRepository<T extends RestAddressableModel, ID ex
|
|||||||
extends AbstractDSpaceRestRepository
|
extends AbstractDSpaceRestRepository
|
||||||
implements CrudRepository<T, ID>, PagingAndSortingRepository<T, ID>, BeanNameAware {
|
implements CrudRepository<T, ID>, PagingAndSortingRepository<T, ID>, BeanNameAware {
|
||||||
|
|
||||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(DSpaceRestRepository.class);
|
|
||||||
|
|
||||||
private String thisRepositoryBeanName;
|
private String thisRepositoryBeanName;
|
||||||
private DSpaceRestRepository<T, ID> thisRepository;
|
private DSpaceRestRepository<T, ID> thisRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MetadataFieldService metadataFieldService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From BeanNameAware. Allows us to capture the name of the bean, so we can load it into thisRepository.
|
* From BeanNameAware. Allows us to capture the name of the bean, so we can load it into thisRepository.
|
||||||
* See getThisRepository() method.
|
* See getThisRepository() method.
|
||||||
|
@@ -81,6 +81,7 @@ public class DSpaceKernelInitializer implements ApplicationContextInitializer<Co
|
|||||||
* Initially look for JNDI Resource called "java:/comp/env/dspace.dir".
|
* Initially look for JNDI Resource called "java:/comp/env/dspace.dir".
|
||||||
* If not found, use value provided in "dspace.dir" in Spring Environment
|
* If not found, use value provided in "dspace.dir" in Spring Environment
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("BanJNDI")
|
||||||
private String getDSpaceHome(ConfigurableEnvironment environment) {
|
private String getDSpaceHome(ConfigurableEnvironment environment) {
|
||||||
// Load the "dspace.dir" property from Spring Boot's Configuration (application.properties)
|
// Load the "dspace.dir" property from Spring Boot's Configuration (application.properties)
|
||||||
// This gives us the location of our DSpace configurations, necessary to start the kernel
|
// This gives us the location of our DSpace configurations, necessary to start the kernel
|
||||||
|
@@ -62,6 +62,7 @@ public class EmailServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
|
@SuppressWarnings("BanJNDI")
|
||||||
public void init() {
|
public void init() {
|
||||||
// See if there is already a Session in our environment
|
// See if there is already a Session in our environment
|
||||||
String sessionName = cfg.getProperty("mail.session.name");
|
String sessionName = cfg.getProperty("mail.session.name");
|
||||||
|
@@ -39,8 +39,8 @@ public class ServerApplication extends SpringBootServletInitializer {
|
|||||||
* <p>
|
* <p>
|
||||||
* See: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
|
* See: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
|
||||||
*
|
*
|
||||||
* @param application
|
* @param application some builder.
|
||||||
* @return
|
* @return the builder, configured with DSpace sources and initializers.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
2
pom.xml
2
pom.xml
@@ -29,7 +29,7 @@
|
|||||||
<solr.client.version>8.11.3</solr.client.version>
|
<solr.client.version>8.11.3</solr.client.version>
|
||||||
|
|
||||||
<ehcache.version>3.10.8</ehcache.version>
|
<ehcache.version>3.10.8</ehcache.version>
|
||||||
<errorprone.version>2.10.0</errorprone.version>
|
<errorprone.version>2.32.0</errorprone.version>
|
||||||
<!-- NOTE: when updating jackson.version, also sync jackson-databind.version below -->
|
<!-- NOTE: when updating jackson.version, also sync jackson-databind.version below -->
|
||||||
<jackson.version>2.16.0</jackson.version>
|
<jackson.version>2.16.0</jackson.version>
|
||||||
<jackson-databind.version>2.16.0</jackson-databind.version>
|
<jackson-databind.version>2.16.0</jackson-databind.version>
|
||||||
|
Reference in New Issue
Block a user