java.net.MalformedURLException.printStackTrace()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中java.net.MalformedURLException.printStackTrace()方法的一些代码示例,展示了MalformedURLException.printStackTrace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MalformedURLException.printStackTrace()方法的具体详情如下:
包路径:java.net.MalformedURLException
类名称:MalformedURLException
方法名:printStackTrace

MalformedURLException.printStackTrace介绍

暂无

代码示例

代码示例来源:origin: Bilibili/DanmakuFlameMaster

  1. public void fillStreamFromHttpFile(Uri uri) {
  2. try {
  3. URL url = new URL(uri.getPath());
  4. url.openConnection();
  5. inStream = new BufferedInputStream(url.openStream());
  6. } catch (MalformedURLException e) {
  7. e.printStackTrace();
  8. } catch (IOException e) {
  9. e.printStackTrace();
  10. }
  11. }

代码示例来源:origin: embulk/embulk

  1. private URL getEmbeddedJarUrl(final String embeddedJarPath) throws MalformedURLException {
  2. final URL embeddedJarUrl;
  3. try {
  4. embeddedJarUrl = new URL(this.oneNestedJarUrlBase, embeddedJarPath);
  5. } catch (MalformedURLException ex) {
  6. // TODO: Notify this to reporters as far as possible.
  7. System.err.println("Failed to load entry in embedded JAR: " + embeddedJarPath);
  8. ex.printStackTrace();
  9. throw ex;
  10. }
  11. return embeddedJarUrl;
  12. }

代码示例来源:origin: TheFinestArtist/FinestWebView-Android

  1. public static String getHost(String url) {
  2. try {
  3. return new URL(url).getHost();
  4. } catch (MalformedURLException e) {
  5. e.printStackTrace();
  6. }
  7. return url;
  8. }
  9. }

代码示例来源:origin: ChinaSilence/any-video

  1. public static String getDomain(String url) {
  2. String domain = "";
  3. try {
  4. URL target = new URL(url);
  5. domain = target.getHost();
  6. } catch (MalformedURLException e) {
  7. log.error("Url(" + url + ") Cannot convert to BASIC-URL");
  8. e.printStackTrace();
  9. }
  10. return domain;
  11. }

代码示例来源:origin: aa112901/remusic

  1. public PreLoad(Context context, String url) {
  2. try {
  3. this.url = new URL(url);
  4. } catch (MalformedURLException e) {
  5. e.printStackTrace();
  6. }
  7. uri = URI.create(url);
  8. fileUtils = ProxyFileUtils.getInstance(context, uri, false);
  9. }

代码示例来源:origin: ChinaSilence/any-video

  1. public static String getTopDomain(String url) {
  2. String domain = "";
  3. try {
  4. URL target = new URL(url);
  5. domain = target.getHost();
  6. String[] part = domain.split("\\.");
  7. if (part.length > 2) {
  8. domain = part[part.length - 3] + "." + part[part.length - 2] + "." + part[part.length - 1];
  9. domain = domain.replace("www.", "");
  10. domain = domain.replace("m.", "");
  11. }
  12. } catch (MalformedURLException e) {
  13. log.error("Url(" + url + ") Cannot convert to BASIC-URL");
  14. e.printStackTrace();
  15. }
  16. return domain;
  17. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query Github.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the weather server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query Github.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the weather server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query GitHub.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the GitHub server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query Github.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the weather server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query Github.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the weather server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query GitHub.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the GitHub server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query Github.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the weather server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query Github.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the weather server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query GitHub.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the GitHub server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  9. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  10. .appendQueryParameter(PARAM_SORT, sortBy)
  11. .build();
  12. URL url = null;
  13. try {
  14. url = new URL(builtUri.toString());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. }
  18. return url;
  19. }

代码示例来源:origin: udacity/ud851-Exercises

  1. /**
  2. * Builds the URL used to query GitHub.
  3. *
  4. * @param githubSearchQuery The keyword that will be queried for.
  5. * @return The URL to use to query the GitHub server.
  6. */
  7. public static URL buildUrl(String githubSearchQuery) {
  8. // COMPLETED (1) Fill in this method to build the proper GitHub query URL
  9. Uri builtUri = Uri.parse(GITHUB_BASE_URL).buildUpon()
  10. .appendQueryParameter(PARAM_QUERY, githubSearchQuery)
  11. .appendQueryParameter(PARAM_SORT, sortBy)
  12. .build();
  13. URL url = null;
  14. try {
  15. url = new URL(builtUri.toString());
  16. } catch (MalformedURLException e) {
  17. e.printStackTrace();
  18. }
  19. return url;
  20. }

代码示例来源:origin: cymcsg/UltimateAndroid

  1. public static Bitmap returnBitMap(String url) {
  2. URL myFileUrl = null;
  3. Bitmap bitmap = null;
  4. try {
  5. myFileUrl = new URL(url);
  6. } catch (MalformedURLException e) {
  7. e.printStackTrace();
  8. }
  9. try {
  10. HttpURLConnection conn = (HttpURLConnection) myFileUrl
  11. .openConnection();
  12. conn.setDoInput(true);
  13. conn.connect();
  14. InputStream is = conn.getInputStream();
  15. bitmap = BitmapFactory.decodeStream(is);
  16. is.close();
  17. } catch (IOException e) {
  18. e.printStackTrace();
  19. }
  20. return bitmap;
  21. }

代码示例来源:origin: decaywood/XueQiuSuperSpider

  1. private List<URL> processNode(List<JsonNode> nodeList) {
  2. List<URL> res = new ArrayList<>();
  3. for (JsonNode node : nodeList) {
  4. try {
  5. for (JsonNode jsonNode : node) {
  6. String suffix = jsonNode.get("target").asText();
  7. String path = URLMapper.MAIN_PAGE.toString() + suffix;
  8. res.add(new URL(path));
  9. }
  10. } catch (MalformedURLException e) {
  11. e.printStackTrace();
  12. }
  13. }
  14. return res;
  15. }
  16. }

代码示例来源:origin: cymcsg/UltimateAndroid

  1. public static Bitmap getBitMap(String url) {
  2. URL myFileUrl = null;
  3. Bitmap bitmap = null;
  4. try {
  5. myFileUrl = new URL(url);
  6. } catch (MalformedURLException e) {
  7. e.printStackTrace();
  8. }
  9. try {
  10. HttpURLConnection conn = (HttpURLConnection) myFileUrl
  11. .openConnection();
  12. conn.setRequestProperty("referer", "http://t.qingdaonews.com");
  13. conn.setDoInput(true);
  14. conn.connect();
  15. InputStream is = conn.getInputStream();
  16. bitmap = BitmapFactory.decodeStream(is);
  17. is.close();
  18. conn.disconnect();
  19. } catch (IOException e) {
  20. e.printStackTrace();
  21. }
  22. return bitmap;
  23. }

代码示例来源:origin: javaee-samples/javaee7-samples

  1. URL httpsUrl = new URL(
  2. "https",
  3. url.getHost(),
  4. e.printStackTrace();
  5. logger.log(Level.SEVERE, "Failure creating HTTPS URL", e);

相关文章