Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-516

Change exception message when a setter can not be invoked

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.3.0
    • None
    • Core
    • None
    • Java SUN version 1.5.0_08-b03 / MySQL 5.0

    Description

      When the object to be mapped redefined #toString() method we can have the following exception message:
      java.lang.RuntimeException: Error setting property 'setPrice' of '32 (name)'. Cause: java.lang.IllegalArgumentException
      at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:52)

      Furthermore, the value to set is not describe in this message.

      A message like the following will ease finding the reason :
      java.lang.RuntimeException: Error setting property 'setPrice' for object of type 'com....MyBean' with value of type 'null'. Cause: java.lang.IllegalArgumentException
      at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:52)

      In my case this was because the database column was null and i was expecting a float which can not be set to null.

      This might also come in handy when the type of the setter is not compatible with the type of the value.

      Attachments

        1. IBATIS-516-2008-06-13.patch
          1 kB
          Sébastien Launay

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yabon Sébastien Launay
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: