https://issues.apache.org/bugzilla/show_bug.cgi?id=49696

           Summary: Default ImageWriterRegistry instance register method
                    does not override image writers
           Product: XMLGraphicsCommons
           Version: Trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: ImageWriter
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=25835)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25835)
Adds method to ImageWriterRegistry to allow priority when registering writers

For the singleton instance of ImageWriterRegistry, there is no way to register
a new writer to override an already-registered MIME type.

ImageWriterRegistry retrieves writers based on a high-to-low priority, and
checks whether the writer is functional.

The text of the ImageWriterRegistry register method reads "If an ImageWriter
for the same target MIME type has already been registered, it is overwritten
with the new one.", but this is not a true statement.  The writer is instead
placed in an internal MIME type-specific array based on a high-to-low
preference priority.

Priorities are assigned based on the class name.  Other than adjusting the
class loader or altering the package-level default-preferred-order.properties
file, there is no way to add a new ImageWriter class name with a priority to
the registry.

New writers added via the existing register method will always receive a
priority of 0, and built-in classes for existing MIME types (JPEG, TIFF, PNG)
will always be preferred.

Proposal is 
1) leave the existing register method which preferences a higher priority over
a lower priority alone, but adjust the JavaDoc to state "If an ImageWriter for
the same target MIME type has already been registered, it is placed in an array
based on priority."

2) add a new method, register(ImageWriter writer, int priority) which will add
the priority for the writer class name to the preferred order map prior to
calling register(ImageWriter).

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to