39
39
40
40
public class App {
41
41
42
- private static final String exeFolder = System .getProperty ("user.dir" );
43
- private static final Path outFile = Paths .get (exeFolder , "new_config.xml" );
44
- private static final Path inFile = Paths .get (exeFolder , "config.xml" );
45
- private static boolean isCheck = false ;
46
- private static boolean debug = false ;
47
- private static final String LF = System . getProperty ( "line.separator" ) ;
42
+ private static final String EXE_FOLDER = System .getProperty ("user.dir" );
43
+ private static final Path OUT_FILE = Paths .get (EXE_FOLDER , "new_config.xml" );
44
+ private static final Path IN_FILE = Paths .get (EXE_FOLDER , "config.xml" );
45
+ private static final String LF = System . getProperty ( "line.separator" ) ;
46
+ private static boolean isCheck = false ;
47
+ private static boolean debug = false ;
48
48
49
49
50
50
public static void main (String [] args ) {
@@ -59,11 +59,11 @@ public static void main(String[] args) {
59
59
List <Subnet4 > subnet4List = new ArrayList <>();
60
60
String configXML = "" ;
61
61
try {
62
- if (!inFile .toFile ().exists ()) {
62
+ if (!IN_FILE .toFile ().exists ()) {
63
63
System .out .println (Message .NO_CONFIG_FILE );
64
64
System .exit (1 );
65
65
}
66
- configXML = Files .readString (inFile );
66
+ configXML = Files .readString (IN_FILE );
67
67
DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance ();
68
68
DocumentBuilder dBuilder = dbFactory .newDocumentBuilder ();
69
69
doc = dBuilder .parse (new InputSource (new StringReader (configXML )));
@@ -227,8 +227,8 @@ public static void main(String[] args) {
227
227
transformer .transform (source , result );
228
228
String pattern = "\\ r?\\ n\\ s+\\ r?\\ n" ;
229
229
String prettyXML = writer .toString ().replaceAll (pattern , LF );
230
- outFile .toFile ().createNewFile ();
231
- Files .writeString (outFile , prettyXML , Charset .defaultCharset ());
230
+ OUT_FILE .toFile ().createNewFile ();
231
+ Files .writeString (OUT_FILE , prettyXML , Charset .defaultCharset ());
232
232
System .out .println (Message .SUCCESS );
233
233
System .exit (0 );
234
234
}
@@ -362,7 +362,6 @@ private static boolean validIPAddress(String ipAddress) {
362
362
return ipValid ;
363
363
}
364
364
365
-
366
365
/**
367
366
* Handles the command line arguments when the program is first run
368
367
*
@@ -393,7 +392,6 @@ private static void processArgs(String[] args) {
393
392
}
394
393
}
395
394
396
-
397
395
/**
398
396
* Generates one UUID for each Kea static mapping
399
397
*
@@ -521,6 +519,4 @@ private static void howTo() {
521
519
System .out .println (Message .HOW_TO );
522
520
System .exit (0 );
523
521
}
524
-
525
-
526
522
}
0 commit comments