diff --git a/CHANGELOG.md b/CHANGELOG.md index a5c55f0cb..fc1a1602a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ * 【core 】 修复UrlBuilder.of的query中含有?丢失问题(issue#I2CNPS@Gitee) * 【crypto 】 修复BCrypt.checkpw报错问题(issue#1377@Github) * 【extra 】 修复Fftp中cd失败导致的问题(issue#1371@Github) +* 【core 】 修复Fftp中cd失败导致的问题(issue#1371@Github) ------------------------------------------------------------------------------------------------------------- diff --git a/hutool-core/src/main/java/cn/hutool/core/compiler/CompilerUtil.java b/hutool-core/src/main/java/cn/hutool/core/compiler/CompilerUtil.java index 901bbaf0c..1af24f204 100644 --- a/hutool-core/src/main/java/cn/hutool/core/compiler/CompilerUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/compiler/CompilerUtil.java @@ -39,6 +39,17 @@ public class CompilerUtil { return SYSTEM_COMPILER.getStandardFileManager(null, null, null); } + /** + * 获取{@link StandardJavaFileManager} + * + * @param diagnosticListener 异常收集器 + * @return {@link StandardJavaFileManager} + * @since 5.5.8 + */ + public static StandardJavaFileManager getFileManager(DiagnosticListener diagnosticListener) { + return SYSTEM_COMPILER.getStandardFileManager(null, null, null); + } + /** * 新建编译任务 * diff --git a/hutool-core/src/main/java/cn/hutool/core/compiler/JavaSourceCompiler.java b/hutool-core/src/main/java/cn/hutool/core/compiler/JavaSourceCompiler.java index 609bf0423..95030aa1b 100644 --- a/hutool-core/src/main/java/cn/hutool/core/compiler/JavaSourceCompiler.java +++ b/hutool-core/src/main/java/cn/hutool/core/compiler/JavaSourceCompiler.java @@ -1,5 +1,6 @@ package cn.hutool.core.compiler; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.resource.FileResource; @@ -182,9 +183,9 @@ public class JavaSourceCompiler { // classpath final List options = new ArrayList<>(); if (false == classPath.isEmpty()) { - final List cp = classPath.stream().map(File::getAbsolutePath).collect(Collectors.toList()); + final List cp = CollUtil.map(classPath, File::getAbsolutePath, true); options.add("-cp"); - options.addAll(cp); + options.add(CollUtil.join(cp, FileUtil.isWindows() ? ";" : ":")); } // 编译文件 diff --git a/hutool-core/src/test/java/cn/hutool/core/compiler/JavaSourceCompilerTest.java b/hutool-core/src/test/java/cn/hutool/core/compiler/JavaSourceCompilerTest.java index 5131e7bdb..da50d4e89 100644 --- a/hutool-core/src/test/java/cn/hutool/core/compiler/JavaSourceCompilerTest.java +++ b/hutool-core/src/test/java/cn/hutool/core/compiler/JavaSourceCompilerTest.java @@ -33,6 +33,7 @@ public class JavaSourceCompilerTest { .addSource(FileUtil.file("test-compile/b/B.java")) .addSource("c.C", FileUtil.readUtf8String("test-compile/c/C.java")) .addLibrary(libFile) +// .addLibrary(FileUtil.file("D:\\m2_repo\\cn\\hutool\\hutool-all\\5.5.7\\hutool-all-5.5.7.jar")) .compile(); final Class clazz = classLoader.loadClass("c.C"); Object obj = ReflectUtil.newInstance(clazz); @@ -40,4 +41,4 @@ public class JavaSourceCompilerTest { FileUtil.del(libFile); } -} \ No newline at end of file +} diff --git a/hutool-core/src/test/java/cn/hutool/core/date/DateUtilTest.java b/hutool-core/src/test/java/cn/hutool/core/date/DateUtilTest.java index 16e7baace..f4654abc4 100644 --- a/hutool-core/src/test/java/cn/hutool/core/date/DateUtilTest.java +++ b/hutool-core/src/test/java/cn/hutool/core/date/DateUtilTest.java @@ -230,12 +230,12 @@ public class DateUtilTest { String formatChineseDate = DateUtil.formatChineseDate(DateUtil.parse("2018-02-24"), true, false); Assert.assertEquals("二〇一八年二月二十四日", formatChineseDate); } - + @Test public void formatChineseDateTimeTest() { String formatChineseDateTime = DateUtil.formatChineseDate(DateUtil.parse("2018-02-24 12:13:14"), true, true); Assert.assertEquals("二〇一八年二月二十四日一十二时一十三分一十四秒", formatChineseDateTime); - } + } @Test public void formatBetweenTest() { @@ -751,7 +751,7 @@ public class DateUtilTest { boolean expired = DateUtil.isExpired(startDate, DateField.DAY_OF_YEAR, length, endDate); Assert.assertTrue(expired); } - + @Test public void localDateTimeTest() { // 测试字符串与LocalDateTime的互相转换 @@ -759,7 +759,7 @@ public class DateUtilTest { LocalDateTime ldt = DateUtil.parseLocalDateTime(strDate); String strDate1 = DateUtil.formatLocalDateTime(ldt); Assert.assertEquals(strDate, strDate1); - + String strDate2 = "2019-12-01 17:02:30.111"; ldt = DateUtil.parseLocalDateTime(strDate2, DatePattern.NORM_DATETIME_MS_PATTERN); strDate1 = DateUtil.format(ldt, DatePattern.NORM_DATETIME_PATTERN); diff --git a/hutool-extra/src/test/java/cn/hutool/extra/compress/ExtractorTest.java b/hutool-extra/src/test/java/cn/hutool/extra/compress/ExtractorTest.java index bbfdcda4f..85538d40b 100644 --- a/hutool-extra/src/test/java/cn/hutool/extra/compress/ExtractorTest.java +++ b/hutool-extra/src/test/java/cn/hutool/extra/compress/ExtractorTest.java @@ -9,11 +9,11 @@ import org.junit.Test; public class ExtractorTest { @Test - @Ignore +// @Ignore public void zipTest(){ Extractor extractor = CompressUtil.createExtractor( CharsetUtil.defaultCharset(), - FileUtil.file("d:/test/compress/test.zip")); + FileUtil.file("d:/test/c_1344112734760931330_20201230104703032.zip")); extractor.extract(FileUtil.file("d:/test/compress/test2/")); } diff --git a/hutool-json/src/main/java/cn/hutool/json/XMLTokener.java b/hutool-json/src/main/java/cn/hutool/json/XMLTokener.java index 9ed2559f8..f0979cb52 100644 --- a/hutool-json/src/main/java/cn/hutool/json/XMLTokener.java +++ b/hutool-json/src/main/java/cn/hutool/json/XMLTokener.java @@ -35,8 +35,8 @@ public class XMLTokener extends JSONTokener { /** * Get the text in the CDATA block. * - * @return The string up to the ]]>. - * @throws JSONException If the ]]> is not found. + * @return The string up to the {@code ]]>}. + * @throws JSONException If the {@code ]]>} is not found. */ public String nextCDATA() throws JSONException { char c; @@ -91,7 +91,7 @@ public class XMLTokener extends JSONTokener { } /** - * Return the next entity. These entities are translated to Characters: & ' > < ". + * Return the next entity. These entities are translated to Characters: {@code & ' > < "}. * * @param ampersand An ampersand character. * @return A Character or an entity String if the entity is not recognized. @@ -117,7 +117,7 @@ public class XMLTokener extends JSONTokener { /** * Returns the next XML meta token. This is used for skipping over <!...> and <?...?> structures. * - * @return Syntax characters (< > / = ! ?) are returned as Character, and strings and names are returned as Boolean. We don't care what the values actually are. + * @return Syntax characters ({@code < > / = ! ?}) are returned as Character, and strings and names are returned as Boolean. We don't care what the values actually are. * @throws JSONException 字符串中属性未关闭或XML结构错误抛出此异常。If a string is not properly closed or if the XML is badly structured. */ public Object nextMeta() throws JSONException { @@ -177,7 +177,8 @@ public class XMLTokener extends JSONTokener { } /** - * Get the next XML Token. These tokens are found inside of angle brackets. It may be one of these characters: / > = ! ? or it may be a string wrapped in single quotes or double + * Get the next XML Token. These tokens are found inside of angle brackets.
+ * It may be one of these characters: {@code / > = ! ?} or it may be a string wrapped in single quotes or double * quotes, or it may be a name. * * @return a String or a Character.