本文整理了Java中java.net.MalformedURLException.printStackTrace()
方法的一些代码示例,展示了MalformedURLException.printStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MalformedURLException.printStackTrace()
方法的具体详情如下:
包路径:java.net.MalformedURLException
类名称:MalformedURLException
方法名:printStackTrace
暂无
代码示例来源:origin: Bilibili/DanmakuFlameMaster
public void fillStreamFromHttpFile(Uri uri) {
try {
URL url = new URL(uri.getPath());
url.openConnection();
inStream = new BufferedInputStream(url.openStream());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: embulk/embulk
private URL getEmbeddedJarUrl(final String embeddedJarPath) throws MalformedURLException {
final URL embeddedJarUrl;
try {
embeddedJarUrl = new URL(this.oneNestedJarUrlBase, embeddedJarPath);
} catch (MalformedURLException ex) {
// TODO: Notify this to reporters as far as possible.
System.err.println("Failed to load entry in embedded JAR: " + embeddedJarPath);
ex.printStackTrace();
throw ex;
}
return embeddedJarUrl;
}
代码示例来源:origin: TheFinestArtist/FinestWebView-Android
public static String getHost(String url) {
try {
return new URL(url).getHost();
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
}
代码示例来源:origin: ChinaSilence/any-video
public static String getDomain(String url) {
String domain = "";
try {
URL target = new URL(url);
domain = target.getHost();
} catch (MalformedURLException e) {
log.error("Url(" + url + ") Cannot convert to BASIC-URL");
e.printStackTrace();
}
return domain;
}
代码示例来源:origin: aa112901/remusic
public PreLoad(Context context, String url) {
try {
this.url = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
uri = URI.create(url);
fileUtils = ProxyFileUtils.getInstance(context, uri, false);
}
代码示例来源:origin: ChinaSilence/any-video
public static String getTopDomain(String url) {
String domain = "";
try {
URL target = new URL(url);
domain = target.getHost();
String[] part = domain.split("\\.");
if (part.length > 2) {
domain = part[part.length - 3] + "." + part[part.length - 2] + "." + part[part.length - 1];
domain = domain.replace("www.", "");
domain = domain.replace("m.", "");
}
} catch (MalformedURLException e) {
log.error("Url(" + url + ") Cannot convert to BASIC-URL");
e.printStackTrace();
}
return domain;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query Github.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the weather server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query Github.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the weather server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query GitHub.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the GitHub server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query Github.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the weather server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query Github.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the weather server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query GitHub.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the GitHub server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query Github.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the weather server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query Github.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the weather server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query GitHub.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the GitHub server.
*/
public static URL buildUrl(String githubSearchQuery) {
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: udacity/ud851-Exercises
/**
* Builds the URL used to query GitHub.
*
* @param githubSearchQuery The keyword that will be queried for.
* @return The URL to use to query the GitHub server.
*/
public static URL buildUrl(String githubSearchQuery) {
// COMPLETED (1) Fill in this method to build the proper GitHub query URL
Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
.appendQueryParameter(PARAM_QUERY, githubSearchQuery)
.appendQueryParameter(PARAM_SORT, sortBy)
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
代码示例来源:origin: cymcsg/UltimateAndroid
public static Bitmap returnBitMap(String url) {
URL myFileUrl = null;
Bitmap bitmap = null;
try {
myFileUrl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection) myFileUrl
.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}
代码示例来源:origin: decaywood/XueQiuSuperSpider
private List<URL> processNode(List<JsonNode> nodeList) {
List<URL> res = new ArrayList<>();
for (JsonNode node : nodeList) {
try {
for (JsonNode jsonNode : node) {
String suffix = jsonNode.get("target").asText();
String path = URLMapper.MAIN_PAGE.toString() + suffix;
res.add(new URL(path));
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
return res;
}
}
代码示例来源:origin: cymcsg/UltimateAndroid
public static Bitmap getBitMap(String url) {
URL myFileUrl = null;
Bitmap bitmap = null;
try {
myFileUrl = new URL(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection) myFileUrl
.openConnection();
conn.setRequestProperty("referer", "http://t.qingdaonews.com");
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(is);
is.close();
conn.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}
代码示例来源:origin: javaee-samples/javaee7-samples
URL httpsUrl = new URL(
"https",
url.getHost(),
e.printStackTrace();
logger.log(Level.SEVERE, "Failure creating HTTPS URL", e);
内容来源于网络,如有侵权,请联系作者删除!