Revision 5596 trunk/extensions/extScripting/src/org/gvsig/scripting/DefaultThinlet.java

View differences:

DefaultThinlet.java
39 39
	public static Class getPluginsServices() {
40 40
		return PluginServices.class;
41 41
	}
42
    public Object parse(File file) throws IOException {
43
        return parse(file, this);
44
    }
42 45

  
46

  
43 47
    public Object parse(String path, Object handler) throws IOException {
44 48
        ffilename = path;
45 49
        InputStream inputstream = null;
......
69 73
        }
70 74
    }
71 75

  
76
    public Object parse(File file, Object handler) throws IOException {
77
        ffilename = file.getAbsolutePath();
78
        InputStream inputstream = null;
79

  
80
        try {
81
	        try {	        	
82
	        	inputstream = new FileInputStream(file);
83
	        } catch (Exception e) {
84
	        	/* thows nullpointerexception*/
85
	        }                	 
86
	        fin = new LineNumberReader(new BufferedReader(new InputStreamReader(inputstream)));
87
	        fin.setLineNumber(1);
88
	        Object ret = parse(fin, true, false, handler);
89
	        return ret;
90
        } finally{ 
91
            fin = null;
92
            if(inputstream != null) try{inputstream.close();}catch(IOException ignore){}
93
        }
94
    }
95

  
72 96
	
73 97
	public static IExtension getScriptExtension() {	
74 98
		return PluginServices.getExtension(ScriptingExtension.class);

Also available in: Unified diff