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