From 8ab54fd7073eb1f1f956946db8cc046993f18ea9 Mon Sep 17 00:00:00 2001 From: Felix Schumacher Date: Wed, 6 Aug 2008 16:14:50 +0200 Subject: [PATCH] jcifs-0.8.1 from tgz Thu Feb 26 19:26:14 EST 2004 jcifs-0.8.1 released The decision to exclude ATTR_HIDDEN files in generic list operations has been revoked. All list methods now include all files unless specifically filtered. The following bugs have been fixed: o Previously querying the last modified time or file size immediately following a SmbFileOutputStream.write call returned old information. o The createNewFile method did not use the correct open mode. o The setLastModified method set the create time to an invalid value. --- CHANGES.txt | 15 ++++++++++++++ README.txt | 12 ++++++++++++ build.xml | 14 ++++++------- examples/Exists.java | 1 - examples/FileInfo.java | 7 +++++-- src/jcifs/smb/ServerMessageBlock.java | 36 ++++++++++++++++++---------------- src/jcifs/smb/SmbFile.java | 17 ++++++++-------- src/jcifs/smb/SmbFileOutputStream.java | 2 ++ 8 files changed, 68 insertions(+), 36 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 0e6aafb..c3786cc 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,18 @@ +Thu Feb 26 19:26:14 EST 2004 +jcifs-0.8.1 released + +The decision to exclude ATTR_HIDDEN files in generic list operations has +been revoked. All list methods now include all files unless specifically +filtered. + +The following bugs have been fixed: + + o Previously querying the last modified time or file size immediately + following a SmbFileOutputStream.write call returned old + information. + o The createNewFile method did not use the correct open mode. + o The setLastModified method set the create time to an invalid value. + Tue Feb 10 23:44:45 EST 2004 jcifs-0.8.0 released diff --git a/README.txt b/README.txt index fd30bf5..53b2e4f 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,15 @@ +Thu Feb 26 19:26:14 EST 2004 +jcifs-0.8.1 released + +Hidden files are included in all list operations unless specifically +filtered. A attribute caching bug, createNewFile open mode bug, and time +setting method bugs have been fixed. + +Tue Feb 10 23:44:45 EST 2004 +jcifs-0.8.0 released + +This completes the 0.8 beta cycle. There is no technical difference between +this release and 0.8.0b1. Tue Feb 10 23:44:45 EST 2004 jcifs-0.8.0 released diff --git a/build.xml b/build.xml index b0ed45e..21634c1 100644 --- a/build.xml +++ b/build.xml @@ -66,24 +66,24 @@ - + - + - - - + + + - + - + diff --git a/examples/Exists.java b/examples/Exists.java index 07985f7..009e210 100644 --- a/examples/Exists.java +++ b/examples/Exists.java @@ -5,7 +5,6 @@ public class Exists { public static void main( String argv[] ) throws Exception { SmbFile f = new SmbFile( argv[0] ); - System.out.println( f.length() + " bytes" ); if( f.exists() ) { System.out.println( argv[0] + " exists" ); } else { diff --git a/examples/FileInfo.java b/examples/FileInfo.java index bb5f458..d9501ef 100644 --- a/examples/FileInfo.java +++ b/examples/FileInfo.java @@ -85,7 +85,7 @@ public class FileInfo { System.out.println( " getParent: " + f.getParent() ); break; case 15: - System.out.println( " lastModified: " + sdf.format( new Date( f.lastModified() ))); + System.out.println( " lastModified: " + + f.lastModified() + ": " + sdf.format( new Date( f.lastModified() ))); break; case 16: System.out.println( "getDiskFreeSpace: " + f.getDiskFreeSpace() ); @@ -108,9 +108,12 @@ public class FileInfo { case 22: System.out.println( " canWrite: " + f.canWrite() ); break; + case 23: + System.out.println( " createTime: " + + f.createTime() + ": " + sdf.format( new Date( f.createTime() ))); + break; } i++; - if( i == 23 ) { + if( i == 24 ) { i = 0; } } while( i != end ); diff --git a/src/jcifs/smb/ServerMessageBlock.java b/src/jcifs/smb/ServerMessageBlock.java index ac92961..bf4d345 100644 --- a/src/jcifs/smb/ServerMessageBlock.java +++ b/src/jcifs/smb/ServerMessageBlock.java @@ -177,27 +177,29 @@ abstract class ServerMessageBlock { } static void writeTime( long t, byte[] dst, int dstIndex ) { - synchronized( TZ ) { - if( TZ.inDaylightTime( new Date() )) { - // in DST - if( TZ.inDaylightTime( new Date( t ))) { - // t also in DST so no correction - } else { - // t not in DST so subtract 1 hour - t -= 3600000; - } - } else { - // not in DST - if( TZ.inDaylightTime( new Date( t ))) { - // t is in DST so add 1 hour - t += 3600000; + if( t != 0L ) { + synchronized( TZ ) { + if( TZ.inDaylightTime( new Date() )) { + // in DST + if( TZ.inDaylightTime( new Date( t ))) { + // t also in DST so no correction + } else { + // t not in DST so subtract 1 hour + t -= 3600000; + } } else { - // t isn't in DST either + // not in DST + if( TZ.inDaylightTime( new Date( t ))) { + // t is in DST so add 1 hour + t += 3600000; + } else { + // t isn't in DST either + } } } - } - t = (t + MILLISECONDS_BETWEEN_1970_AND_1601) * 10000L; + t = (t + MILLISECONDS_BETWEEN_1970_AND_1601) * 10000L; + } writeLong( t, dst, dstIndex ); } diff --git a/src/jcifs/smb/SmbFile.java b/src/jcifs/smb/SmbFile.java index a4a0761..ceb6a4a 100644 --- a/src/jcifs/smb/SmbFile.java +++ b/src/jcifs/smb/SmbFile.java @@ -375,7 +375,6 @@ public class SmbFile extends URLConnection { SmbComBlankResponse blank_resp = new SmbComBlankResponse(); DfsReferral dfsReferral = null; // Only used by getDfsPath() - /** * Constructs an SmbFile representing a resource on an SMB network such as * a file or directory. See the description and examples of smb URLs above. @@ -1098,7 +1097,7 @@ The shareAccess parameter controls what permissions other clients have try { if( url.getHost().length() == 0 ) { } else if( share == null ) { - if( type == TYPE_WORKGROUP ) { + if( getType() == TYPE_WORKGROUP ) { UniAddress.getByName( url.getHost(), true ); } else { UniAddress.getByName( url.getHost() ).getHostName(); @@ -1292,10 +1291,10 @@ The shareAccess parameter controls what permissions other clients have */ public String[] list() throws SmbException { - return list( "*", ATTR_DIRECTORY | ATTR_SYSTEM, null, null ); + return list( "*", ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, null, null ); } public String[] list( SmbFilenameFilter filter ) throws SmbException { - return list( "*", ATTR_DIRECTORY | ATTR_SYSTEM, filter, null ); + return list( "*", ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, filter, null ); } /** @@ -1325,7 +1324,7 @@ The shareAccess parameter controls what permissions other clients have */ public SmbFile[] listFiles() throws SmbException { - return listFiles( "*", ATTR_DIRECTORY | ATTR_SYSTEM, null, null ); + return listFiles( "*", ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, null, null ); } /** @@ -1358,13 +1357,13 @@ The shareAccess parameter controls what permissions other clients have */ public SmbFile[] listFiles( String wildcard ) throws SmbException { - return listFiles( wildcard, ATTR_DIRECTORY | ATTR_SYSTEM, null, null ); + return listFiles( wildcard, ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, null, null ); } public SmbFile[] listFiles( SmbFilenameFilter filter ) throws SmbException { - return listFiles( "*", ATTR_DIRECTORY | ATTR_SYSTEM, filter, null ); + return listFiles( "*", ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, filter, null ); } public SmbFile[] listFiles( SmbFileFilter filter ) throws SmbException { - return listFiles( "*", ATTR_DIRECTORY | ATTR_SYSTEM, null, filter ); + return listFiles( "*", ATTR_DIRECTORY | ATTR_HIDDEN | ATTR_SYSTEM, null, filter ); } String[] list( String wildcard, int searchAttributes, SmbFilenameFilter fnf, SmbFileFilter ff ) throws SmbException { @@ -2018,7 +2017,7 @@ The shareAccess parameter controls what permissions other clients have throw new SmbException( SmbException.ERRDOS, SmbException.ERRnoaccess ); } - close( open0( O_RDWR | O_EXCL, ATTR_NORMAL, 0 ), 0L ); + close( open0( O_RDWR | O_CREAT | O_EXCL, ATTR_NORMAL, 0 ), 0L ); } void setPathInformation( int attrs, long ctime, long mtime ) throws SmbException { diff --git a/src/jcifs/smb/SmbFileOutputStream.java b/src/jcifs/smb/SmbFileOutputStream.java index fb2e6a6..d0e1f89 100644 --- a/src/jcifs/smb/SmbFileOutputStream.java +++ b/src/jcifs/smb/SmbFileOutputStream.java @@ -221,5 +221,7 @@ write, and/or delete the file while the jCIFS user has the file open. file.send( req, rsp ); } } while( len > 0 ); + + file.attrExpiration = file.sizeExpiration = 0L; } } -- 2.11.0