repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java
Resources.getString
public String getString( String key ) throws MissingResourceException { ResourceBundle bundle = getBundle(); return bundle.getString( key ); }
java
public String getString( String key ) throws MissingResourceException { ResourceBundle bundle = getBundle(); return bundle.getString( key ); }
[ "public", "String", "getString", "(", "String", "key", ")", "throws", "MissingResourceException", "{", "ResourceBundle", "bundle", "=", "getBundle", "(", ")", ";", "return", "bundle", ".", "getString", "(", "key", ")", ";", "}" ]
Retrieve a raw string from bundle. @param key the key of resource @return the resource string @throws MissingResourceException if the requested key is unknown
[ "Retrieve", "a", "raw", "string", "from", "bundle", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L682-L687
train
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java
Resources.getBundle
public ResourceBundle getBundle() throws MissingResourceException { if( null == m_bundle ) { // bundle wasn't cached, so load it, cache it, and return it. ClassLoader classLoader = m_classLoader; if( null == classLoader ) { clas...
java
public ResourceBundle getBundle() throws MissingResourceException { if( null == m_bundle ) { // bundle wasn't cached, so load it, cache it, and return it. ClassLoader classLoader = m_classLoader; if( null == classLoader ) { clas...
[ "public", "ResourceBundle", "getBundle", "(", ")", "throws", "MissingResourceException", "{", "if", "(", "null", "==", "m_bundle", ")", "{", "// bundle wasn't cached, so load it, cache it, and return it.", "ClassLoader", "classLoader", "=", "m_classLoader", ";", "if", "("...
Retrieve underlying ResourceBundle. If bundle has not been loaded it will be loaded by this method. Access is given in case other resources need to be extracted that this Manager does not provide simplified access to. @return the ResourceBundle @throws MissingResourceException if an error occurs
[ "Retrieve", "underlying", "ResourceBundle", ".", "If", "bundle", "has", "not", "been", "loaded", "it", "will", "be", "loaded", "by", "this", "method", ".", "Access", "is", "given", "in", "case", "other", "resources", "need", "to", "be", "extracted", "that", ...
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L893-L914
train
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java
Resources.getPatternString
private String getPatternString( String key ) throws MissingResourceException { ResourceBundle bundle = getBundle(); Object object = bundle.getObject( key ); // is the resource a single string if( object instanceof String ) { return (String) object; ...
java
private String getPatternString( String key ) throws MissingResourceException { ResourceBundle bundle = getBundle(); Object object = bundle.getObject( key ); // is the resource a single string if( object instanceof String ) { return (String) object; ...
[ "private", "String", "getPatternString", "(", "String", "key", ")", "throws", "MissingResourceException", "{", "ResourceBundle", "bundle", "=", "getBundle", "(", ")", ";", "Object", "object", "=", "bundle", ".", "getObject", "(", "key", ")", ";", "// is the reso...
Utility method to retrieve a string from ResourceBundle. If the key is a single string then that will be returned. If key refers to string array then a random string will be chosen. Other types cause an exception. @param key the key to resource @return the string resource @throws MissingResourceException if an error...
[ "Utility", "method", "to", "retrieve", "a", "string", "from", "ResourceBundle", ".", "If", "the", "key", "is", "a", "single", "string", "then", "that", "will", "be", "returned", ".", "If", "key", "refers", "to", "string", "array", "then", "a", "random", ...
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L928-L952
train
ops4j/org.ops4j.base
ops4j-base-store/src/main/java/org/ops4j/store/StoreFactory.java
StoreFactory.anonymousStore
public static Store<InputStream> anonymousStore() throws IOException { File temp = File.createTempFile( "ops4j-store-anonymous-", "" ); temp.delete(); temp.mkdir(); return new TemporaryStore( temp, true ); }
java
public static Store<InputStream> anonymousStore() throws IOException { File temp = File.createTempFile( "ops4j-store-anonymous-", "" ); temp.delete(); temp.mkdir(); return new TemporaryStore( temp, true ); }
[ "public", "static", "Store", "<", "InputStream", ">", "anonymousStore", "(", ")", "throws", "IOException", "{", "File", "temp", "=", "File", ".", "createTempFile", "(", "\"ops4j-store-anonymous-\"", ",", "\"\"", ")", ";", "temp", ".", "delete", "(", ")", ";"...
If the store must be unique, here is it. @return unique storage @throws java.io.IOException in case no temp folder has been found.
[ "If", "the", "store", "must", "be", "unique", "here", "is", "it", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-store/src/main/java/org/ops4j/store/StoreFactory.java#L97-L104
train
ops4j/org.ops4j.base
ops4j-base-spi/src/main/java/org/ops4j/spi/SafeServiceLoader.java
SafeServiceLoader.loadClassIfVisible
@SuppressWarnings( "unchecked" ) private <T> Class<T> loadClassIfVisible( String className, ClassLoader classLoader ) { try { Class<T> klass = (Class<T>) classLoader.loadClass( className ); return klass; } catch ( ClassNotFoundException e ) { ...
java
@SuppressWarnings( "unchecked" ) private <T> Class<T> loadClassIfVisible( String className, ClassLoader classLoader ) { try { Class<T> klass = (Class<T>) classLoader.loadClass( className ); return klass; } catch ( ClassNotFoundException e ) { ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "<", "T", ">", "Class", "<", "T", ">", "loadClassIfVisible", "(", "String", "className", ",", "ClassLoader", "classLoader", ")", "{", "try", "{", "Class", "<", "T", ">", "klass", "=", "(", "C...
Loads a class with the given name from the given class loader. @param className fully qualified class name @param classLoader class loader @return class with given name, or null
[ "Loads", "a", "class", "with", "the", "given", "name", "from", "the", "given", "class", "loader", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-spi/src/main/java/org/ops4j/spi/SafeServiceLoader.java#L106-L118
train
ops4j/org.ops4j.base
ops4j-base-net/src/main/java/org/ops4j/net/URLUtils.java
URLUtils.prepareInputStream
public static InputStream prepareInputStream( final URL url, final boolean acceptAnyCertificate ) throws IOException { final URLConnection conn = url.openConnection(); prepareForAuthentication( conn ); prepareHttpHeaders( conn ); if( acceptAnyCertificate ) { ...
java
public static InputStream prepareInputStream( final URL url, final boolean acceptAnyCertificate ) throws IOException { final URLConnection conn = url.openConnection(); prepareForAuthentication( conn ); prepareHttpHeaders( conn ); if( acceptAnyCertificate ) { ...
[ "public", "static", "InputStream", "prepareInputStream", "(", "final", "URL", "url", ",", "final", "boolean", "acceptAnyCertificate", ")", "throws", "IOException", "{", "final", "URLConnection", "conn", "=", "url", ".", "openConnection", "(", ")", ";", "prepareFor...
Prepare url for authentication and ssl if necessary and returns the input stream from the url. @param url url to prepare @param acceptAnyCertificate true if the certicate check should be skipped @return input stream from url @throws IOException re-thrown
[ "Prepare", "url", "for", "authentication", "and", "ssl", "if", "necessary", "and", "returns", "the", "input", "stream", "from", "the", "url", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-net/src/main/java/org/ops4j/net/URLUtils.java#L170-L181
train
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java
NullArgumentException.validateNotEmpty
public static void validateNotEmpty( String stringToCheck, String argumentName ) throws NullArgumentException { validateNotEmpty( stringToCheck, false, argumentName ); }
java
public static void validateNotEmpty( String stringToCheck, String argumentName ) throws NullArgumentException { validateNotEmpty( stringToCheck, false, argumentName ); }
[ "public", "static", "void", "validateNotEmpty", "(", "String", "stringToCheck", ",", "String", "argumentName", ")", "throws", "NullArgumentException", "{", "validateNotEmpty", "(", "stringToCheck", ",", "false", ",", "argumentName", ")", ";", "}" ]
Validates that the string is not null and not an empty string without trimming the string. @param stringToCheck The object to be tested. @param argumentName The name of the object, which is used to construct the exception message. @throws NullArgumentException if the stringToCheck is either null or zero characters l...
[ "Validates", "that", "the", "string", "is", "not", "null", "and", "not", "an", "empty", "string", "without", "trimming", "the", "string", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java#L87-L91
train
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java
NullArgumentException.validateNotEmpty
public static void validateNotEmpty( String stringToCheck, boolean trim, String argumentName ) throws NullArgumentException { validateNotNull( stringToCheck, argumentName ); if( stringToCheck.length() == 0 || ( trim && stringToCheck.trim().length() == 0 ) ) { ...
java
public static void validateNotEmpty( String stringToCheck, boolean trim, String argumentName ) throws NullArgumentException { validateNotNull( stringToCheck, argumentName ); if( stringToCheck.length() == 0 || ( trim && stringToCheck.trim().length() == 0 ) ) { ...
[ "public", "static", "void", "validateNotEmpty", "(", "String", "stringToCheck", ",", "boolean", "trim", ",", "String", "argumentName", ")", "throws", "NullArgumentException", "{", "validateNotNull", "(", "stringToCheck", ",", "argumentName", ")", ";", "if", "(", "...
Validates that the string is not null and not an empty string. @param stringToCheck The object to be tested. @param trim If the elements should be trimmed before checking if empty @param argumentName The name of the object, which is used to construct the exception message. @throws NullArgumentException if t...
[ "Validates", "that", "the", "string", "is", "not", "null", "and", "not", "an", "empty", "string", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java#L102-L111
train
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java
NullArgumentException.validateNotEmpty
public static void validateNotEmpty( Properties propertiesToCheck, String argumentName ) throws NullArgumentException { validateNotNull( propertiesToCheck, argumentName ); if( propertiesToCheck.isEmpty() ) { throw new NullArgumentException( argumentName + IS_EMPTY ); ...
java
public static void validateNotEmpty( Properties propertiesToCheck, String argumentName ) throws NullArgumentException { validateNotNull( propertiesToCheck, argumentName ); if( propertiesToCheck.isEmpty() ) { throw new NullArgumentException( argumentName + IS_EMPTY ); ...
[ "public", "static", "void", "validateNotEmpty", "(", "Properties", "propertiesToCheck", ",", "String", "argumentName", ")", "throws", "NullArgumentException", "{", "validateNotNull", "(", "propertiesToCheck", ",", "argumentName", ")", ";", "if", "(", "propertiesToCheck"...
Validates that the Properties instance is not null and that it has entries. @param propertiesToCheck The object to be tested. @param argumentName The name of the object, which is used to construct the exception message. @throws NullArgumentException if the Properties instance is null or does not have any entries...
[ "Validates", "that", "the", "Properties", "instance", "is", "not", "null", "and", "that", "it", "has", "entries", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java#L121-L129
train
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java
NullArgumentException.validateNotEmpty
public static void validateNotEmpty( Object[] arrayToCheck, String argumentName ) throws NullArgumentException { validateNotNull( arrayToCheck, argumentName ); if( arrayToCheck.length == 0 ) { throw new NullArgumentException( argumentName + IS_EMPTY ); } }
java
public static void validateNotEmpty( Object[] arrayToCheck, String argumentName ) throws NullArgumentException { validateNotNull( arrayToCheck, argumentName ); if( arrayToCheck.length == 0 ) { throw new NullArgumentException( argumentName + IS_EMPTY ); } }
[ "public", "static", "void", "validateNotEmpty", "(", "Object", "[", "]", "arrayToCheck", ",", "String", "argumentName", ")", "throws", "NullArgumentException", "{", "validateNotNull", "(", "arrayToCheck", ",", "argumentName", ")", ";", "if", "(", "arrayToCheck", "...
Validates that the array instance is not null and that it has entries. @param arrayToCheck The object to be tested. @param argumentName The name of the object, which is used to construct the exception message. @throws NullArgumentException if the array instance is null or does not have any entries. @since 0.5.0, Janu...
[ "Validates", "that", "the", "array", "instance", "is", "not", "null", "and", "that", "it", "has", "entries", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java#L140-L148
train
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java
NullArgumentException.validateNotEmptyContent
public static void validateNotEmptyContent( String[] arrayToCheck, String argumentName ) throws NullArgumentException { validateNotEmptyContent( arrayToCheck, false, argumentName ); }
java
public static void validateNotEmptyContent( String[] arrayToCheck, String argumentName ) throws NullArgumentException { validateNotEmptyContent( arrayToCheck, false, argumentName ); }
[ "public", "static", "void", "validateNotEmptyContent", "(", "String", "[", "]", "arrayToCheck", ",", "String", "argumentName", ")", "throws", "NullArgumentException", "{", "validateNotEmptyContent", "(", "arrayToCheck", ",", "false", ",", "argumentName", ")", ";", "...
Validates that the string array instance is not null and that it has entries that are not null or empty eithout trimming the string. @param arrayToCheck The object to be tested. @param argumentName The name of the object, which is used to construct the exception message. @throws NullArgumentException if the array ins...
[ "Validates", "that", "the", "string", "array", "instance", "is", "not", "null", "and", "that", "it", "has", "entries", "that", "are", "not", "null", "or", "empty", "eithout", "trimming", "the", "string", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java#L160-L164
train
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java
NullArgumentException.validateNotEmptyContent
public static void validateNotEmptyContent( String[] arrayToCheck, boolean trim, String argumentName ) throws NullArgumentException { validateNotEmpty( arrayToCheck, argumentName ); for( int i = 0; i < arrayToCheck.length; i++ ) { validateNotEmpty( arrayToCheck[ i ], arra...
java
public static void validateNotEmptyContent( String[] arrayToCheck, boolean trim, String argumentName ) throws NullArgumentException { validateNotEmpty( arrayToCheck, argumentName ); for( int i = 0; i < arrayToCheck.length; i++ ) { validateNotEmpty( arrayToCheck[ i ], arra...
[ "public", "static", "void", "validateNotEmptyContent", "(", "String", "[", "]", "arrayToCheck", ",", "boolean", "trim", ",", "String", "argumentName", ")", "throws", "NullArgumentException", "{", "validateNotEmpty", "(", "arrayToCheck", ",", "argumentName", ")", ";"...
Validates that the string array instance is not null and that it has entries that are not null or empty. @param arrayToCheck The object to be tested. @param trim If the elements should be trimmed before checking if empty @param argumentName The name of the object, which is used to construct the exception messa...
[ "Validates", "that", "the", "string", "array", "instance", "is", "not", "null", "and", "that", "it", "has", "entries", "that", "are", "not", "null", "or", "empty", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java#L176-L188
train
ops4j/org.ops4j.base
ops4j-base-util-property/src/main/java/org/ops4j/util/property/PropertyStore.java
PropertyStore.get
@SuppressWarnings( "unchecked" ) public <T> T get( final String propertyName ) { return (T) m_properties.get( propertyName ); }
java
@SuppressWarnings( "unchecked" ) public <T> T get( final String propertyName ) { return (T) m_properties.get( propertyName ); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "get", "(", "final", "String", "propertyName", ")", "{", "return", "(", "T", ")", "m_properties", ".", "get", "(", "propertyName", ")", ";", "}" ]
Returns the property by name. @param propertyName name of the property @return property value
[ "Returns", "the", "property", "by", "name", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-property/src/main/java/org/ops4j/util/property/PropertyStore.java#L78-L82
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java
ZipExploder.getEntries
protected Map<String, ZipEntry> getEntries(ZipFile zf) { Enumeration<?> e = zf.entries(); Map<String, ZipEntry> m = new HashMap<String, ZipEntry>(); while (e.hasMoreElements()) { ZipEntry ze = (ZipEntry) e.nextElement(); m.put(ze.getName(), ze); } return m...
java
protected Map<String, ZipEntry> getEntries(ZipFile zf) { Enumeration<?> e = zf.entries(); Map<String, ZipEntry> m = new HashMap<String, ZipEntry>(); while (e.hasMoreElements()) { ZipEntry ze = (ZipEntry) e.nextElement(); m.put(ze.getName(), ze); } return m...
[ "protected", "Map", "<", "String", ",", "ZipEntry", ">", "getEntries", "(", "ZipFile", "zf", ")", "{", "Enumeration", "<", "?", ">", "e", "=", "zf", ".", "entries", "(", ")", ";", "Map", "<", "String", ",", "ZipEntry", ">", "m", "=", "new", "HashMa...
Get all the entries in a ZIP file.
[ "Get", "all", "the", "entries", "in", "a", "ZIP", "file", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java#L270-L278
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java
ZipExploder.printHelp
protected static void printHelp() { System.out.println(); System.out.println("Usage: java " + ZipExploder.class.getName() + " (-jar jarFilename... | -zip zipFilename...)... -dir destDir {-verbose}"); System.out.println("Where:"); System.out.println(" jarFilename path to source jar, may ...
java
protected static void printHelp() { System.out.println(); System.out.println("Usage: java " + ZipExploder.class.getName() + " (-jar jarFilename... | -zip zipFilename...)... -dir destDir {-verbose}"); System.out.println("Where:"); System.out.println(" jarFilename path to source jar, may ...
[ "protected", "static", "void", "printHelp", "(", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"Usage: java \"", "+", "ZipExploder", ".", "class", ".", "getName", "(", ")", "+", "\" (-jar jarF...
Print command help text.
[ "Print", "command", "help", "text", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java#L338-L346
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java
ZipExploder.main
public static void main(final String[] args) { if (args.length == 0) { printHelp(); System.exit(0); } List<String> zipNames = new ArrayList<String>(); List<String> jarNames = new ArrayList<String>(); String destDir = null; boolean jarActive = false...
java
public static void main(final String[] args) { if (args.length == 0) { printHelp(); System.exit(0); } List<String> zipNames = new ArrayList<String>(); List<String> jarNames = new ArrayList<String>(); String destDir = null; boolean jarActive = false...
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "==", "0", ")", "{", "printHelp", "(", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "List", "<", "String", ">...
Main command line entry point. @param args
[ "Main", "command", "line", "entry", "point", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java#L359-L421
train
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/environment/EnvironmentException.java
EnvironmentException.getMessage
public String getMessage() { String base = super.getMessage(); if( null == base ) { return "Failed to access " + m_variable + " environment variable"; } return "Failed to access " + m_variable + " environment variable - " + base; }
java
public String getMessage() { String base = super.getMessage(); if( null == base ) { return "Failed to access " + m_variable + " environment variable"; } return "Failed to access " + m_variable + " environment variable - " + base; }
[ "public", "String", "getMessage", "(", ")", "{", "String", "base", "=", "super", ".", "getMessage", "(", ")", ";", "if", "(", "null", "==", "base", ")", "{", "return", "\"Failed to access \"", "+", "m_variable", "+", "\" environment variable\"", ";", "}", ...
Prepends variable name to the base message. @return the message of the Exception. @see java.lang.Throwable#getMessage()
[ "Prepends", "variable", "name", "to", "the", "base", "message", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/environment/EnvironmentException.java#L130-L140
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/PrintStreamMonitor.java
PrintStreamMonitor.notifyUpdate
public void notifyUpdate( URL resource, int expected, int count ) { if( m_first ) { m_expected = expected; m_start = System.currentTimeMillis(); m_first = false; } int completed = ( count * 100 ) / expected; m_out.print( resource.toExternal...
java
public void notifyUpdate( URL resource, int expected, int count ) { if( m_first ) { m_expected = expected; m_start = System.currentTimeMillis(); m_first = false; } int completed = ( count * 100 ) / expected; m_out.print( resource.toExternal...
[ "public", "void", "notifyUpdate", "(", "URL", "resource", ",", "int", "expected", ",", "int", "count", ")", "{", "if", "(", "m_first", ")", "{", "m_expected", "=", "expected", ";", "m_start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "m_fir...
Notify the monitor of the update in the download status. @param resource the name of the remote resource being downloaded. @param expected the expected number of bytes to be downloaded. @param count the number of bytes downloaded.
[ "Notify", "the", "monitor", "of", "the", "update", "in", "the", "download", "status", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/PrintStreamMonitor.java#L60-L70
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/PrintStreamMonitor.java
PrintStreamMonitor.notifyCompletion
public void notifyCompletion( URL resource ) { long now = System.currentTimeMillis(); long time = now - m_start; int kBps = (int) ( m_expected / time ); m_out.println( resource.toExternalForm() + " : " + kBps + " kBps. " ); }
java
public void notifyCompletion( URL resource ) { long now = System.currentTimeMillis(); long time = now - m_start; int kBps = (int) ( m_expected / time ); m_out.println( resource.toExternalForm() + " : " + kBps + " kBps. " ); }
[ "public", "void", "notifyCompletion", "(", "URL", "resource", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "time", "=", "now", "-", "m_start", ";", "int", "kBps", "=", "(", "int", ")", "(", "m_expected", "/",...
Notify the monitor of the successful completion of a download process. @param resource the name of the remote resource.
[ "Notify", "the", "monitor", "of", "the", "successful", "completion", "of", "a", "download", "process", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/PrintStreamMonitor.java#L78-L84
train
ops4j/org.ops4j.base
ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertyResolver.java
PropertyResolver.processToken
private static void processToken( String token, Stack<String> stack, Properties props ) { if( "}".equals( token ) ) { String name = stack.pop(); String open = stack.pop(); if( "${".equals( open ) ) { startProperty( name, props, stack );...
java
private static void processToken( String token, Stack<String> stack, Properties props ) { if( "}".equals( token ) ) { String name = stack.pop(); String open = stack.pop(); if( "${".equals( open ) ) { startProperty( name, props, stack );...
[ "private", "static", "void", "processToken", "(", "String", "token", ",", "Stack", "<", "String", ">", "stack", ",", "Properties", "props", ")", "{", "if", "(", "\"}\"", ".", "equals", "(", "token", ")", ")", "{", "String", "name", "=", "stack", ".", ...
Process one token. @param token The token to process. @param stack The parser Stack. @param props The Properties to replace.
[ "Process", "one", "token", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertyResolver.java#L92-L118
train
ops4j/org.ops4j.base
ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertyResolver.java
PropertyResolver.startProperty
private static void startProperty( String name, Properties props, Stack<String> stack ) { String propValue = System.getProperty( name ); if( propValue == null ) { propValue = props.getProperty( name ); } if( propValue == null ) { push( stack, "...
java
private static void startProperty( String name, Properties props, Stack<String> stack ) { String propValue = System.getProperty( name ); if( propValue == null ) { propValue = props.getProperty( name ); } if( propValue == null ) { push( stack, "...
[ "private", "static", "void", "startProperty", "(", "String", "name", ",", "Properties", "props", ",", "Stack", "<", "String", ">", "stack", ")", "{", "String", "propValue", "=", "System", ".", "getProperty", "(", "name", ")", ";", "if", "(", "propValue", ...
Starts a new property. @param name The name of the property. @param props The Properties we are exchanging with. @param stack The parsing stack.
[ "Starts", "a", "new", "property", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertyResolver.java#L127-L142
train
ops4j/org.ops4j.base
ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertyResolver.java
PropertyResolver.push
private static void push( Stack<String> stack, String value ) { if( stack.size() > 0 ) { String data = stack.pop(); if( "${".equals( data ) ) { stack.push( data ); stack.push( value ); } else { ...
java
private static void push( Stack<String> stack, String value ) { if( stack.size() > 0 ) { String data = stack.pop(); if( "${".equals( data ) ) { stack.push( data ); stack.push( value ); } else { ...
[ "private", "static", "void", "push", "(", "Stack", "<", "String", ">", "stack", ",", "String", "value", ")", "{", "if", "(", "stack", ".", "size", "(", ")", ">", "0", ")", "{", "String", "data", "=", "stack", ".", "pop", "(", ")", ";", "if", "(...
Pushes a value on a stack @param stack the stack @param value the value
[ "Pushes", "a", "value", "on", "a", "stack" ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertyResolver.java#L150-L169
train
ops4j/org.ops4j.base
ops4j-base-monitors/src/main/java/org/ops4j/monitors/stream/StreamMonitorRouter.java
StreamMonitorRouter.notifyUpdate
public void notifyUpdate( URL resource, int expected, int count ) { synchronized( m_Monitors ) { for( StreamMonitor monitor : m_Monitors ) { monitor.notifyUpdate( resource, expected, count ); } } }
java
public void notifyUpdate( URL resource, int expected, int count ) { synchronized( m_Monitors ) { for( StreamMonitor monitor : m_Monitors ) { monitor.notifyUpdate( resource, expected, count ); } } }
[ "public", "void", "notifyUpdate", "(", "URL", "resource", ",", "int", "expected", ",", "int", "count", ")", "{", "synchronized", "(", "m_Monitors", ")", "{", "for", "(", "StreamMonitor", "monitor", ":", "m_Monitors", ")", "{", "monitor", ".", "notifyUpdate",...
Notify all subscribing monitors of a updated event. @param resource the url of the updated resource @param expected the size in bytes of the download @param count the progress in bytes
[ "Notify", "all", "subscribing", "monitors", "of", "a", "updated", "event", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-monitors/src/main/java/org/ops4j/monitors/stream/StreamMonitorRouter.java#L54-L63
train
ops4j/org.ops4j.base
ops4j-base-monitors/src/main/java/org/ops4j/monitors/stream/StreamMonitorRouter.java
StreamMonitorRouter.notifyCompletion
public void notifyCompletion( URL resource ) { synchronized( m_Monitors ) { for( StreamMonitor monitor : m_Monitors ) { monitor.notifyCompletion( resource ); } } }
java
public void notifyCompletion( URL resource ) { synchronized( m_Monitors ) { for( StreamMonitor monitor : m_Monitors ) { monitor.notifyCompletion( resource ); } } }
[ "public", "void", "notifyCompletion", "(", "URL", "resource", ")", "{", "synchronized", "(", "m_Monitors", ")", "{", "for", "(", "StreamMonitor", "monitor", ":", "m_Monitors", ")", "{", "monitor", ".", "notifyCompletion", "(", "resource", ")", ";", "}", "}",...
Notify all subscribing monitors of a download completion event. @param resource the url of the downloaded resource
[ "Notify", "all", "subscribing", "monitors", "of", "a", "download", "completion", "event", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-monitors/src/main/java/org/ops4j/monitors/stream/StreamMonitorRouter.java#L70-L79
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.closeStreams
private static void closeStreams( InputStream src, OutputStream dest ) { try { src.close(); } catch( IOException e ) { e.printStackTrace(); } try { dest.close(); } catch( IOException e ) { ...
java
private static void closeStreams( InputStream src, OutputStream dest ) { try { src.close(); } catch( IOException e ) { e.printStackTrace(); } try { dest.close(); } catch( IOException e ) { ...
[ "private", "static", "void", "closeStreams", "(", "InputStream", "src", ",", "OutputStream", "dest", ")", "{", "try", "{", "src", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", ...
Closes the streams and reports Exceptions to System.err @param src The InputStream to close. @param dest The OutputStream to close.
[ "Closes", "the", "streams", "and", "reports", "Exceptions", "to", "System", ".", "err" ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L145-L164
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.compareStreams
public static boolean compareStreams( InputStream in1, InputStream in2 ) throws IOException { boolean moreOnIn1; do { int v1 = in1.read(); int v2 = in2.read(); if( v1 != v2 ) { return false; } mor...
java
public static boolean compareStreams( InputStream in1, InputStream in2 ) throws IOException { boolean moreOnIn1; do { int v1 = in1.read(); int v2 = in2.read(); if( v1 != v2 ) { return false; } mor...
[ "public", "static", "boolean", "compareStreams", "(", "InputStream", "in1", ",", "InputStream", "in2", ")", "throws", "IOException", "{", "boolean", "moreOnIn1", ";", "do", "{", "int", "v1", "=", "in1", ".", "read", "(", ")", ";", "int", "v2", "=", "in2"...
Compares if two streams are identical in their contents. @param in1 The first stream. @param in2 The second stream. @return true if both streams contains the same byte data, including having the same number of characters in them. @throws IOException If an underlying I/O problem occured.
[ "Compares", "if", "two", "streams", "are", "identical", "in", "their", "contents", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L176-L193
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.copyReaderToWriter
public static void copyReaderToWriter( Reader input, Writer output, boolean close ) throws IOException { try { BufferedReader in = bufferInput( input ); BufferedWriter out = bufferOutput( output ); int ch = in.read(); while( ch != -1 ) ...
java
public static void copyReaderToWriter( Reader input, Writer output, boolean close ) throws IOException { try { BufferedReader in = bufferInput( input ); BufferedWriter out = bufferOutput( output ); int ch = in.read(); while( ch != -1 ) ...
[ "public", "static", "void", "copyReaderToWriter", "(", "Reader", "input", ",", "Writer", "output", ",", "boolean", "close", ")", "throws", "IOException", "{", "try", "{", "BufferedReader", "in", "=", "bufferInput", "(", "input", ")", ";", "BufferedWriter", "ou...
Copies the Reader to the Writer. @param input The input characters. @param output The destination of the characters. @param close true if the reader and writer should be closed after the operation is completed. @throws IOException If an underlying I/O problem occured.
[ "Copies", "the", "Reader", "to", "the", "Writer", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L204-L228
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.bufferOutput
private static BufferedWriter bufferOutput( Writer writer ) { BufferedWriter out; if( writer instanceof BufferedWriter ) { out = (BufferedWriter) writer; } else { out = new BufferedWriter( writer ); } return out; }
java
private static BufferedWriter bufferOutput( Writer writer ) { BufferedWriter out; if( writer instanceof BufferedWriter ) { out = (BufferedWriter) writer; } else { out = new BufferedWriter( writer ); } return out; }
[ "private", "static", "BufferedWriter", "bufferOutput", "(", "Writer", "writer", ")", "{", "BufferedWriter", "out", ";", "if", "(", "writer", "instanceof", "BufferedWriter", ")", "{", "out", "=", "(", "BufferedWriter", ")", "writer", ";", "}", "else", "{", "o...
Wraps the Writer in a BufferedWriter, unless it already is a BufferedWriter. @param writer The Writer to check and possibly wrap. @return A BufferedWriter.
[ "Wraps", "the", "Writer", "in", "a", "BufferedWriter", "unless", "it", "already", "is", "a", "BufferedWriter", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L237-L249
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.bufferInput
private static BufferedReader bufferInput( Reader reader ) { BufferedReader in; if( reader instanceof BufferedReader ) { in = (BufferedReader) reader; } else { in = new BufferedReader( reader ); } return in; }
java
private static BufferedReader bufferInput( Reader reader ) { BufferedReader in; if( reader instanceof BufferedReader ) { in = (BufferedReader) reader; } else { in = new BufferedReader( reader ); } return in; }
[ "private", "static", "BufferedReader", "bufferInput", "(", "Reader", "reader", ")", "{", "BufferedReader", "in", ";", "if", "(", "reader", "instanceof", "BufferedReader", ")", "{", "in", "=", "(", "BufferedReader", ")", "reader", ";", "}", "else", "{", "in",...
Wraps the Reader in a BufferedReaderm unless it already is a BufferedReader. @param reader The Reader to check and possibly wrap. @return A BufferedReader.
[ "Wraps", "the", "Reader", "in", "a", "BufferedReaderm", "unless", "it", "already", "is", "a", "BufferedReader", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L258-L270
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.copyStreamToWriter
public static void copyStreamToWriter( InputStream in, Writer out, String encoding, boolean close ) throws IOException { InputStreamReader reader = new InputStreamReader( in, encoding ); copyReaderToWriter( reader, out, close ); }
java
public static void copyStreamToWriter( InputStream in, Writer out, String encoding, boolean close ) throws IOException { InputStreamReader reader = new InputStreamReader( in, encoding ); copyReaderToWriter( reader, out, close ); }
[ "public", "static", "void", "copyStreamToWriter", "(", "InputStream", "in", ",", "Writer", "out", ",", "String", "encoding", ",", "boolean", "close", ")", "throws", "IOException", "{", "InputStreamReader", "reader", "=", "new", "InputStreamReader", "(", "in", ",...
Copies an InputStream to a Writer. @param in The input byte stream of data. @param out The Writer to receive the streamed data as characters. @param encoding The encoding used in the byte stream. @param close true if the Reader and OutputStream should be closed after the completion. @throws IOException ...
[ "Copies", "an", "InputStream", "to", "a", "Writer", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L282-L287
train
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java
StreamUtils.copyReaderToStream
public static void copyReaderToStream( Reader in, OutputStream out, String encoding, boolean close ) throws IOException { OutputStreamWriter writer = new OutputStreamWriter( out, encoding ); copyReaderToWriter( in, writer, close ); }
java
public static void copyReaderToStream( Reader in, OutputStream out, String encoding, boolean close ) throws IOException { OutputStreamWriter writer = new OutputStreamWriter( out, encoding ); copyReaderToWriter( in, writer, close ); }
[ "public", "static", "void", "copyReaderToStream", "(", "Reader", "in", ",", "OutputStream", "out", ",", "String", "encoding", ",", "boolean", "close", ")", "throws", "IOException", "{", "OutputStreamWriter", "writer", "=", "new", "OutputStreamWriter", "(", "out", ...
Copies the content of the Reader to the provided OutputStream using the provided encoding. @param in The character data to convert. @param out The OutputStream to send the data to. @param encoding The character encoding that should be used for the byte stream. @param close true if the Reader and OutputSt...
[ "Copies", "the", "content", "of", "the", "Reader", "to", "the", "provided", "OutputStream", "using", "the", "provided", "encoding", "." ]
b0e742c0d9511f6b19ca64da2ebaf30b7a47256a
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L299-L304
train
drallgood/jpasskit
jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java
PKSigningInformationUtil.loadSigningInformationFromPKCS12AndIntermediateCertificate
public PKSigningInformation loadSigningInformationFromPKCS12AndIntermediateCertificate(InputStream keyStoreInputStream, String keyStorePassword, InputStream appleWWDRCAFileInputStream) throws IOException, CertificateException { KeyStore pkcs12KeyStore = loadPKCS12File(keyStoreInputStream, keyStoreP...
java
public PKSigningInformation loadSigningInformationFromPKCS12AndIntermediateCertificate(InputStream keyStoreInputStream, String keyStorePassword, InputStream appleWWDRCAFileInputStream) throws IOException, CertificateException { KeyStore pkcs12KeyStore = loadPKCS12File(keyStoreInputStream, keyStoreP...
[ "public", "PKSigningInformation", "loadSigningInformationFromPKCS12AndIntermediateCertificate", "(", "InputStream", "keyStoreInputStream", ",", "String", "keyStorePassword", ",", "InputStream", "appleWWDRCAFileInputStream", ")", "throws", "IOException", ",", "CertificateException", ...
Load all signing information necessary for pass generation using two input streams for the key store and the Apple WWDRCA certificate. The caller is responsible for closing the stream after this method returns successfully or fails. @param keyStoreInputStream <code>InputStream</code> of the key store @param keyStoreP...
[ "Load", "all", "signing", "information", "necessary", "for", "pass", "generation", "using", "two", "input", "streams", "for", "the", "key", "store", "and", "the", "Apple", "WWDRCA", "certificate", "." ]
63bfa8abbdb85c2d7596c60eed41ed8e374cbd01
https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java#L97-L104
train
drallgood/jpasskit
jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java
PKSigningInformationUtil.loadPKCS12File
@Deprecated public KeyStore loadPKCS12File(InputStream inputStreamOfP12, String password) throws CertificateException, IOException { try { return CertUtils.toKeyStore(inputStreamOfP12, password.toCharArray()); } catch (IllegalStateException ex) { throw new IOException("Key fr...
java
@Deprecated public KeyStore loadPKCS12File(InputStream inputStreamOfP12, String password) throws CertificateException, IOException { try { return CertUtils.toKeyStore(inputStreamOfP12, password.toCharArray()); } catch (IllegalStateException ex) { throw new IOException("Key fr...
[ "@", "Deprecated", "public", "KeyStore", "loadPKCS12File", "(", "InputStream", "inputStreamOfP12", ",", "String", "password", ")", "throws", "CertificateException", ",", "IOException", "{", "try", "{", "return", "CertUtils", ".", "toKeyStore", "(", "inputStreamOfP12",...
Load the keystore from an already opened input stream. The caller is responsible for closing the stream after this method returns successfully or fails. @param inputStreamOfP12 <code>InputStream</code> containing the signing key store. @param password Password to access the key store @return Key store loaded from <co...
[ "Load", "the", "keystore", "from", "an", "already", "opened", "input", "stream", "." ]
63bfa8abbdb85c2d7596c60eed41ed8e374cbd01
https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java#L147-L154
train
drallgood/jpasskit
jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java
PKSigningInformationUtil.loadDERCertificate
@Deprecated public X509Certificate loadDERCertificate(String filePath) throws IOException, CertificateException { try (InputStream certificateInputStream = CertUtils.toInputStream(filePath)) { return loadDERCertificate(certificateInputStream); } }
java
@Deprecated public X509Certificate loadDERCertificate(String filePath) throws IOException, CertificateException { try (InputStream certificateInputStream = CertUtils.toInputStream(filePath)) { return loadDERCertificate(certificateInputStream); } }
[ "@", "Deprecated", "public", "X509Certificate", "loadDERCertificate", "(", "String", "filePath", ")", "throws", "IOException", ",", "CertificateException", "{", "try", "(", "InputStream", "certificateInputStream", "=", "CertUtils", ".", "toInputStream", "(", "filePath",...
Load certificate file in DER format from the filesystem or the classpath @param filePath Path to the file, containing the certificate. @return Loaded certificate. @throws IOException @throws CertificateException @deprecated
[ "Load", "certificate", "file", "in", "DER", "format", "from", "the", "filesystem", "or", "the", "classpath" ]
63bfa8abbdb85c2d7596c60eed41ed8e374cbd01
https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java#L166-L171
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java
LocalTypeDetector.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); suspectLocals = new HashMap<>(); classVersion = classContext.getJavaClass().getMajor(); super.visitClassContext(classContext); } finally { ...
java
@Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); suspectLocals = new HashMap<>(); classVersion = classContext.getJavaClass().getMajor(); super.visitClassContext(classContext); } finally { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "suspectLocals", "=", "new", "HashMap", "<>", "(", ")", ";", "classVersion", "=", "classCont...
implements the visitor to create and clear the stack and suspectLocals @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "create", "and", "clear", "the", "stack", "and", "suspectLocals" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java#L92-L103
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java
LocalTypeDetector.visitMethod
@Override public void visitMethod(Method obj) { suspectLocals.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(obj); for (int pr : parmRegs) { suspectLocals.put(Integer.valueOf(pr), new RegisterInfo(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), ...
java
@Override public void visitMethod(Method obj) { suspectLocals.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(obj); for (int pr : parmRegs) { suspectLocals.put(Integer.valueOf(pr), new RegisterInfo(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), ...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "suspectLocals", ".", "clear", "(", ")", ";", "int", "[", "]", "parmRegs", "=", "RegisterUtils", ".", "getParameterRegisters", "(", "obj", ")", ";", "for", "(", "int", "pr"...
implements the visitor to collect parameter registers @param obj the context object of the currently parsed method
[ "implements", "the", "visitor", "to", "collect", "parameter", "registers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java#L111-L118
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
FloatingPointLoops.visitCode
@Override public void visitCode(Code obj) { forLoops = new HashSet<>(); super.visitCode(obj); forLoops = null; }
java
@Override public void visitCode(Code obj) { forLoops = new HashSet<>(); super.visitCode(obj); forLoops = null; }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "forLoops", "=", "new", "HashSet", "<>", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "forLoops", "=", "null", ";", "}" ]
implements the visitor to clear the forLoops set @param obj the context object for the currently parsed code block
[ "implements", "the", "visitor", "to", "clear", "the", "forLoops", "set" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java#L65-L70
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
FloatingPointLoops.sawOpcode
@Override public void sawOpcode(int seen) { if (!forLoops.isEmpty()) { Iterator<FloatForLoop> ffl = forLoops.iterator(); while (ffl.hasNext()) { if (!ffl.next().sawOpcode(seen)) { ffl.remove(); } } } if ...
java
@Override public void sawOpcode(int seen) { if (!forLoops.isEmpty()) { Iterator<FloatForLoop> ffl = forLoops.iterator(); while (ffl.hasNext()) { if (!ffl.next().sawOpcode(seen)) { ffl.remove(); } } } if ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "!", "forLoops", ".", "isEmpty", "(", ")", ")", "{", "Iterator", "<", "FloatForLoop", ">", "ffl", "=", "forLoops", ".", "iterator", "(", ")", ";", "while", "(", ...
implements the visitor to find for loops using floating point indexes @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "find", "for", "loops", "using", "floating", "point", "indexes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java#L78-L92
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.visitField
@Override public void visitField(Field obj) { String fieldSig = obj.getSignature(); if ("Ljavax/swing/JLabel;".equals(fieldSig)) { FieldAnnotation fa = FieldAnnotation.fromVisitedField(this); fieldLabels.add(XFactory.createXField(fa)); } }
java
@Override public void visitField(Field obj) { String fieldSig = obj.getSignature(); if ("Ljavax/swing/JLabel;".equals(fieldSig)) { FieldAnnotation fa = FieldAnnotation.fromVisitedField(this); fieldLabels.add(XFactory.createXField(fa)); } }
[ "@", "Override", "public", "void", "visitField", "(", "Field", "obj", ")", "{", "String", "fieldSig", "=", "obj", ".", "getSignature", "(", ")", ";", "if", "(", "\"Ljavax/swing/JLabel;\"", ".", "equals", "(", "fieldSig", ")", ")", "{", "FieldAnnotation", "...
looks for fields that are JLabels and stores them in a set @param obj the field object of the current field
[ "looks", "for", "fields", "that", "are", "JLabels", "and", "stores", "them", "in", "a", "set" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L198-L206
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processFaultyGuiStrings
private void processFaultyGuiStrings() { FQMethod methodInfo = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()); Integer parmIndex = displayTextMethods.get(methodInfo); if ((parmIndex != null) && (stack.getStackDepth() > parmIndex.intValue())) { ...
java
private void processFaultyGuiStrings() { FQMethod methodInfo = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()); Integer parmIndex = displayTextMethods.get(methodInfo); if ((parmIndex != null) && (stack.getStackDepth() > parmIndex.intValue())) { ...
[ "private", "void", "processFaultyGuiStrings", "(", ")", "{", "FQMethod", "methodInfo", "=", "new", "FQMethod", "(", "getClassConstantOperand", "(", ")", ",", "getNameConstantOperand", "(", ")", ",", "getSigConstantOperand", "(", ")", ")", ";", "Integer", "parmInde...
looks for calls to set a readable string that is generated from a static constant, as these strings are not translatable. also looks for setting readable strings that are appended together. This is likely not to be internationalizable.
[ "looks", "for", "calls", "to", "set", "a", "readable", "string", "that", "is", "generated", "from", "a", "static", "constant", "as", "these", "strings", "are", "not", "translatable", ".", "also", "looks", "for", "setting", "readable", "strings", "that", "are...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L343-L357
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processNullLayouts
private void processNullLayouts(String className, String methodName) { if ("java/awt/Container".equals(className) && "setLayout".equals(methodName) && (stack.getStackDepth() > 0) && stack.getStackItem(0).isNull()) { bugReporter.reportBug(new BugInstance(this, BugType.S508C_NULL_LAYOUT.name(), NORMAL...
java
private void processNullLayouts(String className, String methodName) { if ("java/awt/Container".equals(className) && "setLayout".equals(methodName) && (stack.getStackDepth() > 0) && stack.getStackItem(0).isNull()) { bugReporter.reportBug(new BugInstance(this, BugType.S508C_NULL_LAYOUT.name(), NORMAL...
[ "private", "void", "processNullLayouts", "(", "String", "className", ",", "String", "methodName", ")", "{", "if", "(", "\"java/awt/Container\"", ".", "equals", "(", "className", ")", "&&", "\"setLayout\"", ".", "equals", "(", "methodName", ")", "&&", "(", "sta...
looks for containers where a null layout is installed @param className class that a method call is made on @param methodName name of the method that is called
[ "looks", "for", "containers", "where", "a", "null", "layout", "is", "installed" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L367-L371
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processSetColorOps
private void processSetColorOps(String methodName) throws ClassNotFoundException { if ("setBackground".equals(methodName) || "setForeground".equals(methodName)) { int argCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if (stack.getStackDepth() > argCount) { ...
java
private void processSetColorOps(String methodName) throws ClassNotFoundException { if ("setBackground".equals(methodName) || "setForeground".equals(methodName)) { int argCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if (stack.getStackDepth() > argCount) { ...
[ "private", "void", "processSetColorOps", "(", "String", "methodName", ")", "throws", "ClassNotFoundException", "{", "if", "(", "\"setBackground\"", ".", "equals", "(", "methodName", ")", "||", "\"setForeground\"", ".", "equals", "(", "methodName", ")", ")", "{", ...
looks for calls to set the color of components where the color isn't from UIManager @param methodName the method that is called @throws ClassNotFoundException if the gui component class can't be found
[ "looks", "for", "calls", "to", "set", "the", "color", "of", "components", "where", "the", "color", "isn", "t", "from", "UIManager" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L382-L397
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processSetSizeOps
private void processSetSizeOps(String methodName) throws ClassNotFoundException { if ("setSize".equals(methodName)) { int argCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if ((windowClass != null) && (stack.getStackDepth() > argCount)) { OpcodeStack.It...
java
private void processSetSizeOps(String methodName) throws ClassNotFoundException { if ("setSize".equals(methodName)) { int argCount = SignatureUtils.getNumParameters(getSigConstantOperand()); if ((windowClass != null) && (stack.getStackDepth() > argCount)) { OpcodeStack.It...
[ "private", "void", "processSetSizeOps", "(", "String", "methodName", ")", "throws", "ClassNotFoundException", "{", "if", "(", "\"setSize\"", ".", "equals", "(", "methodName", ")", ")", "{", "int", "argCount", "=", "SignatureUtils", ".", "getNumParameters", "(", ...
looks for calls to setSize on components, rather than letting the layout manager set them @param methodName the method that was called on a component @throws ClassNotFoundException if the gui class wasn't found
[ "looks", "for", "calls", "to", "setSize", "on", "components", "rather", "than", "letting", "the", "layout", "manager", "set", "them" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L408-L420
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getAStoreReg
public static int getAStoreReg(final DismantleBytecode dbc, final int seen) { if (seen == Const.ASTORE) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isAStore(seen)) { return seen - Const.ASTORE_0; } return -1; }
java
public static int getAStoreReg(final DismantleBytecode dbc, final int seen) { if (seen == Const.ASTORE) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isAStore(seen)) { return seen - Const.ASTORE_0; } return -1; }
[ "public", "static", "int", "getAStoreReg", "(", "final", "DismantleBytecode", "dbc", ",", "final", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "ASTORE", ")", "{", "return", "dbc", ".", "getRegisterOperand", "(", ")", ";", "}", "if", ...
returns the register used to store a reference @param dbc the dismantle byte code parsing the class @param seen the opcode of the store @return the register stored into
[ "returns", "the", "register", "used", "to", "store", "a", "reference" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L49-L58
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getALoadReg
public static int getALoadReg(DismantleBytecode dbc, int seen) { if (seen == Const.ALOAD) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isALoad(seen)) { return seen - Const.ALOAD_0; } return -1; }
java
public static int getALoadReg(DismantleBytecode dbc, int seen) { if (seen == Const.ALOAD) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isALoad(seen)) { return seen - Const.ALOAD_0; } return -1; }
[ "public", "static", "int", "getALoadReg", "(", "DismantleBytecode", "dbc", ",", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "ALOAD", ")", "{", "return", "dbc", ".", "getRegisterOperand", "(", ")", ";", "}", "if", "(", "OpcodeUtils", ...
returns the register used to load a reference @param dbc the dismantle byte code parsing the class @param seen the opcode of the load @return the register loaded from
[ "returns", "the", "register", "used", "to", "load", "a", "reference" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L69-L77
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getStoreReg
public static int getStoreReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ASTORE) || (seen == Const.ISTORE) || (seen == Const.LSTORE) || (seen == Const.FSTORE) || (seen == Const.DSTORE)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isIStore(seen)) { retu...
java
public static int getStoreReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ASTORE) || (seen == Const.ISTORE) || (seen == Const.LSTORE) || (seen == Const.FSTORE) || (seen == Const.DSTORE)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isIStore(seen)) { retu...
[ "public", "static", "int", "getStoreReg", "(", "DismantleBytecode", "dbc", ",", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "ASTORE", ")", "||", "(", "seen", "==", "Const", ".", "ISTORE", ")", "||", "(", "seen", "==", "Const"...
returns the register used in a store operation @param dbc the dismantle byte code parsing the class @param seen the opcode of the store @return the register stored into
[ "returns", "the", "register", "used", "in", "a", "store", "operation" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L88-L104
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getLoadReg
public static int getLoadReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ALOAD) || (seen == Const.ILOAD) || (seen == Const.LLOAD) || (seen == Const.FLOAD) || (seen == Const.DLOAD)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isILoad(seen)) { return seen...
java
public static int getLoadReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ALOAD) || (seen == Const.ILOAD) || (seen == Const.LLOAD) || (seen == Const.FLOAD) || (seen == Const.DLOAD)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isILoad(seen)) { return seen...
[ "public", "static", "int", "getLoadReg", "(", "DismantleBytecode", "dbc", ",", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "ALOAD", ")", "||", "(", "seen", "==", "Const", ".", "ILOAD", ")", "||", "(", "seen", "==", "Const", ...
returns the register used in a load operation @param dbc the dismantle byte code parsing the class @param seen the opcode of the load @return the register stored into
[ "returns", "the", "register", "used", "in", "a", "load", "operation" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L115-L131
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getLocalVariableEndRange
public static int getLocalVariableEndRange(LocalVariableTable lvt, int reg, int curPC) { int endRange = Integer.MAX_VALUE; if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, curPC); if (lv != null) { endRange = lv.getStartPC() + lv.getLength(); ...
java
public static int getLocalVariableEndRange(LocalVariableTable lvt, int reg, int curPC) { int endRange = Integer.MAX_VALUE; if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, curPC); if (lv != null) { endRange = lv.getStartPC() + lv.getLength(); ...
[ "public", "static", "int", "getLocalVariableEndRange", "(", "LocalVariableTable", "lvt", ",", "int", "reg", ",", "int", "curPC", ")", "{", "int", "endRange", "=", "Integer", ".", "MAX_VALUE", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVariable", ...
returns the end pc of the visible range of this register at this pc @param lvt the local variable table for this method @param reg the register to examine @param curPC the pc of the current instruction @return the endpc
[ "returns", "the", "end", "pc", "of", "the", "visible", "range", "of", "this", "register", "at", "this", "pc" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L144-L153
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getParameterRegisters
public static int[] getParameterRegisters(Method obj) { Type[] argTypes = obj.getArgumentTypes(); int[] regs = new int[argTypes.length]; int curReg = obj.isStatic() ? 0 : 1; for (int t = 0; t < argTypes.length; t++) { String sig = argTypes[t].getSignature(); regs...
java
public static int[] getParameterRegisters(Method obj) { Type[] argTypes = obj.getArgumentTypes(); int[] regs = new int[argTypes.length]; int curReg = obj.isStatic() ? 0 : 1; for (int t = 0; t < argTypes.length; t++) { String sig = argTypes[t].getSignature(); regs...
[ "public", "static", "int", "[", "]", "getParameterRegisters", "(", "Method", "obj", ")", "{", "Type", "[", "]", "argTypes", "=", "obj", ".", "getArgumentTypes", "(", ")", ";", "int", "[", "]", "regs", "=", "new", "int", "[", "argTypes", ".", "length", ...
gets the set of registers used for parameters @param obj the context object for the method to find the parameter registers of @return the set of registers that parameters are using
[ "gets", "the", "set", "of", "registers", "used", "for", "parameters" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L163-L174
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java
StaticArrayCreatedInMethod.visitCode
@Override public void visitCode(Code obj) { if (!Values.STATIC_INITIALIZER.equals(getMethodName())) { state = State.SEEN_NOTHING; super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { if (!Values.STATIC_INITIALIZER.equals(getMethodName())) { state = State.SEEN_NOTHING; super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "!", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "getMethodName", "(", ")", ")", ")", "{", "state", "=", "State", ".", "SEEN_NOTHING", ";", "super", "...
implements the visitor by forwarding calls for methods that are the static initializer @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "by", "forwarding", "calls", "for", "methods", "that", "are", "the", "static", "initializer" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java#L56-L62
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java
StaticArrayCreatedInMethod.sawOpcode
@Override public void sawOpcode(int seen) { int index; switch (state) { case SEEN_NOTHING: if (seen == Const.BIPUSH) { arraySize = getIntConstant(); if (arraySize > 0) { state = State.SEEN_ARRAY_SIZE; ...
java
@Override public void sawOpcode(int seen) { int index; switch (state) { case SEEN_NOTHING: if (seen == Const.BIPUSH) { arraySize = getIntConstant(); if (arraySize > 0) { state = State.SEEN_ARRAY_SIZE; ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "int", "index", ";", "switch", "(", "state", ")", "{", "case", "SEEN_NOTHING", ":", "if", "(", "seen", "==", "Const", ".", "BIPUSH", ")", "{", "arraySize", "=", "getIntConsta...
implements the visitor to look for creation of local arrays using constant values @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "look", "for", "creation", "of", "local", "arrays", "using", "constant", "values" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java#L70-L149
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java
NonFunctionalField.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if ((serializableClass != null) && (cls.implementationOf(serializableClass))) { Field[] fields = cls.getFields(); setupVisitorForCla...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if ((serializableClass != null) && (cls.implementationOf(serializableClass))) { Field[] fields = cls.getFields(); setupVisitorForCla...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "(", "serializableClass", "!=", "null", ")", "&&", "(",...
checks to see if the class is Serializable, then looks for fields that are both final and transient @param classContext the context object of the currently parsed class
[ "checks", "to", "see", "if", "the", "class", "is", "Serializable", "then", "looks", "for", "fields", "that", "are", "both", "final", "and", "transient" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java#L65-L82
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
ArrayIndexOutOfBounds.visitCode
@Override public void visitCode(Code obj) { Method m = getMethod(); stack.resetForMethodEntry(this); initializedRegs.clear(); modifyRegs.clear(); Type[] argTypes = m.getArgumentTypes(); int arg = m.isStatic() ? 0 : 1; for (Type argType : argTypes) { ...
java
@Override public void visitCode(Code obj) { Method m = getMethod(); stack.resetForMethodEntry(this); initializedRegs.clear(); modifyRegs.clear(); Type[] argTypes = m.getArgumentTypes(); int arg = m.isStatic() ? 0 : 1; for (Type argType : argTypes) { ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "m", "=", "getMethod", "(", ")", ";", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "initializedRegs", ".", "clear", "(", ")", ";", "modifyRegs", ".", ...
overrides the visitor to collect parameter registers @param obj the code block of the currently parsed method
[ "overrides", "the", "visitor", "to", "collect", "parameter", "registers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java#L90-L110
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
AbnormalFinallyBlockReturn.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { // TODO: Look at method calls in a finally block to see if they throw // exceptions // : and those exceptions are not caught in the finally block // : Only do it if effort is on, ie: boolean fullAnalysis = /...
java
@Override public void visitClassContext(ClassContext classContext) { // TODO: Look at method calls in a finally block to see if they throw // exceptions // : and those exceptions are not caught in the finally block // : Only do it if effort is on, ie: boolean fullAnalysis = /...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "// TODO: Look at method calls in a finally block to see if they throw", "// exceptions", "// : and those exceptions are not caught in the finally block", "// : Only do it if effort is on...
overrides the visitor to check for java class version being as good or better than 1.4 @param classContext the context object that holds the JavaClass parsed
[ "overrides", "the", "visitor", "to", "check", "for", "java", "class", "version", "being", "as", "good", "or", "better", "than", "1", ".", "4" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java#L70-L87
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
AbnormalFinallyBlockReturn.visitCode
@Override public void visitCode(Code obj) { fbInfo.clear(); loadedReg = -1; CodeException[] exc = obj.getExceptionTable(); if (exc != null) { for (CodeException ce : exc) { if ((ce.getCatchType() == 0) && (ce.getStartPC() == ce.getHandlerPC())) { ...
java
@Override public void visitCode(Code obj) { fbInfo.clear(); loadedReg = -1; CodeException[] exc = obj.getExceptionTable(); if (exc != null) { for (CodeException ce : exc) { if ((ce.getCatchType() == 0) && (ce.getStartPC() == ce.getHandlerPC())) { ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "fbInfo", ".", "clear", "(", ")", ";", "loadedReg", "=", "-", "1", ";", "CodeException", "[", "]", "exc", "=", "obj", ".", "getExceptionTable", "(", ")", ";", "if", "(", ...
overrides the visitor to collect finally block info. @param obj the code object to scan for finally blocks
[ "overrides", "the", "visitor", "to", "collect", "finally", "block", "info", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java#L95-L116
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
AbnormalFinallyBlockReturn.findMethod
@Nullable private static Method findMethod(JavaClass cls, String name, String sig) { Method[] methods = cls.getMethods(); for (Method m : methods) { if (m.getName().equals(name) && m.getSignature().equals(sig)) { return m; } } return null; ...
java
@Nullable private static Method findMethod(JavaClass cls, String name, String sig) { Method[] methods = cls.getMethods(); for (Method m : methods) { if (m.getName().equals(name) && m.getSignature().equals(sig)) { return m; } } return null; ...
[ "@", "Nullable", "private", "static", "Method", "findMethod", "(", "JavaClass", "cls", ",", "String", "name", ",", "String", "sig", ")", "{", "Method", "[", "]", "methods", "=", "cls", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "m", ":", ...
finds the method in specified class by name and signature @param cls the class to look the method in @param name the name of the method to look for @param sig the signature of the method to look for @return the Method object for the specified information
[ "finds", "the", "method", "in", "specified", "class", "by", "name", "and", "signature" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java#L209-L219
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
WeakExceptionMessaging.prescreen
public boolean prescreen(Method method) { if (Values.STATIC_INITIALIZER.equals(method.getName())) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.ATHROW)); }
java
public boolean prescreen(Method method) { if (Values.STATIC_INITIALIZER.equals(method.getName())) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.ATHROW)); }
[ "public", "boolean", "prescreen", "(", "Method", "method", ")", "{", "if", "(", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "method", ".", "getName", "(", ")", ")", ")", "{", "return", "false", ";", "}", "BitSet", "bytecodeSet", "=", "getCla...
looks for methods that contain a ATHROW opcodes, ignoring static initializers @param method the context object of the current method @return if the class uses throws
[ "looks", "for", "methods", "that", "contain", "a", "ATHROW", "opcodes", "ignoring", "static", "initializers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java#L102-L109
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
WeakExceptionMessaging.visitCode
@Override public void visitCode(Code obj) { Method method = getMethod(); if (!method.isSynthetic() && prescreen(method)) { stack.resetForMethodEntry(this); super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { Method method = getMethod(); if (!method.isSynthetic() && prescreen(method)) { stack.resetForMethodEntry(this); super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "Method", "method", "=", "getMethod", "(", ")", ";", "if", "(", "!", "method", ".", "isSynthetic", "(", ")", "&&", "prescreen", "(", "method", ")", ")", "{", "stack", ".", ...
overrides the visitor to prescreen the method to look for throws calls and only forward onto bytecode scanning if there @param obj the context object of the currently parsed code block
[ "overrides", "the", "visitor", "to", "prescreen", "the", "method", "to", "look", "for", "throws", "calls", "and", "only", "forward", "onto", "bytecode", "scanning", "if", "there" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java#L117-L124
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
WeakExceptionMessaging.sawOpcode
@Override public void sawOpcode(int seen) { boolean allConstantStrings = false; boolean sawConstant = false; try { stack.precomputation(this); if (seen == Const.ATHROW) { checkForWEM(); } else if ((seen == Const.LDC) || (seen == Const.LDC_...
java
@Override public void sawOpcode(int seen) { boolean allConstantStrings = false; boolean sawConstant = false; try { stack.precomputation(this); if (seen == Const.ATHROW) { checkForWEM(); } else if ((seen == Const.LDC) || (seen == Const.LDC_...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "boolean", "allConstantStrings", "=", "false", ";", "boolean", "sawConstant", "=", "false", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "if", "(", "...
overrides the visitor to look for throws instructions using exceptions with static messages @param seen the opcode of the currently visited instruction
[ "overrides", "the", "visitor", "to", "look", "for", "throws", "instructions", "using", "exceptions", "with", "static", "messages" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java#L132-L184
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/FBContrib.java
FBContrib.main
public static void main(final String[] args) { JOptionPane.showMessageDialog(null, "To use fb-contrib, copy this jar file into your local SpotBugs plugin directory, and use SpotBugs as usual.\n\nfb-contrib is a trademark of MeBigFatGuy.com", "fb-contrib: copyright 2005-2019", JOp...
java
public static void main(final String[] args) { JOptionPane.showMessageDialog(null, "To use fb-contrib, copy this jar file into your local SpotBugs plugin directory, and use SpotBugs as usual.\n\nfb-contrib is a trademark of MeBigFatGuy.com", "fb-contrib: copyright 2005-2019", JOp...
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"To use fb-contrib, copy this jar file into your local SpotBugs plugin directory, and use SpotBugs as usual.\\n\\nfb-contrib is a t...
shows the simple help @param args standard command line args
[ "shows", "the", "simple", "help" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/FBContrib.java#L37-L42
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
SuspiciousComparatorReturnValues.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); for (CompareSpec entry : compareClasses) { if (cls.implementationOf(entry.getCompareClass())) { methodInfo = entry.getMethodInfo...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); for (CompareSpec entry : compareClasses) { if (cls.implementationOf(entry.getCompareClass())) { methodInfo = entry.getMethodInfo...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "for", "(", "CompareSpec", "entry", ":", "compareClasses", ")", "{",...
implements the visitor to actually iterate twice over this class, once for compareTo and once for compare. @param classContext the currently parsed class
[ "implements", "the", "visitor", "to", "actually", "iterate", "twice", "over", "this", "class", "once", "for", "compareTo", "and", "once", "for", "compare", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java#L91-L109
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
SuspiciousComparatorReturnValues.visitCode
@Override public void visitCode(Code obj) { if (getMethod().isSynthetic()) { return; } String methodName = getMethodName(); String methodSig = getMethodSig(); if (methodName.equals(methodInfo.methodName) && methodSig.endsWith(methodInfo.signatureEnding) ...
java
@Override public void visitCode(Code obj) { if (getMethod().isSynthetic()) { return; } String methodName = getMethodName(); String methodSig = getMethodSig(); if (methodName.equals(methodInfo.methodName) && methodSig.endsWith(methodInfo.signatureEnding) ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "getMethod", "(", ")", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "String", "methodName", "=", "getMethodName", "(", ")", ";", "String", "methodSi...
implements the visitor to check to see what Const were returned from a comparator. If no Const were returned it can't determine anything, however if only Const were returned, it looks to see if negative positive and zero was returned. It also looks to see if a non zero value is returned unconditionally. While it is pos...
[ "implements", "the", "visitor", "to", "check", "to", "see", "what", "Const", "were", "returned", "from", "a", "comparator", ".", "If", "no", "Const", "were", "returned", "it", "can", "t", "determine", "anything", "however", "if", "only", "Const", "were", "...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java#L119-L150
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
SuspiciousComparatorReturnValues.sawOpcode
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); switch (seen) { case Const.IRETURN: { processIntegerReturn(); } break; case Const.GOTO: case Const.GOTO_...
java
@Override public void sawOpcode(int seen) { try { stack.precomputation(this); switch (seen) { case Const.IRETURN: { processIntegerReturn(); } break; case Const.GOTO: case Const.GOTO_...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "IRETURN", ":", "{", "processIntegerReturn", "(", ")...
implements the visitor to look for returns of constant values, and records them for being negative, zero or positive. It also records unconditional returns of non zero values @param seen the currently parsed opcode
[ "implements", "the", "visitor", "to", "look", "for", "returns", "of", "constant", "values", "and", "records", "them", "for", "being", "negative", "zero", "or", "positive", ".", "It", "also", "records", "unconditional", "returns", "of", "non", "zero", "values" ...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java#L159-L252
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java
ParallelLists.visitCode
@Override public void visitCode(final Code obj) { stack.resetForMethodEntry(this); indexToFieldMap.clear(); super.visitCode(obj); }
java
@Override public void visitCode(final Code obj) { stack.resetForMethodEntry(this); indexToFieldMap.clear(); super.visitCode(obj); }
[ "@", "Override", "public", "void", "visitCode", "(", "final", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "indexToFieldMap", ".", "clear", "(", ")", ";", "super", ".", "visitCode", "(", "obj", ")", ";", "}" ]
implements the visitor to reset the opcode stack, and the file maps @param obj the currently parsed method code block
[ "implements", "the", "visitor", "to", "reset", "the", "opcode", "stack", "and", "the", "file", "maps" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java#L99-L104
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java
ParallelLists.getIntOpRegister
private int getIntOpRegister(final int seen) { if ((seen == Const.ISTORE) || (seen == Const.IINC)) { return getRegisterOperand(); } return seen - Const.ISTORE_0; }
java
private int getIntOpRegister(final int seen) { if ((seen == Const.ISTORE) || (seen == Const.IINC)) { return getRegisterOperand(); } return seen - Const.ISTORE_0; }
[ "private", "int", "getIntOpRegister", "(", "final", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "ISTORE", ")", "||", "(", "seen", "==", "Const", ".", "IINC", ")", ")", "{", "return", "getRegisterOperand", "(", ")", ";", "}", ...
fetch the register from a integer op code @param seen the currently parsed opcode @return the register in use
[ "fetch", "the", "register", "from", "a", "integer", "op", "code" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java#L140-L145
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
UseEnumCollections.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.getMajor() >= Const.MAJOR_1_5) { stack = new OpcodeStack(); checkedFields = new HashSet<>(); enumRegs = new ...
java
@Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); if (cls.getMajor() >= Const.MAJOR_1_5) { stack = new OpcodeStack(); checkedFields = new HashSet<>(); enumRegs = new ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "JavaClass", "cls", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "cls", ".", "getMajor", "(", ")", ">=", "Const", ".",...
implements the visitor to check that the class is greater or equal than 1.5, and set and clear the stack @param classContext the context object for the currently parsed class
[ "implements", "the", "visitor", "to", "check", "that", "the", "class", "is", "greater", "or", "equal", "than", "1", ".", "5", "and", "set", "and", "clear", "the", "stack" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java#L79-L96
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
UseEnumCollections.isEnum
private boolean isEnum(int stackPos) throws ClassNotFoundException { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); if (!item.getSignature().startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { return fa...
java
private boolean isEnum(int stackPos) throws ClassNotFoundException { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); if (!item.getSignature().startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { return fa...
[ "private", "boolean", "isEnum", "(", "int", "stackPos", ")", "throws", "ClassNotFoundException", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<=", "stackPos", ")", "{", "return", "false", ";", "}", "OpcodeStack", ".", "Item", "item", "=", "sta...
returns whether the item at the stackPos location on the stack is an enum, and doesn't implement any interfaces @param stackPos the position on the opstack to check @return whether the class is an enum @throws ClassNotFoundException if the class can not be loaded
[ "returns", "whether", "the", "item", "at", "the", "stackPos", "location", "on", "the", "stack", "is", "an", "enum", "and", "doesn", "t", "implement", "any", "interfaces" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java#L223-L241
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
UseEnumCollections.couldBeEnumCollection
private boolean couldBeEnumCollection(int stackPos) { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); CollectionType userValue = (CollectionType) item.getUserValue(); if (userValue != null) { ...
java
private boolean couldBeEnumCollection(int stackPos) { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); CollectionType userValue = (CollectionType) item.getUserValue(); if (userValue != null) { ...
[ "private", "boolean", "couldBeEnumCollection", "(", "int", "stackPos", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<=", "stackPos", ")", "{", "return", "false", ";", "}", "OpcodeStack", ".", "Item", "item", "=", "stack", ".", "getStackIt...
returns whether the item at the stackpos location isn't an enum collection but could be @param stackPos the position on the opstack to check @return whether the collection should be converted to an enum collection
[ "returns", "whether", "the", "item", "at", "the", "stackpos", "location", "isn", "t", "an", "enum", "collection", "but", "could", "be" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java#L251-L265
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
UseEnumCollections.alreadyReported
private boolean alreadyReported(int stackPos) { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); XField field = item.getXField(); if (field == null) { return false; } String fi...
java
private boolean alreadyReported(int stackPos) { if (stack.getStackDepth() <= stackPos) { return false; } OpcodeStack.Item item = stack.getStackItem(stackPos); XField field = item.getXField(); if (field == null) { return false; } String fi...
[ "private", "boolean", "alreadyReported", "(", "int", "stackPos", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", "<=", "stackPos", ")", "{", "return", "false", ";", "}", "OpcodeStack", ".", "Item", "item", "=", "stack", ".", "getStackItem", ...
returns whether the collection has already been reported on @param stackPos the position on the opstack to check @return whether the collection has already been reported.
[ "returns", "whether", "the", "collection", "has", "already", "been", "reported", "on" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java#L275-L288
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
StackedTryBlocks.visitCode
@Override public void visitCode(Code obj) { try { XMethod xMethod = getXMethod(); if (xMethod != null) { String[] tes = xMethod.getThrownExceptions(); Set<String> thrownExceptions = new HashSet<>(Arrays.<String> asList((tes == null) ? new String[0] : ...
java
@Override public void visitCode(Code obj) { try { XMethod xMethod = getXMethod(); if (xMethod != null) { String[] tes = xMethod.getThrownExceptions(); Set<String> thrownExceptions = new HashSet<>(Arrays.<String> asList((tes == null) ? new String[0] : ...
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "try", "{", "XMethod", "xMethod", "=", "getXMethod", "(", ")", ";", "if", "(", "xMethod", "!=", "null", ")", "{", "String", "[", "]", "tes", "=", "xMethod", ".", "getThrown...
overrides the visitor to look for 'idea' try catch blocks to find issues specifically, method needs two or more try catch blocks that only catch one exception type. @param obj the currently parsed code object
[ "overrides", "the", "visitor", "to", "look", "for", "idea", "try", "catch", "blocks", "to", "find", "issues", "specifically", "method", "needs", "two", "or", "more", "try", "catch", "blocks", "that", "only", "catch", "one", "exception", "type", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java#L88-L150
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
StackedTryBlocks.findBlockWithStart
@Nullable private TryBlock findBlockWithStart(int pc) { for (TryBlock block : blocks) { if (block.atStartPC(pc)) { return block; } } return null; }
java
@Nullable private TryBlock findBlockWithStart(int pc) { for (TryBlock block : blocks) { if (block.atStartPC(pc)) { return block; } } return null; }
[ "@", "Nullable", "private", "TryBlock", "findBlockWithStart", "(", "int", "pc", ")", "{", "for", "(", "TryBlock", "block", ":", "blocks", ")", "{", "if", "(", "block", ".", "atStartPC", "(", "pc", ")", ")", "{", "return", "block", ";", "}", "}", "ret...
looks for an existing try block that has this pc as a start of the try @param pc the current program counter @return the tryblock if this statement starts it, else null
[ "looks", "for", "an", "existing", "try", "block", "that", "has", "this", "pc", "as", "a", "start", "of", "the", "try" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java#L274-L284
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java
DateComparison.visit
@Override public void visit(Method obj) { state = State.SAW_NOTHING; register1_1 = -1; register1_2 = -1; register2_1 = -1; register2_2 = -1; super.visit(obj); }
java
@Override public void visit(Method obj) { state = State.SAW_NOTHING; register1_1 = -1; register1_2 = -1; register2_1 = -1; register2_2 = -1; super.visit(obj); }
[ "@", "Override", "public", "void", "visit", "(", "Method", "obj", ")", "{", "state", "=", "State", ".", "SAW_NOTHING", ";", "register1_1", "=", "-", "1", ";", "register1_2", "=", "-", "1", ";", "register2_1", "=", "-", "1", ";", "register2_2", "=", "...
overrides the visitor to reset the registers @param obj the method of the currently parsed method
[ "overrides", "the", "visitor", "to", "reset", "the", "registers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java#L76-L84
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java
DateComparison.sawOpcode
@Override public void sawOpcode(int seen) { switch (state) { case SAW_NOTHING: if (OpcodeUtils.isALoad(seen)) { register1_1 = RegisterUtils.getALoadReg(this, seen); state = State.SAW_LOAD1_1; } break; ...
java
@Override public void sawOpcode(int seen) { switch (state) { case SAW_NOTHING: if (OpcodeUtils.isALoad(seen)) { register1_1 = RegisterUtils.getALoadReg(this, seen); state = State.SAW_LOAD1_1; } break; ...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "if", "(", "OpcodeUtils", ".", "isALoad", "(", "seen", ")", ")", "{", "register1_1", "=", "RegisterUtils", ".", ...
overrides the visitor to look for double date compares using the same registers @param seen the current opcode parsed.
[ "overrides", "the", "visitor", "to", "look", "for", "double", "date", "compares", "using", "the", "same", "registers" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java#L92-L187
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java
AbstractCollectionScanningDetector.isLocalCollection
protected final int isLocalCollection(OpcodeStack.Item item) throws ClassNotFoundException { Comparable<?> aliasReg = (Comparable<?>) item.getUserValue(); if (aliasReg instanceof Integer) { return ((Integer) aliasReg).intValue(); } int reg = item.getRegisterNumber(); ...
java
protected final int isLocalCollection(OpcodeStack.Item item) throws ClassNotFoundException { Comparable<?> aliasReg = (Comparable<?>) item.getUserValue(); if (aliasReg instanceof Integer) { return ((Integer) aliasReg).intValue(); } int reg = item.getRegisterNumber(); ...
[ "protected", "final", "int", "isLocalCollection", "(", "OpcodeStack", ".", "Item", "item", ")", "throws", "ClassNotFoundException", "{", "Comparable", "<", "?", ">", "aliasReg", "=", "(", "Comparable", "<", "?", ">", ")", "item", ".", "getUserValue", "(", ")...
determines if the stack item refers to a collection that is stored in a local variable @param item the stack item to check @return the register number of the local variable that this collection refers to, or -1 @throws ClassNotFoundException if the items class cannot be found
[ "determines", "if", "the", "stack", "item", "refers", "to", "a", "collection", "that", "is", "stored", "in", "a", "local", "variable" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java#L92-L109
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { localizableFields = new HashMap<>(); visitedBlocks = new BitSet(); clsContext = classContext; clsName = clsContext.getJavaClass().getClassName(); clsSig = SignatureUtils.cla...
java
@Override public void visitClassContext(ClassContext classContext) { try { localizableFields = new HashMap<>(); visitedBlocks = new BitSet(); clsContext = classContext; clsName = clsContext.getJavaClass().getClassName(); clsSig = SignatureUtils.cla...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "localizableFields", "=", "new", "HashMap", "<>", "(", ")", ";", "visitedBlocks", "=", "new", "BitSet", "(", ")", ";", "clsContext", "=", "clas...
overrides the visitor to collect localizable fields, and then report those that survive all method checks. @param classContext the context object that holds the JavaClass parsed
[ "overrides", "the", "visitor", "to", "collect", "localizable", "fields", "and", "then", "report", "those", "that", "survive", "all", "method", "checks", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L97-L143
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.visitMethod
@Override public void visitMethod(Method obj) { if (localizableFields.isEmpty()) { return; } try { cfg = clsContext.getCFG(obj); cpg = cfg.getMethodGen().getConstantPool(); BasicBlock bb = cfg.getEntry(); Set<String> uncheckedFiel...
java
@Override public void visitMethod(Method obj) { if (localizableFields.isEmpty()) { return; } try { cfg = clsContext.getCFG(obj); cpg = cfg.getMethodGen().getConstantPool(); BasicBlock bb = cfg.getEntry(); Set<String> uncheckedFiel...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "if", "(", "localizableFields", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "try", "{", "cfg", "=", "clsContext", ".", "getCFG", "(", "obj", ")", ";", "cpg"...
overrides the visitor to navigate basic blocks looking for all first usages of fields, removing those that are read from first. @param obj the context object of the currently parsed method
[ "overrides", "the", "visitor", "to", "navigate", "basic", "blocks", "looking", "for", "all", "first", "usages", "of", "fields", "removing", "those", "that", "are", "read", "from", "first", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L151-L171
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.prescreen
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.PUTFIELD) || bytecodeSet.get(Const.GETFIELD)); }
java
private boolean prescreen(Method method) { BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Const.PUTFIELD) || bytecodeSet.get(Const.GETFIELD)); }
[ "private", "boolean", "prescreen", "(", "Method", "method", ")", "{", "BitSet", "bytecodeSet", "=", "getClassContext", "(", ")", ".", "getBytecodeSet", "(", "method", ")", ";", "return", "(", "bytecodeSet", "!=", "null", ")", "&&", "(", "bytecodeSet", ".", ...
looks for methods that contain a GETFIELD or PUTFIELD opcodes @param method the context object of the current method @return if the class uses GETFIELD or PUTFIELD
[ "looks", "for", "methods", "that", "contain", "a", "GETFIELD", "or", "PUTFIELD", "opcodes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L180-L183
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.sawOpcode
@Override public void sawOpcode(int seen) { if ((seen == Const.GETFIELD) || (seen == Const.PUTFIELD)) { String fieldName = getNameConstantOperand(); FieldInfo fi = localizableFields.get(fieldName); if (fi != null) { SourceLineAnnotation sla = SourceLineAnn...
java
@Override public void sawOpcode(int seen) { if ((seen == Const.GETFIELD) || (seen == Const.PUTFIELD)) { String fieldName = getNameConstantOperand(); FieldInfo fi = localizableFields.get(fieldName); if (fi != null) { SourceLineAnnotation sla = SourceLineAnn...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "(", "seen", "==", "Const", ".", "GETFIELD", ")", "||", "(", "seen", "==", "Const", ".", "PUTFIELD", ")", ")", "{", "String", "fieldName", "=", "getNameConstantOpe...
implements the visitor to add SourceLineAnnotations for fields in constructors and static initializers. @param seen the opcode of the currently visited instruction
[ "implements", "the", "visitor", "to", "add", "SourceLineAnnotations", "for", "fields", "in", "constructors", "and", "static", "initializers", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L209-L219
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
FieldCouldBeLocal.buildMethodFieldModifiers
private void buildMethodFieldModifiers(ClassContext classContext) { FieldModifier fm = new FieldModifier(); fm.visitClassContext(classContext); methodFieldModifiers = fm.getMethodFieldModifiers(); }
java
private void buildMethodFieldModifiers(ClassContext classContext) { FieldModifier fm = new FieldModifier(); fm.visitClassContext(classContext); methodFieldModifiers = fm.getMethodFieldModifiers(); }
[ "private", "void", "buildMethodFieldModifiers", "(", "ClassContext", "classContext", ")", "{", "FieldModifier", "fm", "=", "new", "FieldModifier", "(", ")", ";", "fm", ".", "visitClassContext", "(", "classContext", ")", ";", "methodFieldModifiers", "=", "fm", ".",...
builds up the method to field map of what method write to which fields this is one recursively so that if method A calls method B, and method B writes to field C, then A modifies F. @param classContext the context object of the currently parsed class
[ "builds", "up", "the", "method", "to", "field", "map", "of", "what", "method", "write", "to", "which", "fields", "this", "is", "one", "recursively", "so", "that", "if", "method", "A", "calls", "method", "B", "and", "method", "B", "writes", "to", "field",...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java#L318-L322
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { if (mapInterface != null) { this.clsContext = classContext; classContext.getJavaClass().accept(this); } }
java
@Override public void visitClassContext(ClassContext classContext) { if (mapInterface != null) { this.clsContext = classContext; classContext.getJavaClass().accept(this); } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "if", "(", "mapInterface", "!=", "null", ")", "{", "this", ".", "clsContext", "=", "classContext", ";", "classContext", ".", "getJavaClass", "(", ")", ".", ...
overrides the visitor to make sure that the static initializer was able to load the map class @param classContext the currently parsed class
[ "overrides", "the", "visitor", "to", "make", "sure", "that", "the", "static", "initializer", "was", "able", "to", "load", "the", "map", "class" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L83-L89
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.visitField
@Override public void visitField(Field obj) { if (checkConfusedName(obj.getName(), obj.getSignature())) { bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this).addField(this) .addString(obj.getName())); ...
java
@Override public void visitField(Field obj) { if (checkConfusedName(obj.getName(), obj.getSignature())) { bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this).addField(this) .addString(obj.getName())); ...
[ "@", "Override", "public", "void", "visitField", "(", "Field", "obj", ")", "{", "if", "(", "checkConfusedName", "(", "obj", ".", "getName", "(", ")", ",", "obj", ".", "getSignature", "(", ")", ")", ")", "{", "bugReporter", ".", "reportBug", "(", "new",...
overrides the visitor to look for fields where the name has 'Map', 'Set', 'List' in it but the type of that field isn't that. @param obj the currently parsed field
[ "overrides", "the", "visitor", "to", "look", "for", "fields", "where", "the", "name", "has", "Map", "Set", "List", "in", "it", "but", "the", "type", "of", "that", "field", "isn", "t", "that", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L97-L103
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.visitMethod
@Override public void visitMethod(Method obj) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable[] lvs = lvt.getLocalVariableTable(); for (LocalVariable lv : lvs) { if (checkConfusedName(lv.getName(), lv.getSignature())) {...
java
@Override public void visitMethod(Method obj) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable[] lvs = lvt.getLocalVariableTable(); for (LocalVariable lv : lvs) { if (checkConfusedName(lv.getName(), lv.getSignature())) {...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "LocalVariableTable", "lvt", "=", "obj", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVariable", "[", "]", "lvs", "=", "lvt"...
overrides the visitor to look for local variables where the name has 'Map', 'Set', 'List' in it but the type of that field isn't that. note that this only is useful if compiled with debug labels. @param obj the currently parsed method
[ "overrides", "the", "visitor", "to", "look", "for", "local", "variables", "where", "the", "name", "has", "Map", "Set", "List", "in", "it", "but", "the", "type", "of", "that", "field", "isn", "t", "that", ".", "note", "that", "this", "only", "is", "usef...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L112-L124
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.checkConfusedName
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EXS_EXCEPTION_SOFTENING_RETURN_FALSE", justification = "No other simple way to determine whether class exists") private boolean checkConfusedName(String methodOrVariableName, String signature) { try { String name = methodOrVariableName...
java
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EXS_EXCEPTION_SOFTENING_RETURN_FALSE", justification = "No other simple way to determine whether class exists") private boolean checkConfusedName(String methodOrVariableName, String signature) { try { String name = methodOrVariableName...
[ "@", "edu", ".", "umd", ".", "cs", ".", "findbugs", ".", "annotations", ".", "SuppressFBWarnings", "(", "value", "=", "\"EXS_EXCEPTION_SOFTENING_RETURN_FALSE\"", ",", "justification", "=", "\"No other simple way to determine whether class exists\"", ")", "private", "boole...
looks for a name that mentions a collection type but the wrong type for the variable @param methodOrVariableName the method or variable name @param signature the variable signature @return whether the name doesn't match the type
[ "looks", "for", "a", "name", "that", "mentions", "a", "collection", "type", "but", "the", "wrong", "type", "for", "the", "variable" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L135-L154
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java
ConflictingTimeUnits.sawOpcode
@Override public void sawOpcode(int seen) { Units unit = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESTATIC: unit = processI...
java
@Override public void sawOpcode(int seen) { Units unit = null; try { stack.precomputation(this); switch (seen) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESTATIC: unit = processI...
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "Units", "unit", "=", "null", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "seen", ")", "{", "case", "Const", ".", "INVOKEVIRTUAL", ...
overrides the visitor to look for operations on two time unit values that are conflicting
[ "overrides", "the", "visitor", "to", "look", "for", "operations", "on", "two", "time", "unit", "values", "that", "are", "conflicting" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java#L179-L230
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java
ConflictingTimeUnits.processArithmetic
@SuppressWarnings("PMD.CompareObjectsWithEquals") private void processArithmetic() { if (stack.getStackDepth() > 1) { OpcodeStack.Item arg1 = stack.getStackItem(0); OpcodeStack.Item arg2 = stack.getStackItem(1); Units u1 = (Units) arg1.getUserValue(); Units u...
java
@SuppressWarnings("PMD.CompareObjectsWithEquals") private void processArithmetic() { if (stack.getStackDepth() > 1) { OpcodeStack.Item arg1 = stack.getStackItem(0); OpcodeStack.Item arg2 = stack.getStackItem(1); Units u1 = (Units) arg1.getUserValue(); Units u...
[ "@", "SuppressWarnings", "(", "\"PMD.CompareObjectsWithEquals\"", ")", "private", "void", "processArithmetic", "(", ")", "{", "if", "(", "stack", ".", "getStackDepth", "(", ")", ">", "1", ")", "{", "OpcodeStack", ".", "Item", "arg1", "=", "stack", ".", "getS...
false positive; we're comparing enums
[ "false", "positive", ";", "we", "re", "comparing", "enums" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java#L250-L264
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { if ((throwableClass != null) && !isPre14Class(classContext.getJavaClass())) { stack = new OpcodeStack(); catchInfos = new HashSet<>(); exReg = new HashMap<>(); ...
java
@Override public void visitClassContext(ClassContext classContext) { try { if ((throwableClass != null) && !isPre14Class(classContext.getJavaClass())) { stack = new OpcodeStack(); catchInfos = new HashSet<>(); exReg = new HashMap<>(); ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "if", "(", "(", "throwableClass", "!=", "null", ")", "&&", "!", "isPre14Class", "(", "classContext", ".", "getJavaClass", "(", ")", ")", ")", ...
implements the visitor to make sure the jdk is 1.4 or better @param classContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "make", "sure", "the", "jdk", "is", "1", ".", "4", "or", "better" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L97-L112
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.prescreen
public boolean prescreen(Code code, Method method) { if (method.isSynthetic()) { return false; } CodeException[] ce = code.getExceptionTable(); if (CollectionUtils.isEmpty(ce)) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeS...
java
public boolean prescreen(Code code, Method method) { if (method.isSynthetic()) { return false; } CodeException[] ce = code.getExceptionTable(); if (CollectionUtils.isEmpty(ce)) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeS...
[ "public", "boolean", "prescreen", "(", "Code", "code", ",", "Method", "method", ")", "{", "if", "(", "method", ".", "isSynthetic", "(", ")", ")", "{", "return", "false", ";", "}", "CodeException", "[", "]", "ce", "=", "code", ".", "getExceptionTable", ...
looks for methods that contain a catch block and an ATHROW opcode @param code the context object of the current code block @param method the context object of the current method @return if the class throws exceptions
[ "looks", "for", "methods", "that", "contain", "a", "catch", "block", "and", "an", "ATHROW", "opcode" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L123-L135
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.visitCode
@Override public void visitCode(Code obj) { if (prescreen(obj, getMethod())) { stack.resetForMethodEntry(this); catchInfos.clear(); exceptions = collectExceptions(obj.getExceptionTable()); exReg.clear(); lastWasExitPoint = false; super....
java
@Override public void visitCode(Code obj) { if (prescreen(obj, getMethod())) { stack.resetForMethodEntry(this); catchInfos.clear(); exceptions = collectExceptions(obj.getExceptionTable()); exReg.clear(); lastWasExitPoint = false; super....
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "prescreen", "(", "obj", ",", "getMethod", "(", ")", ")", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "catchInfos", ".", "clear", "(", ...
implements the visitor to filter out methods that don't throw exceptions @param obj the context object of the currently parsed code block
[ "implements", "the", "visitor", "to", "filter", "out", "methods", "that", "don", "t", "throw", "exceptions" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L143-L153
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.collectExceptions
public CodeException[] collectExceptions(CodeException... exs) { List<CodeException> filteredEx = new ArrayList<>(); for (CodeException ce : exs) { if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) { filteredEx.add(ce);...
java
public CodeException[] collectExceptions(CodeException... exs) { List<CodeException> filteredEx = new ArrayList<>(); for (CodeException ce : exs) { if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) { filteredEx.add(ce);...
[ "public", "CodeException", "[", "]", "collectExceptions", "(", "CodeException", "...", "exs", ")", "{", "List", "<", "CodeException", ">", "filteredEx", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "CodeException", "ce", ":", "exs", ")", "{", ...
collects all the valid exception objects (ones where start and finish are before the target @param exs the exceptions from the class file @return the filtered exceptions
[ "collects", "all", "the", "valid", "exception", "objects", "(", "ones", "where", "start", "and", "finish", "are", "before", "the", "target" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L162-L170
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.isPossibleExBuilder
public boolean isPossibleExBuilder(int excReg) throws ClassNotFoundException { String sig = getSigConstantOperand(); String returnSig = SignatureUtils.getReturnSignature(sig); if (returnSig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { returnSig = SignatureUtils.trimSignature(retu...
java
public boolean isPossibleExBuilder(int excReg) throws ClassNotFoundException { String sig = getSigConstantOperand(); String returnSig = SignatureUtils.getReturnSignature(sig); if (returnSig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { returnSig = SignatureUtils.trimSignature(retu...
[ "public", "boolean", "isPossibleExBuilder", "(", "int", "excReg", ")", "throws", "ClassNotFoundException", "{", "String", "sig", "=", "getSigConstantOperand", "(", ")", ";", "String", "returnSig", "=", "SignatureUtils", ".", "getReturnSignature", "(", "sig", ")", ...
returns whether the method called might be a method that builds an exception using the original exception. It does so by looking to see if the method returns an exception, and if one of the parameters is the original exception @param excReg the register of the original exception caught @return whether this method call...
[ "returns", "whether", "the", "method", "called", "might", "be", "a", "method", "that", "builds", "an", "exception", "using", "the", "original", "exception", ".", "It", "does", "so", "by", "looking", "to", "see", "if", "the", "method", "returns", "an", "exc...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L327-L346
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.updateExceptionRegister
private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) { if (OpcodeUtils.isAStore(seen)) { int reg = RegisterUtils.getAStoreReg(this, seen); ci.setReg(reg); exReg.put(Integer.valueOf(reg), Boolean.TRUE); LocalVariableTable lvt = getMethod().getLoc...
java
private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) { if (OpcodeUtils.isAStore(seen)) { int reg = RegisterUtils.getAStoreReg(this, seen); ci.setReg(reg); exReg.put(Integer.valueOf(reg), Boolean.TRUE); LocalVariableTable lvt = getMethod().getLoc...
[ "private", "boolean", "updateExceptionRegister", "(", "CatchInfo", "ci", ",", "int", "seen", ",", "int", "pc", ")", "{", "if", "(", "OpcodeUtils", ".", "isAStore", "(", "seen", ")", ")", "{", "int", "reg", "=", "RegisterUtils", ".", "getAStoreReg", "(", ...
looks to update the catchinfo block with the register used for the exception variable. If their is a local variable table, but the local variable can't be found return false, signifying an empty catch block. @param ci the catchinfo record for the catch starting at this pc @param seen the opcode of the currently visite...
[ "looks", "to", "update", "the", "catchinfo", "block", "with", "the", "register", "used", "for", "the", "exception", "variable", ".", "If", "their", "is", "a", "local", "variable", "table", "but", "the", "local", "variable", "can", "t", "be", "found", "retu...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L394-L413
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.addCatchBlock
private void addCatchBlock(int start, int finish) { CatchInfo ci = new CatchInfo(start, finish); catchInfos.add(ci); }
java
private void addCatchBlock(int start, int finish) { CatchInfo ci = new CatchInfo(start, finish); catchInfos.add(ci); }
[ "private", "void", "addCatchBlock", "(", "int", "start", ",", "int", "finish", ")", "{", "CatchInfo", "ci", "=", "new", "CatchInfo", "(", "start", ",", "finish", ")", ";", "catchInfos", ".", "add", "(", "ci", ")", ";", "}" ]
add a catch block info record for the catch block that is guessed to be in the range of start to finish @param start the handler pc @param finish the guessed end of the catch block
[ "add", "a", "catch", "block", "info", "record", "for", "the", "catch", "block", "that", "is", "guessed", "to", "be", "in", "the", "range", "of", "start", "to", "finish" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L423-L426
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.visitClassContext
@Override public void visitClassContext(ClassContext classContext) { try { javaClass = classContext.getJavaClass(); if (javaClass.getMajor() >= Const.MAJOR_1_5) { javaClass.accept(this); } } finally { javaClass = null; } }
java
@Override public void visitClassContext(ClassContext classContext) { try { javaClass = classContext.getJavaClass(); if (javaClass.getMajor() >= Const.MAJOR_1_5) { javaClass.accept(this); } } finally { javaClass = null; } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "classContext", ")", "{", "try", "{", "javaClass", "=", "classContext", ".", "getJavaClass", "(", ")", ";", "if", "(", "javaClass", ".", "getMajor", "(", ")", ">=", "Const", ".", ...
overrides the visitor to make sure that the class was compiled by java 1.5 or later. @param classContext the context object of the currently parsed class
[ "overrides", "the", "visitor", "to", "make", "sure", "that", "the", "class", "was", "compiled", "by", "java", "1", ".", "5", "or", "later", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L62-L72
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.visitMethod
@Override public void visitMethod(Method obj) { try { if (obj.isSynthetic()) { return; } if (Values.CONSTRUCTOR.equals(getMethodName()) && javaClass.getClassName().contains("$")) { return; } List<String> types = SignatureUtils.getParameterSignatures(obj.getSignature()); if ((types.isEmpty...
java
@Override public void visitMethod(Method obj) { try { if (obj.isSynthetic()) { return; } if (Values.CONSTRUCTOR.equals(getMethodName()) && javaClass.getClassName().contains("$")) { return; } List<String> types = SignatureUtils.getParameterSignatures(obj.getSignature()); if ((types.isEmpty...
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "try", "{", "if", "(", "obj", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "if", "(", "Values", ".", "CONSTRUCTOR", ".", "equals", "(", "getMethodName", ...
overrides the visitor to look for methods that has an array as a last parameter of an array type, where the base type is not like the previous parameter nor something like a char or byte array. @param obj the currently parse method
[ "overrides", "the", "visitor", "to", "look", "for", "methods", "that", "has", "an", "array", "as", "a", "last", "parameter", "of", "an", "array", "type", "where", "the", "base", "type", "is", "not", "like", "the", "previous", "parameter", "nor", "something...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L81-L131
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.hasSimilarParms
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "LII_LIST_INDEXED_ITERATING", justification = "this doesn't iterate over every element, so we can't use a for-each loop") private static boolean hasSimilarParms(List<String> argTypes) { for (int i = 0; i < (argTypes.size() - 1); i++) { if (argTypes.get(...
java
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "LII_LIST_INDEXED_ITERATING", justification = "this doesn't iterate over every element, so we can't use a for-each loop") private static boolean hasSimilarParms(List<String> argTypes) { for (int i = 0; i < (argTypes.size() - 1); i++) { if (argTypes.get(...
[ "@", "edu", ".", "umd", ".", "cs", ".", "findbugs", ".", "annotations", ".", "SuppressFBWarnings", "(", "value", "=", "\"LII_LIST_INDEXED_ITERATING\"", ",", "justification", "=", "\"this doesn't iterate over every element, so we can't use a for-each loop\"", ")", "private",...
determines whether a bunch of types are similar and thus would be confusing to have one be a varargs. @param argTypes the parameter signatures to check @return whether the parameter are similar
[ "determines", "whether", "a", "bunch", "of", "types", "are", "similar", "and", "thus", "would", "be", "confusing", "to", "have", "one", "be", "a", "varargs", "." ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L148-L169
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.isInherited
private boolean isInherited(Method m) throws ClassNotFoundException { JavaClass[] infs = javaClass.getAllInterfaces(); for (JavaClass inf : infs) { if (hasMethod(inf, m)) { return true; } } JavaClass[] sups = javaClass.getSuperClasses(); for (JavaClass sup : sups) { if (hasMethod(sup, m)) { ...
java
private boolean isInherited(Method m) throws ClassNotFoundException { JavaClass[] infs = javaClass.getAllInterfaces(); for (JavaClass inf : infs) { if (hasMethod(inf, m)) { return true; } } JavaClass[] sups = javaClass.getSuperClasses(); for (JavaClass sup : sups) { if (hasMethod(sup, m)) { ...
[ "private", "boolean", "isInherited", "(", "Method", "m", ")", "throws", "ClassNotFoundException", "{", "JavaClass", "[", "]", "infs", "=", "javaClass", ".", "getAllInterfaces", "(", ")", ";", "for", "(", "JavaClass", "inf", ":", "infs", ")", "{", "if", "("...
looks to see if this method is derived from a super class. If it is we don't want to report on it, as that would entail changing a whole hierarchy @param m the current method @return if the method is inherited @throws ClassNotFoundException if the super class(s) aren't found
[ "looks", "to", "see", "if", "this", "method", "is", "derived", "from", "a", "super", "class", ".", "If", "it", "is", "we", "don", "t", "want", "to", "report", "on", "it", "as", "that", "would", "entail", "changing", "a", "whole", "hierarchy" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L180-L196
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
UseVarArgs.hasMethod
private static boolean hasMethod(JavaClass c, Method candidateMethod) { String name = candidateMethod.getName(); String sig = candidateMethod.getSignature(); for (Method method : c.getMethods()) { if (!method.isStatic() && method.getName().equals(name) && method.getSignature().equals(sig)) { return true; ...
java
private static boolean hasMethod(JavaClass c, Method candidateMethod) { String name = candidateMethod.getName(); String sig = candidateMethod.getSignature(); for (Method method : c.getMethods()) { if (!method.isStatic() && method.getName().equals(name) && method.getSignature().equals(sig)) { return true; ...
[ "private", "static", "boolean", "hasMethod", "(", "JavaClass", "c", ",", "Method", "candidateMethod", ")", "{", "String", "name", "=", "candidateMethod", ".", "getName", "(", ")", ";", "String", "sig", "=", "candidateMethod", ".", "getSignature", "(", ")", "...
looks to see if a class has a method with a specific name and signature @param c the class to check @param candidateMethod the method to look for @return whether this class has the exact method
[ "looks", "to", "see", "if", "a", "class", "has", "a", "method", "with", "a", "specific", "name", "and", "signature" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java#L206-L217
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
IncorrectInternalClassUse.visitClassContext
@Override public void visitClassContext(ClassContext context) { JavaClass cls = context.getJavaClass(); if (!isInternal(cls.getClassName())) { ConstantPool pool = cls.getConstantPool(); int numItems = pool.getLength(); for (int i = 0; i < numItems; i++) { ...
java
@Override public void visitClassContext(ClassContext context) { JavaClass cls = context.getJavaClass(); if (!isInternal(cls.getClassName())) { ConstantPool pool = cls.getConstantPool(); int numItems = pool.getLength(); for (int i = 0; i < numItems; i++) { ...
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "context", ")", "{", "JavaClass", "cls", "=", "context", ".", "getJavaClass", "(", ")", ";", "if", "(", "!", "isInternal", "(", "cls", ".", "getClassName", "(", ")", ")", ")", "...
implements the visitor to look for classes that reference com.sun.xxx, or org.apache.xerces.xxx classes by looking for class Const in the constant pool @param context the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "look", "for", "classes", "that", "reference", "com", ".", "sun", ".", "xxx", "or", "org", ".", "apache", ".", "xerces", ".", "xxx", "classes", "by", "looking", "for", "class", "Const", "in", "the", "constant", "pool...
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java#L97-L114
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
IncorrectInternalClassUse.isInternal
private static boolean isInternal(String clsName) { boolean internal = false; for (String internalPackage : internalPackages) { if (clsName.startsWith(internalPackage)) { internal = true; break; } } if (internal) { for ...
java
private static boolean isInternal(String clsName) { boolean internal = false; for (String internalPackage : internalPackages) { if (clsName.startsWith(internalPackage)) { internal = true; break; } } if (internal) { for ...
[ "private", "static", "boolean", "isInternal", "(", "String", "clsName", ")", "{", "boolean", "internal", "=", "false", ";", "for", "(", "String", "internalPackage", ":", "internalPackages", ")", "{", "if", "(", "clsName", ".", "startsWith", "(", "internalPacka...
determines if the class in question is an internal class by looking at package prefixes @param clsName the name of the class to check @return whether the class is internal
[ "determines", "if", "the", "class", "in", "question", "is", "an", "internal", "class", "by", "looking", "at", "package", "prefixes" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java#L131-L150
train
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java
FindClassCircularDependencies.getDependenciesForClass
private Set<String> getDependenciesForClass(String clsName) { Set<String> dependencies = dependencyGraph.get(clsName); if (dependencies == null) { dependencies = new HashSet<>(); dependencyGraph.put(clsName, dependencies); } return dependencies; }
java
private Set<String> getDependenciesForClass(String clsName) { Set<String> dependencies = dependencyGraph.get(clsName); if (dependencies == null) { dependencies = new HashSet<>(); dependencyGraph.put(clsName, dependencies); } return dependencies; }
[ "private", "Set", "<", "String", ">", "getDependenciesForClass", "(", "String", "clsName", ")", "{", "Set", "<", "String", ">", "dependencies", "=", "dependencyGraph", ".", "get", "(", "clsName", ")", ";", "if", "(", "dependencies", "==", "null", ")", "{",...
returns a set of dependent class names for a class, and if it doesn't exist create the set install it, and then return; @param clsName the class for which you are trying to get dependencies @return the active set of classes that are dependent on the specified class
[ "returns", "a", "set", "of", "dependent", "class", "names", "for", "a", "class", "and", "if", "it", "doesn", "t", "exist", "create", "the", "set", "install", "it", "and", "then", "return", ";" ]
3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java#L160-L168
train