Results 1 to 3 of 3

Thread: how to convert IllegalAccessException to DataAccessException

Hybrid View

  1. #1

    Default how to convert IllegalAccessException to DataAccessException

    I use class "org.apache.commons.beanutils.BeanUtils" in a dao method.

    it throws java.lang.IllegalAccessException and
    java.lang.reflect.InvocationTargetException.

    I want to convert the exceptions to org.springframework.dao.DataAccessException;

    which implements of DataAccessException seemly for instead?

  2. #2
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    DataAccessExceptions are converted from SQLExceptions using a SQLExceptionTranslator which is a property of the JdbcTemplate class. It doesn't appear there is a way to capture non-SQLExceptions and convert them to another exception type.

    The only way I think of fixing this is to implement a subclass of BeanUtils to intercept the desired exceptiosn and throw DataAccessExceptions.

  3. #3
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    You can simply catch the exception and throw an appropriate subclass of DataAccessException (probably a subclass of one of the existing classes lower down).
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

Similar Threads

  1. catching DataAccessException
    By Cuball in forum Data
    Replies: 3
    Last Post: May 20th, 2005, 07:40 AM
  2. Replies: 38
    Last Post: May 11th, 2005, 02:49 PM
  3. Convert legacy code to Spring
    By rwspeh in forum Data
    Replies: 3
    Last Post: Feb 23rd, 2005, 09:59 PM
  4. Failed to convert property value
    By humberto in forum Container
    Replies: 1
    Last Post: Dec 14th, 2004, 09:32 PM
  5. Failed to convert property
    By pak in forum Web
    Replies: 2
    Last Post: Sep 14th, 2004, 03:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •