star-micronics / react-native-star-io10

react-native-star-io10 is a library for supporting application development for Star Micronics devices.
Other
91 stars 55 forks source link

Possible cause of the `empty String` error? #130

Open ncpa0cpl opened 4 days ago

ncpa0cpl commented 4 days ago

Description

At my work we've encountered an issue like this: when calling the StarPrinter.getStatus() we'd get an empty String exception on one of the production devices, it happens only on one of them, and started happening after a network outage. Looking through the stack trace it appears that the SDK parses a string into a number, but the string happens to be empty hence the error. Though we can not think of what could be causing this, in the first place what numbers are there to be parsed in a getStatus() call?

Could someone shed some light on what could possible be the cause of this?

Your device where the bug occurs

Your printer

SDK Version: 1.6.0

Additional context

Here's the stack trace of the error that we are getting:

{
        "0": {
            "file": "FloatingDecimal.java",
            "methodName": "readJavaFormatString",
            "lineNumber": 1842,
            "class": "sun.misc.FloatingDecimal"
        },
        "1": {
            "file": "FloatingDecimal.java",
            "methodName": "parseDouble",
            "lineNumber": 110,
            "class": "sun.misc.FloatingDecimal"
        },
        "2": {
            "file": "Double.java",
            "methodName": "parseDouble",
            "lineNumber": 538,
            "class": "java.lang.Double"
        },
        "3": {
            "file": "SourceFile",
            "methodName": "c",
            "lineNumber": 15,
            "class": "com.starmicronics.stario10.starxpandcommand.json.b"
        },
        "4": {
            "file": "SourceFile",
            "methodName": "f",
            "lineNumber": 53,
            "class": "com.starmicronics.stario10.starxpandcommand.json.b"
        },
        "5": {
            "file": "SourceFile",
            "methodName": "a",
            "lineNumber": 1,
            "class": "com.starmicronics.stario10.starxpandcommand.json.b"
        },
        "6": {
            "file": "SourceFile",
            "methodName": "b",
            "lineNumber": 1,
            "class": "com.starmicronics.stario10.autoswitchinterface.a$a"
        },
        "7": {
            "file": "SourceFile",
            "methodName": "a",
            "lineNumber": 3,
            "class": "com.starmicronics.stario10.autoswitchinterface.a$a"
        },
        "8": {
            "file": "SourceFile",
            "methodName": "a",
            "lineNumber": 12,
            "class": "com.starmicronics.stario10.StarPrinter"
        },
        "9": {
            "file": "SourceFile",
            "methodName": "a",
            "lineNumber": 19,
            "class": "com.starmicronics.stario10.StarPrinter"
        },
        "10": {
            "file": "SourceFile",
            "methodName": "b",
            "lineNumber": 2,
            "class": "com.starmicronics.stario10.StarPrinter"
        },
        "11": {
            "file": "SourceFile",
            "methodName": "access$internalOpen",
            "lineNumber": 1,
            "class": "com.starmicronics.stario10.StarPrinter"
        },
        "12": {
            "file": "SourceFile",
            "methodName": "invokeSuspend",
            "lineNumber": 77,
            "class": "com.starmicronics.stario10.StarPrinter$s"
        },
        "13": {
            "file": "ContinuationImpl.kt",
            "methodName": "resumeWith",
            "lineNumber": 8,
            "class": "hn.a"
        },
        "14": {
            "file": "DispatchedTask.kt",
            "methodName": "run",
            "lineNumber": 117,
            "class": "bo.s0"
        },
        "15": {
            "file": "CoroutineScheduler.kt",
            "methodName": "run",
            "lineNumber": 98,
            "class": "io.a$a"
        }
}
PawelLampliapps commented 1 day ago

It is also worth to mention that recycling power on the device and the printer doesn't help. Only after uninstalling the app and installing it again, we can establish connection with the printer. I was looking through issues in this repo and in https://github.com/star-micronics/StarXpand-SDK-Android, and I didn't find anything similar except this issue: https://github.com/star-micronics/StarXpand-SDK-Android/issues/19 where reinstall was also the only solution. In first comment, it was told that it is possible that it is caused by "recycling stored values". Is there a way for clearing those values as a temporary fix?