|
31 | 31 |
|
32 | 32 | import javax.sql.DataSource; |
33 | 33 |
|
| 34 | +import org.jspecify.annotations.Nullable; |
| 35 | + |
34 | 36 | import org.springframework.core.convert.ConversionException; |
35 | 37 | import org.springframework.core.convert.ConversionService; |
36 | 38 | import org.springframework.jdbc.core.JdbcTemplate; |
@@ -224,7 +226,8 @@ private void setAces(AclImpl acl, List<AccessControlEntryImpl> aces) { |
224 | 226 | * @param findNow Long-based primary keys to retrieve |
225 | 227 | * @param sids |
226 | 228 | */ |
227 | | - private void lookupPrimaryKeys(final Map<Serializable, Acl> acls, final Set<Long> findNow, final List<Sid> sids) { |
| 229 | + private void lookupPrimaryKeys(final Map<Serializable, Acl> acls, final Set<Long> findNow, |
| 230 | + final @Nullable List<Sid> sids) { |
228 | 231 | Assert.notNull(acls, "ACLs are required"); |
229 | 232 | Assert.notEmpty(findNow, "Items to find now required"); |
230 | 233 | String sql = computeRepeatingSql(this.lookupPrimaryKeysWhereClause, findNow.size()); |
@@ -264,7 +267,7 @@ private void setKeys(PreparedStatement ps, Set<Long> findNow) throws SQLExceptio |
264 | 267 | * automatically create entries if required) |
265 | 268 | */ |
266 | 269 | @Override |
267 | | - public final Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids) { |
| 270 | + public final Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, @Nullable List<Sid> sids) { |
268 | 271 | Assert.isTrue(this.batchSize >= 1, "BatchSize must be >= 1"); |
269 | 272 | Assert.notEmpty(objects, "Objects to lookup required"); |
270 | 273 | // Map<ObjectIdentity,Acl> |
@@ -323,7 +326,7 @@ public final Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects, |
323 | 326 | * properly-configured parent ACLs. |
324 | 327 | */ |
325 | 328 | private Map<ObjectIdentity, Acl> lookupObjectIdentities(final Collection<ObjectIdentity> objectIdentities, |
326 | | - List<Sid> sids) { |
| 329 | + @Nullable List<Sid> sids) { |
327 | 330 | Assert.notEmpty(objectIdentities, "Must provide identities to lookup"); |
328 | 331 |
|
329 | 332 | // contains Acls with StubAclParents |
@@ -399,8 +402,10 @@ private AclImpl convert(Map<Serializable, Acl> inputMap, Long currentIdentity) { |
399 | 402 | } |
400 | 403 |
|
401 | 404 | // Now we have the parent (if there is one), create the true AclImpl |
| 405 | + Sid owner = inputAcl.getOwner(); |
| 406 | + Assert.isTrue(owner != null, "Owner is required"); |
402 | 407 | AclImpl result = new AclImpl(inputAcl.getObjectIdentity(), inputAcl.getId(), this.aclAuthorizationStrategy, |
403 | | - this.grantingStrategy, parent, null, inputAcl.isEntriesInheriting(), inputAcl.getOwner()); |
| 408 | + this.grantingStrategy, parent, null, inputAcl.isEntriesInheriting(), owner); |
404 | 409 |
|
405 | 410 | // Copy the "aces" from the input to the destination |
406 | 411 |
|
@@ -506,9 +511,9 @@ private class ProcessResultSet implements ResultSetExtractor<Set<Long>> { |
506 | 511 |
|
507 | 512 | private final Map<Serializable, Acl> acls; |
508 | 513 |
|
509 | | - private final List<Sid> sids; |
| 514 | + private final @Nullable List<Sid> sids; |
510 | 515 |
|
511 | | - ProcessResultSet(Map<Serializable, Acl> acls, List<Sid> sids) { |
| 516 | + ProcessResultSet(Map<Serializable, Acl> acls, @Nullable List<Sid> sids) { |
512 | 517 | Assert.notNull(acls, "ACLs cannot be null"); |
513 | 518 | this.acls = acls; |
514 | 519 | this.sids = sids; // can be null |
@@ -579,6 +584,9 @@ private void convertCurrentResultIntoObject(Map<Serializable, Acl> acls, ResultS |
579 | 584 | // target id type, e.g. UUID. |
580 | 585 | Serializable identifier = (Serializable) rs.getObject("object_id_identity"); |
581 | 586 | identifier = BasicLookupStrategy.this.aclClassIdUtils.identifierFrom(identifier, rs); |
| 587 | + if (identifier == null) { |
| 588 | + throw new IllegalStateException("Identifier cannot be null"); |
| 589 | + } |
582 | 590 | ObjectIdentity objectIdentity = BasicLookupStrategy.this.objectIdentityGenerator |
583 | 591 | .createObjectIdentity(identifier, rs.getString("class")); |
584 | 592 |
|
@@ -670,7 +678,7 @@ public boolean isGranted(List<Permission> permission, List<Sid> sids, boolean ad |
670 | 678 | } |
671 | 679 |
|
672 | 680 | @Override |
673 | | - public boolean isSidLoaded(List<Sid> sids) { |
| 681 | + public boolean isSidLoaded(@Nullable List<Sid> sids) { |
674 | 682 | throw new UnsupportedOperationException("Stub only"); |
675 | 683 | } |
676 | 684 |
|
|
0 commit comments