patterntesting.exception.io
Class IOExceptionHelper

java.lang.Object
  extended by patterntesting.exception.io.IOExceptionHelper

public final class IOExceptionHelper
extends Object

Since:
10.06.2009
Author:
oliver

Method Summary
static FileNotFoundException getBetterFileNotFoundException(FileNotFoundException ioe, File file)
          If the cause of a FileNotFoundException is a missing directory you will get a DirNotFoundException as return value.
static IOException getBetterIOException(IOException ioe, File file)
          In contrast to the original IOException the file name will be appear alway as absolute file name.
static IOException getBetterIOException(IOException ioe, String filename)
           
static DirNotFoundException getDirNotFoundException(IOException ioe, File dir)
          At the moment this is only a simple constructor call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBetterIOException

public static IOException getBetterIOException(IOException ioe,
                                               File file)
In contrast to the original IOException the file name will be appear alway as absolute file name. The cause of the given IOException is ignored for the moment bcause the constructor IOException(String s, Throwable t) is not available in Java 5.

Parameters:
ioe - the original IOException
file - the file
Returns:
a better IOException

getBetterIOException

public static IOException getBetterIOException(IOException ioe,
                                               String filename)
Parameters:
ioe - the original IOException
filename - which caused the IOExeption
Returns:
a better IOException

getBetterFileNotFoundException

public static FileNotFoundException getBetterFileNotFoundException(FileNotFoundException ioe,
                                                                   File file)
If the cause of a FileNotFoundException is a missing directory you will get a DirNotFoundException as return value.

Parameters:
ioe - the original FileNotFoundException
file - the cause of the FileNotFoundException
Returns:
a FileNotFoundException or a DirNotFoundException

getDirNotFoundException

public static DirNotFoundException getDirNotFoundException(IOException ioe,
                                                           File dir)
At the moment this is only a simple constructor call. But when we switch to Java6 we will evaluate the cause of the given IOException.

Parameters:
ioe - the IOException with the cause
dir - the directory
Returns:
a DirNotFoundException


Copyright © 2009-2010 PatternTesting Team. All Rights Reserved.