diff options
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/util/Util.java')
-rw-r--r-- | src/main/java/org/openslx/imagemaster/util/Util.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/org/openslx/imagemaster/util/Util.java b/src/main/java/org/openslx/imagemaster/util/Util.java index 79589c4..e9146e0 100644 --- a/src/main/java/org/openslx/imagemaster/util/Util.java +++ b/src/main/java/org/openslx/imagemaster/util/Util.java @@ -16,7 +16,7 @@ import org.apache.log4j.Logger; public class Util { - private static Logger log = Logger.getLogger( Util.class ); + private static Logger LOGGER = Logger.getLogger( Util.class ); /** * Check if the given object is null, abort program if true. @@ -35,7 +35,7 @@ public class Util { if ( something == null ) { if ( message != null ) - log.fatal( "[NOTNULL] " + message, new NullPointerException() ); + LOGGER.fatal( "[NOTNULL] " + message, new NullPointerException() ); System.exit( 2 ); } } @@ -57,7 +57,7 @@ public class Util { if ( number == 0 ) { if ( message != null ) - log.fatal( "[NOTNULL] " + message, new NullPointerException() ); + LOGGER.fatal( "[NOTNULL] " + message, new NullPointerException() ); System.exit( 2 ); } } @@ -75,7 +75,7 @@ public class Util { if ( something == null || something.isEmpty() ) { if ( message != null ) - log.fatal( "[NOTNULL] " + message, new NullPointerException() ); + LOGGER.fatal( "[NOTNULL] " + message, new NullPointerException() ); System.exit( 2 ); } } @@ -123,6 +123,14 @@ public class Util return str != null && !str.isEmpty(); } + public static boolean isEmpty( String str, String message, Logger logger ) + { + if ( str != null && !str.isEmpty() ) + return false; + logger.debug( message ); + return true; + } + /** * Tries to parse an int. Returns 0 on error. * |