示例#1
0
 private static void parseAdd(String[] arr, int lineNumber) throws ParseException {
   if (arr.length > 1) {
     switch (arr[1]) {
       case "CLIENT":
         {
           if (arr.length > 2) {
             if (arr.length > 3) {
               switch (arr[3]) {
                 case "LIST_CLIENT":
                   {
                     if (arr.length > 4) {
                       ProxyFilter.addClientToClientList(arr[4], arr[2]);
                     } else {
                       throw new ParseException(
                           "Client list name not specified at " + lineNumber, 5);
                     }
                   }
                   break;
                 case "LIST_ADDRESS":
                   {
                     if (arr.length > 4) {
                       if (arr.length > 5) {
                         ProxyFilter.addClientToAddressList(arr[4], arr[2], arr[5].equals("1"));
                       } else {
                         throw new ParseException(
                             "Permision type not specified at " + lineNumber, 6);
                       }
                     } else {
                       throw new ParseException(
                           "Address list name not specified at " + lineNumber, 5);
                     }
                   }
                   break;
                 default:
                   {
                     throw new ParseException("Wrong list type specified at " + lineNumber, 4);
                   }
               }
             } else {
               throw new ParseException("List type not specified at " + lineNumber, 3);
             }
           } else {
             throw new ParseException("Client ip not specified at " + lineNumber, 2);
           }
         }
         break;
       case "LIST_CLIENT":
         {
           if (arr.length > 2) {
             if (arr.length > 3) {
               switch (arr[3]) {
                 case "LIST_ADDRESS":
                   {
                     if (arr.length > 4) {
                       if (arr.length > 5) {
                         ProxyFilter.addClientListToAddressList(
                             arr[4], arr[2], arr[5].equals("1"));
                       } else {
                         throw new ParseException(
                             "Permision type not specified at " + lineNumber, 6);
                       }
                     } else {
                       throw new ParseException(
                           "Address list name not specified at " + lineNumber, 5);
                     }
                   }
                   break;
                 default:
                   {
                     throw new ParseException("Wrong list type specified at " + lineNumber, 4);
                   }
               }
             } else {
               throw new ParseException("List type not specified at " + lineNumber, 3);
             }
           } else {
             throw new ParseException("Client list name not specified at " + lineNumber, 2);
           }
         }
         break;
       case "ADDRESS":
         {
           if (arr.length > 2) {
             if (arr.length > 3) {
               switch (arr[3]) {
                 case "LIST_ADDRESS":
                   {
                     if (arr.length > 4) {
                       ProxyFilter.addAddressToAddressList(arr[4], arr[2]);
                     } else {
                       throw new ParseException(
                           "Address list name not specified at " + lineNumber, 5);
                     }
                   }
                   break;
                 default:
                   {
                     throw new ParseException("Wrong list type specified at " + lineNumber, 4);
                   }
               }
             } else {
               throw new ParseException("List type not specified at " + lineNumber, 3);
             }
           } else {
             throw new ParseException("Website name not specified at " + lineNumber, 2);
           }
         }
         break;
       default:
         {
           throw new ParseException("Wrong add params at " + lineNumber, 2);
         }
     }
   } else {
     throw new ParseException("Wrong add section at " + lineNumber, 1);
   }
 }