2013-04-30 1 views
1

VFS를 사용하여 HTTP, SFTP, FTP 등에서 파일을 성공적으로 다운로드하고 있습니다. 파일의 내용 유형을 가져와야하고 이상한 점이 있습니다. 나는 왜 그런 일이 일어나고 있는지 확신하지 못한다. 내가 getSize에 대한 호출을 제거하면VFS FileObject에서 ContentInfo를 가져 오려고 할 때 NullPointer

FileObject file = vfs.resolveFile(uri) ; 
FileContent content = remote.getContent(); 

InputStream source = content.getInputStream(); 
ByteArrayOutputStream target = new ByteArrayOutputStream(); 
copy(source, target); 

content.getSize(); // HACK: Prevents null-pointer in next line 
String type = content.getContentInfo().getContentType(); 

, content.getContentInfo는 null를 돌려줍니다. 왜 이런거야? 내가 놓친 게 있니? 샘 라드 쓴 @,이 트렁크에 고정으로

+0

은'어떤 전화 getSize' 어떻게됩니까? 'System.out.println (content.isOpen()? "Open": "Closed");' – durron597

+0

어떤 종류의 파일로 인해이 오류가 발생합니까? –

+0

['issue']처럼 보입니다. (http://mail-archives.apache.org/mod_mbox/commons-issues/201207.mbox/%[email protected]%3E) –

답변