Project

General

Profile

« Previous | Next » 

Revision 8484

Added by Jing Tao almost 11 years ago

Fixed a bug that showing illegal options in the groupadd command.

View differences:

src/edu/ucsb/nceas/metacat/authentication/AuthFile.java
614 614
            } else if (argus[1] != null && argus[1].equals(USAGE)) {
615 615
                printUsage();
616 616
            } else {
617
                System.out.print("The unknown action "+argus[1]);
617
                System.out.print("Error: the unknown action "+argus[1]);
618 618
            }
619 619
    }
620 620
    
......
629 629
            String arg = argus[i];
630 630
            
631 631
            if(map.containsKey(arg)) {
632
                System.out.println("The command line for groupadd can't have the duplicated options "+arg+".");
632
                System.out.println("Error: the command line for groupadd can't have the duplicated options "+arg+".");
633 633
                System.exit(1);
634 634
            }
635 635
            
......
639 639
                map.put(arg, argus[i+1]);
640 640
            } else if(!arg.equals(DASHG) && !arg.equals(DASHD)) {
641 641
                //check if the previous argument is -g or -d
642
                if(!argus[i-1].equals(DASHG) || !argus[i-1].equals(DASHD)) {
643
                    System.out.println("An illegal argument "+arg+" in the groupadd command ");
642
                if(!argus[i-1].equals(DASHG) && !argus[i-1].equals(DASHD)) {
643
                    System.out.println("Error: an illegal argument "+arg+" in the groupadd command ");
644
                    System.exit(1);
644 645
                }
645 646
            }
646 647
        } 
......
649 650
        if(map.keySet().size() ==1 || map.keySet().size() ==2) {
650 651
            groupName = map.get(DASHG);
651 652
            if(groupName == null) {
652
                System.out.println("The "+DASHG+" group-name is required in the groupadd command line.");
653
                System.out.println("Error: the "+DASHG+" group-name is required in the groupadd command line.");
653 654
            }
654 655
            description = map.get(DASHD);
655 656
            authFile.addGroup(groupName, description);
......
700 701
     */
701 702
    private static void printError(String[] argus) {
702 703
        if(argus != null) {
703
            System.out.println("It is an illegal command: ");
704
            System.out.println("Error: it is an illegal command: ");
704 705
            for(int i=0; i<argus.length; i++) {
705 706
                if(i!= 0) {
706 707
                    System.out.print(argus[i]+" ");

Also available in: Unified diff