{"thread":{"id":"19180","subject":"[PATCH JGIT v4] Silence inefficient new String(String) constructor reported by FindBugs","startedAt":"2009-05-04T21:54:04Z","lastAt":"2009-05-04T21:54:04Z","messageCount":1,"participants":["Sohn, Matthias"],"isPatch":true,"patchVersion":4,"patchTotal":null},"messages":[{"id":"113008","messageId":"366BBB1215D0AB4B8A153AF047A2878003073DCB@dewdfe18.wdf.sap.corp","threadId":"19180","inReplyTo":null,"subject":"[PATCH JGIT v4] Silence inefficient new String(String) constructor reported by FindBugs","fromName":"Sohn, Matthias","fromEmail":"matthias.sohn@sap.com","sentAt":"2009-05-04T21:54:04Z","receivedAt":"2009-05-04T21:54:04Z","isPatch":true,"sender":{"key":"matthias.sohn@sap.com","avatar":"https://gravatar.com/avatar/88bbb2733bcb977ec2d2cc1916ba8a70d6d41432c146bb8dab4f7f802261194e?d=mp&s=160"},"body":"From: Matthias Sohn <matthias.sohn@sap.com>\nSilencing \"inefficient new String(String) constructor\" warning reported by \nFindBugs (see\nhttp://thread.gmane.org/gmane.comp.version-control.git/117831/focus=117937).\nusing FindBugs filter mechanisms. For now the configuration file .fbprefs\ncontains the FindBugs default settings.\n\nSigned-off-by: Matthias Sohn <matthias.sohn@sap.com>\n---\nFiltering out false positives using FindBugs exclusion filter seems \nto be the best compromise since\n- filter settings can be shared by submitting .fbprefs and filter rules\n- using annotations would require to add additional jars to build path\n- simple comment would not reduce the FindBugs problem list\n\n org.spearce.jgit/.fbprefs                          |  125 ++++++++++++++++++++\n .../findBugs/FindBugsExcludeFilter.xml             |    9 ++\n 2 files changed, 134 insertions(+), 0 deletions(-)\n create mode 100644 org.spearce.jgit/.fbprefs\n create mode 100644 org.spearce.jgit/findBugs/FindBugsExcludeFilter.xml\n\ndiff --git a/org.spearce.jgit/.fbprefs b/org.spearce.jgit/.fbprefs\nnew file mode 100644\nindex 0000000..e97968b\n--- /dev/null\n+++ b/org.spearce.jgit/.fbprefs\n@@ -0,0 +1,125 @@\n+#FindBugs User Preferences\n+#Mon May 04 20:17:32 CEST 2009\n+detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true\n+detectorBadAppletConstructor=BadAppletConstructor|false\n+detectorBadResultSetAccess=BadResultSetAccess|true\n+detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true\n+detectorBadUseOfReturnValue=BadUseOfReturnValue|true\n+detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true\n+detectorBooleanReturnNull=BooleanReturnNull|true\n+detectorCallToUnsupportedMethod=CallToUnsupportedMethod|true\n+detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true\n+detectorCheckTypeQualifiers=CheckTypeQualifiers|true\n+detectorCloneIdiom=CloneIdiom|true\n+detectorComparatorIdiom=ComparatorIdiom|true\n+detectorConfusedInheritance=ConfusedInheritance|true\n+detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true\n+detectorCrossSiteScripting=CrossSiteScripting|true\n+detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true\n+detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true\n+detectorDontUseEnum=DontUseEnum|true\n+detectorDroppedException=DroppedException|true\n+detectorDumbMethodInvocations=DumbMethodInvocations|true\n+detectorDumbMethods=DumbMethods|true\n+detectorDuplicateBranches=DuplicateBranches|true\n+detectorEmptyZipFileEntry=EmptyZipFileEntry|true\n+detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true\n+detectorFinalizerNullsFields=FinalizerNullsFields|true\n+detectorFindBadCast2=FindBadCast2|true\n+detectorFindBadForLoop=FindBadForLoop|true\n+detectorFindCircularDependencies=FindCircularDependencies|false\n+detectorFindDeadLocalStores=FindDeadLocalStores|true\n+detectorFindDoubleCheck=FindDoubleCheck|true\n+detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true\n+detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true\n+detectorFindFinalizeInvocations=FindFinalizeInvocations|true\n+detectorFindFloatEquality=FindFloatEquality|true\n+detectorFindHEmismatch=FindHEmismatch|true\n+detectorFindInconsistentSync2=FindInconsistentSync2|true\n+detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true\n+detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true\n+detectorFindMaskedFields=FindMaskedFields|true\n+detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true\n+detectorFindNakedNotify=FindNakedNotify|true\n+detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true\n+detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true\n+detectorFindNonShortCircuit=FindNonShortCircuit|true\n+detectorFindNullDeref=FindNullDeref|true\n+detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true\n+detectorFindOpenStream=FindOpenStream|true\n+detectorFindPuzzlers=FindPuzzlers|true\n+detectorFindRefComparison=FindRefComparison|true\n+detectorFindReturnRef=FindReturnRef|true\n+detectorFindRunInvocations=FindRunInvocations|true\n+detectorFindSelfComparison=FindSelfComparison|true\n+detectorFindSelfComparison2=FindSelfComparison2|true\n+detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true\n+detectorFindSpinLoop=FindSpinLoop|true\n+detectorFindSqlInjection=FindSqlInjection|true\n+detectorFindTwoLockWait=FindTwoLockWait|true\n+detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true\n+detectorFindUnconditionalWait=FindUnconditionalWait|true\n+detectorFindUninitializedGet=FindUninitializedGet|true\n+detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true\n+detectorFindUnreleasedLock=FindUnreleasedLock|true\n+detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true\n+detectorFindUnsyncGet=FindUnsyncGet|true\n+detectorFindUselessControlFlow=FindUselessControlFlow|true\n+detectorFormatStringChecker=FormatStringChecker|true\n+detectorHugeSharedStringConstants=HugeSharedStringConstants|true\n+detectorIDivResultCastToDouble=IDivResultCastToDouble|true\n+detectorIncompatMask=IncompatMask|true\n+detectorInconsistentAnnotations=InconsistentAnnotations|true\n+detectorInefficientMemberAccess=InefficientMemberAccess|false\n+detectorInefficientToArray=InefficientToArray|true\n+detectorInfiniteLoop=InfiniteLoop|true\n+detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true\n+detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|false\n+detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true\n+detectorInitializationChain=InitializationChain|true\n+detectorInstantiateStaticClass=InstantiateStaticClass|true\n+detectorInvalidJUnitTest=InvalidJUnitTest|true\n+detectorIteratorIdioms=IteratorIdioms|true\n+detectorLazyInit=LazyInit|true\n+detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true\n+detectorMethodReturnCheck=MethodReturnCheck|true\n+detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true\n+detectorMutableLock=MutableLock|true\n+detectorMutableStaticFields=MutableStaticFields|true\n+detectorNaming=Naming|true\n+detectorNumberConstructor=NumberConstructor|true\n+detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true\n+detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true\n+detectorPublicSemaphores=PublicSemaphores|false\n+detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true\n+detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true\n+detectorRedundantInterfaces=RedundantInterfaces|true\n+detectorRepeatedConditionals=RepeatedConditionals|true\n+detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true\n+detectorSerializableIdiom=SerializableIdiom|true\n+detectorStartInConstructor=StartInConstructor|true\n+detectorStaticCalendarDetector=StaticCalendarDetector|true\n+detectorStringConcatenation=StringConcatenation|true\n+detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true\n+detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true\n+detectorSwitchFallthrough=SwitchFallthrough|true\n+detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true\n+detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true\n+detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true\n+detectorURLProblems=URLProblems|true\n+detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true\n+detectorUnnecessaryMath=UnnecessaryMath|true\n+detectorUnreadFields=UnreadFields|true\n+detectorUseObjectEquals=UseObjectEquals|false\n+detectorUselessSubclassMethod=UselessSubclassMethod|false\n+detectorVarArgsProblems=VarArgsProblems|true\n+detectorVolatileUsage=VolatileUsage|true\n+detectorWaitInLoop=WaitInLoop|true\n+detectorWrongMapIterator=WrongMapIterator|true\n+detectorXMLFactoryBypass=XMLFactoryBypass|true\n+detector_threshold=2\n+effort=default\n+excludefilter0=findBugs\\\\FindBugsExcludeFilter.xml\n+filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,MT_CORRECTNESS,PERFORMANCE,STYLE|false\n+filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY,EXPERIMENTAL|\n+run_at_full_build=true\ndiff --git a/org.spearce.jgit/findBugs/FindBugsExcludeFilter.xml b/org.spearce.jgit/findBugs/FindBugsExcludeFilter.xml\nnew file mode 100644\nindex 0000000..526eb01\n--- /dev/null\n+++ b/org.spearce.jgit/findBugs/FindBugsExcludeFilter.xml\n@@ -0,0 +1,9 @@\n+<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n+<FindBugsFilter>\n+     <!-- Silence inefficient new String(String) constructor warning, see http://thread.gmane.org/gmane.comp.version-control.git/117831/focus=117937 -->\n+     <Match>\n+       <Class name=\"org.spearce.jgit.lib.RefDatabase\" />\n+       <Method name=\"refreshPackedRefs\" />\n+       <Bug pattern=\"DM_STRING_CTOR\" />\n+     </Match>\n+</FindBugsFilter>\n-- \n1.6.2.2.1669.g7eaf8\n\n"}]}