You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/11/02 02:26:21 UTC

[GitHub] [incubator-eventmesh] xwm1992 commented on a diff in pull request #2063: Add type check before convert

xwm1992 commented on code in PR #2063:
URL: https://github.com/apache/incubator-eventmesh/pull/2063#discussion_r1011089505


##########
eventmesh-connector-plugin/eventmesh-connector-standalone/src/main/java/org/apache/eventmesh/connector/standalone/broker/task/SubScribeTask.java:
##########
@@ -57,8 +57,9 @@ public void run() {
                 if (offset == null) {
                     CloudEvent message = standaloneBroker.getMessage(topicName);
                     if (message != null) {
-                        if (message.getExtension("offset") != null) {
-                            offset = new AtomicInteger((int) message.getExtension("offset"));
+                        Object tmpOffset = message.getExtension("offset");
+                        if (tmpOffset instanceof Integer) {
+                            offset = new AtomicInteger((Integer) tmpOffset);

Review Comment:
   Here please change to `new AtomicInteger(Integer.parseInt(tmpOffset.toString()))`



-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org