From 399597f84d5a3112cc8ad7262a40cfcae88cf83c Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 12 Mar 2015 16:23:02 +0100 Subject: getting rid of log4j in logger class --- .../id/commons/validation/ValidationHelper.java | 53 +++++++++++----------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'id/server/moa-id-commons/src/main/java/at') diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java index be6d7d01e..13d680b78 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java @@ -44,14 +44,13 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; -import org.apache.log4j.Logger; +import at.gv.egovernment.moa.logging.Logger; public class ValidationHelper { public static final String PUBLICSERVICE_URL_POSTFIX = ".gv.at"; - private static final Logger log = Logger.getLogger(ValidationHelper.class); private static final String TEMPLATE_DATEFORMAT = "dd.MM.yyyy"; @@ -68,7 +67,7 @@ public class ValidationHelper { host = host.substring(0, host.length()-1); if (url.getHost().endsWith(PUBLICSERVICE_URL_POSTFIX)) { - log.debug("PublicURLPrefix with .gv.at Domain found."); + Logger.debug("PublicURLPrefix with .gv.at Domain found."); return true; } else { @@ -95,7 +94,7 @@ public class ValidationHelper { return false; } else { - log.info("Found correct X509 Extension in server certificate. PublicService is allowed"); + Logger.info("Found correct X509 Extension in server certificate. PublicService is allowed"); return true; } } @@ -104,27 +103,27 @@ public class ValidationHelper { } } catch (MalformedURLException e) { - log.warn("PublicURLPrefix can not parsed to URL", e); + Logger.warn("PublicURLPrefix can not parsed to URL", e); return false; } catch (UnknownHostException e) { - log.warn("Can not connect to PublicURLPrefix Server", e); + Logger.warn("Can not connect to PublicURLPrefix Server", e); return false; } catch (IOException e) { - log.warn("Can not connect to PublicURLPrefix Server", e); + Logger.warn("Can not connect to PublicURLPrefix Server", e); return false; } catch (CertificateEncodingException e) { - log.warn("Can not parse X509 server certificate", e); + Logger.warn("Can not parse X509 server certificate", e); return false; } catch (CertificateException e) { - log.warn("Can not read X509 server certificate", e); + Logger.warn("Can not read X509 server certificate", e); return false; } catch (X509ExtensionInitException e) { - log.warn("Can not read X509 server certificate extension", e); + Logger.warn("Can not read X509 server certificate extension", e); return false; } @@ -133,7 +132,7 @@ public class ValidationHelper { try { socket.close(); } catch (IOException e) { - log.warn("SSL Socket can not be closed.", e); + Logger.warn("SSL Socket can not be closed.", e); } } } @@ -148,7 +147,7 @@ public class ValidationHelper { return true; } catch (Throwable t) { - log.warn("No valid DataBase OAID received! " + oaIDObj); + Logger.warn("No valid DataBase OAID received! " + oaIDObj); } } return false; @@ -156,7 +155,7 @@ public class ValidationHelper { public static boolean validateNumber(String value) { - log.debug("Validate Number " + value); + Logger.debug("Validate Number " + value); try { Float.valueOf(value); @@ -171,7 +170,7 @@ public class ValidationHelper { } public static boolean validatePhoneNumber(String value) { - log.debug ("Validate PhoneNumber " + value); + Logger.debug ("Validate PhoneNumber " + value); /* ************************************************************************************************ * Legende: @@ -187,11 +186,11 @@ public class ValidationHelper { Matcher matcher = pattern.matcher(value); boolean b = matcher.matches(); if (b) { - log.debug("Parameter PhoneNumber erfolgreich ueberprueft"); + Logger.debug("Parameter PhoneNumber erfolgreich ueberprueft"); return true; } else { - log.error("Fehler Ueberpruefung Parameter PhoneNumber. PhoneNumber entspricht nicht den Kriterien ^ [a-zA-Z .,;:/\\-]* [ ]* [(]{0,1}[ ]*[+]{0,1}[ ]*[0-9]{0,2}[ ]*[)]{0,1} [ ]* [0-9]*[ ]*[/\\-]{0,1} [ ]*[ ]* [0-9]* [ ]* [a-zA-Z .,;:\\/-]* $"); + Logger.error("Fehler Ueberpruefung Parameter PhoneNumber. PhoneNumber entspricht nicht den Kriterien ^ [a-zA-Z .,;:/\\-]* [ ]* [(]{0,1}[ ]*[+]{0,1}[ ]*[0-9]{0,2}[ ]*[)]{0,1} [ ]* [0-9]*[ ]*[/\\-]{0,1} [ ]*[ ]* [0-9]* [ ]* [a-zA-Z .,;:\\/-]* $"); return false; } @@ -200,7 +199,7 @@ public class ValidationHelper { public static boolean validateURL(String urlString) { - log.debug("Validate URL " + urlString); + Logger.debug("Validate URL " + urlString); if (urlString.startsWith("http") || urlString.startsWith("https")) { try { @@ -216,7 +215,7 @@ public class ValidationHelper { // public static boolean validateGeneralURL(String urlString) { // -// log.debug("Validate URL " + urlString); +// Logger.debug("Validate URL " + urlString); // // try { // new URL(urlString); @@ -231,17 +230,17 @@ public class ValidationHelper { public static boolean isValidAdminTarget(String target) { - log.debug("Ueberpruefe Parameter Target"); + Logger.debug("Ueberpruefe Parameter Target"); Pattern pattern = Pattern.compile("[a-zA-Z-]{1,5}"); Matcher matcher = pattern.matcher(target); boolean b = matcher.matches(); if (b) { - log.debug("Parameter SSO-Target erfolgreich ueberprueft. SSO Target is PublicService."); + Logger.debug("Parameter SSO-Target erfolgreich ueberprueft. SSO Target is PublicService."); return true; } else { - log.info("Parameter SSO-Target entspricht nicht den Kriterien " + + Logger.info("Parameter SSO-Target entspricht nicht den Kriterien " + "(nur Zeichen a-z, A-Z und -, sowie 1-5 Zeichen lang) fuer den oeffentlichen Bereich. " + "Valiere SSO-Target fuer privatwirtschaftliche Bereiche."); return false; @@ -250,14 +249,14 @@ public class ValidationHelper { public static boolean isValidTarget(String target) { - log.debug("Ueberpruefe Parameter Target"); + Logger.debug("Ueberpruefe Parameter Target"); if (TargetValidator.isValidTarget(target)) { - log.debug("Parameter Target erfolgreich ueberprueft"); + Logger.debug("Parameter Target erfolgreich ueberprueft"); return true; } else { - log.error("Fehler Ueberpruefung Parameter Target. Target entspricht nicht den Kriterien (nur Zeichen a-z, A-Z und -, sowie 1-5 Zeichen lang)"); + Logger.error("Fehler Ueberpruefung Parameter Target. Target entspricht nicht den Kriterien (nur Zeichen a-z, A-Z und -, sowie 1-5 Zeichen lang)"); return false; } @@ -265,17 +264,17 @@ public class ValidationHelper { public static boolean isValidSourceID(String sourceID) { - log.debug("Ueberpruefe Parameter sourceID"); + Logger.debug("Ueberpruefe Parameter sourceID"); Pattern pattern = Pattern.compile("[\\w-_]{1,20}"); Matcher matcher = pattern.matcher(sourceID); boolean b = matcher.matches(); if (b) { - log.debug("Parameter sourceID erfolgreich ueberprueft"); + Logger.debug("Parameter sourceID erfolgreich ueberprueft"); return true; } else { - log.error("Fehler Ueberpruefung Parameter sourceID. SourceID entspricht nicht den Kriterien (nur Zeichen a-z, A-Z, - und _, sowie 1-20 Zeichen lang)"); + Logger.error("Fehler Ueberpruefung Parameter sourceID. SourceID entspricht nicht den Kriterien (nur Zeichen a-z, A-Z, - und _, sowie 1-20 Zeichen lang)"); return false; } } -- cgit v1.2.3