class AntennaUtils {

    public static Path computeInnerReplacementJarPath(Path jarPath){
        Iterator<Path> jarPathIterator = getJarPathIteratorFromPath(jarPath);
        if(!jarPathIterator.hasNext()){
            throw new ExecutionException("Tried to computeInnerReplacementPath from broken Path");
        }
        Path cleanedUp = jarPathIterator.next();
        while(jarPathIterator.hasNext()){
            final String basename = Optional.ofNullable(cleanedUp.getFileName())
                    .orElseThrow(() -> new ExecutionException("Error in computeInnerReplacementJarPath"))
                    .toString();
            final String parent = Optional.ofNullable(cleanedUp.getParent())
                    .orElseThrow(() -> new ExecutionException("Error in computeInnerReplacementJarPath"))
                    .toString();

            String cleanedUpBasename = replaceDotInJarExtension(basename);
            cleanedUp = Paths.get(parent, cleanedUpBasename, jarPathIterator.next().toString());
        }
        return cleanedUp;
    }

    private  AntennaUtils();

}