Hello,

The specification for the properties file format says that a comment is a line that has either a ! or # as the first non whitespace character. Greping around in the source shows we have several instances if comments tarting a few spaces in. I don't think we are using ! for comments anywhere though. Using this expression seems to do the trick for me:

's/^[         ]*#.*/#/g'

Note that the contents of the [] is one space and a literal tab as \t is not portable to all versions of sed that we use.

The cleaning mechanism is hard to make really safe without semantic parsing. Have you considered using the CompileProperties option instead? For most of the resource bundles in the jdk, we convert the properties into java src. As I understand it, resource bundles work seamlessly as classes or properties files. I assume this is done for runtime performance. You could also choose to just copy the properties files instead of cleaning them, especially if there are no or few comments in them.

/Erik

On 2015-03-04 20:21, Staffan Larsen wrote:
The problem is that the makefiles do "cleanup" of the resource files, 
accidentally deleting half of some strings. In this case

GC_INFO=Name = ''{0}'', Collections = 
{1,choice,-1#Unavailable|0#{1,number,integer}}, Total time spent = {2}

becomes

GC_INFO=Name \= ''{0}'', Collections \= {1,choice,-1#

The below diff fixes the problem. I added an extra ^ before the # so that only 
# at the beginning of the line are treated as comments. I don’t know if this 
has other implications, though? Should # anywhere on the line be treated as the 
beginning of a comment? In that case we need to handle the jconsole resource 
file specially.

Thanks,
/Staffan


diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk
--- a/make/common/JavaCompilation.gmk
+++ b/make/common/JavaCompilation.gmk
@@ -393,7 +393,7 @@
         $(MKDIR) -p $$(@D)
         export LC_ALL=C ; ( $(CAT) $$< && $(ECHO) "" ) \
             | $(SED) -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' \
- -e 's/\([^\\]\)!/\1\\!/g' -e 's/#.*/#/g' \
+ -e 's/\([^\\]\)!/\1\\!/g' -e 's/^#.*/#/g' \
             | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \
             | $(SED) -e '/^#/d' -e '/^$$$$/d' \
                 -e :a -e '/\\$$$$/N; s/\\\n//; ta' \

Reply via email to