{"record":{"id":"bb6b2df72b15fbb1","repo":"skylot/jadx","slug":"centrality-state-is-not-supported-for","errorCode":null,"errorMessage":"Centrality state is not supported for {}","messagePattern":"Centrality state is not supported for (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/dex/visitors/finaly/traverser/state/TraverserState.java","lineNumber":97,"sourceCode":"\n\t\tsb.append(secondIndent);\n\t\tTraverserBlockInfo blockInsnInfo = getBlockInsnInfo();\n\t\tif (blockInsnInfo != null) {\n\t\t\tsb.append(blockInsnInfo.toString(secondIndent));\n\t\t} else {\n\t\t\tsb.append(\"NO ACTIVE BLOCK\");\n\t\t}\n\t\tsb.append(System.lineSeparator());\n\n\t\tsb.append(baseIndent);\n\t\tsb.append(\"}\");\n\t\treturn sb.toString();\n\t}\n\n\tpublic final CentralityState getCentralityState() {\n\t\tCentralityState underlying = getUnderlyingCentralityState();\n\t\tif (underlying == null) {\n\t\t\tthrow new UnsupportedOperationException(\"Centrality state is not supported for \" + getClass().getName());\n\t\t}\n\t\treturn underlying;\n\t}\n\n\tpublic final @Nullable TraverserBlockInfo getBlockInsnInfo() {\n\t\treturn getUnderlyingBlockInsnInfo();\n\t}\n\n\tpublic final GlobalTraverserSourceState getGlobalState() {\n\t\treturn getComparatorState().getGlobalStateFor(this);\n\t}\n}\n","sourceCodeStart":79,"sourceCodeEnd":110,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/visitors/finaly/traverser/state/TraverserState.java#L79-L110","documentation":"Thrown as UnsupportedOperationException by TraverserState.getCentralityState() when getUnderlyingCentralityState() returns null. CentralityState tracks whether a traverser state allows central (merged) output and which output registers are permitted. Not all state types carry centrality — terminal states, global source states, and some cache-recovery states intentionally return null. Calling getCentralityState() on such a state is a programming error: the caller must check via the underlying accessor or ensure the state type supports centrality before calling.","triggerScenarios":"A visitor or handler calls state.getCentralityState() on a state subclass whose getUnderlyingCentralityState() returns null. This happens when code assumes all states have centrality but encounters a terminal or transitional state. Note that TraverserState.toString() safely checks for null before calling getCentralityState(), so only direct external callers are affected.","commonSituations":"New visitor or handler code added to the finally traverser that does not guard for null centrality. Typically surfaces during testing on edge-case inputs that produce terminal states early in traversal.","solutions":["Report to jadx developers with the input and stack trace.","Workaround: disable the finally extraction pass.","If developing jadx, call getUnderlyingCentralityState() (or the public getBlockInsnInfo()) first and skip centrality-dependent logic when null."],"exampleFix":"// before\nCentralityState cs = state.getCentralityState();\nboolean allowsCentral = cs.getAllowsCentral();\n\n// after\nCentralityState cs = state.getUnderlyingCentralityState();\nif (cs == null) {\n    return; // this state type does not support centrality\n}\nboolean allowsCentral = cs.getAllowsCentral();","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Check for null centrality before calling getCentralityState()\nCentralityState cs = state.getUnderlyingCentralityState();\nif (cs == null) {\n    // This state type does not support centrality\n    return;\n}\n// Safe to use cs\nboolean allowsCentral = cs.getAllowsCentral();","tryCatchPattern":null,"preventionTips":["Always use getUnderlyingCentralityState() (nullable) instead of getCentralityState() (throws).","When writing new finally-traverser code, test with inputs that produce terminal states early.","Note that TraverserState.toString() already handles null safely — follow its pattern."],"tags":["jadx","decompiler","finally-traverser","unsupported-operation","null-check"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}