[jOOQ/jOOQ#13499] UnqualifiedName.name can be null

This commit is contained in:
Lukas Eder 2022-05-02 13:40:27 +02:00
parent b7fc10238c
commit 8139c613b3
2 changed files with 12 additions and 3 deletions

View File

@ -268,8 +268,14 @@ final class QualifiedName extends AbstractName {
if (hash == null) {
int h = 1;
for (int i = 0; i < qualifiedName.length; i++)
h = 31 * h + qualifiedName[i].name.hashCode();
for (int i = 0; i < qualifiedName.length; i++) {
UnqualifiedName n = qualifiedName[i];
if (n.name == null)
h = 31 * h + 0;
else
h = 31 * h + n.name.hashCode();
}
hash = h;
}

View File

@ -172,6 +172,9 @@ final class UnqualifiedName extends AbstractName {
// [#13499] Since QualifiedName and UnqualifiedName can be equal, both
// need the same hashCode() computation
return 31 * 1 + name.hashCode();
if (name == null)
return 0;
else
return 31 * 1 + name.hashCode();
}
}