Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-04-18 16:15:42 -0400
committerCarsten Hammer2019-04-27 08:15:35 -0400
commit5b6d6eacaf221925f3391744387554458e0e8511 (patch)
tree150a643335349829a2efca15998728375353e7b9
parenta2962166dc7668df4614605d16045b0891e49e52 (diff)
downloadegit-5b6d6eacaf221925f3391744387554458e0e8511.tar.gz
egit-5b6d6eacaf221925f3391744387554458e0e8511.tar.xz
egit-5b6d6eacaf221925f3391744387554458e0e8511.zip
Use String.isEmpty() instead of comparing to ""
Use of String.equals("") can be replaced with with String.length() == 0 (for JDK5 and lower) or String.isEmpty() (for JDK6 and higher) Change-Id: I278bcc6e7095802469cfe2db24f029bb5dc870a9 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/GitMoveDeleteHookTest.java4
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java4
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java2
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java2
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/CreatePatchOperation.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/importing/GitScmUrlImportWizardPage.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/ExistingOrNewPage.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitVariableResolver.java2
10 files changed, 14 insertions, 14 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/GitMoveDeleteHookTest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/GitMoveDeleteHookTest.java
index d63569468..7667538b7 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/GitMoveDeleteHookTest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/GitMoveDeleteHookTest.java
@@ -744,14 +744,14 @@ public class GitMoveDeleteHookTest {
private void registerWorkspaceRelativeTestDirProject(String parent, String projName) {
- if ((parent != null) && !parent.equals(""))
+ if ((parent != null) && !parent.isEmpty())
registerWorkspaceRelativeTestDir(parent);
else
registerWorkspaceRelativeTestDir(projName);
}
private void registerWorkspaceRelativeTestDir(String relativeDir) {
- if ((relativeDir != null) && !relativeDir.equals("")) {
+ if ((relativeDir != null) && !relativeDir.isEmpty()) {
File d = new File(workspace, relativeDir);
testDirs.add(d);
}
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java
index 91193cd7b..da5f304e0 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/GitProjectSetCapability.java
@@ -88,7 +88,7 @@ public final class GitProjectSetCapability extends ProjectSetCapability {
if (projectPath == null) {
return null;
}
- if (projectPath.equals("")) //$NON-NLS-1$
+ if (projectPath.isEmpty())
projectPath = "."; //$NON-NLS-1$
return asReference(url, branch, projectPath);
@@ -112,7 +112,7 @@ public final class GitProjectSetCapability extends ProjectSetCapability {
public IProject[] addToWorkspace(final String[] referenceStrings,
final ProjectSetSerializationContext context,
final IProgressMonitor monitor) throws TeamException {
- final ArrayList<IProject> importedProjects = new ArrayList<IProject>();
+ final ArrayList<IProject> importedProjects = new ArrayList<>();
try{
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java
index 9a29c276d..c644cf7a1 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java
@@ -415,7 +415,7 @@ public class RepositoryUtil {
Set<String> dirs;
synchronized (prefs) {
dirString = prefs.get(PREFS_DIRECTORIES_REL, ""); //$NON-NLS-1$
- if (dirString.equals("")) { //$NON-NLS-1$
+ if (dirString.isEmpty()) {
dirs = migrateAbsolutePaths();
} else {
dirs = toDirSet(dirString);
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java
index be9f9c346..a076b542b 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java
@@ -246,7 +246,7 @@ class GitFileHistory extends FileHistory implements IAdaptable {
@Override
public IFileRevision getFileRevision(final String id) {
- if (id == null || id.equals("") //$NON-NLS-1$
+ if (id == null || id.isEmpty()
|| GitFileRevision.WORKSPACE.equals(id))
return new WorkspaceFileRevision(resource);
if (GitFileRevision.INDEX.equals(id))
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CreatePatchOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CreatePatchOperation.java
index 38b71bc85..e65826a8d 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CreatePatchOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CreatePatchOperation.java
@@ -419,7 +419,7 @@ public class CreatePatchOperation implements IEGitOperation {
if (repoRelativePath == null)
return path;
// repository and project at the same level
- if (repoRelativePath.equals("")) //$NON-NLS-1$
+ if (repoRelativePath.isEmpty())
return path;
return path.removeFirstSegments(path.matchingFirstSegments(new Path(
repoRelativePath)));
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java
index 041100ef3..eed6e3514 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitCreatePatchWizard.java
@@ -237,7 +237,7 @@ public class GitCreatePatchWizard extends Wizard {
if (rm != null) {
String repoRelativePath = rm.getRepoRelativePath(r);
if (repoRelativePath != null)
- if (repoRelativePath.equals("")) //$NON-NLS-1$
+ if (repoRelativePath.isEmpty())
// repository selected
return TreeFilter.ALL;
else
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java
index cf2d7cb1a..38722217c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/LocationPage.java
@@ -215,7 +215,7 @@ public class LocationPage extends WizardPage {
private void validateDialog() {
String fileName = wsFilenameText.getText();
- if (fileName.equals("")) //$NON-NLS-1$
+ if (fileName.isEmpty())
if (modified) {
setErrorMessage(UIText.GitCreatePatchWizard_WorkspacePatchDialogEnterFileName);
getButton(IDialogConstants.OK_ID).setEnabled(false);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/importing/GitScmUrlImportWizardPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/importing/GitScmUrlImportWizardPage.java
index 6df1482f2..5053d2820 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/importing/GitScmUrlImportWizardPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/importing/GitScmUrlImportWizardPage.java
@@ -254,7 +254,7 @@ public class GitScmUrlImportWizardPage extends WizardPage implements
// ignore
} else if (params[k].startsWith("version=")) { //$NON-NLS-1$
// ignore
- } else if (params[k]!=null && !params[k].equals("")) //$NON-NLS-1$
+ } else if (params[k] != null && !params[k].isEmpty())
sb.append(";").append(params[k]); //$NON-NLS-1$
} else
sb.append(ssp);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/ExistingOrNewPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/ExistingOrNewPage.java
index c617fce56..544879fb7 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/ExistingOrNewPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/sharing/ExistingOrNewPage.java
@@ -301,7 +301,7 @@ class ExistingOrNewPage extends WizardPage {
for (TreeItem ti : tree.getItems()) {
if (ti.getItemCount() > 0
|| ((ProjectAndRepo) ti.getData()).getRepo()
- .equals("")) //$NON-NLS-1$
+ .isEmpty())
ti.setChecked(false);
for (TreeItem subTi : ti.getItems()) {
IProject project = ((ProjectAndRepo) subTi
@@ -645,7 +645,7 @@ class ExistingOrNewPage extends WizardPage {
for (Object checkedElement : viewer.getCheckedElements()) {
String path = ((ProjectAndRepo) checkedElement).getRepo();
if (((ProjectAndRepo) checkedElement).getRepo() != null
- && path.equals("")) { //$NON-NLS-1$
+ && path.isEmpty()) {
pageComplete = false;
}
}
@@ -680,7 +680,7 @@ class ExistingOrNewPage extends WizardPage {
IPath p = null;
for (TreeItem ti : treeItems) {
String gitDirParentCandidate = ti.getText(1);
- if (gitDirParentCandidate.equals("")) //$NON-NLS-1$
+ if (gitDirParentCandidate.isEmpty())
continue;
if (ti.getItemCount() > 0)
if (hasRepositoryInOwnDirectory(ti.getItems()))
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitVariableResolver.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitVariableResolver.java
index 1e184f8b8..a78a5e671 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitVariableResolver.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/variables/GitVariableResolver.java
@@ -74,7 +74,7 @@ public class GitVariableResolver implements IDynamicVariableResolver {
if (repoRelativePath == null) {
return ""; //$NON-NLS-1$
}
- if (repoRelativePath.equals("")) //$NON-NLS-1$
+ if (repoRelativePath.isEmpty())
return "."; //$NON-NLS-1$
else
return repoRelativePath;

Back to the top