diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2013-12-08 19:28:03 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2013-12-08 19:28:03 +0100 |
commit | 438682eef6e2e2875f4eb7775706078b7133c644 (patch) | |
tree | bb44402c7293c321c22eaef64c64650c66cdd4a6 | |
parent | c3fcacdb36b8ef6a8535dfbbc9e94fce0ac52d8b (diff) | |
download | cgeo-438682eef6e2e2875f4eb7775706078b7133c644.zip cgeo-438682eef6e2e2875f4eb7775706078b7133c644.tar.gz cgeo-438682eef6e2e2875f4eb7775706078b7133c644.tar.bz2 |
findbugs: more cleanup
* include findbugs suppression annotations
* have findbugs settings stored as shared settings
-rw-r--r-- | main/.classpath | 1 | ||||
-rw-r--r-- | main/.settings/edu.umd.cs.findbugs.core.prefs | 133 | ||||
-rw-r--r-- | main/compile-libs/findbugs-jsr305.jar | bin | 0 -> 33031 bytes | |||
-rw-r--r-- | main/libs/findbugs-annotations.jar | bin | 0 -> 77185 bytes | |||
-rw-r--r-- | main/project/findbugs/exclusions.xml | 5 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/AbstractPopupActivity.java | 6 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/DirectionProvider.java | 3 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 3 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/MainActivity.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 9 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/settings/TemplateTextPreference.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java | 3 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/ui/dialog/NoTitleDialog.java | 4 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/utils/MatcherWrapper.java | 3 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/utils/TextUtils.java | 3 |
15 files changed, 161 insertions, 16 deletions
diff --git a/main/.classpath b/main/.classpath index d7bb252..1b83665 100644 --- a/main/.classpath +++ b/main/.classpath @@ -20,5 +20,6 @@ <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry kind="lib" path="compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar"/> + <classpathentry kind="lib" path="compile-libs/findbugs-jsr305.jar"/> <classpathentry kind="output" path="bin/classes"/> </classpath> diff --git a/main/.settings/edu.umd.cs.findbugs.core.prefs b/main/.settings/edu.umd.cs.findbugs.core.prefs new file mode 100644 index 0000000..c371a1d --- /dev/null +++ b/main/.settings/edu.umd.cs.findbugs.core.prefs @@ -0,0 +1,133 @@ +#FindBugs User Preferences +#Sun Dec 08 19:08:28 CET 2013 +cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud +detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true +detectorAtomicityProblem=AtomicityProblem|true +detectorBadAppletConstructor=BadAppletConstructor|false +detectorBadResultSetAccess=BadResultSetAccess|true +detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true +detectorBadUseOfReturnValue=BadUseOfReturnValue|true +detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true +detectorBooleanReturnNull=BooleanReturnNull|true +detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false +detectorCheckExpectedWarnings=CheckExpectedWarnings|false +detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true +detectorCheckTypeQualifiers=CheckTypeQualifiers|true +detectorCloneIdiom=CloneIdiom|true +detectorComparatorIdiom=ComparatorIdiom|true +detectorConfusedInheritance=ConfusedInheritance|true +detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true +detectorCrossSiteScripting=CrossSiteScripting|true +detectorDefaultEncodingDetector=DefaultEncodingDetector|true +detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true +detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true +detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true +detectorDontUseEnum=DontUseEnum|true +detectorDroppedException=DroppedException|true +detectorDumbMethodInvocations=DumbMethodInvocations|true +detectorDumbMethods=DumbMethods|true +detectorDuplicateBranches=DuplicateBranches|true +detectorEmptyZipFileEntry=EmptyZipFileEntry|true +detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true +detectorExplicitSerialization=ExplicitSerialization|true +detectorFinalizerNullsFields=FinalizerNullsFields|true +detectorFindBadCast2=FindBadCast2|true +detectorFindBadForLoop=FindBadForLoop|true +detectorFindCircularDependencies=FindCircularDependencies|false +detectorFindDeadLocalStores=FindDeadLocalStores|true +detectorFindDoubleCheck=FindDoubleCheck|true +detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true +detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true +detectorFindFinalizeInvocations=FindFinalizeInvocations|true +detectorFindFloatEquality=FindFloatEquality|true +detectorFindHEmismatch=FindHEmismatch|true +detectorFindInconsistentSync2=FindInconsistentSync2|true +detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true +detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true +detectorFindMaskedFields=FindMaskedFields|true +detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true +detectorFindNakedNotify=FindNakedNotify|true +detectorFindNonShortCircuit=FindNonShortCircuit|true +detectorFindNullDeref=FindNullDeref|true +detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true +detectorFindOpenStream=FindOpenStream|true +detectorFindPuzzlers=FindPuzzlers|true +detectorFindRefComparison=FindRefComparison|true +detectorFindReturnRef=FindReturnRef|true +detectorFindRunInvocations=FindRunInvocations|true +detectorFindSelfComparison=FindSelfComparison|true +detectorFindSelfComparison2=FindSelfComparison2|true +detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true +detectorFindSpinLoop=FindSpinLoop|true +detectorFindSqlInjection=FindSqlInjection|true +detectorFindTwoLockWait=FindTwoLockWait|true +detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true +detectorFindUnconditionalWait=FindUnconditionalWait|true +detectorFindUninitializedGet=FindUninitializedGet|true +detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true +detectorFindUnreleasedLock=FindUnreleasedLock|true +detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true +detectorFindUnsyncGet=FindUnsyncGet|true +detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true +detectorFindUselessControlFlow=FindUselessControlFlow|true +detectorFormatStringChecker=FormatStringChecker|true +detectorHugeSharedStringConstants=HugeSharedStringConstants|true +detectorIDivResultCastToDouble=IDivResultCastToDouble|true +detectorIncompatMask=IncompatMask|true +detectorInconsistentAnnotations=InconsistentAnnotations|true +detectorInefficientMemberAccess=InefficientMemberAccess|false +detectorInefficientToArray=InefficientToArray|true +detectorInfiniteLoop=InfiniteLoop|true +detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true +detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true +detectorInitializationChain=InitializationChain|true +detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true +detectorInstantiateStaticClass=InstantiateStaticClass|true +detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true +detectorInvalidJUnitTest=InvalidJUnitTest|true +detectorIteratorIdioms=IteratorIdioms|true +detectorLazyInit=LazyInit|true +detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true +detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true +detectorMethodReturnCheck=MethodReturnCheck|true +detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true +detectorMutableLock=MutableLock|true +detectorMutableStaticFields=MutableStaticFields|true +detectorNaming=Naming|true +detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true +detectorNumberConstructor=NumberConstructor|true +detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true +detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true +detectorPublicSemaphores=PublicSemaphores|false +detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true +detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true +detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true +detectorRedundantInterfaces=RedundantInterfaces|true +detectorRepeatedConditionals=RepeatedConditionals|true +detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true +detectorSerializableIdiom=SerializableIdiom|true +detectorStartInConstructor=StartInConstructor|true +detectorStaticCalendarDetector=StaticCalendarDetector|true +detectorStringConcatenation=StringConcatenation|true +detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true +detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true +detectorSwitchFallthrough=SwitchFallthrough|true +detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true +detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true +detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true +detectorURLProblems=URLProblems|true +detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true +detectorUnnecessaryMath=UnnecessaryMath|true +detectorUnreadFields=UnreadFields|true +detectorUselessSubclassMethod=UselessSubclassMethod|true +detectorVarArgsProblems=VarArgsProblems|true +detectorVolatileUsage=VolatileUsage|true +detectorWaitInLoop=WaitInLoop|true +detectorWrongMapIterator=WrongMapIterator|true +detectorXMLFactoryBypass=XMLFactoryBypass|true +detector_threshold=3 +effort=max +excludefilter0=project/findbugs/exclusions.xml|true +filter_settings=Low|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|20 +filter_settings_neg=NOISE,I18N| +run_at_full_build=false diff --git a/main/compile-libs/findbugs-jsr305.jar b/main/compile-libs/findbugs-jsr305.jar Binary files differnew file mode 100644 index 0000000..cc39b73 --- /dev/null +++ b/main/compile-libs/findbugs-jsr305.jar diff --git a/main/libs/findbugs-annotations.jar b/main/libs/findbugs-annotations.jar Binary files differnew file mode 100644 index 0000000..3641ad6 --- /dev/null +++ b/main/libs/findbugs-annotations.jar diff --git a/main/project/findbugs/exclusions.xml b/main/project/findbugs/exclusions.xml index c48983e..9d44156 100644 --- a/main/project/findbugs/exclusions.xml +++ b/main/project/findbugs/exclusions.xml @@ -2,7 +2,10 @@ <FindBugsFilter> <!-- generated Android resources --> <Match> - <Class name="~.*\.R\$.*"/> + <Or> + <Class name="~.*\.R\$.*"/> + <Class name="~.*ViewHolder" + </Or> </Match> <!-- third party code --> diff --git a/main/src/cgeo/geocaching/AbstractPopupActivity.java b/main/src/cgeo/geocaching/AbstractPopupActivity.java index 5b9b509..5f24030 100644 --- a/main/src/cgeo/geocaching/AbstractPopupActivity.java +++ b/main/src/cgeo/geocaching/AbstractPopupActivity.java @@ -108,9 +108,6 @@ public abstract class AbstractPopupActivity extends AbstractActivity implements } @Override - public abstract void navigateTo(); - - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // set theme @@ -202,9 +199,6 @@ public abstract class AbstractPopupActivity extends AbstractActivity implements return super.onTouchEvent(event); } - @Override - public abstract void showNavigationMenu(); - protected abstract void startDefaultNavigation2(); protected final void addCacheDetails() { diff --git a/main/src/cgeo/geocaching/DirectionProvider.java b/main/src/cgeo/geocaching/DirectionProvider.java index b4fb86c..ae58fed 100644 --- a/main/src/cgeo/geocaching/DirectionProvider.java +++ b/main/src/cgeo/geocaching/DirectionProvider.java @@ -3,6 +3,8 @@ package cgeo.geocaching; import cgeo.geocaching.compatibility.Compatibility; import cgeo.geocaching.utils.MemorySubject; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import android.app.Activity; import android.content.Context; import android.hardware.Sensor; @@ -54,6 +56,7 @@ public class DirectionProvider extends MemorySubject<Float> implements SensorEve } @Override + @SuppressFBWarnings("FE_FLOATING_POINT_EQUALITY") public void onSensorChanged(final SensorEvent event) { final float direction = event.values[0]; if (direction != previous) { diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index c589e9b..2da93bc 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -32,6 +32,8 @@ import cgeo.geocaching.utils.LogTemplateProvider.LogContext; import cgeo.geocaching.utils.MatcherWrapper; import cgeo.geocaching.utils.UncertainProperty; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.lang3.BooleanUtils; @@ -366,6 +368,7 @@ public class Geocache implements ICache, IWaypoint { * the other cache to compare this one to * @return true if both caches have the same content */ + @SuppressFBWarnings("FE_FLOATING_POINT_EQUALITY") private boolean isEqualTo(final Geocache other) { return detailed == other.detailed && StringUtils.equalsIgnoreCase(geocode, other.geocode) && diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java index 1d4c22c..f5d19df 100644 --- a/main/src/cgeo/geocaching/MainActivity.java +++ b/main/src/cgeo/geocaching/MainActivity.java @@ -668,7 +668,7 @@ public class MainActivity extends AbstractActivity { wait(500); checks++; } catch (Exception e) { - // nothing; + Log.e("MainActivity.CountBubbleUpdateThread.run", e); } if (checks > 10) { diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 41f622f..98deb07 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -1310,9 +1310,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto protected DoRunnable(final Viewport viewport) { this.viewport = viewport; } - - @Override - public abstract void run(); } /** @@ -1479,7 +1476,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto mapController.setCenter(mapItemFactory.getGeoPointBase(new Geopoint(mapState[0] / 1.0e6, mapState[1] / 1.0e6))); mapController.setZoom(mapState[2]); } catch (RuntimeException e) { - // nothing at all + Log.e("centermap", e); } centered = true; @@ -1503,7 +1500,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto mapController.zoomToSpan((int) (viewport.getLatitudeSpan() * 1e6), (int) (viewport.getLongitudeSpan() * 1e6)); } } catch (RuntimeException e) { - // nothing at all + Log.e("centermap", e); } centered = true; @@ -1512,7 +1509,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto try { mapController.setCenter(makeGeoPoint(coordsCenter)); } catch (Exception e) { - // nothing at all + Log.e("centermap", e); } centered = true; diff --git a/main/src/cgeo/geocaching/settings/TemplateTextPreference.java b/main/src/cgeo/geocaching/settings/TemplateTextPreference.java index 9eaaa67..a703231 100644 --- a/main/src/cgeo/geocaching/settings/TemplateTextPreference.java +++ b/main/src/cgeo/geocaching/settings/TemplateTextPreference.java @@ -48,7 +48,7 @@ public class TemplateTextPreference extends DialogPreference { settingsActivity = (SettingsActivity) this.getContext(); editText = (EditText) view.findViewById(R.id.signature_dialog_text); - editText.setText(getPersistedString(initialValue != null ? initialValue.toString() : StringUtils.EMPTY)); + editText.setText(getPersistedString(initialValue != null ? initialValue : StringUtils.EMPTY)); Button button = (Button) view.findViewById(R.id.signature_templates); button.setOnClickListener(new View.OnClickListener() { diff --git a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java index 55b153b..568119e 100644 --- a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java +++ b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java @@ -2,6 +2,8 @@ package cgeo.geocaching.ui; import cgeo.geocaching.activity.AbstractViewPagerActivity.PageViewCreator; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import android.os.Bundle; import android.view.View; @@ -29,6 +31,7 @@ public abstract class AbstractCachingPageViewCreator<ViewClass extends View> imp } @Override + @SuppressFBWarnings("USM_USELESS_ABSTRACT_METHOD") public abstract ViewClass getDispatchedView(); /** diff --git a/main/src/cgeo/geocaching/ui/dialog/NoTitleDialog.java b/main/src/cgeo/geocaching/ui/dialog/NoTitleDialog.java index fc5ebe6..8660a7b 100644 --- a/main/src/cgeo/geocaching/ui/dialog/NoTitleDialog.java +++ b/main/src/cgeo/geocaching/ui/dialog/NoTitleDialog.java @@ -1,5 +1,7 @@ package cgeo.geocaching.ui.dialog; +import cgeo.geocaching.utils.Log; + import android.app.Dialog; import android.content.Context; import android.os.Bundle; @@ -24,7 +26,7 @@ public abstract class NoTitleDialog extends Dialog { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); } catch (final Exception e) { - // nothing + Log.e("NoTitleDialog.onCreate", e); } } } diff --git a/main/src/cgeo/geocaching/utils/MatcherWrapper.java b/main/src/cgeo/geocaching/utils/MatcherWrapper.java index 78b1170..c99d3c4 100644 --- a/main/src/cgeo/geocaching/utils/MatcherWrapper.java +++ b/main/src/cgeo/geocaching/utils/MatcherWrapper.java @@ -1,5 +1,7 @@ package cgeo.geocaching.utils; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -44,6 +46,7 @@ public class MatcherWrapper { * @param input * @return */ + @SuppressFBWarnings("DM_STRING_CTOR") private static String newString(String input) { if (input == null) { return null; diff --git a/main/src/cgeo/geocaching/utils/TextUtils.java b/main/src/cgeo/geocaching/utils/TextUtils.java index 14caf1d..efbb2d7 100644 --- a/main/src/cgeo/geocaching/utils/TextUtils.java +++ b/main/src/cgeo/geocaching/utils/TextUtils.java @@ -3,6 +3,8 @@ */ package cgeo.geocaching.utils; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import org.eclipse.jdt.annotation.Nullable; import java.util.regex.Matcher; @@ -36,6 +38,7 @@ public final class TextUtils { * Find the last occurring value * @return defaultValue or the n-th group if the pattern matches (trimmed if wanted) */ + @SuppressFBWarnings("DM_STRING_CTOR") public static String getMatch(@Nullable final String data, final Pattern p, final boolean trim, final int group, final String defaultValue, final boolean last) { if (data != null) { |