FileNotFoundException“/”从 URL 中删除
FileNotFoundException "/" getting removed from URL
我得到以下异常。
Failed to GET File Details from http://192.168.2.111/storage java.io.FileNotFoundException: http:/192.168.2.111/storage/data/18-Apr-2017-ops (No such file or directory)
junit.framework.AssertionFailedError: Failed to GET File Details from http://192.168.2.111/storage java.io.FileNotFoundException: http:/192.168.2.111/storage/data/18-Apr-2017-ops (No such file or directory)
at com.billing.getlogs.GetLogsTest.countLinesOperationsUpload(GetLogsTest.java:222)
at com.billing.getlogs.GetLogsTest.GetLogsLineCountTest(GetLogsTest.java:264)
如果你看,URL在java.io.FileNotFoundException:之后只有一个/在http:之后。 URL 是从属性文件中读取的。是否有任何原因会因为 / 字符正确出现在 url.
的其他部分而将其删除
知道了。
我变了
InputStream is = new BufferedInputStream(new FileInputStream(text));
至
InputStream is = new BufferedInputStream(new URL(text).openStream());
我一直在尝试读取 URL 的内容,但我的原始代码是用于读取文件的内容。
我得到以下异常。
Failed to GET File Details from http://192.168.2.111/storage java.io.FileNotFoundException: http:/192.168.2.111/storage/data/18-Apr-2017-ops (No such file or directory)
junit.framework.AssertionFailedError: Failed to GET File Details from http://192.168.2.111/storage java.io.FileNotFoundException: http:/192.168.2.111/storage/data/18-Apr-2017-ops (No such file or directory)
at com.billing.getlogs.GetLogsTest.countLinesOperationsUpload(GetLogsTest.java:222)
at com.billing.getlogs.GetLogsTest.GetLogsLineCountTest(GetLogsTest.java:264)
如果你看,URL在java.io.FileNotFoundException:之后只有一个/在http:之后。 URL 是从属性文件中读取的。是否有任何原因会因为 / 字符正确出现在 url.
的其他部分而将其删除知道了。
我变了
InputStream is = new BufferedInputStream(new FileInputStream(text));
至
InputStream is = new BufferedInputStream(new URL(text).openStream());
我一直在尝试读取 URL 的内容,但我的原始代码是用于读取文件的内容。