Bug 856019 - Java variables validation does not recognize variables after an odd number of apostrophes
Summary: Java variables validation does not recognize variables after an odd number of...
Status: CLOSED DUPLICATE of bug 872039
Alias: None
Product: Zanata
Classification: Retired
Component: Component-UI
Version: 1.7
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 1.7
Assignee: Carlos Munoz
QA Contact: Ding-Yi Chen
Depends On:
TreeView+ depends on / blocked
Reported: 2012-09-11 01:35 UTC by David Mason
Modified: 2014-07-03 00:40 UTC (History)
3 users (show)

Clone Of:
Last Closed: 2012-09-11 05:22:52 UTC

Attachments (Terms of Use)

Description David Mason 2012-09-11 01:35:59 UTC
Description of problem:
For any java variable that appears in a string after an odd number of apostrophe ("'") characters, the variable is not recognised for validation. This can cause confusing messages of added or missing variables when using words containing apostrophes. Variables that are after an even number of apostrophes are validated as normal.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Sign in and enter a workspace that has java style variables ( %{name} )
2.Copy a source string with variables to the target
3.Add a single apostrophe at the beginning of the string
4.Add another apostrophe next to the first
Actual results:
3.Validation shows all variables are missing
4.Validation does not show missing variables

Expected results:
Validation does not show missing variables at step 3 or 4

Additional info:
Caused by validator considering string 'quoted' between apostrophes and intentionally not validating.

Comment 1 Carlos Munoz 2012-09-11 01:43:44 UTC
Removed quote analysis from the validation.


Comment 2 Carlos Munoz 2012-09-11 05:22:52 UTC
Reverting this change as Java validation was working as expected. The bug was reported while attempting to validate Ruby code using the Java validator. A ruby variable validator should be implemented instead.


Comment 3 Sean Flanigan 2012-09-11 05:32:26 UTC
(Mid-air collision...)

Actually, the validator was working as it should: apostrophes (single quotes) are used for escaping in Java MessageFormat: http://docs.oracle.com/javase/1.4.2/docs/api/java/text/MessageFormat.html

To get a single quote with MessageFormat, you actually have to use two in a row.  Anything inside a quoted area that looks like a variable expansion will be output verbatim by MessageFormat, ie not treated as a variable.

The string given in the steps to reproduce ("%{name}") appears to be a Ruby string, not a Java string.  Until we implement a Ruby validator in the editor, it's best just to disable the Java validator for Ruby projects.

We should revert the above commit, please.  The quote analysis is fine.

Comment 4 Ding-Yi Chen 2014-07-03 00:40:51 UTC

*** This bug has been marked as a duplicate of bug 872039 ***

Note You need to log in before you can comment on or make changes to this bug.