• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Camelcade / Perl5-IDEA / #525521637

21 Jul 2025 12:07PM UTC coverage: 82.347% (+0.08%) from 82.266%
#525521637

push

github

hurricup
#2842 Moved embedded perl extensions

30964 of 37602 relevant lines covered (82.35%)

0.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.5
/plugin/docker/src/main/java/com/perl5/lang/perl/idea/sdk/host/docker/PerlDockerFileTransfer.java
1
/*
2
 * Copyright 2015-2025 Alexandr Evstigneev
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.perl5.lang.perl.idea.sdk.host.docker;
18

19
import com.intellij.execution.ExecutionException;
20
import com.intellij.openapi.util.NullableLazyValue;
21
import com.intellij.openapi.vfs.VirtualFile;
22
import com.perl5.lang.perl.idea.sdk.host.PerlHostFileTransfer;
23
import org.jetbrains.annotations.NotNull;
24
import org.jetbrains.annotations.Nullable;
25

26
import java.io.IOException;
27
import java.util.Arrays;
28
import java.util.Collections;
29
import java.util.List;
30

31
import static com.intellij.openapi.util.NullableLazyValue.atomicLazyNullable;
32

33
class PerlDockerFileTransfer extends PerlHostFileTransfer<PerlDockerData> {
34
  private final @NotNull PerlDockerAdapter myAdapter;
35

36
  private volatile boolean isOpened = false;
1✔
37
  private volatile Throwable closedThrowable;
38
  private volatile ExecutionException myCreationError;
39

40
  private final NullableLazyValue<@Nullable String> myContainerNameProvider = atomicLazyNullable(() -> {
1✔
41
    try {
42
      String containerName = getAdapter().createRunningContainer("copying_" + myHostData.getSafeImageName());
1✔
43
      isOpened = true;
1✔
44
      return containerName;
1✔
45
    }
46
    catch (ExecutionException e) {
×
47
      myCreationError = e;
×
48
    }
49
    return null;
×
50
  });
51

52
  public PerlDockerFileTransfer(@NotNull PerlDockerData hostData) {
53
    super(hostData);
1✔
54
    myAdapter = new PerlDockerAdapter(hostData);
1✔
55
  }
1✔
56

57
  @NotNull
58
  PerlDockerAdapter getAdapter() {
59
    return myAdapter;
1✔
60
  }
61

62
  @Override
63
  protected void doSyncPath(@NotNull String remotePath, String localPath) throws IOException {
64
    assertNotClosed();
1✔
65
    try {
66
      myAdapter.copyRemote(getContainerName(), remotePath, localPath);
1✔
67
    }
68
    catch (ExecutionException e) {
×
69
      throw new IOException(e);
×
70
    }
1✔
71
  }
1✔
72

73
  private synchronized void assertNotClosed() throws IOException {
74
    if (closedThrowable != null) {
1✔
75
      throw new IOException("This transfer is already closed", closedThrowable);
×
76
    }
77
  }
1✔
78

79
  @Override
80
  protected void doSyncHelpers() throws IOException {
81
    assertNotClosed();
1✔
82
  }
1✔
83

84
  @NotNull
85
  String getContainerName() throws IOException {
86
    String containerName = myContainerNameProvider.getValue();
1✔
87
    if (containerName != null) {
1✔
88
      return containerName;
1✔
89
    }
90
    throw new IOException("Container could not be created for " + myHostData + ".", myCreationError);
×
91
  }
92

93
  @Override
94
  public synchronized void close() throws IOException {
95
    if (!isOpened) {
1✔
96
      return;
×
97
    }
98
    if (closedThrowable != null) {
1✔
99
      throw new IOException("This transfer is already closed.", closedThrowable);
×
100
    }
101
    closedThrowable = new Throwable();
1✔
102

103
    String containerName = getContainerName();
1✔
104
    try {
105
      myAdapter.killContainer(containerName);
1✔
106
    }
107
    catch (ExecutionException e) {
×
108
      throw new IOException("Error killing copy container: " + containerName, e);
×
109
    }
1✔
110
  }
1✔
111

112
  @Override
113
  public @NotNull List<VirtualFile> listFiles(@NotNull String remotePath) {
114
    VirtualFile root = new PerlDockerFileSystem(this).refreshAndFindFileByPath(remotePath);
1✔
115
    return root == null ? Collections.emptyList() : Collections.unmodifiableList(Arrays.asList(root.getChildren()));
1✔
116
  }
117
}
118

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc