Bug 785046

Summary: Maven module support: Error message 'resId length must be between 0 and 255' occurs when source string is longer than 255.
Product: [Retired] Zanata Reporter: Ding-Yi Chen <dchen>
Component: Component-PersistenceAssignee: Alex Eng <aeng>
Status: CLOSED CURRENTRELEASE QA Contact: Carlos Munoz <camunoz>
Severity: low Docs Contact:
Priority: low    
Version: 1.4.3-SNAPSHOTCC: aeng, camunoz, damason, pahuang, sflaniga, zanata-bugs
Target Milestone: ---   
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Server version 2.1-SNAPSHOT (20130102-0032), Client version 2.0.2-SNAPSHOT Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-26 04:06:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ding-Yi Chen 2012-01-27 03:30:17 UTC
Description of problem:
When pushing the properties files with a source string longer than 255, following error message is shown in server.log:
resId length must be between 0 and 255

Version-Release number of selected component (if applicable):
Zanata version 1.4.6-SNAPSHOT (20120127-0944). 

How reproducible:
Always.

Steps to Reproduce:
0. Assume project 'JBossAS', version 'master' is create in zanata.
1. git clone git://github.com/jbossas/jboss-as.gi
2. cd jboss
3. mvn zanata:push -Dzanata.enableModules=true
4. Document that trigger the error: https://github.com/jbossas/jboss-as/blob/master/jdr/jboss-as-sos/src/main/resources/sos/po/ru.properties
  
Actual results:
Following error message is shown in server.log:
resId length must be between 0 and 255

Expected results:
Sucessfully push without error.

Additional info:

Comment 1 Runa Bhattacharjee 2012-07-30 13:41:26 UTC
Is this still a problem? Thanks.

Comment 2 David Mason 2012-11-16 01:11:09 UTC
This will still occur. The issue is that Zanata's database currently only stores up to 255 characters for the id of each text flow, and for properties format the key is used directly without modification (unlike gettext, for which a hash of the content is used).

The above link appears not to be valid. Looking at the updated version at

https://github.com/jbossas/jboss-as/blob/master/jdr/jboss-as-sos/src/main/resources/sos/po/sos_ru.properties

it appears that the key causing the problem is:

This\ utility\ will\ collect\ some\ detailed\ \ information\ about\ the\nhardware\ and\ setup\ of\ your\ %(distroa)s\ system.\nThe\ information\ is\ collected\ and\ an\ archive\ is\ \ packaged\ under\n/tmp,\ which\ you\ can\ send\ to\ a\ support\ representative.\n%(distrob)s\ will\ use\ this\ information\ for\ diagnostic\ purposes\ ONLY\nand\ it\ will\ be\ considered\ confidential\ information.\n\nThis\ process\ may\ take\ a\ while\ to\ complete.\nNo\ changes\ will\ be\ made\ to\ your\ system.\n\n

These appear to be extracted from python scripts, so in this specific case they would probably be better off using gettext.

Looking at the API documentation for java properties, there does not appear to be any limit to the acceptable length of a key, so this is a bug in Zanata's properties support that we may want to address at some point.

Comment 3 Patrick Huang 2012-11-20 05:08:26 UTC
should modify error message to something like "Zanata does not support properties key exceeding 255 characters"

Comment 4 Alex Eng 2013-01-02 01:15:39 UTC
Implemented checking of id length for properties.
Zanata-common 1.8.6-SNAPSHOT
Zanata-client 2.0.2-SNAPSHOT
See 

https://github.com/zanata/zanata-client/commit/380b098a77a8e2d16cfbe6eadfeba601b36608e7

https://github.com/zanata/zanata-common/commit/f65c7fb212e486f59532e0eef07fa664dfd0a29a

Comment 5 Carlos Munoz 2013-01-02 04:36:15 UTC
This is a quick workaround for the time being, but should we investigate how to remove this restriction from property files?

Comment 6 Ding-Yi Chen 2013-01-02 05:14:59 UTC
The new address of the error-triggering document is now https://github.com/jbossas/jboss-as/blob/7.1/jdr/jboss-as-sos/src/main/resources/sos/po/sos_ru.properties

The file is no longer in master.

Comment 8 Sean Flanigan 2013-01-07 02:06:39 UTC
(In reply to comment #5)
> This is a quick workaround for the time being, but should we investigate how
> to remove this restriction from property files?

I'm not sure if it's really worth supporting property keys of arbitrary length.  Property keys files in Java projects don't normally get anywhere near that long; sos seems to be an aberration.

I think it's reasonable for Zanata to have this limitation on key length.  If it became a real problem, the client could always implement a second mapping for properties files in Zanata.  For instance, we could hash the propertyKey+sourceText and call that the resId - similar to the mapping for PO files.