Skip to content

Commit

Permalink
fix build on JDK 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed May 17, 2013
1 parent 48ea931 commit f51d92b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
45 changes: 45 additions & 0 deletions hawtio-core/src/main/java/io/hawt/util/Objects.java
@@ -0,0 +1,45 @@
/**
* Copyright (C) 2013 the original author or authors.
* See the notice.md file distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.hawt.util;

/**
* Some helper methods - though could be replaced by JDK 1.7 code now in java.util.Objects
* whenever we are happy to ignore JDK 1.6
*/
public class Objects {
public static boolean equals(Object a, Object b) {
if (a == b) {
return true;
} else {
return a != null && b != null && a.equals(b);
}
}

public static int compare(Comparable a, Comparable b) {
if (a == b) {
return 0;
}
if (a == null) {
return -1;
}
if (b == null) {
return 1;
}
return a.compareTo(b);
}
}
3 changes: 1 addition & 2 deletions hawtio-git/src/main/java/io/hawt/git/GitFacade.java
Expand Up @@ -4,6 +4,7 @@
import io.hawt.util.FileFilters;
import io.hawt.util.IOHelper;
import io.hawt.util.MBeanSupport;
import io.hawt.util.Objects;
import io.hawt.util.Strings;
import org.eclipse.jgit.api.AddCommand;
import org.eclipse.jgit.api.CloneCommand;
Expand All @@ -12,7 +13,6 @@
import org.eclipse.jgit.api.InitCommand;
import org.eclipse.jgit.api.ListBranchCommand;
import org.eclipse.jgit.api.Status;
import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.diff.DiffEntry;
Expand Down Expand Up @@ -44,7 +44,6 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.SortedSet;
import java.util.Timer;
import java.util.TimerTask;
Expand Down

0 comments on commit f51d92b

Please sign in to comment.