Skip to content

Commit

Permalink
Merge pull request #102 from zalando-stups/backport-to-java-8
Browse files Browse the repository at this point in the history
Backport to java 8
  • Loading branch information
vadeg authored Oct 13, 2022
2 parents 28a8a77 + c6b26a3 commit 1276244
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 8
- name: Cache local Maven repository
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<spring.version>5.3.23</spring.version>
<postgresql.version>42.5.0</postgresql.version>
<dependency-check-maven.version>7.2.1</dependency-check-maven.version>
Expand Down
43 changes: 24 additions & 19 deletions src/main/java/org/zalando/typemapper/postgres/PgTypeHelper.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
package org.zalando.typemapper.postgres;

import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;

import java.util.*;

import javax.persistence.Column;

import com.google.common.base.Optional;
import org.postgresql.core.BaseConnection;

import org.postgresql.jdbc.PostgresJDBCDriverReusedTimestampUtils;

import org.postgresql.util.PGobject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Optional;


import org.zalando.sprocwrapper.util.NameUtils;
import org.zalando.typemapper.annotations.DatabaseField;
import org.zalando.typemapper.annotations.DatabaseType;
import org.zalando.typemapper.core.DatabaseFieldDescriptor;
Expand All @@ -36,7 +21,25 @@
import org.zalando.typemapper.core.fieldMapper.DefaultObjectMapper;
import org.zalando.typemapper.core.fieldMapper.GlobalValueTransformerRegistry;
import org.zalando.typemapper.core.fieldMapper.ObjectMapper;
import org.zalando.sprocwrapper.util.NameUtils;

import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;

public class PgTypeHelper {

Expand Down Expand Up @@ -265,7 +268,9 @@ public int compare(final Field a, final Field b) {
for (final Field f : fields) {
final DatabaseFieldDescriptor databaseFieldDescriptor = getDatabaseFieldDescriptor(f);
if (databaseFieldDescriptor != null) {
f.trySetAccessible();
if (!f.isAccessible()) {
f.setAccessible(true);
}

Object value;
try {
Expand Down

0 comments on commit 1276244

Please sign in to comment.