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

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Nightly Builds
    • Nightly Builds
    • BeanUtils2
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: