< prev index next >

src/java.desktop/share/classes/java/beans/XMLEncoder.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -612,15 +612,17 @@
                 throw new NullPointerException((target == null ? "target" :
                                                 "methodName") + " should not be null");
             }
 
             if (isArgument && target instanceof Field && methodName.equals("get")) {
-                Field f = (Field)target;
+                Field f = (Field) target;
+                if (Modifier.isStatic(f.getModifiers())) {
                 writeln("<object class=" + quote(f.getDeclaringClass().getName()) +
                         " field=" + quote(f.getName()) + "/>");
                 return;
             }
+            }
 
             Class<?> primitiveType = primitiveTypeFor(value.getClass());
             if (primitiveType != null && target == value.getClass() &&
                 methodName.equals("new")) {
                 String primitiveTypeName = primitiveType.getName();
< prev index next >