minor error in instantiating regexp

This commit is contained in:
Eric J. Bowersox 2004-05-31 04:05:04 +00:00
parent 609d216148
commit 6446f9fd2e

View File

@ -28,8 +28,7 @@ public class IPv4Util
public static final long MAX_ADDRESS = 0xFFFFFFFFL; public static final long MAX_ADDRESS = 0xFFFFFFFFL;
private static final REProgram IPV4_PATTERN = private static final REProgram IPV4_PATTERN;
new RECompiler().compile("^\\s*(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\s*$");
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructors * Constructors
@ -101,4 +100,25 @@ public class IPv4Util
} // end longToStringAddress } // 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 } // end class IPv4Util