我只是试图加载一个URL到InputStream,但它似乎从来没有管理。InputStream不会打开一个流到指定的URL
private void getWebpage(String url)
{
URL myFileUrl = null;
try
{
myFileUrl= new URL(url);
}
catch (MalformedURLException e)
{
System.out.println("Malformed URL Exception");
}
catch (Exception e)
{
System.out.println("Some URL Exception");
}
try
{
InputStream in = myFileUrl.openStream();
System.out.println("Does it get here?");
is = new BufferedInputStream(in);
in.close();
is.close();
}
catch (IOException e)
{
System.out.println("Some IO Exception");
}
catch (Exception e)
{
System.out.println("Some Exception");
}
}
它从不打印出“它到了吗?”到控制台,但它确实打印出一些IO异常。世界上没有最好的错误信息我知道。
使用'e.printStackTrace'而不是'System.out.println'获得更有用的错误信息 – Craigy
您确定您的应用程序拥有? –
dymmeh
我的清单文件中有用户权限行。 – RichardG