Looly 4 年 前
コミット
e71cc5bc32

+ 1 - 0
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)
 
 -------------------------------------------------------------------------------------------------------------
 

+ 11 - 0
hutool-core/src/main/java/cn/hutool/core/compiler/CompilerUtil.java

@@ -40,6 +40,17 @@ public class CompilerUtil {
 	}
 
 	/**
+	 * 获取{@link StandardJavaFileManager}
+	 *
+	 * @param diagnosticListener 异常收集器
+	 * @return {@link StandardJavaFileManager}
+	 * @since 5.5.8
+	 */
+	public static StandardJavaFileManager getFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener) {
+		return SYSTEM_COMPILER.getStandardFileManager(null, null, null);
+	}
+
+	/**
 	 * 新建编译任务
 	 *
 	 * @param fileManager        {@link JavaFileManager},用于管理已经编译好的文件

+ 3 - 2
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<String> options = new ArrayList<>();
 		if (false == classPath.isEmpty()) {
-			final List<String> cp = classPath.stream().map(File::getAbsolutePath).collect(Collectors.toList());
+			final List<String> cp = CollUtil.map(classPath, File::getAbsolutePath, true);
 			options.add("-cp");
-			options.addAll(cp);
+			options.add(CollUtil.join(cp, FileUtil.isWindows() ? ";" : ":"));
 		}
 
 		// 编译文件

+ 2 - 1
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);
 	}
 
-}
+}

+ 4 - 4
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);

+ 2 - 2
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/"));
 	}

+ 6 - 5
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 <code>]]&gt;</code>.
-	 * @throws JSONException If the <code>]]&gt;</code> 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: <code>&amp;  '  &gt;  &lt;  &quot;</code>.
+	 * 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 &lt;!...&gt; and &lt;?...?&gt; structures.
 	 *
-	 * @return Syntax characters (<code>&lt; &gt; / = ! ?</code>) 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: <code>/ &gt; = ! ?</code> 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. <br>
+	 * 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.