gong commented on code in PR #4694:
URL: https://github.com/apache/incubator-inlong/pull/4694#discussion_r900853930


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/sink/ck/ClickHouseSinkOperation.java:
##########
@@ -179,60 +104,26 @@ public PageInfo<? extends SinkListResponse> 
getPageInfo(Page<StreamSinkEntity> e
     }
 
     @Override
-    public void updateOpt(SinkRequest request, String operator) {
-        String sinkType = request.getSinkType();
-        Preconditions.checkTrue(SinkType.SINK_CLICKHOUSE.equals(sinkType),
-                String.format(ErrorCodeEnum.SINK_TYPE_NOT_SAME.getMessage(), 
SinkType.SINK_CLICKHOUSE, sinkType));
-
-        StreamSinkEntity entity = 
sinkMapper.selectByPrimaryKey(request.getId());
-        Preconditions.checkNotNull(entity, 
ErrorCodeEnum.SINK_INFO_NOT_FOUND.getMessage());
+    protected void setTargetEntity(SinkRequest request, StreamSinkEntity 
targetEntity) {
+        
Preconditions.checkTrue(this.getSinkType().equals(request.getSinkType()),
+                ErrorCodeEnum.SINK_TYPE_NOT_SUPPORT.getMessage() + ": " + 
getSinkType());
         ClickHouseSinkRequest sinkRequest = (ClickHouseSinkRequest) request;
-        CommonBeanUtils.copyProperties(sinkRequest, entity, true);
         try {
             ClickHouseSinkDTO dto = 
ClickHouseSinkDTO.getFromRequest(sinkRequest);
-            entity.setExtParams(objectMapper.writeValueAsString(dto));
+            targetEntity.setExtParams(objectMapper.writeValueAsString(dto));
         } catch (Exception e) {
-            throw new 
BusinessException(ErrorCodeEnum.SINK_INFO_INCORRECT.getMessage());
+            throw new 
BusinessException(ErrorCodeEnum.SINK_SAVE_FAILED.getMessage());

Review Comment:
   I suggest print full exception stack in here and other like here. Because it 
is convenient to analyse problem when throw exception.



-- 
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]

Reply via email to