tx-control/tx-control-api/src/main/java/org/osgi/service/transaction/control/ScopedWorkException.java
public <A extends Throwable, B extends Throwable> RuntimeException asOneOf(
			Class<A> a, Class<B> b) throws A, B {
		Throwable t = getCause();

		if (t instanceof RuntimeException) {
			throw (RuntimeException) t;
		}

		possibleThrow(a, t);
		possibleThrow(b, t);

		throw new IllegalArgumentException(
				"The cause of this Exception is not an instance of "
						+ String.join(", ", a.getName(), b.getName()),
				this);
	}
/**
	 * Throws the cause of this Exception as a RuntimeException or one of the
	 * supplied Exception types.
	 * <p>
	 * Usage is of the form:
	 * 
	 * <pre>
	 * public void doStuff() throws IOException, ClassNotFoundException {
	 *     try {
	 *         ...
	 *     } catch (ScopedWorkException swe) {
	 *         throw swe.asOneOf(IOException.class, ClassNotFoundException.class);
	 *     }
	 * }
	 * </pre>
	 * 
	 * @param a
	 * @param b
	 * @return This method will always throw an exception
	 * @throws A
	 * @throws B
	 */
Throws the cause of this Exception as a RuntimeException or one of the
supplied Exception types.

Usage is of the form.




Throws the cause of this Exception as a RuntimeException or one of the supplied Exception types . Usage is of the form .
public <A extends Throwable, B extends Throwable> RuntimeException asOneOf(
			Class<A> a, Class<B> b) throws A, B {
		Throwable t = getCause();
		if (t instanceof RuntimeException) {
			throw (RuntimeException) t;
		}
		possibleThrow(a, t);
		possibleThrow(b, t);
		throw new IllegalArgumentException(
				"The cause of this Exception is not an instance of "
						+ String.join(", ", a.getName(), b.getName()),
				this);
	}
public < A extends Throwable , B extends Throwable > RuntimeException asOneOf ( Class < A > a , Class < B > b ) throws A , B { Throwable t = getCause ( ) ; if ( t instanceof RuntimeException ) { throw ( RuntimeException ) t ; } possibleThrow ( a , t ) ; possibleThrow ( b , t ) ; throw new IllegalArgumentException ( "The cause of this Exception is not an instance of " + String . join ( ", " , a . getName ( ) , b . getName ( ) ) , this ) ; }
Throws the cause of this Exception as a RuntimeException or one of the
 supplied Exception types.
Throws the cause of this Exception as a RuntimeException or one of the supplied Exception types .