{"record":{"id":"e538953e9acefb3c","repo":"quarkusio/quarkus","slug":"invalid-parameter-type","errorCode":"INVALID_PARAMETER_TYPE","errorMessage":"Unknown XML Source class: {0}","messagePattern":"Unknown XML Source class: (.+?)","errorType":"error_code","errorClass":"PSQLException","httpStatus":null,"severity":"error","filePath":"extensions/jdbc/jdbc-postgresql/runtime/src/main/java/io/quarkus/jdbc/postgresql/runtime/graal/PgSQLXML.java","lineNumber":193,"sourceCode":"                DOMSource domSource = new DOMSource(builder.parse(input));\n                //noinspection unchecked\n                return (T) domSource;\n            } else if (SAXSource.class.equals(sourceClass)) {\n                XMLReader reader = getXmlFactoryFactory().createXMLReader();\n                InputSource is = new InputSource(new StringReader(data));\n                return sourceClass.cast(new SAXSource(reader, is));\n            } else if (StreamSource.class.equals(sourceClass)) {\n                return sourceClass.cast(new StreamSource(new StringReader(data)));\n            } else if (StAXSource.class.equals(sourceClass)) {\n                XMLInputFactory xif = getXmlFactoryFactory().newXMLInputFactory();\n                XMLStreamReader xsr = xif.createXMLStreamReader(new StringReader(data));\n                return sourceClass.cast(new StAXSource(xsr));\n            }\n        } catch (Exception e) {\n            throw new PSQLException(GT.tr(\"Unable to decode xml data.\"), PSQLState.DATA_ERROR, e);\n        }\n\n        throw new PSQLException(GT.tr(\"Unknown XML Source class: {0}\", sourceClass),\n                PSQLState.INVALID_PARAMETER_TYPE);\n    }\n\n    @Substitute\n    @Override\n    public synchronized String getString() throws SQLException {\n        checkFreed();\n        ensureInitialized();\n        return data;\n    }\n\n    @Substitute\n    @Override\n    public synchronized OutputStream setBinaryStream() throws SQLException {\n        checkFreed();\n        initialize();\n        active = true;\n        byteArrayOutputStream = new ByteArrayOutputStream();","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/jdbc/jdbc-postgresql/runtime/src/main/java/io/quarkus/jdbc/postgresql/runtime/graal/PgSQLXML.java#L175-L211","documentation":"PgSQLXML.getSource(sourceClass) only supports a fixed set of Source classes (DOMSource, SAXSource, StAXSource). If the requested class is not one of the supported implementations, it throws a PSQLException with SQLState INVALID_PARAMETER_TYPE and the parameterized message 'Unknown XML Source class: {0}'. This is a limitation of the substituted PgSQLXML implementation.","triggerScenarios":"Calling sqlxml.getSource(SomeCustomSource.class) or a Source subclass not in the substitution's if/else chain (e.g. a custom AbstractTransformer-based Source), so no branch matches and the fall-through throw executes.","commonSituations":"Code ported from other JDBC drivers accepting arbitrary Source types; use of library-specific Source implementations (e.g. JAXBSource) that the substituted class does not handle.","solutions":["Request only javax.xml.transform.dom.DOMSource, javax.xml.transform.sax.SAXSource, or javax.xml.transform.stax.StAXSource.","Use getString() and construct the desired Source from the returned string yourself.","For JAXB, marshal via DOMSource: sqlxml.getSource(DOMSource.class) then unmarshal from the DOM node.","Consider contributing support for the missing Source type to the extension's substitution class."],"exampleFix":"// before\nJAXBSource s = sqlxml.getSource(JAXBSource.class); // throws INVALID_PARAMETER_TYPE\n// after\nDOMSource ds = sqlxml.getSource(DOMSource.class);\nMyType v = jc.createUnmarshaller().unmarshal(ds.getNode(), MyType.class).getValue();","handlingStrategy":"type-guard","validationCode":"static boolean isSupportedSource(Class<?> c) {\n    return c == DOMSource.class || c == SAXSource.class || c == StAXSource.class;\n}","typeGuard":"static boolean supportedXmlSource(Class<? extends Source> c) {\n    return javax.xml.transform.dom.DOMSource.class.equals(c)\n        || javax.xml.transform.sax.SAXSource.class.equals(c)\n        || javax.xml.transform.stax.StAXSource.class.equals(c);\n}","tryCatchPattern":"try {\n    Source s = sqlxml.getSource(requestedClass);\n} catch (PSQLException e) {\n    if (\"INVALID_PARAMETER_TYPE\".equals(e.getSQLState()) && e.getMessage().startsWith(\"Unknown XML Source class\")) {\n        String xml = sqlxml.getString();\n        s = buildSourceManually(xml, requestedClass);\n    } else { throw e; }\n}","preventionTips":["Only request DOMSource, SAXSource, or StAXSource from PgSQLXML","Wrap custom Source needs around getString() output","Centralize SQLXML access in a helper that enforces the supported Source types"],"tags":["postgresql","sqlxml","unsupported-type","native-image"],"backgroundTag":"unsupported-source-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}