XMLFilter cannot be overridden cleanly due to mime type clash
Original issue 361 created by tol... on 2013-08-15T23:23:59.000Z:
If I want to subclass XMLFilter and use a different MIME type, things don't quite work out. The XMLFilter constructor hard-codes MimeTypeMapper.XML_MIME_TYPE as the mime type for resources created by the filter. But the encoderManager uses the subclass's getMimeType() to create the encoder mapping. This mismatch can result in un-encoded output in target files.
I suggest adding a constructor for subclasses that accepts the overridden mime type. Patch will be attached. An allternate approach would be to hard-code MimeTypeMapper.XML_MIME_TYPE in getEncoderManager. But the first seems more correct to me.
Comments (7)
-
Account Deleted -
Account Deleted Comment 2. originally posted by tol... on 2013-08-16T15:31:54.000Z:
Patch updated with documentation.
-
Account Deleted Comment 4. originally posted by @ysavourel on 2013-08-17T09:49:00.000Z:
public XMLFilter () {
super(false, getMimeType(), IProcessor.DC_ALL);
}
Was obviously a dumb idea (too early in the morning...). Never mind.Andrew: The problem with using a constructor with a parameter is that I don't think it'll work with the dynamic creation we use in the Filter configuration mapper. But maybe that is not an issue for you.
But I cannot think of any other way.
-
Account Deleted - changed status to resolved
Comment 5. originally posted by @ysavourel on 2013-08-17T09:57:13.000Z:
This issue was closed by revision acbeb87ab74f.
-
Account Deleted Comment 6. originally posted by @ysavourel on 2013-08-17T09:57:41.000Z:
-
Account Deleted Comment 7. originally posted by tol... on 2013-08-26T19:49:16.000Z:
Sorry for the late reply...
I don't think this would be a problem for dynamic creation, since the constructor is protected and thus only for use by subclasses, which themselves can offer a no-arg constructor. Thanks for committing!
-
Account Deleted Comment 8. originally posted by @ysavourel on 2013-09-04T20:47:57.000Z:
This issue was closed by revision acbeb87ab74f.
- Log in to comment
Comment 1. originally posted by tol... on 2013-08-15T23:33:59.000Z:
Patch attached. Apply with git am < FILE.