diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2020-12-04 11:27:47 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2020-12-22 10:53:00 +0100 |
commit | 21262e98fe6ccb397f7d8af0fca6c8b8c0de2794 (patch) | |
tree | d1406112da5040ec90801aa98bbe875f31ce9069 | |
parent | 0132666d5aa668455a2a45d82bc1f62bd1365998 (diff) | |
download | jgit-21262e98fe6ccb397f7d8af0fca6c8b8c0de2794.tar.gz jgit-21262e98fe6ccb397f7d8af0fca6c8b8c0de2794.zip |
[spotbugs] Silence NP_BOOLEAN_RETURN_NULL in FakeUserAuthGSS#doAuth
Also mark the return value @Nullable to enable null analysis in Eclipse.
Change-Id: Ib954b231d743da6ea122adb2cc4880b5f99824cc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
3 files changed, 156 insertions, 1 deletions
diff --git a/org.eclipse.jgit.junit.ssh/.settings/edu.umd.cs.findbugs.core.prefs b/org.eclipse.jgit.junit.ssh/.settings/edu.umd.cs.findbugs.core.prefs new file mode 100644 index 0000000000..2792ea032a --- /dev/null +++ b/org.eclipse.jgit.junit.ssh/.settings/edu.umd.cs.findbugs.core.prefs @@ -0,0 +1,145 @@ +#SpotBugs User Preferences +#Fri Dec 04 11:26:04 CET 2020 +detectorExplicitSerialization=ExplicitSerialization|true +detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true +detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true +detectorWrongMapIterator=WrongMapIterator|true +detectorUnnecessaryMath=UnnecessaryMath|true +detectorUselessSubclassMethod=UselessSubclassMethod|false +filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|15 +detectorURLProblems=URLProblems|true +detectorIteratorIdioms=IteratorIdioms|true +detectorMutableEnum=MutableEnum|true +detectorFindNonShortCircuit=FindNonShortCircuit|true +detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true +detectorVolatileUsage=VolatileUsage|true +detectorFindNakedNotify=FindNakedNotify|true +detectorFindUninitializedGet=FindUninitializedGet|true +detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true +detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true +detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true +detectorSwitchFallthrough=SwitchFallthrough|true +detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true +detectorConfusedInheritance=ConfusedInheritance|true +detectorSynchronizationOnSharedBuiltinConstant=SynchronizationOnSharedBuiltinConstant|true +detectorMutableStaticFields=MutableStaticFields|true +detectorInvalidJUnitTest=InvalidJUnitTest|true +detectorInfiniteLoop=InfiniteLoop|true +detectorFindRunInvocations=FindRunInvocations|true +detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true +detectorXMLFactoryBypass=XMLFactoryBypass|true +detectorFindOpenStream=FindOpenStream|true +detectorCheckExpectedWarnings=CheckExpectedWarnings|false +detectorHugeSharedStringConstants=HugeSharedStringConstants|true +detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true +detectorStringConcatenation=StringConcatenation|true +detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true +detectorFinalizerNullsFields=FinalizerNullsFields|true +detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true +detectorInefficientToArray=InefficientToArray|false +detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true +detectorInconsistentAnnotations=InconsistentAnnotations|true +detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true +detectorInstantiateStaticClass=InstantiateStaticClass|true +detectorCheckRelaxingNullnessAnnotation=CheckRelaxingNullnessAnnotation|true +detectorMethodReturnCheck=MethodReturnCheck|true +detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true +detectorFindDoubleCheck=FindDoubleCheck|true +detectorFindBadForLoop=FindBadForLoop|true +detectorDefaultEncodingDetector=DefaultEncodingDetector|true +detectorFindInconsistentSync2=FindInconsistentSync2|true +detectorFindSpinLoop=FindSpinLoop|true +detectorFindMaskedFields=FindMaskedFields|true +detectorBooleanReturnNull=BooleanReturnNull|true +detectorFindUnsyncGet=FindUnsyncGet|true +detectorCrossSiteScripting=CrossSiteScripting|true +detectorDroppedException=DroppedException|true +detectorFindDeadLocalStores=FindDeadLocalStores|true +detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true +detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true +detectorFindRefComparison=FindRefComparison|true +detectorFindRoughConstants=FindRoughConstants|true +detectorMutableLock=MutableLock|true +detectorFindNullDeref=FindNullDeref|true +detectorFindReturnRef=FindReturnRef|true +detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true +detectorFindUselessControlFlow=FindUselessControlFlow|true +detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true +detectorIDivResultCastToDouble=IDivResultCastToDouble|true +detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true +detectorFindSelfComparison=FindSelfComparison|true +detectorFindFloatEquality=FindFloatEquality|true +detectorFindComparatorProblems=FindComparatorProblems|true +detectorRepeatedConditionals=RepeatedConditionals|true +filter_settings_neg=NOISE| +detectorInefficientMemberAccess=InefficientMemberAccess|false +detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true +detectorNumberConstructor=NumberConstructor|true +detectorDontAssertInstanceofInTests=DontAssertInstanceofInTests|true +detectorFindFinalizeInvocations=FindFinalizeInvocations|true +detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true +detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true +detectorFindUnconditionalWait=FindUnconditionalWait|true +detectorFindTwoLockWait=FindTwoLockWait|true +detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true +detectorFindUnreleasedLock=FindUnreleasedLock|true +detectorInefficientIndexOf=InefficientIndexOf|false +detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true +detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true +detectorOverridingMethodsMustInvokeSuperDetector=OverridingMethodsMustInvokeSuperDetector|true +detectorWaitInLoop=WaitInLoop|true +detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true +detectorBadUseOfReturnValue=BadUseOfReturnValue|true +detectorFindSqlInjection=FindSqlInjection|true +detectorUnreadFields=UnreadFields|true +detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true +detectorFindUselessObjects=FindUselessObjects|true +detectorBadAppletConstructor=BadAppletConstructor|false +detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true +detectorSerializableIdiom=SerializableIdiom|true +detectorNaming=Naming|true +detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true +detectorFormatStringChecker=FormatStringChecker|true +detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true +detectorEmptyZipFileEntry=EmptyZipFileEntry|false +detectorFindCircularDependencies=FindCircularDependencies|false +detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true +detectorAtomicityProblem=AtomicityProblem|true +detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true +detectorInitializationChain=InitializationChain|true +detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true +detectorOptionalReturnNull=OptionalReturnNull|true +detectorStartInConstructor=StartInConstructor|true +detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true +detectorRedundantConditions=RedundantConditions|true +effort=default +detectorRedundantInterfaces=RedundantInterfaces|true +detectorDuplicateBranches=DuplicateBranches|true +detectorCheckTypeQualifiers=CheckTypeQualifiers|true +detectorComparatorIdiom=ComparatorIdiom|true +detectorFindBadCast2=FindBadCast2|true +detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true +excludefilter0=findBugs/FindBugsExcludeFilter.xml|true +detectorBadResultSetAccess=BadResultSetAccess|true +detectorIncompatMask=IncompatMask|true +detectorCovariantArrayAssignment=CovariantArrayAssignment|false +detectorDumbMethodInvocations=DumbMethodInvocations|true +run_at_full_build=false +detectorStaticCalendarDetector=StaticCalendarDetector|true +detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true +detectorVarArgsProblems=VarArgsProblems|true +detectorInefficientInitializationInsideLoop=InefficientInitializationInsideLoop|false +detectorCloneIdiom=CloneIdiom|true +detectorFindHEmismatch=FindHEmismatch|true +detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true +detectorFindSelfComparison2=FindSelfComparison2|true +detectorLazyInit=LazyInit|true +detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true +detectorDontUseEnum=DontUseEnum|true +detectorFindPuzzlers=FindPuzzlers|true +detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false +detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true +detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true +detector_threshold=2 +detectorPublicSemaphores=PublicSemaphores|false +detectorDumbMethods=DumbMethods|true diff --git a/org.eclipse.jgit.junit.ssh/findBugs/FindBugsExcludeFilter.xml b/org.eclipse.jgit.junit.ssh/findBugs/FindBugsExcludeFilter.xml new file mode 100644 index 0000000000..999cb71f7c --- /dev/null +++ b/org.eclipse.jgit.junit.ssh/findBugs/FindBugsExcludeFilter.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<FindBugsFilter> + <!-- Silence returning null for Boolean return type --> + <Match> + <Class name="org.eclipse.jgit.junit.ssh.SshTestGitServer$FakeUserAuthGSS" /> + <Method name="doAuth" /> + <Bug pattern="NP_BOOLEAN_RETURN_NULL" /> + </Match> +</FindBugsFilter> diff --git a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java index ab8e0c1ca0..8494a2fb1a 100644 --- a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java +++ b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java @@ -54,6 +54,7 @@ import org.apache.sshd.server.shell.UnknownCommand; import org.apache.sshd.server.subsystem.SubsystemFactory; import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; import org.eclipse.jgit.annotations.NonNull; +import org.eclipse.jgit.annotations.Nullable; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.ReceivePack; import org.eclipse.jgit.transport.RemoteConfig; @@ -202,7 +203,7 @@ public class SshTestGitServer { private static class FakeUserAuthGSS extends UserAuthGSS { @Override - protected Boolean doAuth(Buffer buffer, boolean initial) + protected @Nullable Boolean doAuth(Buffer buffer, boolean initial) throws Exception { // We always reply that we did do this, but then we fail at the // first token message. That way we can test that the client-side |