package org.opendaylight.yangtools.yang.common;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import java.util.Arrays;
import java.util.List;
private static final long serialVersionUID = 1L;
- private final List<RpcError> errorList;
+ private final ImmutableList<RpcError> errorList;
/**
* Constructs a new instance with the specified detail message and errors.
*/
public OperationFailedException(final String message, final Throwable cause,
final RpcError... errors) {
- super(Preconditions.checkNotNull(message), cause);
+ super(requireNonNull(message), cause);
if (errors != null && errors.length > 0) {
- errorList = ImmutableList.<RpcError>copyOf( Arrays.asList( errors ) );
+ errorList = ImmutableList.copyOf(Arrays.asList(errors));
} else {
// Add a default RpcError.
errorList = ImmutableList.of(RpcResultBuilder.newError(ErrorType.APPLICATION, null,
@Override
public String toString() {
- return MoreObjects.toStringHelper( this ).add( "message", getMessage() )
- .add( "errorList", errorList ).toString();
+ return MoreObjects.toStringHelper(this).add("message", getMessage())
+ .add("errorList", errorList).toString();
}
}