Merge pull request #223 from shatake/shatake_branch

modified Upload on suggest words
This commit is contained in:
Shinsuke Sugaya 2014-10-31 19:21:35 +09:00
commit 2b4d9d8a18
4 changed files with 6 additions and 6 deletions

View file

@ -277,7 +277,7 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
final File oFile = tempFile;
try {
final String head = new String(b, Constants.UTF_8);
if (!head.startsWith("\"SuggestWord\",")) {
if (!(head.startsWith("\"BadWord\"") || head.startsWith("BadWord"))) {
log.error("Unknown file: "
+ suggestBadWordForm.suggestBadWordFile);
throw new SSCActionMessagesException(

View file

@ -276,7 +276,7 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
final File oFile = tempFile;
try {
final String head = new String(b, Constants.UTF_8);
if (!head.startsWith("\"SuggestWord\",")) {
if (!(head.startsWith("\"SuggestWord\"") || head.startsWith("SuggestWord"))) {
log.error("Unknown file: "
+ suggestElevateWordForm.suggestElevateWordFile);
throw new SSCActionMessagesException(

View file

@ -178,7 +178,7 @@ public class SuggestBadWordService extends BsSuggestBadWordService implements
}
private static String getValue(final List<String> list, final int index) {
if (index < list.size()) {
if (index >= list.size()) {
return StringUtil.EMPTY;
}
String item = list.get(index).trim();
@ -187,7 +187,7 @@ public class SuggestBadWordService extends BsSuggestBadWordService implements
}
if (item.length() > 1 && item.charAt(0) == '"'
&& item.charAt(item.length() - 1) == '"') {
item = item.substring(1, item.length() - 2);
item = item.substring(1, item.length() - 1);
}
return item;
}

View file

@ -204,7 +204,7 @@ public class SuggestElevateWordService extends BsSuggestElevateWordService
}
static String getValue(final List<String> list, final int index) {
if (index < list.size()) {
if (index >= list.size()) {
return StringUtil.EMPTY;
}
String item = list.get(index).trim();
@ -213,7 +213,7 @@ public class SuggestElevateWordService extends BsSuggestElevateWordService
}
if (item.length() > 1 && item.charAt(0) == '"'
&& item.charAt(item.length() - 1) == '"') {
item = item.substring(1, item.length() - 2);
item = item.substring(1, item.length() - 1);
}
return item;
}