question: @ SuppressWarnings ( "fallthrough" ) private String ent ( char flag ) throws Exception { char ch ; int idx = mBuffIdx + 1 ; Input inp = null ; String str = null ; mESt = 0x100 ; bappend ( '&' ) ; for ( short st = 0 ; st >= 0 ; ) { ch = ( mChIdx < mChLen ) ? mChars [ mChIdx ++ ] : getch ( ) ; switch ( st ) { case 0 : case 1 : switch ( chtyp ( ch ) ) { case 'd' : case '.' : case '-' : if ( st != 1 ) { panic ( FAULT ) ; } case 'a' : case 'A' : case '_' : case 'X' : bappend ( ch ) ; eappend ( ch ) ; st = 1 ; break ; case ':' : if ( mIsNSAware != false ) { panic ( FAULT ) ; } bappend ( ch ) ; eappend ( ch ) ; st = 1 ; break ; case ';' : if ( mESt < 0x100 ) { mBuffIdx = idx - 1 ; bappend ( mESt ) ; st = - 1 ; break ; } else if ( mPh == PH_DTD ) { bappend ( ';' ) ; st = - 1 ; break ; } str = new String ( mBuff , idx + 1 , mBuffIdx - idx ) ; inp = mEnt . get ( str ) ; mBuffIdx = idx - 1 ; if ( inp != null ) { if ( inp . chars == null ) { InputSource is = resolveEnt ( str , inp . pubid , inp . sysid ) ; if ( is != null ) { push ( new Input ( BUFFSIZE_READER ) ) ; setinp ( is ) ; mInp . pubid = inp . pubid ; mInp . sysid = inp . sysid ; str = null ; } else { if ( flag != 'x' ) { panic ( FAULT ) ; } } } else { push ( inp ) ; str = null ; } } else { if ( flag != 'x' ) { panic ( FAULT ) ; } } st = - 1 ; break ; case '#' : if ( st != 0 ) { panic ( FAULT ) ; } st = 2 ; break ; default : panic ( FAULT ) ; } break ; case 2 : switch ( chtyp ( ch ) ) { case 'd' : bappend ( ch ) ; break ; case ';' : try { int i = Integer . parseInt ( new String ( mBuff , idx + 1 , mBuffIdx - idx ) , 10 ) ; if ( i >= 0xffff ) { panic ( FAULT ) ; } ch = ( char ) i ; } catch ( NumberFormatException nfe ) { panic ( FAULT ) ; } mBuffIdx = idx - 1 ; if ( ch == ' ' || mInp . next != null ) { bappend ( ch , flag ) ; } else { bappend ( ch ) ; } st = - 1 ; break ; case 'a' : if ( ( mBuffIdx == idx ) && ( ch == 'x' ) ) { st = 3 ; break ; } default : panic ( FAULT ) ; } break ; case 3 : switch ( chtyp ( ch ) ) { case 'A' : case 'a' : case 'd' : bappend ( ch ) ; break ; case ';' : try { int i = Integer . parseInt ( new String ( mBuff , idx + 1 , mBuffIdx - idx ) , 16 ) ; if ( i >= 0xffff ) { panic ( FAULT ) ; } ch = ( char ) i ; } catch ( NumberFormatException nfe ) { panic ( FAULT ) ; } mBuffIdx = idx - 1 ; if ( ch == ' ' || mInp . next != null ) { bappend ( ch , flag ) ; } else { bappend ( ch ) ; } st = - 1 ; break ; default : panic ( FAULT ) ; } break ; default : panic ( FAULT ) ; } } return str ; }
target:  Resoves an entity. This method resolves built-in and character entity references. It is also reports external entities to the application.