[
https://issues.apache.org/jira/browse/SSHD-1209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17401788#comment-17401788
]
Lyor Goldstein edited comment on SSHD-1209 at 8/20/21, 3:15 AM:
----------------------------------------------------------------
You are writing the string to a {{ByteBufferArray}} and that means that it is
UTF-8 encoded - perhaps you are writing some UNICODE data but reading it as
ASCII instead of UTF-8 on the peer side. Another possibility is that you are
not reading the data as a {{ByteBufferArray}} - reminder: when writing a
string, its length is written as a 32-bit value before the (UTF-8) characters
was (Author: lgoldstein):
You are writing the string to a {{ByteBufferArray}} and that means that it is
UTF-8 encoded - perhaps you are writing some UNICODE data but reading it as
ASCII instead of UTF-8 on the peer side
> Write to error stream for custom exception is appending a extra word at the
> beginning
> -------------------------------------------------------------------------------------
>
> Key: SSHD-1209
> URL: https://issues.apache.org/jira/browse/SSHD-1209
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 2.7.0
> Reporter: Susmit Sarkar
> Priority: Major
> Attachments: image-2021-08-19-12-50-01-922.png
>
>
> Hello Team,
>
> We have a class as below
>
> {code:java}
> DetailedSftpErrorStatusDataHandler implements SftpErrorStatusDataHandler,
> ChannelSessionAware, DetailedSftpErrorStatusDataHandler implements
> SftpErrorStatusDataHandler, ChannelSessionAware,
> AsyncCommandErrorStreamAware, CommandDirectErrorStreamAware {
> {code}
> and we have overridden the :
>
> resolveErrorMessage and setIoErrorStream(IoOutputStream errStream)
> {code:java}
> @Override
> public void setIoErrorStream(IoOutputStream errStream) {
> this.errStream = errStream;
> }
> {code}
> finally we are writing to the error stream:
> {code:java}
> private void writeMsgToErrorStream(String refinedUserExitMessage) {
> ByteArrayBuffer buf = new ByteArrayBuffer();
> buf.putString(refinedUserExitMessage +
> System.getProperty("line.separator"));
> try { if (errStream != null) {
> errStream.writeBuffer(buf);
> }
> } catch (Exception e) {
> }
> }
> {code}
> Once the data is written to error stream we are gettig proper message to the
> console:
> !image-2021-08-19-12-50-01-922.png!
> But there is an extra charater getting appended at the first character *<*
> Utils.java ....
> I have no idea from where this *<* is coming from, and that changes with the
> first character like if it is P it would be *>, when starting with S it gets
> appended with Z*
> Any help will be appreciated.
> Thanks,
> Susmit
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]