diff --git a/src/main/java/org/hbp/mip/MIPApplication.java b/src/main/java/org/hbp/mip/MIPApplication.java index 1b1b9fc648c1dd102927b80fc9779a733c2fb3e4..1046f886b703e5e67e036f20a2a02d3685d5ccec 100644 --- a/src/main/java/org/hbp/mip/MIPApplication.java +++ b/src/main/java/org/hbp/mip/MIPApplication.java @@ -93,7 +93,7 @@ import java.security.Principal; @Api(value = "/", description = "MIP API") public class MIPApplication extends WebSecurityConfigurerAdapter { - private Logger logger = Logger.getLogger(this.getClass()); + private static final Logger LOGGER = Logger.getLogger(MIPApplication.class); @Autowired OAuth2ClientContext oauth2ClientContext; @@ -184,9 +184,9 @@ public class MIPApplication extends WebSecurityConfigurerAdapter { cookie.setPath("/"); response.addCookie(cookie); } catch (JsonProcessingException e) { - logger.trace(e); + LOGGER.trace(e); } catch (UnsupportedEncodingException e) { - logger.trace(e); + LOGGER.trace(e); } return principal; } diff --git a/src/main/java/org/hbp/mip/controllers/AppsApi.java b/src/main/java/org/hbp/mip/controllers/AppsApi.java index 705fc0736e7d4ecdf2d6c73218d21d310508c558..b89ef31b4836ba1e52966ae8a002e341bdb13546 100644 --- a/src/main/java/org/hbp/mip/controllers/AppsApi.java +++ b/src/main/java/org/hbp/mip/controllers/AppsApi.java @@ -33,7 +33,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; @Api(value = "/apps", description = "the apps API") public class AppsApi { - private Logger logger = Logger.getLogger(this.getClass()); + private static final Logger LOGGER = Logger.getLogger(AppsApi.class); @Autowired MIPApplication mipApplication; @@ -109,7 +109,7 @@ public class AppsApi { } catch (ConstraintViolationException cve) { - logger.trace(cve); + LOGGER.trace(cve); if(session.getTransaction() != null) { session.getTransaction().rollback(); @@ -118,7 +118,7 @@ public class AppsApi { } catch (NonUniqueObjectException nuoe) { - logger.trace(nuoe); + LOGGER.trace(nuoe); if(session.getTransaction() != null) { session.getTransaction().rollback(); diff --git a/src/main/java/org/hbp/mip/controllers/ArticlesApi.java b/src/main/java/org/hbp/mip/controllers/ArticlesApi.java index 3fb3febd15833459e7fb9b54055aed423cf8f88b..9abe54e053cba89e029fd410c53f23979e62cbbb 100644 --- a/src/main/java/org/hbp/mip/controllers/ArticlesApi.java +++ b/src/main/java/org/hbp/mip/controllers/ArticlesApi.java @@ -32,7 +32,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; @Api(value = "/articles", description = "the articles API") public class ArticlesApi { - private Logger logger = Logger.getLogger(this.getClass()); + private static final Logger LOGGER = Logger.getLogger(ArticlesApi.class); @Autowired MIPApplication mipApplication; @@ -135,7 +135,7 @@ public class ArticlesApi { try { slg = new Slugify(); } catch (IOException e) { - logger.trace(e); + LOGGER.trace(e); } String slug = slg != null ? slg.slugify(article.getTitle()) : ""; diff --git a/src/main/java/org/hbp/mip/controllers/ExperimentApi.java b/src/main/java/org/hbp/mip/controllers/ExperimentApi.java index cadf43ea34a878031348bf7b916c512887df902a..92cdd690bb54fc5c1f1f55273c565495a7e6bb7f 100644 --- a/src/main/java/org/hbp/mip/controllers/ExperimentApi.java +++ b/src/main/java/org/hbp/mip/controllers/ExperimentApi.java @@ -35,7 +35,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; @javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-07T07:38:20.227Z") public class ExperimentApi { - private Logger logger = Logger.getLogger(this.getClass()); + private static final Logger LOGGER = Logger.getLogger(ExperimentApi.class); private static final String EXAREME_ALGO_JSON_FILE="data/exareme_algorithms.json"; @@ -72,7 +72,7 @@ public class ExperimentApi { // create query try { con.setRequestMethod("POST"); - } catch (ProtocolException pe) { logger.trace(pe); } // ignore; won't happen + } catch (ProtocolException pe) { LOGGER.trace(pe); } // ignore; won't happen con.addRequestProperty("Content-Type", "application/json"); con.setRequestProperty("Content-Length", Integer.toString(query.length())); con.setFollowRedirects(true); @@ -102,8 +102,8 @@ public class ExperimentApi { } catch (IOException ioe) { // write error to - logger.trace(ioe); - logger.warn("Experiment failed to run properly !"); + LOGGER.trace(ioe); + LOGGER.warn("Experiment failed to run properly !"); experiment.setHasError(true); experiment.setHasServerError(true); experiment.setResult(ioe.getMessage()); @@ -158,8 +158,8 @@ public class ExperimentApi { { transaction.rollback(); } - logger.trace(e); - logger.warn("Cannot create experiment to run ! This is probably caused by a bad request !"); + LOGGER.trace(e); + LOGGER.warn("Cannot create experiment to run ! This is probably caused by a bad request !"); // 400 here probably return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); } @@ -173,7 +173,7 @@ public class ExperimentApi { { sendPost(experiment); } - } catch (MalformedURLException mue) { logger.trace(mue.getMessage()); } // ignore + } catch (MalformedURLException mue) { LOGGER.trace(mue.getMessage()); } // ignore return new ResponseEntity<>(gson.toJson(experiment), HttpStatus.OK); } @@ -239,8 +239,8 @@ public class ExperimentApi { experiment.setResult("Unsupported variables !"); } } catch (Exception e) { - logger.trace(e); - logger.warn("Failed to run Exareme algorithm !"); + LOGGER.trace(e); + LOGGER.warn("Failed to run Exareme algorithm !"); experiment.setHasError(true); experiment.setHasServerError(true); experiment.setResult(e.getMessage()); @@ -267,7 +267,7 @@ public class ExperimentApi { new JsonParser().parse(test); } catch (JsonParseException jpe) { - logger.trace(jpe); // This is the normal behavior when the input string is not JSON-ified + LOGGER.trace(jpe); // This is the normal behavior when the input string is not JSON-ified return false; } return true; @@ -289,8 +289,8 @@ public class ExperimentApi { try { experimentUuid = UUID.fromString(uuid); } catch (IllegalArgumentException iae) { - logger.trace(iae); - logger.warn("An invalid Experiment UUID was received !"); + LOGGER.trace(iae); + LOGGER.warn("An invalid Experiment UUID was received !"); return ResponseEntity.badRequest().body("Invalid Experiment UUID"); } @@ -329,8 +329,8 @@ public class ExperimentApi { try { experimentUuid = UUID.fromString(uuid); } catch (IllegalArgumentException iae) { - logger.trace(iae); - logger.warn("An invalid Experiment UUID was received !"); + LOGGER.trace(iae); + LOGGER.warn("An invalid Experiment UUID was received !"); return ResponseEntity.badRequest().body("Invalid Experiment UUID"); } @@ -370,8 +370,8 @@ public class ExperimentApi { try { experimentUuid = UUID.fromString(uuid); } catch (IllegalArgumentException iae) { - logger.trace(iae); - logger.warn("An invalid Experiment UUID was received !"); + LOGGER.trace(iae); + LOGGER.warn("An invalid Experiment UUID was received !"); return ResponseEntity.badRequest().body("Invalid Experiment UUID"); } diff --git a/src/main/java/org/hbp/mip/controllers/ModelsApi.java b/src/main/java/org/hbp/mip/controllers/ModelsApi.java index 4679b0857750323e85bc34aecac6c1b8221db550..e8fe94f906c831c5c781573056c195d7f2c666f6 100644 --- a/src/main/java/org/hbp/mip/controllers/ModelsApi.java +++ b/src/main/java/org/hbp/mip/controllers/ModelsApi.java @@ -29,7 +29,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; @javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-01-07T07:38:20.227Z") public class ModelsApi { - private Logger logger = Logger.getLogger(this.getClass()); + private static final Logger LOGGER = Logger.getLogger(ModelsApi.class); @Autowired MIPApplication mipApplication; @@ -169,7 +169,7 @@ public class ModelsApi { slg = new Slugify(); slug = slg.slugify(model.getTitle()); } catch (IOException e) { - logger.trace(e); + LOGGER.trace(e); } i = 0; diff --git a/src/main/java/org/hbp/mip/utils/CSVUtil.java b/src/main/java/org/hbp/mip/utils/CSVUtil.java index c001e83b3bd467d814d122299df88bdb22d35a00..94c3234e33afa34859c2142c521bed91be43bb69 100644 --- a/src/main/java/org/hbp/mip/utils/CSVUtil.java +++ b/src/main/java/org/hbp/mip/utils/CSVUtil.java @@ -20,7 +20,7 @@ import java.util.stream.Collectors; */ public class CSVUtil { - private static Logger logger = Logger.getLogger(CSVUtil.class); + private static final Logger LOGGER = Logger.getLogger(CSVUtil.class); private static final String SEPARATOR = ","; @@ -143,7 +143,7 @@ public class CSVUtil { data.put(c, ll); } } catch (IOException e) { - logger.trace(e); + LOGGER.trace(e); } result.setCode(code); result.setDate(date); @@ -170,8 +170,8 @@ public class CSVUtil { isr.close(); is.close(); } catch (IOException e) { - logger.trace(e); - logger.warn("A problem occured while trying to read a CSV file !"); + LOGGER.trace(e); + LOGGER.warn("A problem occured while trying to read a CSV file !"); } return rows;