8244018: No error message for non-existent icon path
Reviewed-by: asemenyuk, almatvee
This commit is contained in:
parent
14ae7cf769
commit
342edb4c6d
@ -295,6 +295,17 @@ public class DeployParams {
|
||||
throw new PackagerException("ERR_LicenseFileNotExit");
|
||||
}
|
||||
}
|
||||
|
||||
// Validate icon file if set
|
||||
String icon = (String)bundlerArguments.get(
|
||||
Arguments.CLIOptions.ICON.getId());
|
||||
if (icon != null) {
|
||||
File iconFile = new File(icon);
|
||||
if (!iconFile.exists()) {
|
||||
throw new PackagerException("ERR_IconFileNotExit",
|
||||
iconFile.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setTargetFormat(String t) {
|
||||
|
@ -90,6 +90,7 @@ ERR_NoUniqueName=Error: --add-launcher <name>=<file path> requires a unique name
|
||||
ERR_NoJreInstallerName=Error: Jre Installers require a name parameter
|
||||
ERR_InvalidAppName=Error: Invalid Application name: {0}
|
||||
ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}
|
||||
ERR_IconFileNotExit=Error: Specified icon file [{0}] does not exist
|
||||
ERR_LicenseFileNotExit=Error: Specified license file does not exist
|
||||
ERR_BuildRootInvalid=Error: temp ({0}) must be non-existant or empty directory
|
||||
ERR_InvalidOption=Error: Invalid Option: [{0}]
|
||||
|
@ -89,6 +89,7 @@ ERR_NoUniqueName=\u30A8\u30E9\u30FC: --add-launcher <name>=<file path>\u306B\u30
|
||||
ERR_NoJreInstallerName=\u30A8\u30E9\u30FC: Jre\u30A4\u30F3\u30B9\u30C8\u30FC\u30E9\u306B\u306F\u540D\u524D\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u5FC5\u8981\u3067\u3059
|
||||
ERR_InvalidAppName=\u30A8\u30E9\u30FC: \u7121\u52B9\u306A\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u540D: {0}
|
||||
ERR_InvalidSLName=\u30A8\u30E9\u30FC: \u7121\u52B9\u306A\u8FFD\u52A0\u30E9\u30F3\u30C1\u30E3\u540D: {0}
|
||||
ERR_IconFileNotExit=Error: Specified icon file [{0}] does not exist
|
||||
ERR_LicenseFileNotExit=\u30A8\u30E9\u30FC: \u6307\u5B9A\u3055\u308C\u305F\u30E9\u30A4\u30BB\u30F3\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u306F\u5B58\u5728\u3057\u307E\u305B\u3093
|
||||
ERR_BuildRootInvalid=\u30A8\u30E9\u30FC: \u4E00\u6642({0})\u306F\u5B58\u5728\u3057\u306A\u3044\u304B\u3001\u7A7A\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059
|
||||
ERR_InvalidOption=\u30A8\u30E9\u30FC: \u7121\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3: [{0}]
|
||||
|
@ -89,6 +89,7 @@ ERR_NoUniqueName=\u9519\u8BEF\uFF1A--add-launcher <name>=<file path> \u9700\u898
|
||||
ERR_NoJreInstallerName=\u9519\u8BEF\uFF1AJre \u5B89\u88C5\u7A0B\u5E8F\u9700\u8981\u4E00\u4E2A\u540D\u79F0\u53C2\u6570
|
||||
ERR_InvalidAppName=\u9519\u8BEF\uFF1A\u5E94\u7528\u7A0B\u5E8F\u540D\u79F0 {0} \u65E0\u6548
|
||||
ERR_InvalidSLName=\u9519\u8BEF\uFF1A\u6DFB\u52A0\u542F\u52A8\u7A0B\u5E8F\u540D\u79F0 {0} \u65E0\u6548
|
||||
ERR_IconFileNotExit=Error: Specified icon file [{0}] does not exist
|
||||
ERR_LicenseFileNotExit=\u9519\u8BEF\uFF1A\u6307\u5B9A\u7684\u8BB8\u53EF\u8BC1\u6587\u4EF6\u4E0D\u5B58\u5728
|
||||
ERR_BuildRootInvalid=\u9519\u8BEF\uFF1A\u4E34\u65F6\u76EE\u5F55 ({0}) \u5FC5\u987B\u662F\u4E0D\u5B58\u5728\u7684\u76EE\u5F55\u6216\u7A7A\u767D\u76EE\u5F55
|
||||
ERR_InvalidOption=\u9519\u8BEF\uFF1A\u9009\u9879 [{0}] \u65E0\u6548
|
||||
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package jdk.jpackage.tests;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import jdk.jpackage.test.Annotations.Parameters;
|
||||
import jdk.jpackage.test.Annotations.Test;
|
||||
import jdk.jpackage.test.JPackageCommand;
|
||||
import jdk.jpackage.test.TKit;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary jpackage application version testing
|
||||
* @library ../../../../helpers
|
||||
* @build jdk.jpackage.test.*
|
||||
* @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal
|
||||
* @compile NonExistentTest.java
|
||||
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
|
||||
* --jpt-run=jdk.jpackage.tests.NonExistentTest
|
||||
*/
|
||||
|
||||
public final class NonExistentTest {
|
||||
|
||||
private final String expectedError;
|
||||
private final JPackageCommand cmd;
|
||||
|
||||
@Parameters
|
||||
public static Collection input() {
|
||||
return List.of(new Object[][]{
|
||||
// non-existent icon
|
||||
{"Hello",
|
||||
new String[]{"--icon", "non-existent"},
|
||||
"Error:"},
|
||||
{"com.other/com.other.Hello",
|
||||
new String[]{"--icon", "non-existent"},
|
||||
"Error:"},
|
||||
// non-existent input
|
||||
{"Hello",
|
||||
new String[]{"--input", "non-existent"},
|
||||
"Exception:"},
|
||||
{"com.other/com.other.Hello",
|
||||
new String[]{"--input", "non-existent"},
|
||||
"Exception:"},
|
||||
// non-existent resource-dir
|
||||
{"Hello",
|
||||
new String[]{"--resource-dir", "non-existent"},
|
||||
"Specified resource directory"},
|
||||
{"com.other/com.other.Hello",
|
||||
new String[]{"--resource-dir", "non-existent"},
|
||||
"Specified resource directory"},
|
||||
});
|
||||
}
|
||||
|
||||
public NonExistentTest(String javaAppDesc, String[] jpackageArgs,
|
||||
String expectedError) {
|
||||
this.expectedError = expectedError;
|
||||
|
||||
cmd = JPackageCommand.helloAppImage(javaAppDesc)
|
||||
.saveConsoleOutput(true).dumpOutput(true);
|
||||
if (jpackageArgs != null) {
|
||||
cmd.addArguments(jpackageArgs);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
List<String> output = cmd.execute(1).getOutput();
|
||||
TKit.assertNotNull(output, "output is null");
|
||||
TKit.assertTextStream(expectedError).apply(output.stream());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user