lab/direct/TopicPublisher.java
private static void assertReturnCode(String operation, int returnCode, int... rc) throws IllegalStateException {
        boolean oneRCMatched = false;
        for (int i = 0; i < rc.length; i++) {
            if (rc[i] == returnCode) {
                oneRCMatched = true;
                break;
            }
        }
        if (!oneRCMatched) {
            throw new IllegalStateException(String.format("'%s' returned unexpected returnCode %d:%s", operation,
                    returnCode, SolEnum.ReturnCode.toString(returnCode)));
        }
    }
/**
     * Helper method to validate return codes.
     *
     * @param operation
     * @param returnCode
     * @param rc
     * @throws IllegalStateException
     */
Helper method to validate return codes.
Helper method to validate return codes .
private static void assertReturnCode(String operation, int returnCode, int... rc) throws IllegalStateException {
        boolean oneRCMatched = false;
        for (int i = 0; i < rc.length; i++) {
            if (rc[i] == returnCode) {
                oneRCMatched = true;
                break;
            }
        }
        if (!oneRCMatched) {
            throw new IllegalStateException(String.format("'%s' returned unexpected returnCode %d:%s", operation,
                    returnCode, SolEnum.ReturnCode.toString(returnCode)));
        }
    }
private static void assertReturnCode ( String operation , int returnCode , int ... rc ) throws IllegalStateException { boolean oneRCMatched = false ; for ( int i = 0 ; i < rc . length ; i ++ ) { if ( rc [ i ] == returnCode ) { oneRCMatched = true ; break ; } } if ( ! oneRCMatched ) { throw new IllegalStateException ( String . format ( "'%s' returned unexpected returnCode %d:%s" , operation , returnCode , SolEnum . ReturnCode . toString ( returnCode ) ) ) ; } }
Helper method to validate return codes.
Helper method to validate return codes .