mirror of
https://github.com/google/nomulus.git
synced 2025-07-25 20:18:34 +02:00
Fix various Error Prone errors that were found by the FOSS build
Most common: - Unnecessary parentheses and operator precedence clarify (self-explanatory) - Reference equality--there were a few instances of using == or != improperly - Qualification of Builder (and similar) imports so that it's clear which type of Builder we're referring to - Marking some immutable classes with @Immutable since EP desires that all enums be deeply immutable - String.split() having "surprising behavior" ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=230971531
This commit is contained in:
parent
9cd37189c2
commit
3cf26ff9b6
52 changed files with 155 additions and 133 deletions
|
@ -91,7 +91,6 @@ import google.registry.model.registry.label.PremiumList.PremiumListRevision;
|
|||
import google.registry.model.registry.label.ReservedList;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.transfer.TransferData;
|
||||
import google.registry.model.transfer.TransferData.Builder;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import google.registry.tmch.LordnTaskUtils;
|
||||
import java.util.Arrays;
|
||||
|
@ -383,7 +382,8 @@ public class DatastoreHelper {
|
|||
registrar.asBuilder().setAllowedTlds(difference(registrar.getAllowedTlds(), tld)).build());
|
||||
}
|
||||
|
||||
private static Builder createTransferDataBuilder(DateTime requestTime, DateTime expirationTime) {
|
||||
private static TransferData.Builder createTransferDataBuilder(
|
||||
DateTime requestTime, DateTime expirationTime) {
|
||||
return new TransferData.Builder()
|
||||
.setTransferStatus(TransferStatus.PENDING)
|
||||
.setGainingClientId("NewRegistrar")
|
||||
|
@ -585,7 +585,8 @@ public class DatastoreHelper {
|
|||
} else {
|
||||
deleteResource(autorenewPollMessage);
|
||||
}
|
||||
Builder transferDataBuilder = createTransferDataBuilder(requestTime, expirationTime);
|
||||
TransferData.Builder transferDataBuilder =
|
||||
createTransferDataBuilder(requestTime, expirationTime);
|
||||
return persistResource(domain.asBuilder()
|
||||
.setPersistedCurrentSponsorClientId("TheRegistrar")
|
||||
.addStatusValue(StatusValue.PENDING_TRANSFER)
|
||||
|
|
|
@ -49,6 +49,11 @@ public final class FakeServletInputStream extends ServletInputStream {
|
|||
return input.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
return input.read(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
input.close();
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.google.appengine.tools.pipeline.impl.servlets.PipelineServlet;
|
|||
import com.google.appengine.tools.pipeline.impl.servlets.TaskHandler;
|
||||
import com.google.apphosting.api.ApiProxy;
|
||||
import com.google.common.base.CharMatcher;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
|
@ -224,11 +225,11 @@ public abstract class MapreduceTestCase<T> extends ShardableTestCase {
|
|||
throws UnsupportedEncodingException {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
String[] params = requestBody.split("&");
|
||||
Iterable<String> params = Splitter.on('&').split(requestBody);
|
||||
for (String param : params) {
|
||||
String[] pair = param.split("=");
|
||||
String name = pair[0];
|
||||
String value = URLDecoder.decode(pair[1], "UTF-8");
|
||||
List<String> pair = Splitter.on('=').splitToList(param);
|
||||
String name = pair.get(0);
|
||||
String value = URLDecoder.decode(pair.get(1), "UTF-8");
|
||||
if (result.containsKey(name)) {
|
||||
throw new IllegalArgumentException("Duplicate parameter: " + requestBody);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue