# HG changeset patch # User herrick # Date 1554821824 14400 # Node ID 23da9e6f446fc7b8a391fa75890265b29d3bbaba # Parent 4948a1944cf9558d70ed905e85f7d64ed02bdc77 8221641: Follow up code clean up for JDK-8221582 Reviewed-by: almatvee diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties Tue Apr 09 10:57:04 2019 -0400 @@ -45,7 +45,6 @@ resource.rpm-spec-file=RPM spec file resource.rpm-init-script=RPM init script - error.parameters-null=Parameters map is null. error.parameters-null.advice=Pass in a non-null parameters map. error.parameters-null=Parameters map is null. @@ -69,11 +68,11 @@ message.icon-not-png=The specified icon "{0}" is not a PNG file and will not be used. The default icon will be used in it's place. -message.test-for-tool=Test for [{0}]. Result\: {1} -message.outputting-to-location=Generating DEB for installer to\: {0} -message.output-to-location=Package (.deb) saved to\: {0} +message.test-for-tool=Test for [{0}]. Result: {1} +message.outputting-to-location=Generating DEB for installer to: {0}. +message.output-to-location=Package (.deb) saved to: {0}. message.debs-like-licenses=Debian packages should specify a license. The absence of a license will cause some linux distributions to complain about the quality of the application. message.one-shortcut-required=At least one type of shortcut is required. Enabling menu shortcut. -message.outputting-bundle-location=Generating RPM for installer to\: {0} -message.output-bundle-location=Package (.rpm) saved to\: {0} +message.outputting-bundle-location=Generating RPM for installer to: {0}. +message.output-bundle-location=Package (.rpm) saved to: {0}. message.creating-association-with-null-extension=Creating association with null extension. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties Tue Apr 09 10:57:04 2019 -0400 @@ -45,7 +45,6 @@ resource.rpm-spec-file=RPM spec file resource.rpm-init-script=RPM init script - error.parameters-null=Parameters map is null. error.parameters-null.advice=Pass in a non-null parameters map. error.parameters-null=Parameters map is null. @@ -69,11 +68,11 @@ message.icon-not-png=The specified icon "{0}" is not a PNG file and will not be used. The default icon will be used in it's place. -message.test-for-tool=Test for [{0}]. Result\: {1} -message.outputting-to-location=Generating DEB for installer to\: {0} -message.output-to-location=Package (.deb) saved to\: {0} +message.test-for-tool=Test for [{0}]. Result: {1} +message.outputting-to-location=Generating DEB for installer to: {0}. +message.output-to-location=Package (.deb) saved to: {0}. message.debs-like-licenses=Debian packages should specify a license. The absence of a license will cause some linux distributions to complain about the quality of the application. message.one-shortcut-required=At least one type of shortcut is required. Enabling menu shortcut. -message.outputting-bundle-location=Generating RPM for installer to\: {0} -message.output-bundle-location=Package (.rpm) saved to\: {0} +message.outputting-bundle-location=Generating RPM for installer to: {0}. +message.output-bundle-location=Package (.rpm) saved to: {0}. message.creating-association-with-null-extension=Creating association with null extension. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties Tue Apr 09 10:57:04 2019 -0400 @@ -45,7 +45,6 @@ resource.rpm-spec-file=RPM spec file resource.rpm-init-script=RPM init script - error.parameters-null=Parameters map is null. error.parameters-null.advice=Pass in a non-null parameters map. error.parameters-null=Parameters map is null. @@ -69,11 +68,11 @@ message.icon-not-png=The specified icon "{0}" is not a PNG file and will not be used. The default icon will be used in it's place. -message.test-for-tool=Test for [{0}]. Result\: {1} -message.outputting-to-location=Generating DEB for installer to\: {0} -message.output-to-location=Package (.deb) saved to\: {0} +message.test-for-tool=Test for [{0}]. Result: {1} +message.outputting-to-location=Generating DEB for installer to: {0}. +message.output-to-location=Package (.deb) saved to: {0}. message.debs-like-licenses=Debian packages should specify a license. The absence of a license will cause some linux distributions to complain about the quality of the application. message.one-shortcut-required=At least one type of shortcut is required. Enabling menu shortcut. -message.outputting-bundle-location=Generating RPM for installer to\: {0} -message.output-bundle-location=Package (.rpm) saved to\: {0} +message.outputting-bundle-location=Generating RPM for installer to: {0}. +message.output-bundle-location=Package (.rpm) saved to: {0}. message.creating-association-with-null-extension=Creating association with null extension. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties Tue Apr 09 10:57:04 2019 -0400 @@ -27,13 +27,13 @@ app.bundler.name=Mac Application Image app.bundler.description=A Directory based image of a mac Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers store.bundler.name=Mac App Store Ready Bundler -store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store." +store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store. dmg.bundler.name=DMG Installer dmg.bundler.description=Mac DMG Installer Bundle pkg.bundler.name=PKG Installer pkg.bundler.description=Mac PKG Installer Bundle. -error.invalid-cfbundle-version=Invalid CFBundleVersion - ''{0}'' +error.invalid-cfbundle-version=Invalid CFBundleVersion: [{0}]. error.invalid-cfbundle-version.advice=Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots. error.explicit-sign-no-cert=Signature explicitly requested but no signing certificate specified. error.explicit-sign-no-cert.advice=Either specify a valid cert in 'mac.signing-key-developer-id-app' or unset 'signBundle' or set 'signBundle' to false. @@ -45,8 +45,6 @@ error.parameters-null.advice=Pass in a non-null parameters map. error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.no-system-runtime=Bundle Configured to use the System JRE -error.no-system-runtime.advice=Do not set 'runtime' to null, either don't set it or set it to a valid value. error.must-sign-app-store=Mac App Store apps must be signed, and signing has been disabled by bundler configuration. error.must-sign-app-store.advice=Either unset 'signBundle' or set 'signBundle' to true. error.no-app-signing-key=No Mac App Store App Signing Key @@ -73,35 +71,34 @@ message.bundle-name-too-long-warning={0} is set to ''{1}'', which is longer than 16 characters. For a better Mac experience consider shortening it. -message.no-mac-jre-support=Currently Macs require a JDK to package message.null-classpath=Null app resources? -message.preparing-info-plist=Preparing Info.plist\: {0} +message.preparing-info-plist=Preparing Info.plist: {0}. message.icon-not-icns= The specified icon "{0}" is not an ICNS file and will not be used. The default icon will be used in it's place. message.version-string-too-many-components=Version sting may have between 1 and 3 numbers: 1, 1.2, 1.2.3. message.version-string-first-number-not-zero=The first number in a CFBundleVersion cannot be zero or negative. message.version-string-no-negative-numbers=Negative numbers are not allowed in version strings. message.version-string-numbers-only=Version strings can consist of only numbers and up to two dots. message.creating-association-with-null-extension=Creating association with null extension. -message.ignoring.symlink=Warning: codesign is skipping the symlink {0} +message.ignoring.symlink=Warning: codesign is skipping the symlink {0}. message.keychain.error=Error: unable to get keychain list. -message.building-bundle=Building Mac App Store Bundle for {0} -mesasge.intermediate-bundle-location=Intermediate application bundle image\: {0} -message.app-image-dir-does-not-exist=Specified application image directory {0}\: {1} does not exists -message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.could-not-retrieve-name=Could not retrieve gecos name +message.building-bundle=Building Mac App Store Bundle for {0}. +mesasge.intermediate-bundle-location=Intermediate application bundle image: {0} +message.app-image-dir-does-not-exist=Specified application image directory {0}: {1} does not exists. +message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.could-not-retrieve-name=Could not retrieve gecos name. message.app-image-requires-app-name=When using an external app image you must specify the app name. message.app-image-requires-app-name.advice=Set the app name via the -name CLI flag, the fx:application/@name ANT attribute, or via the 'appName' bundler argument. message.app-image-requires-identifier=When using an external app image you must specify the identifier. message.app-image-requires-identifier.advice=Set the identifier via the -appId CLI flag, the fx:application/@id ANT attribute, or via the 'identifier' bundler argument. -message.building-dmg=Building DMG package for {0} -message.running-script=Running shell script on application image [{0}] -message.intermediate-image-location=[DEBUG] Intermediate application bundle image\: {0} -message.preparing-dmg-setup=Preparing dmg setup\: {0} -message.creating-dmg-file=Creating DMG file\: {0} +message.building-dmg=Building DMG package for {0}. +message.running-script=Running shell script on application image [{0}]. +message.intermediate-image-location=[DEBUG] Intermediate application bundle image: {0}. +message.preparing-dmg-setup=Preparing dmg setup: {0}. +message.creating-dmg-file=Creating DMG file: {0}. message.dmg-cannot-be-overwritten=Dmg file exists ({0} and can not be removed. -message.output-to-location=Result DMG installer for {0}\: {1} -message.building-pkg=Building PKG package for {0} -message.preparing-scripts=Preparing package scripts -message.preparing-distribution-dist=Preparing distribution.dist\: {0} +message.output-to-location=Result DMG installer for {0}: {1}. +message.building-pkg=Building PKG package for {0}. +message.preparing-scripts=Preparing package scripts. +message.preparing-distribution-dist=Preparing distribution.dist: {0}. message.signing.pkg=Warning: For signing PKG, you might need to set "Always Trust" for your certificate using "Keychain Access" tool. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties Tue Apr 09 10:57:04 2019 -0400 @@ -27,13 +27,13 @@ app.bundler.name=Mac Application Image app.bundler.description=A Directory based image of a mac Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers store.bundler.name=Mac App Store Ready Bundler -store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store." +store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store. dmg.bundler.name=DMG Installer dmg.bundler.description=Mac DMG Installer Bundle pkg.bundler.name=PKG Installer pkg.bundler.description=Mac PKG Installer Bundle. -error.invalid-cfbundle-version=Invalid CFBundleVersion - ''{0}'' +error.invalid-cfbundle-version=Invalid CFBundleVersion: [{0}]. error.invalid-cfbundle-version.advice=Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots. error.explicit-sign-no-cert=Signature explicitly requested but no signing certificate specified. error.explicit-sign-no-cert.advice=Either specify a valid cert in 'mac.signing-key-developer-id-app' or unset 'signBundle' or set 'signBundle' to false. @@ -45,8 +45,6 @@ error.parameters-null.advice=Pass in a non-null parameters map. error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.no-system-runtime=Bundle Configured to use the System JRE -error.no-system-runtime.advice=Do not set 'runtime' to null, either don't set it or set it to a valid value. error.must-sign-app-store=Mac App Store apps must be signed, and signing has been disabled by bundler configuration. error.must-sign-app-store.advice=Either unset 'signBundle' or set 'signBundle' to true. error.no-app-signing-key=No Mac App Store App Signing Key @@ -73,35 +71,34 @@ message.bundle-name-too-long-warning={0} is set to ''{1}'', which is longer than 16 characters. For a better Mac experience consider shortening it. -message.no-mac-jre-support=Currently Macs require a JDK to package message.null-classpath=Null app resources? -message.preparing-info-plist=Preparing Info.plist\: {0} +message.preparing-info-plist=Preparing Info.plist: {0}. message.icon-not-icns= The specified icon "{0}" is not an ICNS file and will not be used. The default icon will be used in it's place. message.version-string-too-many-components=Version sting may have between 1 and 3 numbers: 1, 1.2, 1.2.3. message.version-string-first-number-not-zero=The first number in a CFBundleVersion cannot be zero or negative. message.version-string-no-negative-numbers=Negative numbers are not allowed in version strings. message.version-string-numbers-only=Version strings can consist of only numbers and up to two dots. message.creating-association-with-null-extension=Creating association with null extension. -message.ignoring.symlink=Warning: codesign is skipping the symlink {0} +message.ignoring.symlink=Warning: codesign is skipping the symlink {0}. message.keychain.error=Error: unable to get keychain list. -message.building-bundle=Building Mac App Store Bundle for {0} -mesasge.intermediate-bundle-location=Intermediate application bundle image\: {0} -message.app-image-dir-does-not-exist=Specified application image directory {0}\: {1} does not exists -message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.could-not-retrieve-name=Could not retrieve gecos name +message.building-bundle=Building Mac App Store Bundle for {0}. +mesasge.intermediate-bundle-location=Intermediate application bundle image: {0} +message.app-image-dir-does-not-exist=Specified application image directory {0}: {1} does not exists. +message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.could-not-retrieve-name=Could not retrieve gecos name. message.app-image-requires-app-name=When using an external app image you must specify the app name. message.app-image-requires-app-name.advice=Set the app name via the -name CLI flag, the fx:application/@name ANT attribute, or via the 'appName' bundler argument. message.app-image-requires-identifier=When using an external app image you must specify the identifier. message.app-image-requires-identifier.advice=Set the identifier via the -appId CLI flag, the fx:application/@id ANT attribute, or via the 'identifier' bundler argument. -message.building-dmg=Building DMG package for {0} -message.running-script=Running shell script on application image [{0}] -message.intermediate-image-location=[DEBUG] Intermediate application bundle image\: {0} -message.preparing-dmg-setup=Preparing dmg setup\: {0} -message.creating-dmg-file=Creating DMG file\: {0} +message.building-dmg=Building DMG package for {0}. +message.running-script=Running shell script on application image [{0}]. +message.intermediate-image-location=[DEBUG] Intermediate application bundle image: {0}. +message.preparing-dmg-setup=Preparing dmg setup: {0}. +message.creating-dmg-file=Creating DMG file: {0}. message.dmg-cannot-be-overwritten=Dmg file exists ({0} and can not be removed. -message.output-to-location=Result DMG installer for {0}\: {1} -message.building-pkg=Building PKG package for {0} -message.preparing-scripts=Preparing package scripts -message.preparing-distribution-dist=Preparing distribution.dist\: {0} +message.output-to-location=Result DMG installer for {0}: {1}. +message.building-pkg=Building PKG package for {0}. +message.preparing-scripts=Preparing package scripts. +message.preparing-distribution-dist=Preparing distribution.dist: {0}. message.signing.pkg=Warning: For signing PKG, you might need to set "Always Trust" for your certificate using "Keychain Access" tool. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties Tue Apr 09 10:57:04 2019 -0400 @@ -27,13 +27,13 @@ app.bundler.name=Mac Application Image app.bundler.description=A Directory based image of a mac Application with an optionally co-bundled JRE. Used as a base for the Installer bundlers store.bundler.name=Mac App Store Ready Bundler -store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store." +store.bundler.description=Creates a binary bundle ready for deployment into the Mac App Store. dmg.bundler.name=DMG Installer dmg.bundler.description=Mac DMG Installer Bundle pkg.bundler.name=PKG Installer pkg.bundler.description=Mac PKG Installer Bundle. -error.invalid-cfbundle-version=Invalid CFBundleVersion - ''{0}'' +error.invalid-cfbundle-version=Invalid CFBundleVersion: [{0}]. error.invalid-cfbundle-version.advice=Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots. error.explicit-sign-no-cert=Signature explicitly requested but no signing certificate specified. error.explicit-sign-no-cert.advice=Either specify a valid cert in 'mac.signing-key-developer-id-app' or unset 'signBundle' or set 'signBundle' to false. @@ -45,8 +45,6 @@ error.parameters-null.advice=Pass in a non-null parameters map. error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.no-system-runtime=Bundle Configured to use the System JRE -error.no-system-runtime.advice=Do not set 'runtime' to null, either don't set it or set it to a valid value. error.must-sign-app-store=Mac App Store apps must be signed, and signing has been disabled by bundler configuration. error.must-sign-app-store.advice=Either unset 'signBundle' or set 'signBundle' to true. error.no-app-signing-key=No Mac App Store App Signing Key @@ -73,35 +71,34 @@ message.bundle-name-too-long-warning={0} is set to ''{1}'', which is longer than 16 characters. For a better Mac experience consider shortening it. -message.no-mac-jre-support=Currently Macs require a JDK to package message.null-classpath=Null app resources? -message.preparing-info-plist=Preparing Info.plist\: {0} +message.preparing-info-plist=Preparing Info.plist: {0}. message.icon-not-icns= The specified icon "{0}" is not an ICNS file and will not be used. The default icon will be used in it's place. message.version-string-too-many-components=Version sting may have between 1 and 3 numbers: 1, 1.2, 1.2.3. message.version-string-first-number-not-zero=The first number in a CFBundleVersion cannot be zero or negative. message.version-string-no-negative-numbers=Negative numbers are not allowed in version strings. message.version-string-numbers-only=Version strings can consist of only numbers and up to two dots. message.creating-association-with-null-extension=Creating association with null extension. -message.ignoring.symlink=Warning: codesign is skipping the symlink {0} +message.ignoring.symlink=Warning: codesign is skipping the symlink {0}. message.keychain.error=Error: unable to get keychain list. -message.building-bundle=Building Mac App Store Bundle for {0} -mesasge.intermediate-bundle-location=Intermediate application bundle image\: {0} -message.app-image-dir-does-not-exist=Specified application image directory {0}\: {1} does not exists -message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.could-not-retrieve-name=Could not retrieve gecos name +message.building-bundle=Building Mac App Store Bundle for {0}. +mesasge.intermediate-bundle-location=Intermediate application bundle image: {0} +message.app-image-dir-does-not-exist=Specified application image directory {0}: {1} does not exists. +message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.could-not-retrieve-name=Could not retrieve gecos name. message.app-image-requires-app-name=When using an external app image you must specify the app name. message.app-image-requires-app-name.advice=Set the app name via the -name CLI flag, the fx:application/@name ANT attribute, or via the 'appName' bundler argument. message.app-image-requires-identifier=When using an external app image you must specify the identifier. message.app-image-requires-identifier.advice=Set the identifier via the -appId CLI flag, the fx:application/@id ANT attribute, or via the 'identifier' bundler argument. -message.building-dmg=Building DMG package for {0} -message.running-script=Running shell script on application image [{0}] -message.intermediate-image-location=[DEBUG] Intermediate application bundle image\: {0} -message.preparing-dmg-setup=Preparing dmg setup\: {0} -message.creating-dmg-file=Creating DMG file\: {0} +message.building-dmg=Building DMG package for {0}. +message.running-script=Running shell script on application image [{0}]. +message.intermediate-image-location=[DEBUG] Intermediate application bundle image: {0}. +message.preparing-dmg-setup=Preparing dmg setup: {0}. +message.creating-dmg-file=Creating DMG file: {0}. message.dmg-cannot-be-overwritten=Dmg file exists ({0} and can not be removed. -message.output-to-location=Result DMG installer for {0}\: {1} -message.building-pkg=Building PKG package for {0} -message.preparing-scripts=Preparing package scripts -message.preparing-distribution-dist=Preparing distribution.dist\: {0} +message.output-to-location=Result DMG installer for {0}: {1}. +message.building-pkg=Building PKG package for {0}. +message.preparing-scripts=Preparing package scripts. +message.preparing-distribution-dist=Preparing distribution.dist: {0}. message.signing.pkg=Warning: For signing PKG, you might need to set "Always Trust" for your certificate using "Keychain Access" tool. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java Tue Apr 09 10:57:04 2019 -0400 @@ -719,7 +719,7 @@ } private void addResources(DeployParams deployParams, - String inputdir) { + String inputdir) throws PackagerException { if (inputdir == null || inputdir.isEmpty()) { return; @@ -728,9 +728,10 @@ File baseDir = new File(inputdir); if (!baseDir.isDirectory()) { - Log.error( - "Unable to add resources: \"--input\" is not a directory."); - return; + throw new PackagerException("ERR_InputNotDirectory", inputdir); + } + if (!baseDir.canRead()) { + throw new PackagerException("ERR_CannotReadInputDir", inputdir); } List fileNames; diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DeployParams.java Tue Apr 09 10:57:04 2019 -0400 @@ -364,10 +364,6 @@ if (resources.isEmpty()) { throw new PackagerException("ERR_MissingAppResources"); } - if (!hasClass) { - throw new PackagerException("ERR_MissingArgument", - "--main-class"); - } if (!hasMain) { throw new PackagerException("ERR_MissingArgument", "--main-jar"); diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/share/classes/jdk/jpackage/internal/RelativeFileSet.java --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RelativeFileSet.java Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RelativeFileSet.java Tue Apr 09 10:57:04 2019 -0400 @@ -107,8 +107,11 @@ @Override public String toString() { + if (files.size() == 1) { + return "" + basedir + File.pathSeparator + files; + } return "RelativeFileSet {basedir:" + basedir - + ", files: {" + files + ")}"; + + ", files: {" + files + "}"; } } diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/StandardBundlerParam.java Tue Apr 09 10:57:04 2019 -0400 @@ -167,19 +167,33 @@ (s, p) -> s ); + static final StandardBundlerParam PREDEFINED_RUNTIME_IMAGE = + new StandardBundlerParam<>( + Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId(), + File.class, + params -> null, + (s, p) -> new File(s) + ); + static final StandardBundlerParam APP_NAME = new StandardBundlerParam<>( Arguments.CLIOptions.NAME.getId(), String.class, params -> { String s = MAIN_CLASS.fetchFrom(params); - if (s == null) return null; - - int idx = s.lastIndexOf("."); - if (idx >= 0) { - return s.substring(idx+1); + if (s != null) { + int idx = s.lastIndexOf("."); + if (idx >= 0) { + return s.substring(idx+1); + } + return s; + } else if (isRuntimeInstaller(params)) { + File f = PREDEFINED_RUNTIME_IMAGE.fetchFrom(params); + if (f != null) { + return f.getName(); + } } - return s; + return null; }, (s, p) -> s ); @@ -343,13 +357,6 @@ params -> null, (s, p) -> new File(s)); - static final StandardBundlerParam PREDEFINED_RUNTIME_IMAGE = - new StandardBundlerParam<>( - Arguments.CLIOptions.PREDEFINED_RUNTIME_IMAGE.getId(), - File.class, - params -> null, - (s, p) -> new File(s)); - @SuppressWarnings("unchecked") static final StandardBundlerParam>> ADD_LAUNCHERS = new StandardBundlerParam<>( @@ -718,17 +725,8 @@ } mainJarFile = new File(mainJarValue); if (mainJarFile.exists()) { - // absolute path for main-jar may fail is only legal if - // path is within the appResourceRoot directory - try { - return new RelativeFileSet(appResourcesRoot, - new LinkedHashSet<>(Collections.singletonList( - mainJarFile))); - } catch (Exception e) { - // if not within, RelativeFileSet constructor throws a - // RuntimeException, but the IllegalArgumentException - // below contains a more explicit error message. - } + // absolute path for main-jar may fail is not legal + // below contains explicit error message. } else { List modulePath = MODULE_PATH.fetchFrom(params); modulePath.removeAll(getDefaultModulePath()); diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties Tue Apr 09 10:57:04 2019 -0400 @@ -30,44 +30,42 @@ param.vendor.default=Unknown param.version.default=1.0 -message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize) -message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize) -message.using-custom-resource-from-file=Using custom package resource {0} (loaded from file {1}) -message.using-custom-resource=Using custom package resource {0} (loaded from {1}) -message.creating-app-bundle=Creating app bundle\: {0} in {1} -message.detected.modules="Automatically adding detected modules: {0}." -message.modules="Adding modules: {0} to runtime image." -message.app-image-dir-does-not-exist=Specified application image directory {0}\: {1} does not exists -message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.runtime-image-dir-does-not-exist=Specified runtime image directory {0}\: {1} does not exists -message.runtime-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.debug-working-directory=Kept working directory for debug\: {0} -message.bundle-created=Succeeded in building {0} bundle +message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize). +message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize). +message.using-custom-resource-from-file=Using custom package resource {0} (loaded from file {1}). +message.using-custom-resource=Using custom package resource {0} (loaded from {1}). +message.creating-app-bundle=Creating app bundle: {0} in {1}. +message.detected.modules=Automatically adding detected modules: {0}. +message.modules=Adding modules: {0} to runtime image. +message.app-image-dir-does-not-exist=Specified application image directory {0}: {1} does not exists. +message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.runtime-image-dir-does-not-exist=Specified runtime image directory {0}: {1} does not exists. +message.runtime-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.debug-working-directory=Kept working directory for debug: {0}. +message.bundle-created=Succeeded in building {0} bundle. error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.root-exists=Error: Application output directory {0} already exists +error.root-exists=Error: Application output directory {0} already exists. error.no-application-class=Main application class is missing. error.no-application-class.advice=Please specify main application class. -error.no-main-module=Main application module is missing. -error.no-main-module.advice=Make sure to use fx\:module task to create modular application. -error.no-main-class-with-main-jar=An application class was not specified nor was one found in the jar {0} -error.no-main-class-with-main-jar.advice=Please specify a application class or ensure that the jar {0} specifies one in the manifest. -error.no-main-class=An application class was not specified nor was one found in the supplied application resources +error.no-main-class-with-main-jar=A main class was not specified nor was one found in the jar {0}. +error.no-main-class-with-main-jar.advice=Specify a main class or ensure that the jar {0} specifies one in the manifest. +error.no-main-class=A main class was not specified nor was one found in the supplied application resources. error.no-main-class.advice=Please specify a application class or ensure that the appResources has a jar containing one in the manifest. -error.main-jar-does-not-exist=The configured main jar does not exist {0} -error.main-jar-does-not-exist.advice=The main jar must be specified relative to the app resources (not an absolute path), and must exist within those resources. +error.main-jar-does-not-exist=The configured main jar does not exist {0} in the input directory. +error.main-jar-does-not-exist.advice=The main jar must be specified relative to the input directory (not an absolute path), and must exist within that directory. warning.module.does.not.exist=Module [{0}] does not exist. warning.no.jdk.modules.found=Warning: No JDK Modules found. -warning.missing.arg.file=Warning: Missing argument file: {0} +warning.missing.arg.file=Warning: Missing argument file: {0}. MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. MSG_BundlerPlatformException=Bundler {0} skipped because the bundler does not support bundling on this platform. -MSG_BundlerConfigException=Bundler {0} skipped because of a configuration problem\: {1} \n\ -Advice to fix\: {2} -MSG_BundlerConfigExceptionNoAdvice=Bundler {0} skipped because of a configuration problem\: {1} -MSG_BundlerRuntimeException=Bundler {0} failed because of {1} +MSG_BundlerConfigException=Bundler {0} skipped because of a configuration problem: {1}. \n\ +Advice to fix: {2} +MSG_BundlerConfigExceptionNoAdvice=Bundler {0} skipped because of a configuration problem: {1}. +MSG_BundlerRuntimeException=Bundler {0} failed because of {1}. MSG_Version=jpackage version MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. @@ -75,14 +73,14 @@ ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. ERR_NotImageOption=Error: Option [{0}] is not valid in create-app-image mode. -ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option +ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option. ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. -ERR_MissingMode=Error: Mode is not specified -ERR_MissingArgument=Error: Missing argument: {0} -ERR_MissingAppResources=Error: No application jars found -ERR_AppImageNotExist=Error: App image directory "{0}" does not exist -ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory +ERR_MissingMode=Error: Mode is not specified. +ERR_MissingArgument=Error: Missing argument: {0}. +ERR_MissingAppResources=Error: No application jars found. +ERR_AppImageNotExist=Error: App image directory "{0}" does not exist. +ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory. ERR_NoAddLauncherName=Error: Add Launchers require a name parameter. ERR_NoUniqueName=Error: Add Launchers require a unique name parameter. ERR_NoJreInstallerName=Error: Jre Installers require a name parameter. @@ -90,8 +88,10 @@ ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}. ERR_LicenseFileNotExit=Error: Specified license file does not exist. ERR_BuildRootInvalid=Error: temp-root ({0}) must be non-existant directory. -ERR_InvalidOption=Error: Invalid Option: [{0}] +ERR_InvalidOption=Error: Invalid Option: [{0}]. ERR_VersionComparison=Error: Failed to compare version {0} with {1}. ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. -ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" -ERR_NoEntryPoint="Error: create-app-image requires --main-jar or --module Option" +ERR_BothMainJarAndModule=Error: Cannot have both --main-jar and --module Options. +ERR_NoEntryPoint=Error: create-app-image requires --main-jar or --module Option. +ERR_InputNotDirectory=Error: Input directory specified is not a directory: {0}. +ERR_CannotReadInputDir=Error: No permission to read from input directory: {0}. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties Tue Apr 09 10:57:04 2019 -0400 @@ -30,44 +30,42 @@ param.vendor.default=Unknown param.version.default=1.0 -message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize) -message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize) -message.using-custom-resource-from-file=Using custom package resource {0} (loaded from file {1}) -message.using-custom-resource=Using custom package resource {0} (loaded from {1}) -message.creating-app-bundle=Creating app bundle\: {0} in {1} -message.detected.modules="Automatically adding detected modules: {0}." -message.modules="Adding modules: {0} to runtime image." -message.app-image-dir-does-not-exist=Specified application image directory {0}\: {1} does not exists -message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.runtime-image-dir-does-not-exist=Specified runtime image directory {0}\: {1} does not exists -message.runtime-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.debug-working-directory=Kept working directory for debug\: {0} -message.bundle-created=Succeeded in building {0} bundle +message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize). +message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize). +message.using-custom-resource-from-file=Using custom package resource {0} (loaded from file {1}). +message.using-custom-resource=Using custom package resource {0} (loaded from {1}). +message.creating-app-bundle=Creating app bundle: {0} in {1}. +message.detected.modules=Automatically adding detected modules: {0}. +message.modules=Adding modules: {0} to runtime image. +message.app-image-dir-does-not-exist=Specified application image directory {0}: {1} does not exists. +message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.runtime-image-dir-does-not-exist=Specified runtime image directory {0}: {1} does not exists. +message.runtime-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.debug-working-directory=Kept working directory for debug: {0}. +message.bundle-created=Succeeded in building {0} bundle. error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.root-exists=Error: Application output directory {0} already exists +error.root-exists=Error: Application output directory {0} already exists. error.no-application-class=Main application class is missing. error.no-application-class.advice=Please specify main application class. -error.no-main-module=Main application module is missing. -error.no-main-module.advice=Make sure to use fx\:module task to create modular application. -error.no-main-class-with-main-jar=An application class was not specified nor was one found in the jar {0} -error.no-main-class-with-main-jar.advice=Please specify a application class or ensure that the jar {0} specifies one in the manifest. -error.no-main-class=An application class was not specified nor was one found in the supplied application resources +error.no-main-class-with-main-jar=A main class was not specified nor was one found in the jar {0}. +error.no-main-class-with-main-jar.advice=Specify a main class or ensure that the jar {0} specifies one in the manifest. +error.no-main-class=A main class was not specified nor was one found in the supplied application resources. error.no-main-class.advice=Please specify a application class or ensure that the appResources has a jar containing one in the manifest. -error.main-jar-does-not-exist=The configured main jar does not exist {0} -error.main-jar-does-not-exist.advice=The main jar must be specified relative to the app resources (not an absolute path), and must exist within those resources. +error.main-jar-does-not-exist=The configured main jar does not exist {0} in the input directory. +error.main-jar-does-not-exist.advice=The main jar must be specified relative to the input directory (not an absolute path), and must exist within that directory. warning.module.does.not.exist=Module [{0}] does not exist. warning.no.jdk.modules.found=Warning: No JDK Modules found. -warning.missing.arg.file=Warning: Missing argument file: {0} +warning.missing.arg.file=Warning: Missing argument file: {0}. MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. MSG_BundlerPlatformException=Bundler {0} skipped because the bundler does not support bundling on this platform. -MSG_BundlerConfigException=Bundler {0} skipped because of a configuration problem\: {1} \n\ -Advice to fix\: {2} -MSG_BundlerConfigExceptionNoAdvice=Bundler {0} skipped because of a configuration problem\: {1} -MSG_BundlerRuntimeException=Bundler {0} failed because of {1} +MSG_BundlerConfigException=Bundler {0} skipped because of a configuration problem: {1}. \n\ +Advice to fix: {2} +MSG_BundlerConfigExceptionNoAdvice=Bundler {0} skipped because of a configuration problem: {1}. +MSG_BundlerRuntimeException=Bundler {0} failed because of {1}. MSG_Version=jpackage version MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. @@ -75,14 +73,14 @@ ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. ERR_NotImageOption=Error: Option [{0}] is not valid in create-app-image mode. -ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option +ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option. ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. -ERR_MissingMode=Error: Mode is not specified -ERR_MissingArgument=Error: Missing argument: {0} -ERR_MissingAppResources=Error: No application jars found -ERR_AppImageNotExist=Error: App image directory "{0}" does not exist -ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory +ERR_MissingMode=Error: Mode is not specified. +ERR_MissingArgument=Error: Missing argument: {0}. +ERR_MissingAppResources=Error: No application jars found. +ERR_AppImageNotExist=Error: App image directory "{0}" does not exist. +ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory. ERR_NoAddLauncherName=Error: Add Launchers require a name parameter. ERR_NoUniqueName=Error: Add Launchers require a unique name parameter. ERR_NoJreInstallerName=Error: Jre Installers require a name parameter. @@ -90,8 +88,10 @@ ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}. ERR_LicenseFileNotExit=Error: Specified license file does not exist. ERR_BuildRootInvalid=Error: temp-root ({0}) must be non-existant directory. -ERR_InvalidOption=Error: Invalid Option: [{0}] +ERR_InvalidOption=Error: Invalid Option: [{0}]. ERR_VersionComparison=Error: Failed to compare version {0} with {1}. ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. -ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" -ERR_NoEntryPoint="Error: create-app-image requires --main-jar or --module Option" +ERR_BothMainJarAndModule=Error: Cannot have both --main-jar and --module Options. +ERR_NoEntryPoint=Error: create-app-image requires --main-jar or --module Option. +ERR_InputNotDirectory=Error: Input directory specified is not a directory: {0}. +ERR_CannotReadInputDir=Error: No permission to read from input directory: {0}. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties Tue Apr 09 10:57:04 2019 -0400 @@ -30,44 +30,42 @@ param.vendor.default=Unknown param.version.default=1.0 -message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize) -message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize) -message.using-custom-resource-from-file=Using custom package resource {0} (loaded from file {1}) -message.using-custom-resource=Using custom package resource {0} (loaded from {1}) -message.creating-app-bundle=Creating app bundle\: {0} in {1} -message.detected.modules="Automatically adding detected modules: {0}." -message.modules="Adding modules: {0} to runtime image." -message.app-image-dir-does-not-exist=Specified application image directory {0}\: {1} does not exists -message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.runtime-image-dir-does-not-exist=Specified runtime image directory {0}\: {1} does not exists -message.runtime-image-dir-does-not-exist.advice=Confirm that the value for {0} exists -message.debug-working-directory=Kept working directory for debug\: {0} -message.bundle-created=Succeeded in building {0} bundle +message.using-default-resource=Using default package resource {0} {1} (add {2} to the resource-dir to customize). +message.no-default-resource=no default package resource {0} {1} (add {2} to the resource-dir to customize). +message.using-custom-resource-from-file=Using custom package resource {0} (loaded from file {1}). +message.using-custom-resource=Using custom package resource {0} (loaded from {1}). +message.creating-app-bundle=Creating app bundle: {0} in {1}. +message.detected.modules=Automatically adding detected modules: {0}. +message.modules=Adding modules: {0} to runtime image. +message.app-image-dir-does-not-exist=Specified application image directory {0}: {1} does not exists. +message.app-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.runtime-image-dir-does-not-exist=Specified runtime image directory {0}: {1} does not exists. +message.runtime-image-dir-does-not-exist.advice=Confirm that the value for {0} exists. +message.debug-working-directory=Kept working directory for debug: {0}. +message.bundle-created=Succeeded in building {0} bundle. error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. -error.root-exists=Error: Application output directory {0} already exists +error.root-exists=Error: Application output directory {0} already exists. error.no-application-class=Main application class is missing. error.no-application-class.advice=Please specify main application class. -error.no-main-module=Main application module is missing. -error.no-main-module.advice=Make sure to use fx\:module task to create modular application. -error.no-main-class-with-main-jar=An application class was not specified nor was one found in the jar {0} -error.no-main-class-with-main-jar.advice=Please specify a application class or ensure that the jar {0} specifies one in the manifest. -error.no-main-class=An application class was not specified nor was one found in the supplied application resources +error.no-main-class-with-main-jar=A main class was not specified nor was one found in the jar {0}. +error.no-main-class-with-main-jar.advice=Specify a main class or ensure that the jar {0} specifies one in the manifest. +error.no-main-class=A main class was not specified nor was one found in the supplied application resources. error.no-main-class.advice=Please specify a application class or ensure that the appResources has a jar containing one in the manifest. -error.main-jar-does-not-exist=The configured main jar does not exist {0} -error.main-jar-does-not-exist.advice=The main jar must be specified relative to the app resources (not an absolute path), and must exist within those resources. +error.main-jar-does-not-exist=The configured main jar does not exist {0} in the input directory. +error.main-jar-does-not-exist.advice=The main jar must be specified relative to the input directory (not an absolute path), and must exist within that directory. warning.module.does.not.exist=Module [{0}] does not exist. warning.no.jdk.modules.found=Warning: No JDK Modules found. -warning.missing.arg.file=Warning: Missing argument file: {0} +warning.missing.arg.file=Warning: Missing argument file: {0}. MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. MSG_BundlerPlatformException=Bundler {0} skipped because the bundler does not support bundling on this platform. -MSG_BundlerConfigException=Bundler {0} skipped because of a configuration problem\: {1} \n\ -Advice to fix\: {2} -MSG_BundlerConfigExceptionNoAdvice=Bundler {0} skipped because of a configuration problem\: {1} -MSG_BundlerRuntimeException=Bundler {0} failed because of {1} +MSG_BundlerConfigException=Bundler {0} skipped because of a configuration problem: {1}. \n\ +Advice to fix: {2} +MSG_BundlerConfigExceptionNoAdvice=Bundler {0} skipped because of a configuration problem: {1}. +MSG_BundlerRuntimeException=Bundler {0} failed because of {1}. MSG_Version=jpackage version MSG_BundlerFailed=Error: Bundler "{1}" ({0}) failed to produce a bundle. @@ -75,14 +73,14 @@ ERR_UnsupportedOption=Error: Option [{0}] is not valid on this platform. ERR_NotImageOption=Error: Option [{0}] is not valid in create-app-image mode. -ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option +ERR_NotInstallerOption=Error: Option [{0}] is not valid with --app-image option. ERR_NoInstallerEntryPoint=Error: Option [{0}] is not valid without --module or --main-jar entry point option. -ERR_MissingMode=Error: Mode is not specified -ERR_MissingArgument=Error: Missing argument: {0} -ERR_MissingAppResources=Error: No application jars found -ERR_AppImageNotExist=Error: App image directory "{0}" does not exist -ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory +ERR_MissingMode=Error: Mode is not specified. +ERR_MissingArgument=Error: Missing argument: {0}. +ERR_MissingAppResources=Error: No application jars found. +ERR_AppImageNotExist=Error: App image directory "{0}" does not exist. +ERR_AppImageInvalid=Error: App image directory "{0}" does not contain "app" sub-directory. ERR_NoAddLauncherName=Error: Add Launchers require a name parameter. ERR_NoUniqueName=Error: Add Launchers require a unique name parameter. ERR_NoJreInstallerName=Error: Jre Installers require a name parameter. @@ -90,8 +88,10 @@ ERR_InvalidSLName=Error: Invalid Add Launcher name: {0}. ERR_LicenseFileNotExit=Error: Specified license file does not exist. ERR_BuildRootInvalid=Error: temp-root ({0}) must be non-existant directory. -ERR_InvalidOption=Error: Invalid Option: [{0}] +ERR_InvalidOption=Error: Invalid Option: [{0}]. ERR_VersionComparison=Error: Failed to compare version {0} with {1}. ERR_InvalidInstallerType=Error: Invalid or Unsupported Installer type: [{0}]. -ERR_BothMainJarAndModule="Error: Cannot have both --main-jar and --module Options" -ERR_NoEntryPoint="Error: create-app-image requires --main-jar or --module Option" +ERR_BothMainJarAndModule=Error: Cannot have both --main-jar and --module Options. +ERR_NoEntryPoint=Error: create-app-image requires --main-jar or --module Option. +ERR_InputNotDirectory=Error: Input directory specified is not a directory: {0}. +ERR_CannotReadInputDir=Error: No permission to read from input directory: {0}. diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties Tue Apr 09 10:57:04 2019 -0400 @@ -48,45 +48,43 @@ error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. error.iscc-not-found=Can not find Inno Setup Compiler (iscc.exe). -error.iscc-not-found.advice=Download Inno Setup 5 or later from http\://www.jrsoftware.org and add it to the PATH. +error.iscc-not-found.advice=Download Inno Setup 5 or later from http://www.jrsoftware.org and add it to the PATH. error.copyright-is-too-long=The copyright string is too long for InnoSetup. error.copyright-is-too-long.advice=Provide a copyright string shorter than 100 characters. error.too-many-content-types-for-file-association=More than one MIME types was specified for File Association number {0}. error.too-many-content-types-for-file-association.advice=Specify one and only one MIME type for each file association. error.no-wix-tools=Can not find WiX tools (light.exe, candle.exe). -error.no-wix-tools.advice=Download WiX 3.0 or later from http\://wix.sf.net and add it to the PATH. +error.no-wix-tools.advice=Download WiX 3.0 or later from http://wix.sf.net and add it to the PATH. error.version-string-wrong-format=Version string is not compatible with MSI rules [{0}]. -error.version-string-wrong-format.advice=Set the bundler argument "{0}" according to these rules: http\://msdn.microsoft.com/en-us/library/aa370859%28v\=VS.85%29.aspx -error.version-string-major-out-of-range=Major version must be in the range [0, 255] -error.version-string-build-out-of-range=Build part of version must be in the range [0, 65535] -error.version-string-minor-out-of-range=Minor version must be in the range [0, 255] +error.version-string-wrong-format.advice=Set the bundler argument "{0}" according to these rules: http://msdn.microsoft.com/en-us/library/aa370859%28v\=VS.85%29.aspx . +error.version-string-major-out-of-range=Major version must be in the range [0, 255]. +error.version-string-build-out-of-range=Build part of version must be in the range [0, 65535]. +error.version-string-minor-out-of-range=Minor version must be in the range [0, 255]. error.version-string-part-not-number=Failed to convert version component to int. -error.cannot-walk-directory=Can not walk [{0}] - it is not a valid directory +error.cannot-walk-directory=Can not walk [{0}] - it is not a valid directory. error.version-swap=Failed to update version information for {0}. - - -message.result-dir=Result application bundle\: {0} +message.result-dir=Result application bundle: {0}. message.icon-not-ico=The specified icon "{0}" is not an ICO file and will not be used. The default icon will be used in it's place. message.multiple-launchers=Multiple launchers found in predefined app-image. {0} will be used as primary launcher. message.potential.windows.defender.issue=Warning: Windows Defender may prevent jpackage from functioning. If there is an issue, it can be addressed by either disabling realtime monitoring, or adding an exclusion for the directory "{0}". message.tool-wrong-version=Detected [{0}] version {1} but version {2} is required. -message.outputting-to-location=Generating EXE for installer to\: {0} -message.output-location=Installer (.exe) saved to\: {0} -message.tool-version=\ Detected [{0}] version [{1}] +message.outputting-to-location=Generating EXE for installer to: {0}. +message.output-location=Installer (.exe) saved to: {0} +message.tool-version=Detected [{0}] version [{1}]. message.one-shortcut-required=At least one type of shortcut is required. Enabling menu shortcut. -message.running-wsh-script=Running WSH script on application image [{0}] -message.iscc-file-string=\ InnoSetup compiler set to {0} +message.running-wsh-script=Running WSH script on application image [{0}]. +message.iscc-file-string=InnoSetup compiler set to {0}. message.creating-association-with-null-extension=Creating association with null extension. message.wrong-tool-version=Detected [{0}] version {1} but version {2} is required. message.version-string-too-many-components=Version sting may have up to 3 components - major.minor.build . message.truncating.id=Truncating Application ID to 126 chars for Inno Setup. message.use-wix36-features=WiX 3.6 detected. Enabling advanced cleanup action. -message.generated-product-guid=Generated product GUID\: {0} -message.preparing-msi-config=Preparing MSI config\: {0} -message.generating-msi=Generating MSI\: {0} -message.light-file-string=WiX light tool set to {0} -message.candle-file-string=WiX candle tool set to {0} +message.generated-product-guid=Generated product GUID: {0}. +message.preparing-msi-config=Preparing MSI config: {0}. +message.generating-msi=Generating MSI: {0}. +message.light-file-string=WiX light tool set to {0}. +message.candle-file-string=WiX candle tool set to {0}. message.install.dir.exist=The folder [APPLICATIONFOLDER] already exist. Whould you like to install to that folder anyway? message.invalid.install.dir=Warning: Invalid install directory {0}. Install directory should be a relative sub-path under the default installation location such as "Program Files". Defaulting to application name "{1}". diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties Tue Apr 09 10:57:04 2019 -0400 @@ -48,45 +48,43 @@ error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. error.iscc-not-found=Can not find Inno Setup Compiler (iscc.exe). -error.iscc-not-found.advice=Download Inno Setup 5 or later from http\://www.jrsoftware.org and add it to the PATH. +error.iscc-not-found.advice=Download Inno Setup 5 or later from http://www.jrsoftware.org and add it to the PATH. error.copyright-is-too-long=The copyright string is too long for InnoSetup. error.copyright-is-too-long.advice=Provide a copyright string shorter than 100 characters. error.too-many-content-types-for-file-association=More than one MIME types was specified for File Association number {0}. error.too-many-content-types-for-file-association.advice=Specify one and only one MIME type for each file association. error.no-wix-tools=Can not find WiX tools (light.exe, candle.exe). -error.no-wix-tools.advice=Download WiX 3.0 or later from http\://wix.sf.net and add it to the PATH. +error.no-wix-tools.advice=Download WiX 3.0 or later from http://wix.sf.net and add it to the PATH. error.version-string-wrong-format=Version string is not compatible with MSI rules [{0}]. -error.version-string-wrong-format.advice=Set the bundler argument "{0}" according to these rules: http\://msdn.microsoft.com/en-us/library/aa370859%28v\=VS.85%29.aspx -error.version-string-major-out-of-range=Major version must be in the range [0, 255] -error.version-string-build-out-of-range=Build part of version must be in the range [0, 65535] -error.version-string-minor-out-of-range=Minor version must be in the range [0, 255] +error.version-string-wrong-format.advice=Set the bundler argument "{0}" according to these rules: http://msdn.microsoft.com/en-us/library/aa370859%28v\=VS.85%29.aspx . +error.version-string-major-out-of-range=Major version must be in the range [0, 255]. +error.version-string-build-out-of-range=Build part of version must be in the range [0, 65535]. +error.version-string-minor-out-of-range=Minor version must be in the range [0, 255]. error.version-string-part-not-number=Failed to convert version component to int. -error.cannot-walk-directory=Can not walk [{0}] - it is not a valid directory +error.cannot-walk-directory=Can not walk [{0}] - it is not a valid directory. error.version-swap=Failed to update version information for {0}. - - -message.result-dir=Result application bundle\: {0} +message.result-dir=Result application bundle: {0}. message.icon-not-ico=The specified icon "{0}" is not an ICO file and will not be used. The default icon will be used in it's place. message.multiple-launchers=Multiple launchers found in predefined app-image. {0} will be used as primary launcher. message.potential.windows.defender.issue=Warning: Windows Defender may prevent jpackage from functioning. If there is an issue, it can be addressed by either disabling realtime monitoring, or adding an exclusion for the directory "{0}". message.tool-wrong-version=Detected [{0}] version {1} but version {2} is required. -message.outputting-to-location=Generating EXE for installer to\: {0} -message.output-location=Installer (.exe) saved to\: {0} -message.tool-version=\ Detected [{0}] version [{1}] +message.outputting-to-location=Generating EXE for installer to: {0}. +message.output-location=Installer (.exe) saved to: {0} +message.tool-version=Detected [{0}] version [{1}]. message.one-shortcut-required=At least one type of shortcut is required. Enabling menu shortcut. -message.running-wsh-script=Running WSH script on application image [{0}] -message.iscc-file-string=\ InnoSetup compiler set to {0} +message.running-wsh-script=Running WSH script on application image [{0}]. +message.iscc-file-string=InnoSetup compiler set to {0}. message.creating-association-with-null-extension=Creating association with null extension. message.wrong-tool-version=Detected [{0}] version {1} but version {2} is required. message.version-string-too-many-components=Version sting may have up to 3 components - major.minor.build . message.truncating.id=Truncating Application ID to 126 chars for Inno Setup. message.use-wix36-features=WiX 3.6 detected. Enabling advanced cleanup action. -message.generated-product-guid=Generated product GUID\: {0} -message.preparing-msi-config=Preparing MSI config\: {0} -message.generating-msi=Generating MSI\: {0} -message.light-file-string=WiX light tool set to {0} -message.candle-file-string=WiX candle tool set to {0} +message.generated-product-guid=Generated product GUID: {0}. +message.preparing-msi-config=Preparing MSI config: {0}. +message.generating-msi=Generating MSI: {0}. +message.light-file-string=WiX light tool set to {0}. +message.candle-file-string=WiX candle tool set to {0}. message.install.dir.exist=The folder [APPLICATIONFOLDER] already exist. Whould you like to install to that folder anyway? message.invalid.install.dir=Warning: Invalid install directory {0}. Install directory should be a relative sub-path under the default installation location such as "Program Files". Defaulting to application name "{1}". diff -r 4948a1944cf9 -r 23da9e6f446f src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties Fri Apr 05 11:24:44 2019 -0400 +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties Tue Apr 09 10:57:04 2019 -0400 @@ -48,45 +48,43 @@ error.cannot-create-output-dir=Output directory {0} cannot be created. error.cannot-write-to-output-dir=Output directory {0} is not writable. error.iscc-not-found=Can not find Inno Setup Compiler (iscc.exe). -error.iscc-not-found.advice=Download Inno Setup 5 or later from http\://www.jrsoftware.org and add it to the PATH. +error.iscc-not-found.advice=Download Inno Setup 5 or later from http://www.jrsoftware.org and add it to the PATH. error.copyright-is-too-long=The copyright string is too long for InnoSetup. error.copyright-is-too-long.advice=Provide a copyright string shorter than 100 characters. error.too-many-content-types-for-file-association=More than one MIME types was specified for File Association number {0}. error.too-many-content-types-for-file-association.advice=Specify one and only one MIME type for each file association. error.no-wix-tools=Can not find WiX tools (light.exe, candle.exe). -error.no-wix-tools.advice=Download WiX 3.0 or later from http\://wix.sf.net and add it to the PATH. +error.no-wix-tools.advice=Download WiX 3.0 or later from http://wix.sf.net and add it to the PATH. error.version-string-wrong-format=Version string is not compatible with MSI rules [{0}]. -error.version-string-wrong-format.advice=Set the bundler argument "{0}" according to these rules: http\://msdn.microsoft.com/en-us/library/aa370859%28v\=VS.85%29.aspx -error.version-string-major-out-of-range=Major version must be in the range [0, 255] -error.version-string-build-out-of-range=Build part of version must be in the range [0, 65535] -error.version-string-minor-out-of-range=Minor version must be in the range [0, 255] +error.version-string-wrong-format.advice=Set the bundler argument "{0}" according to these rules: http://msdn.microsoft.com/en-us/library/aa370859%28v\=VS.85%29.aspx . +error.version-string-major-out-of-range=Major version must be in the range [0, 255]. +error.version-string-build-out-of-range=Build part of version must be in the range [0, 65535]. +error.version-string-minor-out-of-range=Minor version must be in the range [0, 255]. error.version-string-part-not-number=Failed to convert version component to int. -error.cannot-walk-directory=Can not walk [{0}] - it is not a valid directory +error.cannot-walk-directory=Can not walk [{0}] - it is not a valid directory. error.version-swap=Failed to update version information for {0}. - - -message.result-dir=Result application bundle\: {0} +message.result-dir=Result application bundle: {0}. message.icon-not-ico=The specified icon "{0}" is not an ICO file and will not be used. The default icon will be used in it's place. message.multiple-launchers=Multiple launchers found in predefined app-image. {0} will be used as primary launcher. message.potential.windows.defender.issue=Warning: Windows Defender may prevent jpackage from functioning. If there is an issue, it can be addressed by either disabling realtime monitoring, or adding an exclusion for the directory "{0}". message.tool-wrong-version=Detected [{0}] version {1} but version {2} is required. -message.outputting-to-location=Generating EXE for installer to\: {0} -message.output-location=Installer (.exe) saved to\: {0} -message.tool-version=\ Detected [{0}] version [{1}] +message.outputting-to-location=Generating EXE for installer to: {0}. +message.output-location=Installer (.exe) saved to: {0} +message.tool-version=Detected [{0}] version [{1}]. message.one-shortcut-required=At least one type of shortcut is required. Enabling menu shortcut. -message.running-wsh-script=Running WSH script on application image [{0}] -message.iscc-file-string=\ InnoSetup compiler set to {0} +message.running-wsh-script=Running WSH script on application image [{0}]. +message.iscc-file-string=InnoSetup compiler set to {0}. message.creating-association-with-null-extension=Creating association with null extension. message.wrong-tool-version=Detected [{0}] version {1} but version {2} is required. message.version-string-too-many-components=Version sting may have up to 3 components - major.minor.build . message.truncating.id=Truncating Application ID to 126 chars for Inno Setup. message.use-wix36-features=WiX 3.6 detected. Enabling advanced cleanup action. -message.generated-product-guid=Generated product GUID\: {0} -message.preparing-msi-config=Preparing MSI config\: {0} -message.generating-msi=Generating MSI\: {0} -message.light-file-string=WiX light tool set to {0} -message.candle-file-string=WiX candle tool set to {0} +message.generated-product-guid=Generated product GUID: {0}. +message.preparing-msi-config=Preparing MSI config: {0}. +message.generating-msi=Generating MSI: {0}. +message.light-file-string=WiX light tool set to {0}. +message.candle-file-string=WiX candle tool set to {0}. message.install.dir.exist=The folder [APPLICATIONFOLDER] already exist. Whould you like to install to that folder anyway? message.invalid.install.dir=Warning: Invalid install directory {0}. Install directory should be a relative sub-path under the default installation location such as "Program Files". Defaulting to application name "{1}". diff -r 4948a1944cf9 -r 23da9e6f446f test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java --- a/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Fri Apr 05 11:24:44 2019 -0400 +++ b/test/jdk/tools/jpackage/JPackageMissingArgumentsTest.java Tue Apr 09 10:57:04 2019 -0400 @@ -59,7 +59,7 @@ "--main-class", "Hello", }; - private static final String [] RESULT_4 = {"--main-class"}; + private static final String [] RESULT_4 = {"main class was not specified"}; private static final String [] CMD_4 = { "create-app-image", "--input", "input", @@ -94,10 +94,10 @@ "--module", "com.hello/com.hello.Hello", }; - private static void validate(String output, String [] expected) - throws Exception { + private static void validate(String output, String [] expected, + boolean single) throws Exception { String[] result = output.split("\n"); - if (result.length != 1) { + if (single && result.length != 1) { System.err.println(output); throw new AssertionError("Invalid number of lines in output: " + result.length); @@ -114,48 +114,48 @@ private static void testMissingArg() throws Exception { String output = JPackageHelper.executeCLI(false, CMD_1); - validate(output, RESULT_1); + validate(output, RESULT_1, true); output = JPackageHelper.executeCLI(false, CMD_2); - validate(output, RESULT_2); + validate(output, RESULT_2, true); output = JPackageHelper.executeCLI(false, CMD_3); - validate(output, RESULT_3); + validate(output, RESULT_3, true); output = JPackageHelper.executeCLI(false, CMD_4); - validate(output, RESULT_4); + validate(output, RESULT_4, false); output = JPackageHelper.executeCLI(false, CMD_5); - validate(output, RESULT_5); + validate(output, RESULT_5, true); output = JPackageHelper.executeCLI(false, CMD_6); - validate(output, RESULT_6); + validate(output, RESULT_6, true); output = JPackageHelper.executeCLI(false, CMD_7); - validate(output, RESULT_7); + validate(output, RESULT_7, true); } private static void testMissingArgToolProvider() throws Exception { String output = JPackageHelper.executeToolProvider(false, CMD_1); - validate(output, RESULT_1); + validate(output, RESULT_1, true); output = JPackageHelper.executeToolProvider(false, CMD_2); - validate(output, RESULT_2); + validate(output, RESULT_2, true); output = JPackageHelper.executeToolProvider(false, CMD_3); - validate(output, RESULT_3); + validate(output, RESULT_3, true); output = JPackageHelper.executeToolProvider(false, CMD_4); - validate(output, RESULT_4); + validate(output, RESULT_4, false); output = JPackageHelper.executeToolProvider(false, CMD_5); - validate(output, RESULT_5); + validate(output, RESULT_5, true); output = JPackageHelper.executeToolProvider(false, CMD_6); - validate(output, RESULT_6); + validate(output, RESULT_6, true); output = JPackageHelper.executeToolProvider(false, CMD_7); - validate(output, RESULT_7); + validate(output, RESULT_7, true); } public static void main(String[] args) throws Exception { diff -r 4948a1944cf9 -r 23da9e6f446f test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageErrorTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageErrorTest.java Tue Apr 09 10:57:04 2019 -0400 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2018, 2019, 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. + */ + + /* + * @test + * @summary jpackage create app image error test + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @build JPackageCreateAppImageBase + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageErrorTest + */ +import java.util.*; +import java.io.*; +import java.nio.*; +import java.nio.file.*; +import java.nio.file.attribute.*; + +public class JPackageCreateAppImageErrorTest { + + private static final String OUTPUT = "output"; + + private static final String ARG1 = "--no-such-argument"; + private static final String EXPECTED1 = + "Invalid Option: [--no-such-argument]"; + private static final String ARG2 = "--output"; + private static final String EXPECTED2 = "Mode is not specified"; + + private static final String [] CMD1 = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "non-existant.jar", + }; + private static final String EXP1 = "main jar does not exist"; + + private static final String [] CMD2 = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar", + }; + private static final String EXP2 = "class was not specified nor was"; + + private static void validate(String output, String expected, boolean single) + throws Exception { + String[] result = output.split("\n"); + if (single && result.length != 1) { + System.err.println(output); + throw new AssertionError("Unexpected multiple lines of output: " + + output); + } + + if (!result[0].trim().contains(expected)) { + throw new AssertionError("Unexpected output: " + result[0] + + " - expected output to contain: " + expected); + } + } + + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + + validate(JPackageHelper.executeToolProvider(false, ARG1), EXPECTED1, true); + validate(JPackageHelper.executeToolProvider(false, ARG2), EXPECTED2, true); + + JPackageHelper.deleteOutputFolder(OUTPUT); + validate(JPackageHelper.executeToolProvider(false, CMD1), EXP1, false); + + JPackageHelper.deleteOutputFolder(OUTPUT); + validate(JPackageHelper.executeToolProvider(false, CMD2), EXP2, false); + + } + +} diff -r 4948a1944cf9 -r 23da9e6f446f test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageMainClassErrorTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageMainClassErrorTest.java Tue Apr 09 10:57:04 2019 -0400 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2018, 2019, 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. + */ + +import java.io.File; +import java.nio.file.Files; + +/* + * @test + * @summary jpackage create image with no main class arguments and with main-class attribute + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageMainClassErrorTest + */ +public class JPackageCreateAppImageMainClassErrorTest { + private static final String OUTPUT = "output"; + private static final String app = JPackagePath.getApp(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + private static final String[] CMD = { + "create-app-image", + "--input", "input", + "--output", OUTPUT, + "--name", "test", + "--main-jar", "hello.jar"}; + + private static void validate(String output) throws Exception { + String[] result = output.split("\n"); + if (result.length != 2) { + throw new AssertionError( + "Unexpected number of lines: " + result.length); + } + + if (!result[0].trim().contains("main class was not specified")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + + if (!result[1].trim().startsWith("Advice to fix: ")) { + throw new AssertionError("Unexpected result[1]: " + result[1]); + } + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloImageJar(); + + JPackageHelper.deleteOutputFolder(OUTPUT); + validate(JPackageHelper.executeCLI(false, CMD)); + + JPackageHelper.deleteOutputFolder(OUTPUT); + validate(JPackageHelper.executeToolProvider(false, CMD)); + } + +} diff -r 4948a1944cf9 -r 23da9e6f446f test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModuleMainClassErrorTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageModuleMainClassErrorTest.java Tue Apr 09 10:57:04 2019 -0400 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2018, 2019, 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. + */ + +import java.io.File; +import java.nio.file.Files; + +/* + * @test + * @summary jpackage create image with no main class arguments and with main-class attribute + * @library ../helpers + * @build JPackageHelper + * @build JPackagePath + * @modules jdk.jpackage + * @run main/othervm -Xmx512m JPackageCreateAppImageModuleMainClassErrorTest + */ +public class JPackageCreateAppImageModuleMainClassErrorTest { + private static final String OUTPUT = "output"; + private static final String app = JPackagePath.getApp(); + private static final String appOutput = JPackagePath.getAppOutputFile(); + private static final String appWorkingDir = JPackagePath.getAppWorkingDir(); + + private static final String [] CMD = { + "create-app-image", + "--output", OUTPUT, + "--name", "test", + "--module", "com.hello", + "--module-path", "input"}; + + private static void validate(String buildOutput) throws Exception { + + File outfile = new File(appWorkingDir + File.separator + appOutput); + int retVal = JPackageHelper.execute(outfile, app); + if (retVal == 0) { + throw new AssertionError( + "Test application exited without error: "); + } + + if (!outfile.exists()) { + throw new AssertionError(appOutput + " was not created"); + } + String output = Files.readString(outfile.toPath()); + String[] result = output.split("\n"); + + if (result.length != 1) { + System.out.println("outfile (" + outfile + ") content: " + output); + throw new AssertionError( + "Unexpected number of lines: " + result.length); + } + + if (!result[0].trim().contains( + "does not have a ModuleMainClass attribute")) { + throw new AssertionError("Unexpected result[0]: " + result[0]); + } + } + + public static void main(String[] args) throws Exception { + JPackageHelper.createHelloModule(); + + JPackageHelper.deleteOutputFolder(OUTPUT); + validate(JPackageHelper.executeCLI(true, CMD)); + + JPackageHelper.deleteOutputFolder(OUTPUT); + validate(JPackageHelper.executeToolProvider(true, CMD)); + } + +} diff -r 4948a1944cf9 -r 23da9e6f446f test/jdk/tools/jpackage/helpers/JPackageHelper.java --- a/test/jdk/tools/jpackage/helpers/JPackageHelper.java Fri Apr 05 11:24:44 2019 -0400 +++ b/test/jdk/tools/jpackage/helpers/JPackageHelper.java Tue Apr 09 10:57:04 2019 -0400 @@ -153,7 +153,7 @@ return command; } - private static void deleteRecursive(File path) throws IOException { + public static void deleteRecursive(File path) throws IOException { if (!path.exists()) { return; } @@ -191,7 +191,13 @@ public static void deleteOutputFolder(String output) throws IOException { File outputFolder = new File(output); System.out.println("AMDEBUG output: " + outputFolder.getAbsolutePath()); - deleteRecursive(outputFolder); + try { + deleteRecursive(outputFolder); + } catch (IOException ioe) { + System.out.println("IOException: " + ioe); + ioe.printStackTrace(); + deleteRecursive(outputFolder); + } } public static String executeCLI(boolean retValZero, String... args) throws Exception { @@ -344,7 +350,8 @@ createModule("Hello.java"); } - private static void createModule(String javaFile) throws Exception { + private static void createModule(String javaFile) + throws Exception { int retVal; File input = new File("input");