Bug 119397 - java/jdk16: Wrong locales with patchset 3
Summary: java/jdk16: Wrong locales with patchset 3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Greg Lewis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-06 21:20 UTC by Bernhard Froehlich
Modified: 2008-02-03 18:50 UTC (History)
0 users

See Also:


Attachments
file.diff (481 bytes, patch)
2008-01-06 21:20 UTC, Bernhard Froehlich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Froehlich 2008-01-06 21:20:02 UTC
All available locales are detected and replaced at build time in work/control/build/bsd-amd64/gensrc/sun/util/LocaleDataMetaInfo.java. With JDK 1.6 and patchset 3 the result is always "  ben sun/text/resources/ |  arn sun/text/resources/ " and is definitely wrong.


http://lists.freebsd.org/pipermail/freebsd-java/2007-December/007027.html

Fix: There are 2 files j2se/make/java/java/localegen.sh and j2se/make/java/java/genlocales.gmk that are responsible for detecting and generating the list of available locales.

All locales are formattet in genlocales.gmk and stored in a temporary file where one line should be one locale and seperated with newlines. I have found that this does not work because '\n' is interpreted as string and not as an escape character (newline) so the format of the file is wrong and causes the error.

@$(ECHO) $(subst .properties,'\n',$(Euro_Resources_properties)) > $@.tmp.euro;
@$(ECHO) $(subst .java,'\n',$(Euro_Resources_java)) >> $@.tmp.euro;


The second part is localegen.sh where this temporary file is read ...

localelist=`$NAWK -F$1_ '{print $2}' $2 | sort`

The second parameter of nawk contains a $ and is not escaped so it gets replaced by the shell and not passed thru to nawk as it was expected.


My attached fix is more like a workaround because it uses sed to reformat the badly formattet tempory file of locales.



Patch attached with submission follows:
How-To-Repeat: Locale.getAvailableLocales() returns an String array with: "ben", "arn", "sun/text/resources/"


import java.util.Locale;
import sun.util.LocaleDataMetaInfo;

public class LocaleDebug
{
	public static void main(String[] args)
	{
		Locale[] locales = Locale.getAvailableLocales();

		for(int i=0; i < locales.length; i++)
			System.out.println(locales[i]);

		System.out.println("sun.text.resources.FormatData -> " +
		LocaleDataMetaInfo.getSupportedLocaleString("sun.text.resources.FormatData"));
	}
}
Comment 1 Martin Wilke freebsd_committer freebsd_triage 2008-01-07 14:07:59 UTC
Responsible Changed
From-To: freebsd-java->glewis

Over to maintainer.
Comment 2 dfilter service freebsd_committer freebsd_triage 2008-02-03 18:46:35 UTC
glewis      2008-02-03 18:46:26 UTC

  FreeBSD ports repository

  Modified files:
    java/jdk16           Makefile 
  Added files:
    java/jdk16/files     patch-j2se-java-localegen.sh 
  Log:
  . Fix locale generation and hence locale handling in general.
  
  PR:             119397
  Submitted by:   Bernhard Froehlich <decke@bluelife.at>
  
  Revision  Changes    Path
  1.154     +1 -1      ports/java/jdk16/Makefile
  1.1       +15 -0     ports/java/jdk16/files/patch-j2se-java-localegen.sh (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Greg Lewis freebsd_committer freebsd_triage 2008-02-03 18:46:45 UTC
State Changed
From-To: open->closed

Committed. Thanks!