This is an automated email from the ASF dual-hosted git repository.
mbien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 0d6e1c2f59 fix NPE on git checkout error, print msg to output instead.
new d0382ce067 Merge pull request #4151 from mbien/git-npe
0d6e1c2f59 is described below
commit 0d6e1c2f59ecb9a45609e853238ffa8c9311d438
Author: Michael Bien <[email protected]>
AuthorDate: Wed May 25 19:43:21 2022 +0200
fix NPE on git checkout error, print msg to output instead.
---
.../modules/git/ui/checkout/AbstractCheckoutAction.java | 11 +++++++----
.../org/netbeans/modules/git/ui/checkout/Bundle.properties | 1 +
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git
a/ide/git/src/org/netbeans/modules/git/ui/checkout/AbstractCheckoutAction.java
b/ide/git/src/org/netbeans/modules/git/ui/checkout/AbstractCheckoutAction.java
index 8e7961a0dc..fd5f717514 100644
---
a/ide/git/src/org/netbeans/modules/git/ui/checkout/AbstractCheckoutAction.java
+++
b/ide/git/src/org/netbeans/modules/git/ui/checkout/AbstractCheckoutAction.java
@@ -99,8 +99,7 @@ public abstract class AbstractCheckoutAction extends
SingleRepositoryAction {
revision = newBranchName;
LOG.log(Level.FINE, "Creating branch: {0}:{1}", new
Object[] { revision, revisionToCheckout }); //NOI18N
GitBranch branch = client.createBranch(revision,
revisionToCheckout, getProgressMonitor());
- log(revisionToCheckout, branch);
-
+ logBranchCreation(revisionToCheckout, branch);
}
client.addNotificationListener(new FileListener() {
@Override
@@ -170,9 +169,13 @@ public abstract class AbstractCheckoutAction extends
SingleRepositoryAction {
return b != null && b.getName() != GitBranch.NO_BRANCH;
}
- private void log (String revision, GitBranch branch) {
+ private void logBranchCreation (String revision, GitBranch branch)
{
OutputLogger logger = getLogger();
-
logger.outputLine(NbBundle.getMessage(CheckoutRevisionAction.class,
"MSG_CheckoutRevisionAction.branchCreated", new Object[] { branch.getName(),
revision, branch.getId() })); //NOI18N
+ if (branch != null) {
+
logger.outputLine(NbBundle.getMessage(CheckoutRevisionAction.class,
"MSG_CheckoutRevisionAction.branchCreated", new Object[] { branch.getName(),
revision, branch.getId() })); //NOI18N
+ } else {
+
logger.outputLine(NbBundle.getMessage(CheckoutRevisionAction.class,
"MSG_CheckoutRevisionAction.noBranchCreated", new Object[] { revision }));
//NOI18N
+ }
}
private boolean resolveConflicts (File[] conflicts, boolean
mergeAllowed) throws GitException {
diff --git a/ide/git/src/org/netbeans/modules/git/ui/checkout/Bundle.properties
b/ide/git/src/org/netbeans/modules/git/ui/checkout/Bundle.properties
index d423882452..dffec9038f 100644
--- a/ide/git/src/org/netbeans/modules/git/ui/checkout/Bundle.properties
+++ b/ide/git/src/org/netbeans/modules/git/ui/checkout/Bundle.properties
@@ -48,6 +48,7 @@ MSG_CheckoutRevisionAction.branchCreated = Branch created\n\
Name: {0}\n\
From: {1}\n\
Id : {2}
+MSG_CheckoutRevisionAction.noBranchCreated = Branch with revision {0}, could
not be created
MSG_CheckoutRevisionAction.checkoutConflicts = You have local modification in
working copy that would result in a checkout conflict.\n\
You can try to merge, revert them or review them in the Versioning view.
LBL_CheckoutRevisionAction.checkoutConflicts = Checkout conflicts
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists