When I run the following code to test copying a directory, I get a System.IO.IOException when fileInfo.CopyTo method is being called. The error message is: "The process cannot access the file 'C:\CopyDirectoryTest1\temp.txt' because it is being used by another process."
It seems like there's a lock on file1 ("C:\CopyDirectoryTest1\tem...
The question proper
Has anyone experienced this exception on a single core machine?
The I/O operation has been aborted because of either a thread exit or an application request.
Some context
On a single CPU system, only one MSIL instruction is executed at a time, threads notwithstanding. Between operations, the runtime gets to do...
Hi,
After an upgrade to XP and Java 1.6 one of our intranet apps is experiencing a problem when running a java applet in the browser. The java applet is a document editor and accepts a parameter to where the document is located. I assume it copies this file to the users machine for editing. I wish I knew more but I don't have the source...
Hi All -
Final Edit: I found a solution to the problem (at the bottom of the question).
I've got an Nunit problem that's causing me grief. Edit: actually it looks more like a SQLite problem, but I'm not 100% certain yet.
My TestFixture has a setup that generates a random filename that's used as a SQLite database in each of my tests.
...
There are multiple places in an application which call XmlWriter.Create on the same file, all accessed through the following function. When one calls while another is still writing, I get an IOException. What's the best way to lock or synchronize access?
Here's the function that's being used:
public void SaveToDisk()
{
...
I am attempting to delete a file using J2ME's FileConnection.delete() method, but I an IOException is being thrown each time I call the delete() method. I have written a conditional statement to verify the existence of the file, but irregardless of that fact, an IOException is thrown.
According to the FileConnection API, when delete() i...
I have a WinForms client-server app running on a Novell network that produces the following error when connecting to the lone Windows 2003 Server on the network:
TYPE: System.IO.IOException
MSG: Logon failure: unknown user name or bad password.
SOURCE: mscorlib
SITE: WinIOError
at System.IO.__Error.WinIOError(Int32 errorCode, String...
After providing some answers here, and reading some comments, it would seem that, in practice IOException is never thrown on close for file I/O.
Are there any cases in which calling close on a Stream/Reader/Writer actually throws an IOException?
If an exception is actually thrown, how should it be dealt with?
...
I'm writing a test for a piece of code that has an IOException catch in it that I'm trying to cover. The try/catch looks something like this:
try {
oos = new ObjectOutputStream(new FileOutputStream(cacheFileName));
} catch (IOException e) {
LOGGER.error("Bad news!", e);
} finally {
The easiest way seems to make FileOutputStrea...
I try to open a large number of files but after 5000 files or so I get
Exception in thread "Main" java.io.IOException: The device is not connected
Is this the expected behavior? Is there a way around it? I want to leave my code as straightforward as possible.
...
I have an application where i sometimes need to read from file being written to and as a result being locked. As I have understood from other questions i should catch the IOException and retry until i can read.
But my question is how do i know for certain that the file is locked and that it is not another IOExcetpion that occurs.
...
bash-3.2$ echo $JAVA_HOME
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
bash-3.2$ bin/hadoop dfs -copyFromLocal conf /user/yokkom/input2
bash-3.2$ bin/hadoop jar hadoop-*-examples.jar grep input2 output 'dfs[a-z.]+'
09/04/17 10:09:32 INFO mapred.FileInputFormat: Total input paths to process : 10
09/04/17 10:09:33 INFO ma...
hey, I have this code that should save a java.util.Vector of custom serializable classes:
if(filename.equals("")){
javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
if(fc.showSaveDialog(this) == javax.swing.JFileChooser.APPROVE_OPTION){
filename = fc.getSelectedFile().toString();
}
}
try{
java.io.FileOutputStream fos =...
Hi
I have a web application running in cluster mode with a load balancer.
It consists in two tomcats (T1, and T2) addressing only one DB.
T2 is nfs mounted to T1. This is the only dofference between both nodes.
I have a java method generating some files. If the request
runs on T1 there is no problem but if the request is running on node...
Hey,
I have implemented a csv file builder that takes in an xml document applies a xsl transform to it and appends it to a file.
public class CsvBatchPrinter : BaseBatchPrinter
{
public CsvBatchPrinter() : base(".csv")
{
RemoveDiatrics = false;
}
protected override void PrintDocuments(System.Collections.Generic.List<XmlDocument>...
I am looking for a list of platform-specific (JRE-specific) of IOException messages indicating disk is full or out of space.
So far I have:
Windows: "There is not enough space on the disk"
Solaris/Linux?: "Not enough space"
GCJ: "No space left on device".
I wish Java would make an IOException subclass for this...
...
Hi, I'm trying to write a small application that simply reads data from a socket, extracts some information (two integers) from the data and sends the extracted information off on a serial port.
The idea is that it should start and just keep going. In short, it works, but not for long. After a consistently short period I start to recei...
Dear all,
I've been working in this small piece of code that seems trivial but still i cannot really see where is the problem. My functions does a pretty simple thing. Opens a file, copy its contents, replace a string inside and copy it back to the original file (a simple search and replace inside a text file then).
I didn't really know ...
I want to create and open a file but only if it doesnt exist. I dont want to use a File.Exists because a thread by switch after it creating a file with the same name.
How do i check if the exception System.IO.IOException was caused by the file existing? I prefer not to parse the error msg (even tho it can be as simple as .indexOf("exist...
I'm running into a strange problem while reading from an InputStream on the Android platform. I'm not sure if this is an Android specific issue, or something I'm doing wrong in general.
The only thing that is Android specific is this call:
InputStream is = getResources().openRawResource(R.raw.myfile);
This returns an InputStream for...