TODO: write test, and also test for exception.
336533
public <E extends Model> LazyList<E> load() {
        if (hydrated()) { throw new DBException("load() must be the last on the chain of methods"); }
        hydrate();
        return (LazyList<E>) this;
    }
364029
public static void safelyIgnoreException(Throwable t)
    {
        if (t instanceof ThreadDeath)
        {
            throw (ThreadDeath) t;
        }

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

    }
786611
public void reportError(Throwable t) {
		// set the exception, if it is the first (and the exception is non null)
		if (t != null && exception.compareAndSet(null, t) && toInterrupt != null) {
			toInterrupt.interrupt();
		}
	}
1060071
@Override
    public void write(Void value, TProtocol protocol)
            throws Exception
    {
        Preconditions.checkNotNull(protocol, "protocol is null");
    }
1241803
public void setException(Throwable t) {
    if (err == null) {
      t.printStackTrace();
    } else {
      err.emit(t);
    }
  }
960134
@Override
    public void writeByteStream(InputStream is)
        throws IOException
    {
        while (true) {
            int len = SIZE - _offset - 3;

            if (len < 16) {
                flushBuffer();
                len = SIZE - _offset - 3;
            }

            len = is.read(_buffer, _offset + 3, len);

            if (len <= 0) {
                _buffer[_offset++] = BC_BINARY_DIRECT;
                return;
            }

            _buffer[_offset + 0] = (byte) BC_BINARY_CHUNK;
            _buffer[_offset + 1] = (byte) (len >> 8);
            _buffer[_offset + 2] = (byte) (len);

            _offset += len + 3;
        }
    }
246248
def exception(self, s):
        """"""
        self.error(s)
        type, value, tb = sys.exc_info()
        self.writelines(traceback.format_stack(), 1)
        self.writelines(traceback.format_tb(tb)[1:], 1)
        self.writelines(traceback.format_exception_only(type, value), 1)
788366
public static void throwException(Throwable t) {
        if (hasUnsafe()) {
            PlatformDependent0.throwException(t);
        } else {
            PlatformDependent.<RuntimeException>throwException0(t);
        }
    }
69983
public static void exception(Object o, TraceComponent tc, Exception e) {
    if(isTracing()) SibTr.exception(o, tc, e);

  }
1142557
def isexception(obj):
    
    if isinstance(obj, Exception):
        return True
    if isclass(obj) and issubclass(obj, Exception):
        return True
    return False
1087774
private void execute() throws Exception {
		if (result == null) {
			env.execute(executionName);
		} else {
			output.write(executionName.toString(), System.out, result);
		}

		System.out.println();
		algorithm.printAnalytics(System.out);

		if (jobDetailsPath.getValue() != null) {
			writeJobDetails(env, jobDetailsPath.getValue());
		}
	}
750172
void writeProcessingInstruction(final Writer output, final String name, final String value)
            throws SAXException {
        try {
            output.write(LESS_THAN);
            output.write(QUESTION);
            output.write(name);
            if (value != null) {
                output.write(STRING_BLANK);
                output.write(value);
            }
            output.write(QUESTION);
            output.write(GREATER_THAN);
        } catch (IOException e) {
            throw new SAXException(e);
        }
    }
686419
@Then("^an exception '(.+?)' thrown( with class '(.+?)'( and message like '(.+?)')?)?")
    public void assertExceptionNotThrown(String exception, String foo, String clazz, String bar, String exceptionMsg)
            throws ClassNotFoundException {
        List<Exception> exceptions = commonspec.getExceptions();
        if ("IS NOT".equals(exception)) {
            assertThat(exceptions).as("Captured exception list is not empty").isEmpty();
        } else {
            assertThat(exceptions).as("Captured exception list is empty").isNotEmpty();
            Exception ex = exceptions.get(exceptions.size() - 1);
            if ((clazz != null) && (exceptionMsg != null)) {
                assertThat(ex.toString()).as("Unexpected last exception class").contains(clazz);
                assertThat(ex.toString()).as("Unexpected last exception message").contains(exceptionMsg);

            } else if (clazz != null) {
                assertThat(exceptions.get(exceptions.size() - 1).getClass().getSimpleName()).as("Unexpected last exception class").isEqualTo(clazz);
            }

            commonspec.getExceptions().clear();
        }
    }
1179822
protected int checkWrite(int length) {
    checkWrite(position, length);
    int previousPosition = this.position;
    this.position = previousPosition + length;
    return offset(previousPosition);
  }
396728
@Private
  @Override
  public void threwException(final int taskletId, final Exception exception) {
    try {
      failedTasklets(exception, Collections.singletonList(taskletId));
    } catch (final InterruptedException e) {
      throw new RuntimeException(e);
    }
  }
437645
@Override
    public void write(int idx) throws IOException {
        try {
            beforeWrite(1);
            out.write(idx);
            afterWrite(1);
        } catch (IOException e) {
            handleIOException(e);
        }
    }
962101
def write(self, s, *args, **kwargs):
        """"""
        if args or kwargs:
            self.handle.write(s.format(*args, **kwargs))
        else:
            self.handle.write(s)