L
laredotornado
Hi,
I'm using Java 1.6. My FindBugs tool is giving me this error ...
Non-transient non-serializable instance field in serializable
class
Class com.myco.clearing.common.xml.Node defines non-transient non-
serializable instance field children
The class and its private fields that Findbugs is complaining about
are below ...
public class Node implements Serializable, Comparable<Node>,
Cloneable {
/**
* For serializable classes.
*/
private static final long serialVersionUID = 1L;
/**
* Unique id
*/
private long id;
/**
* Node Name
*/
private String name;
/**
* Node value
*/
private String value = "";
/**
* Child nodes
*/
private List<Node> children;
/**
* Parent node
*/
private Node parent;
/**
* Node attributes
*/
private List<Attribute> attributes;
I have a public, no-argument constructor and getter/setter methods for
all the fields you see (except serialVersionUID). Any ideas why
FindBugs is complaining about the field "children" or how I can
troubleshoot this further?
The above references a class, "Attribute". The relevant parts are
below. Same thing -- a public, no-argument constructor and getter/
setter methods present.
public class Attribute implements Serializable, Cloneable {
/**
* For serializable classes.
*/
private static final long serialVersionUID = 1L;
/**
* Attribute Name
*/
private String name;
/**
* Attribute value, can be local or inherited
*/
private String value;
/**
* Node having this attribute
*/
private Node node;
Thanks, - Dave
I'm using Java 1.6. My FindBugs tool is giving me this error ...
Non-transient non-serializable instance field in serializable
class
Class com.myco.clearing.common.xml.Node defines non-transient non-
serializable instance field children
The class and its private fields that Findbugs is complaining about
are below ...
public class Node implements Serializable, Comparable<Node>,
Cloneable {
/**
* For serializable classes.
*/
private static final long serialVersionUID = 1L;
/**
* Unique id
*/
private long id;
/**
* Node Name
*/
private String name;
/**
* Node value
*/
private String value = "";
/**
* Child nodes
*/
private List<Node> children;
/**
* Parent node
*/
private Node parent;
/**
* Node attributes
*/
private List<Attribute> attributes;
I have a public, no-argument constructor and getter/setter methods for
all the fields you see (except serialVersionUID). Any ideas why
FindBugs is complaining about the field "children" or how I can
troubleshoot this further?
The above references a class, "Attribute". The relevant parts are
below. Same thing -- a public, no-argument constructor and getter/
setter methods present.
public class Attribute implements Serializable, Cloneable {
/**
* For serializable classes.
*/
private static final long serialVersionUID = 1L;
/**
* Attribute Name
*/
private String name;
/**
* Attribute value, can be local or inherited
*/
private String value;
/**
* Node having this attribute
*/
private Node node;
Thanks, - Dave