signature:
public class UCSReader { /** * Read a single character . This method will block until a character is
 * available , an I / O error occurs , or the end of the stream is reached .
 * < p > Subclasses that intend to support efficient single - character input
 * should override this method .
 * @ return The character read , as an integer in the range 0 to 127
 * ( < tt > 0x00-0x7f < / tt > ) , or - 1 if the end of the stream has
 * been reached
 * @ exception IOException If an I / O error occurs */
public int read ( ) throws IOException { } }

implementation:
int b0 = fInputStream . read ( ) & 0xff ; if ( b0 == 0xff ) return - 1 ; int b1 = fInputStream . read ( ) & 0xff ; if ( b1 == 0xff ) return - 1 ; if ( fEncoding >= 4 ) { int b2 = fInputStream . read ( ) & 0xff ; if ( b2 == 0xff ) return - 1 ; int b3 = fInputStream . read ( ) & 0xff ; if ( b3 == 0xff ) return - 1 ; if ( log . isLoggable ( Level . FINE ) ) log . fine ( "b0 is " + ( b0 & 0xff ) + " b1 " + ( b1 & 0xff ) + " b2 " + ( b2 & 0xff ) + " b3 " + ( b3 & 0xff ) ) ; if ( fEncoding == UCS4BE ) return ( b0 << 24 ) + ( b1 << 16 ) + ( b2 << 8 ) + b3 ; else return ( b3 << 24 ) + ( b2 << 16 ) + ( b1 << 8 ) + b0 ; } else { // UCS - 2
if ( fEncoding == UCS2BE ) return ( b0 << 8 ) + b1 ; else return ( b1 << 8 ) + b0 ; }


signature:
public class UrlSetWriter { /** * Complete the document but don ' t close the underlying writer
 * @ throws IOException
 * if there is an IO error */
public void finish ( ) throws IOException { } }

implementation: if ( ! this . finished ) { this . finished = true ; writeEnd ( ) ; } try { this . out . close ( ) ; } catch ( final XMLStreamException e ) { throw new IOException ( e ) ; }


signature:
public class ChannelData { /** * Make an appropriate Gson parser to processing ChannelData instances
 * @ param pretty
 * if the gson output should be " pretty printed "
 * @ return the new gson instance */
public static Gson makeGson ( final boolean pretty ) { } }

implementation: final GsonBuilder gb = new GsonBuilder ( ) ; if ( pretty ) { gb . setPrettyPrinting ( ) ; } gb . registerTypeAdapter ( Node . class , new NodeAdapter ( ) ) ; gb . registerTypeAdapter ( byte [ ] . class , new ByteArrayAdapter ( ) ) ; return gb . create ( ) ;


signature:
public class LZMAEncoder { /** * Gets an integer [ 0 , 63 ] matching the highest two bits of an integer .
 * This is like bit scan reverse ( BSR ) on x86 except that this also
 * cares about the second highest bit . */
public static int getDistSlot ( int dist ) { } }


signature:
public class LZMAEncoder { /** * Compresses for LZMA2.
 * @ return true if the LZMA2 chunk became full , false otherwise */
public boolean encodeForLZMA2 ( ) { } }

implementation:
// LZMA2 uses RangeEncoderToBuffer so IOExceptions aren ' t possible .
try { if ( ! lz . isStarted ( ) && ! encodeInit ( ) ) return false ; while ( uncompressedSize <= LZMA2_UNCOMPRESSED_LIMIT && rc . getPendingSize ( ) <= LZMA2_COMPRESSED_LIMIT ) if ( ! encodeSymbol ( ) ) return false ; } catch ( IOException e ) { throw new Error ( ) ; } return true ;


signature:
public class MetaKeys { /** * Get a string from meta data
 * If the provided metadata set is < code > null < / code > , then the result will
 * also be < code > null < / code > .
 * @ param metadata
 * the meta data map , may be < code > null < / code >
 * @ param ns
 * the namespace
 * @ param key
 * the key
 * @ return the value , as string , may be < code > null < / code > */
public static String getString ( final Map < MetaKey , String > metadata , final String ns , final String key ) { } }

implementation: return getString ( metadata , ns , key , null ) ;


signature:
public class MetaKeys { /** * Get a string from meta data
 * If the provided metadata set is < code > null < / code > , then the result will
 * also be < code > null < / code > .
 * @ param metadata
 * the meta data map , may be < code > null < / code >
 * @ param ns
 * the namespace
 * @ param key
 * the key
 * @ param defaultValue
 * the value returned if either the metadata parameter is
 * < code > null < / code > or the metadata does not contain this key or
 * the value is < code > null < / code >
 * @ return the value , as string , may be < code > null < / code > */
public static String getString ( final Map < MetaKey , String > metadata , final String ns , final String key , final String defaultValue ) { } }

implementation: if ( metadata == null ) { return defaultValue ; } final String result = metadata . get ( new MetaKey ( ns , key ) ) ; if ( result == null ) { return defaultValue ; } return result ;


signature:
public class MetaKeys { /** * Return an unmodifiable map of provided and extracted meta data
 * @ param providedMetaData
 * the provided meta data , or code { @ code null }
 * @ param extractedMetaData
 * the extracted meta data , or code { @ code null }
 * @ return the union of provided and extracted meta data , never returns
 * { @ code null } */
public static Map < MetaKey , String > union ( final Map < MetaKey , String > providedMetaData , final Map < MetaKey , String > extractedMetaData ) { } }

implementation:
final int size1 = providedMetaData != null ? providedMetaData . size ( ) : 0 ; final int size2 = extractedMetaData != null ? extractedMetaData . size ( ) : 0 ; if ( size1 + size2 == 0 ) { return Collections . emptyMap ( ) ; } final Map < MetaKey , String > result = new HashMap < > ( size1 + size2 ) ; if ( extractedMetaData != null ) { result . putAll ( extractedMetaData ) ; } // provided will override
if ( providedMetaData != null ) { result . putAll ( providedMetaData ) ; } return Collections . unmodifiableMap ( result ) ;


signature:
public class GodModeService { /** * Write out the announce file < br >
 * Writing a file like this seems a little bit strange from a Java
 * perspective . However , there seems to be no other way to create a file
 * with a provided set of initial file attributes other than
 * { @ link Files # newByteChannel ( java . nio . file . Path , Set , FileAttribute . . . ) } .
 * All other methods don ' t access file attributes .
 * @ param adminToken
 * The admin token to write out */
protected void writeAnnounceFile ( final String adminToken ) { } }

implementation:
final Path path = ANNOUNCE_FILE . toPath ( ) ; /* * Try to delete the file first . We don ' t care about the result
 * since the next operation will try to create a new file anyway .
 * However by deleting it first , we try to ensure that the initial
 * file permissions are set . If the file exists these would not be
 * changed . */
ANNOUNCE_FILE . delete ( ) ; // posix
final FileAttribute < ? > [ ] attrs ; if ( ANNOUNCE_FILE_POSIX ) { final Set < PosixFilePermission > perms = EnumSet . of ( PosixFilePermission . OWNER_READ , PosixFilePermission . OWNER_WRITE ) ; attrs = new FileAttribute < ? > [ ] { PosixFilePermissions . asFileAttribute ( perms ) } ; } else { attrs = new FileAttribute < ? > [ 0 ] ; } final Set < ? extends OpenOption > options = EnumSet . of ( StandardOpenOption . CREATE , StandardOpenOption . WRITE , StandardOpenOption . TRUNCATE_EXISTING ) ; try ( SeekableByteChannel sbc = Files . newByteChannel ( path , options , attrs ) ) { final StringWriter sw = new StringWriter ( ) ; final PrintWriter writer = new PrintWriter ( sw ) ; writer . format ( "user=%s%n" , NAME ) ; writer . format ( "password=%s%n" , adminToken ) ; writer . close ( ) ; final ByteBuffer data = ByteBuffer . wrap ( sw . toString ( ) . getBytes ( StandardCharsets . UTF_8 ) ) ; while ( data . hasRemaining ( ) ) { sbc . write ( data ) ; } } catch ( final UnsupportedOperationException e ) { System . err . format ( "WARNING: Failed to write out announce file with secured posix permissions. If you are on a non-posix platform (e.g. Windows), you might need to set the system property '%s' to 'true'%n" , PROP_NOT_POSIX ) ; } catch ( final IOException e ) { System . err . println ( "WARNING: Unable to write announce file: " + ExceptionHelper . getMessage ( e ) ) ; }


signature:
public class JspRuntimeLibrary { /** * Returns the value of the javax . servlet . error . exception request
 * attribute value , if present , otherwise the value of the
 * javax . servlet . jsp . jspException request attribute value .
 * This method is called at the beginning of the generated servlet code
 * for a JSP error page , when the " exception " implicit scripting language
 * variable is initialized . */
public static Throwable getThrowable ( ServletRequest request ) { } }

implementation:
Throwable error = ( Throwable ) request . getAttribute ( SERVLET_EXCEPTION ) ; if ( error == null ) { error = ( Throwable ) request . getAttribute ( JSP_EXCEPTION ) ; if ( error != null ) { /* * The only place that sets JSP _ EXCEPTION is
 * PageContextImpl . handlePageException ( ) . It really should set
 * SERVLET _ EXCEPTION , but that would interfere with the
 * ErrorReportValve . Therefore , if JSP _ EXCEPTION is set , we
 * need to set SERVLET _ EXCEPTION . */
request . setAttribute ( SERVLET_EXCEPTION , error ) ; } } return error ;


signature:
public class JspRuntimeLibrary { /** * _ _ begin introspecthelperMethod */
public static void introspecthelper ( Object bean , String prop , String value , ServletRequest request , String param , boolean ignoreMethodNF ) throws JasperException { } }

implementation: if ( Constants . IS_SECURITY_ENABLED ) { try { PrivilegedIntrospectHelper dp = new PrivilegedIntrospectHelper ( bean , prop , value , request , param , ignoreMethodNF ) ; AccessController . doPrivileged ( dp ) ; } catch ( PrivilegedActionException pe ) { Exception e = pe . getException ( ) ; throw ( JasperException ) e ; } } else { internalIntrospecthelper ( bean , prop , value , request , param , ignoreMethodNF ) ; }


signature:
public class JspRuntimeLibrary { /** * Create a typed array .
 * This is a special case where params are passed through
 * the request and the property is indexed . */
public static void createTypedArray ( String propertyName , Object bean , Method method , String [ ] values , Class t , Class propertyEditorClass ) throws JasperException { } }

implementation: try { if ( propertyEditorClass != null ) { Object [ ] tmpval = new Integer [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) { tmpval [ i ] = getValueFromBeanInfoPropertyEditor ( t , propertyName , values [ i ] , propertyEditorClass ) ; } method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( Integer . class ) ) { Integer [ ] tmpval = new Integer [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Integer . valueOf ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( Byte . class ) ) { Byte [ ] tmpval = new Byte [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Byte . valueOf ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( Boolean . class ) ) { Boolean [ ] tmpval = new Boolean [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Boolean . valueOf ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( Short . class ) ) { Short [ ] tmpval = new Short [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Short . valueOf ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( Long . class ) ) { Long [ ] tmpval = new Long [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Long . valueOf ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( Double . class ) ) { Double [ ] tmpval = new Double [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Double . valueOf ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( Float . class ) ) { Float [ ] tmpval = new Float [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Float . valueOf ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( Character . class ) ) { Character [ ] tmpval = new Character [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Character . valueOf ( values [ i ] . charAt ( 0 ) ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( int . class ) ) { int [ ] tmpval = new int [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Integer . parseInt ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( byte . class ) ) { byte [ ] tmpval = new byte [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Byte . parseByte ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( boolean . class ) ) { boolean [ ] tmpval = new boolean [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = ( Boolean . valueOf ( values [ i ] ) ) . booleanValue ( ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( short . class ) ) { short [ ] tmpval = new short [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Short . parseShort ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( long . class ) ) { long [ ] tmpval = new long [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Long . parseLong ( values [ i ] ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( double . class ) ) { double [ ] tmpval = new double [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Double . valueOf ( values [ i ] ) . doubleValue ( ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( float . class ) ) { float [ ] tmpval = new float [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = Float . valueOf ( values [ i ] ) . floatValue ( ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else if ( t . equals ( char . class ) ) { char [ ] tmpval = new char [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) tmpval [ i ] = values [ i ] . charAt ( 0 ) ; method . invoke ( bean , new Object [ ] { tmpval } ) ; } else { Object [ ] tmpval = new Integer [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) { tmpval [ i ] = getValueFromPropertyEditorManager ( t , propertyName , values [ i ] ) ; } method . invoke ( bean , new Object [ ] { tmpval } ) ; } } catch ( Exception ex ) { throw new JasperException ( "error in invoking method" , ex ) ; }


signature:
public class JspRuntimeLibrary { /** * _ _ begin lookupReadMethodMethod */
public static Object handleGetProperty ( Object o , String prop ) throws JasperException { } }

implementation: if ( o == null ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.beans.nullbean" ) ) ; } Object value = null ; try { Method method = getReadMethod ( o . getClass ( ) , prop ) ; value = method . invoke ( o , ( Object [ ] ) null ) ; } catch ( Exception ex ) { throw new JasperException ( ex ) ; } return value ;


signature:
public class JspRuntimeLibrary { /** * Use proprietaryEvaluate
 * public static void handleSetPropertyExpression ( Object bean ,
 * String prop , String expression , PageContext pageContext ,
 * VariableResolver variableResolver , FunctionMapper functionMapper )
 * throws JasperException
 * try {
 * Method method = getWriteMethod ( bean . getClass ( ) , prop ) ;
 * method . invoke ( bean , new Object [ ] {
 * pageContext . getExpressionEvaluator ( ) . evaluate (
 * expression ,
 * method . getParameterTypes ( ) [ 0 ] ,
 * variableResolver ,
 * functionMapper ,
 * null )
 * } catch ( Exception ex ) {
 * throw new JasperException ( ex ) ; */
public static void handleSetPropertyExpression ( Object bean , String prop , String expression , PageContext pageContext , ProtectedFunctionMapper functionMapper ) throws JasperException { } }

implementation: try { Method method = getWriteMethod ( bean . getClass ( ) , prop ) ; method . invoke ( bean , new Object [ ] { PageContextImpl . evaluateExpression ( expression , method . getParameterTypes ( ) [ 0 ] , pageContext , functionMapper ) } ) ; } catch ( Exception ex ) { throw new JasperException ( ex ) ; }


signature:
public class JspRuntimeLibrary { /** * Convert a possibly relative resource path into a context - relative
 * resource path that starts with a ' / ' .
 * @ param request The servlet request we are processing
 * @ param relativePath The possibly relative resource path */
public static String getContextRelativePath ( ServletRequest request , String relativePath ) { } }

implementation:
if ( relativePath . startsWith ( "/" ) ) return ( relativePath ) ; if ( ! ( request instanceof HttpServletRequest ) ) return ( relativePath ) ; HttpServletRequest hrequest = ( HttpServletRequest ) request ; String uri = ( String ) request . getAttribute ( "javax.servlet.include.servlet_path" ) ; if ( uri != null ) { String pathInfo = ( String ) request . getAttribute ( "javax.servlet.include.path_info" ) ; if ( pathInfo == null ) { if ( uri . lastIndexOf ( '/' ) >= 0 ) { uri = uri . substring ( 0 , uri . lastIndexOf ( '/' ) ) ; } } } else { // STARTJR : fix improper handling of jsp : include
uri = hrequest . getServletPath ( ) ; String pathInfo = hrequest . getPathInfo ( ) ; if ( pathInfo != null ) { uri = uri + pathInfo ; } if ( uri . lastIndexOf ( '/' ) >= 0 ) { uri = uri . substring ( 0 , uri . lastIndexOf ( '/' ) ) ; } // ENDJR
} return uri + '/' + relativePath ;


signature:
public class JspRuntimeLibrary { /** * Perform a RequestDispatcher . include ( ) operation , with optional flushing
 * of the response beforehand .
 * @ param request The servlet request we are processing
 * @ param response The servlet response we are processing
 * @ param relativePath The relative path of the resource to be included
 * @ param out The Writer to whom we are currently writing
 * @ param flush Should we flush before the include is processed ?
 * @ exception IOException if thrown by the included servlet
 * @ exception ServletException if thrown by the included servlet */
public static void include ( ServletRequest request , ServletResponse response , String relativePath , JspWriter out , boolean flush ) throws IOException , ServletException { } }

implementation:
if ( flush && ! ( out instanceof BodyContent ) ) out . flush ( ) ; // FIXME - It is tempting to use request . getRequestDispatcher ( ) to
// resolve a relative path directly , but Catalina currently does not
// take into account whether the caller is inside a RequestDispatcher
// include or not . Whether Catalina * should * take that into account
// is a spec issue currently under review . In the mean time ,
// replicate Jasper ' s previous behavior
String resourcePath = getContextRelativePath ( request , relativePath ) ; RequestDispatcher rd = request . getRequestDispatcher ( resourcePath ) ; rd . include ( request , new ServletResponseWrapperInclude ( response , out ) ) ;


signature:
public class PerThreadTagHandlerPool { /** * Adds the given tag handler to this tag handler pool , unless this tag
 * handler pool has already reached its capacity , in which case the tag
 * handler ' s release ( ) method is called .
 * @ param handler Tag handler to add to this tag handler pool */
public void reuse ( Tag handler ) { } }

implementation: PerThreadData ptd = perThread . get ( ) ; if ( ptd . current < ( ptd . handlers . length - 1 ) ) { ptd . handlers [ ++ ptd . current ] = handler ; } else { handler . release ( ) ; }


signature:
public class PerThreadTagHandlerPool { /** * Calls the release ( ) method of all tag handlers in this tag handler pool . */
public void release ( ) { } }

implementation: Enumeration < PerThreadData > enumeration = perThreadDataVector . elements ( ) ; while ( enumeration . hasMoreElements ( ) ) { PerThreadData ptd = enumeration . nextElement ( ) ; if ( ptd . handlers != null ) { for ( int i = ptd . current ; i >= 0 ; i -- ) { if ( ptd . handlers [ i ] != null ) { ptd . handlers [ i ] . release ( ) ; } } } }


signature:
public class Uploader { /** * Check if the uploaded artifact is actually a checksum file
 * @ param c
 * the extracted coordinates
 * @ return { @ code true } if the upload is definitely a checksum file ,
 * { @ code false } otherwise */
private String isCheckSum ( final Coordinates c ) { } }

implementation: final String cext = c . getExtension ( ) ; if ( cext == null ) { return null ; } for ( final String ext : this . options . getChecksumExtensions ( ) ) { if ( cext . endsWith ( "." + ext ) ) { return ext ; } } return null ;


signature:
public class VirtualizerImpl { /** * private final static Logger logger = LoggerFactory . getLogger ( VirtualizerImpl . class ) ; */
@ Override public void virtualize ( final Context context ) { } }

implementation: try { processVirtualize ( context ) ; } catch ( final Exception e ) { throw new RuntimeException ( e ) ; }


signature:
public class LZMAOutputStream { /** * Finishes the stream without closing the underlying OutputStream . */
public void finish ( ) throws IOException { } }

implementation: if ( ! finished ) { if ( exception != null ) throw exception ; try { if ( expectedUncompressedSize != - 1 && expectedUncompressedSize != currentUncompressedSize ) throw new XZIOException ( "Expected uncompressed size (" + expectedUncompressedSize + ") doesn't equal " + "the number of bytes written to the stream (" + currentUncompressedSize + ")" ) ; lz . setFinishing ( ) ; lzma . encodeForLZMA1 ( ) ; if ( useEndMarker ) lzma . encodeLZMA1EndMarker ( ) ; rc . finish ( ) ; } catch ( IOException e ) { exception = e ; throw e ; } finished = true ; lzma . putArraysToCache ( arrayCache ) ; lzma = null ; lz = null ; }


signature:
public class PageContextImpl { /** * Returns the exception associated with this page context , if any .
 * Added wrapping for Throwables to avoid ClassCastException
 * ( see Bugzilla 31171 for details ) .
 * @ return The Exception associated with this page context , if any . */
public Exception getException ( ) { } }

implementation:
Throwable t = JspRuntimeLibrary . getThrowable ( request ) ; // Only wrap if needed
if ( ( t != null ) && ( ! ( t instanceof Exception ) ) ) { t = new JspException ( t ) ; } return ( Exception ) t ;


signature:
public class PageContextImpl { /** * Evaluates an EL expression
 * @ param expression The expression to be evaluated
 * @ param expectedType The expected resulting type
 * @ param pageContext The page context
 * @ param functionMap Maps prefix and name to Method
 * @ return The result of the evaluation */
public static Object evaluateExpression ( final String expression , final Class expectedType , final PageContext pageContext , final ProtectedFunctionMapper functionMap ) throws ELException { } }

implementation: Object retValue ; if ( SecurityUtil . isPackageProtectionEnabled ( ) ) { try { retValue = AccessController . doPrivileged ( new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws Exception { ELContextImpl elContext = ( ELContextImpl ) pageContext . getELContext ( ) ; elContext . setFunctionMapper ( functionMap ) ; ExpressionFactory expFactory = getExpressionFactory ( pageContext ) ; ValueExpression expr = expFactory . createValueExpression ( elContext , expression , expectedType ) ; return expr . getValue ( elContext ) ; } } ) ; } catch ( PrivilegedActionException ex ) { Exception realEx = ex . getException ( ) ; if ( realEx instanceof ELException ) { throw ( ELException ) realEx ; } else { throw new ELException ( realEx ) ; } } } else { ELContextImpl elContext = ( ELContextImpl ) pageContext . getELContext ( ) ; elContext . setFunctionMapper ( functionMap ) ; ExpressionFactory expFactory = getExpressionFactory ( pageContext ) ; ValueExpression expr = expFactory . createValueExpression ( elContext , expression , expectedType ) ; retValue = expr . getValue ( elContext ) ; } return retValue ;


signature:
public class SystemServiceImpl { /** * Make the prefix by guessing the port from the OSGi settings */
protected String makePrefixFromOsgiProperties ( ) { } }

implementation: final String port = System . getProperty ( "org.osgi.service.http.port" ) ; if ( port == null ) { return null ; } final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "http://" ) . append ( discoverHostname ( ) ) ; if ( ! "80" . equals ( port ) ) { sb . append ( ':' ) . append ( port ) ; } return sb . toString ( ) ;


signature:
public class XmlFiles { /** * Test if this file is an XML file
 * @ param path
 * the path to check
 * @ return < code > true < / code > if this is an XML file
 * @ throws IOException
 * if the probing fails */
public static boolean isXml ( final Path path ) throws IOException { } }

implementation: final XmlToolsFactory xml = Activator . getXmlToolsFactory ( ) ; final XMLInputFactory xin = xml . newXMLInputFactory ( ) ; try ( InputStream stream = new BufferedInputStream ( Files . newInputStream ( path ) ) ) { try { final XMLStreamReader reader = xin . createXMLStreamReader ( stream ) ; reader . next ( ) ; return true ; } catch ( final XMLStreamException e ) { return false ; } }


signature:
public class TagFileProcessor { /** * Parses the tag file , and collects information on the directives included
 * in it . The method is used to obtain the info on the tag file , when the
 * handler that it represents is referenced . The tag file is not compiled
 * here .
 * @ param pc the current ParserController used in this compilation
 * @ param name the tag name as specified in the TLD
 * @ param tagfile the path for the tagfile
 * @ param tagLibInfo the TagLibraryInfo object associated with this TagInfo
 * @ return a TagInfo object assembled from the directives in the tag file . */
public static TagInfo parseTagFileDirectives ( ParserController pc , String name , String path , TagLibraryInfo tagLibInfo ) throws JasperException { } }

implementation: ErrorDispatcher err = pc . getCompiler ( ) . getErrorDispatcher ( ) ; Node . Nodes page = null ; try { page = pc . parseTagFileDirectives ( path ) ; } catch ( FileNotFoundException e ) { err . jspError ( "jsp.error.file.not.found" , path ) ; } catch ( IOException e ) { err . jspError ( "jsp.error.file.not.found" , path ) ; } TagFileDirectiveVisitor tagFileVisitor = new TagFileDirectiveVisitor ( pc . getCompiler ( ) , tagLibInfo , name , path ) ; page . visit ( tagFileVisitor ) ; tagFileVisitor . postCheck ( ) ; return tagFileVisitor . getTagInfo ( ) ;


signature:
public class TagFileProcessor { /** * Compiles and loads a tagfile . */
private Class loadTagFile ( Compiler compiler , String tagFilePath , TagInfo tagInfo , PageInfo parentPageInfo ) throws JasperException { } }

implementation:
JspCompilationContext ctxt = compiler . getCompilationContext ( ) ; JspRuntimeContext rctxt = ctxt . getRuntimeContext ( ) ; synchronized ( rctxt ) { JspServletWrapper wrapper = ( JspServletWrapper ) rctxt . getWrapper ( tagFilePath ) ; if ( wrapper == null ) { wrapper = new JspServletWrapper ( ctxt . getServletContext ( ) , ctxt . getOptions ( ) , tagFilePath , tagInfo , ctxt . getRuntimeContext ( ) , ( URL ) ctxt . getTagFileJarUrls ( ) . get ( tagFilePath ) ) ; rctxt . addWrapper ( tagFilePath , wrapper ) ; // Use same classloader and classpath for compiling tag files
wrapper . getJspEngineContext ( ) . setClassLoader ( ( URLClassLoader ) ctxt . getClassLoader ( ) ) ; wrapper . getJspEngineContext ( ) . setClassPath ( ctxt . getClassPath ( ) ) ; } else { // Make sure that JspCompilationContext gets the latest TagInfo
// for the tag file . TagInfo instance was created the last
// time the tag file was scanned for directives , and the tag
// file may have been modified since then .
wrapper . getJspEngineContext ( ) . setTagInfo ( tagInfo ) ; } Class tagClazz ; int tripCount = wrapper . incTripCount ( ) ; try { if ( tripCount > 0 ) { // When tripCount is greater than zero , a circular
// dependency exists . The circularily dependant tag
// file is compiled in prototype mode , to avoid infinite
// recursion .
JspServletWrapper tempWrapper = new JspServletWrapper ( ctxt . getServletContext ( ) , ctxt . getOptions ( ) , tagFilePath , tagInfo , ctxt . getRuntimeContext ( ) , ( URL ) ctxt . getTagFileJarUrls ( ) . get ( tagFilePath ) ) ; tagClazz = tempWrapper . loadTagFilePrototype ( ) ; tempVector . add ( tempWrapper . getJspEngineContext ( ) . getCompiler ( ) ) ; } else { tagClazz = wrapper . loadTagFile ( ) ; } } finally { wrapper . decTripCount ( ) ; } // Add the dependants for this tag file to its parent ' s
// dependant list . The only reliable dependency information
// can only be obtained from the tag instance .
try { Object tagIns = tagClazz . newInstance ( ) ; if ( tagIns instanceof JspSourceDependent ) { for ( String dependant : ( ( JspSourceDependent ) tagIns ) . getDependants ( ) ) { parentPageInfo . addDependant ( dependant ) ; } } } catch ( Exception e ) { // ignore errors
} return tagClazz ; }


signature:
public class TagFileProcessor { /** * Implements a phase of the translation that compiles ( if necessary )
 * the tag files used in a JSP files . The directives in the tag files
 * are assumed to have been proccessed and encapsulated as TagFileInfo
 * in the CustomTag nodes . */
public void loadTagFiles ( Compiler compiler , Node . Nodes page ) throws JasperException { } }

implementation: tempVector = new ArrayList < Compiler > ( ) ; page . visit ( new TagFileLoaderVisitor ( compiler ) ) ;


signature:
public class TagFileProcessor { /** * Removed the java and class files for the tag prototype
 * generated from the current compilation .
 * @ param classFileName If non - null , remove only the class file with
 * with this name . */
public void removeProtoTypeFiles ( String classFileName ) { } }

implementation: Iterator < Compiler > iter = tempVector . iterator ( ) ; while ( iter . hasNext ( ) ) { Compiler c = iter . next ( ) ; if ( classFileName == null ) { c . removeGeneratedClassFiles ( ) ; } else if ( classFileName . equals ( c . getCompilationContext ( ) . getClassFileName ( ) ) ) { c . removeGeneratedClassFiles ( ) ; tempVector . remove ( c ) ; return ; } }


signature:
public class JspC { /** * END GlassFish 750 */
public static void main ( String arg [ ] ) { } }

implementation:
if ( arg . length == 0 ) { System . out . println ( Localizer . getMessage ( "jspc.usage" ) ) ; } else { JspC jspc = new JspC ( ) ; try { jspc . setArgs ( arg ) ; if ( jspc . helpNeeded ) { System . out . println ( Localizer . getMessage ( "jspc.usage" ) ) ; } else { jspc . execute ( ) ; } } catch ( JasperException je ) { System . err . println ( je ) ; // System . err . println ( je . getMessage ( ) ) ;
if ( jspc . getDieLevel ( ) != NO_DIE_LEVEL ) { System . exit ( jspc . getDieLevel ( ) ) ; } } }


signature:
public class JspC { /** * Base dir for the webapp . Used to generate class names and resolve
 * includes */
public void setUriroot ( String s ) { } }

implementation: uriRoot = s ; if ( s != null ) { try { uriRoot = new File ( s ) . getCanonicalPath ( ) ; } catch ( Exception ex ) { uriRoot = s ; } }


signature:
public class JspC { /** * Parses comma - separated list of JSP files to be processed .
 * < p > Each file is interpreted relative to uriroot , unless it is absolute ,
 * in which case it must start with uriroot .
 * @ param jspFiles Comma - separated list of JSP files to be processed */
public void setJspFiles ( String jspFiles ) { } }

implementation: StringTokenizer tok = new StringTokenizer ( jspFiles , " ," ) ; while ( tok . hasMoreTokens ( ) ) { pages . add ( tok . nextToken ( ) ) ; }


signature:
public class JspC { /** * Gets the list of JSP compilation errors caught during the most recent
 * invocation of this instance ' s < code > execute < / code > method when
 * failOnError has been set to FALSE .
 * Each error error in the list is represented by an instance of
 * org . apache . jasper . JasperException .
 * @ return List of JSP compilation errors caught during most recent
 * invocation of this instance ' s < code > execute < / code > method , or an empty
 * list if no errors were encountered or this instance ' s failOnError
 * property was set to TRUE */
public List < JasperException > getJSPCompilationErrors ( ) { } }

implementation: ArrayList < JasperException > ret = null ; Collection < JasperException > c = jspErrors . values ( ) ; if ( c != null ) { ret = new ArrayList < JasperException > ( ) ; Iterator < JasperException > it = c . iterator ( ) ; while ( it . hasNext ( ) ) { ret . add ( it . next ( ) ) ; } } return ret ;


signature:
public class JspC { /** * Include the generated web . xml inside the webapp ' s web . xml . */
protected void mergeIntoWebXml ( ) throws IOException { } }

implementation:
File webappBase = new File ( uriRoot ) ; File webXml = new File ( webappBase , "WEB-INF/web.xml" ) ; File webXml2 = new File ( webappBase , "WEB-INF/web2.xml" ) ; String insertStartMarker = Localizer . getMessage ( "jspc.webinc.insertStart" ) ; String insertEndMarker = Localizer . getMessage ( "jspc.webinc.insertEnd" ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( webXml ) , "UTF-8" ) ) ; BufferedReader fragmentReader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( webxmlFile ) , "UTF-8" ) ) ; PrintWriter writer = new PrintWriter ( new OutputStreamWriter ( new FileOutputStream ( webXml2 ) , "UTF-8" ) ) ; // Insert the < servlet > and < servlet - mapping > declarations
int pos = - 1 ; String line = null ; while ( true ) { line = reader . readLine ( ) ; if ( line == null ) { break ; } // Skip anything previously generated by JSPC
if ( line . indexOf ( insertStartMarker ) >= 0 ) { while ( true ) { line = reader . readLine ( ) ; if ( line == null ) { return ; } if ( line . indexOf ( insertEndMarker ) >= 0 ) { line = reader . readLine ( ) ; if ( line == null ) { return ; } break ; } } } for ( int i = 0 ; i < insertBefore . length ; i ++ ) { pos = line . indexOf ( insertBefore [ i ] ) ; if ( pos >= 0 ) break ; } if ( pos >= 0 ) { writer . println ( line . substring ( 0 , pos ) ) ; break ; } else { writer . println ( line ) ; } } writer . println ( insertStartMarker ) ; while ( true ) { String line2 = fragmentReader . readLine ( ) ; if ( line2 == null ) { writer . println ( ) ; break ; } writer . println ( line2 ) ; } writer . println ( insertEndMarker ) ; writer . println ( ) ; for ( int i = 0 ; i < pos ; i ++ ) { writer . print ( " " ) ; } if ( line != null ) { writer . println ( line . substring ( pos ) ) ; } while ( true ) { line = reader . readLine ( ) ; if ( line == null ) { break ; } writer . println ( line ) ; } writer . close ( ) ; reader . close ( ) ; fragmentReader . close ( ) ; FileInputStream fis = new FileInputStream ( webXml2 ) ; FileOutputStream fos = new FileOutputStream ( webXml ) ; byte buf [ ] = new byte [ 512 ] ; try { while ( true ) { int n = fis . read ( buf ) ; if ( n < 0 ) { break ; } fos . write ( buf , 0 , n ) ; } } finally { if ( fis != null ) { fis . close ( ) ; } if ( fos != null ) { fos . close ( ) ; } } webXml2 . delete ( ) ; ( new File ( webxmlFile ) ) . delete ( ) ;


signature:
public class JspC { /** * Locate all jsp files in the webapp . Used if no explicit
 * jsps are specified . */
public void scanFiles ( File base ) throws JasperException { } }

implementation: Stack < String > dirs = new Stack < String > ( ) ; dirs . push ( base . toString ( ) ) ; if ( extensions == null ) { extensions = new ArrayList < String > ( ) ; extensions . add ( "jsp" ) ; extensions . add ( "jspx" ) ; } while ( ! dirs . isEmpty ( ) ) { String s = dirs . pop ( ) ; File f = new File ( s ) ; if ( f . exists ( ) && f . isDirectory ( ) ) { String [ ] files = f . list ( ) ; String ext ; for ( int i = 0 ; ( files != null ) && i < files . length ; i ++ ) { File f2 = new File ( s , files [ i ] ) ; if ( f2 . isDirectory ( ) ) { dirs . push ( f2 . getPath ( ) ) ; } else { String path = f2 . getPath ( ) ; String uri = path . substring ( uriRoot . length ( ) ) ; ext = files [ i ] . substring ( files [ i ] . lastIndexOf ( '.' ) + 1 ) ; if ( extensions . contains ( ext ) || jspConfig . isJspPage ( uri ) ) { pages . add ( path ) ; } } } } }


signature:
public class JspC { /** * = = = = = Private utility methods = = = = = */
private String nextArg ( ) { } }

implementation: if ( ( argPos >= args . length ) || ( fullstop = SWITCH_FULL_STOP . equals ( args [ argPos ] ) ) ) { return null ; } else { return args [ argPos ++ ] ; }


signature:
public class JspC { /** * Initializes the classloader as / if needed for the given
 * compilation context .
 * @ param clctxt The compilation context
 * @ throws IOException If an error occurs */
private void initClassLoader ( JspCompilationContext clctxt ) throws IOException { } }

implementation:
classPath = getClassPath ( ) ; ClassLoader jspcLoader = getClass ( ) . getClassLoader ( ) ; // Turn the classPath into URLs
ArrayList < URL > urls = new ArrayList < URL > ( ) ; StringTokenizer tokenizer = new StringTokenizer ( classPath , File . pathSeparator ) ; while ( tokenizer . hasMoreTokens ( ) ) { String path = tokenizer . nextToken ( ) ; try { File libFile = new File ( path ) ; urls . add ( libFile . toURL ( ) ) ; } catch ( IOException ioe ) { // Failing a toCanonicalPath on a file that
// exists ( ) should be a JVM regression test ,
// therefore we have permission to freak uot
throw new RuntimeException ( ioe . toString ( ) ) ; } } File webappBase = new File ( uriRoot ) ; if ( webappBase . exists ( ) ) { File classes = new File ( webappBase , "/WEB-INF/classes" ) ; try { if ( classes . exists ( ) ) { classPath = classPath + File . pathSeparator + classes . getCanonicalPath ( ) ; urls . add ( classes . getCanonicalFile ( ) . toURL ( ) ) ; } } catch ( IOException ioe ) { // failing a toCanonicalPath on a file that
// exists ( ) should be a JVM regression test ,
// therefore we have permission to freak out
throw new RuntimeException ( ioe . toString ( ) ) ; } File lib = new File ( webappBase , "/WEB-INF/lib" ) ; if ( lib . exists ( ) && lib . isDirectory ( ) ) { String [ ] libs = lib . list ( ) ; for ( int i = 0 ; i < libs . length ; i ++ ) { if ( libs [ i ] . length ( ) < 5 ) continue ; String ext = libs [ i ] . substring ( libs [ i ] . length ( ) - 4 ) ; if ( ! ".jar" . equalsIgnoreCase ( ext ) ) { if ( ".tld" . equalsIgnoreCase ( ext ) ) { log . warning ( "TLD files should not be placed in /WEB-INF/lib" ) ; } continue ; } try { File libFile = new File ( lib , libs [ i ] ) ; classPath = classPath + File . pathSeparator + libFile . getCanonicalPath ( ) ; urls . add ( libFile . getCanonicalFile ( ) . toURL ( ) ) ; } catch ( IOException ioe ) { // failing a toCanonicalPath on a file that
// exists ( ) should be a JVM regression test ,
// therefore we have permission to freak out
throw new RuntimeException ( ioe . toString ( ) ) ; } } } } // What is this ? ?
urls . add ( new File ( clctxt . getRealPath ( "/" ) ) . getCanonicalFile ( ) . toURL ( ) ) ; URL urlsA [ ] = new URL [ urls . size ( ) ] ; urls . toArray ( urlsA ) ; /* SJSAS 6327357
 loader = new URLClassLoader ( urlsA , this . getClass ( ) . getClassLoader ( ) ) ; */
// START SJSAS 6327357
ClassLoader sysClassLoader = initSystemClassLoader ( ) ; if ( sysClassLoader != null ) { loader = new URLClassLoader ( urlsA , sysClassLoader ) ; } else { loader = new URLClassLoader ( urlsA , this . getClass ( ) . getClassLoader ( ) ) ; } // END SJSAS 6327357


signature:
public class JspC { /** * Find the WEB - INF dir by looking up in the directory tree .
 * This is used if no explicit docbase is set , but only files .
 * XXX Maybe we should require the docbase . */
private void locateUriRoot ( File f ) { } }

implementation:
String tUriBase = uriBase ; if ( tUriBase == null ) { tUriBase = "/" ; } try { if ( f . exists ( ) ) { f = new File ( f . getCanonicalPath ( ) ) ; while ( f != null ) { File g = new File ( f , "WEB-INF" ) ; if ( g . exists ( ) && g . isDirectory ( ) ) { uriRoot = f . getCanonicalPath ( ) ; uriBase = tUriBase ; if ( log . isLoggable ( Level . INFO ) ) { log . info ( Localizer . getMessage ( "jspc.implicit.uriRoot" , uriRoot ) ) ; } break ; } if ( f . exists ( ) && f . isDirectory ( ) ) { tUriBase = "/" + f . getName ( ) + "/" + tUriBase ; } String fParent = f . getParent ( ) ; if ( fParent == null ) { break ; } else { f = new File ( fParent ) ; } // If there is no acceptible candidate , uriRoot will
// remain null to indicate to the CompilerContext to
// use the current working / user dir .
} if ( uriRoot != null ) { File froot = new File ( uriRoot ) ; uriRoot = froot . getCanonicalPath ( ) ; } } } catch ( IOException ioe ) { // since this is an optional default and a null value
// for uriRoot has a non - error meaning , we can just
// pass straight through
}


signature:
public class JspC { /** * START SJSAS 6327357 */
private ClassLoader initSystemClassLoader ( ) throws IOException { } }

implementation: String sysClassPath = getSystemClassPath ( ) ; if ( sysClassPath == null ) { return null ; } ArrayList < URL > urls = new ArrayList < URL > ( ) ; StringTokenizer tokenizer = new StringTokenizer ( sysClassPath , File . pathSeparator ) ; while ( tokenizer . hasMoreTokens ( ) ) { urls . add ( new File ( tokenizer . nextToken ( ) ) . toURL ( ) ) ; } if ( urls . size ( ) == 0 ) { return null ; } URL urlsArray [ ] = new URL [ urls . size ( ) ] ; urls . toArray ( urlsArray ) ; return new URLClassLoader ( urlsArray , this . getClass ( ) . getClassLoader ( ) ) ;


signature:
public class JspC { /** * Purges all compilation errors related to JSP fragments . */
private void purgeJspFragmentErrors ( ) { } }

implementation: Iterator < String > it = dependents . iterator ( ) ; if ( it != null ) { while ( it . hasNext ( ) ) { jspErrors . remove ( it . next ( ) ) ; } }


signature:
public class HC4 { /** * Moves to the next byte , checks that there is enough available space ,
 * and possibly normalizes the hash tables and the hash chain .
 * @ return number of bytes available , including the current byte */
private int movePos ( ) { } }

implementation: int avail = movePos ( 4 , 4 ) ; if ( avail != 0 ) { if ( ++ lzPos == Integer . MAX_VALUE ) { int normalizationOffset = Integer . MAX_VALUE - cyclicSize ; hash . normalize ( normalizationOffset ) ; normalize ( chain , cyclicSize , normalizationOffset ) ; lzPos -= normalizationOffset ; } if ( ++ cyclicPos == cyclicSize ) cyclicPos = 0 ; } return avail ;


signature: public class ExpressionEvaluatorImpl { public Expression parseExpression ( String expression , Class expectedType , FunctionMapper fMapper ) throws ELException { } }

implementation: ExpressionFactory fac = ExpressionFactory . newInstance ( ) ; javax . el . ValueExpression expr ; ELContextImpl elContext = new ELContextImpl ( null ) ; javax . el . FunctionMapper fm = new FunctionMapperWrapper ( fMapper ) ; elContext . setFunctionMapper ( fm ) ; try { expr = fac . createValueExpression ( elContext , expression , expectedType ) ; } catch ( javax . el . ELException ex ) { throw new ELException ( ex ) ; } return new ExpressionImpl ( expr , pageContext ) ;


signature:
public class DeltaOptions { /** * Sets the delta distance in bytes . The new distance must be in
 * the range [ DISTANCE _ MIN , DISTANCE _ MAX ] . */
public void setDistance ( int distance ) throws UnsupportedOptionsException { } }

implementation: if ( distance < DISTANCE_MIN || distance > DISTANCE_MAX ) throw new UnsupportedOptionsException ( "Delta distance must be in the range [" + DISTANCE_MIN + ", " + DISTANCE_MAX + "]: " + distance ) ; this . distance = distance ;


signature:
public class JspReader { /** * search the stream for a match to a string
 * @ param string The string to match
 * @ return < strong > true < / strong > is one is found , the current position
 * in stream is positioned after the search string , < strong >
 * false < / strong > otherwise , position in stream unchanged . */
boolean matches ( String string ) throws JasperException { } }

implementation: Mark mark = mark ( ) ; int ch = 0 ; int i = 0 ; do { ch = nextChar ( ) ; if ( ( ( char ) ch ) != string . charAt ( i ++ ) ) { reset ( mark ) ; return false ; } } while ( i < string . length ( ) ) ; return true ;


signature:
public class JspReader { /** * Looks ahead to see if there are optional spaces followed by
 * the given String . If so , true is returned and those spaces and
 * characters are skipped . If not , false is returned and the
 * position is restored to where we were before . */
boolean matchesOptionalSpacesFollowedBy ( String s ) throws JasperException { } }

implementation: Mark mark = mark ( ) ; skipSpaces ( ) ; boolean result = matches ( s ) ; if ( ! result ) { reset ( mark ) ; } return result ;


signature:
public class JspReader { /** * Skip until the given string is matched in the stream .
 * When returned , the context is positioned past the end of the match .
 * @ param s The String to match .
 * @ return A non - null < code > Mark < / code > instance ( positioned immediately
 * before the search string ) if found , < strong > null < / strong >
 * otherwise . */
Mark skipUntil ( String limit ) throws JasperException { } }

implementation: Mark ret = null ; int limlen = limit . length ( ) ; int ch ; skip : for ( ret = mark ( ) , ch = nextChar ( ) ; ch != - 1 ; ret = mark ( ) , ch = nextChar ( ) ) { if ( ch == limit . charAt ( 0 ) ) { Mark restart = mark ( ) ; for ( int i = 1 ; i < limlen ; i ++ ) { if ( peekChar ( ) == limit . charAt ( i ) ) nextChar ( ) ; else { reset ( restart ) ; continue skip ; } } return ret ; } } return null ;


signature:
public class JspReader { /** * Skip until the given string is matched in the stream , but ignoring
 * chars initially escaped by a ' \ ' .
 * When returned , the context is positioned past the end of the match .
 * @ param s The String to match .
 * @ return A non - null < code > Mark < / code > instance ( positioned immediately
 * before the search string ) if found , < strong > null < / strong >
 * otherwise . */
Mark skipUntilIgnoreEsc ( String limit ) throws JasperException { } }

implementation:
Mark ret = null ; int limlen = limit . length ( ) ; int ch ; int prev = 'x' ; // Doesn ' t matter
skip : for ( ret = mark ( ) , ch = nextChar ( ) ; ch != - 1 ; ret = mark ( ) , prev = ch , ch = nextChar ( ) ) { if ( ch == '\\' && prev == '\\' ) { ch = 0 ; // Double \ is not an escape char anymore
} else if ( ch == limit . charAt ( 0 ) && prev != '\\' ) { for ( int i = 1 ; i < limlen ; i ++ ) { if ( peekChar ( ) == limit . charAt ( i ) ) nextChar ( ) ; else continue skip ; } return ret ; } } return null ;


signature:
public class JspReader { /** * Skip until the given end tag is matched in the stream .
 * When returned , the context is positioned past the end of the tag .
 * @ param tag The name of the tag whose ETag ( < / tag > ) to match .
 * @ return A non - null < code > Mark < / code > instance ( positioned immediately
 * before the ETag ) if found , < strong > null < / strong > otherwise . */
Mark skipUntilETag ( String tag ) throws JasperException { } }

implementation: Mark ret = skipUntil ( "</" + tag ) ; if ( ret != null ) { skipSpaces ( ) ; if ( nextChar ( ) != '>' ) ret = null ; } return ret ;


signature:
public class JspReader { /** * Parse a space delimited token .
 * If quoted the token will consume all characters up to a matching quote ,
 * otherwise , it consumes up to the first delimiter character .
 * @ param quoted If < strong > true < / strong > accept quoted strings . */
String parseToken ( boolean quoted ) throws JasperException { } }

implementation:
StringBuilder stringBuffer = new StringBuilder ( ) ; skipSpaces ( ) ; stringBuffer . setLength ( 0 ) ; if ( ! hasMoreInput ( ) ) { return "" ; } int ch = peekChar ( ) ; if ( quoted ) { if ( ch == '"' || ch == '\'' ) { char endQuote = ch == '"' ? '"' : '\'' ; // Consume the open quote :
ch = nextChar ( ) ; for ( ch = nextChar ( ) ; ch != - 1 && ch != endQuote ; ch = nextChar ( ) ) { if ( ch == '\\' ) ch = nextChar ( ) ; stringBuffer . append ( ( char ) ch ) ; } // Check end of quote , skip closing quote :
if ( ch == - 1 ) { err . jspError ( mark ( ) , "jsp.error.quotes.unterminated" ) ; } } else { err . jspError ( mark ( ) , "jsp.error.attr.quoted" ) ; } } else { if ( ! isDelimiter ( ) ) { // Read value until delimiter is found :
do { ch = nextChar ( ) ; // Take care of the quoting here .
if ( ch == '\\' ) { if ( peekChar ( ) == '"' || peekChar ( ) == '\'' || peekChar ( ) == '>' || peekChar ( ) == '%' ) ch = nextChar ( ) ; } stringBuffer . append ( ( char ) ch ) ; } while ( ! isDelimiter ( ) ) ; } } return stringBuffer . toString ( ) ;


signature:
public class JspReader { /** * Parse utils - Is current character a token delimiter ?
 * Delimiters are currently defined to be = , & gt ; , & lt ; , " , and ' or any
 * any space character as defined by < code > isSpace < / code > .
 * @ return A boolean . */
private boolean isDelimiter ( ) throws JasperException { } }

implementation:
if ( ! isSpace ( ) ) { int ch = peekChar ( ) ; // Look for a single - char work delimiter :
if ( ch == '=' || ch == '>' || ch == '"' || ch == '\'' || ch == '/' ) { return true ; } // Look for an end - of - comment or end - of - tag :
if ( ch == '-' ) { Mark mark = mark ( ) ; if ( ( ( ch = nextChar ( ) ) == '>' ) || ( ( ch == '-' ) && ( nextChar ( ) == '>' ) ) ) { reset ( mark ) ; return true ; } else { reset ( mark ) ; return false ; } } return false ; } else { return true ; }


signature:
public class JspReader { /** * Register a new source file .
 * This method is used to implement file inclusion . Each included file
 * gets a unique identifier ( which is the index in the array of source
 * files ) .
 * @ return The index of the now registered file . */
private int registerSourceFile ( String file ) { } }

implementation: if ( sourceFiles . contains ( file ) ) return - 1 ; sourceFiles . add ( file ) ; this . size ++ ; return sourceFiles . size ( ) - 1 ;


signature:
public class JspReader { /** * Unregister the source file .
 * This method is used to implement file inclusion . Each included file
 * gets a uniq identifier ( which is the index in the array of source
 * files ) .
 * @ return The index of the now registered file . */
private int unregisterSourceFile ( String file ) { } }

implementation: if ( ! sourceFiles . contains ( file ) ) return - 1 ; sourceFiles . remove ( file ) ; this . size -- ; return sourceFiles . size ( ) - 1 ;


signature:
public class JspReader { /** * Push a file ( and its associated Stream ) on the file stack . THe
 * current position in the current file is remembered . */
private void pushFile ( String file , String encoding , InputStreamReader reader ) throws JasperException , FileNotFoundException { } }

implementation:
// Register the file
String longName = file ; int fileid = registerSourceFile ( longName ) ; if ( fileid == - 1 ) { err . jspError ( "jsp.error.file.already.registered" , file ) ; } currFileId = fileid ; try { CharArrayWriter caw = new CharArrayWriter ( ) ; char buf [ ] = new char [ 1024 ] ; for ( int i = 0 ; ( i = reader . read ( buf ) ) != - 1 ; ) caw . write ( buf , 0 , i ) ; caw . close ( ) ; if ( current == null ) { current = new Mark ( this , caw . toCharArray ( ) , fileid , getFile ( fileid ) , master , encoding ) ; } else { current . pushStream ( caw . toCharArray ( ) , fileid , getFile ( fileid ) , longName , encoding ) ; } } catch ( Throwable ex ) { log . log ( Level . SEVERE , "Exception parsing file " , ex ) ; // Pop state being constructed :
popFile ( ) ; err . jspError ( "jsp.error.file.cannot.read" , file ) ; } finally { if ( reader != null ) { try { reader . close ( ) ; } catch ( Exception any ) { } } }


signature:
public class JspReader { /** * Pop a file from the file stack . The field " current " is retored
 * to the value to point to the previous files , if any , and is set
 * to null otherwise .
 * @ return true is there is a previous file on the stck .
 * false otherwise . */
private boolean popFile ( ) throws JasperException { } }

implementation:
// Is stack created ? ( will happen if the Jsp file we ' re looking at is
// missing .
if ( current == null || currFileId < 0 ) { return false ; } // Restore parser state :
String fName = getFile ( currFileId ) ; currFileId = unregisterSourceFile ( fName ) ; if ( currFileId < - 1 ) { err . jspError ( "jsp.error.file.not.registered" , fName ) ; } Mark previous = current . popStream ( ) ; if ( previous != null ) { master = current . baseDir ; current = previous ; return true ; } // Note that although the current file is undefined here , " current "
// is not set to null just for convience , for it maybe used to
// set the current ( undefined ) position .
return false ;


signature:
public class Coordinates { /** * Create an unclassified version of ourself
 * @ return either a new instance without a classifier , or the same instance
 * if it already is without a classifier */
public Coordinates makeUnclassified ( ) { } }

implementation: if ( this . classifier == null ) { return this ; } return new Coordinates ( this . groupId , this . artifactId , this . version , this . qualifiedVersion , null , this . extension ) ;


signature:
public class ControllerCall { /** * Add custom binders assigned to the method
 * Custom binders assigned to the method will be added to the binding
 * manager instance .
 * @ param manager
 * the manager to add binders to
 * @ param method
 * the method to evaluate for additional binders */
protected static void addMethodBinders ( final BindingManager manager , final Method method ) { } }

implementation: final ControllerBinder [ ] binders = method . getAnnotationsByType ( ControllerBinder . class ) ; if ( binders == null ) { return ; } for ( final ControllerBinder binder : binders ) { try { final Binder binderImpl = binder . value ( ) . newInstance ( ) ; if ( binderImpl instanceof ControllerBinderParametersAware ) { ( ( ControllerBinderParametersAware ) binderImpl ) . setParameters ( binder . parameters ( ) ) ; } manager . addBinder ( binderImpl ) ; } catch ( InstantiationException | IllegalAccessException e ) { manager . addBinder ( new ErrorBinder ( e ) ) ; } }


signature:
public class SmapStratum { /** * Returns the given stratum as a String : a StratumSection ,
 * followed by at least one FileSection and at least one LineSection . */
public String getString ( ) { } }

implementation:
// check state and initialize buffer
if ( fileNameList . size ( ) == 0 || lineData . size ( ) == 0 ) return null ; StringBuilder out = new StringBuilder ( ) ; // print StratumSection
out . append ( "*S " + stratumName + "\n" ) ; // print FileSection
out . append ( "*F\n" ) ; int bound = fileNameList . size ( ) ; for ( int i = 0 ; i < bound ; i ++ ) { if ( filePathList . get ( i ) != null ) { out . append ( "+ " + i + " " + fileNameList . get ( i ) + "\n" ) ; // Source paths must be relative , not absolute , so we
// remove the leading " / " , if one exists .
String filePath = filePathList . get ( i ) ; if ( filePath . startsWith ( "/" ) ) { filePath = filePath . substring ( 1 ) ; } out . append ( filePath + "\n" ) ; } else { out . append ( i + " " + fileNameList . get ( i ) + "\n" ) ; } } // print LineSection
out . append ( "*L\n" ) ; bound = lineData . size ( ) ; for ( int i = 0 ; i < bound ; i ++ ) { LineInfo li = lineData . get ( i ) ; out . append ( li . getString ( ) ) ; } return out . toString ( ) ;


signature:
public class JDTJavaCompiler { /** * Invoke CompilationResult # getProblems safely so that it works with
 * 3.1.1 and more recent versions of the eclipse java compiler .
 * See https : / / jsp . dev . java . net / issues / show _ bug . cgi ? id = 13
 * @ param result The compilation result .
 * @ return The same object than CompilationResult # getProblems */
private static final IProblem [ ] safeGetProblems ( CompilationResult result ) { } }

implementation:
if ( ! USE_INTROSPECTION_TO_INVOKE_GET_PROBLEM ) { try { return result . getProblems ( ) ; } catch ( NoSuchMethodError re ) { USE_INTROSPECTION_TO_INVOKE_GET_PROBLEM = true ; } } try { if ( GET_PROBLEM_METH == null ) { GET_PROBLEM_METH = result . getClass ( ) . getDeclaredMethod ( "getProblems" , new Class [ ] { } ) ; } // an array of a particular type can be casted into an array of a super type .
return ( IProblem [ ] ) GET_PROBLEM_METH . invoke ( result , null ) ; } catch ( Throwable e ) { if ( e instanceof RuntimeException ) { throw ( RuntimeException ) e ; } else { throw new RuntimeException ( e ) ; } }


signature:
public class LZMA2Options { /** * Sets the compression options to the given preset .
 * The presets 0-3 are fast presets with medium compression .
 * The presets 4-6 are fairly slow presets with high compression .
 * The default preset ( < code > PRESET _ DEFAULT < / code > ) is 6.
 * The presets 7-9 are like the preset 6 but use bigger dictionaries
 * and have higher compressor and decompressor memory requirements .
 * Unless the uncompressed size of the file exceeds 8 & nbsp ; MiB ,
 * 16 & nbsp ; MiB , or 32 & nbsp ; MiB , it is waste of memory to use the
 * presets 7 , 8 , or 9 , respectively .
 * @ throws UnsupportedOptionsException
 * < code > preset < / code > is not supported */
public void setPreset ( int preset ) throws UnsupportedOptionsException { } }

implementation: if ( preset < 0 || preset > 9 ) throw new UnsupportedOptionsException ( "Unsupported preset: " + preset ) ; lc = LC_DEFAULT ; lp = LP_DEFAULT ; pb = PB_DEFAULT ; dictSize = presetToDictSize [ preset ] ; if ( preset <= 3 ) { mode = MODE_FAST ; mf = MF_HC4 ; niceLen = preset <= 1 ? 128 : NICE_LEN_MAX ; depthLimit = presetToDepthLimit [ preset ] ; } else { mode = MODE_NORMAL ; mf = MF_BT4 ; niceLen = ( preset == 4 ) ? 16 : ( preset == 5 ) ? 32 : 64 ; depthLimit = 0 ; }


signature:
public class LZMA2Options { /** * Sets the dictionary size in bytes .
 * The dictionary ( or history buffer ) holds the most recently seen
 * uncompressed data . Bigger dictionary usually means better compression .
 * However , using a dictioanary bigger than the size of the uncompressed
 * data is waste of memory .
 * Any value in the range [ DICT _ SIZE _ MIN , DICT _ SIZE _ MAX ] is valid ,
 * but sizes of 2 ^ n and 2 ^ n & nbsp ; + & nbsp ; 2 ^ ( n - 1 ) bytes are somewhat
 * recommended .
 * @ throws UnsupportedOptionsException
 * < code > dictSize < / code > is not supported */
public void setDictSize ( int dictSize ) throws UnsupportedOptionsException { } }

implementation: if ( dictSize < DICT_SIZE_MIN ) throw new UnsupportedOptionsException ( "LZMA2 dictionary size must be at least 4 KiB: " + dictSize + " B" ) ; if ( dictSize > DICT_SIZE_MAX ) throw new UnsupportedOptionsException ( "LZMA2 dictionary size must not exceed " + ( DICT_SIZE_MAX >> 20 ) + " MiB: " + dictSize + " B" ) ; this . dictSize = dictSize ;


signature:
public class LZMA2Options { /** * Sets the number of literal context bits and literal position bits .
 * The sum of < code > lc < / code > and < code > lp < / code > is limited to 4.
 * Trying to exceed it will throw an exception . This function lets
 * you change both at the same time .
 * @ throws UnsupportedOptionsException
 * < code > lc < / code > and < code > lp < / code >
 * are invalid */
public void setLcLp ( int lc , int lp ) throws UnsupportedOptionsException { } }

implementation: if ( lc < 0 || lp < 0 || lc > LC_LP_MAX || lp > LC_LP_MAX || lc + lp > LC_LP_MAX ) throw new UnsupportedOptionsException ( "lc + lp must not exceed " + LC_LP_MAX + ": " + lc + " + " + lp ) ; this . lc = lc ; this . lp = lp ;


signature:
public class LZMA2Options { /** * Sets the number of position bits .
 * This affects what kind of alignment in the uncompressed data is
 * assumed in general . The default ( 2 ) means four - byte alignment
 * ( 2 ^ < code > pb < / code > = 2 ^ 2 = 4 ) , which is often a good choice when
 * there ' s no better guess .
 * When the alignment is known , setting the number of position bits
 * accordingly may reduce the file size a little . For example with text
 * files having one - byte alignment ( US - ASCII , ISO - 8859 - * , UTF - 8 ) , using
 * < code > setPb ( 0 ) < / code > can improve compression slightly . For UTF - 16
 * text , < code > setPb ( 1 ) < / code > is a good choice . If the alignment is
 * an odd number like 3 bytes , < code > setPb ( 0 ) < / code > might be the best
 * choice .
 * Even though the assumed alignment can be adjusted with
 * < code > setPb < / code > and < code > setLp < / code > , LZMA2 still slightly favors
 * 16 - byte alignment . It might be worth taking into account when designing
 * file formats that are likely to be often compressed with LZMA2.
 * @ throws UnsupportedOptionsException
 * < code > pb < / code > is invalid */
public void setPb ( int pb ) throws UnsupportedOptionsException { } }

implementation: if ( pb < 0 || pb > PB_MAX ) throw new UnsupportedOptionsException ( "pb must not exceed " + PB_MAX + ": " + pb ) ; this . pb = pb ;


signature:
public class LZMA2Options { /** * Sets the compression mode .
 * This specifies the method to analyze the data produced by
 * a match finder . The default is < code > MODE _ FAST < / code > for presets
 * 0-3 and < code > MODE _ NORMAL < / code > for presets 4-9.
 * Usually < code > MODE _ FAST < / code > is used with Hash Chain match finders
 * and < code > MODE _ NORMAL < / code > with Binary Tree match finders . This is
 * also what the presets do .
 * The special mode < code > MODE _ UNCOMPRESSED < / code > doesn ' t try to
 * compress the data at all ( and doesn ' t use a match finder ) and will
 * simply wrap it in uncompressed LZMA2 chunks .
 * @ throws UnsupportedOptionsException
 * < code > mode < / code > is not supported */
public void setMode ( int mode ) throws UnsupportedOptionsException { } }

implementation: if ( mode < MODE_UNCOMPRESSED || mode > MODE_NORMAL ) throw new UnsupportedOptionsException ( "Unsupported compression mode: " + mode ) ; this . mode = mode ;


signature:
public class LZMA2Options { /** * Sets the nice length of matches .
 * Once a match of at least < code > niceLen < / code > bytes is found ,
 * the algorithm stops looking for better matches . Higher values tend
 * to give better compression at the expense of speed . The default
 * depends on the preset .
 * @ throws UnsupportedOptionsException
 * < code > niceLen < / code > is invalid */
public void setNiceLen ( int niceLen ) throws UnsupportedOptionsException { } }

implementation: if ( niceLen < NICE_LEN_MIN ) throw new UnsupportedOptionsException ( "Minimum nice length of matches is " + NICE_LEN_MIN + " bytes: " + niceLen ) ; if ( niceLen > NICE_LEN_MAX ) throw new UnsupportedOptionsException ( "Maximum nice length of matches is " + NICE_LEN_MAX + ": " + niceLen ) ; this . niceLen = niceLen ;


signature:
public class LZMA2Options { /** * Sets the match finder type .
 * Match finder has a major effect on compression speed , memory usage ,
 * and compression ratio . Usually Hash Chain match finders are faster
 * than Binary Tree match finders . The default depends on the preset :
 * 0-3 use < code > MF _ HC4 < / code > and 4-9 use < code > MF _ BT4 < / code > .
 * @ throws UnsupportedOptionsException
 * < code > mf < / code > is not supported */
public void setMatchFinder ( int mf ) throws UnsupportedOptionsException { } }

implementation: if ( mf != MF_HC4 && mf != MF_BT4 ) throw new UnsupportedOptionsException ( "Unsupported match finder: " + mf ) ; this . mf = mf ;


signature:
public class LZMA2Options { /** * Gets how much memory the LZMA2 decoder will need to decompress the data
 * that was encoded with these options and stored in a . xz file .
 * The returned value may bigger than the value returned by a direct call
 * to { @ link LZMA2InputStream # getMemoryUsage ( int ) } if the dictionary size
 * is not 2 ^ n or 2 ^ n & nbsp ; + & nbsp ; 2 ^ ( n - 1 ) bytes . This is because the . xz
 * headers store the dictionary size in such a format and other values
 * are rounded up to the next such value . Such rounding is harmess except
 * it might waste some memory if an unsual dictionary size is used .
 * If you use raw LZMA2 streams and unusual dictioanary size , call
 * { @ link LZMA2InputStream # getMemoryUsage } directly to get raw decoder
 * memory requirements . */
public int getDecoderMemoryUsage ( ) { } }

implementation:
// Round the dictionary size up to the next 2 ^ n or 2 ^ n + 2 ^ ( n - 1 ) .
int d = dictSize - 1 ; d |= d >>> 2 ; d |= d >>> 3 ; d |= d >>> 4 ; d |= d >>> 8 ; d |= d >>> 16 ; return LZMA2InputStream . getMemoryUsage ( d + 1 ) ;


signature:
public class ErrorDispatcher { /** * Dispatches the given JSP parse error to the configured error handler .
 * @ param where Error location
 * @ param e The exception whose message is used as the error message */
public void jspError ( Mark where , Exception e ) throws JasperException { } }

implementation: dispatch ( where , e . getMessage ( ) , null , e ) ;


signature:
public class ErrorDispatcher { /** * Dispatches the given JSP parse error to the configured error handler .
 * The given error code is localized . If it is not found in the
 * resource bundle for localized error messages , it is used as the error
 * message .
 * @ param errCode Error code
 * @ param args Arguments for parametric replacement */
public void jspError ( String errCode , String ... args ) throws JasperException { } }

implementation: dispatch ( null , errCode , args , null ) ;


signature:
public class ErrorDispatcher { /** * Dispatches the given JSP parse error to the configured error handler .
 * The given error code is localized . If it is not found in the
 * resource bundle for localized error messages , it is used as the error
 * message .
 * @ param where Error location
 * @ param errCode Error code
 * @ param args Arguments for parametric replacement */
public void jspError ( Mark where , String errCode , String ... args ) throws JasperException { } }

implementation: dispatch ( where , errCode , args , null ) ;


signature:
public class ErrorDispatcher { /** * Dispatches the given JSP parse error to the configured error handler .
 * The given error code is localized . If it is not found in the
 * resource bundle for localized error messages , it is used as the error
 * message .
 * @ param n Node that caused the error
 * @ param errCode Error code
 * @ param args Arguments for parametric replacement */
public void jspError ( Node n , String errCode , String ... args ) throws JasperException { } }

implementation: dispatch ( n . getStart ( ) , errCode , args , null ) ;


signature:
public class ErrorDispatcher { /** * Dispatches the given JSP parse error to the configured error handler .
 * The given error code is localized . If it is not found in the
 * resource bundle for localized error messages , it is used as the error
 * message .
 * @ param errCode Error code
 * @ param arg Argument for parametric replacement
 * @ param e Parsing exception */
public void jspError ( String errCode , String arg , Exception e ) throws JasperException { } }

implementation: dispatch ( null , errCode , new Object [ ] { arg } , e ) ;


signature:
public class ErrorDispatcher { /** * Dispatches the given JSP parse error to the configured error handler .
 * The given error code is localized . If it is not found in the
 * resource bundle for localized error messages , it is used as the error
 * message .
 * @ param n Node that caused the error
 * @ param errCode Error code
 * @ param arg Argument for parametric replacement
 * @ param e Parsing exception */
public void jspError ( Node n , String errCode , String arg , Exception e ) throws JasperException { } }

implementation: dispatch ( n . getStart ( ) , errCode , new Object [ ] { arg } , e ) ;


signature:
public class ErrorDispatcher { /** * Creates and throws a new exception from the given JasperException ,
 * by prepending the given location information ( containing file name ,
 * line number , and column number ) to the message of the given exception ,
 * and copying the stacktrace of the given exception to the new exception .
 * @ param where The location information ( containing file name ,
 * line number , and column number ) to prepend
 * @ param je The JasperException to amend */
public void throwException ( Mark where , JasperException je ) throws JasperException { } }

implementation:
if ( where == null ) { throw je ; } // Get file location
String file = null ; if ( jspcMode ) { // Get the full URL of the resource that caused the error
try { file = where . getURL ( ) . toString ( ) ; } catch ( MalformedURLException me ) { // Fallback to using context - relative path
file = where . getFile ( ) ; } } else { // Get the context - relative resource path , so as to not
// disclose any local filesystem details
file = where . getFile ( ) ; } JasperException newEx = new JasperException ( file + "(" + where . getLineNumber ( ) + "," + where . getColumnNumber ( ) + ")" + " " + je . getMessage ( ) , je . getCause ( ) ) ; newEx . setStackTrace ( je . getStackTrace ( ) ) ; throw newEx ;


signature:
public class ErrorDispatcher { /** * Dispatches the given compilation error report and exception to the
 * configured error handler .
 * @ param errorReport Compilation error report
 * @ param e Compilation exception */
public void javacError ( String errorReport , Exception e ) throws JasperException { } }

implementation: errHandler . javacError ( errorReport , e ) ;


signature:
public class ErrorDispatcher { /** * Dispatches the given JSP parse error to the configured error handler .
 * The given error code is localized . If it is not found in the
 * resource bundle for localized error messages , it is used as the error
 * message .
 * @ param where Error location
 * @ param errCode Error code
 * @ param args Arguments for parametric replacement
 * @ param e Parsing exception */
private void dispatch ( Mark where , String errCode , Object [ ] args , Exception e ) throws JasperException { } }

implementation:
String file = null ; String errMsg = null ; int line = - 1 ; int column = - 1 ; boolean hasLocation = false ; // Localize
if ( errCode != null ) { errMsg = Localizer . getMessage ( errCode , args ) ; } else if ( e != null ) { // give a hint about what ' s wrong
errMsg = e . getMessage ( ) ; } // Get error location
if ( where != null ) { if ( jspcMode ) { // Get the full URL of the resource that caused the error
try { file = where . getURL ( ) . toString ( ) ; } catch ( MalformedURLException me ) { // Fallback to using context - relative path
file = where . getFile ( ) ; } } else { // Get the context - relative resource path , so as to not
// disclose any local filesystem details
file = where . getFile ( ) ; } line = where . getLineNumber ( ) ; column = where . getColumnNumber ( ) ; hasLocation = true ; } // Get nested exception
Exception nestedEx = e ; if ( ( e instanceof SAXException ) && ( ( ( SAXException ) e ) . getException ( ) != null ) ) { nestedEx = ( ( SAXException ) e ) . getException ( ) ; } if ( hasLocation ) { errHandler . jspError ( file , line , column , errMsg , nestedEx ) ; } else { errHandler . jspError ( errMsg , nestedEx ) ; }


signature:
public class ErrorDispatcher { /** * Parses the given Java compilation error message , which may contain one
 * or more compilation errors , into an array of JavacErrorDetail instances .
 * Each JavacErrorDetail instance contains the information about a single
 * compilation error .
 * @ param errMsg Compilation error message that was generated by the
 * javac compiler
 * @ param fname Name of Java source file whose compilation failed
 * @ return Array of JavacErrorDetail instances corresponding to the
 * compilation errors , or null if the given error message does not
 * contain any compilation error line numbers */
public static JavacErrorDetail [ ] parseJavacMessage ( Node . Nodes pageNodes , String errMsg , String fname ) throws IOException , JasperException { } }

implementation:
ArrayList < JavacErrorDetail > errors = new ArrayList < JavacErrorDetail > ( ) ; StringBuilder errMsgBuf = null ; int lineNum = - 1 ; JavacErrorDetail javacError = null ; BufferedReader reader = new BufferedReader ( new StringReader ( errMsg ) ) ; /* * Parse compilation errors . Each compilation error consists of a file
 * path and error line number , followed by a number of lines describing
 * the error . */
String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { /* * Error line number is delimited by set of colons .
 * Ignore colon following drive letter on Windows ( fromIndex = 2 ) .
 * XXX Handle deprecation warnings that don ' t have line info */
int beginColon = line . indexOf ( ':' , 2 ) ; int endColon = line . indexOf ( ':' , beginColon + 1 ) ; if ( ( beginColon >= 0 ) && ( endColon >= 0 ) ) { if ( javacError != null ) { // add previous error to error vector
errors . add ( javacError ) ; } String lineNumStr = line . substring ( beginColon + 1 , endColon ) ; try { lineNum = Integer . parseInt ( lineNumStr ) ; } catch ( NumberFormatException e ) { // XXX
} errMsgBuf = new StringBuilder ( ) ; javacError = createJavacError ( fname , pageNodes , errMsgBuf , lineNum ) ; } // Ignore messages preceding first error
if ( errMsgBuf != null ) { errMsgBuf . append ( line ) ; errMsgBuf . append ( "\n" ) ; } } // Add last error to error vector
if ( javacError != null ) { errors . add ( javacError ) ; } reader . close ( ) ; return errors . toArray ( new JavacErrorDetail [ 0 ] ) ;


signature:
public class AspectInformation { /** * Filter the provided aspect lists by a predicate on the ID
 * @ param list
 * the list to filter
 * @ param predicate
 * the ID predicate
 * @ return the filtered list , returns only < code > null < / code > when the list
 * was < code > null < / code > */
public static List < AspectInformation > filterIds ( final List < AspectInformation > list , final Predicate < String > predicate ) { } }

implementation: if ( list == null ) { return null ; } return list . stream ( ) . filter ( ( i ) -> predicate . test ( i . getFactoryId ( ) ) ) . collect ( Collectors . toList ( ) ) ;


signature:
public class AspectInformation { /** * Get all aspect ids which are currently missing but required by this
 * aspect
 * @ param assignedAspects
 * the aspects which are considered assigned
 * @ return A possibly empty , array of all missing but required aspects .
 * Never returns < code > null < / code > */
public String [ ] getMissingIds ( final List < AspectInformation > assignedAspects ) { } }

implementation: final Set < AspectInformation > required = new HashSet < > ( ) ; addRequired ( required , this , assignedAspects ) ; return required . stream ( ) . map ( AspectInformation :: getFactoryId ) . toArray ( size -> new String [ size ] ) ;


signature:
public class ParserUtils { /** * Sets the path prefix URL for . xsd resources */
public static void setSchemaResourcePrefix ( String prefix ) { } }

implementation: if ( prefix != null && prefix . startsWith ( "file:" ) ) { schemaResourcePrefix = uencode ( prefix ) ; isSchemaResourcePrefixFileUrl = true ; } else { schemaResourcePrefix = prefix ; isSchemaResourcePrefixFileUrl = false ; } for ( int i = 0 ; i < CACHED_SCHEMA_RESOURCE_PATHS . length ; i ++ ) { String path = DEFAULT_SCHEMA_RESOURCE_PATHS [ i ] ; int index = path . lastIndexOf ( '/' ) ; if ( index != - 1 ) { CACHED_SCHEMA_RESOURCE_PATHS [ i ] = schemaResourcePrefix + path . substring ( index + 1 ) ; } }


signature:
public class ParserUtils { /** * Sets the path prefix URL for . dtd resources */
public static void setDtdResourcePrefix ( String prefix ) { } }

implementation: if ( prefix != null && prefix . startsWith ( "file:" ) ) { dtdResourcePrefix = uencode ( prefix ) ; isDtdResourcePrefixFileUrl = true ; } else { dtdResourcePrefix = prefix ; isDtdResourcePrefixFileUrl = false ; } for ( int i = 0 ; i < CACHED_DTD_RESOURCE_PATHS . length ; i ++ ) { String path = DEFAULT_DTD_RESOURCE_PATHS [ i ] ; int index = path . lastIndexOf ( '/' ) ; if ( index != - 1 ) { CACHED_DTD_RESOURCE_PATHS [ i ] = dtdResourcePrefix + path . substring ( index + 1 ) ; } }


signature:
public class ParserUtils { /** * END PWC 6386258 */
private static String uencode ( String prefix ) { } }

implementation: if ( prefix != null && prefix . startsWith ( "file:" ) ) { StringTokenizer tokens = new StringTokenizer ( prefix , "/\\:" , true ) ; StringBuilder stringBuilder = new StringBuilder ( ) ; while ( tokens . hasMoreElements ( ) ) { String token = tokens . nextToken ( ) ; if ( "/" . equals ( token ) || "\\" . equals ( token ) || ":" . equals ( token ) ) { stringBuilder . append ( token ) ; } else { try { stringBuilder . append ( URLEncoder . encode ( token , "UTF-8" ) ) ; } catch ( java . io . UnsupportedEncodingException ex ) { } } } return stringBuilder . toString ( ) ; } else { return prefix ; }


signature:
public class ParserUtils { /** * Parse the specified XML document , and return a < code > TreeNode < / code >
 * that corresponds to the root node of the document tree .
 * @ param uri URI of the XML document being parsed
 * @ param is Input source containing the deployment descriptor
 * @ exception JasperException if an I / O or parsing error has occurred */
public TreeNode parseXMLDocument ( String uri , InputSource is ) throws JasperException { } }

implementation: return parseXMLDocument ( uri , is , false ) ;


signature:
public class ParserUtils { /** * Parse the specified XML document , and return a < code > TreeNode < / code >
 * that corresponds to the root node of the document tree .
 * @ param uri URI of the XML document being parsed
 * @ param is Input source containing the deployment descriptor
 * @ param validate true if the XML document needs to be validated against
 * its DTD or schema , false otherwise
 * @ exception JasperException if an I / O or parsing error has occurred */
public TreeNode parseXMLDocument ( String uri , InputSource is , boolean validate ) throws JasperException { } }

implementation:
Document document = null ; // Perform an XML parse of this document , via JAXP
// START 6412405
ClassLoader currentLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; Thread . currentThread ( ) . setContextClassLoader ( getClass ( ) . getClassLoader ( ) ) ; // END 6412405
try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; /* See CR 6399139
 factory . setFeature (
 " http : / / apache . org / xml / features / validation / dynamic " ,
 true ) ; */
DocumentBuilder builder = factory . newDocumentBuilder ( ) ; builder . setEntityResolver ( entityResolver ) ; builder . setErrorHandler ( errorHandler ) ; document = builder . parse ( is ) ; document . setDocumentURI ( uri ) ; if ( validate ) { Schema schema = getSchema ( document ) ; if ( schema != null ) { // Validate TLD against specified schema
schema . newValidator ( ) . validate ( new DOMSource ( document ) ) ; } /* See CR 6399139
 else {
 log . warning ( Localizer . getMessage (
 " jsp . warning . dtdValidationNotSupported " ) ) ; */
} } catch ( ParserConfigurationException ex ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.xml" , uri ) , ex ) ; } catch ( SAXParseException ex ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.xml.line" , uri , Integer . toString ( ex . getLineNumber ( ) ) , Integer . toString ( ex . getColumnNumber ( ) ) ) , ex ) ; } catch ( SAXException sx ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.xml" , uri ) , sx ) ; } catch ( IOException io ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.xml" , uri ) , io ) ; // START 6412405
} finally { Thread . currentThread ( ) . setContextClassLoader ( currentLoader ) ; } // END 6412405
// Convert the resulting document to a graph of TreeNodes
return ( convert ( null , document . getDocumentElement ( ) ) ) ;


signature:
public class ParserUtils { /** * Create and return a TreeNode that corresponds to the specified Node ,
 * including processing all of the attributes and children nodes .
 * @ param parent The parent TreeNode ( if any ) for the new TreeNode
 * @ param node The XML document Node to be converted */
protected TreeNode convert ( TreeNode parent , Node node ) { } }

implementation:
// Construct a new TreeNode for this node
TreeNode treeNode = new TreeNode ( node . getNodeName ( ) , parent ) ; // Convert all attributes of this node
NamedNodeMap attributes = node . getAttributes ( ) ; if ( attributes != null ) { int n = attributes . getLength ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Node attribute = attributes . item ( i ) ; treeNode . addAttribute ( attribute . getNodeName ( ) , attribute . getNodeValue ( ) ) ; } } // Create and attach all children of this node
NodeList children = node . getChildNodes ( ) ; if ( children != null ) { int n = children . getLength ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Node child = children . item ( i ) ; if ( child instanceof Comment ) continue ; if ( child instanceof Text ) { String body = ( ( Text ) child ) . getData ( ) ; if ( body != null ) { body = body . trim ( ) ; if ( body . length ( ) > 0 ) treeNode . setBody ( body ) ; } } else { TreeNode treeChild = convert ( treeNode , child ) ; } } } // Return the completed TreeNode graph
return ( treeNode ) ;


signature:
public class ParserUtils { /** * Gets the compiled schema referenced by the given XML document .
 * @ param document The XML document to validate
 * @ return The schema against which to validate */
private static Schema getSchema ( Document document ) throws SAXException , JasperException { } }

implementation: Schema schema = null ; Element root = document . getDocumentElement ( ) ; NamedNodeMap map = root . getAttributes ( ) ; for ( int i = 0 ; map != null && i < map . getLength ( ) ; i ++ ) { if ( SCHEMA_LOCATION_ATTR . equals ( map . item ( i ) . getLocalName ( ) ) ) { String schemaLocation = map . item ( i ) . getNodeValue ( ) ; if ( Constants . SCHEMA_LOCATION_JSP_20 . equals ( schemaLocation ) ) { schema = getSchema ( Constants . TAGLIB_SCHEMA_PUBLIC_ID_20 ) ; break ; } else if ( Constants . SCHEMA_LOCATION_JSP_21 . equals ( schemaLocation ) ) { schema = getSchema ( Constants . TAGLIB_SCHEMA_PUBLIC_ID_21 ) ; break ; } else if ( Constants . SCHEMA_LOCATION_WEBAPP_24 . equals ( schemaLocation ) ) { schema = getSchema ( Constants . WEBAPP_SCHEMA_PUBLIC_ID_24 ) ; break ; } else if ( Constants . SCHEMA_LOCATION_WEBAPP_25 . equals ( schemaLocation ) ) { schema = getSchema ( Constants . WEBAPP_SCHEMA_PUBLIC_ID_25 ) ; break ; } else { throw new JasperException ( Localizer . getMessage ( "jsp.error.parse.unknownTldSchemaLocation" , document . getDocumentURI ( ) , map . item ( i ) . getNodeValue ( ) ) ) ; } } } return schema ;


signature:
public class ParserUtils { /** * Gets the compiled schema for the given schema public id .
 * @ param schemaPublicId The public id for which to get the schema
 * ( e . g . , web - jsptaglibrary _ 2_0 . xsd )
 * @ return The compiled schema */
private static Schema getSchema ( String schemaPublicId ) throws SAXException { } }

implementation: Schema schema = schemaCache . get ( schemaPublicId ) ; if ( schema == null ) { synchronized ( schemaCache ) { schema = schemaCache . get ( schemaPublicId ) ; if ( schema == null ) { SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; schemaFactory . setResourceResolver ( new MyLSResourceResolver ( ) ) ; schemaFactory . setErrorHandler ( new MyErrorHandler ( ) ) ; String path = schemaPublicId ; if ( schemaResourcePrefix != null ) { int index = schemaPublicId . lastIndexOf ( '/' ) ; if ( index != - 1 ) { path = schemaPublicId . substring ( index + 1 ) ; } path = schemaResourcePrefix + path ; } InputStream input = null ; if ( isSchemaResourcePrefixFileUrl ) { try { File f = new File ( new URI ( path ) ) ; if ( f . exists ( ) ) { input = new FileInputStream ( f ) ; } } catch ( Exception e ) { throw new SAXException ( e ) ; } } else { input = ParserUtils . class . getResourceAsStream ( path ) ; } if ( input == null ) { throw new SAXException ( Localizer . getMessage ( "jsp.error.internal.filenotfound" , schemaPublicId ) ) ; } schema = schemaFactory . newSchema ( new StreamSource ( input ) ) ; schemaCache . put ( schemaPublicId , schema ) ; } } } return schema ;


signature:
public class BindingManager { /** * Create a new BindingManager with default binders
 * This call creates a new BindingManager instance and add the following
 * binders :
 * < ul >
 * < li > { @ link MapBinder } < / li >
 * < li > { @ link BindingManagerBinder } < / li >
 * < / ul >
 * @ param data
 * the initial data for the MapBinder
 * @ return
 * a new binder manager instance */
public static final BindingManager create ( final Map < String , Object > data ) { } }

implementation: final BindingManager result = new BindingManager ( ) ; result . addBinder ( new MapBinder ( data ) ) ; result . addBinder ( new BindingManagerBinder ( ) ) ; return result ;


signature:
public class BindingManager { /** * Merge all errors of this binding into this result
 * @ param binding
 * the binding to merge
 * @ param result
 * the result to merge into */
private static void mergeErrors ( final BindingResult bindingResult , final BindingResult result ) { } }

implementation: if ( bindingResult == null ) { return ; } result . addErrors ( bindingResult . getLocalErrors ( ) ) ; for ( final Map . Entry < String , BindingResult > child : bindingResult . getChildren ( ) . entrySet ( ) ) { mergeErrors ( child . getValue ( ) , result . getChildOrAdd ( child . getKey ( ) ) ) ; }


signature:
public class BindingManager { /** * Add a new binder
 * If the binder has to be initialized then all methods annotated with
 * { @ link Initializer } will be called .
 * @ param binder
 * the binder to add
 * @ param initializeBinder
 * whether the binder will be initialized */
public void addBinder ( final Binder binder , final boolean initializeBinder ) { } }

implementation: if ( initializeBinder ) { initializeBinder ( binder ) ; } this . binders . add ( binder ) ;


signature:
public class BindingManager { /** * Initialize the binder with our current state
 * @ param binder
 * the binder to initialize */
private void initializeBinder ( final Binder binder ) { } }

implementation: for ( final Method m : binder . getClass ( ) . getMethods ( ) ) { if ( ! m . isAnnotationPresent ( Binder . Initializer . class ) ) { continue ; } final Call call = bind ( m , binder ) ; try { call . invoke ( ) ; } catch ( final Exception e ) { throw new RuntimeException ( String . format ( "Failed to initialze binder: %s # %s" , binder , m ) , e ) ; } }


signature:
public class ChannelAspectProcessor { /** * This actively scans for available aspects and returns their information
 * objects
 * @ param context
 * the context to use
 * @ return the result map , never returns < code > null < / code > */
public static Map < String , ChannelAspectInformation > scanAspectInformations ( final BundleContext context ) { } }

implementation:
Collection < ServiceReference < ChannelAspectFactory > > refs ; try { refs = context . getServiceReferences ( ChannelAspectFactory . class , null ) ; } catch ( final InvalidSyntaxException e ) { // this should never happen since we don ' t specific a filter
return Collections . emptyMap ( ) ; } if ( refs == null ) { return Collections . emptyMap ( ) ; } final Map < String , ChannelAspectInformation > result = new HashMap < > ( refs . size ( ) ) ; for ( final ServiceReference < ChannelAspectFactory > ref : refs ) { final ChannelAspectInformation info = makeInformation ( ref ) ; result . put ( info . getFactoryId ( ) , info ) ; } return result ;


signature:
public class SmapUtil { /** * Generates an appropriate SMAP representing the current compilation
 * context . ( JSR - 045 . )
 * @ param ctxt Current compilation context
 * @ param pageNodes The current JSP page
 * @ return a SMAP for the page */
public void generateSmap ( Node . Nodes pageNodes ) throws IOException { } }

implementation:
classInfos = new ArrayList < ClassInfo > ( ) ; String className = ctxt . getFullClassName ( ) ; // Instantiate a SmapStratum for the main JSP page .
SmapStratum s = new SmapStratum ( "JSP" ) ; classInfos . add ( new ClassInfo ( className , s ) ) ; // Map out Node . Nodes and putting LineInfo into SmapStratum
evaluateNodes ( pageNodes , s , ctxt . getOptions ( ) . getMappedFile ( ) ) ; String classFileName = ctxt . getClassFileName ( ) ; for ( ClassInfo entry : classInfos ) { // Get SmapStratum
s = entry . getSmapStratum ( ) ; s . optimizeLineSection ( ) ; // Set up our SMAP generator
SmapGenerator g = new SmapGenerator ( ) ; g . setOutputFileName ( unqualify ( ctxt . getServletJavaFileName ( ) ) ) ; g . addStratum ( s , true ) ; String name = entry . getClassName ( ) ; // class name
// Compute the class name and output file name for inner classes
if ( ! className . equals ( name ) ) { classFileName = ctxt . getOutputDir ( ) + name . substring ( name . lastIndexOf ( '.' ) + 1 ) + ".class" ; } entry . setClassFileName ( classFileName ) ; entry . setSmap ( g . getString ( ) ) ; if ( ctxt . getOptions ( ) . isSmapDumped ( ) ) { File outSmap = new File ( classFileName + ".smap" ) ; PrintWriter so = new PrintWriter ( new OutputStreamWriter ( new FileOutputStream ( outSmap ) , SMAP_ENCODING ) ) ; so . print ( g . getString ( ) ) ; so . close ( ) ; } }


signature:
public class SmapUtil { /** * Returns an unqualified version of the given file path . */
private static String unqualify ( String path ) { } }

implementation: path = path . replace ( '\\' , '/' ) ; return path . substring ( path . lastIndexOf ( '/' ) + 1 ) ;


signature:
public class TagPluginManager { /** * Invoke tag plugin for the given custom tag , if a plugin exists for
 * the custom tag ' s tag handler .
 * The given custom tag node will be manipulated by the plugin . */
private void invokePlugin ( Node . CustomTag n ) { } }

implementation: TagPlugin tagPlugin = tagPlugins . get ( n . getTagHandlerClass ( ) . getName ( ) ) ; if ( tagPlugin == null ) { return ; } TagPluginContext tagPluginContext = new TagPluginContextImpl ( n , pageInfo ) ; n . setTagPluginContext ( tagPluginContext ) ; tagPlugin . doTag ( tagPluginContext ) ;


signature:
public class BasicArrayCache { /** * Gets { @ code T [ size ] } from the given { @ code cache } .
 * If no such array is found , { @ code null } is returned . */
private static < T > T getArray ( CacheMap < T > cache , int size ) { } }

implementation:
// putArray doesn ' t add small arrays to the cache and so it ' s
// pointless to look for small arrays here .
if ( size < CACHEABLE_SIZE_MIN ) return null ; // Try to find a stack that holds arrays of T [ size ] .
CyclicStack < Reference < T > > stack ; synchronized ( cache ) { stack = cache . get ( size ) ; } if ( stack == null ) return null ; // Try to find a non - cleared Reference from the stack .
T array ; do { Reference < T > r = stack . pop ( ) ; if ( r == null ) return null ; array = r . get ( ) ; } while ( array == null ) ; return array ;


signature:
public class BasicArrayCache { /** * Puts the { @ code array } of { @ code size } elements long into
 * the { @ code cache } . */
private static < T > void putArray ( CacheMap < T > cache , T array , int size ) { } }

implementation:
// Small arrays aren ' t cached .
if ( size < CACHEABLE_SIZE_MIN ) return ; CyclicStack < Reference < T > > stack ; synchronized ( cache ) { // Get a stack that holds arrays of T [ size ] . If no such stack
// exists , allocate a new one . If the cache already had STACKS _ MAX
// number of stacks , the least recently used stack is removed by
// cache . put ( it calls removeEldestEntry ) .
stack = cache . get ( size ) ; if ( stack == null ) { stack = new CyclicStack < Reference < T > > ( ) ; cache . put ( size , stack ) ; } } stack . push ( new SoftReference < T > ( array ) ) ;


signature:
public class BasicArrayCache { /** * Allocates a new byte array , hopefully reusing an existing
 * array from the cache .
 * @ param size size of the array to allocate
 * @ param fillWithZeros
 * if true , all the elements of the returned
 * array will be zero ; if false , the contents
 * of the returned array is undefined */
public byte [ ] getByteArray ( int size , boolean fillWithZeros ) { } }

implementation: byte [ ] array = getArray ( byteArrayCache , size ) ; if ( array == null ) array = new byte [ size ] ; else if ( fillWithZeros ) Arrays . fill ( array , ( byte ) 0x00 ) ; return array ;


signature:
public class BasicArrayCache { /** * This is like getByteArray but for int arrays . */
public int [ ] getIntArray ( int size , boolean fillWithZeros ) { } }

implementation: int [ ] array = getArray ( intArrayCache , size ) ; if ( array == null ) array = new int [ size ] ; else if ( fillWithZeros ) Arrays . fill ( array , 0 ) ; return array ;


signature:
public class AetherImporter { /** * Prepare an import with dependencies
 * This method does resolve even transient dependencies and also adds the
 * sources if requested */
public static AetherResult prepareDependencies ( final Path tmpDir , final ImportConfiguration cfg ) throws RepositoryException { } }

implementation:
Objects . requireNonNull ( tmpDir ) ; Objects . requireNonNull ( cfg ) ; final RepositoryContext ctx = new RepositoryContext ( tmpDir , cfg . getRepositoryUrl ( ) , cfg . isAllOptional ( ) ) ; // add all coordinates
final CollectRequest cr = new CollectRequest ( ) ; cr . setRepositories ( ctx . getRepositories ( ) ) ; for ( final MavenCoordinates coords : cfg . getCoordinates ( ) ) { final Dependency dep = new Dependency ( new DefaultArtifact ( coords . toString ( ) ) , COMPILE ) ; cr . addDependency ( dep ) ; } final DependencyFilter filter = DependencyFilterUtils . classpathFilter ( COMPILE ) ; final DependencyRequest deps = new DependencyRequest ( cr , filter ) ; // resolve
final DependencyResult dr = ctx . getSystem ( ) . resolveDependencies ( ctx . getSession ( ) , deps ) ; final List < ArtifactResult > arts = dr . getArtifactResults ( ) ; if ( ! cfg . isIncludeSources ( ) ) { // we are already done here
return asResult ( arts , cfg , of ( dr ) ) ; } // resolve sources
final List < ArtifactRequest > requests = extendRequests ( arts . stream ( ) . map ( ArtifactResult :: getRequest ) , ctx , cfg ) ; return asResult ( resolve ( ctx , requests ) , cfg , of ( dr ) ) ;


signature:
public class AetherImporter { /** * Prepare a plain import process
 * Prepare a simple import request with a specific list of coordinates */
public static AetherResult preparePlain ( final Path tmpDir , final ImportConfiguration cfg ) throws ArtifactResolutionException { } }

implementation:
Objects . requireNonNull ( tmpDir ) ; Objects . requireNonNull ( cfg ) ; final RepositoryContext ctx = new RepositoryContext ( tmpDir , cfg . getRepositoryUrl ( ) , cfg . isAllOptional ( ) ) ; // extend
final List < ArtifactRequest > requests = extendRequests ( cfg . getCoordinates ( ) . stream ( ) . map ( c -> { final DefaultArtifact artifact = new DefaultArtifact ( c . toString ( ) ) ; return makeRequest ( ctx . getRepositories ( ) , artifact ) ; } ) , ctx , cfg ) ; // process
return asResult ( resolve ( ctx , requests ) , cfg , empty ( ) ) ;


signature:
public class AetherImporter { /** * Process the actual import request
 * This method takes the import configuration as is and simply tries to
 * import it . Not manipulating the list of coordinates any more */
public static Collection < ArtifactResult > processImport ( final Path tmpDir , final ImportConfiguration cfg ) throws ArtifactResolutionException { } }

implementation:
Objects . requireNonNull ( tmpDir ) ; Objects . requireNonNull ( cfg ) ; final RepositoryContext ctx = new RepositoryContext ( tmpDir , cfg . getRepositoryUrl ( ) ) ; final Collection < ArtifactRequest > requests = new LinkedList < > ( ) ; for ( final MavenCoordinates coords : cfg . getCoordinates ( ) ) { // main artifact
final DefaultArtifact main = new DefaultArtifact ( coords . toString ( ) ) ; requests . add ( makeRequest ( ctx . getRepositories ( ) , main ) ) ; } // process
return ctx . getSystem ( ) . resolveArtifacts ( ctx . getSession ( ) , requests ) ;


signature:
public class AetherImporter { /** * Convert aether result list to AetherResult object
 * @ param results
 * the result collection
 * @ param cfg
 * the import configuration
 * @ param dependencyResult
 * The result of the dependency resolution
 * @ return the AetherResult object */
public static AetherResult asResult ( final Collection < ArtifactResult > results , final ImportConfiguration cfg , final Optional < DependencyResult > dependencyResult ) { } }

implementation:
final AetherResult result = new AetherResult ( ) ; // create set of requested coordinates
final Set < String > requested = new HashSet < > ( cfg . getCoordinates ( ) . size ( ) ) ; for ( final MavenCoordinates mc : cfg . getCoordinates ( ) ) { requested . add ( mc . toString ( ) ) ; } // generate dependency map
final Map < String , Boolean > optionalDeps = new HashMap < > ( ) ; fillOptionalDependenciesMap ( dependencyResult , optionalDeps ) ; // convert artifacts
for ( final ArtifactResult ar : results ) { final AetherResult . Entry entry = new AetherResult . Entry ( ) ; final MavenCoordinates coordinates = MavenCoordinates . fromResult ( ar ) ; final String key = coordinates . toBase ( ) . toString ( ) ; entry . setCoordinates ( coordinates ) ; entry . setResolved ( ar . isResolved ( ) ) ; entry . setRequested ( requested . contains ( key ) ) ; entry . setOptional ( optionalDeps . getOrDefault ( key , Boolean . FALSE ) ) ; // convert error
if ( ar . getExceptions ( ) != null && ! ar . getExceptions ( ) . isEmpty ( ) ) { final StringBuilder sb = new StringBuilder ( ar . getExceptions ( ) . get ( 0 ) . getMessage ( ) ) ; if ( ar . getExceptions ( ) . size ( ) > 1 ) { sb . append ( " ..." ) ; } entry . setError ( sb . toString ( ) ) ; } // add to list
result . getArtifacts ( ) . add ( entry ) ; } // sort by coordinates
Collections . sort ( result . getArtifacts ( ) , Comparator . comparing ( AetherResult . Entry :: getCoordinates ) ) ; // set repo url
result . setRepositoryUrl ( cfg . getRepositoryUrl ( ) ) ; return result ;


signature:
public class TagLibraryInfoImpl { /** * the following is a workaround until these problems are resolved . */
private InputStream getResourceAsStream ( String uri ) throws JasperException { } }

implementation:
try { // see if file exists on the filesystem first
String real = ctxt . getRealPath ( uri ) ; if ( real == null ) { return ctxt . getResourceAsStream ( uri ) ; } else { return new FileInputStream ( real ) ; } } catch ( FileNotFoundException ex ) { // if file not found on filesystem , get the resource through
// the context
return ctxt . getResourceAsStream ( uri ) ; }