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

Driver throws NumberFormatException when used with 9.4 beta1 #90

Closed
andreak opened this issue Jul 3, 2014 · 7 comments
Closed

Driver throws NumberFormatException when used with 9.4 beta1 #90

andreak opened this issue Jul 3, 2014 · 7 comments

Comments

@andreak
Copy link
Contributor

andreak commented Jul 3, 2014

Get this exception:
java.lang.NumberFormatException: For input string: "4beta1"

But the exception is masked in IOException:
ProtocolFactoryImpl:288
io = new IOException(e.getCause());

The real NFE-stack-trace is:

java.lang.NumberFormatException: For input string: "4beta1"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:492)
    at java.lang.Integer.valueOf(Integer.java:582)
    at com.impossibl.postgres.system.Version.parsePart(Version.java:59)
    at com.impossibl.postgres.system.Version.parse(Version.java:45)
    at com.impossibl.postgres.system.BasicContext.updateSystemParameter(BasicContext.java:579)
    at com.impossibl.postgres.protocol.v30.ProtocolImpl.receiveParameterStatus(ProtocolImpl.java:1158)
    at com.impossibl.postgres.protocol.v30.ProtocolImpl.dispatch(ProtocolImpl.java:837)
    at com.impossibl.postgres.protocol.v30.MessageHandler.channelRead(MessageHandler.java:46)
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338)
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:153)
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:338)
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:324)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:132)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:485)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:452)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Thread.java:745)

But the Exception in the logs is:

java.io.IOException
    at com.impossibl.postgres.protocol.v30.ProtocolFactoryImpl.translateConnectionException(ProtocolFactoryImpl.java:288)
    at com.impossibl.postgres.protocol.v30.ProtocolFactoryImpl.connect(ProtocolFactoryImpl.java:199)
    at com.impossibl.postgres.protocol.v30.ProtocolFactoryImpl.connect(ProtocolFactoryImpl.java:90)
    at com.impossibl.postgres.system.BasicContext.<init>(BasicContext.java:130)
    at com.impossibl.postgres.jdbc.PGConnectionImpl.<init>(PGConnectionImpl.java:181)
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:168)
    at com.impossibl.postgres.jdbc.PGDriver.connect(PGDriver.java:60)
    at com.impossibl.postgres.jdbc.PGDriver.connect(PGDriver.java:50)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
@gsmet
Copy link
Contributor

gsmet commented Jul 3, 2014

Hi Andreas,

This is a known limitation.

I have to extract this commit (in fact, this code has changed but it's just a one liner to fix):
gmokki@c5d2c32

I have a couple of things to do so I'll see about extracting this one from the original pull request and submit another one.

@andreak
Copy link
Contributor Author

andreak commented Jul 3, 2014

Thanks!

@andreak
Copy link
Contributor Author

andreak commented Jul 3, 2014

BTW; The real error was kind of hard to spot as the NFE is masked and the real NFE.message never gets out in the log.

Maybe changin
ProtocolFactoryImpl.translateConnectionException

so that
io = new IOException(e.getCause());

becomes:
io = new IOException(e);

?

Then the NFE won't get masked. As it stands e.getCause() returns null so the NFE never propagates.

@gsmet
Copy link
Contributor

gsmet commented Jul 3, 2014

IIRC, there's something to fix that in the original PR and it should be
merged to.

See my post here: #85

On Thu, Jul 3, 2014 at 11:13 AM, Andreas Joseph Krogh <
notifications@github.com> wrote:

BTW; The real error was kind of hard to spot as the NFE is masked and the
real NFE.message never gets out in the log.

Maybe changin
ProtocolFactoryImpl.translateConnectionException

so that
io = new IOException(e.getCause());

becomes:
io = new IOException(e);

?

Then the NFE won't get masked. As it stands e.getCause() returns null so
the NFE never propagates.


Reply to this email directly or view it on GitHub
#90 (comment).

@andreak
Copy link
Contributor Author

andreak commented Jul 3, 2014

Right, it's there.
What's holding up merging of #73?

@gsmet
Copy link
Contributor

gsmet commented Jul 3, 2014

Nothing. There's just some work to merge it due to the recent changes.

I'll prepare a clean PR for Kevin or Brett to merge it directly. Hopefully
in a few hours.

On Thu, Jul 3, 2014 at 11:35 AM, Andreas Joseph Krogh <
notifications@github.com> wrote:

Right, it's there.
What's holding up merging of #73
#73?


Reply to this email directly or view it on GitHub
#90 (comment).

@gsmet
Copy link
Contributor

gsmet commented Jul 3, 2014

Done: #91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants