Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » GitHub Wiki and jGit
GitHub Wiki and jGit [message #1404260] Wed, 30 July 2014 17:36 Go to next message
Dol Bik is currently offline Dol BikFriend
Messages: 9
Registered: April 2014
Junior Member
Is it possible to access GitHub Wiki using jGit?

Let's take for example https://github.com/radiant/radiant/wiki. There are titles like "Installation", "The Basics", "Extensions", etc., links to other sites (as you can see on the right) and the corresponding descriptions.
How can I retrieve and parse those information with jGit?
I know how to access Git repositories with jGit, but I'm not sure if it's possible to access the GitHub Wiki as well.

This is what I have so far:

Repository repository = null;

try {
	File localPath = File.createTempFile("TestGitRepository", "");
	localPath.delete();

	Git.cloneRepository()
			.setURI("https://github.com/radiant/radiant.wiki.git") 
			.setDirectory(localPath).call();

	Git git = Git.open(localPath);
	repository = git.getRepository();

} catch (IOException | GitAPIException e) {
	System.err.println("Caught Exception: " + e.getMessage());
	e.printStackTrace();
} finally {
	repository.close(); // Exception
}


But I get a java.lang.NullPointerException at repository.close();.

Thank you.

[Updated on: Wed, 30 July 2014 18:24]

Report message to a moderator

Re: GitHub Wiki and jGit [message #1404276 is a reply to message #1404260] Wed, 30 July 2014 20:32 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1072
Registered: July 2009
Senior Member
I tried your example and it works perfectly well, though if you hit an exception
the variable "repository" is null and you will hit NPE when trying to close the
repository. Add a null check to fix this.

Maybe some RuntimeException is thrown, in this case no stack trace will be
printed since you only catch checked exceptions.

Maybe you are lacking proxy settings ?
Previous Topic:Issue with Configure Git repository
Next Topic:Committed changes to branch, now won't let me push upstream
Goto Forum:
  


Current Time: Thu Aug 22 11:13:50 GMT 2019

Powered by FUDForum. Page generated in 0.01675 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top