Skip to content

Commit aa2a8f7

Browse files
Max Hoheneggermsohn
authored andcommitted
Fix incomplete null analysis configuration
JGit annotations were configured in the projects properties, but the dependency was unresolvable in the IDE. Hence null analysis was effectively disabled. Also fix potential null access that was revealed after the null analysis configuration has been fixed. Change-Id: I1f1e98ae14dbd1973e9fffe34475f072f460b728 Signed-off-by: Max Hohenegger <[email protected]>
1 parent 41e8c5f commit aa2a8f7

File tree

11 files changed

+27
-11
lines changed

11 files changed

+27
-11
lines changed

org.eclipse.egit.gitflow.ui/META-INF/MANIFEST.MF

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Import-Package: org.eclipse.egit.core;version="[4.6.0,4.7.0)",
3535
Require-Bundle: org.eclipse.core.jobs;bundle-version="[3.4.0,4.0.0)",
3636
org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
3737
org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
38-
org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)";resolution:=optional,
3938
org.eclipse.team.ui;bundle-version="[3.4.0,4.0.0)",
4039
org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
4140
org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
@@ -44,7 +43,8 @@ Require-Bundle: org.eclipse.core.jobs;bundle-version="[3.4.0,4.0.0)",
4443
org.eclipse.core.databinding.observable;bundle-version="[1.4.0,2.0.0)",
4544
org.eclipse.core.databinding.beans;bundle-version="[1.2.0,2.0.0)",
4645
org.eclipse.core.databinding;bundle-version="[1.4.0,2.0.0)",
47-
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)"
46+
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
47+
org.eclipse.jgit;bundle-version="[4.6.0,4.7.0)";resolution:=optional
4848
Export-Package: org.eclipse.egit.gitflow.ui;version="4.6.0";x-friends:="org.eclipse.egit.ui.test",
4949
org.eclipse.egit.gitflow.ui.internal;version="4.6.0";x-friends:="org.eclipse.egit.ui.test",
5050
org.eclipse.egit.gitflow.ui.internal.actions;version="4.6.0";x-friends:="org.eclipse.egit.ui.test",

org.eclipse.egit.gitflow.ui/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ bin.includes = META-INF/,\
55
plugin.properties,\
66
about.html,\
77
icons/
8-
additional.bundles = org.eclipse.jdt.annotation
8+
additional.bundles = org.eclipse.jgit
99
src.includes = about.html

org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/DevelopCheckoutHandler.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
*******************************************************************************/
99
package org.eclipse.egit.gitflow.ui.internal.actions;
1010

11+
import static org.eclipse.egit.gitflow.ui.Activator.error;
12+
1113
import org.eclipse.core.commands.AbstractHandler;
1214
import org.eclipse.core.commands.ExecutionEvent;
1315
import org.eclipse.core.commands.ExecutionException;
1416
import org.eclipse.egit.gitflow.GitFlowRepository;
17+
import org.eclipse.egit.gitflow.ui.internal.UIText;
1518
import org.eclipse.egit.ui.internal.branch.BranchOperationUI;
1619

1720
/**
@@ -22,6 +25,9 @@ public class DevelopCheckoutHandler extends AbstractHandler {
2225
@Override
2326
public Object execute(ExecutionEvent event) throws ExecutionException {
2427
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
28+
if (gfRepo == null) {
29+
return error(UIText.Handlers_noGitflowRepositoryFound);
30+
}
2531

2632
BranchOperationUI.checkout(gfRepo.getRepository(),
2733
gfRepo.getConfig().getDevelopFull()).start();

org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/DevelopCompareHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*******************************************************************************/
99
package org.eclipse.egit.gitflow.ui.internal.actions;
1010

11+
import static org.eclipse.egit.gitflow.ui.Activator.error;
1112
import static org.eclipse.egit.ui.Activator.handleError;
1213
import static org.eclipse.egit.ui.internal.UIText.CompareWithRefAction_errorOnSynchronize;
1314
import static org.eclipse.jgit.lib.Constants.HEAD;
@@ -21,6 +22,7 @@
2122
import org.eclipse.core.resources.IResource;
2223
import org.eclipse.core.runtime.OperationCanceledException;
2324
import org.eclipse.egit.gitflow.GitFlowRepository;
25+
import org.eclipse.egit.gitflow.ui.internal.UIText;
2426
import org.eclipse.egit.ui.internal.CompareUtils;
2527
import org.eclipse.ui.IWorkbenchPage;
2628

@@ -32,6 +34,9 @@ public class DevelopCompareHandler extends AbstractHandler {
3234
@Override
3335
public Object execute(ExecutionEvent event) throws ExecutionException {
3436
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
37+
if (gfRepo == null) {
38+
return error(UIText.Handlers_noGitflowRepositoryFound);
39+
}
3540

3641
IResource[] selectedResources = GitFlowHandlerUtil.gatherResourceToOperateOn(event);
3742
String revision;

org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/actions/GitFlowHandlerUtil.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
import org.eclipse.core.resources.IResource;
1616
import org.eclipse.egit.gitflow.GitFlowRepository;
1717
import org.eclipse.egit.ui.internal.selection.SelectionUtils;
18-
import org.eclipse.jdt.annotation.Nullable;
1918
import org.eclipse.jface.viewers.ISelection;
2019
import org.eclipse.jface.viewers.IStructuredSelection;
2120
import org.eclipse.jface.viewers.StructuredSelection;
21+
import org.eclipse.jgit.annotations.Nullable;
2222
import org.eclipse.jgit.lib.Ref;
2323
import org.eclipse.jgit.lib.Repository;
2424
import org.eclipse.ui.handlers.HandlerUtil;
@@ -68,6 +68,11 @@ static IStructuredSelection getSelection(ExecutionEvent event) {
6868
static String gatherRevision(ExecutionEvent event) throws IOException {
6969
final GitFlowRepository gfRepo = GitFlowHandlerUtil
7070
.getRepository(event);
71+
if (gfRepo == null) {
72+
throw new IllegalStateException(
73+
"Gitflow command called with no Gitflow repository present"); //$NON-NLS-1$
74+
}
75+
7176
Ref develop = gfRepo.getRepository()
7277
.exactRef(gfRepo.getConfig().getDevelopFull());
7378
if (develop == null) {

org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/decorators/GitFlowLightweightDecorator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
import org.eclipse.egit.gitflow.ui.Activator;
1616
import org.eclipse.egit.gitflow.ui.internal.UIIcons;
1717
import org.eclipse.egit.ui.internal.repository.tree.RepositoryNode;
18-
import org.eclipse.jdt.annotation.Nullable;
1918
import org.eclipse.jface.resource.ImageDescriptor;
2019
import org.eclipse.jface.viewers.IDecoration;
2120
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
2221
import org.eclipse.jface.viewers.LabelProvider;
22+
import org.eclipse.jgit.annotations.Nullable;
2323
import org.eclipse.jgit.lib.Repository;
2424
import org.eclipse.swt.graphics.ImageData;
2525
import org.eclipse.ui.PlatformUI;

org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/dialogs/InitDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@
5555
import org.eclipse.egit.gitflow.GitFlowRepository;
5656
import org.eclipse.egit.gitflow.InitParameters;
5757
import org.eclipse.egit.gitflow.WrongGitFlowStateException;
58-
import org.eclipse.jdt.annotation.NonNull;
5958
import org.eclipse.jface.databinding.dialog.TitleAreaDialogSupport;
6059
import org.eclipse.jface.databinding.dialog.ValidationMessageProvider;
6160
import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
6261
import org.eclipse.jface.dialogs.TitleAreaDialog;
6362
import org.eclipse.jface.layout.GridDataFactory;
6463
import org.eclipse.jface.layout.GridLayoutFactory;
64+
import org.eclipse.jgit.annotations.NonNull;
6565
import org.eclipse.jgit.lib.Ref;
6666
import org.eclipse.jgit.lib.Repository;
6767
import org.eclipse.jgit.revwalk.RevCommit;

org.eclipse.egit.gitflow/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Bundle-ActivationPolicy: lazy
1010
Bundle-Localization: plugin
1111
Require-Bundle: org.eclipse.core.runtime,
1212
org.eclipse.core.resources,
13-
org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)";resolution:=optional
13+
org.eclipse.jgit;bundle-version="[4.6.0,4.7.0)";resolution:=optional
1414
Export-Package: org.eclipse.egit.gitflow;version="4.6.0";
1515
uses:="org.osgi.framework,
1616
org.eclipse.jgit.transport,

org.eclipse.egit.gitflow/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ bin.includes = META-INF/,\
44
build.properties,\
55
about.html,\
66
plugin.properties
7-
additional.bundles = org.eclipse.jdt.annotation
7+
additional.bundles = org.eclipse.jgit
88
src.includes = about.html

org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/GitFlowRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import java.util.List;
1818

1919
import org.eclipse.egit.gitflow.internal.CoreText;
20-
import org.eclipse.jdt.annotation.NonNull;
21-
import org.eclipse.jdt.annotation.Nullable;
20+
import org.eclipse.jgit.annotations.NonNull;
21+
import org.eclipse.jgit.annotations.Nullable;
2222
import org.eclipse.jgit.api.Git;
2323
import org.eclipse.jgit.api.errors.GitAPIException;
2424
import org.eclipse.jgit.errors.IncorrectObjectTypeException;

0 commit comments

Comments
 (0)