| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 
 | ## functions for some basic exception handling
# FIXME: should all these actually be deprecated or defunct
## poll for an exception
.jgetEx <- function(clear=FALSE) {
  exo <- .Call(RpollException)
  if (is.null(exo)) return(NULL)
  x <- new("jobjRef", jobj=exo, jclass="java/lang/Throwable")
  if (clear) .jclear()
  x
}
## explicitly clear any pending exceptions
.jclear <- function() {
  .C(RclearException)
  invisible(NULL)
}
## throw an exception
.jthrow <- function(exception, message=NULL) {
  if (is.character(exception))
    exception <- .jnew(exception, as.character(message))
  if (is(exception, "jobjRef"))
    .Call(RthrowException, exception)
  else
    stop("Invalid exception.")
}
"$.Throwable" <- function( x, name ){
	if( name %in% names(x) ){
		x[[ name ]]
	} else{
		._jobjRef_dollar( x[["jobj"]], name )
	}
}
"$<-.Throwable" <- function( x, name, value ){
	if( name %in% names(x) ){
		x[[ name ]] <- value
	} else{
		._jobjRef_dollargets( x[["jobj"]], name, value )
	}
	x
	
}
 |