[jira] [Commented] (IO-337) ByteOrderMark can be refactored as an enum
[ https://issues.apache.org/jira/browse/IO-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17800316#comment-17800316 ] Niall Pemberton commented on IO-337: I will -1 this change if it is ever committed since it would severely limit what is provided by the current implementation and prevent it being used for its original purpose. As I said in 2015 and if you look at the Wikidepdia page, there are more than 5 listed BOMs. The original poster is incorrect in stating that it is mis-used in XMLReader - from memory this code came from Tika and was the original purpose for being developed (XML Guessing). In its current implementation this functionality can be used for other purposes, not just BOMs and so its a regressive step to make a change that would prevent that and limit functionality. This works perfectly well as it is and I see zero benefit and lots of downsides to this change, so we should close this as WONTFIX > ByteOrderMark can be refactored as an enum > -- > > Key: IO-337 > URL: https://issues.apache.org/jira/browse/IO-337 > Project: Commons IO > Issue Type: New Feature >Reporter: Yaniv Kunda >Priority: Minor > Fix For: 3.x > > Attachments: ByteOrderMark-enum.patch > > > ByteOrderMark is used primarily for encapsulating the data regarding to > Unicode BOMs. Since those are fixed, it would make sense to make it an enum, > instead of a public class. > I have attached a patch that only covers ByteOrderMark itself, including an > additional getCharset() utility method, and toString() simplification. > This patch does not cover: > 1) Its incorrect use (per its perceived purpose) in > XmlStreamReader.XML_GUESS_BYTES > 2) The now-unnecessary tests -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (IO-337) ByteOrderMark can be refactored as an enum
[ https://issues.apache.org/jira/browse/IO-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17800314#comment-17800314 ] Gary D. Gregory commented on IO-337: We can reconsider for the next major version IMO. > ByteOrderMark can be refactored as an enum > -- > > Key: IO-337 > URL: https://issues.apache.org/jira/browse/IO-337 > Project: Commons IO > Issue Type: New Feature >Reporter: Yaniv Kunda >Priority: Minor > Attachments: ByteOrderMark-enum.patch > > > ByteOrderMark is used primarily for encapsulating the data regarding to > Unicode BOMs. Since those are fixed, it would make sense to make it an enum, > instead of a public class. > I have attached a patch that only covers ByteOrderMark itself, including an > additional getCharset() utility method, and toString() simplification. > This patch does not cover: > 1) Its incorrect use (per its perceived purpose) in > XmlStreamReader.XML_GUESS_BYTES > 2) The now-unnecessary tests -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (IO-337) ByteOrderMark can be refactored as an enum
[ https://issues.apache.org/jira/browse/IO-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17800311#comment-17800311 ] Elliotte Rusty Harold commented on IO-337: -- IMHO this one is probably not worth the incompatibility. The existing approach meets all needs even if it's not technically the most beautiful solution. We should close this one as won't do. > ByteOrderMark can be refactored as an enum > -- > > Key: IO-337 > URL: https://issues.apache.org/jira/browse/IO-337 > Project: Commons IO > Issue Type: New Feature >Reporter: Yaniv Kunda >Priority: Minor > Attachments: ByteOrderMark-enum.patch > > > ByteOrderMark is used primarily for encapsulating the data regarding to > Unicode BOMs. Since those are fixed, it would make sense to make it an enum, > instead of a public class. > I have attached a patch that only covers ByteOrderMark itself, including an > additional getCharset() utility method, and toString() simplification. > This patch does not cover: > 1) Its incorrect use (per its perceived purpose) in > XmlStreamReader.XML_GUESS_BYTES > 2) The now-unnecessary tests -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (IO-337) ByteOrderMark can be refactored as an enum
[ https://issues.apache.org/jira/browse/IO-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14567831#comment-14567831 ] Niall Pemberton commented on IO-337: There are more byte order marks than the five defined as static variables in the ByteOrderMark class. This way we just define the common ones, but allow people to construct others. Switching to an enum would prevent this. It would also prevent the (ab)use of this class to detect starting bytes such as the BOMInputStream does with the XML_GUESS_BYTES boms that it constructs. http://en.wikipedia.org/wiki/Byte_order_mark > ByteOrderMark can be refactored as an enum > -- > > Key: IO-337 > URL: https://issues.apache.org/jira/browse/IO-337 > Project: Commons IO > Issue Type: New Feature >Reporter: Yaniv Kunda >Priority: Minor > Attachments: ByteOrderMark-enum.patch > > > ByteOrderMark is used primarily for encapsulating the data regarding to > Unicode BOMs. Since those are fixed, it would make sense to make it an enum, > instead of a public class. > I have attached a patch that only covers ByteOrderMark itself, including an > additional getCharset() utility method, and toString() simplification. > This patch does not cover: > 1) Its incorrect use (per its perceived purpose) in > XmlStreamReader.XML_GUESS_BYTES > 2) The now-unnecessary tests -- This message was sent by Atlassian JIRA (v6.3.4#6332)
Re: [jira] [Commented] (IO-337) ByteOrderMark can be refactored as an enum
An Enum sounds good but it has to work with all of the current code. We can then deprecate the current one. What would be the name of this Enum? Maybe this is a change we should wait to introduce if and when we break BC in the future. Gary On Jun 17, 2012, at 8:00, "Sebb (JIRA)" wrote: > >[ > https://issues.apache.org/jira/browse/IO-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13393532#comment-13393532 > ] > > Sebb commented on IO-337: > - > > Nice idea, but this will break compatibility. > > It might be possible to introduce a new class for the enum, and deprecate the > old class and methods that use it. > >> ByteOrderMark can be refactored as an enum >> -- >> >>Key: IO-337 >>URL: https://issues.apache.org/jira/browse/IO-337 >>Project: Commons IO >> Issue Type: New Feature >> Reporter: Yaniv Kunda >> Priority: Minor >>Attachments: ByteOrderMark-enum.patch >> >> >> ByteOrderMark is used primarily for encapsulating the data regarding to >> Unicode BOMs. Since those are fixed, it would make sense to make it an enum, >> instead of a public class. >> I have attached a patch that only covers ByteOrderMark itself, including an >> additional getCharset() utility method, and toString() simplification. >> This patch does not cover: >> 1) Its incorrect use (per its perceived purpose) in >> XmlStreamReader.XML_GUESS_BYTES >> 2) The now-unnecessary tests > > -- > This message is automatically generated by JIRA. > If you think it was sent incorrectly, please contact your JIRA > administrators: > https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa > For more information on JIRA, see: http://www.atlassian.com/software/jira > >
[jira] [Commented] (IO-337) ByteOrderMark can be refactored as an enum
[ https://issues.apache.org/jira/browse/IO-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13393532#comment-13393532 ] Sebb commented on IO-337: - Nice idea, but this will break compatibility. It might be possible to introduce a new class for the enum, and deprecate the old class and methods that use it. > ByteOrderMark can be refactored as an enum > -- > > Key: IO-337 > URL: https://issues.apache.org/jira/browse/IO-337 > Project: Commons IO > Issue Type: New Feature >Reporter: Yaniv Kunda >Priority: Minor > Attachments: ByteOrderMark-enum.patch > > > ByteOrderMark is used primarily for encapsulating the data regarding to > Unicode BOMs. Since those are fixed, it would make sense to make it an enum, > instead of a public class. > I have attached a patch that only covers ByteOrderMark itself, including an > additional getCharset() utility method, and toString() simplification. > This patch does not cover: > 1) Its incorrect use (per its perceived purpose) in > XmlStreamReader.XML_GUESS_BYTES > 2) The now-unnecessary tests -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira