jpush / jpush/jpush-react-native

android messageID 过长 报错 For input sting: ''

Open
#770 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.4k
Forks
348
PR merge metrics
No merged PRs in 30d

Description

你的运行环境

  • 插件版本:
    "react-native": "0.61.5",
    "jcore-react-native": "^1.7.5",
    "jpush-react-native": "^2.7.5",

重现步骤

JPush.addCustomMessagegListener(message => {
push.send(message);
});

send: (config: any) => {
console.log(config.messageID);
JPush.addLocalNotification({
...config,
messageID: config.messageID + '',
});
},

Debug logs

java.lang.NumberFormatException: For input string: "29273455998601743"
    at java.lang.Integer.parseInt(Integer.java:618)
    at java.lang.Integer.valueOf(Integer.java:801)
    at cn.jiguang.plugins.push.JPushModule.addLocalNotification(JPushModule.java:378)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:888)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
    at android.os.Looper.loop(Looper.java:213)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
    at java.lang.Thread.run(Thread.java:929)

image

修改以下代码成功

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at android/src/main/java/cn/jiguang/plugins/push/JPushModule.java:378, where addLocalNotification is shown in the stack trace. Reproduce the issue with the reported messageID through JPush.addLocalNotification, then verify the resulting notification path no longer raises NumberFormatException for the long value.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, react-native
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.