Skip to content

Commit

Permalink
chore: replace deprecated clazz.newInstance() with .getDeclaredConstr…
Browse files Browse the repository at this point in the history
…uctor().newInstance()
  • Loading branch information
vlsi committed Mar 11, 2023
1 parent ca25d10 commit 35431d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ public Object getObject(String type, @Nullable String value, byte @Nullable [] b
// point, etc).

if (klass != null) {
obj = klass.newInstance();
obj = klass.getDeclaredConstructor().newInstance();
obj.setType(type);
if (byteValue != null && obj instanceof PGBinaryObject) {
PGBinaryObject binObj = (PGBinaryObject) obj;
Expand Down Expand Up @@ -1921,7 +1921,9 @@ public PGXmlFactoryFactory getXmlFactoryFactory() throws SQLException {
PSQLState.INVALID_PARAMETER_VALUE);
}
try {
xmlFactoryFactory = (PGXmlFactoryFactory) clazz.newInstance();
xmlFactoryFactory = clazz.asSubclass(PGXmlFactoryFactory.class)
.getDeclaredConstructor()
.newInstance();
} catch (Exception ex) {
throw new PSQLException(
GT.tr("Could not instantiate xmlFactoryFactory: {0}", xmlFactoryFactoryClass),
Expand Down

0 comments on commit 35431d6

Please sign in to comment.