#vulnerable code 
                             @Override
	public JSONObject parse(byte[] raw_message) {
		String toParse = "";
		JSONObject toReturn;

		try {

			toParse = new String(raw_message, "UTF-8");

			//System.out.println("Received message: " + toParse);

			OpenSOCMatch gm = grok.match(toParse);
			gm.captures();

			toReturn = new JSONObject();

			toReturn.putAll(gm.toMap());

			String id = toReturn.get("uid").toString();
			
			// We are not parsing the fedata for multi part message as we cannot determine how we can split the message and how many multi part messages can there be. 
			// The message itself will be stored in the response. 
			
			
			String[] tokens = id.split("\\.");
			if(tokens.length == 1 ) {
		     
			String syslog = toReturn.get("syslog").toString();
			
			Multimap<String, String> multiMap =  formatMain(syslog) ;
			
			for(String key : multiMap.keySet()) {
				
				String value =Joiner.on(",").join( multiMap.get(key));
				toReturn.put(key, value);
			}
			
			}
			
			String ip_src_addr = (String) toReturn.get("dvc");
			String ip_src_port = (String) toReturn.get("src_port");
			String ip_dst_addr = (String) toReturn.get("dst_ip");
			String ip_dst_port = (String) toReturn.get("dst_port");
			
			if(ip_src_addr != null)
				toReturn.put("ip_src_addr", ip_src_addr);
			if(ip_src_port != null)
				toReturn.put("ip_src_port", ip_src_port);
			if(ip_dst_addr != null)
				toReturn.put("ip_dst_addr", ip_dst_addr);
			if(ip_dst_port != null)
				toReturn.put("ip_dst_port", ip_dst_port);
			
			return toReturn;

		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}

	} 
                            #location 19 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             @Override
	public JSONObject parse(byte[] raw_message) {
		String toParse = "";
		JSONObject toReturn;

		try {

			toParse = new String(raw_message, "UTF-8");

			//System.out.println("Received message: " + toParse);

			//OpenSOCMatch gm = grok.match(toParse);
			//gm.captures();

			toReturn = new JSONObject();
			
			String[] mTokens = toParse.split(" ");

			//toReturn.putAll(gm.toMap());

			String id = mTokens[0];
			
			// We are not parsing the fedata for multi part message as we cannot determine how we can split the message and how many multi part messages can there be. 
			// The message itself will be stored in the response. 
			
			
			String[] tokens = id.split("\\.");
			if(tokens.length == 2 ) {
		     
				String[] array = Arrays.copyOfRange(mTokens, 1, mTokens.length-1);
			String syslog = Joiner.on(" ").join(array);
			
			Multimap<String, String> multiMap =  formatMain(syslog) ;
			
			for(String key : multiMap.keySet()) {
				
				String value =Joiner.on(",").join( multiMap.get(key));
				toReturn.put(key, value);
			}
			
			}
			
			String ip_src_addr = (String) toReturn.get("dvc");
			String ip_src_port = (String) toReturn.get("src_port");
			String ip_dst_addr = (String) toReturn.get("dst_ip");
			String ip_dst_port = (String) toReturn.get("dst_port");
			
			if(ip_src_addr != null)
				toReturn.put("ip_src_addr", ip_src_addr);
			if(ip_src_port != null)
				toReturn.put("ip_src_port", ip_src_port);
			if(ip_dst_addr != null)
				toReturn.put("ip_dst_addr", ip_dst_addr);
			if(ip_dst_port != null)
				toReturn.put("ip_dst_port", ip_dst_port);
			
			System.out.println(toReturn);
			return toReturn;

		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}

	}