Fix some warnings raised by CheckStyle
- Change ordering of 'static', 'final', etc modifiers according to the order suggested by JLS. - Add comments in empty catch blocks for intentionally ignored exceptions. - Add curly braces around if-else blocks. - Move `catch` to same line as closing brace of preceding `try` blocks. - Wrap long lines. Note that this change does not fix all instances of the above errors across the entire code base. Change-Id: I24bb9649cc5013c249fa5d84e05322a5cdf2ace6
This commit is contained in:
@@ -42,7 +42,7 @@ class ConfigAnnotationParser {
|
|||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static private void parseAnnotation(Config cfg, GerritConfig c) {
|
private static void parseAnnotation(Config cfg, GerritConfig c) {
|
||||||
ArrayList<String> l = Lists.newArrayList(splitter.split(c.name()));
|
ArrayList<String> l = Lists.newArrayList(splitter.split(c.name()));
|
||||||
if (l.size() == 2) {
|
if (l.size() == 2) {
|
||||||
cfg.setString(l.get(0), null, l.get(1), c.value());
|
cfg.setString(l.get(0), null, l.get(1), c.value());
|
||||||
|
@@ -77,13 +77,13 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||||||
|
|
||||||
public class ChangeEditIT extends AbstractDaemonTest {
|
public class ChangeEditIT extends AbstractDaemonTest {
|
||||||
|
|
||||||
private final static String FILE_NAME = "foo";
|
private static final String FILE_NAME = "foo";
|
||||||
private final static String FILE_NAME2 = "foo2";
|
private static final String FILE_NAME2 = "foo2";
|
||||||
private final static String FILE_NAME3 = "foo3";
|
private static final String FILE_NAME3 = "foo3";
|
||||||
private final static byte[] CONTENT_OLD = "bar".getBytes(UTF_8);
|
private static final byte[] CONTENT_OLD = "bar".getBytes(UTF_8);
|
||||||
private final static byte[] CONTENT_NEW = "baz".getBytes(UTF_8);
|
private static final byte[] CONTENT_NEW = "baz".getBytes(UTF_8);
|
||||||
private final static String CONTENT_NEW2_STR = "quxÄÜÖßµ";
|
private static final String CONTENT_NEW2_STR = "quxÄÜÖßµ";
|
||||||
private final static byte[] CONTENT_NEW2 = CONTENT_NEW2_STR.getBytes(UTF_8);
|
private static final byte[] CONTENT_NEW2 = CONTENT_NEW2_STR.getBytes(UTF_8);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SchemaFactory<ReviewDb> reviewDbProvider;
|
private SchemaFactory<ReviewDb> reviewDbProvider;
|
||||||
|
@@ -46,6 +46,7 @@ public final class IoUtil {
|
|||||||
try {
|
try {
|
||||||
src.close();
|
src.close();
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -145,7 +145,7 @@ public class ParameterizedString {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class Format {
|
private abstract static class Format {
|
||||||
abstract void format(StringBuilder b, Map<String, String> p);
|
abstract void format(StringBuilder b, Map<String, String> p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ public class ParameterizedString {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class Function {
|
private abstract static class Function {
|
||||||
abstract String apply(String a);
|
abstract String apply(String a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -182,10 +182,14 @@ public class PermissionRule implements Comparable<PermissionRule> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (canUseRange && (getMin() != 0 || getMax() != 0)) {
|
if (canUseRange && (getMin() != 0 || getMax() != 0)) {
|
||||||
if (0 <= getMin()) r.append('+');
|
if (0 <= getMin()) {
|
||||||
|
r.append('+');
|
||||||
|
}
|
||||||
r.append(getMin());
|
r.append(getMin());
|
||||||
r.append("..");
|
r.append("..");
|
||||||
if (0 <= getMax()) r.append('+');
|
if (0 <= getMax()) {
|
||||||
|
r.append('+');
|
||||||
|
}
|
||||||
r.append(getMax());
|
r.append(getMax());
|
||||||
r.append(' ');
|
r.append(' ');
|
||||||
}
|
}
|
||||||
|
@@ -28,18 +28,18 @@ public interface WebLink {
|
|||||||
/**
|
/**
|
||||||
* Opens the link in a new window or tab
|
* Opens the link in a new window or tab
|
||||||
*/
|
*/
|
||||||
public final static String BLANK = "_blank";
|
public static final String BLANK = "_blank";
|
||||||
/**
|
/**
|
||||||
* Opens the link in the frame it was clicked.
|
* Opens the link in the frame it was clicked.
|
||||||
*/
|
*/
|
||||||
public final static String SELF = "_self";
|
public static final String SELF = "_self";
|
||||||
/**
|
/**
|
||||||
* Opens link in parent frame.
|
* Opens link in parent frame.
|
||||||
*/
|
*/
|
||||||
public final static String PARENT = "_parent";
|
public static final String PARENT = "_parent";
|
||||||
/**
|
/**
|
||||||
* Opens link in the full body of the window.
|
* Opens link in the full body of the window.
|
||||||
*/
|
*/
|
||||||
public final static String TOP = "_top";
|
public static final String TOP = "_top";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -402,7 +402,7 @@ public class SafeHtmlBuilder extends SafeHtml {
|
|||||||
return isElementName(name);
|
return isElementName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class Impl {
|
private abstract static class Impl {
|
||||||
abstract void escapeStr(SafeHtmlBuilder b, String in);
|
abstract void escapeStr(SafeHtmlBuilder b, String in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -895,7 +895,7 @@ public class Dispatcher {
|
|||||||
return token.substring(prefixlen);
|
return token.substring(prefixlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class AsyncSplit implements RunAsyncCallback {
|
private abstract static class AsyncSplit implements RunAsyncCallback {
|
||||||
private final boolean isReloadUi;
|
private final boolean isReloadUi;
|
||||||
protected final String token;
|
protected final String token;
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ public class AccountInfo extends JavaScriptObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class AvatarInfo extends JavaScriptObject {
|
public static class AvatarInfo extends JavaScriptObject {
|
||||||
public final static int DEFAULT_SIZE = 26;
|
public static final int DEFAULT_SIZE = 26;
|
||||||
public final native String url() /*-{ return this.url }-*/;
|
public final native String url() /*-{ return this.url }-*/;
|
||||||
public final native int height() /*-{ return this.height || 0 }-*/;
|
public final native int height() /*-{ return this.height || 0 }-*/;
|
||||||
public final native int width() /*-{ return this.width || 0 }-*/;
|
public final native int width() /*-{ return this.width || 0 }-*/;
|
||||||
|
@@ -294,8 +294,8 @@ public final class GerritLauncher {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private volatile static File myArchive;
|
private static volatile File myArchive;
|
||||||
private volatile static File myHome;
|
private static volatile File myHome;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locate the JAR/WAR file we were launched from.
|
* Locate the JAR/WAR file we were launched from.
|
||||||
|
@@ -96,7 +96,7 @@ public final class Plugin extends JavaScriptObject {
|
|||||||
|
|
||||||
native void _initialized() /*-{ this._success = true }-*/;
|
native void _initialized() /*-{ this._success = true }-*/;
|
||||||
native void _loaded() /*-{ this._loadedGwt() }-*/;
|
native void _loaded() /*-{ this._loadedGwt() }-*/;
|
||||||
private static native final Plugin install(String u)
|
private static final native Plugin install(String u)
|
||||||
/*-{ return $wnd.Gerrit.installGwt(u) }-*/;
|
/*-{ return $wnd.Gerrit.installGwt(u) }-*/;
|
||||||
|
|
||||||
private static final native JavaScriptObject wrap(Screen.EntryPoint b) /*-{
|
private static final native JavaScriptObject wrap(Screen.EntryPoint b) /*-{
|
||||||
|
@@ -109,7 +109,7 @@ public class RestApi {
|
|||||||
get(NativeString.unwrap(cb));
|
get(NativeString.unwrap(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native static void get(String p, JavaScriptObject r)
|
private static native void get(String p, JavaScriptObject r)
|
||||||
/*-{ $wnd.Gerrit.get(p, r) }-*/;
|
/*-{ $wnd.Gerrit.get(p, r) }-*/;
|
||||||
|
|
||||||
public <T extends JavaScriptObject>
|
public <T extends JavaScriptObject>
|
||||||
@@ -117,7 +117,7 @@ public class RestApi {
|
|||||||
put(path(), wrap(cb));
|
put(path(), wrap(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native static void put(String p, JavaScriptObject r)
|
private static native void put(String p, JavaScriptObject r)
|
||||||
/*-{ $wnd.Gerrit.put(p, r) }-*/;
|
/*-{ $wnd.Gerrit.put(p, r) }-*/;
|
||||||
|
|
||||||
public <T extends JavaScriptObject>
|
public <T extends JavaScriptObject>
|
||||||
@@ -125,7 +125,7 @@ public class RestApi {
|
|||||||
put(path(), content, wrap(cb));
|
put(path(), content, wrap(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native static
|
private static native
|
||||||
void put(String p, String c, JavaScriptObject r)
|
void put(String p, String c, JavaScriptObject r)
|
||||||
/*-{ $wnd.Gerrit.put(p, c, r) }-*/;
|
/*-{ $wnd.Gerrit.put(p, c, r) }-*/;
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ public class RestApi {
|
|||||||
put(path(), content, wrap(cb));
|
put(path(), content, wrap(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native static
|
private static native
|
||||||
void put(String p, JavaScriptObject c, JavaScriptObject r)
|
void put(String p, JavaScriptObject c, JavaScriptObject r)
|
||||||
/*-{ $wnd.Gerrit.put(p, c, r) }-*/;
|
/*-{ $wnd.Gerrit.put(p, c, r) }-*/;
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ public class RestApi {
|
|||||||
post(path(), content, wrap(cb));
|
post(path(), content, wrap(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native static
|
private static native
|
||||||
void post(String p, String c, JavaScriptObject r)
|
void post(String p, String c, JavaScriptObject r)
|
||||||
/*-{ $wnd.Gerrit.post(p, c, r) }-*/;
|
/*-{ $wnd.Gerrit.post(p, c, r) }-*/;
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ public class RestApi {
|
|||||||
post(path(), content, wrap(cb));
|
post(path(), content, wrap(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native static
|
private static native
|
||||||
void post(String p, JavaScriptObject c, JavaScriptObject r)
|
void post(String p, JavaScriptObject c, JavaScriptObject r)
|
||||||
/*-{ $wnd.Gerrit.post(p, c, r) }-*/;
|
/*-{ $wnd.Gerrit.post(p, c, r) }-*/;
|
||||||
|
|
||||||
@@ -160,10 +160,10 @@ public class RestApi {
|
|||||||
delete(path(), wrap(cb));
|
delete(path(), wrap(cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native static void delete(String p, JavaScriptObject r)
|
private static native void delete(String p, JavaScriptObject r)
|
||||||
/*-{ $wnd.Gerrit.del(p, r) }-*/;
|
/*-{ $wnd.Gerrit.del(p, r) }-*/;
|
||||||
|
|
||||||
private native static <T extends JavaScriptObject>
|
private static native <T extends JavaScriptObject>
|
||||||
JavaScriptObject wrap(AsyncCallback<T> b) /*-{
|
JavaScriptObject wrap(AsyncCallback<T> b) /*-{
|
||||||
return function(r) {
|
return function(r) {
|
||||||
b.@com.google.gwt.user.client.rpc.AsyncCallback::onSuccess(Ljava/lang/Object;)(r)
|
b.@com.google.gwt.user.client.rpc.AsyncCallback::onSuccess(Ljava/lang/Object;)(r)
|
||||||
|
@@ -28,7 +28,7 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class PrettyFormatter implements SparseHtmlFile {
|
public abstract class PrettyFormatter implements SparseHtmlFile {
|
||||||
public static abstract class EditFilter {
|
public abstract static class EditFilter {
|
||||||
abstract String getStyleName();
|
abstract String getStyleName();
|
||||||
|
|
||||||
abstract int getBegin(Edit edit);
|
abstract int getBegin(Edit edit);
|
||||||
|
@@ -924,8 +924,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
|
|||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
log.info("hook[" + getName() + "] output: " + line);
|
log.info("hook[" + getName() + "] output: " + line);
|
||||||
}
|
}
|
||||||
}
|
} catch (IOException iox) {
|
||||||
catch(IOException iox) {
|
|
||||||
log.error("Error writing hook output", iox);
|
log.error("Error writing hook output", iox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
public class TimestampHandler extends OptionHandler<Timestamp> {
|
public class TimestampHandler extends OptionHandler<Timestamp> {
|
||||||
public final static String TIMESTAMP_FORMAT = "yyyyMMdd_HHmm";
|
public static final String TIMESTAMP_FORMAT = "yyyyMMdd_HHmm";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public TimestampHandler(@Assisted CmdLineParser parser,
|
public TimestampHandler(@Assisted CmdLineParser parser,
|
||||||
|
@@ -72,7 +72,7 @@ public class ConsistencyChecker {
|
|||||||
LoggerFactory.getLogger(ConsistencyChecker.class);
|
LoggerFactory.getLogger(ConsistencyChecker.class);
|
||||||
|
|
||||||
@AutoValue
|
@AutoValue
|
||||||
public static abstract class Result {
|
public abstract static class Result {
|
||||||
private static Result create(Change.Id id, List<ProblemInfo> problems) {
|
private static Result create(Change.Id id, List<ProblemInfo> problems) {
|
||||||
return new AutoValue_ConsistencyChecker_Result(id, null, problems);
|
return new AutoValue_ConsistencyChecker_Result(id, null, problems);
|
||||||
}
|
}
|
||||||
|
@@ -70,7 +70,7 @@ import java.util.List;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class GetDiff implements RestReadView<FileResource> {
|
public class GetDiff implements RestReadView<FileResource> {
|
||||||
private final static ImmutableMap<Patch.ChangeType, ChangeType> CHANGE_TYPE =
|
private static final ImmutableMap<Patch.ChangeType, ChangeType> CHANGE_TYPE =
|
||||||
Maps.immutableEnumMap(
|
Maps.immutableEnumMap(
|
||||||
new ImmutableMap.Builder<Patch.ChangeType, ChangeType>()
|
new ImmutableMap.Builder<Patch.ChangeType, ChangeType>()
|
||||||
.put(Patch.ChangeType.ADDED, ChangeType.ADDED)
|
.put(Patch.ChangeType.ADDED, ChangeType.ADDED)
|
||||||
@@ -339,11 +339,13 @@ public class GetDiff implements RestReadView<FileResource> {
|
|||||||
int lastB = 0;
|
int lastB = 0;
|
||||||
for (Edit edit : internalEdit) {
|
for (Edit edit : internalEdit) {
|
||||||
if (edit.getBeginA() != edit.getEndA()) {
|
if (edit.getBeginA() != edit.getEndA()) {
|
||||||
e.editA.add(ImmutableList.of(edit.getBeginA() - lastA, edit.getEndA() - edit.getBeginA()));
|
e.editA.add(ImmutableList.of(
|
||||||
|
edit.getBeginA() - lastA, edit.getEndA() - edit.getBeginA()));
|
||||||
lastA = edit.getEndA();
|
lastA = edit.getEndA();
|
||||||
}
|
}
|
||||||
if (edit.getBeginB() != edit.getEndB()) {
|
if (edit.getBeginB() != edit.getEndB()) {
|
||||||
e.editB.add(ImmutableList.of(edit.getBeginB() - lastB, edit.getEndB() - edit.getBeginB()));
|
e.editB.add(ImmutableList.of(
|
||||||
|
edit.getBeginB() - lastB, edit.getEndB() - edit.getBeginB()));
|
||||||
lastB = edit.getEndB();
|
lastB = edit.getEndB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,8 +34,10 @@ import java.util.List;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
/**
|
/**
|
||||||
* The suggest oracle may be called many times in rapid succession during the course of one operation.
|
* The suggest oracle may be called many times in rapid succession during the
|
||||||
* It would be easy to have a simple Cache<Boolean, List<Account>> with a short expiration time of 30s.
|
* course of one operation.
|
||||||
|
* It would be easy to have a simple Cache<Boolean, List<Account>> with a short
|
||||||
|
* expiration time of 30s.
|
||||||
* Cache only has a single key we're just using Cache for the expiration behavior.
|
* Cache only has a single key we're just using Cache for the expiration behavior.
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@@ -537,17 +537,23 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
case REJECT:
|
case REJECT:
|
||||||
if (msg.length() > 0) msg.append("; ");
|
if (msg.length() > 0) {
|
||||||
|
msg.append("; ");
|
||||||
|
}
|
||||||
msg.append("blocked by ").append(lbl.label);
|
msg.append("blocked by ").append(lbl.label);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case NEED:
|
case NEED:
|
||||||
if (msg.length() > 0) msg.append("; ");
|
if (msg.length() > 0) {
|
||||||
|
msg.append("; ");
|
||||||
|
}
|
||||||
msg.append("needs ").append(lbl.label);
|
msg.append("needs ").append(lbl.label);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case IMPOSSIBLE:
|
case IMPOSSIBLE:
|
||||||
if (msg.length() > 0) msg.append("; ");
|
if (msg.length() > 0) {
|
||||||
|
msg.append("; ");
|
||||||
|
}
|
||||||
msg.append("needs ").append(lbl.label)
|
msg.append("needs ").append(lbl.label)
|
||||||
.append(" (check project access)");
|
.append(" (check project access)");
|
||||||
continue;
|
continue;
|
||||||
|
@@ -100,12 +100,13 @@ public final class SitePaths {
|
|||||||
|
|
||||||
if (site_path.exists()) {
|
if (site_path.exists()) {
|
||||||
final String[] contents = site_path.list();
|
final String[] contents = site_path.list();
|
||||||
if (contents != null)
|
if (contents != null) {
|
||||||
isNew = contents.length == 0;
|
isNew = contents.length == 0;
|
||||||
else if (site_path.isDirectory())
|
} else if (site_path.isDirectory()) {
|
||||||
throw new FileNotFoundException("Cannot access " + site_path);
|
throw new FileNotFoundException("Cannot access " + site_path);
|
||||||
else
|
} else {
|
||||||
throw new FileNotFoundException("Not a directory: " + site_path);
|
throw new FileNotFoundException("Not a directory: " + site_path);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
isNew = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,7 @@ import org.eclipse.jgit.lib.Config;
|
|||||||
*/
|
*/
|
||||||
public abstract class FieldDef<I, T> {
|
public abstract class FieldDef<I, T> {
|
||||||
/** Definition of a single (non-repeatable) field. */
|
/** Definition of a single (non-repeatable) field. */
|
||||||
public static abstract class Single<I, T> extends FieldDef<I, T> {
|
public abstract static class Single<I, T> extends FieldDef<I, T> {
|
||||||
Single(String name, FieldType<T> type, boolean stored) {
|
Single(String name, FieldType<T> type, boolean stored) {
|
||||||
super(name, type, stored);
|
super(name, type, stored);
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ public abstract class FieldDef<I, T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Definition of a repeatable field. */
|
/** Definition of a repeatable field. */
|
||||||
public static abstract class Repeatable<I, T>
|
public abstract static class Repeatable<I, T>
|
||||||
extends FieldDef<I, Iterable<T>> {
|
extends FieldDef<I, Iterable<T>> {
|
||||||
Repeatable(String name, FieldType<T> type, boolean stored) {
|
Repeatable(String name, FieldType<T> type, boolean stored) {
|
||||||
super(name, type, stored);
|
super(name, type, stored);
|
||||||
|
@@ -182,12 +182,12 @@ public abstract class AbstractChangeUpdate extends VersionedMetaData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Writes commit to a BatchMetaDataUpdate without committing the batch. */
|
/** Writes commit to a BatchMetaDataUpdate without committing the batch. */
|
||||||
abstract public void writeCommit(BatchMetaDataUpdate batch)
|
public abstract void writeCommit(BatchMetaDataUpdate batch)
|
||||||
throws OrmException, IOException;
|
throws OrmException, IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the NameKey for the project where the update will be stored,
|
* @return the NameKey for the project where the update will be stored,
|
||||||
* which is not necessarily the same as the change's project.
|
* which is not necessarily the same as the change's project.
|
||||||
*/
|
*/
|
||||||
abstract protected Project.NameKey getProjectName();
|
protected abstract Project.NameKey getProjectName();
|
||||||
}
|
}
|
||||||
|
@@ -220,7 +220,7 @@ public class ChangeRebuilder {
|
|||||||
&& event.psId.equals(update.getPatchSetId());
|
&& event.psId.equals(update.getPatchSetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class Event implements Comparable<Event> {
|
private abstract static class Event implements Comparable<Event> {
|
||||||
final PatchSet.Id psId;
|
final PatchSet.Id psId;
|
||||||
final Account.Id who;
|
final Account.Id who;
|
||||||
final Timestamp when;
|
final Timestamp when;
|
||||||
|
@@ -178,10 +178,11 @@ class IntraLineLoader extends CacheLoader<IntraLineDiffKey, IntraLineDiff> {
|
|||||||
int nb = lf + 1;
|
int nb = lf + 1;
|
||||||
int p = 0;
|
int p = 0;
|
||||||
while (p < ae - ab) {
|
while (p < ae - ab) {
|
||||||
if (cmp.equals(a, ab + p, a, ab + p))
|
if (cmp.equals(a, ab + p, a, ab + p)) {
|
||||||
p++;
|
p++;
|
||||||
else
|
} else {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (p == ae - ab) {
|
if (p == ae - ab) {
|
||||||
ab = nb;
|
ab = nb;
|
||||||
@@ -214,10 +215,11 @@ class IntraLineLoader extends CacheLoader<IntraLineDiffKey, IntraLineDiff> {
|
|||||||
int nb = lf + 1;
|
int nb = lf + 1;
|
||||||
int p = 0;
|
int p = 0;
|
||||||
while (p < be - bb) {
|
while (p < be - bb) {
|
||||||
if (cmp.equals(b, bb + p, b, bb + p))
|
if (cmp.equals(b, bb + p, b, bb + p)) {
|
||||||
p++;
|
p++;
|
||||||
else
|
} else {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (p == be - bb) {
|
if (p == be - bb) {
|
||||||
bb = nb;
|
bb = nb;
|
||||||
|
@@ -150,12 +150,13 @@ public class PatchList implements Serializable {
|
|||||||
while (low < high) {
|
while (low < high) {
|
||||||
final int mid = (low + high) >>> 1;
|
final int mid = (low + high) >>> 1;
|
||||||
final int cmp = patches[mid].getNewName().compareTo(fileName);
|
final int cmp = patches[mid].getNewName().compareTo(fileName);
|
||||||
if (cmp < 0)
|
if (cmp < 0) {
|
||||||
low = mid + 1;
|
low = mid + 1;
|
||||||
else if (cmp == 0)
|
} else if (cmp == 0) {
|
||||||
return mid;
|
return mid;
|
||||||
else
|
} else {
|
||||||
high = mid;
|
high = mid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return -(low + 1);
|
return -(low + 1);
|
||||||
}
|
}
|
||||||
|
@@ -264,7 +264,7 @@ public class JarScanner implements PluginContentScanner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class AbstractAnnotationVisitor extends
|
private abstract static class AbstractAnnotationVisitor extends
|
||||||
AnnotationVisitor {
|
AnnotationVisitor {
|
||||||
AbstractAnnotationVisitor() {
|
AbstractAnnotationVisitor() {
|
||||||
super(Opcodes.ASM4);
|
super(Opcodes.ASM4);
|
||||||
|
@@ -214,7 +214,7 @@ public class PluginLoader implements LifecycleListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized private void unloadPlugin(Plugin plugin) {
|
private synchronized void unloadPlugin(Plugin plugin) {
|
||||||
persistentCacheFactory.onStop(plugin);
|
persistentCacheFactory.onStop(plugin);
|
||||||
String name = plugin.getName();
|
String name = plugin.getName();
|
||||||
log.info(String.format("Unloading plugin %s", name));
|
log.info(String.format("Unloading plugin %s", name));
|
||||||
|
@@ -47,7 +47,7 @@ public class CommentLinkInfo {
|
|||||||
public final String html;
|
public final String html;
|
||||||
public final Boolean enabled; // null means true
|
public final Boolean enabled; // null means true
|
||||||
|
|
||||||
public transient final String name;
|
public final transient String name;
|
||||||
|
|
||||||
public CommentLinkInfo(String name, String match, String link, String html,
|
public CommentLinkInfo(String name, String match, String link, String html,
|
||||||
Boolean enabled) {
|
Boolean enabled) {
|
||||||
|
@@ -119,7 +119,7 @@ public class SectionSortCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@AutoValue
|
@AutoValue
|
||||||
static abstract class EntryKey {
|
abstract static class EntryKey {
|
||||||
public abstract String ref();
|
public abstract String ref();
|
||||||
public abstract List<String> patterns();
|
public abstract List<String> patterns();
|
||||||
public abstract int cachedHashCode();
|
public abstract int cachedHashCode();
|
||||||
|
@@ -92,8 +92,9 @@ public class AndPredicate<T> extends Predicate<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object other) {
|
public boolean equals(final Object other) {
|
||||||
if (other == null)
|
if (other == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return getClass() == other.getClass()
|
return getClass() == other.getClass()
|
||||||
&& getChildren().equals(((Predicate<?>) other).getChildren());
|
&& getChildren().equals(((Predicate<?>) other).getChildren());
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@ import com.google.inject.name.Named;
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ConflictsCacheImpl implements ConflictsCache {
|
public class ConflictsCacheImpl implements ConflictsCache {
|
||||||
public final static String NAME = "conflicts";
|
public static final String NAME = "conflicts";
|
||||||
|
|
||||||
public static Module module() {
|
public static Module module() {
|
||||||
return new CacheModule() {
|
return new CacheModule() {
|
||||||
|
@@ -137,8 +137,9 @@ public class BasicSerializationTest {
|
|||||||
private static void assertOutput(final byte[] expect,
|
private static void assertOutput(final byte[] expect,
|
||||||
final ByteArrayOutputStream out) {
|
final ByteArrayOutputStream out) {
|
||||||
final byte[] buf = out.toByteArray();
|
final byte[] buf = out.toByteArray();
|
||||||
for (int i = 0; i < expect.length; i++)
|
for (int i = 0; i < expect.length; i++) {
|
||||||
assertEquals(expect[i], buf[i]);
|
assertEquals(expect[i], buf[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static InputStream r(final byte[] buf) {
|
private static InputStream r(final byte[] buf) {
|
||||||
|
@@ -22,7 +22,7 @@ import java.util.List;
|
|||||||
public class TempFileUtil {
|
public class TempFileUtil {
|
||||||
private static List<File> allDirsCreated = new ArrayList<>();
|
private static List<File> allDirsCreated = new ArrayList<>();
|
||||||
|
|
||||||
public synchronized static File createTempDirectory() throws IOException {
|
public static synchronized File createTempDirectory() throws IOException {
|
||||||
File tmp = File.createTempFile("gerrit_test_", "").getCanonicalFile();
|
File tmp = File.createTempFile("gerrit_test_", "").getCanonicalFile();
|
||||||
if (!tmp.delete() || !tmp.mkdir()) {
|
if (!tmp.delete() || !tmp.mkdir()) {
|
||||||
throw new IOException("Cannot create " + tmp.getPath());
|
throw new IOException("Cannot create " + tmp.getPath());
|
||||||
|
@@ -253,7 +253,7 @@ class CommandFactoryProvider implements Provider<CommandFactory>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Split a command line into a string array. */
|
/** Split a command line into a string array. */
|
||||||
static public String[] split(String commandLine) {
|
public static String[] split(String commandLine) {
|
||||||
final List<String> list = new ArrayList<>();
|
final List<String> list = new ArrayList<>();
|
||||||
boolean inquote = false;
|
boolean inquote = false;
|
||||||
boolean inDblQuote = false;
|
boolean inDblQuote = false;
|
||||||
|
@@ -709,7 +709,7 @@ public class QueryShell {
|
|||||||
print(help.toString());
|
print(help.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static abstract class Function {
|
private abstract static class Function {
|
||||||
final String name;
|
final String name;
|
||||||
|
|
||||||
Function(final String name) {
|
Function(final String name) {
|
||||||
|
Reference in New Issue
Block a user