mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
prevent some CNFE during tests with call token macro with reflection
This commit is contained in:
1 parent
3bd3ff9b57
commit
c2cd2d11f2
2 files changed
+19
-13
No files matched your search
@@ -60,6 +60,7 @@ import hudson.tasks.Maven.MavenInstallation;
|
||||
import hudson.util.ArgumentListBuilder;
|
||||
import hudson.util.IOUtils;
|
||||
import hudson.util.MaskingClassLoader;
|
||||
import hudson.util.ReflectionUtils;
|
||||
import hudson.util.StreamTaskListener;
|
||||
|
||||
import java.io.File;
|
||||
@@ -67,6 +68,7 @@ import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -92,11 +94,7 @@ import org.apache.maven.model.building.ModelBuildingRequest;
|
||||
import org.apache.maven.monitor.event.EventDispatcher;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.ProjectBuildingException;
|
||||
import org.codehaus.plexus.PlexusConstants;
|
||||
import org.codehaus.plexus.configuration.DefaultPlexusConfiguration;
|
||||
import org.codehaus.plexus.util.PathTool;
|
||||
import org.jenkinsci.plugins.tokenmacro.MacroEvaluationException;
|
||||
import org.jenkinsci.plugins.tokenmacro.TokenMacro;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.sonatype.aether.transfer.TransferCancelledException;
|
||||
@@ -528,9 +526,13 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
String opts = project.getMavenOpts();
|
||||
if (opts == null ) return null;
|
||||
try {
|
||||
opts = TokenMacro.expand(this, listener, opts);
|
||||
} catch (MacroEvaluationException e) {
|
||||
listener.error( "Ignore MacroEvaluationException " + e.getMessage() );
|
||||
Class<?> clazz = Class.forName( "org.jenkinsci.plugins.tokenmacro.MacroEvaluationException" );
|
||||
Method expandMethod =
|
||||
ReflectionUtils.findMethod(clazz, "expand", new Class[]{ this.getClass(), listener.getClass(), String.class} );
|
||||
opts = (String) expandMethod.invoke( null, this, listener, opts );
|
||||
//opts = TokenMacro.expand(this, listener, opts);
|
||||
//} catch (MacroEvaluationException e) {
|
||||
// listener.error( "Ignore MacroEvaluationException " + e.getMessage() );
|
||||
}
|
||||
catch(Exception tokenException) {
|
||||
listener.error("Ignore Problem expanding maven opts macros " + tokenException.getMessage());
|
||||
|
||||
Reference in new issue
Block a user