summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2013-03-26 12:03:27 (EDT)
committer Gerrit Code Review @ Eclipse.org2013-04-04 17:22:18 (EDT)
commitc780e457a44ccd9758ac2a595bec8c67c69e7885 (patch)
tree36b635db81c484f3e77f27dc01901bde2a8ef439
parenta5fbd77e741ccd5b70c01f7f63d0a73ae7b743e4 (diff)
downloadorg.eclipse.mylyn.commons-c780e457a44ccd9758ac2a595bec8c67c69e7885.zip
org.eclipse.mylyn.commons-c780e457a44ccd9758ac2a595bec8c67c69e7885.tar.gz
org.eclipse.mylyn.commons-c780e457a44ccd9758ac2a595bec8c67c69e7885.tar.bz2
always return a background monitor from Policy#backgroundMonitorForrefs/changes/75/11475/3
Policy#backgroundMonitorFor does not return a background monitor if the passed monitor is null. In that case it returns a new NullProgressMonitor, which is not expected. Change-Id: I4f10f84ed5d7e036dc314f4def87d49d3e0ae749
-rw-r--r--org.eclipse.mylyn.commons.net/src/org/eclipse/mylyn/commons/net/Policy.java2
-rw-r--r--org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/operations/OperationUtilTest.java6
2 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.commons.net/src/org/eclipse/mylyn/commons/net/Policy.java b/org.eclipse.mylyn.commons.net/src/org/eclipse/mylyn/commons/net/Policy.java
index 123a408..6299565 100644
--- a/org.eclipse.mylyn.commons.net/src/org/eclipse/mylyn/commons/net/Policy.java
+++ b/org.eclipse.mylyn.commons.net/src/org/eclipse/mylyn/commons/net/Policy.java
@@ -65,7 +65,7 @@ public class Policy {
*/
public static IProgressMonitor backgroundMonitorFor(IProgressMonitor monitor) {
if (monitor == null) {
- return new NullProgressMonitor();
+ monitor = new NullProgressMonitor();
}
return new BackgroundProgressMonitor(monitor);
}
diff --git a/org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/operations/OperationUtilTest.java b/org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/operations/OperationUtilTest.java
index 420bcbd..0ecf854 100644
--- a/org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/operations/OperationUtilTest.java
+++ b/org.eclipse.mylyn.commons.tests/src/org/eclipse/mylyn/commons/tests/operations/OperationUtilTest.java
@@ -32,10 +32,14 @@ public class OperationUtilTest extends TestCase {
assertFalse(OperationUtil.isBackgroundMonitor(new NullProgressMonitor()));
}
- public void testIsBackgroundMonitorBackgroundMonitor() {
+ public void testIsBackgroundMonitorBackgroundMonitorForNullProgressMonitor() {
assertTrue(OperationUtil.isBackgroundMonitor(Policy.backgroundMonitorFor(new NullProgressMonitor())));
}
+ public void testIsBackgroundMonitorBackgroundMonitorForNull() {
+ assertTrue(OperationUtil.isBackgroundMonitor(Policy.backgroundMonitorFor(null)));
+ }
+
public void testIsBackgroundMonitorOperationMonitorNull() {
assertFalse(OperationUtil.isBackgroundMonitor(OperationUtil.convert(null)));
}