From 2c6c42bdffd1f9162c86d63a4b0bdee9a4eb7d59 Mon Sep 17 00:00:00 2001 From: Tor Norbye Date: Thu, 6 Dec 2012 14:29:08 -0800 Subject: Findbugs cleanup Fix a couple of issues found by findbugs, and some test stability fixes. Change-Id: I97390ea606ea25d6a68e5b7f8245e5e689117995 --- .../core/AndroidTypeRenameParticipant.java | 2 +- .../wizards/templates/NewTemplatePage.java | 1 - .../refactorings/core/RefactoringTestBase.java | 24 +++++++++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) (limited to 'eclipse') diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/core/AndroidTypeRenameParticipant.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/core/AndroidTypeRenameParticipant.java index 383fd13..759879a 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/core/AndroidTypeRenameParticipant.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactorings/core/AndroidTypeRenameParticipant.java @@ -134,7 +134,7 @@ public class AndroidTypeRenameParticipant extends RenameParticipant { } else { mNewFqcn = getArguments().getNewName(); } - if (mOldFqcn == null || mOldFqcn == null) { + if (mOldFqcn == null || mNewFqcn == null) { return false; } if (!RefactoringUtil.isRefactorAppPackage() && mNewFqcn.indexOf('.') == -1) { diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java index 1a2d3ca..57cf5c8 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/NewTemplatePage.java @@ -870,7 +870,6 @@ public class NewTemplatePage extends WizardPage p.type == Parameter.Type.SEPARATOR) { continue; } - p.suggest.indexOf(id); if (!p.suggest.contains(id)) { continue; } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RefactoringTestBase.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RefactoringTestBase.java index 8b7b817..1a97b83 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RefactoringTestBase.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/refactorings/core/RefactoringTestBase.java @@ -55,6 +55,11 @@ public abstract class RefactoringTestBase extends AdtProjectTest { checkRefactoring(refactoring, expected, null); } + @Override + protected void setUp() throws Exception { + // Not calling super.setUp + } + protected void checkRefactoring(Refactoring refactoring, String expected, @Nullable String expectedWarnings) throws Exception { RefactoringStatus status = refactoring.checkAllConditions(new NullProgressMonitor()); @@ -62,7 +67,16 @@ public abstract class RefactoringTestBase extends AdtProjectTest { if (expectedWarnings == null) { expectedWarnings = ""; } - assertEquals(status.toString().trim(), expectedWarnings.trim()); + if (status.toString().trim().startsWith( + "