[
https://issues.apache.org/jira/browse/DERBY-6801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14560974#comment-14560974
]
Bryan Pendleton commented on DERBY-6801:
----------------------------------------
Although this is a separate task, and we might end up committing this work
by itself, I think it's important to review the details of this task in
conjunction
with DERBY-6802 and DERBY-6803.
So I spent some more time reading through DRDAConnThread.java.
For now, I'm mostly concerned with the code that packages the message id
and arguments together, and the code that tries to break them back apart.
I'm thinking that a first cut might be to take the entire method
DRDAConnThread.buildSqlerrmc(),
and all the sub-methods that it calls (buildTokenizedSqlerrmc,
buildDataTruncationSqlerrmc, buildPreformattedSqlerrmc), and refactor them
all as a single unit to the new MessageUtils class, together with the
SQLERRMC_TOKEN_DELIMITER magic constant.
And we'd also take all of MessageService.getLocalizedMessage() and refactor
it into MessageUtils, since this method should be in the same class as the
build* methods from the previous paragraph, to hide the encoding/decoding
in a single class as is our intent.
And I think we'll still need a bit more code in a new method, to be used by
the client-side logic when it wants to take apart the errmc and decode
the individual arguments, but we can get to that when we approach DERBY-6803.
I do like including the exception wrapping and de-wrapping logic that you
noticed,
and included in Messageutils, as I think that is also related to this entire
notion of taking a SQLException and transporting it across the network
from the server to the client in a controlled fashion. So I'm not suggesting to
get rid of those methods necessarily, just to add some more.
> Implement MessageUtils class so client and server can share message argument
> encoding/decoding
> ----------------------------------------------------------------------------------------------
>
> Key: DERBY-6801
> URL: https://issues.apache.org/jira/browse/DERBY-6801
> Project: Derby
> Issue Type: Sub-task
> Components: JDBC, Network Client, Network Server
> Reporter: Bryan Pendleton
> Assignee: Abhinav Gupta
> Priority: Minor
> Attachments: subPart2.diff
>
>
> Currently, the Network Server contains code which encodes message arguments
> to be passed over DRDA to the client, and other code which
> decodes the encoded message arguments when the client passes
> them back in a call to SQLCAMESSAGE (see DERBY-1178 for additional
> discussion of this behavior).
> We would like to extract that logic and place it into a new MessageUtils
> class in the common shared library so that both the client and server
> can manipulate the message arguments without duplicating the code.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)