Skip to content

Null check in DOM attribute #2581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/util/DOM.java
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ else if (key instanceof String)
}
else
{
throw new IllegalArgumentException(String.valueOf(key));
throw new IllegalArgumentException("Bad attribute in '" + tagName + "' element: " + String.valueOf(key));
}
}
// TODO again horrible hack, make this go away
Expand Down
2 changes: 2 additions & 0 deletions api/src/org/labkey/api/util/DisplayElementBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public BUILDER onClick(String onClick)

public BUILDER attributes(Map<String, String> attributes)
{
if (attributes != null && attributes.containsKey(null))
throw new NullPointerException("Unexpected key value in attributes");
if (attributes != null && !attributes.isEmpty())
this.attributes = new TreeMap<>(attributes);
else
Expand Down