Skip to content

Commit fc4394a

Browse files
committed
Various warning fixes in ContainerLauncher.
1 parent 7896f2b commit fc4394a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/docker/ui/launch/ContainerLauncher.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Arrays;
2121
import java.util.HashMap;
2222
import java.util.HashSet;
23-
import java.util.Iterator;
2423
import java.util.List;
2524
import java.util.Map;
2625
import java.util.Properties;
@@ -87,7 +86,6 @@ public class ContainerLauncher {
8786
* AbstractMap.SimpleEntry is a Pair as Java does not have a native Pair
8887
*
8988
*/
90-
@SuppressWarnings("rawtypes")
9189
private Map<AbstractMap.SimpleEntry<String, String>, IPath> dirMapping = new HashMap<>();
9290

9391
private class CopyVolumesJob extends Job {
@@ -115,15 +113,13 @@ protected IStatus run(IProgressMonitor monitor) {
115113
monitor.beginTask(
116114
Messages.getFormattedString(COPY_VOLUMES_DESC, containerId),
117115
volumes.size());
118-
Iterator<String> iterator = volumes.keySet().iterator();
119116
IStatus status = Status.OK_STATUS;
120117
// for each remote volume, copy from host to Container volume
121-
while (iterator.hasNext()) {
118+
for (String hostDirectory : volumes.keySet()) {
122119
if (monitor.isCanceled()) {
123120
monitor.done();
124121
return Status.CANCEL_STATUS;
125122
}
126-
String hostDirectory = iterator.next();
127123
String containerDirectory = volumes.get(hostDirectory);
128124
if (!containerDirectory.endsWith("/")) { //$NON-NLS-1$
129125
containerDirectory = containerDirectory + "/"; //$NON-NLS-1$
@@ -488,7 +484,7 @@ public void launch(String id, IContainerLaunchListener listener,
488484
}
489485

490486
// add any exposed ports as needed
491-
if (exposedPorts.size() > 0)
487+
if (!exposedPorts.isEmpty())
492488
builder = builder.exposedPorts(exposedPorts);
493489

494490
// add any labels if specified
@@ -943,7 +939,7 @@ private Job fetchContainerDirsJobInt(String connectionUri, String imageName, Lis
943939
HashSet<Path> containerDirsSet = new HashSet<>();
944940

945941
for (String dir : containerDirs) {
946-
if (excludedDirs != null && excludedDirs.stream().anyMatch(p -> dir.startsWith(p))) {
942+
if (excludedDirs != null && excludedDirs.stream().anyMatch(dir::startsWith)) {
947943
continue;
948944
}
949945
containerDirsSet.add(new Path(dir));
@@ -1482,7 +1478,7 @@ public Set<String> getCopiedVolumes(String connectionName, String imageName) {
14821478
if(tpath == null) return new HashSet<>();
14831479

14841480
Set<IPath> rv = getCopiedVolumes(tpath);
1485-
return rv.stream().map(p -> p.toString()).collect(Collectors.toSet());
1481+
return rv.stream().map(IPath::toString).collect(Collectors.toSet());
14861482
}
14871483

14881484
/**
@@ -1494,7 +1490,7 @@ public Set<String> getCopiedVolumes(String connectionName, String imageName) {
14941490
*
14951491
* @since 5.7
14961492
*/
1497-
static public Set<IPath> getCopiedVolumes(IPath hostdir) {
1493+
public static Set<IPath> getCopiedVolumes(IPath hostdir) {
14981494
return CopyFromDockerJob.getCopiedPaths((Path) hostdir);
14991495
}
15001496

0 commit comments

Comments
 (0)