Skip to content

Xpp3Dom.getValue() returns null despite @NonNull annotation #388

Closed

Description

@elharo

Xpp3Dom.getValue() is annotated @NonNull (line 141) but returns value which defaults to null when constructed with Xpp3Dom(String name) (line 92). This violates the non-null contract — callers who trust the annotation and omit a null check will encounter NullPointerException.

The builder at Xpp3DomBuilder.java:201 already works around this:

element.setValue(""); // null in xpp3dom, but we don't do that around here

Fix: initialize value to "" in the one-arg constructor, or change the field declaration to private String value = "";.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions