Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Remove checked Exception from ObjectFactory factory methods #45

Open
glassfishrobot opened this issue Nov 9, 2004 · 2 comments
Open

Comments

@glassfishrobot
Copy link

There is a request for JAXB 2.0 to no longer require that
the factory method signatures in ObjectFactory throw the
checked exception JAXBException.

Rationale:
In Java, creating new instances of objects do not fail with a
checked exception. This is because:

  • it's not hard to imagine how many try-catch blocks you'll
    be writing if every "new" throws an exception.
  • unlike errors like I/O problems, which you can handle gracefully,
    there's really nothing you can do to recover from failing to
    create new instances in memory.

Specific request is to change following text in Section 5.2 of JAXB 2.0 Early
Draft

A public class ObjectFactory contains:
An instance factory method signature for each Java content within the package.

Given Java content interface named Foo, here is the derived factory method:

public Foo createFoo() throws JAXBException;
An element instance factory method signature for each bound element declaration.

public IXmlElement createFoo(T elementValue)
throws JAXBException;
Dynamic instance factory allocator method signature:

public Object newInstance(Class javaContentInterface)
throws JAXBException;

Change is to delete "throws JAXBException" from above factory method
signatures of ObjectFactory.

Environment

Operating System: All
Platform: All

Affected Versions

[2.0 draft]

@glassfishrobot
Copy link
Author

Reported by @jfialli

@glassfishrobot
Copy link
Author

This issue was imported from java.net JIRA JSR222-45

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants