code clean up
This commit is contained in:
parent
ab884df75d
commit
ce6fad38d1
12 changed files with 31 additions and 24 deletions
|
@ -45,12 +45,12 @@ public class SearchForm {
|
|||
return SearchLogPager.DEFAULT_PAGE_SIZE;
|
||||
}
|
||||
try {
|
||||
int value = Integer.parseInt(size);
|
||||
final int value = Integer.parseInt(size);
|
||||
if (value <= 0 || value > ComponentUtil.getFessConfig().getPageSearchlogMaxFetchSizeAsInteger()) {
|
||||
return SearchLogPager.DEFAULT_PAGE_SIZE;
|
||||
}
|
||||
return value;
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
// ignore
|
||||
return SearchLogPager.DEFAULT_PAGE_SIZE;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class DictionaryFile<T extends DictionaryItem> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public void writeOut(WrittenStreamOut out) throws IOException {
|
||||
public void writeOut(final WrittenStreamOut out) throws IOException {
|
||||
try (final CurlResponse curlResponse = dictionaryManager.getContentResponse(this);
|
||||
final InputStream inputStream = new BufferedInputStream(curlResponse.getContentAsStream())) {
|
||||
out.write(inputStream);
|
||||
|
|
|
@ -134,7 +134,7 @@ public class ProtwordsFile extends DictionaryFile<ProtwordsItem> {
|
|||
}
|
||||
|
||||
final String inputStrings = line;
|
||||
String input = unescape(inputStrings);
|
||||
final String input = unescape(inputStrings);
|
||||
|
||||
if (input.length() > 0) {
|
||||
id++;
|
||||
|
|
|
@ -155,8 +155,8 @@ public class StemmerOverrideFile extends DictionaryFile<StemmerOverrideItem> {
|
|||
continue;
|
||||
}
|
||||
|
||||
String input = m.group(1).trim();
|
||||
String output = m.group(2).trim();
|
||||
final String input = m.group(1).trim();
|
||||
final String output = m.group(2).trim();
|
||||
|
||||
if (input == null || output == null) {
|
||||
logger.warn("Failed to parse " + line + " in " + path);
|
||||
|
|
|
@ -81,24 +81,31 @@ public class StemmerOverrideItem extends DictionaryItem {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
if (obj == null)
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
StemmerOverrideItem other = (StemmerOverrideItem) obj;
|
||||
}
|
||||
final StemmerOverrideItem other = (StemmerOverrideItem) obj;
|
||||
if (input == null) {
|
||||
if (other.input != null)
|
||||
if (other.input != null) {
|
||||
return false;
|
||||
} else if (!input.equals(other.input))
|
||||
}
|
||||
} else if (!input.equals(other.input)) {
|
||||
return false;
|
||||
}
|
||||
if (output == null) {
|
||||
if (other.output != null)
|
||||
if (other.output != null) {
|
||||
return false;
|
||||
} else if (!output.equals(other.output))
|
||||
}
|
||||
} else if (!output.equals(other.output)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public class StopwordsFile extends DictionaryFile<StopwordsItem> {
|
|||
}
|
||||
|
||||
final String inputStrings = line;
|
||||
String input = unescape(inputStrings);
|
||||
final String input = unescape(inputStrings);
|
||||
|
||||
if (input.length() > 0) {
|
||||
id++;
|
||||
|
|
|
@ -1175,7 +1175,7 @@ public class FessEsClient implements Client {
|
|||
T build(R response, H hit);
|
||||
}
|
||||
|
||||
public void setClusterName(String clusterName) {
|
||||
public void setClusterName(final String clusterName) {
|
||||
this.clusterName = clusterName;
|
||||
}
|
||||
|
||||
|
@ -1491,7 +1491,7 @@ public class FessEsClient implements Client {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FieldCapabilitiesRequestBuilder prepareFieldCaps(String... indices) {
|
||||
public FieldCapabilitiesRequestBuilder prepareFieldCaps(final String... indices) {
|
||||
return client.prepareFieldCaps(indices);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public interface CrawlingConfig {
|
|||
public enum ConfigType {
|
||||
WEB("W"), FILE("F"), DATA("D");
|
||||
|
||||
private String typePrefix;
|
||||
private final String typePrefix;
|
||||
|
||||
ConfigType(final String typePrefix) {
|
||||
this.typePrefix = typePrefix;
|
||||
|
|
|
@ -82,7 +82,7 @@ public class PopularWordHelper {
|
|||
try {
|
||||
popularWordsRequestBuilder.execute().getResponse().getItems().stream()
|
||||
.forEach(item -> wordList.add(item.getText()));
|
||||
} catch (SuggesterException e) {
|
||||
} catch (final SuggesterException e) {
|
||||
logger.warn("Failed to generate popular words.", e);
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ public class ViewHelper {
|
|||
final String escaped = LaFunctions.h(text);
|
||||
int pos = escaped.indexOf(escapedHighlightPre);
|
||||
while (pos >= 0) {
|
||||
int c = escaped.codePointAt(pos);
|
||||
final int c = escaped.codePointAt(pos);
|
||||
if (Character.isISOControl(c) || hihglightTerminalCharSet.contains(c)) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -495,12 +495,12 @@ public class ThumbnailManager {
|
|||
}
|
||||
Files.move(path, newPath);
|
||||
logger.info("Move " + path + " to " + newPath);
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
logger.warn("Failed to move " + path, e);
|
||||
}
|
||||
}
|
||||
} );
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
logger.warn("Failed to migrate thumbnail images.", e);
|
||||
}
|
||||
}, "ThumbnailMigrator").start();
|
||||
|
|
|
@ -81,7 +81,7 @@ public class QueryStringBuilder {
|
|||
return queryBuf.toString().trim();
|
||||
}
|
||||
|
||||
protected void appendQuery(final StringBuilder queryBuf, String q) {
|
||||
protected void appendQuery(final StringBuilder queryBuf, final String q) {
|
||||
final boolean exists = q.indexOf(OR) != -1 || q.indexOf(OR_ALT) != -1;
|
||||
queryBuf.append(' ');
|
||||
if (exists) {
|
||||
|
|
Loading…
Add table
Reference in a new issue