java - Crawling GitHub with JGit -
i'm trying crawl github wiki jgit.
when try 1 url, worked fine. tried random url , got error.
please see extract of code:
import java.io.file; import java.io.ioexception; import org.eclipse.jgit.api.git; import org.eclipse.jgit.api.errors.gitapiexception; public class main { // url error string url = "https://github.com/radiant/radiant.wiki.git"; // url works // string url = "https://github.com/wardcunningham/smallest-federated-wiki.wiki.git"; public static void main(string[] args) { main m = new main(); m.jgittest(); system.out.println("done!"); } public void jgittest() { try { file localpath = file.createtempfile("testgitrepository", ""); localpath.delete(); git.clonerepository().seturi(url).setdirectory(localpath).call(); } catch (ioexception | gitapiexception e) { system.err.println("excepton: " + e.getmessage()); e.printstacktrace(); } } }
this stack trace:
exception in thread "main" org.eclipse.jgit.dircache.invalidpathexception: invalid path (contains separator ':'): how-to:-create-an-extension.textile @ org.eclipse.jgit.dircache.dircachecheckout.checkvalidpathsegment(dircachecheckout.java:1243) @ org.eclipse.jgit.dircache.dircachecheckout.checkvalidpathsegment(dircachecheckout.java:1225) @ org.eclipse.jgit.dircache.dircachecheckout.checkvalidpath(dircachecheckout.java:1185) @ org.eclipse.jgit.dircache.dircachecheckout.processentry(dircachecheckout.java:311) @ org.eclipse.jgit.dircache.dircachecheckout.prescanonetree(dircachecheckout.java:290) @ org.eclipse.jgit.dircache.dircachecheckout.docheckout(dircachecheckout.java:408) @ org.eclipse.jgit.dircache.dircachecheckout.checkout(dircachecheckout.java:393) @ org.eclipse.jgit.api.clonecommand.checkout(clonecommand.java:236) @ org.eclipse.jgit.api.clonecommand.call(clonecommand.java:127) @ main.jgittest(main.java:21) @ main.main(main.java:13)
if visit wiki page of url doesn't work (https://github.com/radiant/radiant/wiki), find page: how to: create extension.
title of page cause of error: invalid path (contains separator ':'): how-to:-create-an-extension.textile
.
i assume need escape output.
i suppose on windows. can't create file on windows having ":" in name. jgit should handle somehow, suppose bug in jgit.
Comments
Post a Comment