healchow commented on code in PR #4291:
URL: https://github.com/apache/inlong/pull/4291#discussion_r907987980
##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/impl/DefaultInlongStreamBuilder.java:
##########
@@ -204,24 +204,26 @@ private void initOrUpdateSource() {
final String streamId = streamInfo.getInlongStreamId();
List<SourceListResponse> sourceListResponses =
managerClient.listSources(groupId, streamId);
List<String> updateSourceNames = Lists.newArrayList();
- for (SourceListResponse sourceListResponse : sourceListResponses) {
- final String sourceName = sourceListResponse.getSourceName();
- final int id = sourceListResponse.getId();
- if (sourceRequests.get(sourceName) == null) {
- boolean isDelete = managerClient.deleteSource(id);
- if (!isDelete) {
- throw new RuntimeException(String.format("Delete source=%s
failed", sourceListResponse));
- }
- } else {
- SourceRequest sourceRequest = sourceRequests.get(sourceName);
- sourceRequest.setId(id);
- Pair<Boolean, String> updateState =
managerClient.updateSource(sourceRequest);
- if (!updateState.getKey()) {
- throw new RuntimeException(String.format("Update source=%s
failed with err=%s", sourceRequest,
- updateState.getValue()));
+ if (sourceListResponses != null && sourceListResponses.size() > 0) {
+ for (SourceListResponse sourceListResponse : sourceListResponses) {
+ final String sourceName = sourceListResponse.getSourceName();
+ final int id = sourceListResponse.getId();
+ if (sourceRequests.get(sourceName) == null) {
+ boolean isDelete = managerClient.deleteSource(id);
+ if (!isDelete) {
+ throw new RuntimeException(String.format("Delete
source=%s failed", sourceListResponse));
Review Comment:
Suggested change the exception message to `throw new
RuntimeException(String.format("Delete source failed by id=%s", id));`, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]