Unverified Commit c4f2d871 authored by Eric Barboni's avatar Eric Barboni Committed by GitHub
Browse files

Merge pull request #4150 from apache/delivery

Sync delivery to release140 for 14-rc6
parents 0bf8e0f0 cc14a920
......@@ -255,27 +255,29 @@ public final class TemplateUtils {
POMModel model = POMModelFactory.getDefault().getModel(modelSource);
org.netbeans.modules.maven.model.pom.Project root = model.getProject();
if (root != null) {
if (model.startTransaction()) {
try {
org.netbeans.modules.maven.model.pom.Properties props = root.getProperties();
if (props == null) {
props = model.getFactory().createProperties();
root.setProperties(props);
}
String packageName = (String) properties.get(TemplateUtils.PARAM_PACKAGE);
String mainClass = (String) properties.get(TemplateUtils.PARAM_MAIN_CLASS_NAME);
if (mainClass == null || mainClass.isEmpty()) {
mainClass = "App"; // NOI18N
}
if (packageName != null && !packageName.isEmpty()) {
mainClass = packageName + '.' + mainClass;
}
props.setProperty("exec.mainClass", mainClass); // NOI18N
} finally {
model.endTransaction();
if (model.getProject().getPackaging() == null || "jar".equals(model.getProject().getPackaging())) {
if (model.startTransaction()) {
try {
Utilities.saveChanges(model);
} catch (IOException ex) {}
org.netbeans.modules.maven.model.pom.Properties props = root.getProperties();
if (props == null) {
props = model.getFactory().createProperties();
root.setProperties(props);
}
String packageName = (String) properties.get(TemplateUtils.PARAM_PACKAGE);
String mainClass = (String) properties.get(TemplateUtils.PARAM_MAIN_CLASS_NAME);
if (mainClass == null || mainClass.isEmpty()) {
mainClass = "App"; // NOI18N
}
if (packageName != null && !packageName.isEmpty()) {
mainClass = packageName + '.' + mainClass;
}
props.setProperty("exec.mainClass", mainClass); // NOI18N
} finally {
model.endTransaction();
try {
Utilities.saveChanges(model);
} catch (IOException ex) {}
}
}
}
}
......
......@@ -93,6 +93,7 @@ public abstract class IDENativeMavenWizardIterator implements WizardDescriptor.I
return new FileBuilder(w.getTemplate().getPrimaryFile(), w.getTargetFolder().getPrimaryFile().getParent()).
param(TemplateUtils.PARAM_PACKAGE, (String) wiz.getProperty("package")).
param(TemplateUtils.PARAM_PACKAGING, (String) this.packaging).
defaultMode(FileBuilder.Mode.COPY).
name(w.getTargetName()).
useLookup(Lookups.fixed(h));
......
......@@ -122,15 +122,18 @@ public class IDENativeTemplateHandler extends CreateFromTemplateHandler {
params.put("projecName", cd.getName());
params.put("packagePath", pi.packageName == null ? "" : pi.packageName.replace('.', '/')); // NOI18N
String mainName;
if (!params.containsKey("mainClassName")) { // NOI18N
String derived = deriveClassName(pi.artifactId);
if (BaseUtilities.isJavaIdentifier(derived)) {
mainName = derived;
} else {
mainName = "App"; // NOI18N
String packaging = cd.getValue(TemplateUtils.PARAM_PACKAGING);
if (packaging == null || "jar".equals(packaging)) { // NOI18N
String mainName;
if (!params.containsKey("mainClassName")) { // NOI18N
String derived = deriveClassName(pi.artifactId);
if (BaseUtilities.isJavaIdentifier(derived)) {
mainName = derived;
} else {
mainName = "App"; // NOI18N
}
params.put("mainClassName", mainName); // NOI18N
}
params.put("mainClassName", mainName); // NOI18N
}
......
......@@ -28,7 +28,14 @@ import org.openide.util.NbBundle;
*
* @author mkleint
*/
@TemplateRegistration(folder=ArchetypeWizards.TEMPLATE_FOLDER, position=980, displayName="#LBL_Maven_POM_Archetype", iconBase="org/netbeans/modules/maven/resources/Maven2Icon.gif", description="pom-root.html")
@TemplateRegistration(
displayName="#LBL_Maven_POM_Archetype",
iconBase="org/netbeans/modules/maven/resources/Maven2Icon.gif",
description="pom-root.html",
folder=ArchetypeWizards.TEMPLATE_FOLDER,
position=980,
createHandlerClass = IDENativeTemplateHandler.class
)
@NbBundle.Messages("LBL_Maven_POM_Archetype=POM Project")
public class PomJavaNativeMWI extends IDENativeMavenWizardIterator {
......
......@@ -57,17 +57,23 @@ public final class ActiveQueue {
}
@Override
public Reference<Object> remove(long timeout) throws IllegalArgumentException, InterruptedException {
throw new InterruptedException();
public Reference<? extends Object> remove(long timeout) throws IllegalArgumentException, InterruptedException {
if (timeout < 0) {
throw new IllegalArgumentException("Negative timeout value");
} else if (Thread.currentThread() != Daemon.running) {
throw new InterruptedException();
}
return super.remove(timeout);
}
@Override
public Reference<Object> remove() throws InterruptedException {
throw new InterruptedException();
}
final Reference<? extends Object> removeSuper() throws InterruptedException {
return super.remove(0);
public Reference<? extends Object> remove() throws InterruptedException {
if (Thread.currentThread() != Daemon.running) {
throw new InterruptedException();
}
return super.remove();
}
}
......@@ -112,7 +118,7 @@ public final class ActiveQueue {
if (impl == null) {
return;
}
Reference<?> ref = impl.removeSuper();
Reference<?> ref = impl.remove();
LOGGER.log(Level.FINE, "Got dequeued reference {0}", new Object[] { ref });
if (!(ref instanceof Runnable)) {
LOGGER.log(Level.WARNING, "A reference not implementing runnable has been added to the Utilities.activeReferenceQueue(): {0}", ref.getClass());
......@@ -131,9 +137,8 @@ public final class ActiveQueue {
// to allow GC
ref = null;
}
} catch (InterruptedException ex) {
// Can happen during VM shutdown, it seems. Ignore.
continue;
} catch (InterruptedException ignored) {
// Can happen during VM shutdown, it seems.
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment