File.listFiles(FilenameFilter) will return null on an IOError while File.mkdir() and File.mkdirs() return false on an IOError. In both cases, there is no IOException thrown so you have no idea what the problem is. Currently nothing is done in the former while an IllegalStateException is thrown in the latter – neither of which is really appropriate.
What’s the right thing to do here. It’s probably not our problem, but we’d like to present something half informative to the user (and not submit a bug report necessarily).
P.S.: I think I asked a similar question once before, but I forgot what the answer was and I can’t remember enough of the context to search my e-mail. So… don’t make fun of me.
rk1
January 12, 2009, 5:53am
2
I’d say instantiate an IOException with an appropriate message, call fillInStackTrace(), and call either ReadErrorDialog or WriteErrorDialog.
rk
Post generated using Mail2Forum (mail2forum.com )
Thus spake “Rodney Kinney”:
I would only do it that way if you’re not in a place where it’s
appropriate to just throw a new IOException.
–
J.
Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org
Post generated using Mail2Forum (mail2forum.com )
I’m actually with Rodney on this one. In this particular case, the user had a partition that would not mount reliably in Vista. It appears that the partition unmounted itself – or otherwise vanished. Hence the error.
I don’t think we want to use VASSAL’s exception mechanism in this. For whatever reason, the Java developers, chose not to throw an IOException in File.listFiles(). I’d have to propogate throws clauses up the call hierarchy.
Or I could throw an IOError but that could still generate a bug report.
2009/1/12 Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net )>
Post generated using Mail2Forum (mail2forum.com )
Michael,
One of the errors is being caused by trying to create the _ext, active and inactive directories. These should probably show a WiteErrorDialog.
Brent.
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 9:37 PM Michael Kiefte wrote:
I’m actually with Rodney on this one. In this particular case, the user had a partition that would not mount reliably in Vista. It appears that the partition unmounted itself – or otherwise vanished. Hence the error.
I don’t think we want to use VASSAL’s exception mechanism in this. For whatever reason, the Java developers, chose not to throw an IOException in File.listFiles(). I’d have to propogate throws clauses up the call hierarchy.
Or I could throw an IOError but that could still generate a bug report.
2009/1/12 Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net )>
Post generated using Mail2Forum (mail2forum.com )
That’s a different one.
The one I’m talking about is
[ 2499446 ] ABR: NullPointerException
The user no longer able to read the extensions directory. The poster said he was having partition issues. dir.listFiles() returns null on IOErrors.
The other issue is something else that I’m working on… Although it’s the same module (CC:E). I chalked that up to the popularity of the updated CC:E modules. Makes me wonder though.
But the first fellow definitely said he had partition issues and it made sense to me. But you’re right. If I go the same route on the other one, it will be WriteErrorDialog. I’m waiting to hear back from the second CC:E bug submitter.
2009/1/12 Brent Easton <b.easton@exemail.com.au (b.easton@exemail.com.au )>
Michael,
One of the errors is being caused by trying to create the _ext, active and inactive directories. These should probably show a WiteErrorDialog.
Brent.
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 9:37 PM Michael Kiefte wrote:
I’m actually with Rodney on this one. In this particular case, the user had a partition that would not mount reliably in Vista. It appears that the partition unmounted itself – or otherwise vanished. Hence the error.
I don’t think we want to use VASSAL’s exception mechanism in this. For whatever reason, the Java developers, chose not to throw an IOException in File.listFiles(). I’d have to propogate throws clauses up the call hierarchy.
Or I could throw an IOError but that could still generate a bug report.
2009/1/12 Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net )>
Post generated using Mail2Forum (mail2forum.com )
Tim_M
January 13, 2009, 1:57am
7
Quick chime in here. Online on server talking to a guy – he had issues with adding extensions, then he couldn’t find the file, it had somehow been placed in the inactive folder (he found it after I had him search for files *.vmdx) still couldn’t get it to work so re d/l then everything worked normal
From: messages-bounces@forums.vassalengine.org [mailto:messages-bounces@forums.vassalengine.org ] On Behalf Of Michael Kiefte
Sent: Monday, January 12, 2009 7:51 PM
To: VASSAL Engine Forums Mailing List
Subject: Re: [Developers]Exceptionless IOErrors
That’s a different one.
The one I’m talking about is
[ 2499446 ] ABR: NullPointerException
The user no longer able to read the extensions directory. The poster said he was having partition issues. dir.listFiles() returns null on IOErrors.
The other issue is something else that I’m working on… Although it’s the same module (CC:E). I chalked that up to the popularity of the updated CC:E modules. Makes me wonder though.
But the first fellow definitely said he had partition issues and it made sense to me. But you’re right. If I go the same route on the other one, it will be WriteErrorDialog. I’m waiting to hear back from the second CC:E bug submitter.
One of the errors is being caused by trying to create the _ext, active and inactive directories. These should probably show a WiteErrorDialog.
Brent.
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 9:37 PM Michael Kiefte wrote:
I’m actually with Rodney on this one. In this particular case, the user had a partition that would not mount reliably in Vista. It appears that the partition unmounted itself – or otherwise vanished. Hence the error.
I don’t think we want to use VASSAL’s exception mechanism in this. For whatever reason, the Java developers, chose not to throw an IOException in File.listFiles(). I’d have to propogate throws clauses up the call hierarchy.
Or I could throw an IOError but that could still generate a bug report.
I would only do it that way if you’re not in a place where it’s
appropriate to just throw a new IOException.
–
J.
Post generated using Mail2Forum (mail2forum.com )
[ 2499446 ] ABR: NullPointerException
On this one, I tend to agree with your earlier email. If Java doesn’t throw an Exception, then we can just ignore it. The problem is actually a bug in Vassal assuming that dir.listFiles() is always non-null. Just code around that and do nothing if dir.listFiles() is null. From Vassal’s point of view, that is the correct thing to do since we could not read any extensions to load.
If you make the WriteDialogError change for the other error, then they should have already got a dialog telling them that Vassal could not create the module_ext diretory to alert them to a problem.
B.
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 9:51 PM Michael Kiefte wrote:
That’s a different one.
The one I’m talking about is
[ 2499446 ] ABR: NullPointerException
The user no longer able to read the extensions directory. The poster said he was having partition issues. dir.listFiles() returns null on IOErrors.
The other issue is something else that I’m working on… Although it’s the same module (CC:E). I chalked that up to the popularity of the updated CC:E modules. Makes me wonder though.
But the first fellow definitely said he had partition issues and it made sense to me. But you’re right. If I go the same route on the other one, it will be WriteErrorDialog. I’m waiting to hear back from the second CC:E bug submitter.
2009/1/12 Brent Easton <b.easton@exemail.com.au (b.easton@exemail.com.au )>
Michael,
One of the errors is being caused by trying to create the _ext, active and inactive directories. These should probably show a WiteErrorDialog.
Brent.
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 9:37 PM Michael Kiefte wrote:
I’m actually with Rodney on this one. In this particular case, the user had a partition that would not mount reliably in Vista. It appears that the partition unmounted itself – or otherwise vanished. Hence the error.
I don’t think we want to use VASSAL’s exception mechanism in this. For whatever reason, the Java developers, chose not to throw an IOException in File.listFiles(). I’d have to propogate throws clauses up the call hierarchy.
Or I could throw an IOError but that could still generate a bug report.
2009/1/12 Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net )>
Post generated using Mail2Forum (mail2forum.com )
I’m not sure we should ignore it. dir.listFiles() returns null when something bad has happened. If the dir is empty, it returns an empty array.
Personally, I’d like to know if something bad is happening to my hard drive.
2009/1/12 Brent Easton <b.easton@exemail.com.au (b.easton@exemail.com.au )>
[ 2499446 ] ABR: NullPointerException
On this one, I tend to agree with your earlier email. If Java doesn’t throw an Exception, then we can just ignore it. The problem is actually a bug in Vassal assuming that dir.listFiles() is always non-null. Just code around that and do nothing if dir.listFiles() is null. From Vassal’s point of view, that is the correct thing to do since we could not read any extensions to load.
If you make the WriteDialogError change for the other error, then they should have already got a dialog telling them that Vassal could not create the module_ext diretory to alert them to a problem.
B.
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 9:51 PM Michael Kiefte wrote:
That’s a different one.
The one I’m talking about is
[ 2499446 ] ABR: NullPointerException
The user no longer able to read the extensions directory. The poster said he was having partition issues. dir.listFiles() returns null on IOErrors.
The other issue is something else that I’m working on… Although it’s the same module (CC:E). I chalked that up to the popularity of the updated CC:E modules. Makes me wonder though.
But the first fellow definitely said he had partition issues and it made sense to me. But you’re right. If I go the same route on the other one, it will be WriteErrorDialog. I’m waiting to hear back from the second CC:E bug submitter.
2009/1/12 Brent Easton <b.easton@exemail.com.au (b.easton@exemail.com.au )>
Michael,
One of the errors is being caused by trying to create the _ext, active and inactive directories. These should probably show a WiteErrorDialog.
Brent.
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 9:37 PM Michael Kiefte wrote:
I’m actually with Rodney on this one. In this particular case, the user had a partition that would not mount reliably in Vista. It appears that the partition unmounted itself – or otherwise vanished. Hence the error.
I don’t think we want to use VASSAL’s exception mechanism in this. For whatever reason, the Java developers, chose not to throw an IOException in File.listFiles(). I’d have to propogate throws clauses up the call hierarchy.
Or I could throw an IOError but that could still generate a bug report.
2009/1/12 Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net )>
Post generated using Mail2Forum (mail2forum.com )
mkiefte
January 13, 2009, 2:23am
10
Did he post a bug or was he just saying?
2009/1/12 Tim McCaron <timothy.mccarron@sbcglobal.net (timothy.mccarron@sbcglobal.net )>
Quick chime in here. Online on server talking to a guy – he had issues with adding extensions, then he couldn’t find the file, it had somehow been placed in the inactive folder (he found it after I had him search for files *.vmdx) still couldn’t get it to work so re d/l then everything worked normal
From: messages-bounces@forums.vassalengine.org (messages-bounces@forums.vassalengine.org ) [mailto:messages-bounces@forums.vassalengine.org (messages-bounces@forums.vassalengine.org )] On Behalf Of Michael Kiefte
Sent: Monday, January 12, 2009 7:51 PM
To: VASSAL Engine Forums Mailing List
Subject: Re: [Developers]Exceptionless IOErrors
That’s a different one.
The one I’m talking about is
[ 2499446 ] ABR: NullPointerException
The user no longer able to read the extensions directory. The poster said he was having partition issues. dir.listFiles() returns null on IOErrors.
The other issue is something else that I’m working on… Although it’s the same module (CC:E). I chalked that up to the popularity of the updated CC:E modules. Makes me wonder though.
But the first fellow definitely said he had partition issues and it made sense to me. But you’re right. If I go the same route on the other one, it will be WriteErrorDialog. I’m waiting to hear back from the second CC:E bug submitter.
One of the errors is being caused by trying to create the _ext, active and inactive directories. These should probably show a WiteErrorDialog.
Brent.
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 9:37 PM Michael Kiefte wrote:
I’m actually with Rodney on this one. In this particular case, the user had a partition that would not mount reliably in Vista. It appears that the partition unmounted itself – or otherwise vanished. Hence the error.
I don’t think we want to use VASSAL’s exception mechanism in this. For whatever reason, the Java developers, chose not to throw an IOException in File.listFiles(). I’d have to propogate throws clauses up the call hierarchy.
Or I could throw an IOError but that could still generate a bug report.
I would only do it that way if you’re not in a place where it’s
appropriate to just throw a new IOException.
–
J.
Post generated using Mail2Forum (mail2forum.com )
Tim_M
January 13, 2009, 2:28am
11
He said he didn’t get an ABR. Probably user error with Manager, no way to be certain
From: messages-bounces@forums.vassalengine.org [mailto:messages-bounces@forums.vassalengine.org ] On Behalf Of Michael Kiefte
Sent: Monday, January 12, 2009 8:24 PM
To: VASSAL Engine Forums Mailing List
Subject: Re: [Developers]Exceptionless IOErrors
Did he post a bug or was he just saying?
M.
2009/1/12 Tim McCaron <timothy.mccarron@sbcglobal.net (timothy.mccarron@sbcglobal.net )>
Quick chime in here. Online on server talking to a guy – he had issues with adding extensions, then he couldn’t find the file, it had somehow been placed in the inactive folder (he found it after I had him search for files *.vmdx) still couldn’t get it to work so re d/l then everything worked normal
Post generated using Mail2Forum (mail2forum.com )
*********** REPLY SEPARATOR ***********
On 12/01/2009 at 10:23 PM Michael Kiefte wrote:
I’m not sure we should ignore it. dir.listFiles() returns null when
something bad has happened. If the dir is empty, it returns an empty
array.
I believe it means the directory does not exist because the call to ensureExists() failed. The proper place to report an error is when the attempt to create the directory fails i.e. The IllegalStateExceptions now being thrown in ensureExists(). If these where replaced with WroteDialogErrors telling the user that the blah blah directory connt be created, then they are getting an appropriate error message and the extensions loader can happily (and quietly) get on with loading nothing.
That’s what the WriteDialogError is for in ensureExists() if for.
B.
Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org
Post generated using Mail2Forum (mail2forum.com )
Thus spake “Michael Kiefte”:
I’m actually with Rodney on this one. In this particular case, the user had
a partition that would not mount reliably in Vista. It appears that the
partition unmounted itself – or otherwise vanished. Hence the error.
I don’t think we want to use VASSAL’s exception mechanism in this. For
whatever reason, the Java developers, chose not to throw an IOException in
File.listFiles(). I’d have to propogate throws clauses up the call
hierarchy.
I’m agreeing with you—it sound like you’re not in a place where it’s
appropriate to throw, so handle the error locally.
–
J.
Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org
Post generated using Mail2Forum (mail2forum.com )
mkiefte:
File.listFiles(FilenameFilter) will return null on an IOError while File.mkdir() and File.mkdirs() return false on an IOError. In both cases, there is no IOException thrown so you have no idea what the problem is. Currently nothing is done in the former while an IllegalStateException is thrown in the latter – neither of which is really appropriate.
What’s the right thing to do here. It’s probably not our problem, but we’d like to present something half informative to the user (and not submit a bug report necessarily).
When you asked this I had fogotten about the FileUtils class I wrote some
time ago. It has mkdirs() and delete() methods which fail with an IOException.
mkiefte
January 22, 2009, 3:27pm
15
However, I’m not sure that’s really appropriate either. If the user is suffereing a hard-drive failure, we can’t really help.
2009/1/22 uckelman <messages@forums.vassalengine.org (messages@forums.vassalengine.org )>
Post generated using Mail2Forum (mail2forum.com )
Thus spake Michael Kiefte:
The point of this is to not write lots of boilerplate error-handling code.
If the user has a failing hard drive, we won’t know it anyway, since Java
doesn’t give us any diagnostic messages with these methods.
J.
Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org
Post generated using Mail2Forum (mail2forum.com )
mkiefte
January 23, 2009, 1:31am
17
Okay, I see your point.
Right now, what happens in the ModuleManager works (although no error is given) so I’m inclined to leave it as is. However, I’m now thinking that a warning dialog should at least be displayed. The selected extension will work for the current invocation, but no extensions directory will be created if there’s an error.
Do you want me to backport the warning into 3.1?
2009/1/22 Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net )>
Post generated using Mail2Forum (mail2forum.com )
mkiefte
January 23, 2009, 1:42am
18
Slight mental lapse there. I did include the warning dialog.
Nevertheless, it works, so I’ll leave it as is.
2009/1/22 Michael Kiefte <mkiefte@dal.ca (mkiefte@dal.ca )>
Okay, I see your point.
Right now, what happens in the ModuleManager works (although no error is given) so I’m inclined to leave it as is. However, I’m now thinking that a warning dialog should at least be displayed. The selected extension will work for the current invocation, but no extensions directory will be created if there’s an error.
Do you want me to backport the warning into 3.1?
2009/1/22 Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net )>
Post generated using Mail2Forum (mail2forum.com )
Thus spake Michael Kiefte:
Okay, I see your point.
Right now, what happens in the ModuleManager works (although no error is
given) so I’m inclined to leave it as is. However, I’m now thinking that a
warning dialog should at least be displayed. The selected extension will
work for the current invocation, but no extensions directory will be created
if there’s an error.
Do you want me to backport the warning into 3.1?
Not unless you really want to. We should fix it in the trunk, though.
–
J.
Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org
Post generated using Mail2Forum (mail2forum.com )