Skip to content
Snippets Groups Projects
Commit 75b2c1ec authored by Robert Goldmann's avatar Robert Goldmann
Browse files

fixed possible NullPointerException

parent cea3748a
Branches
Tags
No related merge requests found
package de.deadlocker8.budgetmaster.backup;
public class GitBackupException extends Exception
{
public GitBackupException(String message)
{
super(message);
}
}
...@@ -53,14 +53,14 @@ public class RemoteGitBackupTask extends GitBackupTask ...@@ -53,14 +53,14 @@ public class RemoteGitBackupTask extends GitBackupTask
handleChanges(credentialsProvider, remote, settings.getAutoBackupGitBranchName()); handleChanges(credentialsProvider, remote, settings.getAutoBackupGitBranchName());
} }
catch(IOException | GitAPIException | URISyntaxException e) catch(IOException | GitAPIException | URISyntaxException | GitBackupException e)
{ {
LOGGER.error("Error performing remote git backup task", e); LOGGER.error("Error performing remote git backup task", e);
setBackupStatus(BackupStatus.ERROR); setBackupStatus(BackupStatus.ERROR);
} }
} }
private void handleChanges(UsernamePasswordCredentialsProvider credentialsProvider, String remote, String branchName) throws GitAPIException, IOException, URISyntaxException private void handleChanges(UsernamePasswordCredentialsProvider credentialsProvider, String remote, String branchName) throws GitAPIException, IOException, URISyntaxException, GitBackupException
{ {
LOGGER.debug(MessageFormat.format("Using git repository: \"{0}\"", gitFolder)); LOGGER.debug(MessageFormat.format("Using git repository: \"{0}\"", gitFolder));
try(Repository repository = GitHelper.openRepository(gitFolder)) try(Repository repository = GitHelper.openRepository(gitFolder))
...@@ -84,8 +84,13 @@ public class RemoteGitBackupTask extends GitBackupTask ...@@ -84,8 +84,13 @@ public class RemoteGitBackupTask extends GitBackupTask
} }
} }
private void renameBranch(Git git, String currentBranchName, String newBranchName) throws GitAPIException private void renameBranch(Git git, String currentBranchName, String newBranchName) throws GitAPIException, GitBackupException
{ {
if(currentBranchName == null)
{
throw new GitBackupException("Could not determine current branch name");
}
if(currentBranchName.equals(newBranchName)) if(currentBranchName.equals(newBranchName))
{ {
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment