Remove thread sleeps when trying to load config files and removed principal from Exception Handling Controller
This commit is contained in:
parent
93320f7c94
commit
5f131b9823
|
@ -1,9 +1,11 @@
|
||||||
package eu.eudat.controllers.controllerhandler;
|
package eu.eudat.controllers.controllerhandler;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.models.data.security.Principal;
|
import eu.eudat.models.data.security.Principal;
|
||||||
import eu.eudat.types.ApiMessageCode;
|
import eu.eudat.types.ApiMessageCode;
|
||||||
|
import eu.eudat.types.Authorities;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
@ -25,7 +27,7 @@ public class ControllerErrorHandler {
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseItem<Exception> processValidationError(Principal principal, Exception ex) throws Exception {
|
public ResponseItem<Exception> processValidationError( Exception ex) throws Exception {
|
||||||
logger.error(ex.getMessage(), ex);
|
logger.error(ex.getMessage(), ex);
|
||||||
return new ResponseItem<Exception>().message(ex.getMessage()).status(ApiMessageCode.DEFAULT_ERROR_MESSAGE);
|
return new ResponseItem<Exception>().message(ex.getMessage()).status(ApiMessageCode.DEFAULT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,14 +169,6 @@ public class DefaultConfigLoader implements ConfigLoader {
|
||||||
if (externalUrls == null) {
|
if (externalUrls == null) {
|
||||||
externalUrls = new ExternalUrls();
|
externalUrls = new ExternalUrls();
|
||||||
this.setExternalUrls();
|
this.setExternalUrls();
|
||||||
} else {
|
|
||||||
while (externalUrls.getMaxresults() == null) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(100L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return externalUrls;
|
return externalUrls;
|
||||||
}
|
}
|
||||||
|
@ -185,14 +177,6 @@ public class DefaultConfigLoader implements ConfigLoader {
|
||||||
if (rdaProperties == null) {
|
if (rdaProperties == null) {
|
||||||
rdaProperties = new ArrayList<>();
|
rdaProperties = new ArrayList<>();
|
||||||
this.setRdaProperties();
|
this.setRdaProperties();
|
||||||
} else {
|
|
||||||
while (rdaProperties.size() == 0) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(100L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return rdaProperties;
|
return rdaProperties;
|
||||||
}
|
}
|
||||||
|
@ -211,14 +195,6 @@ public class DefaultConfigLoader implements ConfigLoader {
|
||||||
if (configurableProviders == null) {
|
if (configurableProviders == null) {
|
||||||
configurableProviders = new ConfigurableProviders();
|
configurableProviders = new ConfigurableProviders();
|
||||||
this.setConfigurableProviders();
|
this.setConfigurableProviders();
|
||||||
} else {
|
|
||||||
while (configurableProviders.getProviders().size() == 0) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(100L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return configurableProviders;
|
return configurableProviders;
|
||||||
}
|
}
|
||||||
|
@ -227,14 +203,6 @@ public class DefaultConfigLoader implements ConfigLoader {
|
||||||
if (keyToSourceMap == null) {
|
if (keyToSourceMap == null) {
|
||||||
keyToSourceMap = new HashMap<>();
|
keyToSourceMap = new HashMap<>();
|
||||||
this.setKeyToSourceMap();
|
this.setKeyToSourceMap();
|
||||||
} else {
|
|
||||||
while (keyToSourceMap.size() == 0) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(100L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
logger.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return keyToSourceMap;
|
return keyToSourceMap;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue