在代码中传递git url时发生InvalidPathException

时间:2019-01-04 06:15:52

标签: java file

在我的代码中传递URL时,我得到了java.nio.file.InvalidPathException。我尝试了正斜杠和后斜杠,但仍然遇到相同的错误。 代码-

import java.io.File;
import java.io.IOException;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;

public class testInAction 
{
public static void main(String[] args) throws IOException 
{
FileRepositoryBuilder builder = new FileRepositoryBuilder();
String repoUrl = "http://stash.gto.intranet.db.com:8081/projects/PARAGON/repos/paragongit/browse";
Repository repository = builder.setGitDir(new File(repoUrl)).readEnvironment().findGitDir().build();
listRepositoryContents(repository);
        repository.close();
    }

private static void listRepositoryContents(Repository repository) throws IOException {
        for (Ref head : repository.getAllRefs().values()) {
            String refName = head.getName();
            ObjectId objId = head.getObjectId();
            System.out.println("refName " + refName);
            System.out.println("objId " + objId);
        }
    }
}

这可能是什么原因...建议一些

1 个答案:

答案 0 :(得分:0)

根据我的阅读,对python-pptx的输入应该是您的 local Git存储库的相对路径或绝对路径,而不是远程路径。因此,在那里使用远程URL毫无意义,而用URL调用left = Inches(1.0) top = Inches(3.9) width = Inches(1.2) height = Inches(2.5) shape = shapes.add_shape( MSO_SHAPE.RECTANGLE, left, top, width, height ) fill = shape.fill fill.solid() fill.fore_color.rgb = RGBColor(226, 206, 72) # This RGB code is the background color that I want the shape to be in fill.fore_color.brightness = -0.3 text_frame = shape.text_frame text_frame.clear() p = text_frame.paragraphs[0] run = p.add_run() run.text = 'Test message' font = run.font font.name = 'Arial' font.size = Pt(16) font.bold = True 也没有任何意义。尝试以下方法:

setGitDir