2017-04-18 80 views
-1

我得到以下例外。FileNotFoundException“/”从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) 

如果你看,java.io.FileNotFoundException之后的URL:只有一个/在后http :. URL是从属性文件中读取的。是否有任何理由,因为/字符正确显示在url的其他部分,这将被删除。

+2

堆栈跟踪是一回事,但我们显然不能看怎么回事无码块... –

+0

嗯,我想我知道是什么问题: InputStream的是=新的BufferedInputStream(新的FileInputStream(文本)) ; \t \t \t \t尝试{ ...... } 文本是一个URL字符串。我想我不应该使用FileInput流,因为它不是一个文件。不知道我应该使用什么。 – runnerpaul

+0

请发布您的代码,如果我们不知道您在做什么,我们无法帮助您。 – Vers

回答

0

明白了。

我改变

InputStream is = new BufferedInputStream(new FileInputStream(text)); 

InputStream is = new BufferedInputStream(new URL(text).openStream()); 

我一直在试图读取URL的内容,但我原来的代码是用于读取文件的内容。