本文整理了Java中xapi.util.X_Util.rethrow()
方法的一些代码示例,展示了X_Util.rethrow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X_Util.rethrow()
方法的具体详情如下:
包路径:xapi.util.X_Util
类名称:X_Util
方法名:rethrow
暂无
代码示例来源:origin: net.wetheinter/xapi-dev-api
@Override
public boolean hasNext() {
try {
next = reader.readLine();
if (next == null) {
reader.close();
return false;
}
return true;
}catch(IOException e) {
throw X_Util.rethrow(e);
}
}
代码示例来源:origin: net.wetheinter/xapi-core-io
@Override
public void onError(final Throwable e) {
final Throwable unwrapped = X_Util.unwrap(e);
if (unwrapped instanceof UnknownHostException) {
failure[0] = true;
} else if (unwrapped instanceof SocketException) {
failure[0] = true;
} else {
e.printStackTrace();
X_Util.rethrow(e);
}
}
});
代码示例来源:origin: net.wetheinter/xapi-dev-api
@Override
public Iterator<String> iterator() {
try {
// reader is closed by StringReader
BufferedReader reader = new BufferedReader(new InputStreamReader(open()));
return new StringReader(reader);
} catch (IOException e) {
throw X_Util.rethrow(e);
}
}
};
代码示例来源:origin: net.wetheinter/xapi-dev-maven
@Override
public Model loadPomString(String pomString) throws XmlPullParserException {
try {
return new MavenXpp3Reader().read(new StringReader(pomString));
} catch (IOException ignored) {
throw X_Util.rethrow(ignored);
}
}
代码示例来源:origin: net.wetheinter/xapi-dev-api
static ResourceCollection fromUrl(URL url, String pkg) {
String path = url.toExternalForm();
File file;
boolean jarUrl = path.startsWith("jar:");
if (jarUrl) path = path.substring("jar:".length());
boolean fileUrl = path.startsWith("file:");
if (fileUrl) path = path.substring("file:".length());
boolean jarFile = path.contains(".jar!");
if (jarFile) path = path.substring(0, path.indexOf(".jar!") + ".jar".length());
if (!(file = new java.io.File(path)).exists()) {
path = path.replace("%20", " ");
if (!(file = new java.io.File(path)).exists()) {
//should be impossible since we get these urls from classloader
throw X_Util.rethrow(new FileNotFoundException());
}
}
try {
//TODO getOrMake; use an InitWithParamMap
if (url.getProtocol().equals("jar")) {
return new ResourceCollection(pkg, ((JarURLConnection)url.openConnection()).getJarFile());
}
assert url.getProtocol().equals("file") : "ResourceCollection only handles url and file protocols";
if (jarFile) {
return new ResourceCollection(pkg, new JarFile(file));
}
return new ResourceCollection(file);
}catch (IOException e) {
throw X_Util.rethrow(e);
}
}
代码示例来源:origin: net.wetheinter/xapi-core-ui-autoui
protected <X> X create(Class<? extends X> renderer) {
try {
return renderer.newInstance();
} catch (InstantiationException e) {
throw X_Debug.rethrow(e.getCause() == null ? e : e.getCause());
} catch (IllegalAccessException e) {
throw X_Util.rethrow(e);
}
}
代码示例来源:origin: net.wetheinter/xapi-core-process
protected <T> void callback(Future<T> future, ReceivesValue<T> receiver) {
try {
receiver.set(future.get());
return;
} catch (InterruptedException e) {
debug(e);
Thread.interrupted();
} catch (ExecutionException e) {
debug(e);
throw X_Util.rethrow(X_Util.unwrap(e));
}
}
代码示例来源:origin: net.wetheinter/xapi-dev-api
public static synchronized File getXApiHome() {
// We purposely don't cache this value so users can change it at runtime.
String loc = X_Properties.getProperty(X_Namespace.PROPERTY_XAPI_HOME);
try {
if (loc == null) {
// use a temporary directory instead
File f = File.createTempFile("xapi", "home");
loc = f.getAbsolutePath();
X_Properties.setProperty(X_Namespace.PROPERTY_XAPI_HOME, loc);
return f;
}
File home = new File(loc);
if (!home.exists()) {
X_Log.info("XApi home @ "+home.getCanonicalPath()+" does not exist.");
if (home.mkdirs()) {
X_Log.info("Successfully created home directory");
} else {
X_Log.warn("Unable to create home directory; using temp file.");
X_Properties.setProperty(X_Namespace.PROPERTY_XAPI_HOME, null);
return getXApiHome();
}
}
return home;
} catch (Throwable e) {
throw X_Util.rethrow(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!