pxb1988/dex2jar · error · RuntimeException
can't pase string
Error message
can't pase string
What it means
Jasmin grammar's string-escape parser handles octal escapes like \NNN by counting following octal digits (x). If an escape sequence has zero valid octal digits (a lone backslash or \ followed by a non-octal char), it throws RuntimeException("can't pase string") — a typo of 'parse'.
Solutions
- Escape backslashes as \\ and use valid octal escapes (\0-\377) in the string
- Replace bad escapes with the intended character or Unicode \uXXXX as supported
- Fix the generator producing the .j file to emit valid escapes
Example fix
// before ldc "C:\temp\x" // after ldc "C:\\temp\\x"
Defensive patterns
Strategy: validation
Validate before calling
static String validateEscapes(String s) {
for (int i = 0; i < s.length(); i++)
if (s.charAt(i) == '\\' && (i + 1 >= s.length() || !isOctal(s.charAt(i + 1)))) throw new IllegalArgumentException("bad escape at " + i);
return s;
}
static boolean isOctal(char c) { return c >= '0' && c <= '7'; } Prevention
- Always escape backslashes as \\ in generated .j strings
- Lint jasmin string literals for lone or invalid escapes
- Fix the upstream string emitter to use valid octal/unicode escapes
When it happens
Trigger: A .j jasmin source file contains a malformed escape inside a string literal, e.g. .limit or ldc with "abc\q" or a trailing backslash.
Common situations: Hand-written or generated jasmin files with typos in escapes; tools exporting strings with backslashes not escaped; Windows-style paths pasted into string literals.
Related errors
- Fail to assemble
- not support access flags " + name
- can't get owner and type from '"+str+"'
- RecognitionException on invalid annotation element keyword…
- RecognitionException on invalid annotation element keyword…
AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08).
Data as JSON: /api/errors/65e69d33d35fa270.
Report an issue: GitHub.
Appendix: source
Thrown at d2j-jasmin/src/main/antlr3/com/googlecode/d2j/jasmin/Jasmin.g:217
i += 2;
break;
case 'u':
String sub = str.substring(i + 2, i + 6);
sb.append((char) Integer.parseInt(sub, 16));
i += 6;
break;
default:
int x = 0;
while (x < 3) {
char e = str.charAt(i + 1 + x);
if (e >= '0' && e <= '7') {
x++;
} else {
break;
}
}
if (x == 0) {
throw new RuntimeException("can't pase string");
}
sb.append((char) Integer.parseInt(str.substring(i + 1, i + 1 + x), 8));
i += 1 + x;
}
} else {
sb.append(c);
i++;
}
}
return sb.toString();
}
private static int getAcc(String name) {
if (name.equals("public")) {
return ACC_PUBLIC;
} else if (name.equals("private")) {
return ACC_PRIVATE;
View on GitHub (pinned to b5bda4fb49)