signature:
public class TagLibraryInfoImpl { /** * Returns an array of TagLibraryInfo objects representing the entire set
 * of tag libraries ( including this TagLibraryInfo ) imported by taglib
 * directives in the translation unit that references this
 * TagLibraryInfo .
 * If a tag library is imported more than once and bound to different
 * prefices , only the TagLibraryInfo bound to the first prefix must be
 * included in the returned array .
 * @ return Array of TagLibraryInfo objects representing the entire set
 * of tag libraries ( including this TagLibraryInfo ) imported by taglib
 * directives in the translation unit that references this TagLibraryInfo .
 * @ since 2.1 */
public TagLibraryInfo [ ] getTagLibraryInfos ( ) { } }

implementation: TagLibraryInfo [ ] taglibs = null ; Collection < TagLibraryInfo > c = pageInfo . getTaglibs ( ) ; if ( c != null && c . size ( ) > 0 ) { taglibs = c . toArray ( new TagLibraryInfo [ 0 ] ) ; } return taglibs ;


signature:
public class TagLibraryInfoImpl { /** * @ param ctxt The JSP compilation context
 * @ param uri The TLD ' s uri
 * @ param in The TLD ' s input stream
 * @ param jarFileUrl The JAR file containing the TLD , or null if the tag
 * library is not packaged in a JAR */
private void parseTLD ( JspCompilationContext ctxt , String uri , InputStream in , URL jarFileUrl ) throws JasperException { } }

implementation:
List < TagInfo > tagVector = new ArrayList < TagInfo > ( ) ; List < TagFileInfo > tagFileVector = new ArrayList < TagFileInfo > ( ) ; HashMap < String , FunctionInfo > functionTable = new HashMap < String , FunctionInfo > ( ) ; // Create an iterator over the child elements of our < taglib > element
ParserUtils pu = new ParserUtils ( ) ; TreeNode tld = pu . parseXMLDocument ( uri , in ) ; // Check to see if the < taglib > root element contains a ' version '
// attribute , which was added in JSP 2.0 to replace the < jsp - version >
// subelement
this . jspversion = tld . findAttribute ( "version" ) ; // Process each child element of our < taglib > element
Iterator list = tld . findChildren ( ) ; while ( list . hasNext ( ) ) { TreeNode element = ( TreeNode ) list . next ( ) ; String tname = element . getName ( ) ; if ( "tlibversion" . equals ( tname ) // JSP 1.1
|| "tlib-version" . equals ( tname ) ) { // JSP 1.2
this . tlibversion = element . getBody ( ) ; } else if ( "jspversion" . equals ( tname ) || "jsp-version" . equals ( tname ) ) { this . jspversion = element . getBody ( ) ; } else if ( "shortname" . equals ( tname ) || "short-name" . equals ( tname ) ) this . shortname = element . getBody ( ) ; else if ( "uri" . equals ( tname ) ) this . urn = element . getBody ( ) ; else if ( "info" . equals ( tname ) || "description" . equals ( tname ) ) this . info = element . getBody ( ) ; else if ( "validator" . equals ( tname ) ) this . tagLibraryValidator = createValidator ( element ) ; else if ( "tag" . equals ( tname ) ) tagVector . add ( createTagInfo ( element , jspversion ) ) ; else if ( "tag-file" . equals ( tname ) ) { TagFileInfo tagFileInfo = createTagFileInfo ( element , uri , jarFileUrl ) ; tagFileVector . add ( tagFileInfo ) ; } else if ( "function" . equals ( tname ) ) { // JSP2.0
FunctionInfo funcInfo = createFunctionInfo ( element ) ; String funcName = funcInfo . getName ( ) ; if ( functionTable . containsKey ( funcName ) ) { err . jspError ( "jsp.error.tld.fn.duplicate.name" , funcName , uri ) ; } functionTable . put ( funcName , funcInfo ) ; } else if ( "display-name" . equals ( tname ) || // Ignored elements
"small-icon" . equals ( tname ) || "large-icon" . equals ( tname ) || "listener" . equals ( tname ) ) { ; } else if ( "taglib-extension" . equals ( tname ) ) { // Recognized but ignored
} else { err . jspError ( "jsp.error.unknown.element.in.taglib" , tname ) ; } } if ( tlibversion == null ) { err . jspError ( "jsp.error.tld.mandatory.element.missing" , "tlib-version" ) ; } if ( jspversion == null ) { err . jspError ( "jsp.error.tld.mandatory.element.missing" , "jsp-version" ) ; } this . tags = tagVector . toArray ( new TagInfo [ 0 ] ) ; this . tagFiles = tagFileVector . toArray ( new TagFileInfo [ 0 ] ) ; this . functions = new FunctionInfo [ functionTable . size ( ) ] ; int i = 0 ; for ( FunctionInfo funcInfo : functionTable . values ( ) ) { this . functions [ i ++ ] = funcInfo ; }


signature:
public class TagLibraryInfoImpl { /** * @ param uri The uri of the TLD
 * @ param ctxt The compilation context
 * @ return String array whose first element denotes the path to the TLD .
 * If the path to the TLD points to a jar file , then the second element
 * denotes the name of the TLD entry in the jar file , which is hardcoded
 * to META - INF / taglib . tld . */
private String [ ] generateTLDLocation ( String uri , JspCompilationContext ctxt ) throws JasperException { } }

implementation: int uriType = TldScanner . uriType ( uri ) ; if ( uriType == TldScanner . ABS_URI ) { err . jspError ( "jsp.error.taglibDirective.absUriCannotBeResolved" , uri ) ; } else if ( uriType == TldScanner . NOROOT_REL_URI ) { uri = ctxt . resolveRelativeUri ( uri ) ; } String [ ] location = new String [ 2 ] ; location [ 0 ] = uri ; if ( location [ 0 ] . endsWith ( "jar" ) ) { URL url = null ; try { url = ctxt . getResource ( location [ 0 ] ) ; } catch ( Exception ex ) { err . jspError ( "jsp.error.tld.unable_to_get_jar" , location [ 0 ] , ex . toString ( ) ) ; } if ( url == null ) { err . jspError ( "jsp.error.tld.missing_jar" , location [ 0 ] ) ; } location [ 0 ] = url . toString ( ) ; location [ 1 ] = "META-INF/taglib.tld" ; } return location ;


signature:
public class TagLibraryInfoImpl { /** * Parses the tag file directives of the given TagFile and turns them into
 * a TagInfo .
 * @ param elem The < tag - file > element in the TLD
 * @ param uri The location of the TLD , in case the tag file is specified
 * relative to it
 * @ param jarFile The JAR file , in case the tag file is packaged in a JAR
 * @ return TagInfo correspoding to tag file directives */
private TagFileInfo createTagFileInfo ( TreeNode elem , String uri , URL jarFileUrl ) throws JasperException { } }

implementation:
String name = null ; String path = null ; String description = null ; String displayName = null ; String icon = null ; boolean checkConflict = false ; Iterator list = elem . findChildren ( ) ; while ( list . hasNext ( ) ) { TreeNode child = ( TreeNode ) list . next ( ) ; String tname = child . getName ( ) ; if ( "name" . equals ( tname ) ) { name = child . getBody ( ) ; } else if ( "path" . equals ( tname ) ) { path = child . getBody ( ) ; } else if ( "description" . equals ( tname ) ) { checkConflict = true ; description = child . getBody ( ) ; } else if ( "display-name" . equals ( tname ) ) { checkConflict = true ; displayName = child . getBody ( ) ; } else if ( "icon" . equals ( tname ) ) { checkConflict = true ; icon = child . getBody ( ) ; } else if ( "example" . equals ( tname ) ) { // Ignore < example > element : Bugzilla 33538
} else if ( "tag-extension" . equals ( tname ) ) { // Ignore < tag - extension > element : Bugzilla 33538
} else { err . jspError ( "jsp.error.unknown.element.in.tagfile" , tname ) ; } } if ( path . startsWith ( "/META-INF/tags" ) ) { // Tag file packaged in JAR
// STARTJR : fix possible NPE
if ( jarFileUrl != null ) { ctxt . getTagFileJarUrls ( ) . put ( path , jarFileUrl ) ; } // ENDJR : fix possible NPE
} else if ( ! path . startsWith ( "/WEB-INF/tags" ) ) { err . jspError ( "jsp.error.tagfile.illegalPath" , path ) ; } JasperTagInfo tagInfo = ( JasperTagInfo ) TagFileProcessor . parseTagFileDirectives ( parserController , name , path , this ) ; if ( checkConflict ) { String tstring = tagInfo . getInfoString ( ) ; if ( tstring != null && ! "" . equals ( tstring ) ) { description = tstring ; } tstring = tagInfo . getDisplayName ( ) ; if ( tstring != null && ! "" . equals ( tstring ) ) { displayName = tstring ; } tstring = tagInfo . getSmallIcon ( ) ; if ( tstring != null && ! "" . equals ( tstring ) ) { icon = tstring ; } tagInfo = new JasperTagInfo ( tagInfo . getTagName ( ) , tagInfo . getTagClassName ( ) , tagInfo . getBodyContent ( ) , description , tagInfo . getTagLibrary ( ) , tagInfo . getTagExtraInfo ( ) , tagInfo . getAttributes ( ) , displayName , icon , tagInfo . getLargeIcon ( ) , tagInfo . getTagVariableInfos ( ) , tagInfo . getDynamicAttributesMapName ( ) ) ; } return new TagFileInfo ( name , path , tagInfo ) ;


signature:
public class TagLibraryInfoImpl { /** * Translation - time validation of the XML document
 * associated with the JSP page .
 * This is a convenience method on the associated
 * TagLibraryValidator class .
 * @ param thePage The JSP page object
 * @ return A string indicating whether the page is valid or not . */
public ValidationMessage [ ] validate ( PageData thePage ) { } }

implementation: TagLibraryValidator tlv = getTagLibraryValidator ( ) ; if ( tlv == null ) return null ; String uri = getURI ( ) ; if ( uri . startsWith ( "/" ) ) { uri = URN_JSPTLD + uri ; } ValidationMessage [ ] messages = tlv . validate ( getPrefixString ( ) , uri , thePage ) ; tlv . release ( ) ; return messages ;


signature:
public class Mark { /** * Sets this mark ' s state to a new stream .
 * It will store the current stream in it ' s includeStack .
 * @ param inStream new stream for mark
 * @ param inFileid id of new file from which stream comes from
 * @ param inBaseDir directory of file
 * @ param inEncoding encoding of new file */
public void pushStream ( char [ ] inStream , int inFileid , String name , String inBaseDir , String inEncoding ) { } }

implementation:
// store current state in stack
includeStack . push ( new IncludeState ( cursor , line , col , fileid , fileName , baseDir , encoding , stream ) ) ; // set new variables
cursor = 0 ; line = 1 ; col = 1 ; fileid = inFileid ; fileName = name ; baseDir = inBaseDir ; encoding = inEncoding ; stream = inStream ;


signature:
public class Mark { /** * / * Restores this mark ' s state to a previously stored stream .
 * @ return null if there is no previous stream
 * The previous Makr instance when the stream is pushed . */
public Mark popStream ( ) { } }

implementation:
// make sure we have something to pop
if ( includeStack . size ( ) <= 0 ) { return null ; } // get previous state in stack
IncludeState state = includeStack . pop ( ) ; // set new variables
cursor = state . cursor ; line = state . line ; col = state . col ; fileid = state . fileid ; fileName = state . fileName ; baseDir = state . baseDir ; stream = state . stream ; return this ;


signature:
public class XMLEncodingDetector { /** * Autodetects the encoding of the XML document supplied by the given
 * input stream .
 * Encoding autodetection is done according to the XML 1.0 specification ,
 * Appendix F . 1 : Detection Without External Encoding Information .
 * @ return Two - element array , where the first element ( of type
 * java . lang . String ) contains the name of the ( auto ) detected encoding , and
 * the second element ( of type java . lang . Boolean ) specifies whether the
 * encoding was specified using the ' encoding ' attribute of an XML prolog
 * ( TRUE ) or autodetected ( FALSE ) . */
public static Object [ ] getEncoding ( String fname , JarFile jarFile , JspCompilationContext ctxt , ErrorDispatcher err ) throws IOException , JasperException { } }

implementation: InputStream inStream = JspUtil . getInputStream ( fname , jarFile , ctxt , err ) ; XMLEncodingDetector detector = new XMLEncodingDetector ( ) ; Object [ ] ret = detector . getEncoding ( inStream , err ) ; inStream . close ( ) ; return ret ;


signature:
public class XMLEncodingDetector { /** * org . apache . xerces . impl . XMLEntityManager . startEntity ( ) */
private void createInitialReader ( ) throws IOException , JasperException { } }

implementation:
// wrap this stream in RewindableInputStream
stream = new RewindableInputStream ( stream ) ; // perform auto - detect of encoding if necessary
if ( encoding == null ) { // read first four bytes and determine encoding
final byte [ ] b4 = new byte [ 4 ] ; int count = 0 ; for ( ; count < 4 ; count ++ ) { b4 [ count ] = ( byte ) stream . read ( ) ; } if ( count == 4 ) { Object [ ] encodingDesc = getEncodingName ( b4 , count ) ; encoding = ( String ) ( encodingDesc [ 0 ] ) ; isBigEndian = ( Boolean ) ( encodingDesc [ 1 ] ) ; hasBom = ( Boolean ) ( encodingDesc [ 2 ] ) ; stream . reset ( ) ; // Special case UTF - 8 files with BOM created by Microsoft
// tools . It ' s more efficient to consume the BOM than make
// the reader perform extra checks . - Ac
if ( count > 2 && encoding . equals ( "UTF-8" ) ) { int b0 = b4 [ 0 ] & 0xFF ; int b1 = b4 [ 1 ] & 0xFF ; int b2 = b4 [ 2 ] & 0xFF ; if ( b0 == 0xEF && b1 == 0xBB && b2 == 0xBF ) { // ignore first three bytes . . .
stream . skip ( 3 ) ; } } reader = createReader ( stream , encoding , isBigEndian ) ; } else { reader = createReader ( stream , encoding , isBigEndian ) ; } }


signature:
public class XMLEncodingDetector { /** * Returns the IANA encoding name that is auto - detected from
 * the bytes specified , with the endian - ness of that encoding where
 * appropriate .
 * @ param b4 The first four bytes of the input .
 * @ param count The number of bytes actually read .
 * @ return a 2 - element array : the first element , an IANA - encoding string ,
 * the second element a Boolean which is true iff the document is big
 * endian , false if it ' s little - endian , and null if the distinction isn ' t
 * relevant . */
private Object [ ] getEncodingName ( byte [ ] b4 , int count ) { } }

implementation:
if ( count < 2 ) { return new Object [ ] { "UTF-8" , null , null } ; } // UTF - 16 , with BOM
int b0 = b4 [ 0 ] & 0xFF ; int b1 = b4 [ 1 ] & 0xFF ; if ( b0 == 0xFE && b1 == 0xFF ) { // UTF - 16 , big - endian , with a BOM
return new Object [ ] { "UTF-16BE" , Boolean . TRUE , Boolean . TRUE } ; } /* SJSAS 6307968
 if ( b0 = = 0xFF & & b1 = = 0xFE ) { */
// BEGIN SJSAS 6307968
if ( count == 2 && b0 == 0xFF && b1 == 0xFE ) { // END SJSAS 6307968
// UTF - 16 , little - endian , with a BOM
return new Object [ ] { "UTF-16LE" , Boolean . FALSE , Boolean . TRUE } ; } // default to UTF - 8 if we don ' t have enough bytes to make a
// good determination of the encoding
if ( count < 3 ) { return new Object [ ] { "UTF-8" , null , null } ; } // UTF - 8 with a BOM
int b2 = b4 [ 2 ] & 0xFF ; if ( b0 == 0xEF && b1 == 0xBB && b2 == 0xBF ) { return new Object [ ] { "UTF-8" , null , Boolean . TRUE } ; } // default to UTF - 8 if we don ' t have enough bytes to make a
// good determination of the encoding
if ( count < 4 ) { return new Object [ ] { "UTF-8" , null , null } ; } // other encodings
int b3 = b4 [ 3 ] & 0xFF ; if ( b0 == 0x00 && b1 == 0x00 && b2 == 0x00 && b3 == 0x3C ) { // UCS - 4 , big endian ( 1234)
return new Object [ ] { "ISO-10646-UCS-4" , Boolean . TRUE , null } ; } if ( b0 == 0x3C && b1 == 0x00 && b2 == 0x00 && b3 == 0x00 ) { // UCS - 4 , little endian ( 4321)
return new Object [ ] { "ISO-10646-UCS-4" , Boolean . FALSE , null } ; } if ( b0 == 0x00 && b1 == 0x00 && b2 == 0x3C && b3 == 0x00 ) { // UCS - 4 , unusual octet order ( 2143)
// REVISIT : What should this be ?
return new Object [ ] { "ISO-10646-UCS-4" , null , null } ; } if ( b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x00 ) { // UCS - 4 , unusual octect order ( 3412)
// REVISIT : What should this be ?
return new Object [ ] { "ISO-10646-UCS-4" , null , null } ; } if ( b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F ) { // UTF - 16 , big - endian , no BOM
// ( or could turn out to be UCS - 2 . . .
// REVISIT : What should this be ?
return new Object [ ] { "UTF-16BE" , Boolean . TRUE , null } ; } if ( b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00 ) { // UTF - 16 , little - endian , no BOM
// ( or could turn out to be UCS - 2 . . .
return new Object [ ] { "UTF-16LE" , Boolean . FALSE , null } ; } if ( b0 == 0x4C && b1 == 0x6F && b2 == 0xA7 && b3 == 0x94 ) { // EBCDIC
// a la xerces1 , return CP037 instead of EBCDIC here
return new Object [ ] { "CP037" , null , null } ; } if ( b0 == 0x00 && b1 == 0x00 && b2 == 0xFE && b3 == 0xFF ) { // UTF - 32 , big - endian , with a BOM
return new Object [ ] { "UTF-32BE" , Boolean . TRUE , Boolean . TRUE } ; } if ( b0 == 0xFF && b1 == 0xFE && b2 == 0x00 && b3 == 0x00 ) { // UTF - 32 , little - endian , with a BOM
return new Object [ ] { "UTF-32LE" , Boolean . FALSE , Boolean . TRUE } ; } // BEGIN SJSAS 6307968
if ( b0 == 0xFF && b1 == 0xFE ) { // UTF - 16 , little - endian , with a BOM
return new Object [ ] { "UTF-16LE" , Boolean . FALSE , Boolean . TRUE } ; } // END SJSAS 6307968
// default encoding
return new Object [ ] { "UTF-8" , null , null } ;


signature:
public class XMLEncodingDetector { /** * org . apache . xerces . impl . XMLDocumentScannerImpl . dispatch */
private void scanXMLDecl ( ) throws IOException , JasperException { } }

implementation:
if ( skipString ( "<?xml" ) ) { fMarkupDepth ++ ; // NOTE : special case where document starts with a PI
// whose name starts with " xml " ( e . g . " xmlfoo " )
if ( XMLChar . isName ( peekChar ( ) ) ) { fStringBuffer . clear ( ) ; fStringBuffer . append ( "xml" ) ; while ( XMLChar . isName ( peekChar ( ) ) ) { fStringBuffer . append ( ( char ) scanChar ( ) ) ; } String target = fSymbolTable . addSymbol ( fStringBuffer . ch , fStringBuffer . offset , fStringBuffer . length ) ; scanPIData ( target , fString ) ; } // standard XML declaration
else { scanXMLDeclOrTextDecl ( false ) ; } }


signature:
public class XMLEncodingDetector { /** * Scans an XML or text declaration .
 * < pre >
 * [ 23 ] XMLDecl : : = ' & lt ; ? xml ' VersionInfo EncodingDecl ? SDDecl ? S ? ' ? > '
 * [ 24 ] VersionInfo : : = S ' version ' Eq ( ' VersionNum ' | " VersionNum " )
 * [ 80 ] EncodingDecl : : = S ' encoding ' Eq ( ' " ' EncName ' " ' | " ' " EncName " ' " )
 * [ 81 ] EncName : : = [ A - Za - z ] ( [ A - Za - z0-9 . _ ] | ' - ' ) *
 * [ 32 ] SDDecl : : = S ' standalone ' Eq ( ( " ' " ( ' yes ' | ' no ' ) " ' " )
 * | ( ' " ' ( ' yes ' | ' no ' ) ' " ' ) )
 * [ 77 ] TextDecl : : = ' & lt ; ? xml ' VersionInfo ? EncodingDecl S ? ' ? > '
 * < / pre >
 * @ param scanningTextDecl True if a text declaration is to
 * be scanned instead of an XML
 * declaration . */
private void scanXMLDeclOrTextDecl ( boolean scanningTextDecl ) throws IOException , JasperException { } }

implementation:
// scan decl
scanXMLDeclOrTextDecl ( scanningTextDecl , fStrings ) ; fMarkupDepth -- ; // pseudo - attribute values
String encodingPseudoAttr = fStrings [ 1 ] ; // set encoding on reader
if ( encodingPseudoAttr != null ) { isEncodingSetInProlog = true ; encoding = encodingPseudoAttr ; }


signature:
public class XMLEncodingDetector { /** * Scans surrogates and append them to the specified buffer .
 * < strong > Note : < / strong > This assumes the current char has already been
 * identified as a high surrogate .
 * @ param buf The StringBuffer to append the read surrogates to .
 * @ returns True if it succeeded . */
private boolean scanSurrogates ( XMLStringBuffer buf ) throws IOException , JasperException { } }

implementation:
int high = scanChar ( ) ; int low = peekChar ( ) ; if ( ! XMLChar . isLowSurrogate ( low ) ) { err . jspError ( "jsp.error.xml.invalidCharInContent" , Integer . toString ( high , 16 ) ) ; return false ; } scanChar ( ) ; // convert surrogates to supplemental character
int c = XMLChar . supplemental ( ( char ) high , ( char ) low ) ; // supplemental character must be a valid XML character
if ( ! XMLChar . isValid ( c ) ) { err . jspError ( "jsp.error.xml.invalidCharInContent" , Integer . toString ( c , 16 ) ) ; return false ; } // fill in the buffer
buf . append ( ( char ) high ) ; buf . append ( ( char ) low ) ; return true ;


signature:
public class XMLEncodingDetector { /** * Convenience function used in all XML scanners . */
private void reportFatalError ( String msgId , String arg ) throws JasperException { } }

implementation: err . jspError ( msgId , arg ) ;


signature:
public class RepositoryLinks { /** * Create a set of default repository links
 * This method calls
 * { @ link # fillRepoLinks ( ChannelInformation , List , String , int , String , int , LinkTarget ) }
 * by using the baseName also as prefix and using a default
 * { @ code priorityOffset } of 10_000
 * @ param channel
 * the channel to generate for
 * @ param links
 * the receiver of the links
 * @ param baseName
 * the name of the top level menu entry
 * @ param basePriority
 * the priority of the top level menu entry
 * @ param linkTemplate
 * the template for generating the links , this template must
 * contain the path variable < code > { idOrName } < / code > */
public static void fillRepoLinks ( final ChannelInformation channel , final List < MenuEntry > links , final String baseName , final int basePriority , final LinkTarget linkTemplate ) { } }

implementation: fillRepoLinks ( channel , links , baseName , basePriority , baseName , 10_000 , linkTemplate ) ;


signature:
public class RepositoryLinks { /** * Create a set of default repository links
 * @ param channel
 * the channel to generate for
 * @ param links
 * the receiver of the links
 * @ param baseName
 * the name of the top level menu entry
 * @ param basePriority
 * the priority of the top level menu entry
 * @ param prefix
 * the prefix of the child menu entries
 * @ param priorityOffset
 * the base priority of the child menu entries
 * @ param linkTemplate
 * the template for generating the links , this template must
 * contain the path variable < code > { idOrName } < / code > */
public static void fillRepoLinks ( final ChannelInformation channel , final List < MenuEntry > links , final String baseName , final int basePriority , final String prefix , final int priorityOffset , final LinkTarget linkTemplate ) { } }

implementation: Objects . requireNonNull ( linkTemplate , "'linkTemplate' must not be null" ) ; fillRepoLinks ( channel , links , baseName , basePriority , prefix , priorityOffset , idOrName -> makeDefaultRepoLink ( linkTemplate , idOrName ) ) ;


signature:
public class RepositoryLinks { /** * Create a set of default repository links
 * @ param channel
 * the channel to generate for
 * @ param links
 * the receiver of the links
 * @ param baseName
 * the name of the top level menu entry
 * @ param basePriority
 * the priority of the top level menu entry
 * @ param prefix
 * the prefix of the child menu entries
 * @ param priorityOffset
 * the base priority of the child menu entries
 * @ param targetFunction
 * the function which provides a link target based on the id or
 * name of the channel . Returning a { @ code null } target will skip
 * this id or name from the list */
public static void fillRepoLinks ( final ChannelInformation channel , final List < MenuEntry > links , final String baseName , final int basePriority , final String prefix , final int priorityOffset , final Function < String , LinkTarget > targetFunction ) { } }

implementation: Objects . requireNonNull ( channel , "'channel' must not be null" ) ; Objects . requireNonNull ( links , "'links' must not be null" ) ; Objects . requireNonNull ( baseName , "'baseName' must not be null" ) ; Objects . requireNonNull ( prefix , "'prefix' must not be null" ) ; Objects . requireNonNull ( targetFunction , "'targetFunction' must not be null" ) ; links . add ( new MenuEntry ( baseName , basePriority , prefix + " (by ID)" , priorityOffset , targetFunction . apply ( channel . getId ( ) ) , Modifier . LINK , null ) ) ; int i = 1 ; for ( final String name : channel . getNames ( ) ) { final LinkTarget target = targetFunction . apply ( name ) ; if ( target != null ) { links . add ( new MenuEntry ( baseName , basePriority , String . format ( "%s (name: %s)" , prefix , name ) , priorityOffset + i , target , Modifier . LINK , null ) ) ; } i ++ ; }


signature:
public class JspCServletContext { /** * Return the real path for the specified context - relative
 * virtual path .
 * @ param path The context - relative virtual path to resolve */
public String getRealPath ( String path ) { } }

implementation: if ( ! myResourceBaseURL . getProtocol ( ) . equals ( "file" ) ) return ( null ) ; if ( ! path . startsWith ( "/" ) ) return ( null ) ; try { return ( getResource ( path ) . getFile ( ) . replace ( '/' , File . separatorChar ) ) ; } catch ( Throwable t ) { return ( null ) ; }


signature:
public class JspCServletContext { /** * Return a URL object of a resource that is mapped to the
 * specified context - relative path .
 * @ param path Context - relative path of the desired resource
 * @ exception MalformedURLException if the resource path is
 * not properly formed */
public URL getResource ( String path ) throws MalformedURLException { } }

implementation:
if ( ! path . startsWith ( "/" ) ) throw new MalformedURLException ( "Path '" + path + "' does not start with '/'" ) ; URL url = new URL ( myResourceBaseURL , path . substring ( 1 ) ) ; InputStream is = null ; try { is = url . openStream ( ) ; } catch ( Throwable t ) { url = null ; } finally { if ( is != null ) { try { is . close ( ) ; } catch ( Throwable t2 ) { // Ignore
} } } return url ;


signature:
public class JspCServletContext { /** * Return an InputStream allowing access to the resource at the
 * specified context - relative path .
 * @ param path Context - relative path of the desired resource */
public InputStream getResourceAsStream ( String path ) { } }

implementation: try { return ( getResource ( path ) . openStream ( ) ) ; } catch ( Throwable t ) { return ( null ) ; }


signature:
public class JspCServletContext { /** * Return the set of resource paths for the " directory " at the
 * specified context path .
 * @ param path Context - relative base path */
public Set < String > getResourcePaths ( String path ) { } }

implementation: Set < String > thePaths = new HashSet < String > ( ) ; if ( ! path . endsWith ( "/" ) ) path += "/" ; String basePath = getRealPath ( path ) ; if ( basePath == null ) return ( thePaths ) ; File theBaseDir = new File ( basePath ) ; if ( ! theBaseDir . exists ( ) || ! theBaseDir . isDirectory ( ) ) return ( thePaths ) ; String theFiles [ ] = theBaseDir . list ( ) ; for ( int i = 0 ; i < theFiles . length ; i ++ ) { File testFile = new File ( basePath + File . separator + theFiles [ i ] ) ; if ( testFile . isFile ( ) ) thePaths . add ( path + theFiles [ i ] ) ; else if ( testFile . isDirectory ( ) ) thePaths . add ( path + theFiles [ i ] + "/" ) ; } return ( thePaths ) ;


signature:
public class JspCServletContext { /** * Log the specified message and exception .
 * @ param message The message to be logged
 * @ param exception The exception to be logged */
public void log ( String message , Throwable exception ) { } }

implementation: myLogWriter . println ( message ) ; exception . printStackTrace ( myLogWriter ) ;


signature:
public class JspCServletContext { /** * Adds the servlet with the given name , description , class name ,
 * init parameters , and loadOnStartup , to this servlet context . */
public void addServlet ( String servletName , String description , String className , Map < String , String > initParameters , int loadOnStartup ) { } }

implementation:
// Do nothing
return ;


signature:
public class JspCServletContext { /** * Adds the filter with the given name , description , and class name to
 * this servlet context . */
public void addFilter ( String filterName , String description , String className , Map < String , String > initParameters ) { } }


signature:
public class XZOutputStream { /** * Updates the filter chain with a single filter .
 * This is equivalent to passing a single - member FilterOptions array
 * to < code > updateFilters ( FilterOptions [ ] ) < / code > .
 * @ param filterOptions
 * new filter to use
 * @ throws UnsupportedOptionsException
 * unsupported filter chain , or trying to change
 * the filter chain in the middle of a Block */
public void updateFilters ( FilterOptions filterOptions ) throws XZIOException { } }

implementation: FilterOptions [ ] opts = new FilterOptions [ 1 ] ; opts [ 0 ] = filterOptions ; updateFilters ( opts ) ;


signature:
public class XZOutputStream { /** * Updates the filter chain with 1-4 filters .
 * Currently this cannot be used to update e . g . LZMA2 options in the
 * middle of a XZ Block . Use < code > endBlock ( ) < / code > to finish the
 * current XZ Block before calling this function . The new filter chain
 * will then be used for the next XZ Block .
 * @ param filterOptions
 * new filter chain to use
 * @ throws UnsupportedOptionsException
 * unsupported filter chain , or trying to change
 * the filter chain in the middle of a Block */
public void updateFilters ( FilterOptions [ ] filterOptions ) throws XZIOException { } }

implementation: if ( blockEncoder != null ) throw new UnsupportedOptionsException ( "Changing filter options " + "in the middle of a XZ Block not implemented" ) ; if ( filterOptions . length < 1 || filterOptions . length > 4 ) throw new UnsupportedOptionsException ( "XZ filter chain must be 1-4 filters" ) ; filtersSupportFlushing = true ; FilterEncoder [ ] newFilters = new FilterEncoder [ filterOptions . length ] ; for ( int i = 0 ; i < filterOptions . length ; ++ i ) { newFilters [ i ] = filterOptions [ i ] . getFilterEncoder ( ) ; filtersSupportFlushing &= newFilters [ i ] . supportsFlushing ( ) ; } RawCoder . validate ( newFilters ) ; filters = newFilters ;


signature:
public class XZOutputStream { /** * Writes an array of bytes to be compressed .
 * The compressors tend to do internal buffering and thus the written
 * data won ' t be readable from the compressed output immediately .
 * Use < code > flush ( ) < / code > to force everything written so far to
 * be written to the underlaying output stream , but be aware that
 * flushing reduces compression ratio .
 * @ param buf buffer of bytes to be written
 * @ param off start offset in < code > buf < / code >
 * @ param len number of bytes to write
 * @ throws XZIOException
 * XZ Stream has grown too big : total file size
 * about 8 & nbsp ; EiB or the Index field exceeds
 * 16 & nbsp ; GiB ; you shouldn ' t reach these sizes
 * in practice
 * @ throws XZIOException
 * < code > finish ( ) < / code > or < code > close ( ) < / code >
 * was already called and len & gt ; 0
 * @ throws IOException may be thrown by the underlying output stream */
public void write ( byte [ ] buf , int off , int len ) throws IOException { } }

implementation: if ( off < 0 || len < 0 || off + len < 0 || off + len > buf . length ) throw new IndexOutOfBoundsException ( ) ; if ( exception != null ) throw exception ; if ( finished ) throw new XZIOException ( "Stream finished or closed" ) ; try { if ( blockEncoder == null ) blockEncoder = new BlockOutputStream ( out , filters , check , arrayCache ) ; blockEncoder . write ( buf , off , len ) ; } catch ( IOException e ) { exception = e ; throw e ; }


signature:
public class XZOutputStream { /** * Finishes the current XZ Block ( but not the whole XZ Stream ) .
 * This doesn ' t flush the stream so it ' s possible that not all data will
 * be decompressible from the output stream when this function returns .
 * Call also < code > flush ( ) < / code > if flushing is wanted in addition to
 * finishing the current XZ Block .
 * If there is no unfinished Block open , this function will do nothing .
 * ( No empty XZ Block will be created . )
 * This function can be useful , for example , to create
 * random - accessible . xz files .
 * Starting a new XZ Block means that the encoder state is reset .
 * Doing this very often will increase the size of the compressed
 * file a lot ( more than plain < code > flush ( ) < / code > would do ) .
 * @ throws XZIOException
 * XZ Stream has grown too big
 * @ throws XZIOException
 * stream finished or closed
 * @ throws IOException may be thrown by the underlying output stream */
public void endBlock ( ) throws IOException { } }

implementation:
if ( exception != null ) throw exception ; if ( finished ) throw new XZIOException ( "Stream finished or closed" ) ; // NOTE : Once there is threading with multiple Blocks , it ' s possible
// that this function will be more like a barrier that returns
// before the last Block has been finished .
if ( blockEncoder != null ) { try { blockEncoder . finish ( ) ; index . add ( blockEncoder . getUnpaddedSize ( ) , blockEncoder . getUncompressedSize ( ) ) ; blockEncoder = null ; } catch ( IOException e ) { exception = e ; throw e ; } }


signature:
public class XZOutputStream { /** * Flushes the encoder and calls < code > out . flush ( ) < / code > .
 * All buffered pending data will then be decompressible from
 * the output stream .
 * Calling this function very often may increase the compressed
 * file size a lot . The filter chain options may affect the size
 * increase too . For example , with LZMA2 the HC4 match finder has
 * smaller penalty with flushing than BT4.
 * Some filters don ' t support flushing . If the filter chain has
 * such a filter , < code > flush ( ) < / code > will call < code > endBlock ( ) < / code >
 * before flushing .
 * @ throws XZIOException
 * XZ Stream has grown too big
 * @ throws XZIOException
 * stream finished or closed
 * @ throws IOException may be thrown by the underlying output stream */
public void flush ( ) throws IOException { } }

implementation:
if ( exception != null ) throw exception ; if ( finished ) throw new XZIOException ( "Stream finished or closed" ) ; try { if ( blockEncoder != null ) { if ( filtersSupportFlushing ) { // This will eventually call out . flush ( ) so
// no need to do it here again .
blockEncoder . flush ( ) ; } else { endBlock ( ) ; out . flush ( ) ; } } else { out . flush ( ) ; } } catch ( IOException e ) { exception = e ; throw e ; }


signature:
public class XZOutputStream { /** * Finishes compression without closing the underlying stream .
 * No more data can be written to this stream after finishing
 * ( calling < code > write < / code > with an empty buffer is OK ) .
 * Repeated calls to < code > finish ( ) < / code > do nothing unless
 * an exception was thrown by this stream earlier . In that case
 * the same exception is thrown again .
 * After finishing , the stream may be closed normally with
 * < code > close ( ) < / code > . If the stream will be closed anyway , there
 * usually is no need to call < code > finish ( ) < / code > separately .
 * @ throws XZIOException
 * XZ Stream has grown too big
 * @ throws IOException may be thrown by the underlying output stream */
public void finish ( ) throws IOException { } }

implementation:
if ( ! finished ) { // This checks for pending exceptions so we don ' t need to
// worry about it here .
endBlock ( ) ; try { index . encode ( out ) ; encodeStreamFooter ( ) ; } catch ( IOException e ) { exception = e ; throw e ; } // Set it to true only if everything goes fine . Setting it earlier
// would cause repeated calls to finish ( ) do nothing instead of
// throwing an exception to indicate an earlier error .
finished = true ; }


signature:
public class XZOutputStream { /** * Finishes compression and closes the underlying stream .
 * The underlying stream < code > out < / code > is closed even if finishing
 * fails . If both finishing and closing fail , the exception thrown
 * by < code > finish ( ) < / code > is thrown and the exception from the failed
 * < code > out . close ( ) < / code > is lost .
 * @ throws XZIOException
 * XZ Stream has grown too big
 * @ throws IOException may be thrown by the underlying output stream */
public void close ( ) throws IOException { } }

implementation:
if ( out != null ) { // If finish ( ) throws an exception , it stores the exception to
// the variable " exception " . So we can ignore the possible
// exception here .
try { finish ( ) ; } catch ( IOException e ) { } try { out . close ( ) ; } catch ( IOException e ) { // Remember the exception but only if there is no previous
// pending exception .
if ( exception == null ) exception = e ; } out = null ; } if ( exception != null ) throw exception ;


signature:
public class LZEncoder { /** * Gets the size of the LZ window buffer that needs to be allocated . */
private static int getBufSize ( int dictSize , int extraSizeBefore , int extraSizeAfter , int matchLenMax ) { } }

implementation: int keepSizeBefore = extraSizeBefore + dictSize ; int keepSizeAfter = extraSizeAfter + matchLenMax ; int reserveSize = Math . min ( dictSize / 2 + ( 256 << 10 ) , 512 << 20 ) ; return keepSizeBefore + keepSizeAfter + reserveSize ;


signature:
public class LZEncoder { /** * Gets approximate memory usage of the LZEncoder base structure and
 * the match finder as kibibytes . */
public static int getMemoryUsage ( int dictSize , int extraSizeBefore , int extraSizeAfter , int matchLenMax , int mf ) { } }

implementation:
// Buffer size + a little extra
int m = getBufSize ( dictSize , extraSizeBefore , extraSizeAfter , matchLenMax ) / 1024 + 10 ; switch ( mf ) { case MF_HC4 : m += HC4 . getMemoryUsage ( dictSize ) ; break ; case MF_BT4 : m += BT4 . getMemoryUsage ( dictSize ) ; break ; default : throw new IllegalArgumentException ( ) ; } return m ;


signature:
public class LZEncoder { /** * Creates a new LZEncoder .
 * @ param dictSize dictionary size
 * @ param extraSizeBefore
 * number of bytes to keep available in the
 * history in addition to dictSize
 * @ param extraSizeAfter
 * number of bytes that must be available
 * after current position + matchLenMax
 * @ param niceLen if a match of at least < code > niceLen < / code >
 * bytes is found , be happy with it and don ' t
 * stop looking for longer matches
 * @ param matchLenMax don ' t test for matches longer than
 * < code > matchLenMax < / code > bytes
 * @ param mf match finder ID
 * @ param depthLimit match finder search depth limit */
public static LZEncoder getInstance ( int dictSize , int extraSizeBefore , int extraSizeAfter , int niceLen , int matchLenMax , int mf , int depthLimit , ArrayCache arrayCache ) { } }

implementation: switch ( mf ) { case MF_HC4 : return new HC4 ( dictSize , extraSizeBefore , extraSizeAfter , niceLen , matchLenMax , depthLimit , arrayCache ) ; case MF_BT4 : return new BT4 ( dictSize , extraSizeBefore , extraSizeAfter , niceLen , matchLenMax , depthLimit , arrayCache ) ; } throw new IllegalArgumentException ( ) ;


signature:
public class LZEncoder { /** * Sets a preset dictionary . If a preset dictionary is wanted , this
 * function must be called immediately after creating the LZEncoder
 * before any data has been encoded . */
public void setPresetDict ( int dictSize , byte [ ] presetDict ) { } }

implementation:
assert ! isStarted ( ) ; assert writePos == 0 ; if ( presetDict != null ) { // If the preset dictionary buffer is bigger than the dictionary
// size , copy only the tail of the preset dictionary .
int copySize = Math . min ( presetDict . length , dictSize ) ; int offset = presetDict . length - copySize ; System . arraycopy ( presetDict , offset , buf , 0 , copySize ) ; writePos += copySize ; skip ( copySize ) ; }


signature:
public class LZEncoder { /** * Moves data from the end of the buffer to the beginning , discarding
 * old data and making space for new input . */
private void moveWindow ( ) { } }

implementation:
// Align the move to a multiple of 16 bytes . LZMA2 needs this
// because it uses the lowest bits from readPos to get the
// alignment of the uncompressed data .
int moveOffset = ( readPos + 1 - keepSizeBefore ) & ~ 15 ; int moveSize = writePos - moveOffset ; System . arraycopy ( buf , moveOffset , buf , 0 , moveSize ) ; readPos -= moveOffset ; readLimit -= moveOffset ; writePos -= moveOffset ;


signature:
public class LZEncoder { /** * Copies new data into the LZEncoder ' s buffer . */
public int fillWindow ( byte [ ] in , int off , int len ) { } }

implementation:
assert ! finishing ; // Move the sliding window if needed .
if ( readPos >= bufSize - keepSizeAfter ) moveWindow ( ) ; // Try to fill the dictionary buffer . If it becomes full ,
// some of the input bytes may be left unused .
if ( len > bufSize - writePos ) len = bufSize - writePos ; System . arraycopy ( in , off , buf , writePos , len ) ; writePos += len ; // Set the new readLimit but only if there ' s enough data to allow
// encoding of at least one more byte .
if ( writePos >= keepSizeAfter ) readLimit = writePos - keepSizeAfter ; processPendingBytes ( ) ; // Tell the caller how much input we actually copied into
// the dictionary .
return len ;


signature:
public class LZEncoder { /** * Process pending bytes remaining from preset dictionary initialization
 * or encoder flush operation . */
private void processPendingBytes ( ) { } }

implementation:
// After flushing or setting a preset dictionary there will be
// pending data that hasn ' t been ran through the match finder yet .
// Run it through the match finder now if there is enough new data
// available ( readPos < readLimit ) that the encoder may encode at
// least one more input byte . This way we don ' t waste any time
// looping in the match finder ( and marking the same bytes as
// pending again ) if the application provides very little new data
// per write call .
if ( pendingSize > 0 && readPos < readLimit ) { readPos -= pendingSize ; int oldPendingSize = pendingSize ; pendingSize = 0 ; skip ( oldPendingSize ) ; assert pendingSize < oldPendingSize ; }


signature:
public class LZEncoder { /** * Get the length of a match at the given distance .
 * @ param dist zero - based distance of the match to test
 * @ param lenLimit don ' t test for a match longer than this
 * @ return length of the match ; it is in the range [ 0 , lenLimit ] */
public int getMatchLen ( int dist , int lenLimit ) { } }

implementation: int backPos = readPos - dist - 1 ; int len = 0 ; while ( len < lenLimit && buf [ readPos + len ] == buf [ backPos + len ] ) ++ len ; return len ;


signature:
public class LZEncoder { /** * Get the length of a match at the given distance and forward offset .
 * @ param forward forward offset
 * @ param dist zero - based distance of the match to test
 * @ param lenLimit don ' t test for a match longer than this
 * @ return length of the match ; it is in the range [ 0 , lenLimit ] */
public int getMatchLen ( int forward , int dist , int lenLimit ) { } }

implementation: int curPos = readPos + forward ; int backPos = curPos - dist - 1 ; int len = 0 ; while ( len < lenLimit && buf [ curPos + len ] == buf [ backPos + len ] ) ++ len ; return len ;


signature:
public class LZEncoder { /** * Verifies that the matches returned by the match finder are valid .
 * This is meant to be used in an assert statement . This is totally
 * useless for actual encoding since match finder ' s results should
 * naturally always be valid if it isn ' t broken .
 * @ param matches return value from < code > getMatches < / code >
 * @ return true if matches are valid , false if match finder is broken */
public boolean verifyMatches ( Matches matches ) { } }

implementation: int lenLimit = Math . min ( getAvail ( ) , matchLenMax ) ; for ( int i = 0 ; i < matches . count ; ++ i ) if ( getMatchLen ( matches . dist [ i ] , lenLimit ) != matches . len [ i ] ) return false ; return true ;


signature:
public class LZEncoder { /** * Moves to the next byte , checks if there is enough input available ,
 * and returns the amount of input available .
 * @ param requiredForFlushing
 * minimum number of available bytes when
 * flushing ; encoding may be continued with
 * new input after flushing
 * @ param requiredForFinishing
 * minimum number of available bytes when
 * finishing ; encoding must not be continued
 * after finishing or the match finder state
 * may be corrupt
 * @ return the number of bytes available or zero if there
 * is not enough input available */
int movePos ( int requiredForFlushing , int requiredForFinishing ) { } }

implementation: assert requiredForFlushing >= requiredForFinishing ; ++ readPos ; int avail = writePos - readPos ; if ( avail < requiredForFlushing ) { if ( avail < requiredForFinishing || ! finishing ) { ++ pendingSize ; avail = 0 ; } } return avail ;


signature:
public class JspWriterImpl { /** * Package - level access */
void recycle ( ) { } }

implementation: flushed = false ; closed = false ; out = null ; byteOut = null ; releaseCharBuffer ( ) ; response = null ;


signature:
public class JspWriterImpl { /** * Flush the output buffer to the underlying character stream , without
 * flushing the stream itself . This method is non - private only so that it
 * may be invoked by PrintStream . */
protected final void flushBuffer ( ) throws IOException { } }

implementation: if ( bufferSize == 0 ) return ; flushed = true ; ensureOpen ( ) ; if ( buf . pos == buf . offset ) return ; initOut ( ) ; out . write ( buf . buf , buf . offset , buf . pos - buf . offset ) ; buf . pos = buf . offset ;


signature:
public class JspWriterImpl { /** * Discard the output buffer . */
public final void clear ( ) throws IOException { } }

implementation:
if ( ( bufferSize == 0 ) && ( out != null ) ) // clear ( ) is illegal after any unbuffered output ( JSP . 5.5)
throw new IllegalStateException ( getLocalizeMessage ( "jsp.error.ise_on_clear" ) ) ; if ( flushed ) throw new IOException ( getLocalizeMessage ( "jsp.error.attempt_to_clear_flushed_buffer" ) ) ; ensureOpen ( ) ; if ( buf != null ) buf . pos = buf . offset ;


signature:
public class JspWriterImpl { /** * Flush the stream . */
public void flush ( ) throws IOException { } }

implementation:
flushBuffer ( ) ; if ( out != null ) { out . flush ( ) ; } // START 6426898
else { // Set the default character encoding if there isn ' t any present ,
// see CR 6699416
response . setCharacterEncoding ( response . getCharacterEncoding ( ) ) ; // Cause response headers to be sent
response . flushBuffer ( ) ; } // END 6426898


signature:
public class JspWriterImpl { /** * Close the stream . */
public void close ( ) throws IOException { } }

implementation:
if ( response == null || closed ) // multiple calls to close is OK
return ; flush ( ) ; if ( out != null ) out . close ( ) ; out = null ; byteOut = null ; closed = true ;


signature:
public class JspWriterImpl { /** * Attempt to write a String pre - encoded with the page encoding .
 * @ param bytesOK If true , write out the byte array ,
 * else , write out the String .
 * @ param buf The text encoded with the page encoding
 * @ param str The original text */
public void write ( boolean bytesOK , byte buf [ ] , String str ) throws IOException { } }

implementation: ensureOpen ( ) ; if ( bufferSize == 0 && bytesOK ) { initByteOut ( ) ; if ( implementsByteWriter ) { write ( buf , 0 , buf . length ) ; return ; } } write ( str ) ;


signature:
public class JspWriterImpl { /** * Write a single character . */
public void write ( int c ) throws IOException { } }

implementation: ensureOpen ( ) ; if ( bufferSize == 0 ) { initOut ( ) ; out . write ( c ) ; } else { if ( getRemaining ( ) == 0 ) if ( autoFlush ) flushBuffer ( ) ; else bufferOverflow ( ) ; buf . buf [ buf . pos ++ ] = ( char ) c ; }


signature:
public class JspWriterImpl { /** * Write a portion of an array of characters .
 * < p > Ordinarily this method stores characters from the given array into
 * this stream ' s buffer , flushing the buffer to the underlying stream as
 * needed . If the requested length is at least as large as the buffer ,
 * however , then this method will flush the buffer and write the characters
 * directly to the underlying stream . Thus redundant
 * < code > DiscardableBufferedWriter < / code > s will not copy data unnecessarily .
 * @ param cbuf A character array
 * @ param off Offset from which to start reading characters
 * @ param len Number of characters to write */
public void write ( char cbuf [ ] , int off , int len ) throws IOException { } }

implementation:
ensureOpen ( ) ; if ( bufferSize == 0 ) { initOut ( ) ; out . write ( cbuf , off , len ) ; return ; } if ( ( off < 0 ) || ( off > cbuf . length ) || ( len < 0 ) || ( ( off + len ) > cbuf . length ) || ( ( off + len ) < 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } else if ( len == 0 ) { return ; } if ( len >= bufferSize ) { /* If the request length exceeds the size of the output buffer ,
 flush the buffer and then write the data directly . In this
 way buffered streams will cascade harmlessly . */
if ( autoFlush ) flushBuffer ( ) ; else bufferOverflow ( ) ; initOut ( ) ; out . write ( cbuf , off , len ) ; return ; } int b = off , t = off + len ; while ( b < t ) { int d = min ( getRemaining ( ) , t - b ) ; System . arraycopy ( cbuf , b , buf . buf , buf . pos , d ) ; b += d ; buf . pos += d ; if ( getRemaining ( ) == 0 ) if ( autoFlush ) flushBuffer ( ) ; else bufferOverflow ( ) ; }


signature:
public class JspWriterImpl { /** * Write a portion of a String .
 * @ param s String to be written
 * @ param off Offset from which to start reading characters
 * @ param len Number of characters to be written */
public void write ( String s , int off , int len ) throws IOException { } }

implementation: ensureOpen ( ) ; if ( bufferSize == 0 ) { initOut ( ) ; out . write ( s , off , len ) ; return ; } int b = off , t = off + len ; while ( b < t ) { int d = min ( getRemaining ( ) , t - b ) ; s . getChars ( b , b + d , buf . buf , buf . pos ) ; b += d ; buf . pos += d ; if ( getRemaining ( ) == 0 ) if ( autoFlush ) flushBuffer ( ) ; else bufferOverflow ( ) ; }


signature:
public class JspWriterImpl { /** * END PWC 6512276 */
private void allocateCharBuffer ( ) { } }

implementation: if ( bufferSize == 0 ) return ; if ( bufferSize > MAX_BUFFER_SIZE ) { buf = new CharBuffer ( new char [ bufferSize ] , 0 , bufferSize ) ; } else { buf = getCharBufferThreadLocalPool ( ) . allocate ( bufferSize ) ; }


signature:
public class Locks { /** * Lock and return { @ link AutoCloseable } instance for unlocking
 * Use with a < tt > try - with - resources < / tt > construct :
 * < pre >
 * { @ code }
 * try ( Locked l = lock ( myLock ) ) {
 * / / locked " myLock "
 * < / pre >
 * @ param lock
 * the lock to lock
 * @ return the { @ link AutoCloseable } instance which unlocks the lock */
public static Locked lock ( final Lock lock ) { } }

implementation: lock . lock ( ) ; return new Locked ( ) { @ Override public void close ( ) { lock . unlock ( ) ; } } ;


signature:
public class DefaultErrorHandler { /** * Processes the given JSP parse error .
 * @ param fname Name of the JSP file in which the parse error occurred
 * @ param line Parse error line number
 * @ param column Parse error column number
 * @ param errMsg Parse error message
 * @ param exception Parse exception */
public void jspError ( String fname , int line , int column , String errMsg , Exception ex ) throws JasperException { } }

implementation: throw new JasperException ( fname + "(" + line + "," + column + ")" + " " + errMsg , ex ) ;


signature:
public class DefaultErrorHandler { /** * Processes the given javac compilation errors .
 * @ param details Array of JavacErrorDetail instances corresponding to the
 * compilation errors */
public void javacError ( JavacErrorDetail [ ] details ) throws JasperException { } }

implementation: if ( details == null ) { return ; } Object [ ] args = null ; StringBuilder buf = new StringBuilder ( ) ; for ( int i = 0 ; i < details . length ; i ++ ) { if ( details [ i ] . getJspBeginLineNumber ( ) >= 0 ) { args = new Object [ ] { Integer . valueOf ( details [ i ] . getJspBeginLineNumber ( ) ) , details [ i ] . getJspFileName ( ) } ; buf . append ( Localizer . getMessage ( "jsp.error.single.line.number" , args ) ) ; buf . append ( "\n" ) ; } buf . append ( Localizer . getMessage ( "jsp.error.corresponding.servlet" ) ) ; buf . append ( details [ i ] . getErrorMessage ( ) ) ; buf . append ( "\n\n" ) ; } if ( buf . length ( ) == 0 ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.nojdk" ) ) ; } throw new JasperException ( Localizer . getMessage ( "jsp.error.unable.compile" ) + "\n\n" + buf ) ;


signature:
public class DefaultErrorHandler { /** * Processes the given javac error report and exception .
 * @ param errorReport Compilation error report
 * @ param exception Compilation exception */
public void javacError ( String errorReport , Exception exception ) throws JasperException { } }

implementation: throw new JasperException ( Localizer . getMessage ( "jsp.error.unable.compile" ) , exception ) ;


signature:
public class ResettableArrayCache { /** * Puts all allocated arrays back to the underlying ArrayCache
 * that haven ' t already been put there with a call to
 * { @ code putArray } . */
public void reset ( ) { } }

implementation:
if ( byteArrays != null ) { // Put the arrays to the cache in reverse order : the array that
// was allocated first is returned last .
synchronized ( byteArrays ) { for ( int i = byteArrays . size ( ) - 1 ; i >= 0 ; -- i ) arrayCache . putArray ( byteArrays . get ( i ) ) ; byteArrays . clear ( ) ; } synchronized ( intArrays ) { for ( int i = intArrays . size ( ) - 1 ; i >= 0 ; -- i ) arrayCache . putArray ( intArrays . get ( i ) ) ; intArrays . clear ( ) ; } }


signature:
public class Localizer { /** * Returns the localized error message corresponding to the given error
 * code .
 * If the given error code is not defined in the resource bundle for
 * localized error messages , it is used as the error message .
 * @ param errCode Error code to localize
 * @ return Localized error message */
public static String getMessage ( String errCode ) { } }

implementation: String errMsg = errCode ; try { errMsg = bundle . getString ( errCode ) ; } catch ( MissingResourceException e ) { } return errMsg ;


signature:
public class Localizer { /** * Returns the localized error message corresponding to the given error
 * code .
 * If the given error code is not defined in the resource bundle for
 * localized error messages , it is used as the error message .
 * @ param errCode Error code to localize
 * @ param arg Argument for parametric replacement
 * @ return Localized error message */
public static String getMessage ( String errCode , String arg ) { } }

implementation: return getMessage ( errCode , new Object [ ] { arg } ) ;


signature:
public class Localizer { /** * Returns the localized error message corresponding to the given error
 * code .
 * If the given error code is not defined in the resource bundle for
 * localized error messages , it is used as the error message .
 * @ param errCode Error code to localize
 * @ param arg1 First argument for parametric replacement
 * @ param arg2 Second argument for parametric replacement
 * @ return Localized error message */
public static String getMessage ( String errCode , String arg1 , String arg2 ) { } }

implementation: return getMessage ( errCode , new Object [ ] { arg1 , arg2 } ) ;


signature:
public class Localizer { /** * Returns the localized error message corresponding to the given error
 * code .
 * If the given error code is not defined in the resource bundle for
 * localized error messages , it is used as the error message .
 * @ param errCode Error code to localize
 * @ param args Arguments for parametric replacement
 * @ return Localized error message */
public static String getMessage ( String errCode , Object [ ] args ) { } }

implementation: String errMsg = errCode ; try { errMsg = bundle . getString ( errCode ) ; if ( args != null ) { MessageFormat formatter = new MessageFormat ( errMsg ) ; errMsg = formatter . format ( args ) ; } } catch ( MissingResourceException e ) { } return errMsg ;


signature:
public class Aggregator { /** * Make a key from the aggregator fields
 * @ param metaData
 * the metadata to build the key from
 * @ param requireAll
 * if this is { @ code true } then all aggregator fields must be
 * present in the meta data map
 * @ return
 * the key or { @ code null } if { @ code requireAll } is { @ code true } and
 * at least one field is missing the provided { @ code metaData } */
public List < String > makeKey ( final Map < MetaKey , String > metaData , final boolean requireAll ) { } }

implementation: final List < String > result = new ArrayList < > ( this . fields . size ( ) ) ; for ( final MetaKey field : this . fields ) { final String value = metaData . get ( field ) ; if ( requireAll && value == null ) { return null ; } result . add ( value ) ; } return result ;


signature:
public class Compiler { /** * Compile the jsp file into equivalent servlet in java source */
private void generateJava ( ) throws Exception { } }

implementation:
long t1 , t2 , t3 , t4 ; t1 = t2 = t3 = t4 = 0 ; if ( log . isLoggable ( Level . FINE ) ) { t1 = System . currentTimeMillis ( ) ; } // Setup page info area
pageInfo = new PageInfo ( new BeanRepository ( ctxt . getClassLoader ( ) , errDispatcher ) , ctxt . getJspFile ( ) ) ; JspConfig jspConfig = options . getJspConfig ( ) ; JspProperty jspProperty = jspConfig . findJspProperty ( ctxt . getJspFile ( ) ) ; /* * If the current uri is matched by a pattern specified in
 * a jsp - property - group in web . xml , initialize pageInfo with
 * those properties . */
pageInfo . setELIgnored ( JspUtil . booleanValue ( jspProperty . isELIgnored ( ) ) ) ; pageInfo . setScriptingInvalid ( JspUtil . booleanValue ( jspProperty . isScriptingInvalid ( ) ) ) ; pageInfo . setTrimDirectiveWhitespaces ( JspUtil . booleanValue ( jspProperty . getTrimSpaces ( ) ) ) ; pageInfo . setDeferredSyntaxAllowedAsLiteral ( JspUtil . booleanValue ( jspProperty . getPoundAllowed ( ) ) ) ; pageInfo . setErrorOnUndeclaredNamespace ( JspUtil . booleanValue ( jspProperty . errorOnUndeclaredNamespace ( ) ) ) ; if ( jspProperty . getIncludePrelude ( ) != null ) { pageInfo . setIncludePrelude ( jspProperty . getIncludePrelude ( ) ) ; } if ( jspProperty . getIncludeCoda ( ) != null ) { pageInfo . setIncludeCoda ( jspProperty . getIncludeCoda ( ) ) ; } if ( options . isDefaultBufferNone ( ) && pageInfo . getBufferValue ( ) == null ) { // Set to unbuffered if not specified explicitly
pageInfo . setBuffer ( 0 ) ; } String javaFileName = ctxt . getServletJavaFileName ( ) ; ServletWriter writer = null ; try { // Setup the ServletWriter
Writer javaWriter = javaCompiler . getJavaWriter ( javaFileName , ctxt . getOptions ( ) . getJavaEncoding ( ) ) ; writer = new ServletWriter ( new PrintWriter ( javaWriter ) ) ; ctxt . setWriter ( writer ) ; // Reset the temporary variable counter for the generator .
JspUtil . resetTemporaryVariableName ( ) ; // Parse the file
ParserController parserCtl = new ParserController ( ctxt , this ) ; pageNodes = parserCtl . parse ( ctxt . getJspFile ( ) ) ; if ( ctxt . isPrototypeMode ( ) ) { // generate prototype . java file for the tag file
Generator . generate ( writer , this , pageNodes ) ; writer . close ( ) ; writer = null ; return ; } // Validate and process attributes
Validator . validate ( this , pageNodes ) ; if ( log . isLoggable ( Level . FINE ) ) { t2 = System . currentTimeMillis ( ) ; } // Collect page info
Collector . collect ( this , pageNodes ) ; // Compile ( if necessary ) and load the tag files referenced in
// this compilation unit .
tfp = new TagFileProcessor ( ) ; tfp . loadTagFiles ( this , pageNodes ) ; if ( log . isLoggable ( Level . FINE ) ) { t3 = System . currentTimeMillis ( ) ; } // Determine which custom tag needs to declare which scripting vars
ScriptingVariabler . set ( pageNodes , errDispatcher ) ; // Optimizations by Tag Plugins
TagPluginManager tagPluginManager = options . getTagPluginManager ( ) ; tagPluginManager . apply ( pageNodes , errDispatcher , pageInfo ) ; // Optimization : concatenate contiguous template texts .
TextOptimizer . concatenate ( this , pageNodes ) ; // Generate static function mapper codes .
ELFunctionMapper . map ( this , pageNodes ) ; // generate servlet . java file
Generator . generate ( writer , this , pageNodes ) ; writer . close ( ) ; writer = null ; // The writer is only used during the compile , dereference
// it in the JspCompilationContext when done to allow it
// to be GC ' d and save memory .
ctxt . setWriter ( null ) ; if ( log . isLoggable ( Level . FINE ) ) { t4 = System . currentTimeMillis ( ) ; log . fine ( "Generated " + javaFileName + " total=" + ( t4 - t1 ) + " generate=" + ( t4 - t3 ) + " validate=" + ( t2 - t1 ) ) ; } } catch ( Exception e ) { if ( writer != null ) { try { writer . close ( ) ; writer = null ; } catch ( Exception e1 ) { // do nothing
} } // Remove the generated . java file
javaCompiler . doJavaFile ( false ) ; throw e ; } finally { if ( writer != null ) { try { writer . close ( ) ; } catch ( Exception e2 ) { // do nothing
} } } // JSR45 Support
if ( ! options . isSmapSuppressed ( ) ) { smapUtil . generateSmap ( pageNodes ) ; } // If any proto type . java and . class files was generated ,
// the prototype . java may have been replaced by the current
// compilation ( if the tag file is self referencing ) , but the
// . class file need to be removed , to make sure that javac would
// generate . class again from the new . java file just generated .
tfp . removeProtoTypeFiles ( ctxt . getClassFileName ( ) ) ;


signature:
public class Compiler { /** * Compile the servlet from . java file to . class file */
private void generateClass ( ) throws FileNotFoundException , JasperException , Exception { } }

implementation:
long t1 = 0 ; if ( log . isLoggable ( Level . FINE ) ) { t1 = System . currentTimeMillis ( ) ; } String javaFileName = ctxt . getServletJavaFileName ( ) ; setJavaCompilerOptions ( ) ; // Start java compilation
JavacErrorDetail [ ] javacErrors = javaCompiler . compile ( ctxt . getFullClassName ( ) , pageNodes ) ; if ( javacErrors != null ) { // If there are errors , always generate java files to disk .
javaCompiler . doJavaFile ( true ) ; log . severe ( "Error compiling file: " + javaFileName ) ; errDispatcher . javacError ( javacErrors ) ; } if ( log . isLoggable ( Level . FINE ) ) { long t2 = System . currentTimeMillis ( ) ; log . fine ( "Compiled " + javaFileName + " " + ( t2 - t1 ) + "ms" ) ; } // Save or delete the generated Java files , depending on the
// value of " keepgenerated " attribute
javaCompiler . doJavaFile ( ctxt . keepGenerated ( ) ) ; // JSR45 Support
if ( ! ctxt . isPrototypeMode ( ) && ! options . isSmapSuppressed ( ) ) { smapUtil . installSmap ( ) ; } // START CR 6373479
if ( jsw != null && jsw . getServletClassLastModifiedTime ( ) <= 0 ) { jsw . setServletClassLastModifiedTime ( javaCompiler . getClassLastModified ( ) ) ; } // END CR 6373479
if ( options . getSaveBytecode ( ) ) { javaCompiler . saveClassFile ( ctxt . getFullClassName ( ) , ctxt . getClassFileName ( ) ) ; } // On some systems , due to file caching , the time stamp for the updated
// JSP file may actually be greater than that of the newly created byte
// codes in the cache . In such cases , adjust the cache time stamp to
// JSP page time , to avoid unnecessary recompilations .
ctxt . getRuntimeContext ( ) . adjustBytecodeTime ( ctxt . getFullClassName ( ) , jspModTime ) ;


signature:
public class Compiler { /** * Compile the jsp file from the current engine context . As an side -
 * effect , tag files that are referenced by this page are also compiled .
 * @ param compileClass If true , generate both . java and . class file
 * If false , generate only . java file */
public void compile ( boolean compileClass ) throws FileNotFoundException , JasperException , Exception { } }

implementation:
try { // Create the output directory for the generated files
// Always try and create the directory tree , in case the generated
// directories were deleted after the server was started .
ctxt . makeOutputDir ( ctxt . getOutputDir ( ) ) ; // If errDispatcher is nulled from a previous compilation of the
// same page , instantiate one here .
if ( errDispatcher == null ) { errDispatcher = new ErrorDispatcher ( jspcMode ) ; } generateJava ( ) ; if ( compileClass ) { generateClass ( ) ; } else { // If called from jspc to only compile to . java files ,
// make sure that . java files are written to disk .
javaCompiler . doJavaFile ( ctxt . keepGenerated ( ) ) ; } } finally { if ( tfp != null ) { tfp . removeProtoTypeFiles ( null ) ; } javaCompiler . release ( ) ; // Make sure these object which are only used during the
// generation and compilation of the JSP page get
// dereferenced so that they can be GC ' d and reduce the
// memory footprint .
tfp = null ; errDispatcher = null ; if ( ! jspcMode ) { pageInfo = null ; } pageNodes = null ; if ( ctxt . getWriter ( ) != null ) { ctxt . getWriter ( ) . close ( ) ; ctxt . setWriter ( null ) ; } }


signature:
public class Compiler { /** * Determine if a compilation is necessary by checking the time stamp
 * of the JSP page with that of the corresponding . class or . java file .
 * If the page has dependencies , the check is also extended to its
 * dependeants , and so on .
 * This method can by overidden by a subclasses of Compiler .
 * @ param checkClass If true , check against . class file ,
 * if false , check against . java file . */
public boolean isOutDated ( boolean checkClass ) { } }

implementation:
String jsp = ctxt . getJspFile ( ) ; if ( jsw != null && ( ctxt . getOptions ( ) . getModificationTestInterval ( ) > 0 ) ) { if ( jsw . getLastModificationTest ( ) + ( ctxt . getOptions ( ) . getModificationTestInterval ( ) * 1000 ) > System . currentTimeMillis ( ) ) { return false ; } else { jsw . setLastModificationTest ( System . currentTimeMillis ( ) ) ; } } long jspRealLastModified = 0 ; // START PWC 6468930
File targetFile ; if ( checkClass ) { targetFile = new File ( ctxt . getClassFileName ( ) ) ; } else { targetFile = new File ( ctxt . getServletJavaFileName ( ) ) ; } // Get the target file ' s last modified time . File . lastModified ( )
// returns 0 if the file does not exist .
long targetLastModified = targetFile . lastModified ( ) ; // Check cached class file
if ( checkClass ) { JspRuntimeContext rtctxt = ctxt . getRuntimeContext ( ) ; String className = ctxt . getFullClassName ( ) ; long cachedTime = rtctxt . getBytecodeBirthTime ( className ) ; if ( cachedTime > targetLastModified ) { targetLastModified = cachedTime ; } else { // Remove from cache , since the bytecodes from the file is more
// current , so that JasperLoader won ' t load the cached version
rtctxt . setBytecode ( className , null ) ; } } if ( targetLastModified == 0L ) return true ; // Check if the jsp exists in the filesystem ( instead of a jar
// or a remote location ) . If yes , then do a File . lastModified ( )
// to determine its last modified time . This is more performant
// ( fewer stat calls ) than the ctxt . getResource ( ) followed by
// openConnection ( ) . However , it only works for file system jsps .
// If the file has indeed changed , then need to call URL . OpenConnection ( )
// so that the cache loads the latest jsp file
if ( jsw != null ) { File jspFile = jsw . getJspFile ( ) ; if ( jspFile != null ) { jspRealLastModified = jspFile . lastModified ( ) ; } } if ( jspRealLastModified == 0 || targetLastModified < jspRealLastModified ) { // END PWC 6468930
try { URL jspUrl = ctxt . getResource ( jsp ) ; if ( jspUrl == null ) { ctxt . incrementRemoved ( ) ; return false ; } URLConnection uc = jspUrl . openConnection ( ) ; if ( uc instanceof JarURLConnection ) { jspRealLastModified = ( ( JarURLConnection ) uc ) . getJarEntry ( ) . getTime ( ) ; } else { jspRealLastModified = uc . getLastModified ( ) ; } uc . getInputStream ( ) . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return true ; } // START PWC 6468930
} // END PWC 6468930
/* PWC 6468930
 long targetLastModified = 0;
 File targetFile ;
 if ( checkClass ) {
 targetFile = new File ( ctxt . getClassFileName ( ) ) ;
 } else {
 targetFile = new File ( ctxt . getServletJavaFileName ( ) ) ;
 if ( ! targetFile . exists ( ) ) {
 return true ;
 targetLastModified = targetFile . lastModified ( ) ; */
if ( checkClass && jsw != null ) { jsw . setServletClassLastModifiedTime ( targetLastModified ) ; } if ( targetLastModified < jspRealLastModified ) { // Remember JSP mod time
jspModTime = jspRealLastModified ; if ( log . isLoggable ( Level . FINE ) ) { log . fine ( "Compiler: outdated: " + targetFile + " " + targetLastModified ) ; } return true ; } // determine if source dependent files ( e . g . includes using include
// directives ) have been changed .
if ( jsw == null ) { return false ; } List < String > depends = jsw . getDependants ( ) ; if ( depends == null ) { return false ; } for ( String include : depends ) { try { URL includeUrl = ctxt . getResource ( include ) ; if ( includeUrl == null ) { return true ; } URLConnection includeUconn = includeUrl . openConnection ( ) ; long includeLastModified = 0 ; if ( includeUconn instanceof JarURLConnection ) { includeLastModified = ( ( JarURLConnection ) includeUconn ) . getJarEntry ( ) . getTime ( ) ; } else { includeLastModified = includeUconn . getLastModified ( ) ; } includeUconn . getInputStream ( ) . close ( ) ; if ( includeLastModified > targetLastModified ) { // START GlassFish 750
if ( include . endsWith ( ".tld" ) ) { ctxt . clearTaglibs ( ) ; ctxt . clearTagFileJarUrls ( ) ; } // END GlassFish 750
return true ; } } catch ( Exception e ) { e . printStackTrace ( ) ; return true ; } } return false ;


signature:
public class Compiler { /** * Remove generated files */
public void removeGeneratedFiles ( ) { } }

implementation:
try { String classFileName = ctxt . getClassFileName ( ) ; if ( classFileName != null ) { File classFile = new File ( classFileName ) ; if ( log . isLoggable ( Level . FINE ) ) log . fine ( "Deleting " + classFile ) ; classFile . delete ( ) ; } } catch ( Exception e ) { // Remove as much as possible , ignore possible exceptions
} try { String javaFileName = ctxt . getServletJavaFileName ( ) ; if ( javaFileName != null ) { File javaFile = new File ( javaFileName ) ; if ( log . isLoggable ( Level . FINE ) ) log . fine ( "Deleting " + javaFile ) ; javaFile . delete ( ) ; } } catch ( Exception e ) { // Remove as much as possible , ignore possible exceptions
}


signature:
public class Compiler { /** * Get an instance of JavaCompiler .
 * If Running with JDK 6 , use a Jsr199JavaCompiler that supports JSR199,
 * else if eclipse ' s JDT compiler is available , use that .
 * The default is to use javac from ant . */
private void initJavaCompiler ( ) throws JasperException { } }

implementation:
boolean disablejsr199 = Boolean . TRUE . toString ( ) . equals ( System . getProperty ( "org.apache.jasper.compiler.disablejsr199" ) ) ; Double version = Double . valueOf ( System . getProperty ( "java.specification.version" ) ) ; if ( ! disablejsr199 && ( version >= 1.6 || getClassFor ( "javax.tools.Tool" ) != null ) ) { // JDK 6 or bundled with jsr199 compiler
javaCompiler = new Jsr199JavaCompiler ( ) ; } else { Class c = getClassFor ( "org.eclipse.jdt.internal.compiler.Compiler" ) ; if ( c != null ) { c = getClassFor ( "org.apache.jasper.compiler.JDTJavaCompiler" ) ; if ( c != null ) { try { javaCompiler = ( JavaCompiler ) c . newInstance ( ) ; } catch ( Exception ex ) { } } } } if ( javaCompiler == null ) { Class c = getClassFor ( "org.apache.tools.ant.taskdefs.Javac" ) ; if ( c != null ) { c = getClassFor ( "org.apache.jasper.compiler.AntJavaCompiler" ) ; if ( c != null ) { try { javaCompiler = ( JavaCompiler ) c . newInstance ( ) ; } catch ( Exception ex ) { } } } } if ( javaCompiler == null ) { errDispatcher . jspError ( "jsp.error.nojavac" ) ; } javaCompiler . init ( ctxt , errDispatcher , jspcMode ) ;


signature:
public class Compiler { /** * Return true if the path refers to a jar file in WEB - INF and is a
 * system jar . */
private boolean systemJarInWebinf ( String path ) { } }

implementation: if ( path . indexOf ( "/WEB-INF/" ) < 0 ) { return false ; } Boolean useMyFaces = ( Boolean ) ctxt . getServletContext ( ) . getAttribute ( "com.sun.faces.useMyFaces" ) ; if ( useMyFaces == null || ! useMyFaces ) { for ( String jar : systemJsfJars ) { if ( path . indexOf ( jar ) > 0 ) { return true ; } } } for ( String jar : systemJars ) { if ( path . indexOf ( jar ) > 0 ) { return true ; } } return false ;


signature:
public class DeltaInputStream { /** * Decode into an array of bytes .
 * This calls < code > in . read ( buf , off , len ) < / code > and defilters the
 * returned data .
 * @ param buf target buffer for decoded data
 * @ param off start offset in < code > buf < / code >
 * @ param len maximum number of bytes to read
 * @ return number of bytes read , or < code > - 1 < / code > to indicate
 * the end of the input stream < code > in < / code >
 * @ throws XZIOException if the stream has been closed
 * @ throws IOException may be thrown by underlaying input
 * stream < code > in < / code > */
public int read ( byte [ ] buf , int off , int len ) throws IOException { } }

implementation: if ( len == 0 ) return 0 ; if ( in == null ) throw new XZIOException ( "Stream closed" ) ; if ( exception != null ) throw exception ; int size ; try { size = in . read ( buf , off , len ) ; } catch ( IOException e ) { exception = e ; throw e ; } if ( size == - 1 ) return - 1 ; delta . decode ( buf , off , size ) ; return size ;


signature:
public class DeltaInputStream { /** * Calls < code > in . available ( ) < / code > .
 * @ return the value returned by < code > in . available ( ) < / code > */
public int available ( ) throws IOException { } }

implementation: if ( in == null ) throw new XZIOException ( "Stream closed" ) ; if ( exception != null ) throw exception ; return in . available ( ) ;


signature:
public class Generator { /** * Single quote and escape a character */
static String quote ( char c ) { } }

implementation: StringBuilder b = new StringBuilder ( ) ; b . append ( '\'' ) ; if ( c == '\'' ) b . append ( '\\' ) . append ( '\'' ) ; else if ( c == '\\' ) b . append ( '\\' ) . append ( '\\' ) ; else if ( c == '\n' ) b . append ( '\\' ) . append ( 'n' ) ; else if ( c == '\r' ) b . append ( '\\' ) . append ( 'r' ) ; else b . append ( c ) ; b . append ( '\'' ) ; return b . toString ( ) ;


signature:
public class Generator { /** * Generates declarations . This includes " info " of the page directive ,
 * and scriptlet declarations . */
private void generateDeclarations ( Node . Nodes page ) throws JasperException { } }

implementation:
class DeclarationVisitor extends Node . Visitor { private boolean getServletInfoGenerated = false ; /* * Generates getServletInfo ( ) method that returns the value of the
 * page directive ' s ' info ' attribute , if present .
 * The Validator has already ensured that if the translation unit
 * contains more than one page directive with an ' info ' attribute ,
 * their values match . */
public void visit ( Node . PageDirective n ) throws JasperException { if ( getServletInfoGenerated ) { return ; } String info = n . getAttributeValue ( "info" ) ; if ( info == null ) return ; getServletInfoGenerated = true ; out . printil ( "public String getServletInfo() {" ) ; out . pushIndent ( ) ; out . printin ( "return " ) ; out . print ( quote ( info ) ) ; out . println ( ";" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ; } public void visit ( Node . Declaration n ) throws JasperException { n . setBeginJavaLine ( out . getJavaLine ( ) ) ; out . printMultiLn ( n . getText ( ) ) ; out . println ( ) ; n . setEndJavaLine ( out . getJavaLine ( ) ) ; } // Custom Tags may contain declarations from tag plugins .
public void visit ( Node . CustomTag n ) throws JasperException { if ( n . useTagPlugin ( ) ) { if ( n . getAtSTag ( ) != null ) { n . getAtSTag ( ) . visit ( this ) ; } visitBody ( n ) ; if ( n . getAtETag ( ) != null ) { n . getAtETag ( ) . visit ( this ) ; } } else { visitBody ( n ) ; } } } out . println ( ) ; page . visit ( new DeclarationVisitor ( ) ) ;


signature:
public class Generator { /** * Compiles list of tag handler pool names . */
private void compileTagHandlerPoolList ( Node . Nodes page ) throws JasperException { } }

implementation:
class TagHandlerPoolVisitor extends Node . Visitor { private Set < String > names = new HashSet < String > ( ) ; /* * Constructor
 * @ param v Set of tag handler pool names to populate */
TagHandlerPoolVisitor ( Set < String > v ) { names = v ; } /* * Gets the name of the tag handler pool for the given custom tag
 * and adds it to the list of tag handler pool names unless it is
 * already contained in it . */
public void visit ( Node . CustomTag n ) throws JasperException { if ( ! n . implementsSimpleTag ( ) ) { String name = createTagHandlerPoolName ( n . getPrefix ( ) , n . getLocalName ( ) , n . getAttributes ( ) , n . hasEmptyBody ( ) ) ; n . setTagHandlerPoolName ( name ) ; if ( ! names . contains ( name ) ) { names . add ( name ) ; } } visitBody ( n ) ; } /* * Creates the name of the tag handler pool whose tag handlers may
 * be ( re ) used to service this action .
 * @ return The name of the tag handler pool */
private String createTagHandlerPoolName ( String prefix , String shortName , Attributes attrs , boolean hasEmptyBody ) { String poolName = null ; poolName = "_jspx_tagPool_" + prefix + "_" + shortName ; if ( attrs != null ) { String [ ] attrNames = new String [ attrs . getLength ( ) ] ; for ( int i = 0 ; i < attrNames . length ; i ++ ) { attrNames [ i ] = attrs . getQName ( i ) ; } Arrays . sort ( attrNames , Collections . reverseOrder ( ) ) ; for ( int i = 0 ; i < attrNames . length ; i ++ ) { poolName = poolName + "_" + attrNames [ i ] ; } } if ( hasEmptyBody ) { poolName = poolName + "_nobody" ; } return JspUtil . makeXmlJavaIdentifier ( poolName ) ; } } page . visit ( new TagHandlerPoolVisitor ( tagHandlerPoolNames ) ) ;


signature:
public class Generator { /** * Generates the _ jspInit ( ) method for instantiating the tag handler pools .
 * For tag file , _ jspInit has to be invoked manually , and the ServletConfig
 * object explicitly passed . */
private void generateTagHandlerInit ( ) { } }

implementation: if ( ! isPoolingEnabled || tagHandlerPoolNames . isEmpty ( ) ) { return ; } if ( ctxt . isTagFile ( ) ) { out . printil ( "private void _jspInit(ServletConfig config) {" ) ; } else { out . printil ( "public void _jspInit() {" ) ; } out . pushIndent ( ) ; for ( String tagHandlerPoolName : tagHandlerPoolNames ) { out . printin ( tagHandlerPoolName ) ; out . print ( " = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(" ) ; if ( ctxt . isTagFile ( ) ) { out . print ( "config" ) ; } else { out . print ( "getServletConfig()" ) ; } out . println ( ");" ) ; } out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ;


signature:
public class Generator { /** * Generates the _ jspDestroy ( ) method which is responsible for calling the
 * release ( ) method on every tag handler in any of the tag handler pools . */
private void generateTagHandlerDestroy ( ) { } }

implementation: if ( ! isPoolingEnabled || tagHandlerPoolNames . isEmpty ( ) ) { return ; } out . printil ( "public void _jspDestroy() {" ) ; out . pushIndent ( ) ; for ( String tagHandlerPoolName : tagHandlerPoolNames ) { out . printin ( tagHandlerPoolName ) ; out . println ( ".release();" ) ; } out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ;


signature:
public class Generator { /** * Generate preamble package name
 * ( shared by servlet and tag handler preamble generation ) */
private void genPreamblePackage ( String packageName ) throws JasperException { } }

implementation: if ( ! "" . equals ( packageName ) && packageName != null ) { out . printil ( "package " + packageName + ";" ) ; out . println ( ) ; }


signature:
public class Generator { /** * Generate preamble imports
 * ( shared by servlet and tag handler preamble generation ) */
private void genPreambleImports ( ) throws JasperException { } }

implementation: Iterator < String > iter = pageInfo . getImports ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { out . printin ( "import " ) ; out . print ( iter . next ( ) ) ; out . println ( ";" ) ; } out . println ( ) ;


signature:
public class Generator { /** * Generation of static initializers in preamble .
 * For example , dependant list , el function map , prefix map .
 * ( shared by servlet and tag handler preamble generation ) */
private void genPreambleStaticInitializers ( ) throws JasperException { } }

implementation:
out . printil ( "private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();" ) ; out . println ( ) ; // Static data for getDependants ( )
out . printil ( "private static java.util.List<String> _jspx_dependants;" ) ; out . println ( ) ; List < String > dependants = pageInfo . getDependants ( ) ; Iterator < String > iter = dependants . iterator ( ) ; if ( ! dependants . isEmpty ( ) ) { out . printil ( "static {" ) ; out . pushIndent ( ) ; out . printin ( "_jspx_dependants = new java.util.ArrayList<String>(" ) ; out . print ( "" + dependants . size ( ) ) ; out . println ( ");" ) ; while ( iter . hasNext ( ) ) { out . printin ( "_jspx_dependants.add(\"" ) ; out . print ( iter . next ( ) ) ; out . println ( "\");" ) ; } out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ; } // Codes to support genStringAsByteArray option
// Generate a static variable for the initial response encoding
if ( genBytes ) { // first get the respons encoding
String contentType = pageInfo . getContentType ( ) ; String encoding = "ISO-8859-1" ; int i = contentType . indexOf ( "charset=" ) ; if ( i > 0 ) encoding = contentType . substring ( i + 8 ) ; // Make sure the encoding is supported
// Assume that this can be determined at compile time
try { "testing" . getBytes ( encoding ) ; out . printin ( "private static final String _jspx_encoding = " ) ; out . print ( quote ( encoding ) ) ; out . println ( ";" ) ; out . printil ( "private boolean _jspx_gen_bytes = true;" ) ; out . printil ( "private boolean _jspx_encoding_tested;" ) ; } catch ( java . io . UnsupportedEncodingException ex ) { genBytes = false ; } }


signature:
public class Generator { /** * Declare tag handler pools ( tags of the same type and with the same
 * attribute set share the same tag handler pool )
 * ( shared by servlet and tag handler preamble generation ) */
private void genPreambleClassVariableDeclarations ( String className ) throws JasperException { } }

implementation: if ( isPoolingEnabled ) { if ( ! tagHandlerPoolNames . isEmpty ( ) ) { for ( String tagHandlerPoolName : tagHandlerPoolNames ) { out . printil ( "private org.apache.jasper.runtime.TagHandlerPool " + tagHandlerPoolName + ";" ) ; } out . println ( ) ; } } out . printil ( "private org.glassfish.jsp.api.ResourceInjector " + "_jspx_resourceInjector;" ) ; out . println ( ) ;


signature:
public class Generator { /** * Declare general - purpose methods
 * ( shared by servlet and tag handler preamble generation ) */
private void genPreambleMethods ( ) throws JasperException { } }

implementation:
// Method used to get compile time file dependencies
out . printil ( "public java.util.List<String> getDependants() {" ) ; out . pushIndent ( ) ; out . printil ( "return _jspx_dependants;" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ; // Method to get bytes from String
if ( genBytes ) { out . printil ( "private static byte[] _jspx_getBytes(String s) {" ) ; out . pushIndent ( ) ; out . printil ( "try {" ) ; out . pushIndent ( ) ; out . printil ( "return s.getBytes(_jspx_encoding);" ) ; out . popIndent ( ) ; out . printil ( "} catch (java.io.UnsupportedEncodingException ex) {" ) ; out . printil ( "}" ) ; out . printil ( "return null;" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ; // Generate code to see if the response encoding has been set
// differently from the encoding declared in the page directive .
// Note that we only need to do the test once . The assumption
// is that the encoding cannot be changed once some data has been
// written .
out . printil ( "private boolean _jspx_same_encoding(String encoding) {" ) ; out . pushIndent ( ) ; out . printil ( "if (! _jspx_encoding_tested) {" ) ; out . pushIndent ( ) ; out . printil ( "_jspx_gen_bytes = _jspx_encoding.equals(encoding);" ) ; out . printil ( "_jspx_encoding_tested = true;" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; out . printil ( "return _jspx_gen_bytes;" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ; } generateTagHandlerInit ( ) ; generateTagHandlerDestroy ( ) ;


signature:
public class Generator { /** * Generates the beginning of the static portion of the servlet . */
private void generatePreamble ( Node . Nodes page ) throws JasperException { } }

implementation:
String servletPackageName = ctxt . getServletPackageName ( ) ; String servletClassName = ctxt . getServletClassName ( ) ; String serviceMethodName = Constants . SERVICE_METHOD_NAME ; // First the package name :
genPreamblePackage ( servletPackageName ) ; // Generate imports
genPreambleImports ( ) ; // Generate class declaration
out . printin ( "public final class " ) ; out . print ( servletClassName ) ; out . print ( " extends " ) ; out . println ( pageInfo . getExtends ( ) ) ; out . printin ( "    implements org.apache.jasper.runtime.JspSourceDependent" ) ; if ( ! pageInfo . isThreadSafe ( ) ) { out . println ( "," ) ; out . printin ( "                 SingleThreadModel" ) ; } out . println ( " {" ) ; out . pushIndent ( ) ; // Class body begins here
generateDeclarations ( page ) ; // Static initializations here
genPreambleStaticInitializers ( ) ; // Class variable declarations
genPreambleClassVariableDeclarations ( servletClassName ) ; // Constructor
// generateConstructor ( className ) ;
// Methods here
genPreambleMethods ( ) ; // Now the service method
out . printin ( "public void " ) ; out . print ( serviceMethodName ) ; out . println ( "(HttpServletRequest request, HttpServletResponse response)" ) ; out . println ( "        throws java.io.IOException, ServletException {" ) ; out . pushIndent ( ) ; out . println ( ) ; // Local variable declarations
out . printil ( "PageContext pageContext = null;" ) ; if ( pageInfo . isSession ( ) ) out . printil ( "HttpSession session = null;" ) ; if ( pageInfo . isErrorPage ( ) ) { out . printil ( "Throwable exception = org.apache.jasper.runtime.JspRuntimeLibrary.getThrowable(request);" ) ; out . printil ( "if (exception != null) {" ) ; out . pushIndent ( ) ; out . printil ( "response.setStatus((Integer)request.getAttribute(\"javax.servlet.error.status_code\"));" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; } out . printil ( "ServletContext application = null;" ) ; out . printil ( "ServletConfig config = null;" ) ; out . printil ( "JspWriter out = null;" ) ; out . printil ( "Object page = this;" ) ; out . printil ( "JspWriter _jspx_out = null;" ) ; out . printil ( "PageContext _jspx_page_context = null;" ) ; out . println ( ) ; out . printil ( "try {" ) ; out . pushIndent ( ) ; out . printin ( "response.setContentType(" ) ; out . print ( quote ( pageInfo . getContentType ( ) ) ) ; out . println ( ");" ) ; if ( ctxt . getOptions ( ) . isXpoweredBy ( ) ) { out . printil ( "response.setHeader(\"X-Powered-By\", \"" + Constants . JSP_NAME + "\");" ) ; } out . printil ( "pageContext = _jspxFactory.getPageContext(this, request, response," ) ; out . printin ( "\t\t\t" ) ; out . print ( quote ( pageInfo . getErrorPage ( ) ) ) ; out . print ( ", " + pageInfo . isSession ( ) ) ; out . print ( ", " + pageInfo . getBuffer ( ) ) ; out . print ( ", " + pageInfo . isAutoFlush ( ) ) ; out . println ( ");" ) ; out . printil ( "_jspx_page_context = pageContext;" ) ; out . printil ( "application = pageContext.getServletContext();" ) ; out . printil ( "config = pageContext.getServletConfig();" ) ; if ( pageInfo . isSession ( ) ) out . printil ( "session = pageContext.getSession();" ) ; out . printil ( "out = pageContext.getOut();" ) ; out . printil ( "_jspx_out = out;" ) ; out . printil ( "_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute(\"com.sun.appserv.jsp.resource.injector\");" ) ; out . println ( ) ;


signature:
public class Generator { /** * Generates an XML Prolog , which includes an XML declaration and
 * an XML doctype declaration . */
private void generateXmlProlog ( Node . Nodes page ) { } }

implementation:
/* * An XML declaration is generated under the following conditions :
 * - ' omit - xml - declaration ' attribute of < jsp : output > action is set to
 * " no " or " false "
 * - JSP document without a < jsp : root > */
String omitXmlDecl = pageInfo . getOmitXmlDecl ( ) ; if ( ( omitXmlDecl != null && ! JspUtil . booleanValue ( omitXmlDecl ) ) || ( omitXmlDecl == null && page . getRoot ( ) . isXmlSyntax ( ) && ! pageInfo . hasJspRoot ( ) && ! ctxt . isTagFile ( ) ) ) { String cType = pageInfo . getContentType ( ) ; String charSet = cType . substring ( cType . indexOf ( "charset=" ) + 8 ) ; out . printil ( "out.write(\"<?xml version=\\\"1.0\\\" encoding=\\\"" + charSet + "\\\"?>\\n\");" ) ; } /* * Output a DOCTYPE declaration if the doctype - root - element appears .
 * If doctype - public appears :
 * < ! DOCTYPE name PUBLIC " doctypePublic " " doctypeSystem " >
 * else
 * < ! DOCTYPE name SYSTEM " doctypeSystem " > */
String doctypeName = pageInfo . getDoctypeName ( ) ; if ( doctypeName != null ) { String doctypePublic = pageInfo . getDoctypePublic ( ) ; String doctypeSystem = pageInfo . getDoctypeSystem ( ) ; out . printin ( "out.write(\"<!DOCTYPE " ) ; out . print ( doctypeName ) ; if ( doctypePublic == null ) { out . print ( " SYSTEM \\\"" ) ; } else { out . print ( " PUBLIC \\\"" ) ; out . print ( doctypePublic ) ; out . print ( "\\\" \\\"" ) ; } out . print ( doctypeSystem ) ; out . println ( "\\\">\\n\");" ) ; }


signature:
public class Generator { /** * Generates the constructor .
 * ( shared by servlet and tag handler preamble generation ) */
private void generateConstructor ( String className ) { } }

implementation: out . printil ( "public " + className + "() {" ) ; out . printil ( "}" ) ; out . println ( ) ;


signature:
public class Generator { /** * Common part of postamble , shared by both servlets and tag files . */
private void genCommonPostamble ( ) { } }

implementation:
// Append any methods that were generated in the buffer .
for ( int i = 0 ; i < methodsBuffered . size ( ) ; i ++ ) { GenBuffer methodBuffer = methodsBuffered . get ( i ) ; methodBuffer . adjustJavaLines ( out . getJavaLine ( ) - 1 ) ; out . printMultiLn ( methodBuffer . toString ( ) ) ; } // Append the helper class
if ( fragmentHelperClass . isUsed ( ) ) { fragmentHelperClass . generatePostamble ( ) ; fragmentHelperClass . adjustJavaLines ( out . getJavaLine ( ) - 1 ) ; out . printMultiLn ( fragmentHelperClass . toString ( ) ) ; } // Append char array declarations
if ( arrayBuffer != null ) { out . printMultiLn ( arrayBuffer . toString ( ) ) ; } // Close the class definition
out . popIndent ( ) ; out . printil ( "}" ) ;


signature:
public class Generator { /** * Generates the ending part of the static portion of the servlet . */
private void generatePostamble ( Node . Nodes page ) { } }

implementation:
out . popIndent ( ) ; out . printil ( "} catch (Throwable t) {" ) ; out . pushIndent ( ) ; out . printil ( "if (!(t instanceof SkipPageException)){" ) ; out . pushIndent ( ) ; out . printil ( "out = _jspx_out;" ) ; out . printil ( "if (out != null && out.getBufferSize() != 0)" ) ; out . pushIndent ( ) ; out . printil ( "out.clearBuffer();" ) ; out . popIndent ( ) ; out . printil ( "if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);" ) ; out . printil ( "else throw new ServletException(t);" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; out . popIndent ( ) ; out . printil ( "} finally {" ) ; out . pushIndent ( ) ; out . printil ( "_jspxFactory.releasePageContext(_jspx_page_context);" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; // Close the service method
out . popIndent ( ) ; out . printil ( "}" ) ; // Generated methods , helper classes , etc .
genCommonPostamble ( ) ;


signature:
public class Generator { /** * The main entry for Generator .
 * @ param out The servlet output writer
 * @ param compiler The compiler
 * @ param page The input page */
public static void generate ( ServletWriter out , Compiler compiler , Node . Nodes page ) throws JasperException { } }

implementation: Generator gen = new Generator ( out , compiler ) ; if ( gen . isPoolingEnabled ) { gen . compileTagHandlerPoolList ( page ) ; } if ( gen . ctxt . isTagFile ( ) ) { JasperTagInfo tagInfo = ( JasperTagInfo ) gen . ctxt . getTagInfo ( ) ; gen . generateTagHandlerPreamble ( tagInfo , page ) ; if ( gen . ctxt . isPrototypeMode ( ) ) { return ; } gen . generateXmlProlog ( page ) ; gen . fragmentHelperClass . generatePreamble ( ) ; page . visit ( gen . new GenerateVisitor ( gen . ctxt . isTagFile ( ) , out , gen . methodsBuffered , gen . fragmentHelperClass ) ) ; gen . generateTagHandlerPostamble ( tagInfo ) ; } else { gen . generatePreamble ( page ) ; gen . generateXmlProlog ( page ) ; gen . fragmentHelperClass . generatePreamble ( ) ; page . visit ( gen . new GenerateVisitor ( gen . ctxt . isTagFile ( ) , out , gen . methodsBuffered , gen . fragmentHelperClass ) ) ; gen . generatePostamble ( page ) ; }


signature:
public class Generator { /** * Generates tag handler preamble . */
private void generateTagHandlerPreamble ( JasperTagInfo tagInfo , Node . Nodes tag ) throws JasperException { } }

implementation:
// Generate package declaration
String className = tagInfo . getTagClassName ( ) ; int lastIndex = className . lastIndexOf ( '.' ) ; if ( lastIndex != - 1 ) { String pkgName = className . substring ( 0 , lastIndex ) ; genPreamblePackage ( pkgName ) ; className = className . substring ( lastIndex + 1 ) ; } // Generate imports
genPreambleImports ( ) ; // Generate class declaration
out . printin ( "public final class " ) ; out . println ( className ) ; out . printil ( "    extends javax.servlet.jsp.tagext.SimpleTagSupport" ) ; out . printin ( "    implements org.apache.jasper.runtime.JspSourceDependent" ) ; if ( tagInfo . hasDynamicAttributes ( ) ) { out . println ( "," ) ; out . printin ( "               javax.servlet.jsp.tagext.DynamicAttributes" ) ; } out . println ( " {" ) ; out . println ( ) ; out . pushIndent ( ) ; /* * Class body begins here */
generateDeclarations ( tag ) ; // Static initializations here
genPreambleStaticInitializers ( ) ; out . printil ( "private JspContext jspContext;" ) ; // Declare writer used for storing result of fragment / body invocation
// if ' varReader ' or ' var ' attribute is specified
out . printil ( "private java.io.Writer _jspx_sout;" ) ; // Class variable declarations
genPreambleClassVariableDeclarations ( tagInfo . getTagName ( ) ) ; generateSetJspContext ( tagInfo ) ; // Tag - handler specific declarations
generateTagHandlerAttributes ( tagInfo ) ; if ( tagInfo . hasDynamicAttributes ( ) ) generateSetDynamicAttribute ( ) ; // Methods here
genPreambleMethods ( ) ; // Now the doTag ( ) method
out . printil ( "public void doTag() throws JspException, java.io.IOException {" ) ; if ( ctxt . isPrototypeMode ( ) ) { out . printil ( "}" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; return ; } out . pushIndent ( ) ; /* * According to the spec , ' pageContext ' must not be made available as
 * an implicit object in tag files .
 * Declare _ jspx _ page _ context , so we can share the code generator with
 * JSPs . */
out . printil ( "PageContext _jspx_page_context = (PageContext)jspContext;" ) ; // Declare implicit objects .
out . printil ( "HttpServletRequest request = " + "(HttpServletRequest) _jspx_page_context.getRequest();" ) ; out . printil ( "HttpServletResponse response = " + "(HttpServletResponse) _jspx_page_context.getResponse();" ) ; out . printil ( "HttpSession session = _jspx_page_context.getSession();" ) ; out . printil ( "ServletContext application = _jspx_page_context.getServletContext();" ) ; out . printil ( "ServletConfig config = _jspx_page_context.getServletConfig();" ) ; out . printil ( "JspWriter out = jspContext.getOut();" ) ; if ( isPoolingEnabled && ! tagHandlerPoolNames . isEmpty ( ) ) { out . printil ( "_jspInit(config);" ) ; } generatePageScopedVariables ( tagInfo ) ; out . println ( ) ; out . printil ( "try {" ) ; out . pushIndent ( ) ;


signature:
public class Generator { /** * Generates declarations for tag handler attributes , and defines the
 * getter and setter methods for each . */
private void generateTagHandlerAttributes ( TagInfo tagInfo ) throws JasperException { } }

implementation:
if ( tagInfo . hasDynamicAttributes ( ) ) { out . printil ( "private java.util.HashMap _jspx_dynamic_attrs = new java.util.HashMap();" ) ; } // Declare attributes
TagAttributeInfo [ ] attrInfos = tagInfo . getAttributes ( ) ; for ( int i = 0 ; i < attrInfos . length ; i ++ ) { out . printin ( "private " ) ; if ( attrInfos [ i ] . isFragment ( ) ) { out . print ( "javax.servlet.jsp.tagext.JspFragment " ) ; } else { out . print ( JspUtil . toJavaSourceType ( attrInfos [ i ] . getTypeName ( ) ) ) ; out . print ( " " ) ; } out . print ( attrInfos [ i ] . getName ( ) ) ; out . println ( ";" ) ; } out . println ( ) ; // Define attribute getter and setter methods
for ( int i = 0 ; i < attrInfos . length ; i ++ ) { // getter method
out . printin ( "public " ) ; if ( attrInfos [ i ] . isFragment ( ) ) { out . print ( "javax.servlet.jsp.tagext.JspFragment " ) ; } else { out . print ( JspUtil . toJavaSourceType ( attrInfos [ i ] . getTypeName ( ) ) ) ; out . print ( " " ) ; } out . print ( toGetterMethod ( attrInfos [ i ] . getName ( ) ) ) ; out . println ( " {" ) ; out . pushIndent ( ) ; out . printin ( "return this." ) ; out . print ( attrInfos [ i ] . getName ( ) ) ; out . println ( ";" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ; // setter method
out . printin ( "public void " ) ; out . print ( toSetterMethodName ( attrInfos [ i ] . getName ( ) ) ) ; if ( attrInfos [ i ] . isFragment ( ) ) { out . print ( "(javax.servlet.jsp.tagext.JspFragment " ) ; } else { out . print ( "(" ) ; out . print ( JspUtil . toJavaSourceType ( attrInfos [ i ] . getTypeName ( ) ) ) ; out . print ( " " ) ; } out . print ( attrInfos [ i ] . getName ( ) ) ; out . println ( ") {" ) ; out . pushIndent ( ) ; out . printin ( "this." ) ; out . print ( attrInfos [ i ] . getName ( ) ) ; out . print ( " = " ) ; out . print ( attrInfos [ i ] . getName ( ) ) ; out . println ( ";" ) ; out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ; }