Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gp-res-filter/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false
org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false
Expand Down
2 changes: 1 addition & 1 deletion gp-res-filter/.settings/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
formatter_profile=_gp
formatter_settings_version=13
formatter_settings_version=14
org.eclipse.jdt.ui.javadoc=true
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/* \n * Copyright IBM Corp. ${year}\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,28 @@ public static PropDef parseLine(String line) {
PropSeparator sep = null;
int sepIdx = -1;

boolean sawSpace = false;
boolean sawWhiteSpace = false;
for (int i = 0; i < line.length(); i++) {
char iChar = line.charAt(i);

if (sawSpace) {
if (sawWhiteSpace) {
if (iChar == PropSeparator.EQUAL.getCharacter()) {
sep = PropSeparator.EQUAL;
} else if (iChar == PropSeparator.COLON.getCharacter()) {
sep = PropSeparator.COLON;
} else {
} else if (!isPropsWhiteSpaceChar(iChar)){
// One or more white space characters are used as a delimiter,
// and we have reached to the first character of the value string.
sep = PropSeparator.SPACE;

assert i > 0; // sawWhiteSpace is true, so we looked at least one non white space character
sepIdx = i - 1;
break;
}
} else {
if (i > 0 && line.charAt(i - 1) != '\\') {
if (iChar == ' ') {
sawSpace = true;
if (isPropsWhiteSpaceChar(iChar)) {
sawWhiteSpace = true;
} else if (iChar == PropSeparator.EQUAL.getCharacter()) {
sep = PropSeparator.EQUAL;
} else if (iChar == PropSeparator.COLON.getCharacter()) {
Expand All @@ -325,7 +331,7 @@ public static PropDef parseLine(String line) {

PropDef pl = new PropDef(key, value, sep, null);
return pl;
}
}

public String getKey() {
return key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public class JavaPropertiesResourceTest {
lst.add(ResourceString.with("backslashes", "a\\b\\c")
.sequenceNumber(12).notes(Arrays.asList(" A comment with backslashes - a\\b\\c あい \\t\\n")).build());

lst.add(ResourceString.with("extraSpaces", "extra spaces before/after key/value ")
.sequenceNumber(13).notes(Arrays.asList(" extra spaces")).build());

Collections.sort(lst, new ResourceStringComparator());
EXPECTED_INPUT_RES_LIST = lst;
}
Expand Down Expand Up @@ -134,6 +137,8 @@ public class JavaPropertiesResourceTest {
Arrays.asList(" Not a Java MessageFormat param"));
bundleBuilder.addResourceString("backslashes", "a\\b\\c", 12,
Arrays.asList(" A comment with backslashes - a\\b\\c あい \\t\\n"));
bundleBuilder.addResourceString("extraSpaces", "extra spaces before/after key/value ", 13,
Arrays.asList(" extra spaces"));
bundleBuilder.addNotes(Arrays.asList(
" You are reading the \".properties\" entry.",
" The exclamation mark can also mark text as comments.",
Expand All @@ -160,6 +165,7 @@ public class JavaPropertiesResourceTest {
EXPECTED_PROP_DEF_LIST.add(new PropDef("withQuote", "You''re about to delete '{1}' rows in Mike''s file {0}.", PropSeparator.EQUAL));
EXPECTED_PROP_DEF_LIST.add(new PropDef("non-param", "This {} is not a parameter.", PropSeparator.EQUAL));
EXPECTED_PROP_DEF_LIST.add(new PropDef("backslashes", "a\\b\\c", PropSeparator.EQUAL));
EXPECTED_PROP_DEF_LIST.add(new PropDef("extraSpaces", "extra spaces before/after key/value ", PropSeparator.EQUAL));
}

private static final JavaPropertiesResource res = new JavaPropertiesResource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ withQuote = You''re about to delete '{0}' rows in Mike''s file {0}.
# Not a Java MessageFormat param
non-param = This {} is not a parameter.
# A comment with backslashes - a\b\c \u3042\u3044 \t\n
backslashes = a\\b\\c
backslashes = a\\b\\c
# extra spaces
extraSpaces = extra spaces before/after key/value
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ withQuote = You''re about to delete '{1}' rows in Mike''s file {0}.
# Not a Java MessageFormat param
non-param = This {} is not a parameter.
# A comment with backslashes - a\b\c \u3042\u3044 \t\n
backslashes = a\\b\\c
backslashes = a\\b\\c
# extra spaces
extraSpaces = extra spaces before/after key/value
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ trailSPs = trailing SPs
withTabs = Tab1\tTab2\tTab3\t
withQuote = You''re about to delete '{1}' rows in Mike''s file {0}.
non-param = This {} is not a parameter.
backslashes = a\\b\\c
backslashes = a\\b\\c
extraSpaces = extra spaces before/after key/value
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ trailSPs = trailing SPs
withTabs = Tab1\tTab2\tTab3\t
withQuote = You''re about to delete '{1}' rows in Mike''s file {0}.
non-param = This {} is not a parameter.
backslashes = a\\b\\c
backslashes = a\\b\\c
extraSpaces = extra spaces before/after key/value
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ withQuote = You''re about to delete '{1}' rows in Mike''s file {0}.
# Not a Java MessageFormat param
non-param = This {} is not a parameter.
# A comment with backslashes - a\b\c \u3042\u3044 \t\n
backslashes = a\\b\\c
backslashes = a\\b\\c
# extra spaces
extraSpaces = extra spaces before/after key/value