Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1134 Map inet type to InetAddress #1527

Merged
merged 10 commits into from Jul 23, 2019

Conversation

@myowaithant9
Copy link
Contributor

commented Jul 12, 2019

It was testing by creating separate JPA project with select query. Then, check the type and transform into InetAddress. For eg. the result data is /127.0.0.1 and type is class java.net.Inet4Address

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 12, 2019

@davecramer

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

This fails all tests

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 16, 2019

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 16, 2019

@codecov-io

This comment has been minimized.

Copy link

commented Jul 16, 2019

Codecov Report

Merging #1527 into master will increase coverage by 0.18%.
The diff coverage is 66.66%.

@@             Coverage Diff              @@
##             master    #1527      +/-   ##
============================================
+ Coverage     68.81%   68.99%   +0.18%     
- Complexity     3941     3959      +18     
============================================
  Files           179      179              
  Lines         16480    16489       +9     
  Branches       2676     2678       +2     
============================================
+ Hits          11340    11376      +36     
+ Misses         3891     3871      -20     
+ Partials       1249     1242       -7
@myowaithant9

This comment has been minimized.

Copy link
Contributor Author

commented Jul 16, 2019

@davecramer I modified them and passed all tests. Could you please check again?

@@ -793,6 +793,7 @@ private Object buildArray(PgArrayList input, int index, int count) throws SQLExc

throw org.postgresql.Driver.notImplemented(this.getClass(), "getArrayImpl(long,int,Map)");
}
System.out.println("testing get object data in pgarray-->" + ret);

This comment has been minimized.

Copy link
@davecramer

davecramer Jul 16, 2019

Member

Please remove any System.out.println use logging instead

This comment has been minimized.

Copy link
@myowaithant9

myowaithant9 Jul 16, 2019

Author Contributor

@davecramer It is the outdated version and I have already removed System.out.println. Could you please check overall commit? There are only 2 files I have changed, PgConnection and PgResultSet. So, do I still need to use logging for PgArray?

@@ -542,15 +544,27 @@ public LargeObjectManager getLargeObjectAPI() throws SQLException {
public Object getObject(String type, String value, byte[] byteValue) throws SQLException {
if (typemap != null) {
Class<?> c = typemap.get(type);
System.out.println("check type c in getOject in PgConnection : " + c);

This comment has been minimized.

Copy link
@davecramer

davecramer Jul 16, 2019

Member

use logger instead

try {
return InetAddress.getByName(value);
} catch (UnknownHostException e) {
throw new PSQLException(GT.tr("Return Inet address is not supported.", type),

This comment has been minimized.

Copy link
@davecramer

davecramer Jul 17, 2019

Member

This is a confusing message. If it is indeed an unknown host, why return Inet address not supported ?

This comment has been minimized.

Copy link
@myowaithant9

myowaithant9 Jul 18, 2019

Author Contributor

Oh! I am sorry for my mistake. It should be IP address of a host could not be determined

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 18, 2019

try {
return InetAddress.getByName(value);
} catch (UnknownHostException e) {
throw new PSQLException(GT.tr("IP address of a host could not be determined", type),

This comment has been minimized.

Copy link
@davecramer

davecramer Jul 18, 2019

Member

for debugging purposes it would be useful to include the value of the host in the Exception.

This comment has been minimized.

Copy link
@myowaithant9

myowaithant9 Jul 19, 2019

Author Contributor

@davecramer Thanks for your suggestion and I have changed a little bit.

This comment has been minimized.

Copy link
@davecramer

davecramer Jul 21, 2019

Member

Why not add the hostname instead ?

This comment has been minimized.

Copy link
@myowaithant9

myowaithant9 Jul 22, 2019

Author Contributor

@davecramer To get hostName from IP Address is like below:

InetAddress addr = InetAddress.getByName("192.168.190.62");
String host = addr.getHostName();
System.out.println(host);

So, I use InetAddress.getByName(value).getHostName() in Exception. But when I add that code, it shows me error to add throw declaration again. If I add it, the other files such as PgArray and PgResultset got error because of that declaration. That's why I use value only in Exception.

This comment has been minimized.

Copy link
@davecramer

davecramer Jul 22, 2019

Member

Yes, I do want just the value. If I'm not mistaken the code above has type not value

This comment has been minimized.

Copy link
@myowaithant9

myowaithant9 Jul 22, 2019

Author Contributor

@davecramer If so, I have already changed it in my last commit.
throw new PSQLException(GT.tr("IP address {0} of a host could not be determined", value)

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 19, 2019

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 19, 2019

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 22, 2019

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 22, 2019

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 22, 2019

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 22, 2019

@davecramer

This comment has been minimized.

Copy link
Member

commented Jul 22, 2019

Excellent. When it passes CI I will push it

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 22, 2019

@AppVeyorBot

This comment has been minimized.

Copy link

commented Jul 23, 2019

@myowaithant9

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2019

@davecramer It passed all tests.

@davecramer davecramer merged commit 1d0c477 into pgjdbc:master Jul 23, 2019

3 checks passed

codecov/project 68.99% (+0.18%) compared to 08d8129
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@myowaithant9 myowaithant9 deleted the myowaithant9:issue1134 branch Jul 23, 2019

maxcom added a commit to maxcom/lorsource that referenced this pull request Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.