Bug 785046 - Maven module support: Error message 'resId length must be between 0 and 255' occurs when source string is longer than 255.
Maven module support: Error message 'resId length must be between 0 and 255' ...
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-Persistence (Show other bugs)
1.4.3-SNAPSHOT
Unspecified Unspecified
low Severity low
: ---
: 2.1
Assigned To: Alex Eng
Carlos Munoz
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-26 22:30 EST by Ding-Yi Chen
Modified: 2013-02-25 23:06 EST (History)
6 users (show)

See Also:
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-25 23:06:23 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ding-Yi Chen 2012-01-26 22:30:17 EST
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 09:41:26 EDT
Is this still a problem? Thanks.
Comment 2 David Mason 2012-11-15 20:11:09 EST
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 00:08:26 EST
should modify error message to something like "Zanata does not support properties key exceeding 255 characters"
Comment 4 Alex Eng 2013-01-01 20:15:39 EST
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-01 23:36:15 EST
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 00:14:59 EST
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-06 21:06:39 EST
(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.

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