[jcifs] 0.8b vs createNewFile

Julian Reschke julian.reschke at gmx.de
Tue Feb 3 14:49:39 GMT 2004


Hi,

the method "createNewFile()" doesn't seem to work as advertised:

	private static boolean testCreateNewFile() throws IOException {
	
		SmbFile smb = new SmbFile("smb://" + creds + host + "/" + share + 
"/newfile");
		System.out.println(smb.getCanonicalPath());
		
		//SmbFileOutputStream so = new SmbFileOutputStream(smb);
		//so.close();
		
		smb.createNewFile();
		
		return smb.exists();
	}

yields:

jcifs.smb.SmbException: File not found
	at jcifs.smb.SmbTransport.send(SmbTransport.java:733)
	at jcifs.smb.SmbSession.send(SmbSession.java:109)
	at jcifs.smb.SmbTree.send(SmbTree.java:129)
	at jcifs.smb.SmbFile.send(SmbFile.java:597)
	at jcifs.smb.SmbFile.open0(SmbFile.java:684)
	at jcifs.smb.SmbFile.createNewFile(SmbFile.java:1979)
	at de.greenbytes.jcifs.Test.testCreateNewFile(Test.java:33)
	at de.greenbytes.jcifs.Test.main(Test.java:19)
Exception in thread "main"


Using "new SmbFileOutputStream/close" on the same SmbFile object instead 
works.

Regards, Julian


-- 
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760


More information about the jcifs mailing list