This commit is contained in:
Shinsuke Sugaya 2015-09-20 18:20:59 +09:00
parent 1a4fb3ab0d
commit 8e613d0cca
10 changed files with 28 additions and 28 deletions

View file

@ -190,11 +190,10 @@ public class LoginAction implements Serializable {
private String getAdminRootPath() {
String returnPath = RequestUtil.getRequest().getContextPath();
if (StringUtil.isEmpty(returnPath) || "/".equals(returnPath)) {
returnPath = "/admin";
return "/admin";
} else {
returnPath = returnPath + "/admin";
return returnPath + "/admin";
}
return returnPath;
}
@Execute(validator = false, input = "../index")

View file

@ -437,7 +437,7 @@ public class SynonymAction {
return;
}
for (String value : values) {
if (value.indexOf(",") >= 0) {
if (value.indexOf(',') >= 0) {
throw new SSCActionMessagesException("errors.invalid_str_is_included", value, ",");
}
if (value.indexOf("=>") >= 0) {

View file

@ -16,6 +16,8 @@
package jp.sf.fess.api;
import java.util.Locale;
public class BaseApiManager {
protected static final String FAVORITES_API = "/favoritesApi";
@ -35,15 +37,11 @@ public class BaseApiManager {
SEARCH, LABEL, SUGGEST, SPELLCHECK, ANALYSIS, HOTSEARCHWORD, FAVORITE, FAVORITES, OTHER, PING;
}
public BaseApiManager() {
super();
}
protected FormatType getFormatType(final String formatType) {
if (formatType == null) {
return FormatType.SEARCH;
}
final String type = formatType.toUpperCase();
final String type = formatType.toUpperCase(Locale.ENGLISH);
if (FormatType.SEARCH.name().equals(type)) {
return FormatType.SEARCH;
} else if (FormatType.LABEL.name().equals(type)) {

View file

@ -417,7 +417,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
buf.append("\"recordCount\":");
buf.append(suggestRecordCount);
if (suggestResultList.size() > 0) {
if (!suggestResultList.isEmpty()) {
buf.append(',');
buf.append("\"result\":[");
boolean first1 = true;
@ -501,7 +501,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
buf.append("\"recordCount\":");
buf.append(spellCheckRecordCount);
if (spellCheckResultList.size() > 0) {
if (!spellCheckResultList.isEmpty()) {
buf.append(',');
buf.append("\"result\":[");
boolean first1 = true;
@ -581,7 +581,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
buf.append("\"recordCount\":");
buf.append(fieldAnalysis.size());
if (fieldAnalysis.size() > 0) {
if (!fieldAnalysis.isEmpty()) {
buf.append(',');
buf.append("\"result\":[");
boolean first1 = true;

View file

@ -153,7 +153,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
.replace(".", " AND " + gsaMetaPrefix)
.replace("|", " OR " + gsaMetaPrefix) + ")");
}
if (additional.size() > 0) {
if (!additional.isEmpty()) {
extraParams.put("additional", (String[]) additional
.toArray(new String[additional.size()]));
}
@ -227,7 +227,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
buf.append("\" original_value=\"");
buf.append(URLEncoder.encode(ie, Constants.UTF_8));
buf.append("\"/>");
if (documentItems.size() > 0) {
if (!documentItems.isEmpty()) {
buf.append("<RES SN=\"");
buf.append(startNumber);
buf.append("\" EN=\"");

View file

@ -361,7 +361,7 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
buf.append("<record-count>");
buf.append(suggestRecordCount);
buf.append("</record-count>");
if (suggestResultList.size() > 0) {
if (!suggestResultList.isEmpty()) {
buf.append("<result>");
for (int i = 0; i < suggestResultList.size(); i++) {
@ -441,7 +441,7 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
buf.append("<record-count>");
buf.append(spellCheckRecordCount);
buf.append("</record-count>");
if (spellCheckResultList.size() > 0) {
if (!spellCheckResultList.isEmpty()) {
buf.append("<result>");
for (int i = 0; i < spellCheckResultList.size(); i++) {
@ -517,7 +517,7 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
buf.append("<record-count>");
buf.append(fieldAnalysis.size());
buf.append("</record-count>");
if (fieldAnalysis.size() > 0) {
if (!fieldAnalysis.isEmpty()) {
buf.append("<result>");
for (final Map.Entry<String, Map<String, List<Map<String, Object>>>> fEntry : fieldAnalysis
.entrySet()) {

View file

@ -62,7 +62,7 @@ public class SynonymFile extends DictionaryFile<SynonymItem> {
}
@Override
public SynonymItem get(final long id) {
public synchronized SynonymItem get(final long id) {
for (final SynonymItem synonymItem : synonymItemList) {
if (id == synonymItem.getId()) {
return synonymItem;
@ -148,7 +148,7 @@ public class SynonymFile extends DictionaryFile<SynonymItem> {
}
}
protected void reload(final SynonymUpdater updater) {
private void reload(final SynonymUpdater updater) {
final List<SynonymItem> itemList = new ArrayList<SynonymItem>();
BufferedReader reader = null;
try {
@ -393,7 +393,7 @@ public class SynonymFile extends DictionaryFile<SynonymItem> {
return new BufferedInputStream(new FileInputStream(file));
}
public void update(final InputStream in) throws IOException {
public synchronized void update(final InputStream in) throws IOException {
StreamUtil.drain(in, file);
reload(null);
}

View file

@ -63,7 +63,7 @@ public class UserDictFile extends DictionaryFile<UserDictItem> {
}
@Override
public UserDictItem get(final long id) {
public synchronized UserDictItem get(final long id) {
for (final UserDictItem userDictItem : userDictItemList) {
if (id == userDictItem.getId()) {
return userDictItem;
@ -149,7 +149,7 @@ public class UserDictFile extends DictionaryFile<UserDictItem> {
}
}
protected void reload(final UserDictUpdater updater) {
private void reload(final UserDictUpdater updater) {
final List<UserDictItem> itemList = new ArrayList<UserDictItem>();
BufferedReader reader = null;
try {
@ -320,7 +320,7 @@ public class UserDictFile extends DictionaryFile<UserDictItem> {
return new BufferedInputStream(new FileInputStream(file));
}
public void update(final InputStream in) throws IOException {
public synchronized void update(final InputStream in) throws IOException {
StreamUtil.drain(in, file);
reload(null);
}

View file

@ -102,8 +102,10 @@ public class CsvDataStoreImpl extends AbstractDataStoreImpl {
return isCsvFile(file, name);
}
});
for (final File file : files) {
fileList.add(file);
if (files != null) {
for (final File file : files) {
fileList.add(file);
}
}
} else {
logger.warn(path + " is not a directory.");

View file

@ -97,13 +97,14 @@ public class JobScheduler {
}
public void register(final ScheduledJob scheduledJob) {
if (scheduledJob == null) {
throw new ScheduledJobException("No job.");
}
final String cronExpression = scheduledJob.getCronExpression();
if (StringUtil.isBlank(cronExpression)) {
return;
}
if (scheduledJob == null) {
throw new ScheduledJobException("No job.");
}
if (!Constants.T.equals(scheduledJob.getAvailable())) {
logger.info("Inactive Job " + scheduledJob.getId() + ":"