MASON-INTEREST-L Archives

March 2013

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Type:
multipart/alternative; boundary=047d7bb04d7ef905e404d7d55e2d
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Subject:
From:
Mark Coletti <[log in to unmask]>
Date:
Wed, 13 Mar 2013 17:48:48 -0400
In-Reply-To:
MIME-Version:
1.0
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Parts/Attachments:
text/plain (1231 bytes) , text/html (2013 bytes)
On Wed, Mar 6, 2013 at 6:30 PM, Matt L. Miller <[log in to unmask]> wrote:

> While I was doing some failure-mode testing on some code that uses
> GeoMASON,
> I have noticed that ShapeFileImporter.read(URL, GeomVectorField, Bag,
> Class)
> has a problem with its exception handling.
>
> The method declares that it throws a FileNotFoundException; however, it
> actually never does so -- the entire IO section is surrounded in a try ...
>

Actually, it does throw a FileNotFoundException:

    250         try
    251         {
    252             FileInputStream shpFileInputStream = new
FileInputStream(shpFile.getFile());
    253
    254             if (shpFileInputStream == null)
    255             {
    256                 throw new FileNotFoundException(shpFile.getFile());
    257             }



> catch that catches all IOExceptions and prints an error message, but does
> NOT propagate the exception back up to the caller. Thus, you get an error
> message on STDERR, but then your code continues blithely along.
>
> I would recommend either adding a
>
> throw e;
>
>
You're right.  It's bad form to catch exceptions without propagating them.
 I've committed changes whereby the exceptions are rethrown with
appropriate changes to the function signatures.


ATOM RSS1 RSS2