Uploaded image for project: 'Commons Sandbox'
  1. Commons Sandbox
  2. SANDBOX-441

[BeanUtils2] Handling of types that can not be instantiated in DefaultClassAccessor should be improved to give users better feedback

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: Nightly Builds
    • Component/s: BeanUtils2
    • Labels:
      None

      Description

      The handling of InstantiationException could be improved to give users a better feedback of what went wrong (see JavaDoc of Class<T>.newInstance() for reasons why instantiation may fail):

      • check if a default constructor is available and throw NoSuchConstructorException if not
      • else throw BeanInstantiationException but inspect beanType in BeanInstantiationException and set specific messages for the following cases:
        • BeanType is abstract
        • BeanType is an interface
        • BeanType is a primitive type
        • BeanType is an array type
        • BeanType represents void
        • if none of the above use a generic message

        Attachments

          Activity

            People

            • Assignee:
              britter Benedikt Ritter
              Reporter:
              britter Benedikt Ritter
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: