Message-ID: From: "eitch (@eitch)" To: "pgjdbc/pgjdbc" Date: Tue, 29 Jul 2025 13:12:09 +0000 Subject: [pgjdbc/pgjdbc] issue #3747: Can not set custom PGXmlFactoryFactory List-Id: X-GitHub-Author-Id: 245382 X-GitHub-Author-Login: eitch X-GitHub-Issue: 3747 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: closed X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3747 Content-Type: text/plain; charset=utf-8 When i try to set a custom PGXmlFactoryFactory with the following implementation: ```java public class CachingPGXmlFactoryFactory implements PGXmlFactoryFactory { @Override public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { return this.documentBuilder; } @Override public TransformerFactory newTransformerFactory() { return this.transformerFactory; } @Override public SAXTransformerFactory newSAXTransformerFactory() { return this.saxTransformerFactory; } @Override public XMLInputFactory newXMLInputFactory() { return this.xmlInputFactory; } @Override public XMLOutputFactory newXMLOutputFactory() { return this.xmlOutputFactory; } @Override public XMLReader createXMLReader() throws SAXException { return this.xmlReader; } } ``` Then i get the following error: ``` Connection property xmlFactoryFactory must implement PGXmlFactoryFactory: li.strolch.persistence.postgresql.CachingPGXmlFactoryFactory ``` I thought i messed up, so i simply used the default factory and i get the same exception: ``` Connection property xmlFactoryFactory must implement PGXmlFactoryFactory: org.postgresql.xml.DefaultPGXmlFactoryFactory ``` When i look at the code, i see this: ```java if (!clazz.isAssignableFrom(PGXmlFactoryFactory.class)) { throw new PSQLException( GT.tr("Connection property xmlFactoryFactory must implement PGXmlFactoryFactory: {0}", xmlFactoryFactoryClass), ``` In my opinion, the two should be switched as such: ```java if (!PGXmlFactoryFactory.class.isAssignableFrom(clazz)) { throw new PSQLException( GT.tr("Connection property xmlFactoryFactory must implement PGXmlFactoryFactory: {0}", xmlFactoryFactoryClass), ```