[
https://issues.apache.org/jira/browse/GUACAMOLE-615?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mike Jumper reopened GUACAMOLE-615:
-----------------------------------
Reopening as these changes introduced an incorrect JSDoc annotation that is
preventing the documentation from being generated:
{code:none}
$ jsdoc -c jsdoc-conf.json
ERROR: Unable to parse a tag's type expression for source file
/home/mjumper/apache/guacamole/guacamole-client/guacamole-common-js/src/main/webapp/modules/Parser.js
in line 310 with tag title "param" and text "{!*[]} elements
The values that should be encoded as the elements of a Guacamole
instruction. Order of these elements is preserved. This array MUST have
at least one element.": Invalid type expression "!*[]": Expected "=", "|",
or end of input but "[" found.
ERROR: Unable to parse a tag's type expression for source file
/home/mjumper/apache/guacamole/guacamole-client/guacamole-common-js/src/main/webapp/modules/Parser.js
in line 324 with tag title "param" and text "{!*[]} elements
The values that should be encoded as the elements of a Guacamole
instruction. Order of these elements is preserved. This array MUST have
at least one element.": Invalid type expression "!*[]": Expected "=", "|",
or end of input but "[" found.
$
{code}
> Incorrect instruction element length handle because of Java's char type
> -----------------------------------------------------------------------
>
> Key: GUACAMOLE-615
> URL: https://issues.apache.org/jira/browse/GUACAMOLE-615
> Project: Guacamole
> Issue Type: Bug
> Components: guacamole-common, guacamole-common-js
> Affects Versions: 0.9.14
> Reporter: Aiden Luo
> Assignee: Mike Jumper
> Priority: Minor
> Fix For: 1.5.2
>
>
> The definition of guacamole instruction:
> {quote}The Guacamole protocol consists of instructions. Each instruction is a
> comma-delimited list followed by a terminating semicolon, where the first
> element of the list is the instruction opcode, and all following elements are
> the arguments for that instruction:
> OPCODE,ARG1,ARG2,ARG3,...;
> Each element of the list has a positive decimal integer length prefix
> separated by the value of the element by a period. This length denotes the
> number of Unicode characters in the value of the element, which is encoded in
> UTF-8:
>
> LENGTH.VALUE
> {quote}
> Which means the element's values will be encoded in UTF-8。That means we must
> use correct UTF-8 encoder/decoder to handle the instruction. But in
> guacamole-common, the parser use Java's char type to parse which only can
> store partial Unicode char.
> Problem code
> [https://github.com/apache/guacamole-client/blob/master/guacamole-common/src/main/java/org/apache/guacamole/protocol/GuacamoleParser.java#L164]
>
>
> {code:java}
> if (state == State.PARSING_CONTENT && charsParsed + elementLength + 1 <=
> length) {
> // Read element
> String element = new String(chunk, offset + charsParsed, elementLength);
> charsParsed += elementLength;
> elementLength = 0;
> ...{code}
> In the code above, bytes of a unicode char may not equal to a java char.
> I also check the guacamole-server implementation, all work fine.
> Correct code
> [https://github.com/apache/guacamole-server/blob/master/src/libguac/parser.c#L113]
> {code:java}
> /* Advance to next character */
> parser->__element_length--;
> char_buffer += char_length;{code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)