db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5806) Trying to prepare statement with no text causes DRDA protocol exception
Date Fri, 01 Nov 2013 14:03:18 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811260#comment-13811260
] 

Knut Anders Hatlen commented on DERBY-5806:
-------------------------------------------

Thanks for fixing this bug, Dyre.

Just one question about this part of the fix:

{noformat}
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Fri Nov 
1 09:50:15 2013
@@ -5920,7 +5920,9 @@ class DRDAConnThread extends Thread {
         String ccsidMBCEncoding = currentStatement.ccsidMBCEncoding;
 
         if (length == 0) {
-            return null;
+            // Can't return null here as that will indicate that the cp is 
+            // missing, when it in fact was present, but contained an empty string
+            return ""; 
         }
         byte [] byteStr = reader.readBytes(length);
         if (ccsidMBCEncoding != null)

{noformat}

It looks to me as if the method would have returned "" when length == 0 if we'd just let it
go through the normal code path below. Would it make sense to remove the special handling
of length == 0 and use the same code path for all cases?

> Trying to prepare statement with no text causes DRDA protocol exception
> -----------------------------------------------------------------------
>
>                 Key: DERBY-5806
>                 URL: https://issues.apache.org/jira/browse/DERBY-5806
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client, Network Server
>    Affects Versions: 10.10.1.1
>            Reporter: Bryan Pendleton
>            Assignee: Dyre Tjeldvoll
>            Priority: Minor
>              Labels: derby_triage10_10, derby_triage10_11
>         Attachments: derby-5806a.diff
>
>
> I accidentally stumbled into a rather awkward bit of error handling.
> On an IJ session running client/server, I tried:
> ij> connect 'jdbc:derby://localhost:1527/brydb';
> ij> prepare seeMenu as '';
> ERROR 08006: A network protocol error was encountered and the connection has been terminated:
A PROTOCOL Data Stream Syntax Error was detected.  Reason: 0x9,236. Plaintext connection attempt
to an SSL enabled server?
> On the Network Server side, I see:
> Sat Jun 09 09:28:51 PDT 2012 : Execution failed because of a Distributed Protocol Error:
 DRDA_Proto_SYNTAXRM; CODPNT arg  = 2414; Error Code Value = e. Plaintext connection attempt
from an SSL enabled client?
> org.apache.derby.impl.drda.DRDAProtocolException: Execution failed because of a Distributed
Protocol Error:  DRDA_Proto_SYNTAXRM; CODPNT arg  = 2414; Error Code Value = e. Plaintext
connection attempt from an SSL enabled client?
> 	at org.apache.derby.impl.drda.DRDAConnThread.throwSyntaxrm(DRDAConnThread.java:537)
> 	at org.apache.derby.impl.drda.DRDAConnThread.missingCodePoint(DRDAConnThread.java:567)
> 	at org.apache.derby.impl.drda.DRDAConnThread.parsePRPSQLSTTobjects(DRDAConnThread.java:3858)
> 	at org.apache.derby.impl.drda.DRDAConnThread.parsePRPSQLSTT(DRDAConnThread.java:3788)
> 	at org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:831)
> 	at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:295)
> It seems like the error handling could be improved here, for what is essentially a syntax
error on my part.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message