8211297: --verbose does not work with jpackager
Submitten-by: almatvee
Reviewed-by: herrick
--- a/src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java Thu Oct 18 17:57:26 2018 -0400
+++ b/src/jdk.packager/share/classes/jdk/packager/internal/Arguments.java Thu Oct 18 18:02:17 2018 -0400
@@ -120,7 +120,6 @@
private String mainJarPath = null;
private static boolean echo = false;
- private static boolean verbose = false;
private static boolean jreInstaller = false;
private List<jdk.packager.internal.Bundler> platformBundlers = null;
@@ -216,7 +215,7 @@
VERBOSE ("verbose", OptionCategories.PROPERTY, () -> {
setOptionValue("verbose", true);
- verbose = true;
+ Log.setVerbose(true);
}),
FILES ("files", "f", OptionCategories.PROPERTY, () -> {
@@ -584,7 +583,7 @@
for (SecondaryLauncherArguments sl : secondaryLaunchers) {
Map<String, ? super Object> slMap = sl.getLauncherMap();
- String slName =
+ String slName =
(String) slMap.get(Arguments.CLIOptions.NAME.getId());
if (slName == null) {
throw new PackagerException("ERR_NoSecondaryLauncherName");
@@ -603,7 +602,7 @@
generateBundle(bp.getBundleParamsAsMap());
} catch (Exception e) {
- if (verbose) {
+ if (Log.isVerbose()) {
throw e;
} else {
System.err.println(e.getMessage());
@@ -866,10 +865,6 @@
return echo;
}
- public static boolean verbose() {
- return verbose;
- }
-
public static boolean isJreInstaller() {
return jreInstaller;
}
--- a/src/jdk.packager/share/classes/jdk/packager/internal/CommonParams.java Thu Oct 18 17:57:26 2018 -0400
+++ b/src/jdk.packager/share/classes/jdk/packager/internal/CommonParams.java Thu Oct 18 18:02:17 2018 -0400
@@ -29,16 +29,11 @@
public abstract class CommonParams {
File outdir;
- boolean verbose;
public void setOutdir(File outdir) {
this.outdir = outdir;
}
- public void setVerbose(boolean v) {
- verbose = v;
- }
-
public abstract void addResource(File baseDir, String path);
public abstract void addResource(File baseDir, File file);
@@ -47,8 +42,7 @@
@Override
public String toString() {
- return "CommonParams{" + "outdir=" + outdir
- + " verbose=" + verbose + '}';
+ return "CommonParams{" + "outdir=" + outdir + '}';
}
}
--- a/src/jdk.packager/share/classes/jdk/packager/internal/DeployParams.java Thu Oct 18 17:57:26 2018 -0400
+++ b/src/jdk.packager/share/classes/jdk/packager/internal/DeployParams.java Thu Oct 18 18:02:17 2018 -0400
@@ -483,7 +483,6 @@
bundleParams.setApplicationCategory(category);
bundleParams.setDescription(description);
bundleParams.setTitle(title);
- if (verbose) bundleParams.setVerbose(true);
bundleParams.setJvmProperties(properties);
bundleParams.setJvmargs(jvmargs);
--- a/src/jdk.packager/share/classes/jdk/packager/internal/Log.java Thu Oct 18 17:57:26 2018 -0400
+++ b/src/jdk.packager/share/classes/jdk/packager/internal/Log.java Thu Oct 18 18:02:17 2018 -0400
@@ -44,6 +44,10 @@
verbose = v;
}
+ public boolean isVerbose() {
+ return verbose;
+ }
+
public void setPrintWriter(PrintWriter out, PrintWriter err) {
this.out = out;
this.err = err;
@@ -147,6 +151,20 @@
}
}
+ public static void setVerbose(boolean v) {
+ if (delegate != null) {
+ delegate.setVerbose(v);
+ }
+ }
+
+ public static boolean isVerbose() {
+ if (delegate != null) {
+ return delegate.isVerbose();
+ }
+
+ return false; // Off by default
+ }
+
public static void verbose(String msg) {
if (delegate != null) {
delegate.verbose(msg);
--- a/src/jdk.packager/share/classes/jdk/packager/internal/bundlers/BundleParams.java Thu Oct 18 17:57:26 2018 -0400
+++ b/src/jdk.packager/share/classes/jdk/packager/internal/bundlers/BundleParams.java Thu Oct 18 18:02:17 2018 -0400
@@ -106,7 +106,7 @@
// where the product will be installed.
public static final String PARAM_INSTALLDIR_CHOOSER = "installdirChooser";
- // boolean - Prevents from launching multiple instances of application.
+ // boolean - Prevents from launching multiple instances of application.
public static final String PARAM_SINGLETON = "singleton";
/**
@@ -289,10 +289,6 @@
return fetchParam(VERBOSE);
}
- public void setVerbose(Boolean verbose) {
- putUnlessNull(VERBOSE.getID(), verbose);
- }
-
public List<String> getLicenseFile() {
return fetchParam(LICENSE_FILE);
}
--- a/src/jdk.packager/share/classes/jdk/packager/main/Main.java Thu Oct 18 17:57:26 2018 -0400
+++ b/src/jdk.packager/share/classes/jdk/packager/main/Main.java Thu Oct 18 18:02:17 2018 -0400
@@ -86,7 +86,7 @@
Arguments arguments = new Arguments(args);
arguments.processArguments();
} catch (Exception e) {
- if (Arguments.verbose()) {
+ if (Log.isVerbose()) {
Log.verbose(e);
} else {
Log.error(e.getMessage());
--- a/src/jdk.packager/windows/native/jpackager/jpackager.cpp Thu Oct 18 17:57:26 2018 -0400
+++ b/src/jdk.packager/windows/native/jpackager/jpackager.cpp Thu Oct 18 18:02:17 2018 -0400
@@ -438,7 +438,7 @@
bool hasEnding(std::wstring const &fullString, std::wstring const &ending) {
if (fullString.length() >= ending.length()) {
- return (0 == fullString.compare(fullString.length() - ending.length(),
+ return (0 == fullString.compare(fullString.length() - ending.length(),
ending.length(), ending));
}
else {
@@ -553,7 +553,7 @@
L" " + args;
#ifdef _DEBUG
- fwprintf (stdout, TEXT("%s"), cmd.c_str());
+ fwprintf (stdout, TEXT("%s\n"), cmd.c_str());
#endif
STARTUPINFO start;