451973 - Ambiguous module init location when mixing --add-to-start & --add-to-startd in the same exec

+ In case of ambiguous selection, defaults to start.ini, with warning
  message
This commit is contained in:
Joakim Erdfelt 2015-04-14 11:20:14 -07:00
parent b8e062bd51
commit d9ffed0a07
2 changed files with 24 additions and 13 deletions

View File

@ -157,25 +157,20 @@ public class BaseBuilder
if (ambiguous.size() > 0)
{
StringBuilder err = new StringBuilder();
err.append("Unable to add ");
err.append(ambiguous.size());
err.append(" module");
if (ambiguous.size() > 1)
{
err.append('s');
}
err.append(" (found declared via both --add-to-start and --add-to-startd): [");
StringBuilder warn = new StringBuilder();
warn.append("Ambiguous module locations detected, defaulting to --add-to-start for the following module selections:");
warn.append(" [");
for (int i = 0; i < ambiguous.size(); i++)
{
if (i > 0)
{
err.append(", ");
warn.append(", ");
}
err.append(ambiguous.get(i).getName());
warn.append(ambiguous.get(i).getName());
}
err.append(']');
throw new RuntimeException(err.toString());
warn.append(']');
StartLog.warn(warn.toString());
}
StartLog.debug("Adding %s new module(s)",count);
@ -198,6 +193,11 @@ public class BaseBuilder
StartDirBuilder builder = new StartDirBuilder(this);
for (Module mod : startDModules)
{
if (ambiguous.contains(mod))
{
// skip ambiguous module
continue;
}
dirty |= builder.addModule(mod);
for (String file : mod.getFiles())
{

View File

@ -18,6 +18,14 @@
package org.eclipse.jetty.start.graph;
/**
* Represents a selection technique.
* <p>
* Each <code>Selection</code> can be used [0..n] times in the graph.
* The <code>Selection</code> must contain a unique 'how' description that represents
* how this selection was determined (what criteria the selection underwent)
* </p>
*/
public class Selection
{
private final boolean explicit;
@ -77,6 +85,9 @@ public class Selection
return true;
}
/**
* Get how this node was selected.
*/
public String getHow()
{
return how;