Skip to content
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

Fix NPE when trying to resolve guards #1067

Merged
merged 3 commits into from
May 30, 2024
Merged
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -421,31 +421,33 @@ private void unregister(
private final class NameResolver
{
private final int namespaceId;
private final Matcher matchName;
private final ThreadLocal<Matcher> matchName;

private NameResolver(
int namespaceId)
{
this.namespaceId = namespaceId;
this.matchName = NamespaceAdapter.PATTERN_NAME.matcher("");
this.matchName = new ThreadLocal<>();
attilakreiner marked this conversation as resolved.
Show resolved Hide resolved
}

private long resolve(
String name)
{
long id = 0L;

if (name != null && matchName.reset(name).matches())
if (name != null)
attilakreiner marked this conversation as resolved.
Show resolved Hide resolved
{
String ns = matchName.group("namespace");
String n = matchName.group("name");
matchName.set(NamespaceAdapter.PATTERN_NAME.matcher(name));
attilakreiner marked this conversation as resolved.
Show resolved Hide resolved
if (matchName.get().matches())
{
String ns = matchName.get().group("namespace");
String n = matchName.get().group("name");

int nsid = ns != null ? supplyId.applyAsInt(ns) : namespaceId;
int nid = supplyId.applyAsInt(n);
int nsid = ns != null ? supplyId.applyAsInt(ns) : namespaceId;
int nid = supplyId.applyAsInt(n);

id = NamespacedId.id(nsid, nid);
id = NamespacedId.id(nsid, nid);
}
}

return id;
}

Expand Down
Loading