/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch licenses this file to you 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 org.elasticsearch.indices.recovery;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.index.shard.ShardId;

import java.io.IOException;
import java.util.Objects;

public class RecoverFilesRecoveryException extends ElasticsearchException implements ElasticsearchWrapperException {

    private final int numberOfFiles;

    private final ByteSizeValue totalFilesSize;

    public RecoverFilesRecoveryException(ShardId shardId, int numberOfFiles, ByteSizeValue totalFilesSize, Throwable cause) {
        super("Failed to transfer [{}] files with total size of [{}]", cause, numberOfFiles, totalFilesSize);
        Objects.requireNonNull(totalFilesSize, "totalFilesSize must not be null");
        setShard(shardId);
        this.numberOfFiles = numberOfFiles;
        this.totalFilesSize = totalFilesSize;
    }

    public int numberOfFiles() {
        return numberOfFiles;
    }

    public ByteSizeValue totalFilesSize() {
        return totalFilesSize;
    }

    public RecoverFilesRecoveryException(StreamInput in) throws IOException{
        super(in);
        numberOfFiles = in.readInt();
        totalFilesSize = new ByteSizeValue(in);
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        super.writeTo(out);
        out.writeInt(numberOfFiles);
        totalFilesSize.writeTo(out);
    }
}

@@ -992,64 +992,8 @@
 ut;%0A
-import org.elasticsearch.common.io.stream.StreamOutput;%0A
 impo
@@ -1264,95 +1264,8 @@
  %7B%0A%0A
-    private final int numberOfFiles;%0A%0A    private final ByteSizeValue totalFilesSize;%0A%0A
     
@@ -1614,618 +1614,104 @@
     
-    this.numberOfFiles = numberOfFiles;%0A        this.totalFilesSize = totalFilesSize;%0A    %7D%0A%0A    public int numberOfFiles() %7B%0A        return numberOfFiles;%0A    %7D%0A%0A    public ByteSizeValue totalFilesSize() %7B%0A        return totalFilesSize;%0A    %7D%0A%0A    public RecoverFilesRecoveryException(StreamInput in) throws IOException%7B%0A        super(in);%0A        numberOfFiles = in.readInt();%0A        totalFilesSize = new ByteSizeValue(in);%0A    %7D%0A%0A    @Override%0A    public void writeTo(StreamOutput out) throws IOException %7B%0A        super.writeTo(out);%0A        out.writeInt(numberOfFiles);%0A        totalFilesSize.writeTo(out
+%7D%0A%0A    public RecoverFilesRecoveryException(StreamInput in) throws IOException%7B%0A        super(in
 );%0A 

Remove unused vars from RecoverFilesRecoveryException