{"record":{"id":"4d2633c72948ec31","repo":"apache/dubbo","slug":"source-null","errorCode":null,"errorMessage":"source == null","messagePattern":"source == null","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/JdkCompiler.java","lineNumber":156,"sourceCode":"        public JavaFileObjectImpl(final String baseName, final CharSequence source) {\n            super(ClassUtils.toURI(baseName + ClassUtils.JAVA_EXTENSION), Kind.SOURCE);\n            this.source = source;\n        }\n\n        JavaFileObjectImpl(final String name, final Kind kind) {\n            super(ClassUtils.toURI(name), kind);\n            source = null;\n        }\n\n        public JavaFileObjectImpl(URI uri, Kind kind) {\n            super(uri, kind);\n            source = null;\n        }\n\n        @Override\n        public CharSequence getCharContent(final boolean ignoreEncodingErrors) throws UnsupportedOperationException {\n            if (source == null) {\n                throw new UnsupportedOperationException(\"source == null\");\n            }\n            return source;\n        }\n\n        @Override\n        public InputStream openInputStream() {\n            return new ByteArrayInputStream(getByteCode());\n        }\n\n        @Override\n        public OutputStream openOutputStream() {\n            return bytecode = new ByteArrayOutputStream();\n        }\n\n        public byte[] getByteCode() {\n            return bytecode.toByteArray();\n        }\n    }","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/JdkCompiler.java#L138-L174","documentation":"Thrown by JavaFileObjectImpl.getCharContent when source is null. This happens when a JavaFileObjectImpl was constructed for output (CLASS kind) or by URI, which do not carry source text, yet the compiler framework calls getCharContent expecting to read source.","triggerScenarios":"The JSR-199 framework or internal code calls getCharContent on a JavaFileObjectImpl that was created via the (name, Kind) or (URI, Kind) constructors (source == null) instead of the (baseName, CharSequence) constructor.","commonSituations":"An internal Dubbo JdkCompiler path where the file manager hands a class-output file object to a code path that then tries to read its source. Generally an internal/library-internal condition rather than a direct user API misuse.","solutions":["This is typically internal to JdkCompiler; ensure you are using a supported Compiler SPI and not calling JavaFileObjectImpl directly.","Upgrade Dubbo to a version where the JdkCompiler file-object lifecycle is correctly managed.","If extending JdkCompiler, only call getCharContent on file objects constructed with source text."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    fileObject.getCharContent(true);\n} catch (UnsupportedOperationException e) {\n    // this file object has no source; use one created with source text\n}","preventionTips":["Do not call getCharContent on output/URI-based JavaFileObjectImpl instances.","Use the supported Compiler SPI rather than extending JdkCompiler internals directly.","Upgrade Dubbo to a version with corrected file-object lifecycle handling."],"tags":["compiler","jdk","internal","file-object"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}