View Javadoc
1   package edu.jiangxin.apktoolbox.convert.protobuf.supervised;
2   
3   import com.google.protobuf.InvalidProtocolBufferException;
4   
5   import java.util.Objects;
6   
7   /**
8    * Unchecked wrapper for {@link InvalidProtocolBufferException}.
9    *
10   * @author Daniel Tischner {@literal <zabuza.dev@gmail.com>}
11   * @see InvalidProtocolBufferException
12   */
13  @SuppressWarnings("SerializableHasSerializationMethods")
14  final class UncheckedInvalidProtocolBufferException extends RuntimeException {
15  
16  	private static final long serialVersionUID = 4733167503348537421L;
17  
18  	/**
19  	 * Creates a new instance with given message and cause
20  	 *
21  	 * @param message The error message, can be null
22  	 * @param cause   The cause of the exception, not null
23  	 */
24  	UncheckedInvalidProtocolBufferException(final String message, final InvalidProtocolBufferException cause) {
25  		super(message, Objects.requireNonNull(cause));
26  	}
27  
28  	/**
29  	 * Creates a new instance with default error message
30  	 *
31  	 * @param cause The cause of the exception, not null
32  	 */
33  	UncheckedInvalidProtocolBufferException(final InvalidProtocolBufferException cause) {
34  		super(Objects.requireNonNull(cause));
35  	}
36  
37  	@Override
38  	public synchronized InvalidProtocolBufferException getCause() {
39  		return (InvalidProtocolBufferException) super.getCause();
40  	}
41  }