Source:
<code>public Pod wait(String name, int timeoutMin, Predicate<Pod> predicate) throws InfrastructureException { String podName = getPodName(name); CompletableFuture<Pod> future = new CompletableFuture<>(); Watch watch = null; try { PodResource<Pod, DoneablePod> podResource = clientFactory.create(workspaceId).pods().inNamespace(namespace).withName(podName); watch = podResource.watch( new Watcher<Pod>() { @Override public void eventReceived(Action action, Pod pod) { if (predicate.test(pod)) { future.complete(pod); } } @Override public void onClose(KubernetesClientException cause) { future.completeExceptionally( new InfrastructureException( "Waiting for pod '" + podName + "' was interrupted")); } }); Pod actualPod = podResource.get(); if (actualPod == null) { <START> throw new InfrastructureException("Specified pod " + podName + " doesn't exist"); <END> } if (predicate.test(actualPod)) { return actualPod; } try { return future.get(timeoutMin, TimeUnit.MINUTES); } catch (ExecutionException e) { throw new InfrastructureException(e.getCause().getMessage(), e); } catch (TimeoutException e) { throw new InfrastructureException("Waiting for pod '" + podName + "' reached timeout"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new InfrastructureException("Waiting for pod '" + podName + "' was interrupted"); } } catch (KubernetesClientException e) { throw new KubernetesInfrastructureException(e); } finally { if (watch != null) { watch.close(); } } }</code><technical_language>is a situation deployment message confusing podName while wasn't</technical_language>

Target:
public Pod wait(String name, int timeoutMin, Predicate<Pod> predicate) throws InfrastructureException { String podName = getPodName(name); CompletableFuture<Pod> future = new CompletableFuture<>(); Watch watch = null; try { PodResource<Pod, DoneablePod> podResource = clientFactory.create(workspaceId).pods().inNamespace(namespace).withName(podName); watch = podResource.watch( new Watcher<Pod>() { @Override public void eventReceived(Action action, Pod pod) { if (predicate.test(pod)) { future.complete(pod); } } @Override public void onClose(KubernetesClientException cause) { future.completeExceptionally( new InfrastructureException( "Waiting for pod '" + podName + "' was interrupted")); } }); Pod actualPod = podResource.get(); if (actualPod == null) { if (name.equals(podName)) { throw new InfrastructureException("Specified pod " + podName + " doesn't exist"); } else { throw new InfrastructureException("No pod in deployment " + name + " found."); } } if (predicate.test(actualPod)) { return actualPod; } try { return future.get(timeoutMin, TimeUnit.MINUTES); } catch (ExecutionException e) { throw new InfrastructureException(e.getCause().getMessage(), e); } catch (TimeoutException e) { throw new InfrastructureException("Waiting for pod '" + podName + "' reached timeout"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new InfrastructureException("Waiting for pod '" + podName + "' was interrupted"); } } catch (KubernetesClientException e) { throw new KubernetesInfrastructureException(e); } finally { if (watch != null) { watch.close(); } } }