#vulnerable code 
                                static String expandUserHome(String text) {
	    if (text.equals("~")) {
		    return System.getProperty("user.home");
	    } else if (text.indexOf("~/") == 0 || text.indexOf("file:~/") == 0 || text.indexOf("jar:file:~/") == 0) {
		    String safeHome = System.getProperty("user.home").replace("\\", "\\\\");
		    return text.replaceFirst("~/", safeHome + "/");
	    }
        return text;
    } 
                            #location 5 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                static String expandUserHome(String text) {
        if (text.equals("~")) {
            return system.getProperty("user.home");
        } else if (text.indexOf("~/") == 0 || text.indexOf("file:~/") == 0 || text.indexOf("jar:file:~/") == 0) {
            String safeHome = system.getProperty("user.home").replace("\\", "\\\\");
            return text.replaceFirst("~/", safeHome + "/");
        }
        return text;
    }