From 6446f9fd2efdbc4546cd56912d437a8e5af72d20 Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Mon, 31 May 2004 04:05:04 +0000 Subject: [PATCH] minor error in instantiating regexp --- src/com/silverwrist/util/IPv4Util.java | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/com/silverwrist/util/IPv4Util.java b/src/com/silverwrist/util/IPv4Util.java index 038c26d..73ed43f 100644 --- a/src/com/silverwrist/util/IPv4Util.java +++ b/src/com/silverwrist/util/IPv4Util.java @@ -28,8 +28,7 @@ public class IPv4Util public static final long MAX_ADDRESS = 0xFFFFFFFFL; - private static final REProgram IPV4_PATTERN = - new RECompiler().compile("^\\s*(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\s*$"); + private static final REProgram IPV4_PATTERN; /*-------------------------------------------------------------------------------- * Constructors @@ -101,4 +100,25 @@ public class IPv4Util } // end longToStringAddress + /*-------------------------------------------------------------------------------- + * Static initializer + *-------------------------------------------------------------------------------- + */ + + static + { + try + { // compile the pattern + RECompiler comp = new RECompiler(); + IPV4_PATTERN = comp.compile("^\\s*(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\s*$"); + + } // end try + catch (RESyntaxException e) + { // shouldn't happen + throw new Error(e.getMessage()); + + } // end catch + + } // end static initializer + } // end class IPv4Util