Skip to content

Commit

Permalink
fix Unhandled npe, IllegalArgumentException
Browse files Browse the repository at this point in the history
Signed-off-by: qGYdXbY2 <[email protected]>
  • Loading branch information
qGYdXbY2 committed Nov 15, 2024
1 parent 37d59d8 commit 19b5adc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ protected Handler<RoutingContext> createMaxRequestSizeHandler() {
}
}
}
context.next();
try{ context.next(); }
catch(IllegalArgumentException e)
{ sendErrorResponse(context, new HttpException(BAD_REQUEST,"", e));
return;
}
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,16 @@ public Future<Space> deleteSpace(Marker marker, String spaceId) {
logger.info(marker, "Deleting space ID: {}", spaceId);
return get(marker, spaceId)
.onFailure(t -> logger.error(marker, "Failure to get space ID: {} during space deletion", spaceId, t))
.onSuccess(space -> logger.info(marker, "Space ID: {} has been retrieved", space.getId()))
.compose(space -> {
if (space == null) {
String errMsg = String.format("Space ID: %s is null after retrieval during space deletion", spaceId);
logger.error(marker,errMsg);
return Future.failedFuture(errMsg);
} else {
logger.info(marker, "Space ID: {} has been retrieved", space.getId());
return Future.succeededFuture(space);
}
})
.compose(space -> deleteSpaceFromPackages(marker, space).map(space))
.compose(space -> {
Promise<Space> p = Promise.promise();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,11 @@ private static Future<Void> updateReadOnlyHeadVersion(Marker marker, Space space
Space.resolveConnector(marker, space.getStorage().getId())
.onSuccess(connector -> RpcClient.getInstanceFor(connector).execute(marker, event, ar -> {
ChangesetsStatisticsResponse response = (ChangesetsStatisticsResponse) ar.result();
space.setReadOnlyHeadVersion(response.getMaxVersion());
p.complete();
if( response != null )
{ space.setReadOnlyHeadVersion(response.getMaxVersion());
p.complete();
}
else p.fail("failed to get Changeset statistics");
}))
.onFailure(p::fail);
return p.future();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ private static Stream<Arguments> provideParameters() {
Arguments.of(false,null,false,null),
Arguments.of(false,null,false,propertyFilter),
Arguments.of(false, spatialSearchGeom,false,null),
Arguments.of(false, spatialSearchGeom,false,propertyFilter),
Arguments.of(false, spatialSearchGeom,true,null),
Arguments.of(false, spatialSearchGeom,false,propertyFilter),
Arguments.of(false, spatialSearchGeom,true,propertyFilter),

Arguments.of(true,null,false,null),
Arguments.of(true,null,false,propertyFilter),
Arguments.of(true, spatialSearchGeom,false,null),
Arguments.of(true, spatialSearchGeom,false,propertyFilter),
Arguments.of(true, spatialSearchGeom,true,null),
Arguments.of(true, spatialSearchGeom,false,propertyFilter),
Arguments.of(true, spatialSearchGeom,true,propertyFilter)
);
}
Expand Down

0 comments on commit 19b5adc

Please sign in to comment.