epoyraz / mztab

Automatically exported from code.google.com/p/mztab
0 stars 0 forks source link

Param object's "value" argument cannot contain special characters #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Param param = new UserParam("Some parameter", "\"[...]\"");
2. System.out.println(param.getValue());

What is the expected output? What do you see instead?

Expected = [...]
Actual = ...

Please use labels and text to provide additional information.

CV parameters are normally encoded in string format using the standard square 
bracket-enclosed, comma-delimited tuple format:
[<label>,<accession>,<name>,<value>]

Because this format makes use of square brackets ("[]") and commas (","), these 
are generally reserved characters that should not appear in the element values. 
 However, some CV param names are known to contain commas, e.g.:

MOD:00648 - N,O-diacetylated L-serine

Therefore, it is well-documented that a Param's "name" argument, when 
containing illegal characters, should be enclosed in quotation marks ("") to 
inform the parsing engine that it should not treat those characters as 
delimiters in the overall parameter tuple string.

However, the Param's "value" argument is not treated in this same manner, even 
though it should be, since the semantics of this element can be arbitrary and 
user-defined.  Currently, even when the string "value" argument is explicitly 
enclosed in quotation marks, these special characters are always just stripped 
out of the stored string value.  This should not happen when the argument value 
is enclosed in quotation marks.

Original issue reported on code.google.com by jjcarv...@gmail.com on 29 Sep 2014 at 11:13

GoogleCodeExporter commented 9 years ago

Original comment by noedelta on 8 Oct 2014 at 4:07

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r584.

Before, all the reserved characters were removed by default. With the new 
implementation if the user of the library encloses with double quotes the 
fields with reserved characters (at this moment, the problematic one it is only 
the comma) the parsing should work without problems.

Now
1a. Param param = new UserParam("Some parameter", "\"[...]\"");
2. System.out.println(param.getValue());

or

1b. Param param = new UserParam("Some parameter", "[...]");
2. System.out.println(param.getValue());

Return the same

[...]

Original comment by noedelta on 9 Oct 2014 at 2:18