public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wrap) { long startTime = loadTimer.startLoad("classloader:" + file); try { SearchState state = new SearchState(file); state.prepareLoadSearch(file); Library library = null; LoadServiceResource resource = getClassPathResource(classLoader, file); if (resource != null) { state.loadName = resolveLoadName(resource, file); library = createLibrary(state, resource); } if (library == null) { throw runtime.newLoadError("no such file to load -- " + file); } try { library.load(runtime, wrap); } catch (IOException e) { if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr()); throw newLoadErrorFromThrowable(runtime, file, e); } } finally { loadTimer.endLoad("classloader:" + file, startTime); } }
public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wrap) { long startTime = loadTimer.startLoad("classloader:" + file); try { SearchState state = new SearchState(file); state.prepareLoadSearch(file); Library library = null; LoadServiceResource resource = getClassPathResource(classLoader, file); if (resource != null) { state.loadName = resolveLoadName(resource, file); library = createLibrary(state, resource); } if (library == null) { throw runtime.newLoadError("no such file to load -- " + file); } try { library.load(runtime, wrap); } catch (IOException e) { if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr()); throw newLoadErrorFromThrowable(runtime, file, e); } } finally { loadTimer.endLoad("classloader:" + file, startTime); } }
public void load(String file, boolean wrap) { long startTime = loadTimer.startLoad(file); try { if(!runtime.getProfile().allowLoad(file)) { throw runtime.newLoadError("no such file to load -- " + file, file); } SearchState state = new SearchState(file); state.prepareLoadSearch(file); Library library = findBuiltinLibrary(state, state.searchFile, state.suffixType); if (library == null) library = findLibraryWithoutCWD(state, state.searchFile, state.suffixType); if (library == null) { library = findLibraryWithClassloaders(state, state.searchFile, state.suffixType); if (library == null) { throw runtime.newLoadError("no such file to load -- " + file, file); } } try { library.load(runtime, wrap); } catch (IOException e) { if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr()); throw newLoadErrorFromThrowable(runtime, file, e); } } finally { loadTimer.endLoad(file, startTime); } }
public void load(String file, boolean wrap) { long startTime = loadTimer.startLoad(file); int currentLine = runtime.getCurrentLine(); try { if(!runtime.getProfile().allowLoad(file)) { throw runtime.newLoadError("no such file to load -- " + file, file); } SearchState state = new SearchState(file); state.prepareLoadSearch(file); Library library = findLibraryBySearchState(state); // load() will do a last chance look in current working directory for the file (see load.c:rb_f_load()). if (library == null) { FileResource fileResource = JRubyFile.createResourceAsFile(runtime, file); if (!fileResource.exists()) throw runtime.newLoadError("no such file to load -- " + file, file); library = LibrarySearcher.ResourceLibrary.create(file, file, fileResource); } try { library.load(runtime, wrap); } catch (IOException e) { debugLoadException(runtime, e); throw newLoadErrorFromThrowable(runtime, file, e); } } finally { runtime.setCurrentLine(currentLine); loadTimer.endLoad(file, startTime); } }
public void load(String file, boolean wrap) { long startTime = loadTimer.startLoad(file); try { if(!runtime.getProfile().allowLoad(file)) { throw runtime.newLoadError("no such file to load -- " + file, file); } SearchState state = new SearchState(file); state.prepareLoadSearch(file); Library library = findBuiltinLibrary(state, state.searchFile, state.suffixType); if (library == null) library = findLibraryWithoutCWD(state, state.searchFile, state.suffixType); if (library == null) { library = findLibraryWithClassloaders(state, state.searchFile, state.suffixType); if (library == null) { throw runtime.newLoadError("no such file to load -- " + file, file); } } try { library.load(runtime, wrap); } catch (IOException e) { if (runtime.getDebug().isTrue()) e.printStackTrace(runtime.getErr()); throw newLoadErrorFromThrowable(runtime, file, e); } } finally { loadTimer.endLoad(file, startTime); } }
public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wrap) { long startTime = loadTimer.startLoad("classloader:" + file); int currentLine = runtime.getCurrentLine(); try { SearchState state = new SearchState(file); state.prepareLoadSearch(file); Library library = null; LoadServiceResource resource = getClassPathResource(classLoader, file); if (resource != null) { state.setLoadName(resolveLoadName(resource, file)); library = createLibrary(state, resource); } if (library == null) { throw runtime.newLoadError("no such file to load -- " + file); } try { library.load(runtime, wrap); } catch (IOException e) { debugLoadException(runtime, e); throw newLoadErrorFromThrowable(runtime, file, e); } } finally { runtime.setCurrentLine(currentLine); loadTimer.endLoad("classloader:" + file, startTime); } }
public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wrap) { long startTime = loadTimer.startLoad("classloader:" + file); int currentLine = runtime.getCurrentLine(); try { SearchState state = new SearchState(file); state.prepareLoadSearch(file); Library library = null; LoadServiceResource resource = getClassPathResource(classLoader, file); if (resource != null) { state.setLoadName(resolveLoadName(resource, file)); library = createLibrary(state, resource); } if (library == null) { throw runtime.newLoadError("no such file to load -- " + file); } try { library.load(runtime, wrap); } catch (IOException e) { debugLoadException(runtime, e); throw newLoadErrorFromThrowable(runtime, file, e); } } finally { runtime.setCurrentLine(currentLine); loadTimer.endLoad("classloader:" + file, startTime); } }
public void load(String file, boolean wrap) { long startTime = loadTimer.startLoad(file); int currentLine = runtime.getCurrentLine(); try { if(!runtime.getProfile().allowLoad(file)) { throw runtime.newLoadError("no such file to load -- " + file, file); } SearchState state = new SearchState(file); state.prepareLoadSearch(file); Library library = findLibraryBySearchState(state); // load() will do a last chance look in current working directory for the file (see load.c:rb_f_load()). if (library == null) { FileResource fileResource = JRubyFile.createResourceAsFile(runtime, file); if (!fileResource.exists()) throw runtime.newLoadError("no such file to load -- " + file, file); library = LibrarySearcher.ResourceLibrary.create(file, file, fileResource); } try { library.load(runtime, wrap); } catch (IOException e) { debugLoadException(runtime, e); throw newLoadErrorFromThrowable(runtime, file, e); } } finally { runtime.setCurrentLine(currentLine); loadTimer.endLoad(file, startTime); } }