| 1 | package pro.verron.officestamper.api; | |
| 2 | ||
| 3 | import org.springframework.util.function.ThrowingFunction; | |
| 4 | ||
| 5 | import java.util.function.Function; | |
| 6 | import java.util.function.Supplier; | |
| 7 | ||
| 8 | /// OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown during the | |
| 9 | /// processing of an Office document using the OfficeStamper library. It provides additional constructors to handle | |
| 10 | /// different scenarios. | |
| 11 | public class OfficeStamperException | |
| 12 | extends RuntimeException { | |
| 13 | /// OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown during | |
| 14 | /// the processing of an Office document using the OfficeStamper library. | |
| 15 | /// | |
| 16 | /// @param message a message describing the error | |
| 17 | public OfficeStamperException(String message) { | |
| 18 | super(message); | |
| 19 | } | |
| 20 | ||
| 21 | /// OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown during | |
| 22 | /// the processing of an Office document using the OfficeStamper library. | |
| 23 | /// | |
| 24 | /// @param cause the cause of the exception | |
| 25 | public OfficeStamperException(Throwable cause) { | |
| 26 | super(cause); | |
| 27 | } | |
| 28 | ||
| 29 | /// OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown during | |
| 30 | /// the processing of an Office document using the OfficeStamper library. | |
| 31 | public OfficeStamperException() { | |
| 32 | super("Unexpected exception"); | |
| 33 | } | |
| 34 | ||
| 35 | /// Creates a supplier that returns a new instance of [OfficeStamperException] with the specified message. | |
| 36 | /// | |
| 37 | /// @param message the message describing the exception | |
| 38 | /// | |
| 39 | /// @return a supplier that provides a new [OfficeStamperException] instance | |
| 40 | public static Supplier<OfficeStamperException> throwing(String message) { | |
| 41 |
2
1. lambda$throwing$0 : replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::lambda$throwing$0 → NO_COVERAGE 2. throwing : replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::throwing → TIMED_OUT |
return () -> new OfficeStamperException(message); |
| 42 | } | |
| 43 | ||
| 44 | /// Wraps a ThrowingFunction into a standard Java Function, converting any checked exceptions thrown by the original | |
| 45 | /// function into an OfficeStamperException. | |
| 46 | /// | |
| 47 | /// @param <T> the type of the input to the function | |
| 48 | /// @param <U> the type of the result of the function | |
| 49 | /// @param function the throwing function to be wrapped | |
| 50 | /// | |
| 51 | /// @return a Function that wraps the specified ThrowingFunction and handles exceptions by throwing an | |
| 52 | /// OfficeStamperException | |
| 53 | public static <T, U> Function<T, U> throwing(ThrowingFunction<T, U> function) { | |
| 54 |
1
1. throwing : replaced return value with null for pro/verron/officestamper/api/OfficeStamperException::throwing → KILLED |
return ThrowingFunction.of(function, OfficeStamperException::new); |
| 55 | } | |
| 56 | ||
| 57 | /// OfficeStamperException is a subclass of RuntimeException that represents an exception that can be thrown during | |
| 58 | /// the processing of an Office document using the OfficeStamper library. | |
| 59 | /// | |
| 60 | /// @param message a message describing the error | |
| 61 | /// @param cause the cause of the exception | |
| 62 | public OfficeStamperException(String message, Throwable cause) { | |
| 63 | super(message, cause); | |
| 64 | } | |
| 65 | } | |
Mutations | ||
| 41 |
1.1 2.2 |
|
| 54 |
1.1 |