Details
-
Bug
-
Resolution: Fixed
-
P2
-
8
-
b119
-
b122
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8031362 | 9 | Joe Wang | P2 | Closed | Fixed | b01 |
JDK-8031255 | 8u5 | Joe Wang | P2 | Resolved | Fixed | b03 |
Description
XMLOutputFactory XMLOutputFactory.newFactory(java.lang.String, java.lang.ClassLoader) method spec contains following:
* <p>
* Note that this is a new method that replaces the deprecated
* {@link #newInstance(java.lang.String, java.lang.ClassLoader)
* newInstance(String factoryId, ClassLoader classLoader)} method.
* No changes in behavior are defined by this replacement method relative
* to the deprecated method.
* </p>
In particular it claims "No changes in behavior are defined by this replacement method relative to the deprecated method."
I believe that this assertion is actually invalid and should be corrected because mentioned deprecated newInstance method returns XMLInputFactory instead of XMLOutputFactory:
/**
* Create a new instance of the factory.
*
* @param factoryId Name of the factory to find, same as
* a property name
* @param classLoader classLoader to use
* @return the factory implementation
* @throws FactoryConfigurationError if an instance of this factory cannot be loaded
*
* @deprecated This method has been deprecated because it returns an
* instance of XMLInputFactory, which is of the wrong class.
* Use the new method {@link #newFactory(java.lang.String,
* java.lang.ClassLoader)} instead.
*/
XMLInputFactory XMLOutputFactory.newInstance(String factoryId, ClassLoader classLoader)
Thus the behavior is different.
I believe spec should describe the difference between these two methods in a way that the behavior of both deprecated and deprecating ones would be clear and unambiguous.
* <p>
* Note that this is a new method that replaces the deprecated
* {@link #newInstance(java.lang.String, java.lang.ClassLoader)
* newInstance(String factoryId, ClassLoader classLoader)} method.
* No changes in behavior are defined by this replacement method relative
* to the deprecated method.
* </p>
In particular it claims "No changes in behavior are defined by this replacement method relative to the deprecated method."
I believe that this assertion is actually invalid and should be corrected because mentioned deprecated newInstance method returns XMLInputFactory instead of XMLOutputFactory:
/**
* Create a new instance of the factory.
*
* @param factoryId Name of the factory to find, same as
* a property name
* @param classLoader classLoader to use
* @return the factory implementation
* @throws FactoryConfigurationError if an instance of this factory cannot be loaded
*
* @deprecated This method has been deprecated because it returns an
* instance of XMLInputFactory, which is of the wrong class.
* Use the new method {@link #newFactory(java.lang.String,
* java.lang.ClassLoader)} instead.
*/
XMLInputFactory XMLOutputFactory.newInstance(String factoryId, ClassLoader classLoader)
Thus the behavior is different.
I believe spec should describe the difference between these two methods in a way that the behavior of both deprecated and deprecating ones would be clear and unambiguous.
Attachments
Issue Links
- backported by
-
JDK-8031255 XMLOutputFactory.newFactory(String, ClassLoader) - incorrect specification
- Resolved
-
JDK-8031362 XMLOutputFactory.newFactory(String, ClassLoader) - incorrect specification
- Closed