mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -205,12 +205,7 @@ public class Sftp extends AbstractFtp {
|
||||
* @since 4.0.5
|
||||
*/
|
||||
public List<String> lsDirs(String path) {
|
||||
return ls(path, new Filter<LsEntry>() {
|
||||
@Override
|
||||
public boolean accept(LsEntry t) {
|
||||
return t.getAttrs().isDir();
|
||||
}
|
||||
});
|
||||
return ls(path, t -> t.getAttrs().isDir());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,12 +216,7 @@ public class Sftp extends AbstractFtp {
|
||||
* @since 4.0.5
|
||||
*/
|
||||
public List<String> lsFiles(String path) {
|
||||
return ls(path, new Filter<LsEntry>() {
|
||||
@Override
|
||||
public boolean accept(LsEntry t) {
|
||||
return false == t.getAttrs().isDir();
|
||||
}
|
||||
});
|
||||
return ls(path, t -> false == t.getAttrs().isDir());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,17 +230,14 @@ public class Sftp extends AbstractFtp {
|
||||
public List<String> ls(String path, final Filter<LsEntry> filter) {
|
||||
final List<String> fileNames = new ArrayList<>();
|
||||
try {
|
||||
channel.ls(path, new LsEntrySelector() {
|
||||
@Override
|
||||
public int select(LsEntry entry) {
|
||||
String fileName = entry.getFilename();
|
||||
if (false == StrUtil.equals(".", fileName) && false == StrUtil.equals("..", fileName)) {
|
||||
if (null == filter || filter.accept(entry)) {
|
||||
fileNames.add(entry.getFilename());
|
||||
}
|
||||
channel.ls(path, entry -> {
|
||||
String fileName = entry.getFilename();
|
||||
if (false == StrUtil.equals(".", fileName) && false == StrUtil.equals("..", fileName)) {
|
||||
if (null == filter || filter.accept(entry)) {
|
||||
fileNames.add(entry.getFilename());
|
||||
}
|
||||
return CONTINUE;
|
||||
}
|
||||
return LsEntrySelector.CONTINUE;
|
||||
});
|
||||
} catch (SftpException e) {
|
||||
throw new JschRuntimeException(e);
|
||||
@@ -316,7 +303,7 @@ public class Sftp extends AbstractFtp {
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector<LsEntry> list = null;
|
||||
Vector<LsEntry> list;
|
||||
try {
|
||||
list = channel.ls(channel.pwd());
|
||||
} catch (SftpException e) {
|
||||
@@ -418,7 +405,7 @@ public class Sftp extends AbstractFtp {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
JschUtil.close(this.channel);
|
||||
JschUtil.close(this.session);
|
||||
}
|
||||
|
@@ -68,7 +68,7 @@ public class ThymeleafEngine implements TemplateEngine {
|
||||
config = new TemplateConfig();
|
||||
}
|
||||
|
||||
ITemplateResolver resolver = null;
|
||||
ITemplateResolver resolver;
|
||||
switch (config.getResourceMode()) {
|
||||
case CLASSPATH:
|
||||
final ClassLoaderTemplateResolver classLoaderResolver = new ClassLoaderTemplateResolver();
|
||||
@@ -94,9 +94,6 @@ public class ThymeleafEngine implements TemplateEngine {
|
||||
case STRING:
|
||||
resolver = new StringTemplateResolver();
|
||||
break;
|
||||
case COMPOSITE:
|
||||
resolver = new DefaultTemplateResolver();
|
||||
break;
|
||||
default:
|
||||
resolver = new DefaultTemplateResolver();
|
||||
break;
|
||||
|
@@ -33,7 +33,7 @@ public class VelocityUtil {
|
||||
/** 是否初始化了默认引擎 */
|
||||
private static boolean isInited;
|
||||
/** 全局上下文,当设定值时,对于每个模板都有效 */
|
||||
private static Map<String, Object> globalContext = new HashMap<String, Object>();
|
||||
private static Map<String, Object> globalContext = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 设置Velocity全局上下文<br>
|
||||
@@ -278,7 +278,7 @@ public class VelocityUtil {
|
||||
public static VelocityContext parseRequest(VelocityContext context, javax.servlet.http.HttpServletRequest request) {
|
||||
final Enumeration<String> attrs = request.getAttributeNames();
|
||||
if (attrs != null) {
|
||||
String attrName = null;
|
||||
String attrName;
|
||||
while (attrs.hasMoreElements()) {
|
||||
attrName = attrs.nextElement();
|
||||
context.put(attrName, request.getAttribute(attrName));
|
||||
@@ -298,7 +298,7 @@ public class VelocityUtil {
|
||||
if (null != session) {
|
||||
final Enumeration<String> sessionAttrs = session.getAttributeNames();
|
||||
if (sessionAttrs != null) {
|
||||
String attrName = null;
|
||||
String attrName;
|
||||
while (sessionAttrs.hasMoreElements()) {
|
||||
attrName = sessionAttrs.nextElement();
|
||||
context.put(attrName, session.getAttribute(attrName));
|
||||
|
@@ -31,7 +31,7 @@ public class IKAnalyzerResult extends AbstractResult {
|
||||
|
||||
@Override
|
||||
protected Word nextWord() {
|
||||
Lexeme next = null;
|
||||
Lexeme next;
|
||||
try {
|
||||
next = this.seg.next();
|
||||
} catch (IOException e) {
|
||||
|
@@ -36,7 +36,7 @@ public class JcsegResult implements Result{
|
||||
if (this.cachedWord != null) {
|
||||
return true;
|
||||
}
|
||||
IWord next = null;
|
||||
IWord next;
|
||||
try {
|
||||
next = this.result.next();
|
||||
} catch (IOException e) {
|
||||
|
@@ -30,7 +30,7 @@ public class MmsegResult extends AbstractResult {
|
||||
|
||||
@Override
|
||||
protected Word nextWord() {
|
||||
com.chenlb.mmseg4j.Word next = null;
|
||||
com.chenlb.mmseg4j.Word next;
|
||||
try {
|
||||
next = this.mmSeg.next();
|
||||
} catch (IOException e) {
|
||||
|
Reference in New Issue
Block a user