#vulnerable code 
                             public static void main(String[] args) throws IOException {
		IngestReader ir = new IngestReader();
				
		if(args.length == 2) {
			String command = args[0];
			String p1 = args[1];
			if(command.equals("-gx")) {
				ir.generateXml(p1);
			}
			else if(command.equals("-b")) {
				ir.indexSenateObject((Bill)ir.loadObject(p1, Bill.class));
			}
			else if(command.equals("-c")) {
				ir.indexSenateObject((Calendar)ir.loadObject(p1, Calendar.class));
			}
			else if(command.equals("-a")) {
				ir.indexSenateObject((Agenda)ir.loadObject(p1, Agenda.class));
			}
			else if(command.equals("-t")) {
				ir.indexSenateObject((Transcript)ir.loadObject(p1, Transcript.class));
			}
			else if(command.equals("-it")) {
				ir.handleTranscript(p1);
			}
			else {
				System.err.println("bad command");
			}
		}
		else if(args.length == 3){
			String command = args[0];
			String p1 = args[1];
			String p2 = args[2];
			if(command.equals("-i")) {
				WRITE_DIRECTORY = p1;
				ir.handlePath(p2);
			}
			else if(command.equals("-fc")) {
				ir.fixCalendarBills(p1, p2);
			}
			else if(command.equals("-fa")) {
				ir.fixAgendaBills(p1, p2);
			}
			else {
				System.err.println("bad command");
			}
		}
		else {
			System.err.println("appropriate usage is:\n" +
					"\t-i <json directory> <sobi directory> (to create index)\n" +
					"\t-gx <sobi directory> (to generate agenda and calendar xml from sobi)\n" +
					"\t-fc <year> <calendar directory> (to fix calendar bills)\n" +
					"\t-fa <year> <agenda directory> (to fix agenda bills)\n" +
					"\t-b <bill json path> (to reindex single bill)\n" +
					"\t-c <calendar json path> (to reindex single calendar)\n" +
					"\t-a <agenda json path> (to reindex single agenda)\n" +
					"\t-t <transcript json path> (to reindex single transcript)" +
					"\t-it <transcript sobi path> (to reindex single agenda)\n");
		}
	} 
                            #location 11 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             public static void main(String[] args) throws IOException {
		IngestReader ir = new IngestReader();
						
		if(args.length == 2) {
			String command = args[0];
			String p1 = args[1];
			if(command.equals("-gx")) {
				ir.generateXml(p1);
			}
			else if(command.equals("-b")) {
				ir.writeBills(new ArrayList<Bill>(Arrays.asList((Bill)ir.loadObject(p1, Bill.class))), false);
			}
			else if(command.equals("-c")) {
				ir.indexSenateObject((Calendar)ir.loadObject(p1, Calendar.class));
			}
			else if(command.equals("-a")) {
				ir.indexSenateObject((Agenda)ir.loadObject(p1, Agenda.class));
			}
			else if(command.equals("-t")) {
				ir.indexSenateObject((Transcript)ir.loadObject(p1, Transcript.class));
			}
			else if(command.equals("-it")) {
				ir.handleTranscript(p1);
			}
			else {
				System.err.println("bad command");
			}
		}
		else if(args.length == 3){
			String command = args[0];
			String p1 = args[1];
			String p2 = args[2];
			if(command.equals("-i")) {
				WRITE_DIRECTORY = p1;
				ir.handlePath(p2);
			}
			else if(command.equals("-fc")) {
				ir.fixCalendarBills(p1, p2);
			}
			else if(command.equals("-fa")) {
				ir.fixAgendaBills(p1, p2);
			}
			else {
				System.err.println("bad command");
			}
		}
		else {
			System.err.println("appropriate usage is:\n" +
					"\t-i <json directory> <sobi directory> (to create index)\n" +
					"\t-gx <sobi directory> (to generate agenda and calendar xml from sobi)\n" +
					"\t-fc <year> <calendar directory> (to fix calendar bills)\n" +
					"\t-fa <year> <agenda directory> (to fix agenda bills)\n" +
					"\t-b <bill json path> (to reindex single bill)\n" +
					"\t-c <calendar json path> (to reindex single calendar)\n" +
					"\t-a <agenda json path> (to reindex single agenda)\n" +
					"\t-t <transcript json path> (to reindex single transcript)" +
					"\t-it <transcript sobi path> (to reindex single agenda)\n");
		}
	}