Replace FluentIterable with streams

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180005797
This commit is contained in:
guyben 2017-12-23 07:08:35 -08:00 committed by Ben McIlwain
parent 552ab12314
commit 3f7cd00882
13 changed files with 121 additions and 104 deletions

View file

@ -14,11 +14,10 @@
package google.registry.model.ofy;
import com.google.common.base.Joiner;
import com.google.common.collect.FluentIterable;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Objectify;
import google.registry.model.BackupGroupRoot;
import java.util.Arrays;
import java.util.Map;
import org.joda.time.DateTime;
@ -43,19 +42,19 @@ class TimestampInversionException extends RuntimeException {
private TimestampInversionException(DateTime transactionTime, String problem) {
super(
Joiner.on('\n')
.join(
String.format(
"Timestamp inversion between transaction time (%s) and %s",
transactionTime, problem),
getFileAndLine(
FluentIterable.from(new Exception().getStackTrace())
.firstMatch(
(StackTraceElement element) ->
!element
.getClassName()
.startsWith(Objectify.class.getPackage().getName())
&& !element.getClassName().startsWith(Ofy.class.getName()))
.get())));
String.format(
"Timestamp inversion between transaction time (%s) and %s\n%s",
transactionTime,
problem,
getFileAndLine(
Arrays.stream(new Exception().getStackTrace())
.filter(
element ->
!element
.getClassName()
.startsWith(Objectify.class.getPackage().getName())
&& !element.getClassName().startsWith(Ofy.class.getName()))
.findFirst()
.get())));
}
}