[
https://issues.apache.org/jira/browse/HADOOP-5596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702160#action_12702160
]
Tsz Wo (Nicholas), SZE commented on HADOOP-5596:
------------------------------------------------
- Seems to me that read and write are not consistent if EnumSetWritable.value
is an empty set. We may have the following problem:
{code}
EnumSetWritable w1 = new EnumSetWritable(EnumSet.noneOf(MyEnum.class));
w1.write(out);
...
EnumSetWritable w2 = new EnumSetWritable();
w2.readFields(in);
// w2.value is null but w1.value is an empty set
{code}
- Also, could you fix the unchecked warnings? The declaration properly should
be EnumSetWritable<E extends Enum<E>>. See also
http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html
> Make ObjectWritable support EnumSet
> -----------------------------------
>
> Key: HADOOP-5596
> URL: https://issues.apache.org/jira/browse/HADOOP-5596
> Project: Hadoop Core
> Issue Type: Improvement
> Components: io
> Reporter: He Yongqiang
> Assignee: He Yongqiang
> Attachments: Hadoop-5596-2009-03-31.patch,
> Hadoop-5596-2009-04-03.patch, Hadoop-5596-2009-04-15-2.patch,
> Hadoop-5596-2009-04-15.patch
>
>
> This is a demand for Hadoop-5438.
> Also another small improvement is that i saw that in the beginning of
> readObject, it tries to get the class from PRIMITIVE_NAMES and then conf.
> Maybe it is better to add a direct load after them if the delaredClass is
> still null. Like this:
> {code}
> String className = UTF8.readString(in);
> Class<?> declaredClass = PRIMITIVE_NAMES.get(className);
> if (declaredClass == null) {
> try {
> declaredClass = conf.getClassByName(className);
> } catch (Exception e) {
> }
> }
>
> if(declaredClass == null) {
> try {
> declaredClass = Class.forName(className);
> } catch (ClassNotFoundException e) {
> throw new RuntimeException("readObject can't find class " +
> className, e);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.