Exceptionless IOErrors

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).

  • M.

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.

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.

  • M.

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:

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.

  • M.

2009/1/12 Brent Easton <b.easton@exemail.com.au (b.easton@exemail.com.au)>

Post generated using Mail2Forum (mail2forum.com)

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:

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:

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.

  • M.

2009/1/12 Brent Easton <b.easton@exemail.com.au (b.easton@exemail.com.au)>

Post generated using Mail2Forum (mail2forum.com)

Did he post a bug or was he just saying?

  • M.

2009/1/12 Tim McCaron <timothy.mccarron@sbcglobal.net (timothy.mccarron@sbcglobal.net)>

Post generated using Mail2Forum (mail2forum.com)

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)

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 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)

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.

However, I’m not sure that’s really appropriate either. If the user is suffereing a hard-drive failure, we can’t really help.

  • M.

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)

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?

  • M.

2009/1/22 Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net)>

Post generated using Mail2Forum (mail2forum.com)

Slight mental lapse there. I did include the warning dialog.

Nevertheless, it works, so I’ll leave it as is.

  • M.

2009/1/22 Michael Kiefte <mkiefte@dal.ca (mkiefte@dal.ca)>

Post generated using Mail2Forum (mail2forum.com)

Thus spake Michael Kiefte:

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)