You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2006/03/15 20:50:13 UTC

svn commit: r386152 - in /jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram: RamFileData.java RamFileSystem.java

Author: imario
Date: Wed Mar 15 11:50:12 2006
New Revision: 386152

URL: http://svn.apache.org/viewcvs?rev=386152&view=rev
Log:
aggresively set the lastModificationTime

Modified:
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileData.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileSystem.java

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileData.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileData.java?rev=386152&r1=386151&r2=386152&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileData.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileData.java Wed Mar 15 11:50:12 2006
@@ -81,6 +81,7 @@
 	 */
 	public void setBuffer(byte[] buffer)
 	{
+		updateLastModified();
 		this.buffer = buffer;
 	}
 
@@ -124,12 +125,17 @@
 	public void clear()
 	{
 		this.buffer = new byte[0];
-		this.lastModified = System.currentTimeMillis();
+		updateLastModified();
 		this.type = FileType.IMAGINARY;
 		this.children = Collections.synchronizedCollection(new ArrayList());
 		this.name = null;
 	}
 
+	void updateLastModified()
+	{
+		this.lastModified = System.currentTimeMillis();
+	}
+
 	/**
 	 * @return Returns the name.
 	 */
@@ -172,6 +178,7 @@
 		}
 
 		this.children.add(data);
+		updateLastModified();
 	}
 
 	/**
@@ -192,6 +199,7 @@
 			throw new FileSystemException("Child not found. " + data);
 		}
 		this.children.remove(data);
+		updateLastModified();
 	}
 
 	/**
@@ -251,6 +259,7 @@
 		byte[] newBuf = new byte[newSize];
 		System.arraycopy(this.buffer, 0, newBuf, 0, size);
 		this.buffer = newBuf;
+		updateLastModified();
 	}
 
 }

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileSystem.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileSystem.java?rev=386152&r1=386151&r2=386152&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileSystem.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ram/RamFileSystem.java Wed Mar 15 11:50:12 2006
@@ -210,6 +210,7 @@
 		}
 		// Store in cache
 		cache.put(file.getName(), file.getData());
+		file.getData().updateLastModified();
 		file.close();
 	}
 
@@ -295,16 +296,30 @@
 			try
 			{
 				InputStream is = fo.getContent().getInputStream();
-				OutputStream os = new BufferedOutputStream(memFo
-						.getOutputStream(), 512);
-				int i;
-				while ((i = is.read()) != -1)
+				try
 				{
-					os.write(i);
+					OutputStream os = new BufferedOutputStream(memFo
+							.getOutputStream(), 512);
+					int i;
+					while ((i = is.read()) != -1)
+					{
+						os.write(i);
+					}
+					os.flush();
+					os.close();
+				}
+				finally
+				{
+					try
+					{
+						is.close();
+					}
+					catch (IOException e)
+					{
+						// ignore on close exception
+						;
+					}
 				}
-				os.flush();
-				os.close();
-				is.close();
 			}
 			catch (IOException e)
 			{



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org