OSDN Git Service

エラー時のプロセス終了コードを整理。
[mikutoga/Pmd2XML.git] / src / main / java / jp / sourceforge / mikutoga / pmd2xml / Pmd2Xml.java
index e52c922..75b110f 100644 (file)
@@ -98,7 +98,7 @@ public final class Pmd2Xml {
                     System.err.println("ERROR:");\r
                     System.err.println("You need -i argument.");\r
                     System.err.println("(-h for help)");\r
-                    System.exit(1);\r
+                    System.exit(5);\r
                 }\r
                 inputFile = args[argIdx];\r
             }else if(arg.equals("-o")){\r
@@ -106,11 +106,16 @@ public final class Pmd2Xml {
                     System.err.println("ERROR:");\r
                     System.err.println("You need -o argument.");\r
                     System.err.println("(-h for help)");\r
-                    System.exit(1);\r
+                    System.exit(5);\r
                 }\r
                 outputFile = args[argIdx];\r
             }else if(arg.equals("-f")){\r
                 force = true;\r
+            }else{\r
+                System.err.println("ERROR:");\r
+                System.err.println("Unknown option:"+arg);\r
+                System.err.println("(-h for help)");\r
+                System.exit(5);\r
             }\r
         }\r
 \r
@@ -118,21 +123,21 @@ public final class Pmd2Xml {
             System.err.println("ERROR:");\r
             System.err.println("You must specify -pmd2xml or -xml2pmd.");\r
             System.err.println("(-h for help)");\r
-            System.exit(1);\r
+            System.exit(5);\r
         }\r
 \r
         if(inputFile == null){\r
             System.err.println("ERROR:");\r
             System.err.println("You must specify input file with -i.");\r
             System.err.println("(-h for help)");\r
-            System.exit(1);\r
+            System.exit(5);\r
         }\r
 \r
         if(outputFile == null){\r
             System.err.println("ERROR:");\r
             System.err.println("You must specify output file with -o.");\r
             System.err.println("(-h for help)");\r
-            System.exit(1);\r
+            System.exit(5);\r
         }\r
 \r
         File iFile = new File(inputFile);\r
@@ -239,7 +244,7 @@ public final class Pmd2Xml {
         Package jrePackage = java.lang.Object.class.getPackage();\r
         if( ! jrePackage.isCompatibleWith("1.6")){\r
             System.err.println("You need JRE 1.6 or later.");\r
-            System.exit(1);\r
+            System.exit(4);\r
         }\r
         return;\r
     }\r