pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: eitch (@eitch) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3747: Can not set custom PGXmlFactoryFactory
Date: Tue, 29 Jul 2025 13:12:09 +0000
Message-ID: <[email protected]> (raw)

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),
```


view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #3747: Can not set custom PGXmlFactoryFactory
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox