Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit a2ac30e

Browse files
committed
Fixed 371 379
1 parent 5daac9c commit a2ac30e

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/main/java/com/mathworks/ci/MatlabInstallation.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
*/
99

10+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
1011
import hudson.CopyOnWrite;
1112
import hudson.EnvVars;
1213
import hudson.Extension;
@@ -15,6 +16,7 @@
1516
import hudson.model.EnvironmentSpecific;
1617
import hudson.model.Node;
1718
import hudson.model.TaskListener;
19+
import hudson.remoting.VirtualChannel;
1820
import hudson.slaves.NodeSpecific;
1921
import hudson.tools.ToolDescriptor;
2022
import hudson.tools.ToolInstallation;
@@ -59,14 +61,23 @@ public MatlabInstallation forNode(@Nonnull Node node, TaskListener log) throws I
5961
return new MatlabInstallation(getName(), translateFor(node, log), getProperties().toList());
6062
}
6163

64+
@SuppressFBWarnings(value = {"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"},
65+
justification =
66+
"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE: Its false positive scenario for sport bug which is fixed in later versions "
67+
+ "https://github.com/spotbugs/spotbugs/issues/1843")
6268
@Override
6369
public void buildEnvVars(EnvVars env) {
64-
FilePath batchExecutablePath = new FilePath (Jenkins.get().getChannel(), getHome());
6570
String pathToExecutable = getHome() + "/bin";
66-
if( batchExecutablePath.getParent () != null ){
67-
env.put ("PATH+matlab_batch", batchExecutablePath.getParent().getRemote());
68-
}
6971
env.put("PATH+matlabroot", pathToExecutable);
72+
Jenkins jenkinsInstance = Jenkins.getInstanceOrNull();
73+
if(jenkinsInstance != null){
74+
if(jenkinsInstance.getChannel() != null){
75+
FilePath batchExecutablePath = new FilePath(jenkinsInstance.getChannel (), getHome());
76+
if( batchExecutablePath.getParent() != null ){
77+
env.put ("PATH+matlab_batch", batchExecutablePath.getParent().getRemote());
78+
}
79+
}
80+
}
7081
}
7182

7283
public static MatlabInstallation[] getAll () {

src/main/java/com/mathworks/ci/tools/MatlabInstaller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private void appendReleaseToArguments(String release, ArgumentListBuilder args,
149149
args.add("--release=" + actualRelease);
150150
}
151151

152-
private void getFreshCopyOfExecutables(String platform, FilePath expectedPath)
152+
synchronized private void getFreshCopyOfExecutables(String platform, FilePath expectedPath)
153153
throws IOException, InterruptedException {
154154
FilePath matlabBatchPath = new FilePath(expectedPath, "matlab-batch");
155155
FilePath mpmPath = new FilePath(expectedPath, "mpm");

src/main/resources/com/mathworks/ci/tools/MatlabInstaller/help-release.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div>
22
<p>
3-
Insert the MATLAB version to install. To install the latest release of MATLAB, insert latest in the <b>Version</b> box.
3+
Insert the MATLAB version to install. To install the latest release of MATLAB, insert latest in the <b>Release</b> box.
44
</p>
55
<p>
66
<ul>

0 commit comments

Comments
 (0)