jpush / jpush/jpush-react-native
android messageID 过长 报错 For input sting: ''
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)

修改以下代码成功

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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