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

Add voteWatch issue
    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Environment:
      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

              • Assignee:
                Unassigned
                Reporter:
                yabon Sébastien Launay

                Dates

                • Created:
                  Updated:

                  Issue deployment