Use final.
diff --git a/src/main/java/org/apache/bsf/BSFDeclaredBean.java b/src/main/java/org/apache/bsf/BSFDeclaredBean.java
index 5bb5046..bb9a443 100644
--- a/src/main/java/org/apache/bsf/BSFDeclaredBean.java
+++ b/src/main/java/org/apache/bsf/BSFDeclaredBean.java
@@ -30,7 +30,7 @@
public Object bean;
public Class type;
- BSFDeclaredBean(String name, Object bean, Class type) {
+ BSFDeclaredBean(final String name, final Object bean, final Class type) {
this.name = name;
this.bean = bean;
this.type = type;
diff --git a/src/main/java/org/apache/bsf/BSFException.java b/src/main/java/org/apache/bsf/BSFException.java
index d1b7e0a..01da782 100644
--- a/src/main/java/org/apache/bsf/BSFException.java
+++ b/src/main/java/org/apache/bsf/BSFException.java
@@ -37,15 +37,15 @@
int reason;
Throwable targetThrowable;
- public BSFException (int reason, String msg) {
+ public BSFException (final int reason, final String msg) {
super (msg);
this.reason = reason;
}
- public BSFException (int reason, String msg, Throwable t) {
+ public BSFException (final int reason, final String msg, final Throwable t) {
this (reason, msg);
targetThrowable = t;
}
- public BSFException (String msg) {
+ public BSFException (final String msg) {
this (REASON_OTHER_ERROR, msg);
}
public int getReason () {
@@ -56,7 +56,7 @@
}
public void printStackTrace () {
if (targetThrowable != null) {
- String msg = getMessage ();
+ final String msg = getMessage ();
if (msg != null && !msg.equals (targetThrowable.getMessage ())) {
System.err.print (msg + ": ");
diff --git a/src/main/java/org/apache/bsf/BSFManager.java b/src/main/java/org/apache/bsf/BSFManager.java
index 19492f6..647008a 100644
--- a/src/main/java/org/apache/bsf/BSFManager.java
+++ b/src/main/java/org/apache/bsf/BSFManager.java
@@ -150,15 +150,15 @@
//////////////////////////////////////////////////////////////////////
static {
- String strInfo="org.apache.bsf.BSFManager.dumpEnvironment() [from static{}]";
+ final String strInfo="org.apache.bsf.BSFManager.dumpEnvironment() [from static{}]";
try {
definedClassLoader=BSFManager.class.getClassLoader(); // get defining ClassLoader
- String resourceName="org/apache/bsf/Languages.properties";
+ final String resourceName="org/apache/bsf/Languages.properties";
Enumeration e = null;
// use the Thread's context class loader to locate the resources
- ClassLoader tccl=Thread.currentThread().getContextClassLoader(); // try to get the context class loader
+ final ClassLoader tccl=Thread.currentThread().getContextClassLoader(); // try to get the context class loader
if (tccl!=null) // no context class loader available!
{
e=tccl.getResources(resourceName);
@@ -170,23 +170,23 @@
}
while (e.hasMoreElements()) {
- URL url = (URL)e.nextElement();
- InputStream is = url.openStream();
+ final URL url = (URL)e.nextElement();
+ final InputStream is = url.openStream();
- Properties p = new Properties();
+ final Properties p = new Properties();
p.load(is);
- for (Enumeration keys = p.propertyNames(); keys.hasMoreElements();) {
+ for (final Enumeration keys = p.propertyNames(); keys.hasMoreElements();) {
- String key = (String) keys.nextElement();
- String value = p.getProperty(key);
- String className = value.substring(0, value.indexOf(","));
+ final String key = (String) keys.nextElement();
+ final String value = p.getProperty(key);
+ final String className = value.substring(0, value.indexOf(","));
// get the extensions for this language
- String exts = value.substring(value.indexOf(",")+1, value.length());
- StringTokenizer st = new StringTokenizer(exts, "|");
- String[] extensions = new String[st.countTokens()];
+ final String exts = value.substring(value.indexOf(",")+1, value.length());
+ final StringTokenizer st = new StringTokenizer(exts, "|");
+ final String[] extensions = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++) {
extensions[i] = st.nextToken().trim();
@@ -195,24 +195,24 @@
registerScriptingEngine(key, className, extensions);
}
}
- } catch (IOException ex) {
- BSF_Log logger = BSF_LogFactory.getLog(BSFManager.class.getName());
+ } catch (final IOException ex) {
+ final BSF_Log logger = BSF_LogFactory.getLog(BSFManager.class.getName());
logger.debug("[BSFManager] static {...}");
logger.error("[BSFManager] Error reading Languages file, exception :",ex);
// TODO: leave in case only a no-op-logger is available or remove next two statements?
ex.printStackTrace();
System.err.println("Error reading Languages file " + ex);
- } catch (NoSuchElementException nsee) {
- BSF_Log logger = BSF_LogFactory.getLog(BSFManager.class.getName());
+ } catch (final NoSuchElementException nsee) {
+ final BSF_Log logger = BSF_LogFactory.getLog(BSFManager.class.getName());
logger.debug("[BSFManager] static {...}");
logger.error("[BSFManager] Syntax error in Languages resource bundle, exception :",nsee);
// TODO: leave in case only a no-op-logger is available or remove next two statements?
nsee.printStackTrace();
System.err.println("Syntax error in Languages resource bundle");
- } catch (MissingResourceException mre) {
- BSF_Log logger = BSF_LogFactory.getLog(BSFManager.class.getName());
+ } catch (final MissingResourceException mre) {
+ final BSF_Log logger = BSF_LogFactory.getLog(BSFManager.class.getName());
logger.debug("[BSFManager] static {...}");
logger.error("[BSFManager] Initialization error, exception :",mre);
@@ -262,13 +262,13 @@
*
* @exception BSFException if anything goes wrong while running the script
*/
- public Object apply(String lang,
- String source,
- int lineNo,
- int columnNo,
- Object funcBody,
- Vector paramNames,
- Vector arguments)
+ public Object apply(final String lang,
+ final String source,
+ final int lineNo,
+ final int columnNo,
+ final Object funcBody,
+ final Vector paramNames,
+ final Vector arguments)
throws BSFException {
logger.debug("BSFManager:apply");
@@ -289,7 +289,7 @@
}
});
result = resultf;
- } catch (PrivilegedActionException prive) {
+ } catch (final PrivilegedActionException prive) {
logger.error("[BSFManager] Exception: ", prive);
throw (BSFException) prive.getException();
@@ -314,14 +314,14 @@
*
* @exception BSFException if anything goes wrong while running the script
*/
- public void compileApply(String lang,
- String source,
- int lineNo,
- int columnNo,
- Object funcBody,
- Vector paramNames,
- Vector arguments,
- CodeBuffer cb)
+ public void compileApply(final String lang,
+ final String source,
+ final int lineNo,
+ final int columnNo,
+ final Object funcBody,
+ final Vector paramNames,
+ final Vector arguments,
+ final CodeBuffer cb)
throws BSFException {
logger.debug("BSFManager:compileApply");
@@ -342,7 +342,7 @@
return null;
}
});
- } catch (PrivilegedActionException prive) {
+ } catch (final PrivilegedActionException prive) {
logger.error("[BSFManager] Exception :", prive);
throw (BSFException) prive.getException();
@@ -363,12 +363,12 @@
*
* @exception BSFException if any error while compiling the expression
*/
- public void compileExpr(String lang,
- String source,
- int lineNo,
- int columnNo,
- Object expr,
- CodeBuffer cb)
+ public void compileExpr(final String lang,
+ final String source,
+ final int lineNo,
+ final int columnNo,
+ final Object expr,
+ final CodeBuffer cb)
throws BSFException {
logger.debug("BSFManager:compileExpr");
@@ -385,7 +385,7 @@
return null;
}
});
- } catch (PrivilegedActionException prive) {
+ } catch (final PrivilegedActionException prive) {
logger.error("[BSFManager] Exception :", prive);
throw (BSFException) prive.getException();
@@ -406,12 +406,12 @@
*
* @exception BSFException if any error while compiling the script
*/
- public void compileScript(String lang,
- String source,
- int lineNo,
- int columnNo,
- Object script,
- CodeBuffer cb)
+ public void compileScript(final String lang,
+ final String source,
+ final int lineNo,
+ final int columnNo,
+ final Object script,
+ final CodeBuffer cb)
throws BSFException {
logger.debug("BSFManager:compileScript");
@@ -429,7 +429,7 @@
return null;
}
});
- } catch (PrivilegedActionException prive) {
+ } catch (final PrivilegedActionException prive) {
logger.error("[BSFManager] Exception :", prive);
throw (BSFException) prive.getException();
@@ -466,16 +466,16 @@
* running decides to throw an exception when asked to
* declare this bean.
*/
- public void declareBean(String beanName, Object bean, Class type)
+ public void declareBean(final String beanName, final Object bean, final Class type)
throws BSFException {
logger.debug("BSFManager:declareBean");
registerBean(beanName, bean);
- BSFDeclaredBean tempBean = new BSFDeclaredBean(beanName, bean, type);
+ final BSFDeclaredBean tempBean = new BSFDeclaredBean(beanName, bean, type);
declaredBeans.addElement(tempBean);
- Enumeration enginesEnum = loadedEngines.elements();
+ final Enumeration enginesEnum = loadedEngines.elements();
BSFEngine engine;
while (enginesEnum.hasMoreElements()) {
engine = (BSFEngine) enginesEnum.nextElement();
@@ -496,11 +496,11 @@
*
* @exception BSFException if anything goes wrong while running the script
*/
- public Object eval(String lang,
- String source,
- int lineNo,
- int columnNo,
- Object expr)
+ public Object eval(final String lang,
+ final String source,
+ final int lineNo,
+ final int columnNo,
+ final Object expr)
throws BSFException {
logger.debug("BSFManager:eval");
@@ -518,7 +518,7 @@
}
});
result = resultf;
- } catch (PrivilegedActionException prive) {
+ } catch (final PrivilegedActionException prive) {
logger.error("[BSFManager] Exception: ", prive);
throw (BSFException) prive.getException();
@@ -546,11 +546,11 @@
*
* @exception BSFException if anything goes wrong while running the script
*/
- public void exec(String lang,
- String source,
- int lineNo,
- int columnNo,
- Object script)
+ public void exec(final String lang,
+ final String source,
+ final int lineNo,
+ final int columnNo,
+ final Object script)
throws BSFException {
logger.debug("BSFManager:exec");
@@ -566,7 +566,7 @@
return null;
}
});
- } catch (PrivilegedActionException prive) {
+ } catch (final PrivilegedActionException prive) {
logger.error("[BSFManager] Exception :", prive);
throw (BSFException) prive.getException();
@@ -586,11 +586,11 @@
*
* @exception BSFException if anything goes wrong while running the script
*/
- public void iexec(String lang,
- String source,
- int lineNo,
- int columnNo,
- Object script)
+ public void iexec(final String lang,
+ final String source,
+ final int lineNo,
+ final int columnNo,
+ final Object script)
throws BSFException {
logger.debug("BSFManager:iexec");
@@ -606,7 +606,7 @@
return null;
}
});
- } catch (PrivilegedActionException prive) {
+ } catch (final PrivilegedActionException prive) {
logger.error("[BSFManager] Exception :", prive);
throw (BSFException) prive.getException();
@@ -629,7 +629,7 @@
if (classPath == null) {
try {
classPath = System.getProperty("java.class.path");
- } catch (Throwable t) {
+ } catch (final Throwable t) {
logger.debug("[BSFManager] Exception :", t);
// prolly a security exception .. so no can do
@@ -650,18 +650,18 @@
*
* @exception BSFException if file's extension is unknown.
*/
- public static String getLangFromFilename(String fileName)
+ public static String getLangFromFilename(final String fileName)
throws BSFException {
- int dotIndex = fileName.lastIndexOf(".");
+ final int dotIndex = fileName.lastIndexOf(".");
if (dotIndex != -1) {
- String extn = fileName.substring(dotIndex + 1);
+ final String extn = fileName.substring(dotIndex + 1);
String langval = (String) extn2Lang.get(extn);
String lang = null;
int index, loops = 0;
if (langval != null) {
- ClassLoader tccl=Thread.currentThread().getContextClassLoader(); // rgf, 2009-09-10
+ final ClassLoader tccl=Thread.currentThread().getContextClassLoader(); // rgf, 2009-09-10
while ((index = langval.indexOf(":", 0)) != -1) {
// Great. Multiple language engines registered
@@ -684,7 +684,7 @@
{
tccl.loadClass (engineName);
}
- catch (ClassNotFoundException cnfe)
+ catch (final ClassNotFoundException cnfe)
{
bTryDefinedClassLoader=true;
}
@@ -695,7 +695,7 @@
definedClassLoader.loadClass(engineName);
}
}
- catch (ClassNotFoundException cnfe2) {
+ catch (final ClassNotFoundException cnfe2) {
// Bummer.
lang = langval;
continue;
@@ -741,7 +741,7 @@
*
* @return true iff it is
*/
- public static boolean isLanguageRegistered(String lang) {
+ public static boolean isLanguageRegistered(final String lang) {
return (registeredEngines.get(lang) != null);
}
@@ -762,7 +762,7 @@
* the reason is set to REASON_OTHER_ERROR and the actual
* exception is passed on as well.
*/
- public BSFEngine loadScriptingEngine(String lang) throws BSFException {
+ public BSFEngine loadScriptingEngine(final String lang) throws BSFException {
logger.debug("BSFManager:loadScriptingEngine");
// if its already loaded return that
@@ -772,7 +772,7 @@
}
// is it a registered language?
- String engineClassName = (String) registeredEngines.get(lang);
+ final String engineClassName = (String) registeredEngines.get(lang);
if (engineClassName == null) {
logger.error("[BSFManager] unsupported language: " + lang);
throw new BSFException(BSFException.REASON_UNKNOWN_LANGUAGE,
@@ -785,12 +785,12 @@
Class engineClass=null;
- ClassLoader tccl=Thread.currentThread().getContextClassLoader();
+ final ClassLoader tccl=Thread.currentThread().getContextClassLoader();
if (tccl!=null) {
try {
engineClass = tccl.loadClass (engineClassName);
}
- catch (ClassNotFoundException cnfe)
+ catch (final ClassNotFoundException cnfe)
{}
}
@@ -813,11 +813,11 @@
loadedEngines.put(lang, eng);
pcs.addPropertyChangeListener(eng);
return eng;
- } catch (PrivilegedActionException prive) {
+ } catch (final PrivilegedActionException prive) {
logger.error("[BSFManager] Exception :", prive);
throw (BSFException) prive.getException();
- } catch (Throwable t) {
+ } catch (final Throwable t) {
logger.error("[BSFManager] Exception :", t);
throw new BSFException(BSFException.REASON_OTHER_ERROR,
@@ -834,12 +834,12 @@
*
* @return the bean if its found or null
*/
- public Object lookupBean(String beanName) {
+ public Object lookupBean(final String beanName) {
logger.debug("BSFManager:lookupBean");
try {
return ((BSFDeclaredBean)objectRegistry.lookup(beanName)).bean;
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
logger.debug("[BSFManager] Exception :", e);
return null;
@@ -853,7 +853,7 @@
* @param beanName name to register under
* @param bean the bean to register
*/
- public void registerBean(String beanName, Object bean) {
+ public void registerBean(final String beanName, final Object bean) {
logger.debug("BSFManager:registerBean");
BSFDeclaredBean tempBean;
@@ -877,9 +877,9 @@
* @param extensions array of file extensions that should be mapped to
* this language type. may be null.
*/
- public static void registerScriptingEngine(String lang,
- String engineClassName,
- String[] extensions) {
+ public static void registerScriptingEngine(final String lang,
+ final String engineClassName,
+ final String[] extensions) {
registeredEngines.put(lang, engineClassName);
if (extensions != null) {
for (int i = 0; i < extensions.length; i++) {
@@ -897,7 +897,7 @@
*
* @param classLoader the class loader to use.
*/
- public void setClassLoader(ClassLoader classLoader) {
+ public void setClassLoader(final ClassLoader classLoader) {
logger.debug("BSFManager:setClassLoader");
pcs.firePropertyChange("classLoader", this.classLoader, classLoader);
@@ -910,7 +910,7 @@
*
* @param classPath the classpath to use
*/
- public void setClassPath(String classPath) {
+ public void setClassPath(final String classPath) {
logger.debug("BSFManager:setClassPath");
pcs.firePropertyChange("classPath", this.classPath, classPath);
@@ -924,7 +924,7 @@
*
* @param objectRegistry the registry to use
*/
- public void setObjectRegistry(ObjectRegistry objectRegistry) {
+ public void setObjectRegistry(final ObjectRegistry objectRegistry) {
logger.debug("BSFManager:setObjectRegistry");
this.objectRegistry = objectRegistry;
@@ -942,7 +942,7 @@
*
* @param tempDir the temporary directory
*/
- public void setTempDir(String tempDir) {
+ public void setTempDir(final String tempDir) {
logger.debug("BSFManager:setTempDir");
pcs.firePropertyChange("tempDir", this.tempDir, tempDir);
@@ -955,7 +955,7 @@
public void terminate() {
logger.debug("BSFManager:terminate");
- Enumeration enginesEnum = loadedEngines.elements();
+ final Enumeration enginesEnum = loadedEngines.elements();
BSFEngine engine;
while (enginesEnum.hasMoreElements()) {
engine = (BSFEngine) enginesEnum.nextElement();
@@ -979,14 +979,14 @@
* running decides to throw an exception when asked to
* undeclare this bean.
*/
- public void undeclareBean(String beanName) throws BSFException {
+ public void undeclareBean(final String beanName) throws BSFException {
logger.debug("BSFManager:undeclareBean");
unregisterBean(beanName);
BSFDeclaredBean tempBean = null;
boolean found = false;
- for (Iterator i = declaredBeans.iterator(); i.hasNext();) {
+ for (final Iterator i = declaredBeans.iterator(); i.hasNext();) {
tempBean = (BSFDeclaredBean) i.next();
if (tempBean.name.equals(beanName)) {
found = true;
@@ -997,9 +997,9 @@
if (found) {
declaredBeans.removeElement(tempBean);
- Enumeration enginesEnum = loadedEngines.elements();
+ final Enumeration enginesEnum = loadedEngines.elements();
while (enginesEnum.hasMoreElements()) {
- BSFEngine engine = (BSFEngine) enginesEnum.nextElement();
+ final BSFEngine engine = (BSFEngine) enginesEnum.nextElement();
engine.undeclareBean(tempBean);
}
}
@@ -1010,7 +1010,7 @@
*
* @param beanName name of bean to unregister
*/
- public void unregisterBean(String beanName) {
+ public void unregisterBean(final String beanName) {
logger.debug("BSFManager:unregisterBean");
objectRegistry.unregister(beanName);
diff --git a/src/main/java/org/apache/bsf/BSF_Log.java b/src/main/java/org/apache/bsf/BSF_Log.java
index 2500d48..3edaf89 100644
--- a/src/main/java/org/apache/bsf/BSF_Log.java
+++ b/src/main/java/org/apache/bsf/BSF_Log.java
@@ -80,7 +80,7 @@
{
ClassLoader cl= Thread.currentThread().getContextClassLoader();
- String str4Log="org.apache.commons.logging.Log";
+ final String str4Log="org.apache.commons.logging.Log";
Class logClass = null;
@@ -89,13 +89,13 @@
try {
logClass = cl.loadClass(str4Log);
}
- catch (ClassNotFoundException e1) // not found by contextClassLoader
+ catch (final ClassNotFoundException e1) // not found by contextClassLoader
{}
}
if (logClass==null) // not found, try defined class loader instead
{
- ClassLoader defCL=BSFManager.getDefinedClassLoader();
+ final ClassLoader defCL=BSFManager.getDefinedClassLoader();
logClass = defCL.loadClass(str4Log);
cl=defCL; // class found, hence we use the definedClassLoader here
}
@@ -109,7 +109,7 @@
oac_LogFactoryGetLog_String_ = oac_LogFactory_.getMethod("getLog", new Class[] {String.class});
// get the Log methods
- String str[][]={{"debug", "isDebugEnabled"},
+ final String str[][]={{"debug", "isDebugEnabled"},
{"error", "isErrorEnabled"},
{"fatal", "isFatalEnabled"},
{"info", "isInfoEnabled" },
@@ -118,7 +118,7 @@
int i=0;
for ( ; i<6; i++)
{
- int j=i*3;
+ final int j=i*3;
meths[j ]=logClass.getMethod(str[i][0], new Class[] {Object.class});
meths[j+1]=logClass.getMethod(str[i][0], new Class[] {Object.class, Throwable.class});
@@ -128,7 +128,7 @@
}
}
- catch (ClassNotFoundException e)// o.k., so we do not use org.apache.commons.logging in this run
+ catch (final ClassNotFoundException e)// o.k., so we do not use org.apache.commons.logging in this run
{
if (iDebug>1) {
e.printStackTrace();
@@ -136,7 +136,7 @@
oac_LogFactory_=null; // make sure it does not get used
oac_LogFactoryGetLog_String_=null; // make sure it does not get used
}
- catch (NoSuchMethodException e)// o.k., so we do not use org.apache.commons.logging in this run
+ catch (final NoSuchMethodException e)// o.k., so we do not use org.apache.commons.logging in this run
{
if (iDebug>1) {
e.printStackTrace();
@@ -164,7 +164,7 @@
this("<?>");
}
- public BSF_Log(String name)
+ public BSF_Log(final String name)
{
Object oac_logger_ = null;
this.name=name;
@@ -174,18 +174,18 @@
{
oac_logger_=oac_LogFactoryGetLog_String.invoke(oac_LogFactory, new Object[] {name});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
oac_logger = oac_logger_;
}
- public BSF_Log(Class clazz)
+ public BSF_Log(final Class clazz)
{
this(clazz.getName());
}
// --------------------------------------------------------------------
- public void debug(Object msg)
+ public void debug(final Object msg)
{
if (oac_logger==null)
{
@@ -198,10 +198,10 @@
meths[debug1].invoke(oac_logger, new Object [] {msg});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
- public void debug(Object msg, Throwable t)
+ public void debug(final Object msg, final Throwable t)
{
if (oac_logger==null)
{
@@ -213,11 +213,11 @@
// ((org.apache.commons.logging.Log) oac_logger).debug(msg, t);
meths[debug2].invoke(oac_logger, new Object [] {msg, t});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
// --------------------------------------------------------------------
- public void error(Object msg)
+ public void error(final Object msg)
{
if (oac_logger==null)
{
@@ -229,10 +229,10 @@
// ((org.apache.commons.logging.Log) oac_logger).error(msg);
meths[error1].invoke(oac_logger, new Object [] {msg});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
- public void error(Object msg, Throwable t)
+ public void error(final Object msg, final Throwable t)
{
if (oac_logger==null)
{
@@ -244,12 +244,12 @@
// ((org.apache.commons.logging.Log) oac_logger).error(msg, t);
meths[error2].invoke(oac_logger, new Object [] {msg, t});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
// --------------------------------------------------------------------
- public void fatal(Object msg)
+ public void fatal(final Object msg)
{
if (oac_logger==null)
{
@@ -261,10 +261,10 @@
// ((org.apache.commons.logging.Log) oac_logger).fatal(msg);
meths[fatal1].invoke(oac_logger, new Object [] {msg});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
- public void fatal(Object msg, Throwable t)
+ public void fatal(final Object msg, final Throwable t)
{
if (oac_logger==null)
{
@@ -275,12 +275,12 @@
// ((org.apache.commons.logging.Log) oac_logger).fatal(msg, t);
meths[fatal2].invoke(oac_logger, new Object [] {msg, t});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
// --------------------------------------------------------------------
- public void info (Object msg)
+ public void info (final Object msg)
{
if (oac_logger==null)
{
@@ -292,10 +292,10 @@
// ((org.apache.commons.logging.Log) oac_logger).info(msg);
meths[info1].invoke(oac_logger, new Object [] {msg});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
- public void info (Object msg, Throwable t)
+ public void info (final Object msg, final Throwable t)
{
if (oac_logger==null)
{
@@ -307,12 +307,12 @@
// ((org.apache.commons.logging.Log) oac_logger).info(msg, t);
meths[info2].invoke(oac_logger, new Object [] {msg, t});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
// --------------------------------------------------------------------
- public void trace(Object msg)
+ public void trace(final Object msg)
{
if (oac_logger==null)
{
@@ -324,10 +324,10 @@
// ((org.apache.commons.logging.Log) oac_logger).trace(msg);
meths[trace1].invoke(oac_logger, new Object [] {msg});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
- public void trace(Object msg, Throwable t)
+ public void trace(final Object msg, final Throwable t)
{
if (oac_logger==null)
{
@@ -339,12 +339,12 @@
// ((org.apache.commons.logging.Log) oac_logger).trace(msg, t);
meths[trace2].invoke(oac_logger, new Object [] {msg, t});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
// --------------------------------------------------------------------
- public void warn (Object msg)
+ public void warn (final Object msg)
{
if (oac_logger==null)
{
@@ -356,10 +356,10 @@
// ((org.apache.commons.logging.Log) oac_logger).warn(msg);
meths[warn1].invoke(oac_logger, new Object [] {msg});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
- public void warn (Object msg, Throwable t)
+ public void warn (final Object msg, final Throwable t)
{
if (oac_logger==null)
{
@@ -371,7 +371,7 @@
// ((org.apache.commons.logging.Log) oac_logger).warn(msg, t);
meths[warn2].invoke(oac_logger, new Object [] {msg, t});
}
- catch (Exception e) { e.printStackTrace(); }
+ catch (final Exception e) { e.printStackTrace(); }
}
@@ -386,7 +386,7 @@
// return ((org.apache.commons.logging.Log) oac_logger).isDebugEnabled();
return ((Boolean) meths[isDebugEnabled].invoke(oac_logger, new Object [] {})).booleanValue();
}
- catch (Exception e) { }
+ catch (final Exception e) { }
finally { return false; }
}
@@ -402,7 +402,7 @@
// return ((org.apache.commons.logging.Log) oac_logger).isErrorEnabled();
return ((Boolean) meths[isErrorEnabled].invoke(oac_logger, new Object [] {})).booleanValue();
}
- catch (Exception e) { }
+ catch (final Exception e) { }
finally { return false; }
}
@@ -418,7 +418,7 @@
// return ((org.apache.commons.logging.Log) oac_logger).isFatalEnabled();
return ((Boolean) meths[isFatalEnabled].invoke(oac_logger, new Object [] {})).booleanValue();
}
- catch (Exception e) { }
+ catch (final Exception e) { }
finally { return false; }
}
@@ -434,7 +434,7 @@
// return ((org.apache.commons.logging.Log) oac_logger).isInfoEnabled();
return ((Boolean) meths[isInfoEnabled].invoke(oac_logger, new Object [] {})).booleanValue();
}
- catch (Exception e) { }
+ catch (final Exception e) { }
finally { return false; }
}
@@ -450,7 +450,7 @@
// return ((org.apache.commons.logging.Log) oac_logger).isTraceEnabled();
return ((Boolean) meths[isTraceEnabled].invoke(oac_logger, new Object [] {})).booleanValue();
}
- catch (Exception e) { }
+ catch (final Exception e) { }
finally { return false; }
}
@@ -466,13 +466,13 @@
// return ((org.apache.commons.logging.Log) oac_logger).isWarnEnabled();
return ((Boolean) meths[isWarnEnabled].invoke(oac_logger, new Object [] {})).booleanValue();
}
- catch (Exception e) { }
+ catch (final Exception e) { }
finally { return false; }
}
// for development purposes only (to debug this class on its own)
- public static void main (String args[]) {
+ public static void main (final String args[]) {
System.out.println("in BSF_Log ...");
System.out.println("--------------------------------------------------------");
System.out.println("--------------------------------------------------------");
@@ -485,7 +485,7 @@
}
- static void dump(BSF_Log bl)
+ static void dump(final BSF_Log bl)
{
System.out.println("\n\tbl=["+bl+"] --->>> --->>> --->>>");
System.err.print("/debug **/"); bl.debug("debug message. "); System.err.println("\\** debug.\\");
@@ -496,7 +496,7 @@
System.err.print("/warn **/"); bl.warn ("warn message. "); System.err.println("\\** warn .\\");
System.err.println();
- Throwable t=new Throwable ("Test from Rony for: "+bl);
+ final Throwable t=new Throwable ("Test from Rony for: "+bl);
System.err.print("/debug **/"); bl.debug("debug message. ", t); System.err.println("\\** debug.\\");
System.err.print("/error **/"); bl.error("error message. ", t); System.err.println("\\** error.\\");
System.err.print("/fatal **/"); bl.fatal("fatal message. ", t); System.err.println("\\** fatal.\\");
diff --git a/src/main/java/org/apache/bsf/BSF_LogFactory.java b/src/main/java/org/apache/bsf/BSF_LogFactory.java
index f9774e3..42381df 100644
--- a/src/main/java/org/apache/bsf/BSF_LogFactory.java
+++ b/src/main/java/org/apache/bsf/BSF_LogFactory.java
@@ -32,12 +32,12 @@
{
protected BSF_LogFactory() {} // mimickries org.apache.commons.logging.LogFactory
- static public BSF_Log getLog (String name)
+ static public BSF_Log getLog (final String name)
{
return new BSF_Log(name);
}
- static public BSF_Log getLog (Class clz)
+ static public BSF_Log getLog (final Class clz)
{
return new BSF_Log(clz);
}
diff --git a/src/main/java/org/apache/bsf/Main.java b/src/main/java/org/apache/bsf/Main.java
index 6a1d2a8..49672a5 100644
--- a/src/main/java/org/apache/bsf/Main.java
+++ b/src/main/java/org/apache/bsf/Main.java
@@ -58,14 +58,14 @@
*
* @exception IOException if any I/O error while loading script
*/
- public static void main(String[] args) throws IOException {
+ public static void main(final String[] args) throws IOException {
try {
if ((args.length == 0) || (args.length % 2 != 0)) {
printHelp();
System.exit(1);
}
- Hashtable argsTable = new Hashtable();
+ final Hashtable argsTable = new Hashtable();
argsTable.put(ARG_OUT, DEFAULT_CLASS_NAME);
argsTable.put(ARG_MODE, DEFAULT_MODE);
@@ -96,15 +96,15 @@
inFileName = DEFAULT_IN_FILE_NAME;
}
- BSFManager mgr = new BSFManager();
- String mode = (String) argsTable.get(ARG_MODE);
+ final BSFManager mgr = new BSFManager();
+ final String mode = (String) argsTable.get(ARG_MODE);
if (mode.equals(ARG_VAL_COMPILE)) {
- String outClassName = (String) argsTable.get(ARG_OUT);
- FileWriter out = new FileWriter(outClassName + ".java");
- PrintWriter pw = new PrintWriter(out);
+ final String outClassName = (String) argsTable.get(ARG_OUT);
+ final FileWriter out = new FileWriter(outClassName + ".java");
+ final PrintWriter pw = new PrintWriter(out);
- CodeBuffer cb = new CodeBuffer();
+ final CodeBuffer cb = new CodeBuffer();
cb.setClassName(outClassName);
mgr.compileScript(
language,
@@ -119,7 +119,7 @@
if (mode.equals(ARG_VAL_EXEC)) {
mgr.exec(language, inFileName, 0, 0, IOUtils.getStringFromReader(in));
} else { /* eval */
- Object obj = mgr.eval(language, inFileName, 0, 0, IOUtils.getStringFromReader(in));
+ final Object obj = mgr.eval(language, inFileName, 0, 0, IOUtils.getStringFromReader(in));
// Try to display the result.
@@ -135,7 +135,7 @@
// Add a window listener to quit on closing.
f.addWindowListener(
new WindowAdapter () {
- public void windowClosing (WindowEvent e) {
+ public void windowClosing (final WindowEvent e) {
System.exit (0);
}
}
@@ -151,7 +151,7 @@
System.err.println("Result: " + obj);
}
}
- } catch (BSFException e) {
+ } catch (final BSFException e) {
e.printStackTrace();
}
}
diff --git a/src/main/java/org/apache/bsf/engines/jacl/BSFCommand.java b/src/main/java/org/apache/bsf/engines/jacl/BSFCommand.java
index 8e01a50..a6d5a47 100644
--- a/src/main/java/org/apache/bsf/engines/jacl/BSFCommand.java
+++ b/src/main/java/org/apache/bsf/engines/jacl/BSFCommand.java
@@ -34,19 +34,19 @@
BSFManager mgr;
BSFEngine jengine;
- BSFCommand (BSFManager mgr, BSFEngine jengine) {
+ BSFCommand (final BSFManager mgr, final BSFEngine jengine) {
this.mgr = mgr;
this.jengine = jengine;
}
- public void cmdProc (Interp interp,
- TclObject argv[]) throws TclException {
+ public void cmdProc (final Interp interp,
+ final TclObject argv[]) throws TclException {
if (argv.length < 2) {
interp.setResult ("invalid # of args; usage: bsf " +
"lookupBean|registerBean|unregisterBean|addEventListener args");
throw new TclException (TCL.ERROR);
}
- String op = argv[1].toString ();
+ final String op = argv[1].toString ();
if (op.equals ("lookupBean")) {
if (argv.length != 3) {
@@ -55,8 +55,8 @@
throw new TclException (TCL.ERROR);
}
- String beanName = argv[2].toString ();
- Object bean = mgr.lookupBean (beanName);
+ final String beanName = argv[2].toString ();
+ final Object bean = mgr.lookupBean (beanName);
if (bean == null) {
interp.setResult ("unknown object: " + beanName);
throw new TclException (TCL.ERROR);
@@ -98,7 +98,7 @@
argv[3].toString (), filter,
jengine, mgr, "<event-script>", 0, 0,
argv[5].toString ());
- } catch (BSFException e) {
+ } catch (final BSFException e) {
e.printStackTrace ();
interp.setResult ("got BSF exception: " + e.getMessage ());
throw new TclException (TCL.ERROR);
diff --git a/src/main/java/org/apache/bsf/engines/jacl/JaclEngine.java b/src/main/java/org/apache/bsf/engines/jacl/JaclEngine.java
index 52a3544..555517d 100644
--- a/src/main/java/org/apache/bsf/engines/jacl/JaclEngine.java
+++ b/src/main/java/org/apache/bsf/engines/jacl/JaclEngine.java
@@ -51,9 +51,9 @@
* passed to the extension, which may be either
* Vectors of Nodes, or Strings.
*/
- public Object call (Object obj, String method, Object[] args)
+ public Object call (final Object obj, final String method, final Object[] args)
throws BSFException {
- StringBuffer tclScript = new StringBuffer (method);
+ final StringBuffer tclScript = new StringBuffer (method);
if (args != null) {
for( int i = 0 ; i < args.length ; i++ ) {
tclScript.append (" ");
@@ -65,8 +65,8 @@
/**
* Declare a bean
*/
- public void declareBean (BSFDeclaredBean bean) throws BSFException {
- String expr = "set " + bean.name + " [bsf lookupBean \"" + bean.name +
+ public void declareBean (final BSFDeclaredBean bean) throws BSFException {
+ final String expr = "set " + bean.name + " [bsf lookupBean \"" + bean.name +
"\"]";
eval ("<declare bean>", 0, 0, expr);
}
@@ -74,13 +74,13 @@
* This is used by an application to evaluate a string containing
* some expression.
*/
- public Object eval (String source, int lineNo, int columnNo,
- Object oscript) throws BSFException {
- String script = oscript.toString ();
+ public Object eval (final String source, final int lineNo, final int columnNo,
+ final Object oscript) throws BSFException {
+ final String script = oscript.toString ();
try {
interp.eval (script);
- TclObject result = interp.getResult();
- Object internalRep = result.getInternalRep();
+ final TclObject result = interp.getResult();
+ final Object internalRep = result.getInternalRep();
// if the object has a corresponding Java type, unwrap it
if (internalRep instanceof ReflectObject) {
@@ -97,7 +97,7 @@
}
return result;
- } catch (TclException e) {
+ } catch (final TclException e) {
throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
"error while eval'ing Jacl expression: " +
interp.getResult (), e);
@@ -106,8 +106,8 @@
/**
* Initialize the engine.
*/
- public void initialize (BSFManager mgr, String lang,
- Vector declaredBeans) throws BSFException {
+ public void initialize (final BSFManager mgr, final String lang,
+ final Vector declaredBeans) throws BSFException {
super.initialize (mgr, lang, declaredBeans);
// create interpreter
@@ -120,13 +120,13 @@
// Make java functions be available to Jacl
try {
interp.eval("jaclloadjava");
- } catch (TclException e) {
+ } catch (final TclException e) {
throw new BSFException (BSFException.REASON_OTHER_ERROR,
"error while loading java package: " +
interp.getResult (), e);
}
- int size = declaredBeans.size ();
+ final int size = declaredBeans.size ();
for (int i = 0; i < size; i++) {
declareBean ((BSFDeclaredBean) declaredBeans.elementAt (i));
}
@@ -135,7 +135,7 @@
/**
* Undeclare a previously declared bean.
*/
- public void undeclareBean (BSFDeclaredBean bean) throws BSFException {
+ public void undeclareBean (final BSFDeclaredBean bean) throws BSFException {
eval ("<undeclare bean>", 0, 0, "set " + bean.name + " \"\"");
}
}
diff --git a/src/main/java/org/apache/bsf/engines/java/JavaEngine.java b/src/main/java/org/apache/bsf/engines/java/JavaEngine.java
index 80ff11b..3fb8b82 100644
--- a/src/main/java/org/apache/bsf/engines/java/JavaEngine.java
+++ b/src/main/java/org/apache/bsf/engines/java/JavaEngine.java
@@ -107,7 +107,7 @@
File file = null;
FileOutputStream fos = null;
String className = null;
- GeneratedFile(File file, FileOutputStream fos, String className) {
+ GeneratedFile(final File file, final FileOutputStream fos, final String className) {
this.file = file;
this.fos = fos;
this.className = className;
@@ -123,16 +123,16 @@
// Do compilation-possible check here??????????????
}
- public Object call (Object object, String method, Object[] args)
+ public Object call (final Object object, final String method, final Object[] args)
throws BSFException
{
throw new BSFException (BSFException.REASON_UNSUPPORTED_FEATURE,
"call() is not currently supported by JavaEngine");
}
- public void compileScript (String source, int lineNo, int columnNo,
- Object script, CodeBuffer cb) throws BSFException {
- ObjInfo oldRet = cb.getFinalServiceMethodStatement ();
+ public void compileScript (final String source, final int lineNo, final int columnNo,
+ final Object script, final CodeBuffer cb) throws BSFException {
+ final ObjInfo oldRet = cb.getFinalServiceMethodStatement ();
if (oldRet != null && oldRet.isExecutable ()) {
cb.addServiceMethodStatement (oldRet.objName + ";");
@@ -159,14 +159,14 @@
* We will attempt to use it, then if necessary fall back on invoking
* javac via the command line.
*/
- public Object eval (String source, int lineNo, int columnNo,
- Object oscript) throws BSFException
+ public Object eval (final String source, final int lineNo, final int columnNo,
+ final Object oscript) throws BSFException
{
Object retval = null;
String classname = null;
GeneratedFile gf = null;
- String basescript = oscript.toString();
+ final String basescript = oscript.toString();
String script = basescript; // May be altered by $$CLASSNAME$$ expansion
try {
@@ -195,7 +195,7 @@
int startpoint = script.indexOf(placeholder);
int endpoint;
if(startpoint >= 0) {
- StringBuffer changed = new StringBuffer();
+ final StringBuffer changed = new StringBuffer();
for(; startpoint >=0; startpoint = script.indexOf(placeholder,startpoint)) {
changed.setLength(0); // Reset for 2nd pass or later
if(startpoint > 0) {
@@ -245,12 +245,12 @@
codeToClass.put(basescript, javaclass);
}
- Object[] callArgs = {mgr};
+ final Object[] callArgs = {mgr};
retval = internalCall(this,"BSFJavaEngineEntry",callArgs);
}
- catch(Exception e) {
+ catch(final Exception e) {
e.printStackTrace ();
throw new BSFException (BSFException.REASON_IO_ERROR, e.getMessage ());
} finally {
@@ -269,10 +269,10 @@
// Search for and clean up minor classes, classname$xxx.class
file = new File(tempDir); // ***** Is this required?
minorPrefix = classname+"$"; // Indirect arg to filter
- String[] minorClassfiles = file.list(new FilenameFilter()
+ final String[] minorClassfiles = file.list(new FilenameFilter()
{
// Starts with classname$ and ends with .class
- public boolean accept(File dir,String name) {
+ public boolean accept(final File dir,final String name) {
return
(0 == name.indexOf(minorPrefix))
&&
@@ -288,8 +288,8 @@
return retval;
}
- public void initialize (BSFManager mgr, String lang,
- Vector declaredBeans) throws BSFException {
+ public void initialize (final BSFManager mgr, final String lang,
+ final Vector declaredBeans) throws BSFException {
super.initialize (mgr, lang, declaredBeans);
}
/**
@@ -300,7 +300,7 @@
* passed to the extension, which may be either
* Vectors of Nodes, or Strings.
*/
- Object internalCall (Object object, String method, Object[] args)
+ Object internalCall (final Object object, final String method, final Object[] args)
throws BSFException
{
//***** ISSUE: Only static methods are currently supported
@@ -308,24 +308,24 @@
try {
if(javaclass != null) {
//***** This should call the lookup used in BML, for typesafety
- Class[] argtypes = new Class[args.length];
+ final Class[] argtypes = new Class[args.length];
for(int i=0; i<args.length; ++i) {
argtypes[i]=args[i].getClass();
}
- Method m = MethodUtils.getMethod(javaclass, method, argtypes);
+ final Method m = MethodUtils.getMethod(javaclass, method, argtypes);
retval = m.invoke(null, args);
}
}
- catch(Exception e) {
+ catch(final Exception e) {
throw new BSFException (BSFException.REASON_IO_ERROR, e.getMessage ());
}
return retval;
}
- private GeneratedFile openUniqueFile(String directory,String prefix,String suffix) {
+ private GeneratedFile openUniqueFile(final String directory,final String prefix,final String suffix) {
File file = null;
FileOutputStream fos = null;
- int max = 1000; // Don't try forever
+ final int max = 1000; // Don't try forever
GeneratedFile gf = null;
int i;
String className = null;
@@ -338,7 +338,7 @@
fos = new FileOutputStream(file);
}
}
- catch(Exception e) {
+ catch(final Exception e) {
// File could not be opened for write, or Security Exception
// was thrown. If someone else created the file before we could
// open it, that's probably a threading conflict and we don't
diff --git a/src/main/java/org/apache/bsf/engines/javaclass/JavaClassEngine.java b/src/main/java/org/apache/bsf/engines/javaclass/JavaClassEngine.java
index 5a7f220..39a3d00 100644
--- a/src/main/java/org/apache/bsf/engines/javaclass/JavaClassEngine.java
+++ b/src/main/java/org/apache/bsf/engines/javaclass/JavaClassEngine.java
@@ -37,7 +37,7 @@
* an instance method call or a static call (as per Java) on the given
* object.
*/
- public Object call (Object object, String method, Object[] args)
+ public Object call (final Object object, final String method, final Object[] args)
throws BSFException {
// determine arg types
Class[] argTypes = null;
@@ -50,11 +50,11 @@
// now find method with the right signature, call it and return result
try {
- Method m = MethodUtils.getMethod (object, method, argTypes);
+ final Method m = MethodUtils.getMethod (object, method, argTypes);
return m.invoke (object, args);
- } catch (Exception e) {
+ } catch (final Exception e) {
// something went wrong while invoking method
- Throwable t = (e instanceof InvocationTargetException) ?
+ final Throwable t = (e instanceof InvocationTargetException) ?
((InvocationTargetException)e).getTargetException () :
null;
throw new BSFException (BSFException.REASON_OTHER_ERROR,
@@ -66,8 +66,8 @@
* This is used by an application to evaluate an object containing
* some expression - clearly not possible for compiled code ..
*/
- public Object eval (String source, int lineNo, int columnNo,
- Object oscript) throws BSFException {
+ public Object eval (final String source, final int lineNo, final int columnNo,
+ final Object oscript) throws BSFException {
throw new BSFException (BSFException.REASON_UNSUPPORTED_FEATURE,
"Java bytecode engine can't evaluate expressions");
}
diff --git a/src/main/java/org/apache/bsf/engines/javascript/JavaScriptEngine.java b/src/main/java/org/apache/bsf/engines/javascript/JavaScriptEngine.java
index ff5465d..e563b1e 100644
--- a/src/main/java/org/apache/bsf/engines/javascript/JavaScriptEngine.java
+++ b/src/main/java/org/apache/bsf/engines/javascript/JavaScriptEngine.java
@@ -62,7 +62,7 @@
* passed to the extension, which may be either
* Vectors of Nodes, or Strings.
*/
- public Object call(Object object, String method, Object[] args)
+ public Object call(final Object object, final String method, final Object[] args)
throws BSFException {
Object retval = null;
@@ -73,7 +73,7 @@
// REMIND: convert arg list Vectors here?
- Object fun = global.get(method, global);
+ final Object fun = global.get(method, global);
// NOTE: Source and line arguments are nonsense in a call().
// Any way to make these arguments *sensible?
if (fun == Scriptable.NOT_FOUND) {
@@ -96,7 +96,7 @@
retval = ((Wrapper) retval).unwrap();
}
}
- catch (Throwable t) {
+ catch (final Throwable t) {
handleError(t);
}
finally {
@@ -105,7 +105,7 @@
return retval;
}
- public void declareBean(BSFDeclaredBean bean) throws BSFException {
+ public void declareBean(final BSFDeclaredBean bean) throws BSFException {
if ((bean.bean instanceof Number) ||
(bean.bean instanceof String) ||
(bean.bean instanceof Boolean)) {
@@ -113,7 +113,7 @@
}
else {
// Must wrap non-scriptable objects before presenting to Rhino
- Scriptable wrapped = Context.toObject(bean.bean, global);
+ final Scriptable wrapped = Context.toObject(bean.bean, global);
global.put(bean.name, global, wrapped);
}
}
@@ -122,10 +122,10 @@
* This is used by an application to evaluate a string containing
* some expression.
*/
- public Object eval(String source, int lineNo, int columnNo, Object oscript)
+ public Object eval(final String source, final int lineNo, final int columnNo, final Object oscript)
throws BSFException {
- String scriptText = oscript.toString();
+ final String scriptText = oscript.toString();
Object retval = null;
Context cx;
@@ -147,7 +147,7 @@
}
}
- catch (Throwable t) { // includes JavaScriptException, rethrows Errors
+ catch (final Throwable t) { // includes JavaScriptException, rethrows Errors
handleError(t);
}
finally {
@@ -168,7 +168,7 @@
message = t.getLocalizedMessage();
// Is it an exception wrapped in a JavaScriptException?
- Object value = ((JavaScriptException) t).getValue();
+ final Object value = ((JavaScriptException) t).getValue();
if (value instanceof Throwable) {
// likely a wrapped exception from a LiveConnect call.
// Display its stack trace as a diagnostic
@@ -209,23 +209,23 @@
* Put the manager into the context-manager
* map hashtable too.
*/
- public void initialize(BSFManager mgr, String lang, Vector declaredBeans)
+ public void initialize(final BSFManager mgr, final String lang, final Vector declaredBeans)
throws BSFException {
super.initialize(mgr, lang, declaredBeans);
// Initialize context and global scope object
try {
- Context cx = Context.enter();
+ final Context cx = Context.enter();
global = new ImporterTopLevel(cx);
- Scriptable bsf = Context.toObject(new BSFFunctions(mgr, this), global);
+ final Scriptable bsf = Context.toObject(new BSFFunctions(mgr, this), global);
global.put("bsf", global, bsf);
- for(Iterator it = declaredBeans.iterator(); it.hasNext();) {
+ for(final Iterator it = declaredBeans.iterator(); it.hasNext();) {
declareBean((BSFDeclaredBean) it.next());
}
}
- catch (Throwable t) {
+ catch (final Throwable t) {
}
finally {
@@ -233,7 +233,7 @@
}
}
- public void undeclareBean(BSFDeclaredBean bean) throws BSFException {
+ public void undeclareBean(final BSFDeclaredBean bean) throws BSFException {
global.delete(bean.name);
}
}
diff --git a/src/main/java/org/apache/bsf/engines/jexl/JEXLEngine.java b/src/main/java/org/apache/bsf/engines/jexl/JEXLEngine.java
index a89f7e4..2343ff3 100644
--- a/src/main/java/org/apache/bsf/engines/jexl/JEXLEngine.java
+++ b/src/main/java/org/apache/bsf/engines/jexl/JEXLEngine.java
@@ -54,12 +54,12 @@
* @throws BSFException For any exception that occurs while trying to
* initialize the engine.
*/
- public void initialize(BSFManager mgr, String lang, Vector declaredBeans)
+ public void initialize(final BSFManager mgr, final String lang, final Vector declaredBeans)
throws BSFException {
super.initialize(mgr, lang, declaredBeans);
jc = JexlHelper.createContext();
for (int i = 0; i < declaredBeans.size(); i++) {
- BSFDeclaredBean bean = (BSFDeclaredBean) declaredBeans.elementAt(i);
+ final BSFDeclaredBean bean = (BSFDeclaredBean) declaredBeans.elementAt(i);
jc.getVars().put(bean.name, bean.bean);
}
}
@@ -84,7 +84,7 @@
* @throws BSFException For any exception that occurs while trying to
* declare the bean.
*/
- public void declareBean(BSFDeclaredBean bean) throws BSFException {
+ public void declareBean(final BSFDeclaredBean bean) throws BSFException {
jc.getVars().put(bean.name, bean.bean);
}
@@ -97,7 +97,7 @@
* @throws BSFException For any exception that occurs while trying to
* undeclare the bean.
*/
- public void undeclareBean(BSFDeclaredBean bean) throws BSFException {
+ public void undeclareBean(final BSFDeclaredBean bean) throws BSFException {
jc.getVars().remove(bean.name);
}
@@ -112,7 +112,7 @@
* @throws BSFException For any exception that occurs while
* evaluating the expression.
*/
- public Object eval(String fileName, int lineNo, int colNo, Object expr)
+ public Object eval(final String fileName, final int lineNo, final int colNo, final Object expr)
throws BSFException {
if (expr == null) {
return null;
@@ -127,7 +127,7 @@
jExpr = ScriptFactory.createScript((String) expr);
}
return jExpr.execute(jc);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new BSFException(BSFException.REASON_EXECUTION_ERROR,
"Exception from Commons JEXL:\n" + e.getMessage(), e);
}
@@ -144,7 +144,7 @@
* @throws BSFException For any exception that occurs while
* executing the script.
*/
- public void exec(String fileName, int lineNo, int colNo, Object script)
+ public void exec(final String fileName, final int lineNo, final int colNo, final Object script)
throws BSFException {
if (script == null) {
return;
@@ -159,7 +159,7 @@
jExpr = ScriptFactory.createScript((String) script);
}
jExpr.execute(jc);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new BSFException(BSFException.REASON_EXECUTION_ERROR,
"Exception from Commons JEXL:\n" + e.getMessage(), e);
}
@@ -177,7 +177,7 @@
* @throws BSFException For any exception that occurs while interactively
* executing the script.
*/
- public void iexec(String fileName, int lineNo, int colNo, Object script)
+ public void iexec(final String fileName, final int lineNo, final int colNo, final Object script)
throws BSFException {
exec(fileName, lineNo, colNo, script);
}
@@ -194,16 +194,16 @@
* @throws BSFException For any exception that occurs while making
* the call.
*/
- public Object call(Object object, String name, Object[] args)
+ public Object call(final Object object, final String name, final Object[] args)
throws BSFException {
try {
- Class[] types = new Class[args.length];
+ final Class[] types = new Class[args.length];
for (int i = 0; i < args.length; i++) {
types[i] = args[i].getClass();
}
- Method m = object.getClass().getMethod(name, types);
+ final Method m = object.getClass().getMethod(name, types);
return m.invoke(object, args);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new BSFException(BSFException.REASON_EXECUTION_ERROR,
"Exception from JEXLEngine:\n" + e.getMessage(), e);
}
diff --git a/src/main/java/org/apache/bsf/engines/jython/JythonEngine.java b/src/main/java/org/apache/bsf/engines/jython/JythonEngine.java
index 8938399..a3c6f57 100644
--- a/src/main/java/org/apache/bsf/engines/jython/JythonEngine.java
+++ b/src/main/java/org/apache/bsf/engines/jython/JythonEngine.java
@@ -52,7 +52,7 @@
/**
* call the named method of the given object.
*/
- public Object call (Object object, String method, Object[] args)
+ public Object call (final Object object, final String method, final Object[] args)
throws BSFException {
try {
PyObject[] pyargs = Py.EmptyObjects;
@@ -65,7 +65,7 @@
}
if (object != null) {
- PyObject o = Py.java2py(object);
+ final PyObject o = Py.java2py(object);
return unwrap(o.invoke(method, pyargs));
}
@@ -79,7 +79,7 @@
}
return null;
- } catch (PyException e) {
+ } catch (final PyException e) {
throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
"exception from Jython:\n" + e, e);
}
@@ -88,7 +88,7 @@
/**
* Declare a bean
*/
- public void declareBean (BSFDeclaredBean bean) throws BSFException {
+ public void declareBean (final BSFDeclaredBean bean) throws BSFException {
interp.set (bean.name, bean.bean);
}
@@ -96,15 +96,15 @@
* Evaluate an anonymous function (differs from eval() in that apply()
* handles multiple lines).
*/
- public Object apply (String source, int lineNo, int columnNo,
- Object funcBody, Vector paramNames,
- Vector arguments) throws BSFException {
+ public Object apply (final String source, final int lineNo, final int columnNo,
+ final Object funcBody, final Vector paramNames,
+ final Vector arguments) throws BSFException {
try {
/* We wrapper the original script in a function definition, and
* evaluate the function. A hack, no question, but it allows
* apply() to pretend to work on Jython.
*/
- StringBuffer script = new StringBuffer(byteify(funcBody.toString()));
+ final StringBuffer script = new StringBuffer(byteify(funcBody.toString()));
int index = 0;
script.insert(0, "def bsf_temp_fn():\n");
@@ -115,7 +115,7 @@
index++;
}
- String scriptStr = script.toString ();
+ final String scriptStr = script.toString ();
importPackage(scriptStr);
interp.exec (scriptStr);
@@ -125,7 +125,7 @@
result = ((PyJavaInstance)result).__tojava__(Object.class);
}
return result;
- } catch (PyException e) {
+ } catch (final PyException e) {
throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
"exception from Jython:\n" + e, e);
}
@@ -134,17 +134,17 @@
/**
* Evaluate an expression.
*/
- public Object eval (String source, int lineNo, int columnNo,
- Object script) throws BSFException {
+ public Object eval (final String source, final int lineNo, final int columnNo,
+ final Object script) throws BSFException {
try {
- String scriptStr = byteify(script.toString ());
+ final String scriptStr = byteify(script.toString ());
importPackage(scriptStr);
Object result = interp.eval (scriptStr);
if (result instanceof PyJavaInstance) {
result = ((PyJavaInstance)result).__tojava__(Object.class);
}
return result;
- } catch (PyException e) {
+ } catch (final PyException e) {
throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
"exception from Jython:\n" + e, e);
}
@@ -153,22 +153,22 @@
/**
* Execute a script.
*/
- public void exec (String source, int lineNo, int columnNo,
- Object script) throws BSFException {
+ public void exec (final String source, final int lineNo, final int columnNo,
+ final Object script) throws BSFException {
try {
- String scriptStr = byteify(script.toString());
+ final String scriptStr = byteify(script.toString());
importPackage(scriptStr);
interp.exec (scriptStr);
- } catch (PyException e) {
+ } catch (final PyException e) {
throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
"exception from Jython:\n" + e, e);
}
}
- private void importPackage(String script) {
- Matcher matcher = fromRegExp.matcher(script);
+ private void importPackage(final String script) {
+ final Matcher matcher = fromRegExp.matcher(script);
while (matcher.find()) {
- String packageName = matcher.group(1);
+ final String packageName = matcher.group(1);
PySystemState.add_package(packageName);
}
}
@@ -176,11 +176,11 @@
/**
* Execute script code, emulating console interaction.
*/
- public void iexec (String source, int lineNo, int columnNo,
- Object script) throws BSFException {
+ public void iexec (final String source, final int lineNo, final int columnNo,
+ final Object script) throws BSFException {
String scriptStr = byteify(script.toString());
importPackage(scriptStr);
- int newline = scriptStr.indexOf("\n");
+ final int newline = scriptStr.indexOf("\n");
if (newline > -1) {
scriptStr = scriptStr.substring(0, newline);
@@ -194,7 +194,7 @@
if (!(interp.runsource(interp.buffer.toString()))) {
interp.resetbuffer();
}
- } catch (PyException e) {
+ } catch (final PyException e) {
interp.resetbuffer();
throw new BSFException(BSFException.REASON_EXECUTION_ERROR,
"exception from Jython:\n" + e, e);
@@ -204,8 +204,8 @@
/**
* Initialize the engine.
*/
- public void initialize (BSFManager mgr, String lang,
- Vector declaredBeans) throws BSFException {
+ public void initialize (final BSFManager mgr, final String lang,
+ final Vector declaredBeans) throws BSFException {
super.initialize (mgr, lang, declaredBeans);
// create an interpreter
@@ -219,7 +219,7 @@
interp.set ("bsf", new BSFFunctions (mgr, this));
// Declare all declared beans to the interpreter
- int size = declaredBeans.size ();
+ final int size = declaredBeans.size ();
for (int i = 0; i < size; i++) {
declareBean ((BSFDeclaredBean) declaredBeans.elementAt (i));
}
@@ -228,13 +228,13 @@
/**
* Undeclare a previously declared bean.
*/
- public void undeclareBean (BSFDeclaredBean bean) throws BSFException {
+ public void undeclareBean (final BSFDeclaredBean bean) throws BSFException {
interp.set (bean.name, null);
}
- public Object unwrap(PyObject result) {
+ public Object unwrap(final PyObject result) {
if (result != null) {
- Object ret = result.__tojava__(Object.class);
+ final Object ret = result.__tojava__(Object.class);
if (ret != Py.NoConversion) {
return ret;
}
@@ -242,11 +242,11 @@
return result;
}
- private String byteify (String orig) {
+ private String byteify (final String orig) {
// Ugh. Jython likes to be fed bytes, rather than the input string.
- ByteArrayInputStream bais =
+ final ByteArrayInputStream bais =
new ByteArrayInputStream(orig.getBytes());
- StringBuffer s = new StringBuffer();
+ final StringBuffer s = new StringBuffer();
int c;
while ((c = bais.read()) >= 0) {
@@ -262,20 +262,20 @@
}
// Override runcode so as not to print the stack dump
- public void runcode(PyObject code) {
+ public void runcode(final PyObject code) {
try {
this.exec(code);
- } catch (PyException exc) {
+ } catch (final PyException exc) {
throw exc;
}
}
}
- public void propertyChange(PropertyChangeEvent e) {
+ public void propertyChange(final PropertyChangeEvent e) {
super.propertyChange(e);
- String name = e.getPropertyName();
- Object value = e.getNewValue();
+ final String name = e.getPropertyName();
+ final Object value = e.getNewValue();
if (name.equals("classLoader")) {
Py.getSystemState().setClassLoader((ClassLoader) value);
}
diff --git a/src/main/java/org/apache/bsf/engines/xslt/XSLTEngine.java b/src/main/java/org/apache/bsf/engines/xslt/XSLTEngine.java
index 86efb4c..a4d6271 100644
--- a/src/main/java/org/apache/bsf/engines/xslt/XSLTEngine.java
+++ b/src/main/java/org/apache/bsf/engines/xslt/XSLTEngine.java
@@ -70,7 +70,7 @@
/**
* call the named method of the given object.
*/
- public Object call (Object object, String method, Object[] args)
+ public Object call (final Object object, final String method, final Object[] args)
throws BSFException {
throw new BSFException (BSFException.REASON_UNSUPPORTED_FEATURE,
"BSF:XSLTEngine can't call methods");
@@ -79,7 +79,7 @@
/**
* Declare a bean by setting it as a parameter
*/
- public void declareBean (BSFDeclaredBean bean) throws BSFException {
+ public void declareBean (final BSFDeclaredBean bean) throws BSFException {
transformer.setParameter (bean.name, new XObject (bean.bean));
}
@@ -87,15 +87,15 @@
* Evaluate an expression. In this case, an expression is assumed
* to be a stylesheet of the template style (see the XSLT spec).
*/
- public Object eval (String source, int lineNo, int columnNo,
- Object oscript) throws BSFException {
+ public Object eval (final String source, final int lineNo, final int columnNo,
+ final Object oscript) throws BSFException {
// get the style base URI (the place from where Xerces XSLT will
// look for imported/included files and referenced docs): if a
// bean named "xslt:styleBaseURI" is registered, then cvt it
// to a string and use that. Otherwise use ".", which means the
// base is the directory where the process is running from
- Object sbObj = mgr.lookupBean ("xslt:styleBaseURI");
- String styleBaseURI = (sbObj == null) ? "." : sbObj.toString ();
+ final Object sbObj = mgr.lookupBean ("xslt:styleBaseURI");
+ final String styleBaseURI = (sbObj == null) ? "." : sbObj.toString ();
// Locate the stylesheet.
StreamSource styleSource;
@@ -106,7 +106,7 @@
try {
transformer = tFactory.newTransformer(styleSource);
- } catch (Exception e) {
+ } catch (final Exception e) {
logger.error("Exception from Xerces XSLT:", e);
throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
"Exception from Xerces XSLT: " + e, e);
@@ -117,7 +117,7 @@
// if its a URL parse it, if not treat it as a file and make a URL and
// parse it and go. If no xslt:src is found, use an empty document
// (stylesheet is treated as a literal result element stylesheet)
- Object srcObj = mgr.lookupBean ("xslt:src");
+ final Object srcObj = mgr.lookupBean ("xslt:src");
Object xis = null;
if (srcObj != null) {
if (srcObj instanceof Node) {
@@ -132,7 +132,7 @@
xis = new StreamSource ((File) srcObj);
mesg = "as a file";
} else {
- String srcObjstr=srcObj.toString();
+ final String srcObjstr=srcObj.toString();
xis = new StreamSource (new StringReader(srcObjstr));
if (srcObj instanceof URL) {
mesg = "as a URL";
@@ -146,7 +146,7 @@
throw new Exception ("Unable to get input from '" +
srcObj + "' " + mesg);
}
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
"BSF:XSLTEngine: unable to get " +
"input from '" + srcObj + "' as XML", e);
@@ -161,7 +161,7 @@
// set all declared beans as parameters.
for (int i = 0; i < declaredBeans.size (); i++) {
- BSFDeclaredBean b = (BSFDeclaredBean) declaredBeans.elementAt (i);
+ final BSFDeclaredBean b = (BSFDeclaredBean) declaredBeans.elementAt (i);
transformer.setParameter (b.name, new XObject (b.bean));
}
@@ -172,10 +172,10 @@
// do it
try {
- DOMResult result = new DOMResult();
+ final DOMResult result = new DOMResult();
transformer.transform ((StreamSource) xis, result);
return new XSLTResultNode (result.getNode());
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
"exception while eval'ing XSLT script" + e, e);
}
@@ -184,8 +184,8 @@
/**
* Initialize the engine.
*/
- public void initialize (BSFManager mgr, String lang,
- Vector declaredBeans) throws BSFException {
+ public void initialize (final BSFManager mgr, final String lang,
+ final Vector declaredBeans) throws BSFException {
super.initialize (mgr, lang, declaredBeans);
tFactory = TransformerFactory.newInstance();
@@ -194,7 +194,7 @@
/**
* Undeclare a bean by setting he parameter represeting it to null
*/
- public void undeclareBean (BSFDeclaredBean bean) throws BSFException {
+ public void undeclareBean (final BSFDeclaredBean bean) throws BSFException {
// Cannot clear only one parameter in Xalan 2, so we set it to null
if ((transformer.getParameter (bean.name)) != null) {
transformer.setParameter (bean.name, null);
diff --git a/src/main/java/org/apache/bsf/engines/xslt/XSLTResultNode.java b/src/main/java/org/apache/bsf/engines/xslt/XSLTResultNode.java
index 1e1daea..bdb7f90 100644
--- a/src/main/java/org/apache/bsf/engines/xslt/XSLTResultNode.java
+++ b/src/main/java/org/apache/bsf/engines/xslt/XSLTResultNode.java
@@ -23,7 +23,7 @@
{
Node node;
- public XSLTResultNode(Node node)
+ public XSLTResultNode(final Node node)
{
this.node = node;
}
diff --git a/src/main/java/org/apache/bsf/util/BSFClassLoader.java b/src/main/java/org/apache/bsf/util/BSFClassLoader.java
index e25c801..f2aa5fb 100644
--- a/src/main/java/org/apache/bsf/util/BSFClassLoader.java
+++ b/src/main/java/org/apache/bsf/util/BSFClassLoader.java
@@ -35,7 +35,7 @@
// this package.
BSFClassLoader () {
}
- public synchronized Class loadClass (String name, boolean resolve)
+ public synchronized Class loadClass (final String name, final boolean resolve)
throws ClassNotFoundException {
Class c = (Class) cache.get (name);
if (c == null) {
@@ -44,14 +44,14 @@
c = findSystemClass (name);
cache.put (name, c);
return c;
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// nope
}
try {
- byte[] data = loadClassData (name);
+ final byte[] data = loadClassData (name);
c = defineClass (name, data, 0, data.length);
cache.put (name, c);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace ();
throw new ClassNotFoundException ("unable to resolve class '" +
name + "'");
@@ -62,15 +62,15 @@
}
return c;
}
- private byte[] loadClassData (String name) throws Exception {
- String fileName = tempDir + File.separatorChar + name + ".class";
- FileInputStream fi = new FileInputStream (fileName);
- byte[] data = new byte[fi.available ()];
+ private byte[] loadClassData (final String name) throws Exception {
+ final String fileName = tempDir + File.separatorChar + name + ".class";
+ final FileInputStream fi = new FileInputStream (fileName);
+ final byte[] data = new byte[fi.available ()];
fi.read (data);
fi.close();
return data;
}
- public void setTempDir (String tempDir) {
+ public void setTempDir (final String tempDir) {
this.tempDir = tempDir;
}
}
diff --git a/src/main/java/org/apache/bsf/util/BSFEngineImpl.java b/src/main/java/org/apache/bsf/util/BSFEngineImpl.java
index 6901430..a39da6a 100644
--- a/src/main/java/org/apache/bsf/util/BSFEngineImpl.java
+++ b/src/main/java/org/apache/bsf/util/BSFEngineImpl.java
@@ -48,8 +48,8 @@
* Default impl of apply - calls eval ignoring parameters and returns
* the result.
*/
- public Object apply(String source, int lineNo, int columnNo,
- Object funcBody, Vector paramNames, Vector arguments)
+ public Object apply(final String source, final int lineNo, final int columnNo,
+ final Object funcBody, final Vector paramNames, final Vector arguments)
throws BSFException {
return eval(source, lineNo, columnNo, funcBody);
}
@@ -57,9 +57,9 @@
/**
* Default impl of compileApply - calls compileExpr ignoring parameters.
*/
- public void compileApply(String source, int lineNo, int columnNo,
- Object funcBody, Vector paramNames,
- Vector arguments, CodeBuffer cb)
+ public void compileApply(final String source, final int lineNo, final int columnNo,
+ final Object funcBody, final Vector paramNames,
+ final Vector arguments, final CodeBuffer cb)
throws BSFException {
compileExpr(source, lineNo, columnNo, funcBody, cb);
}
@@ -68,8 +68,8 @@
* Default impl of compileExpr - generates code that'll create a new
* manager, evaluate the expression, and return the value.
*/
- public void compileExpr(String source, int lineNo, int columnNo,
- Object expr, CodeBuffer cb) throws BSFException {
+ public void compileExpr(final String source, final int lineNo, final int columnNo,
+ final Object expr, final CodeBuffer cb) throws BSFException {
ObjInfo bsfInfo = cb.getSymbol("bsf");
if (bsfInfo == null) {
@@ -84,7 +84,7 @@
evalString += "," + StringUtils.lineSeparator;
evalString += StringUtils.getSafeString(expr.toString()) + ")";
- ObjInfo oldRet = cb.getFinalServiceMethodStatement();
+ final ObjInfo oldRet = cb.getFinalServiceMethodStatement();
if (oldRet != null && oldRet.isExecutable()) {
cb.addServiceMethodStatement(oldRet.objName + ";");
@@ -100,8 +100,8 @@
* Default impl of compileScript - generates code that'll create a new
* manager, and execute the script.
*/
- public void compileScript(String source, int lineNo, int columnNo,
- Object script, CodeBuffer cb)
+ public void compileScript(final String source, final int lineNo, final int columnNo,
+ final Object script, final CodeBuffer cb)
throws BSFException {
ObjInfo bsfInfo = cb.getSymbol("bsf");
@@ -117,7 +117,7 @@
execString += "," + StringUtils.lineSeparator;
execString += StringUtils.getSafeString(script.toString()) + ")";
- ObjInfo oldRet = cb.getFinalServiceMethodStatement();
+ final ObjInfo oldRet = cb.getFinalServiceMethodStatement();
if (oldRet != null && oldRet.isExecutable()) {
cb.addServiceMethodStatement(oldRet.objName + ";");
@@ -128,7 +128,7 @@
cb.addServiceMethodException("org.apache.bsf.BSFException");
}
- public void declareBean(BSFDeclaredBean bean) throws BSFException {
+ public void declareBean(final BSFDeclaredBean bean) throws BSFException {
throw new BSFException(BSFException.REASON_UNSUPPORTED_FEATURE,
"language " + lang +
" does not support declareBean(...).");
@@ -137,7 +137,7 @@
/**
* Default impl of execute - calls eval and ignores the result.
*/
- public void exec(String source, int lineNo, int columnNo, Object script)
+ public void exec(final String source, final int lineNo, final int columnNo, final Object script)
throws BSFException {
eval(source, lineNo, columnNo, script);
}
@@ -145,7 +145,7 @@
/**
* Default impl of interactive execution - calls eval and ignores the result.
*/
- public void iexec(String source, int lineNo, int columnNo, Object script)
+ public void iexec(final String source, final int lineNo, final int columnNo, final Object script)
throws BSFException {
eval(source, lineNo, columnNo, script);
}
@@ -155,7 +155,7 @@
* the manager. Declared beans are simply kept in a vector and
* that's it. Subclasses must do whatever they want with it.
*/
- public void initialize(BSFManager mgr, String lang, Vector declaredBeans)
+ public void initialize(final BSFManager mgr, final String lang, final Vector declaredBeans)
throws BSFException {
this.mgr = mgr;
@@ -175,9 +175,9 @@
*
* @param e PropertyChange event with the change data
*/
- public void propertyChange(PropertyChangeEvent e) {
- String name = e.getPropertyName();
- Object value = e.getNewValue();
+ public void propertyChange(final PropertyChangeEvent e) {
+ final String name = e.getPropertyName();
+ final Object value = e.getNewValue();
if (name.equals("classPath")) {
classPath = (String) value;
@@ -196,7 +196,7 @@
classLoader = null;
}
- public void undeclareBean(BSFDeclaredBean bean) throws BSFException {
+ public void undeclareBean(final BSFDeclaredBean bean) throws BSFException {
throw new BSFException(BSFException.REASON_UNSUPPORTED_FEATURE,
"language " + lang +
" does not support undeclareBean(...).");
diff --git a/src/main/java/org/apache/bsf/util/BSFEventProcessor.java b/src/main/java/org/apache/bsf/util/BSFEventProcessor.java
index 9da9863..224f2f5 100644
--- a/src/main/java/org/apache/bsf/util/BSFEventProcessor.java
+++ b/src/main/java/org/apache/bsf/util/BSFEventProcessor.java
@@ -44,8 +44,8 @@
* Package-protected constructor makes this class unavailable for
* public use.
*/
- BSFEventProcessor (BSFEngine engine, BSFManager manager, String filter,
- String source, int lineNo, int columnNo, Object script)
+ BSFEventProcessor (final BSFEngine engine, final BSFManager manager, final String filter,
+ final String source, final int lineNo, final int columnNo, final Object script)
throws BSFException {
this.engine = engine;
this.manager = manager;
@@ -63,14 +63,14 @@
// of the property. In any case, in the event processor, I only forward
// those events if for which the filters match (if one is specified).
- public void processEvent (String inFilter, Object[] evtInfo) {
+ public void processEvent (final String inFilter, final Object[] evtInfo) {
try {
processExceptionableEvent (inFilter, evtInfo);
- } catch (RuntimeException re) {
+ } catch (final RuntimeException re) {
// rethrow this .. I don't want to intercept run-time stuff
// that can in fact occur legit
throw re;
- } catch (Exception e) {
+ } catch (final Exception e) {
// should not occur
System.err.println ("BSFError: non-exceptionable event delivery " +
"threw exception (that's not nice): " + e);
@@ -83,7 +83,7 @@
// an exception which must go all the way back to the source (as in
// the vetoableChange case)
- public void processExceptionableEvent (String inFilter, Object[] evtInfo) throws Exception
+ public void processExceptionableEvent (final String inFilter, final Object[] evtInfo) throws Exception
{
if ((filter != null) && !isFilteredEvent(filter, inFilter)) {
// ignore this event
@@ -96,7 +96,7 @@
}
- private static boolean isFilteredEvent(final String filter, String inFilter)
+ private static boolean isFilteredEvent(final String filter, final String inFilter)
{
boolean bRes=filter.equalsIgnoreCase(inFilter);
if (bRes)
@@ -104,7 +104,7 @@
return bRes;
}
- String chunks[]=filter.replace('+',' ').split(" ");
+ final String chunks[]=filter.replace('+',' ').split(" ");
for (int i=0;i<chunks.length;i++)
{
bRes=chunks[i].equalsIgnoreCase(inFilter);
diff --git a/src/main/java/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java b/src/main/java/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java
index b55461d..c67bfa6 100644
--- a/src/main/java/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java
+++ b/src/main/java/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java
@@ -75,9 +75,9 @@
* e.g. for indicating which scripting engine object should be
* ultimately informed of the event occurrence.
*/
- BSFEventProcessorReturningEventInfos(BSFEngine engine, BSFManager manager,
- String filter, String source, int lineNo, int columnNo,
- Object script, Object dataFromScriptingEngine) throws BSFException {
+ BSFEventProcessorReturningEventInfos(final BSFEngine engine, final BSFManager manager,
+ final String filter, final String source, final int lineNo, final int columnNo,
+ final Object script, final Object dataFromScriptingEngine) throws BSFException {
this.engine = engine;
this.manager = manager;
this.filter = filter;
@@ -96,14 +96,14 @@
// of the property. In any case, in the event processor, I only forward
// those events if for which the filters match (if one is specified).
- public void processEvent(String inFilter, Object[] evtInfo) {
+ public void processEvent(final String inFilter, final Object[] evtInfo) {
try {
processExceptionableEvent(inFilter, evtInfo);
- } catch (RuntimeException re) {
+ } catch (final RuntimeException re) {
// rethrow this .. I don't want to intercept run-time stuff
// that can in fact occur legit
throw re;
- } catch (Exception e) {
+ } catch (final Exception e) {
// should not occur
System.err.println("BSFError: non-exceptionable event delivery "
+ "threw exception (that's not nice): " + e);
@@ -117,7 +117,7 @@
// an exception which must go all the way back to the source (as in
// the vetoableChange case)
- public void processExceptionableEvent(String inFilter, Object[] evtInfo)
+ public void processExceptionableEvent(final String inFilter, final Object[] evtInfo)
throws Exception {
// System.err.println(this+": inFilter=["+inFilter+"],
@@ -131,7 +131,7 @@
// engine.exec (source, lineNo, columnNo, script);
// create the parameter vectors for engine.apply()
- Vector paramNames = new Vector(), paramValues = new Vector();
+ final Vector paramNames = new Vector(), paramValues = new Vector();
// parameter # 1
// supply the parameters as an array object as sent to the event object
@@ -168,7 +168,7 @@
}
- private static boolean isFilteredEvent(final String filter, String inFilter)
+ private static boolean isFilteredEvent(final String filter, final String inFilter)
{
boolean bRes=filter.equalsIgnoreCase(inFilter);
if (bRes)
@@ -176,7 +176,7 @@
return bRes;
}
- String chunks[]=filter.replace('+',' ').split(" ");
+ final String chunks[]=filter.replace('+',' ').split(" ");
for (int i=0;i<chunks.length;i++)
{
bRes=chunks[i].equalsIgnoreCase(inFilter);
diff --git a/src/main/java/org/apache/bsf/util/BSFFunctions.java b/src/main/java/org/apache/bsf/util/BSFFunctions.java
index 9176cd2..d0acb1a 100644
--- a/src/main/java/org/apache/bsf/util/BSFFunctions.java
+++ b/src/main/java/org/apache/bsf/util/BSFFunctions.java
@@ -33,23 +33,23 @@
BSFManager mgr;
BSFEngine engine;
- public BSFFunctions (BSFManager mgr, BSFEngine engine) {
+ public BSFFunctions (final BSFManager mgr, final BSFEngine engine) {
this.mgr = mgr;
this.engine = engine;
}
- public void addEventListener (Object src, String eventSetName,
- String filter, Object script)
+ public void addEventListener (final Object src, final String eventSetName,
+ final String filter, final Object script)
throws BSFException {
EngineUtils.addEventListener (src, eventSetName, filter, engine,
mgr, "<event-binding>", 0, 0, script);
}
- public Object lookupBean (String name) {
+ public Object lookupBean (final String name) {
return mgr.lookupBean (name);
}
- public void registerBean (String name, Object bean) {
+ public void registerBean (final String name, final Object bean) {
mgr.registerBean (name, bean);
}
- public void unregisterBean (String name) {
+ public void unregisterBean (final String name) {
mgr.unregisterBean (name);
}
}
diff --git a/src/main/java/org/apache/bsf/util/Bean.java b/src/main/java/org/apache/bsf/util/Bean.java
index b00bb0b..7c8eeb5 100644
--- a/src/main/java/org/apache/bsf/util/Bean.java
+++ b/src/main/java/org/apache/bsf/util/Bean.java
@@ -32,7 +32,7 @@
// its current value (mebbe null)
public Object value;
- public Bean (Class type, Object value) {
+ public Bean (final Class type, final Object value) {
this.type = type;
this.value = value;
}
diff --git a/src/main/java/org/apache/bsf/util/CodeBuffer.java b/src/main/java/org/apache/bsf/util/CodeBuffer.java
index 42789b8..e8f0657 100644
--- a/src/main/java/org/apache/bsf/util/CodeBuffer.java
+++ b/src/main/java/org/apache/bsf/util/CodeBuffer.java
@@ -34,13 +34,13 @@
*/
public class CodeBuffer
{
- private StringWriter fieldDeclSW = new StringWriter(),
+ private final StringWriter fieldDeclSW = new StringWriter(),
methodDeclSW = new StringWriter(),
initializerSW = new StringWriter(),
constructorSW = new StringWriter(),
serviceMethodSW = new StringWriter();
- private PrintWriter fieldDeclPW = new PrintWriter(fieldDeclSW),
+ private final PrintWriter fieldDeclPW = new PrintWriter(fieldDeclSW),
methodDeclPW = new PrintWriter(methodDeclSW),
initializerPW = new PrintWriter(initializerSW),
constructorPW = new PrintWriter(constructorSW),
@@ -59,7 +59,7 @@
}
// New stuff...
- private Vector imports = new Vector(),
+ private final Vector imports = new Vector(),
constructorArguments = new Vector(),
constructorExceptions = new Vector(),
serviceMethodExceptions = new Vector(),
@@ -73,71 +73,71 @@
public CodeBuffer()
{
}
- public CodeBuffer(CodeBuffer parent)
+ public CodeBuffer(final CodeBuffer parent)
{
this.parent = parent;
}
- public void addConstructorArgument(ObjInfo arg)
+ public void addConstructorArgument(final ObjInfo arg)
{
constructorArguments.addElement(arg);
}
- public void addConstructorException(String exceptionName)
+ public void addConstructorException(final String exceptionName)
{
if (!constructorExceptions.contains(exceptionName))
{
constructorExceptions.addElement(exceptionName);
}
}
- public void addConstructorStatement(String statement)
+ public void addConstructorStatement(final String statement)
{
constructorPW.println(statement);
}
- public void addFieldDeclaration(String statement)
+ public void addFieldDeclaration(final String statement)
{
fieldDeclPW.println(statement);
}
- public void addImplements(String importName)
+ public void addImplements(final String importName)
{
if (!implementsVector.contains(importName))
{
implementsVector.addElement(importName);
}
}
- public void addImport(String importName)
+ public void addImport(final String importName)
{
if (!imports.contains(importName))
{
imports.addElement(importName);
}
}
- public void addInitializerStatement(String statement)
+ public void addInitializerStatement(final String statement)
{
initializerPW.println(statement);
}
- public void addMethodDeclaration(String statement)
+ public void addMethodDeclaration(final String statement)
{
methodDeclPW.println(statement);
}
- public void addServiceMethodException(String exceptionName)
+ public void addServiceMethodException(final String exceptionName)
{
if (!serviceMethodExceptions.contains(exceptionName))
{
serviceMethodExceptions.addElement(exceptionName);
}
}
- public void addServiceMethodStatement(String statement)
+ public void addServiceMethodStatement(final String statement)
{
serviceMethodPW.println(statement);
}
// Used internally by merge(...).
- private void appendIfNecessary(PrintWriter pw, StringBuffer buf)
+ private void appendIfNecessary(final PrintWriter pw, final StringBuffer buf)
{
if (buf.length() > 0)
{
pw.print(buf.toString());
}
}
- public String buildNewSymbol(String prefix)
+ public String buildNewSymbol(final String prefix)
{
Integer nextNum = getSymbolIndex(prefix);
@@ -252,7 +252,7 @@
return void.class;
}
}
- public ObjInfo getSymbol(String symbol)
+ public ObjInfo getSymbol(final String symbol)
{
ObjInfo ret = (ObjInfo)symbolTable.get(symbol);
@@ -262,7 +262,7 @@
return ret;
}
- Integer getSymbolIndex(String prefix)
+ Integer getSymbolIndex(final String prefix)
{
if (parent != null)
{
@@ -277,9 +277,9 @@
{
return symbolTable;
}
- public void merge(CodeBuffer otherCB)
+ public void merge(final CodeBuffer otherCB)
{
- Vector otherImports = otherCB.getImports();
+ final Vector otherImports = otherCB.getImports();
for (int i = 0; i < otherImports.size(); i++)
{
@@ -292,7 +292,7 @@
appendIfNecessary(constructorPW, otherCB.getConstructorBuffer());
appendIfNecessary(serviceMethodPW, otherCB.getServiceMethodBuffer());
- ObjInfo oldRet = getFinalServiceMethodStatement();
+ final ObjInfo oldRet = getFinalServiceMethodStatement();
if (oldRet != null && oldRet.isExecutable())
{
@@ -306,7 +306,7 @@
symbolTableStack.pop();
symbolTable = (Hashtable)symbolTableStack.peek();
}
- public void print(PrintWriter out, boolean formatOutput)
+ public void print(final PrintWriter out, final boolean formatOutput)
{
if (formatOutput)
{
@@ -323,11 +323,11 @@
{
symbolTable = (Hashtable)symbolTableStack.push(new ScriptSymbolTable(symbolTable));
}
- public void putSymbol(String symbol, ObjInfo obj)
+ public void putSymbol(final String symbol, final ObjInfo obj)
{
symbolTable.put(symbol, obj);
}
- void putSymbolIndex(String prefix, Integer index)
+ void putSymbolIndex(final String prefix, final Integer index)
{
if (parent != null)
{
@@ -338,31 +338,31 @@
usedSymbolIndices.put(prefix, index);
}
}
- public void setClassName(String className)
+ public void setClassName(final String className)
{
this.className = className;
}
- public void setExtends(String extendsName)
+ public void setExtends(final String extendsName)
{
this.extendsName = extendsName;
}
- public void setFinalServiceMethodStatement(ObjInfo finalStatementInfo)
+ public void setFinalServiceMethodStatement(final ObjInfo finalStatementInfo)
{
this.finalStatementInfo = finalStatementInfo;
}
- public void setPackageName(String packageName)
+ public void setPackageName(final String packageName)
{
this.packageName = packageName;
}
- public void setServiceMethodName(String serviceMethodName)
+ public void setServiceMethodName(final String serviceMethodName)
{
this.serviceMethodName = serviceMethodName;
}
- public void setServiceMethodReturnType(Class serviceMethodReturnType)
+ public void setServiceMethodReturnType(final Class serviceMethodReturnType)
{
this.serviceMethodReturnType = serviceMethodReturnType;
}
- public void setSymbolTable(Hashtable symbolTable)
+ public void setSymbolTable(final Hashtable symbolTable)
{
this.symbolTable = symbolTable;
}
@@ -372,9 +372,9 @@
}
public String toString()
{
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- ObjInfo ret = finalStatementInfo;
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
+ final ObjInfo ret = finalStatementInfo;
if (packageName != null && !packageName.equals(""))
{
diff --git a/src/main/java/org/apache/bsf/util/EngineUtils.java b/src/main/java/org/apache/bsf/util/EngineUtils.java
index 9b05efb..797eb3c 100644
--- a/src/main/java/org/apache/bsf/util/EngineUtils.java
+++ b/src/main/java/org/apache/bsf/util/EngineUtils.java
@@ -58,13 +58,13 @@
// ---rgf, 2003-02-13, determine whether changing accessibility of Methods is possible
static boolean bMethodHasSetAccessible=false;
static {
- Class mc=Method.class; // get the "Method" class object
- Class arg[]={boolean.class}; // define an array with the primitive "boolean" pseudo class object
+ final Class mc=Method.class; // get the "Method" class object
+ final Class arg[]={boolean.class}; // define an array with the primitive "boolean" pseudo class object
try {
mc.getMethod("setAccessible", arg ); // is this method available?
bMethodHasSetAccessible=true; // no exception, hence method exists
}
- catch (Exception e)
+ catch (final Exception e)
{
bMethodHasSetAccessible=false;// exception occurred, hence method does not exist
}
@@ -90,18 +90,18 @@
*
* @exception BSFException if anything goes wrong while running the script
*/
- public static void addEventListener (Object bean, String eventSetName,
- String filter, BSFEngine engine,
- BSFManager manager, String source,
- int lineNo, int columnNo,
- Object script) throws BSFException {
- BSFEventProcessor ep = new BSFEventProcessor (engine, manager, filter,
+ public static void addEventListener (final Object bean, final String eventSetName,
+ final String filter, final BSFEngine engine,
+ final BSFManager manager, final String source,
+ final int lineNo, final int columnNo,
+ final Object script) throws BSFException {
+ final BSFEventProcessor ep = new BSFEventProcessor (engine, manager, filter,
source, lineNo, columnNo,
script);
try {
ReflectionUtils.addEventListener (bean, eventSetName, ep);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace ();
throw new BSFException (BSFException.REASON_OTHER_ERROR,
"[EngineUtils.addEventListener()] ouch while adding event listener: "
@@ -134,19 +134,19 @@
*
* @exception BSFException if anything goes wrong while running the script
*/
- public static void addEventListenerReturningEventInfos ( Object bean,
- String eventSetName,
- String filter,
- BSFEngine engine,
- BSFManager manager,
- String source,
- int lineNo,
- int columnNo,
- Object script,
- Object dataFromScriptingEngine
+ public static void addEventListenerReturningEventInfos ( final Object bean,
+ final String eventSetName,
+ final String filter,
+ final BSFEngine engine,
+ final BSFManager manager,
+ final String source,
+ final int lineNo,
+ final int columnNo,
+ final Object script,
+ final Object dataFromScriptingEngine
) throws BSFException
{
- BSFEventProcessorReturningEventInfos ep =
+ final BSFEventProcessorReturningEventInfos ep =
new BSFEventProcessorReturningEventInfos (engine,
manager,
filter,
@@ -159,7 +159,7 @@
try {
ReflectionUtils.addEventListener (bean, eventSetName, ep);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace ();
throw new BSFException (BSFException.REASON_OTHER_ERROR,
"[EngineUtils.addEventListenerReturningEventInfos()] ouch while adding event listener: "
@@ -182,8 +182,8 @@
*
* @exception BSFException if something goes wrong
*/
- public static Object callBeanMethod (Object bean, String methodName,
- Object[] args) throws BSFException {
+ public static Object callBeanMethod (final Object bean, final String methodName,
+ final Object[] args) throws BSFException {
Class[] argTypes = null;
// determine arg types. note that a null argtype
// matches any object type
@@ -197,8 +197,8 @@
// we want to allow a static call to occur on an object, similar
// to what Java allows. So isStaticOnly is set to false.
- boolean isStaticOnly = false;
- Class beanClass = (bean instanceof Class) ? (Class)bean :
+ final boolean isStaticOnly = false;
+ final Class beanClass = (bean instanceof Class) ? (Class)bean :
bean.getClass ();
// now try to call method with the right signature
@@ -207,7 +207,7 @@
try {
m = MethodUtils.getMethod (beanClass, methodName, argTypes,
isStaticOnly);
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
// ok, so that didn't work - now try converting any primitive
// wrapper types to their primitive counterparts
try {
@@ -239,7 +239,7 @@
m = MethodUtils.getMethod (beanClass, methodName, argTypes,
isStaticOnly);
- } catch (Exception e2) {
+ } catch (final Exception e2) {
// throw the original
throw e;
}
@@ -249,7 +249,7 @@
try {
return m.invoke (bean, args);
}
- catch (Exception e) // 2003-02-23, --rgf, maybe an IllegalAccessException?
+ catch (final Exception e) // 2003-02-23, --rgf, maybe an IllegalAccessException?
{
if (e instanceof IllegalAccessException &&
bMethodHasSetAccessible &&
@@ -262,9 +262,9 @@
throw e;
}
- } catch (Exception e) {
+ } catch (final Exception e) {
// something went wrong while invoking method
- Throwable t = (e instanceof InvocationTargetException) ?
+ final Throwable t = (e instanceof InvocationTargetException) ?
((InvocationTargetException)e).getTargetException () :
null;
throw new BSFException (BSFException.REASON_OTHER_ERROR,
@@ -289,7 +289,7 @@
* org.apache.cs.util.MethodUtils for the real
* exceptions that can occur).
*/
- public static Object createBean (String className, Object args[])
+ public static Object createBean (final String className, final Object args[])
throws BSFException {
Bean obj;
Class[] argTypes = null;
@@ -306,7 +306,7 @@
obj = ReflectionUtils.createBean (null, className,
argTypes, args);
return obj.value;
- } catch (NoSuchMethodException me) {
+ } catch (final NoSuchMethodException me) {
// ok, so that didn't work - now try converting any primitive
// wrapper types to their primitive counterparts
try {
@@ -324,12 +324,12 @@
obj = ReflectionUtils.createBean (null, className,
argTypes, args);
return obj.value;
- } catch (Exception e) {
+ } catch (final Exception e) {
// throw the previous exception
throw me;
}
}
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new BSFException (BSFException.REASON_OTHER_ERROR,
"[EngineUtils.createBean()]" + e.getMessage (), e);
}
@@ -343,7 +343,7 @@
*
* @return the string representing the type signature
*/
- public static String getTypeSignatureString (Class cl) {
+ public static String getTypeSignatureString (final Class cl) {
if (cl.isPrimitive ()) {
if (cl == boolean.class) {
return "Z";
@@ -365,7 +365,7 @@
return "V";
}
} else {
- StringBuffer sb = new StringBuffer ("L");
+ final StringBuffer sb = new StringBuffer ("L");
sb.append (cl.getName ());
sb.append (";");
return sb.toString().replace ('.', '/');
@@ -388,20 +388,20 @@
*
* @exception BSFException if something goes wrong.
*/
- public static Class loadClass (BSFManager mgr, String name)
+ public static Class loadClass (final BSFManager mgr, final String name)
throws BSFException {
ClassLoader mgrCL = null;
try {
// TCCL may not be set, adapt logic!
- ClassLoader cl=Thread.currentThread().getContextClassLoader();
+ final ClassLoader cl=Thread.currentThread().getContextClassLoader();
if (cl!=null)
{
try { // try the Thread's context loader first
return Thread.currentThread().getContextClassLoader().loadClass(name);
}
- catch (ClassNotFoundException e01) {
+ catch (final ClassNotFoundException e01) {
}
}
@@ -411,7 +411,7 @@
return mgrCL.loadClass(name);
}
}
- catch (ClassNotFoundException e02) {
+ catch (final ClassNotFoundException e02) {
// o.k., now try the defined class loader
}
@@ -420,7 +420,7 @@
return bsfManagerDefinedCL.loadClass(name);
}
- } catch (ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
// try to load it from the temp dir using my own class loader
try {
if (bsfCL == null) {
@@ -428,7 +428,7 @@
}
bsfCL.setTempDir (mgr.getTempDir ());
return bsfCL.loadClass (name);
- } catch (ClassNotFoundException e2) {
+ } catch (final ClassNotFoundException e2) {
throw new BSFException (BSFException.REASON_OTHER_ERROR,
"[EngineUtils.loadClass()] unable to load class '" + name + "':" + e, e);
}
diff --git a/src/main/java/org/apache/bsf/util/IOUtils.java b/src/main/java/org/apache/bsf/util/IOUtils.java
index 8d836b2..5984cd9 100644
--- a/src/main/java/org/apache/bsf/util/IOUtils.java
+++ b/src/main/java/org/apache/bsf/util/IOUtils.java
@@ -35,10 +35,10 @@
//////////////////////////////////////////////////////////////////////////
- public static String getStringFromReader (Reader reader) throws IOException {
- BufferedReader bufIn = new BufferedReader(reader);
- StringWriter swOut = new StringWriter();
- PrintWriter pwOut = new PrintWriter(swOut);
+ public static String getStringFromReader (final Reader reader) throws IOException {
+ final BufferedReader bufIn = new BufferedReader(reader);
+ final StringWriter swOut = new StringWriter();
+ final PrintWriter pwOut = new PrintWriter(swOut);
String tempLine;
while ((tempLine = bufIn.readLine()) != null) {
diff --git a/src/main/java/org/apache/bsf/util/IndentWriter.java b/src/main/java/org/apache/bsf/util/IndentWriter.java
index 77be549..62c4e15 100644
--- a/src/main/java/org/apache/bsf/util/IndentWriter.java
+++ b/src/main/java/org/apache/bsf/util/IndentWriter.java
@@ -35,7 +35,7 @@
* Forwards its arguments to the <code>PrintWriter</code> constructor
* with the same signature.
*/
- public IndentWriter(OutputStream out)
+ public IndentWriter(final OutputStream out)
{
super(out);
}
@@ -43,7 +43,7 @@
* Forwards its arguments to the <code>PrintWriter</code> constructor
* with the same signature.
*/
- public IndentWriter(OutputStream out, boolean autoFlush)
+ public IndentWriter(final OutputStream out, final boolean autoFlush)
{
super(out, autoFlush);
}
@@ -51,7 +51,7 @@
* Forwards its arguments to the <code>PrintWriter</code> constructor
* with the same signature.
*/
- public IndentWriter(Writer out)
+ public IndentWriter(final Writer out)
{
super(out);
}
@@ -59,7 +59,7 @@
* Forwards its arguments to the <code>PrintWriter</code> constructor
* with the same signature.
*/
- public IndentWriter(Writer out, boolean autoFlush)
+ public IndentWriter(final Writer out, final boolean autoFlush)
{
super(out, autoFlush);
}
@@ -69,7 +69,7 @@
* @param numberOfSpaces the number of spaces to indent the text.
* @param text the text to print.
*/
- public void print(int numberOfSpaces, String text)
+ public void print(final int numberOfSpaces, final String text)
{
super.print(StringUtils.getChars(numberOfSpaces, ' ') + text);
}
@@ -79,7 +79,7 @@
* @param numberOfSpaces the number of spaces to indent the text.
* @param text the text to print.
*/
- public void println(int numberOfSpaces, String text)
+ public void println(final int numberOfSpaces, final String text)
{
super.println(StringUtils.getChars(numberOfSpaces, ' ') + text);
}
diff --git a/src/main/java/org/apache/bsf/util/JavaUtils.java b/src/main/java/org/apache/bsf/util/JavaUtils.java
index c8c01e3..855d2b4 100644
--- a/src/main/java/org/apache/bsf/util/JavaUtils.java
+++ b/src/main/java/org/apache/bsf/util/JavaUtils.java
@@ -34,23 +34,23 @@
logger = BSF_LogFactory.getLog((org.apache.bsf.util.JavaUtils.class).getName());
}
- public static boolean JDKcompile(String fileName, String classPath) {
- String option = (logger.isDebugEnabled()) ? "-g" : "-O";
- String args[] = { "javac", option, "-classpath", classPath, fileName };
+ public static boolean JDKcompile(final String fileName, final String classPath) {
+ final String option = (logger.isDebugEnabled()) ? "-g" : "-O";
+ final String args[] = { "javac", option, "-classpath", classPath, fileName };
logger.debug("JavaEngine: Compiling " + fileName);
logger.debug("JavaEngine: Classpath is " + classPath);
try {
- Process p = java.lang.Runtime.getRuntime().exec(args);
+ final Process p = java.lang.Runtime.getRuntime().exec(args);
p.waitFor();
return (p.exitValue() != 0);
- } catch (IOException e) {
+ } catch (final IOException e) {
logger.error("ERROR: IO exception during exec(javac).", e);
- } catch (SecurityException e) {
+ } catch (final SecurityException e) {
logger.error("ERROR: Unable to create subprocess to exec(javac).",
e);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
logger.error("ERROR: Wait for exec(javac) was interrupted.", e);
}
return false;
diff --git a/src/main/java/org/apache/bsf/util/MethodUtils.java b/src/main/java/org/apache/bsf/util/MethodUtils.java
index b9881bf..d83fbe4 100644
--- a/src/main/java/org/apache/bsf/util/MethodUtils.java
+++ b/src/main/java/org/apache/bsf/util/MethodUtils.java
@@ -63,21 +63,21 @@
newEntry: Method or Constructor under consideration.
*/
- void addItem (Object newEntry)
+ void addItem (final Object newEntry)
{
if(size()==0) {
addElement(newEntry);
} else
{
- Class[] newargs=entryGetParameterTypes(newEntry);
+ final Class[] newargs=entryGetParameterTypes(newEntry);
boolean keep=true;
- for (Enumeration e = elements();
+ for (final Enumeration e = elements();
keep & e.hasMoreElements() ;
)
{
- Object oldEntry=e.nextElement();
+ final Object oldEntry=e.nextElement();
// CAVEAT: Implicit references to enclosing class!
- Class[] oldargs=entryGetParameterTypes(oldEntry);
+ final Class[] oldargs=entryGetParameterTypes(oldEntry);
if(areMethodConvertable(oldargs,newargs)) {
removeElement(oldEntry); // New more specific; discard old
} else if(areMethodConvertable(newargs,oldargs))
@@ -98,8 +98,8 @@
Arguments describe the call we were hoping to resolve. They are
used to throw a nice verbose exception if something goes wrong.
*/
- Object getMostSpecific(Class targetClass,String methodName,
- Class[] argTypes,boolean isStaticReference)
+ Object getMostSpecific(final Class targetClass,final String methodName,
+ final Class[] argTypes,final boolean isStaticReference)
throws NoSuchMethodException
{
if(size()==1) {
@@ -107,8 +107,8 @@
}
if(size()>1)
{
- StringBuffer buf=new StringBuffer();
- Enumeration e=elements();
+ final StringBuffer buf=new StringBuffer();
+ final Enumeration e=elements();
buf.append(e.nextElement());
while(e.hasMoreElements()) {
buf.append(" and ").append(e.nextElement());
@@ -127,7 +127,7 @@
/** Convenience method: Test an entire parameter-list/argument-list pair
for isMethodConvertable(), qv.
*/
- static private boolean areMethodConvertable(Class[] parms,Class[] args)
+ static private boolean areMethodConvertable(final Class[] parms,final Class[] args)
{
if(parms.length!=args.length) {
return false;
@@ -144,10 +144,10 @@
/** Internal subroutine for getEntryPoint(): Format arguments as a
string describing the function being searched for. Used in
verbose exceptions. */
- private static String callToString(Class targetClass,String methodName,
- Class[] argTypes,boolean isStaticReference)
+ private static String callToString(final Class targetClass,final String methodName,
+ final Class[] argTypes,final boolean isStaticReference)
{
- StringBuffer buf = new StringBuffer();
+ final StringBuffer buf = new StringBuffer();
if(isStaticReference) {
buf.append("static ");
}
@@ -177,7 +177,7 @@
}
/** Utility function: obtain common data from either Method or
Constructor. (In lieu of an EntryPoint interface.) */
- static int entryGetModifiers(Object entry)
+ static int entryGetModifiers(final Object entry)
{
return (entry instanceof Method)
? ((Method)entry).getModifiers()
@@ -194,7 +194,7 @@
/** Utility function: obtain common data from either Method or
Constructor. (In lieu of an EntryPoint interface.) */
- static String entryGetName(Object entry)
+ static String entryGetName(final Object entry)
{
return (entry instanceof Method)
? ((Method)entry).getName()
@@ -202,7 +202,7 @@
}
/** Utility function: obtain common data from either Method or
Constructor. (In lieu of an EntryPoint interface.) */
- static Class[] entryGetParameterTypes(Object entry)
+ static Class[] entryGetParameterTypes(final Object entry)
{
return (entry instanceof Method)
? ((Method)entry).getParameterTypes()
@@ -210,7 +210,7 @@
}
/** Utility function: obtain common data from either Method or
Constructor. (In lieu of an EntryPoint interface.) */
- static String entryToString(Object entry)
+ static String entryToString(final Object entry)
{
return (entry instanceof Method)
? ((Method)entry).toString()
@@ -228,7 +228,7 @@
@exception NoSuchMethodException if constructor not found.
*/
- static public Constructor getConstructor(Class targetClass, Class[] argTypes)
+ static public Constructor getConstructor(final Class targetClass, final Class[] argTypes)
throws SecurityException, NoSuchMethodException
{
return (Constructor) getEntryPoint(targetClass,null,argTypes,true);
@@ -257,10 +257,10 @@
* @exception SecurityException if security violation
* @exception NoSuchMethodException if no such method
*/
- static private Object getEntryPoint(Class targetClass,
- String methodName,
- Class[] argTypes,
- boolean isStaticReference)
+ static private Object getEntryPoint(final Class targetClass,
+ final String methodName,
+ final Class[] argTypes,
+ final boolean isStaticReference)
throws SecurityException, NoSuchMethodException
{
// 15.11.1: OBTAIN STARTING CLASS FOR SEARCH
@@ -289,7 +289,7 @@
return targetClass.getConstructor (argTypes);
}
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
// no-args has no alternatives!
if(argTypes==null || argTypes.length==0)
{
@@ -322,10 +322,10 @@
throw new NoSuchMethodException("No methods!");
}
- MoreSpecific best=new MoreSpecific();
+ final MoreSpecific best=new MoreSpecific();
for(int i=0;i<methods.length;++i)
{
- Object mi=methods[i];
+ final Object mi=methods[i];
if (
// 15.11.2.1 ACCESSIBLE: Method is public.
Modifier.isPublic(entryGetModifiers(mi))
@@ -386,8 +386,8 @@
appropriateness before returning the method; if the query is
being made via a static reference, only static methods will be
found and returned. */
- static public Method getMethod(Class target,String methodName,
- Class[] argTypes,boolean isStaticReference)
+ static public Method getMethod(final Class target,final String methodName,
+ final Class[] argTypes,final boolean isStaticReference)
throws SecurityException, NoSuchMethodException
{
return (Method)getEntryPoint(target,methodName,argTypes,isStaticReference);
@@ -414,11 +414,11 @@
* @exception SecurityException if security violation
* @exception NoSuchMethodException if no such method
*/
- static public Method getMethod(Object target,String methodName,
- Class[] argTypes)
+ static public Method getMethod(final Object target,final String methodName,
+ final Class[] argTypes)
throws SecurityException, NoSuchMethodException
{
- boolean staticRef=target instanceof Class;
+ final boolean staticRef=target instanceof Class;
return getMethod( staticRef ? (Class)target : target.getClass(),
methodName,argTypes,staticRef);
}
@@ -432,7 +432,7 @@
Legal ASSIGNMENT CONVERSIONS (5.2) are METHOD CONVERSIONS (5.3)
plus implicit narrowing of int to byte, short or char. */
- static private boolean isAssignmentConvertable(Class parm,Class arg)
+ static private boolean isAssignmentConvertable(final Class parm,final Class arg)
{
return
(arg.equals(Integer.TYPE) &&
@@ -512,7 +512,7 @@
return false;
}
- Class[] primTypes={ Character.TYPE, Byte.TYPE, Short.TYPE, Integer.TYPE,
+ final Class[] primTypes={ Character.TYPE, Byte.TYPE, Short.TYPE, Integer.TYPE,
Long.TYPE, Float.TYPE, Double.TYPE };
int parmscore,argscore;
diff --git a/src/main/java/org/apache/bsf/util/ObjInfo.java b/src/main/java/org/apache/bsf/util/ObjInfo.java
index 32bdf2c..0ffe320 100644
--- a/src/main/java/org/apache/bsf/util/ObjInfo.java
+++ b/src/main/java/org/apache/bsf/util/ObjInfo.java
@@ -30,14 +30,14 @@
public String objName;
public Class objClass;
- public ObjInfo(Class objClass, String objName)
+ public ObjInfo(final Class objClass, final String objName)
{
this.objClass = objClass;
this.objName = objName;
}
public boolean isExecutable()
{
- char[] chars = objName.toCharArray();
+ final char[] chars = objName.toCharArray();
char openingChar = ' ';
boolean inString = false,
inEscapeSequence = false;
diff --git a/src/main/java/org/apache/bsf/util/ObjectRegistry.java b/src/main/java/org/apache/bsf/util/ObjectRegistry.java
index de3a5c3..f1584fd 100644
--- a/src/main/java/org/apache/bsf/util/ObjectRegistry.java
+++ b/src/main/java/org/apache/bsf/util/ObjectRegistry.java
@@ -36,11 +36,11 @@
public ObjectRegistry () {
}
- public ObjectRegistry (ObjectRegistry parent) {
+ public ObjectRegistry (final ObjectRegistry parent) {
this.parent = parent;
}
// lookup an object: cascade up if needed
- public Object lookup (String name) throws IllegalArgumentException {
+ public Object lookup (final String name) throws IllegalArgumentException {
Object obj = reg.get (name);
if (obj == null && parent != null) {
@@ -54,11 +54,11 @@
return obj;
}
// register an object
- public void register (String name, Object obj) {
+ public void register (final String name, final Object obj) {
reg.put (name, obj);
}
// unregister an object (silent if unknown name)
- public void unregister (String name) {
+ public void unregister (final String name) {
reg.remove (name);
}
}
diff --git a/src/main/java/org/apache/bsf/util/ReflectionUtils.java b/src/main/java/org/apache/bsf/util/ReflectionUtils.java
index e72dded..2932dc1 100644
--- a/src/main/java/org/apache/bsf/util/ReflectionUtils.java
+++ b/src/main/java/org/apache/bsf/util/ReflectionUtils.java
@@ -88,16 +88,16 @@
* @exception InvocationTargetException if something goes wrong while
* running add event listener method
*/
- public static void addEventListener (Object source, String eventSetName,
- EventProcessor processor)
+ public static void addEventListener (final Object source, final String eventSetName,
+ final EventProcessor processor)
throws IntrospectionException, IllegalArgumentException,
IllegalAccessException, InstantiationException,
InvocationTargetException {
// find the event set descriptor for this event
- BeanInfo bi = Introspector.getBeanInfo (source.getClass ());
+ final BeanInfo bi = Introspector.getBeanInfo (source.getClass ());
- EventSetDescriptor arrESD[]=bi.getEventSetDescriptors ();
- EventSetDescriptor esd=(EventSetDescriptor) findFeatureByName ("event", eventSetName, arrESD);
+ final EventSetDescriptor arrESD[]=bi.getEventSetDescriptors ();
+ final EventSetDescriptor esd=(EventSetDescriptor) findFeatureByName ("event", eventSetName, arrESD);
if (esd == null) // no events found, maybe a proxy from OpenOffice.org?
{
@@ -112,21 +112,21 @@
errMsg=errMsg+"class defines the following event set(s): ";
// sort ESD by Name
- TreeSet ts=new TreeSet(new Comparator () {
- public int compare(Object o1, Object o2) {return ((EventSetDescriptor)o1).getName().compareToIgnoreCase(((EventSetDescriptor)o2).getName());}
- public boolean equals(Object o1, Object o2) {return ((EventSetDescriptor)o1).getName().equalsIgnoreCase (((EventSetDescriptor)o2).getName());}
+ final TreeSet ts=new TreeSet(new Comparator () {
+ public int compare(final Object o1, final Object o2) {return ((EventSetDescriptor)o1).getName().compareToIgnoreCase(((EventSetDescriptor)o2).getName());}
+ public boolean equals(final Object o1, final Object o2) {return ((EventSetDescriptor)o1).getName().equalsIgnoreCase (((EventSetDescriptor)o2).getName());}
});
for (int i=0;i<arrESD.length;i++)
{
ts.add(arrESD[i]);
}
- Iterator it=ts.iterator(); // get iterator
+ final Iterator it=ts.iterator(); // get iterator
int i=0;
while (it.hasNext()) // iterate in sorted order
{
- EventSetDescriptor tmpESD=(EventSetDescriptor) it.next();
+ final EventSetDescriptor tmpESD=(EventSetDescriptor) it.next();
if (i>0)
{
@@ -136,17 +136,17 @@
// iterate over listener methods and display their names in sorted order
- Method m[]=tmpESD.getListenerMethods();
- TreeSet tsM=new TreeSet(new Comparator () {
- public int compare(Object o1, Object o2) {return ((Method)o1).getName().compareToIgnoreCase(((Method)o2).getName());}
- public boolean equals(Object o1, Object o2) {return ((Method)o1).getName().equalsIgnoreCase (((Method)o2).getName());}
+ final Method m[]=tmpESD.getListenerMethods();
+ final TreeSet tsM=new TreeSet(new Comparator () {
+ public int compare(final Object o1, final Object o2) {return ((Method)o1).getName().compareToIgnoreCase(((Method)o2).getName());}
+ public boolean equals(final Object o1, final Object o2) {return ((Method)o1).getName().equalsIgnoreCase (((Method)o2).getName());}
});
for (int j=0;j<m.length;j++)
{
tsM.add(m[j]);
}
- Iterator itM=tsM.iterator();
+ final Iterator itM=tsM.iterator();
int j=0;
while (itM.hasNext())
@@ -168,10 +168,10 @@
}
// get the class object for the event
- Class listenerType=esd.getListenerType(); // get ListenerType class object from EventSetDescriptor
+ final Class listenerType=esd.getListenerType(); // get ListenerType class object from EventSetDescriptor
// find an event adapter class of the right type
- Class adapterClass = EventAdapterRegistry.lookup (listenerType);
+ final Class adapterClass = EventAdapterRegistry.lookup (listenerType);
if (adapterClass == null) {
throw new IllegalArgumentException ("event adapter for listener type " +
"'" + listenerType + "' (eventset " +
@@ -179,7 +179,7 @@
}
// create the event adapter and give it the event processor
- EventAdapter adapter = (EventAdapter) adapterClass.newInstance ();
+ final EventAdapter adapter = (EventAdapter) adapterClass.newInstance ();
adapter.setEventProcessor (processor);
// bind the adapter to the source bean
@@ -227,8 +227,8 @@
* @exception InvocationTargetException if constructor excepted
* @exception IOException if I/O error in beans.instantiate
*/
- public static Bean createBean (ClassLoader cld, String className,
- Class[] argTypes, Object[] args)
+ public static Bean createBean (final ClassLoader cld, final String className,
+ final Class[] argTypes, final Object[] args)
throws ClassNotFoundException, NoSuchMethodException,
InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException,
@@ -246,19 +246,19 @@
try { // CL passed as argument
cl=cld.loadClass(className);
}
- catch (ClassNotFoundException e02) {
+ catch (final ClassNotFoundException e02) {
exCTX=e02;
}
}
if (cl==null) {
// load context class loader, only use it, if not null
- ClassLoader tccl=Thread.currentThread().getContextClassLoader();
+ final ClassLoader tccl=Thread.currentThread().getContextClassLoader();
if (tccl!=null) {
try { // CTXCL
cl=tccl.loadClass(className);
}
- catch (ClassNotFoundException e01) {}
+ catch (final ClassNotFoundException e01) {}
}
}
@@ -273,11 +273,11 @@
}
// -----------------------------
- Constructor c = MethodUtils.getConstructor (cl, argTypes);
+ final Constructor c = MethodUtils.getConstructor (cl, argTypes);
return new Bean (cl, c.newInstance (args));
} else {
// create the bean with no args constructor
- Object obj = Beans.instantiate (cld, className);
+ final Object obj = Beans.instantiate (cld, className);
return new Bean (obj.getClass (), obj);
}
}
@@ -302,7 +302,7 @@
* @exception InvocationTargetException if constructor excepted
* @exception IOException if I/O error in beans.instantiate
*/
- public static Bean createBean (ClassLoader cld, String className, Object[] args)
+ public static Bean createBean (final ClassLoader cld, final String className, final Object[] args)
throws ClassNotFoundException, NoSuchMethodException,
InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException,
@@ -323,8 +323,8 @@
* null if not found.
*/
private static
- FeatureDescriptor findFeatureByName (String featureType, String name,
- FeatureDescriptor[] fds) {
+ FeatureDescriptor findFeatureByName (final String featureType, final String name,
+ final FeatureDescriptor[] fds) {
for (int i = 0; i < fds.length; i++) {
if (name.equals (fds[i].getName())) {
return fds[i];
@@ -334,21 +334,21 @@
}
- public static Bean getField (Object target, String fieldName)
+ public static Bean getField (final Object target, final String fieldName)
throws IllegalArgumentException, IllegalAccessException {
// This is to handle how we do static fields.
- Class targetClass = (target instanceof Class)
+ final Class targetClass = (target instanceof Class)
? (Class) target
: target.getClass ();
try {
- Field f = targetClass.getField (fieldName);
- Class fieldType = f.getType ();
+ final Field f = targetClass.getField (fieldName);
+ final Class fieldType = f.getType ();
// Get the value and return it.
- Object value = f.get (target);
+ final Object value = f.get (target);
return new Bean (fieldType, value);
- } catch (NoSuchFieldException e) {
+ } catch (final NoSuchFieldException e) {
throw new IllegalArgumentException ("field '" + fieldName + "' is " +
"unknown for '" + target + "'");
}
@@ -370,13 +370,13 @@
* @exception IllegalAccessException if read method is not accessible
* @exception InvocationTargetException if read method excepts
*/
- public static Bean getProperty (Object target, String propName,
- Integer index)
+ public static Bean getProperty (final Object target, final String propName,
+ final Integer index)
throws IntrospectionException, IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
// find the property descriptor
- BeanInfo bi = Introspector.getBeanInfo (target.getClass ());
- PropertyDescriptor pd = (PropertyDescriptor)
+ final BeanInfo bi = Introspector.getBeanInfo (target.getClass ());
+ final PropertyDescriptor pd = (PropertyDescriptor)
findFeatureByName ("property", propName, bi.getPropertyDescriptors ());
if (pd == null) {
throw new IllegalArgumentException ("property '" + propName + "' is " +
@@ -393,7 +393,7 @@
"property '" + propName +
"' as being indexed");
}
- IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+ final IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
rm = ipd.getIndexedReadMethod ();
propType = ipd.getIndexedPropertyType ();
} else {
@@ -415,17 +415,17 @@
}
return new Bean (propType, propVal);
}
- public static void setField (Object target, String fieldName, Bean value,
- TypeConvertorRegistry tcr)
+ public static void setField (final Object target, final String fieldName, final Bean value,
+ final TypeConvertorRegistry tcr)
throws IllegalArgumentException, IllegalAccessException {
// This is to handle how we do static fields.
- Class targetClass = (target instanceof Class)
+ final Class targetClass = (target instanceof Class)
? (Class) target
: target.getClass ();
try {
- Field f = targetClass.getField (fieldName);
- Class fieldType = f.getType ();
+ final Field f = targetClass.getField (fieldName);
+ final Class fieldType = f.getType ();
// type convert the value if necessary
Object fieldVal = null;
@@ -433,7 +433,7 @@
if (fieldType.isAssignableFrom (value.type)) {
fieldVal = value.value;
} else if (tcr != null) {
- TypeConvertor cvtor = tcr.lookup (value.type, fieldType);
+ final TypeConvertor cvtor = tcr.lookup (value.type, fieldType);
if (cvtor != null) {
fieldVal = cvtor.convert (value.type, fieldType, value.value);
} else {
@@ -449,7 +449,7 @@
// now set the value
f.set (target, fieldVal);
- } catch (NoSuchFieldException e) {
+ } catch (final NoSuchFieldException e) {
throw new IllegalArgumentException ("field '" + fieldName + "' is " +
"unknown for '" + target + "'");
}
@@ -475,14 +475,14 @@
* @exception IllegalAccessException if write method is not accessible
* @exception InvocationTargetException if write method excepts
*/
- public static void setProperty (Object target, String propName,
- Integer index, Object value,
- Class valueType, TypeConvertorRegistry tcr)
+ public static void setProperty (final Object target, final String propName,
+ final Integer index, final Object value,
+ final Class valueType, final TypeConvertorRegistry tcr)
throws IntrospectionException, IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
// find the property descriptor
- BeanInfo bi = Introspector.getBeanInfo (target.getClass ());
- PropertyDescriptor pd = (PropertyDescriptor)
+ final BeanInfo bi = Introspector.getBeanInfo (target.getClass ());
+ final PropertyDescriptor pd = (PropertyDescriptor)
findFeatureByName ("property", propName, bi.getPropertyDescriptors ());
if (pd == null) {
throw new IllegalArgumentException ("property '" + propName + "' is " +
@@ -499,7 +499,7 @@
"property '" + propName +
"' as being indexed");
}
- IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+ final IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
wm = ipd.getIndexedWriteMethod ();
propType = ipd.getIndexedPropertyType ();
} else {
@@ -518,7 +518,7 @@
if (propType.isAssignableFrom (valueType)) {
propVal = value;
} else if (tcr != null) {
- TypeConvertor cvtor = tcr.lookup (valueType, propType);
+ final TypeConvertor cvtor = tcr.lookup (valueType, propType);
if (cvtor != null) {
propVal = cvtor.convert (valueType, propType, value);
} else {
diff --git a/src/main/java/org/apache/bsf/util/ScriptSymbolTable.java b/src/main/java/org/apache/bsf/util/ScriptSymbolTable.java
index 30ca5c4..24ec8e7 100644
--- a/src/main/java/org/apache/bsf/util/ScriptSymbolTable.java
+++ b/src/main/java/org/apache/bsf/util/ScriptSymbolTable.java
@@ -27,13 +27,13 @@
*/
class ScriptSymbolTable extends Hashtable
{
- private Hashtable parentTable;
+ private final Hashtable parentTable;
- ScriptSymbolTable(Hashtable parentTable)
+ ScriptSymbolTable(final Hashtable parentTable)
{
this.parentTable = parentTable;
}
- public synchronized Object get(Object key)
+ public synchronized Object get(final Object key)
{
Object ret = super.get(key);
diff --git a/src/main/java/org/apache/bsf/util/StringUtils.java b/src/main/java/org/apache/bsf/util/StringUtils.java
index a4126da..04b9035 100644
--- a/src/main/java/org/apache/bsf/util/StringUtils.java
+++ b/src/main/java/org/apache/bsf/util/StringUtils.java
@@ -53,7 +53,7 @@
arrayDim++;
}
- int iLastPeriod = className.lastIndexOf('.');
+ final int iLastPeriod = className.lastIndexOf('.');
String varName = Introspector.decapitalize(
iLastPeriod != -1
? className.substring(iLastPeriod + 1)
@@ -67,14 +67,14 @@
return getValidIdentifierName(varName);
}
// Ensure that escape sequences are passed through properly.
- public static String cleanString(String str)
+ public static String cleanString(final String str)
{
if (str == null) {
return null;
} else
{
- char[] charArray = str.toCharArray();
- StringBuffer sBuf = new StringBuffer();
+ final char[] charArray = str.toCharArray();
+ final StringBuffer sBuf = new StringBuffer();
for (int i = 0; i < charArray.length; i++) {
switch (charArray[i])
@@ -100,13 +100,13 @@
*
* @return a string consisting of <code>numberOfChars</code> theChars.
*/
- public static String getChars(int numberOfChars, char theChar)
+ public static String getChars(final int numberOfChars, final char theChar)
{
if (numberOfChars <= 0) {
return "";
}
- StringBuffer sRet = new StringBuffer(numberOfChars);
+ final StringBuffer sRet = new StringBuffer(numberOfChars);
for (int i = 0; i < numberOfChars; i++) {
sRet.append(theChar);
@@ -125,15 +125,15 @@
grammar is defined in section 4.3 of the Java VM Spec). This method will
parse the Descriptor if necessary.
*/
- public static String getClassName(Class targetClass)
+ public static String getClassName(final Class targetClass)
{
- String className = targetClass.getName();
+ final String className = targetClass.getName();
return targetClass.isArray() ? parseDescriptor(className) : className;
}
- public static String getCommaListFromVector(Vector sourceVector)
+ public static String getCommaListFromVector(final Vector sourceVector)
{
- StringBuffer strBuf = new StringBuffer();
+ final StringBuffer strBuf = new StringBuffer();
for (int i = 0; i < sourceVector.size(); i++)
{
@@ -147,7 +147,7 @@
Returns a Reader for reading from the specified resource, if the resource
points to a stream.
*/
- public static Reader getContentAsReader(URL url) throws SecurityException,
+ public static Reader getContentAsReader(final URL url) throws SecurityException,
IllegalArgumentException,
IOException
{
@@ -158,7 +158,7 @@
try
{
- Object content = url.getContent();
+ final Object content = url.getContent();
if (content == null)
{
@@ -167,7 +167,7 @@
if (content instanceof InputStream)
{
- Reader in = new InputStreamReader((InputStream)content);
+ final Reader in = new InputStreamReader((InputStream)content);
if (in.ready())
{
@@ -186,11 +186,11 @@
StringUtils.getClassName(content.getClass()));
}
}
- catch (SecurityException e)
+ catch (final SecurityException e)
{
throw new SecurityException("Your JVM's SecurityManager has disallowed this.");
}
- catch (FileNotFoundException e)
+ catch (final FileNotFoundException e)
{
throw new FileNotFoundException("This file was not found: " + url);
}
@@ -198,17 +198,17 @@
/*
Shorthand for: IOUtils.getStringFromReader(getContentAsReader(url)).
*/
- public static String getContentAsString(URL url) throws SecurityException,
+ public static String getContentAsString(final URL url) throws SecurityException,
IllegalArgumentException,
IOException
{
return IOUtils.getStringFromReader(getContentAsReader(url));
}
// Handles multi-line strings.
- public static String getSafeString(String scriptStr)
+ public static String getSafeString(final String scriptStr)
{
- BufferedReader in = new BufferedReader(new StringReader(scriptStr));
- StringBuffer strBuf = new StringBuffer();
+ final BufferedReader in = new BufferedReader(new StringReader(scriptStr));
+ final StringBuffer strBuf = new StringBuffer();
String tempLine,
previousLine = null;
@@ -225,7 +225,7 @@
previousLine = cleanString(tempLine);
}
}
- catch (IOException e)
+ catch (final IOException e)
{
}
@@ -236,7 +236,7 @@
}
/*
*/
- public static URL getURL(URL contextURL, String spec) throws MalformedURLException
+ public static URL getURL(final URL contextURL, final String spec) throws MalformedURLException
{
return getURL(contextURL, spec, 1);
}
@@ -244,7 +244,7 @@
The recursiveDepth argument is used to insure that the algorithm gives up
after hunting 2 levels up in the contextURL's path.
*/
- private static URL getURL(URL contextURL, String spec, int recursiveDepth)
+ private static URL getURL(final URL contextURL, final String spec, final int recursiveDepth)
throws MalformedURLException
{
URL url = null;
@@ -257,12 +257,12 @@
{
url.openStream();
}
- catch (IOException ioe1)
+ catch (final IOException ioe1)
{
throw new MalformedURLException("This file was not found: " + url);
}
}
- catch (MalformedURLException e1)
+ catch (final MalformedURLException e1)
{
url = new URL("file", "", spec);
@@ -270,12 +270,12 @@
{
url.openStream();
}
- catch (IOException ioe2)
+ catch (final IOException ioe2)
{
if (contextURL != null)
{
- String contextFileName = contextURL.getFile();
- String parentName = new File(contextFileName).getParent();
+ final String contextFileName = contextURL.getFile();
+ final String parentName = new File(contextFileName).getParent();
if (parentName != null && recursiveDepth < 3)
{
@@ -291,15 +291,15 @@
return url;
}
- public static String getValidIdentifierName(String identifierName)
+ public static String getValidIdentifierName(final String identifierName)
{
if (identifierName == null || identifierName.length() == 0) {
return null;
}
- StringBuffer strBuf = new StringBuffer();
+ final StringBuffer strBuf = new StringBuffer();
- char[] chars = identifierName.toCharArray();
+ final char[] chars = identifierName.toCharArray();
strBuf.append(Character.isJavaIdentifierStart(chars[0])
? chars[0]
@@ -316,13 +316,13 @@
return strBuf.toString();
}
- public static boolean isValidIdentifierName(String identifierName)
+ public static boolean isValidIdentifierName(final String identifierName)
{
if (identifierName == null || identifierName.length() == 0) {
return false;
}
- char[] chars = identifierName.toCharArray();
+ final char[] chars = identifierName.toCharArray();
if (!Character.isJavaIdentifierStart(chars[0])) {
return false;
@@ -336,7 +336,7 @@
return true;
}
- public static boolean isValidPackageName(String packageName)
+ public static boolean isValidPackageName(final String packageName)
{
if (packageName == null) {
return false;
@@ -345,7 +345,7 @@
return true;
}
- StringTokenizer strTok = new StringTokenizer(packageName, ".", true);
+ final StringTokenizer strTok = new StringTokenizer(packageName, ".", true);
// Should have an odd number of tokens (including '.' delimiters).
if (strTok.countTokens() % 2 != 1) {
@@ -381,9 +381,9 @@
/*
See the comment above for getClassName(targetClass)...
*/
- private static String parseDescriptor(String className)
+ private static String parseDescriptor(final String className)
{
- char[] classNameChars = className.toCharArray();
+ final char[] classNameChars = className.toCharArray();
int arrayDim = 0;
int i = 0;
@@ -393,7 +393,7 @@
i++;
}
- StringBuffer classNameBuf = new StringBuffer();
+ final StringBuffer classNameBuf = new StringBuffer();
switch (classNameChars[i++])
{
diff --git a/src/main/java/org/apache/bsf/util/cf/CFDriver.java b/src/main/java/org/apache/bsf/util/cf/CFDriver.java
index cddaffd..f8252f6 100644
--- a/src/main/java/org/apache/bsf/util/cf/CFDriver.java
+++ b/src/main/java/org/apache/bsf/util/cf/CFDriver.java
@@ -66,7 +66,7 @@
* [-sdelim group] default: ,
*</pre></code>
*/
- public static void main(String[] argv)
+ public static void main(final String[] argv)
{
if (argv.length % 2 == 0)
{
@@ -78,7 +78,7 @@
sDelim = null;
Reader in = null;
Writer out = null;
- CodeFormatter cf = new CodeFormatter();
+ final CodeFormatter cf = new CodeFormatter();
for (int i = 0; i < argv.length; i += 2)
{
@@ -103,7 +103,7 @@
{
in = new FileReader(inFile);
}
- catch (FileNotFoundException e)
+ catch (final FileNotFoundException e)
{
printError("Cannot open input file: " + inFile);
@@ -121,7 +121,7 @@
{
out = new FileWriter(outFile);
}
- catch (IOException e)
+ catch (final IOException e)
{
printError("Cannot open output file: " + outFile);
@@ -139,7 +139,7 @@
{
cf.setMaxLineLength(Integer.parseInt(maxLine));
}
- catch (NumberFormatException nfe)
+ catch (final NumberFormatException nfe)
{
printError("Not a valid integer: " + maxLine);
@@ -153,7 +153,7 @@
{
cf.setIndentationStep(Integer.parseInt(indStep));
}
- catch (NumberFormatException nfe)
+ catch (final NumberFormatException nfe)
{
printError("Not a valid integer: " + indStep);
@@ -174,7 +174,7 @@
printHelp();
}
}
- private static void printError(String errMsg)
+ private static void printError(final String errMsg)
{
System.err.println("ERROR: " + errMsg);
}
diff --git a/src/main/java/org/apache/bsf/util/cf/CodeFormatter.java b/src/main/java/org/apache/bsf/util/cf/CodeFormatter.java
index f025c33..8709963 100644
--- a/src/main/java/org/apache/bsf/util/cf/CodeFormatter.java
+++ b/src/main/java/org/apache/bsf/util/cf/CodeFormatter.java
@@ -69,10 +69,10 @@
private int origIndent;
private boolean inCPP_Comment;
- private void addTok(StringBuffer targetBuf, StringBuffer tokBuf,
- IndentWriter out)
+ private void addTok(final StringBuffer targetBuf, final StringBuffer tokBuf,
+ final IndentWriter out)
{
- int tokLength = tokBuf.length(),
+ final int tokLength = tokBuf.length(),
targetLength = targetBuf.length();
if (indent + targetLength + tokLength > maxLineLength)
@@ -102,11 +102,11 @@
* @param source where to read the unformatted code from.
* @param target where to write the formatted code to.
*/
- public void formatCode(Reader source, Writer target)
+ public void formatCode(final Reader source, final Writer target)
{
String line;
- BufferedReader in = new BufferedReader(source);
- IndentWriter out = new IndentWriter(new BufferedWriter(target), true);
+ final BufferedReader in = new BufferedReader(source);
+ final IndentWriter out = new IndentWriter(new BufferedWriter(target), true);
try
{
@@ -127,7 +127,7 @@
}
}
}
- catch (IOException e)
+ catch (final IOException e)
{
e.printStackTrace();
}
@@ -172,14 +172,14 @@
{
return stickyDelimiters;
}
- private void printLine(String line, IndentWriter out)
+ private void printLine(final String line, final IndentWriter out)
{
- char[] source = line.toCharArray();
+ final char[] source = line.toCharArray();
char ch;
char quoteChar = ' ';
boolean inEscapeSequence = false;
boolean inString = false;
- StringBuffer tokBuf = new StringBuffer(),
+ final StringBuffer tokBuf = new StringBuffer(),
targetBuf = new StringBuffer(hangingIndent + line.length());
for (int i = 0; i < source.length; i++)
@@ -241,7 +241,7 @@
if (i > 0 && source[i - 1] == '/')
{
- String tokStr = tokBuf.append(source,
+ final String tokStr = tokBuf.append(source,
i + 1,
source.length - (i + 1)).toString();
@@ -309,7 +309,7 @@
addTok(targetBuf, tokBuf, out);
}
- String lastLine = targetBuf.toString().trim();
+ final String lastLine = targetBuf.toString().trim();
if (lastLine.length() > 0) {
out.println(indent, lastLine);
@@ -327,7 +327,7 @@
* @param newDelimiters the new set of delimiters.
* @see #getDelimiters
*/
- public void setDelimiters(String newDelimiters)
+ public void setDelimiters(final String newDelimiters)
{
delimiters = newDelimiters;
}
@@ -339,7 +339,7 @@
* @param newIndentationStep the new size of the indentation step.
* @see #getIndentationStep
*/
- public void setIndentationStep(int newIndentationStep)
+ public void setIndentationStep(final int newIndentationStep)
{
indentationStep = (newIndentationStep < 0 ? 0 : newIndentationStep);
}
@@ -354,7 +354,7 @@
* @param newMaxLineLength the new maximum line length.
* @see #getMaxLineLength
*/
- public void setMaxLineLength(int newMaxLineLength)
+ public void setMaxLineLength(final int newMaxLineLength)
{
maxLineLength = (newMaxLineLength < 0 ? 0 : newMaxLineLength);
}
@@ -370,7 +370,7 @@
* @param newStickyDelimiters the new set of sticky delimiters.
* @see #getStickyDelimiters
*/
- public void setStickyDelimiters(String newStickyDelimiters)
+ public void setStickyDelimiters(final String newStickyDelimiters)
{
stickyDelimiters = newStickyDelimiters;
}
diff --git a/src/main/java/org/apache/bsf/util/event/EventAdapterImpl.java b/src/main/java/org/apache/bsf/util/event/EventAdapterImpl.java
index e3f71b7..8037a20 100644
--- a/src/main/java/org/apache/bsf/util/event/EventAdapterImpl.java
+++ b/src/main/java/org/apache/bsf/util/event/EventAdapterImpl.java
@@ -30,7 +30,7 @@
public class EventAdapterImpl implements EventAdapter {
protected EventProcessor eventProcessor;
- public void setEventProcessor (EventProcessor eventProcessor) {
+ public void setEventProcessor (final EventProcessor eventProcessor) {
this.eventProcessor = eventProcessor;
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/EventAdapterRegistry.java b/src/main/java/org/apache/bsf/util/event/EventAdapterRegistry.java
index 28d8cd4..8f4a45e 100644
--- a/src/main/java/org/apache/bsf/util/event/EventAdapterRegistry.java
+++ b/src/main/java/org/apache/bsf/util/event/EventAdapterRegistry.java
@@ -63,22 +63,22 @@
private static String adapterSuffix = "Adapter";
private static boolean dynamic = true;
- public static Class lookup (Class listenerType) {
- String key = listenerType.getName().replace ('.', '_');
+ public static Class lookup (final Class listenerType) {
+ final String key = listenerType.getName().replace ('.', '_');
Class adapterClass = (Class) reg.get (key);
if (adapterClass == null) {
- String en = key.substring (0, key.lastIndexOf ("Listener"));
- String cn = adapterPackage + "." + en + adapterSuffix;
+ final String en = key.substring (0, key.lastIndexOf ("Listener"));
+ final String cn = adapterPackage + "." + en + adapterSuffix;
if (adapterClass==null) { // get Thread's context class loader
- ClassLoader tccl=Thread.currentThread().getContextClassLoader();
+ final ClassLoader tccl=Thread.currentThread().getContextClassLoader();
if (tccl!=null)
{
try { // try supplied class loader
adapterClass=Thread.currentThread().getContextClassLoader().loadClass(cn);
}
- catch (ClassNotFoundException e02) {}
+ catch (final ClassNotFoundException e02) {}
}
}
@@ -87,16 +87,16 @@
adapterClass=cl.loadClass(cn);
}
}
- catch (ClassNotFoundException e01) {}
+ catch (final ClassNotFoundException e01) {}
if (adapterClass==null) { // Defined CL
try { // try supplied class loader
- ClassLoader defCL=BSFManager.getDefinedClassLoader();
+ final ClassLoader defCL=BSFManager.getDefinedClassLoader();
if (cl != defCL) {
adapterClass=defCL.loadClass(cn);
}
}
- catch (ClassNotFoundException e03) {}
+ catch (final ClassNotFoundException e03) {}
}
if (adapterClass==null && dynamic) {
@@ -113,14 +113,14 @@
return adapterClass;
}
- public static void register (Class listenerType, Class eventAdapterClass) {
- String key = listenerType.getName().replace('.', '_');
+ public static void register (final Class listenerType, final Class eventAdapterClass) {
+ final String key = listenerType.getName().replace('.', '_');
reg.put (key, eventAdapterClass);
}
/**
* Class loader to use to load event adapter classes.
*/
- public static void setClassLoader (ClassLoader cloader) {
+ public static void setClassLoader (final ClassLoader cloader) {
cl = cloader;
}
/**
@@ -133,7 +133,7 @@
*
* @param dynamic whether or not to dynamically generate adapters.
*/
- public static void setDynamic (boolean dynamic) {
+ public static void setDynamic (final boolean dynamic) {
EventAdapterRegistry.dynamic = dynamic;
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ActionAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ActionAdapter.java
index 7ebc458..414d4c6 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ActionAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ActionAdapter.java
@@ -25,7 +25,7 @@
public class java_awt_event_ActionAdapter extends EventAdapterImpl
implements ActionListener {
- public void actionPerformed (ActionEvent e) {
+ public void actionPerformed (final ActionEvent e) {
eventProcessor.processEvent ("actionPerformed", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_AdjustmentAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_AdjustmentAdapter.java
index 3b46b2e..7330d0f 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_AdjustmentAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_AdjustmentAdapter.java
@@ -25,7 +25,7 @@
public class java_awt_event_AdjustmentAdapter extends EventAdapterImpl
implements AdjustmentListener {
- public void adjustmentValueChanged (AdjustmentEvent e) {
+ public void adjustmentValueChanged (final AdjustmentEvent e) {
eventProcessor.processEvent ("adjustmentValueChanged", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ComponentAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ComponentAdapter.java
index 3e49411..2b659e4 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ComponentAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ComponentAdapter.java
@@ -25,16 +25,16 @@
public class java_awt_event_ComponentAdapter extends EventAdapterImpl
implements ComponentListener {
- public void componentHidden (ComponentEvent e) {
+ public void componentHidden (final ComponentEvent e) {
eventProcessor.processEvent ("componentHidden", new Object[]{e});
}
- public void componentMoved (ComponentEvent e) {
+ public void componentMoved (final ComponentEvent e) {
eventProcessor.processEvent ("componentMoved", new Object[]{e});
}
- public void componentResized (ComponentEvent e) {
+ public void componentResized (final ComponentEvent e) {
eventProcessor.processEvent ("componentResized", new Object[]{e});
}
- public void componentShown (ComponentEvent e) {
+ public void componentShown (final ComponentEvent e) {
eventProcessor.processEvent ("componentShown", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ContainerAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ContainerAdapter.java
index 1f3bef4..8863278 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ContainerAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ContainerAdapter.java
@@ -25,10 +25,10 @@
public class java_awt_event_ContainerAdapter extends EventAdapterImpl
implements ContainerListener {
- public void componentAdded (ContainerEvent e) {
+ public void componentAdded (final ContainerEvent e) {
eventProcessor.processEvent ("componentAdded", new Object[]{e});
}
- public void componentRemoved (ContainerEvent e) {
+ public void componentRemoved (final ContainerEvent e) {
eventProcessor.processEvent ("componentRemoved", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_FocusAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_FocusAdapter.java
index 3c17c01..ce356dd 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_FocusAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_FocusAdapter.java
@@ -25,10 +25,10 @@
public class java_awt_event_FocusAdapter extends EventAdapterImpl
implements FocusListener {
- public void focusGained (FocusEvent e) {
+ public void focusGained (final FocusEvent e) {
eventProcessor.processEvent ("focusGained", new Object[]{e});
}
- public void focusLost (FocusEvent e) {
+ public void focusLost (final FocusEvent e) {
eventProcessor.processEvent ("focusLost", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ItemAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ItemAdapter.java
index 6589957..269d8c1 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ItemAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_ItemAdapter.java
@@ -25,7 +25,7 @@
public class java_awt_event_ItemAdapter extends EventAdapterImpl
implements ItemListener {
- public void itemStateChanged (ItemEvent e) {
+ public void itemStateChanged (final ItemEvent e) {
eventProcessor.processEvent ("itemStateChanged", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_KeyAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_KeyAdapter.java
index 8dc7f33..b20081f 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_KeyAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_KeyAdapter.java
@@ -25,13 +25,13 @@
public class java_awt_event_KeyAdapter extends EventAdapterImpl
implements KeyListener {
- public void keyPressed (KeyEvent e) {
+ public void keyPressed (final KeyEvent e) {
eventProcessor.processEvent ("keyPressed", new Object[]{e});
}
- public void keyReleased (KeyEvent e) {
+ public void keyReleased (final KeyEvent e) {
eventProcessor.processEvent ("keyReleased", new Object[]{e});
}
- public void keyTyped (KeyEvent e) {
+ public void keyTyped (final KeyEvent e) {
eventProcessor.processEvent ("keyTyped", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_MouseAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_MouseAdapter.java
index d4f2671..689995a 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_MouseAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_MouseAdapter.java
@@ -25,19 +25,19 @@
public class java_awt_event_MouseAdapter extends EventAdapterImpl
implements MouseListener {
- public void mouseClicked (MouseEvent e) {
+ public void mouseClicked (final MouseEvent e) {
eventProcessor.processEvent ("mouseClicked", new Object[]{e});
}
- public void mouseEntered (MouseEvent e) {
+ public void mouseEntered (final MouseEvent e) {
eventProcessor.processEvent ("mouseEntered", new Object[]{e});
}
- public void mouseExited (MouseEvent e) {
+ public void mouseExited (final MouseEvent e) {
eventProcessor.processEvent ("mouseExited", new Object[]{e});
}
- public void mousePressed (MouseEvent e) {
+ public void mousePressed (final MouseEvent e) {
eventProcessor.processEvent ("mousePressed", new Object[]{e});
}
- public void mouseReleased (MouseEvent e) {
+ public void mouseReleased (final MouseEvent e) {
eventProcessor.processEvent ("mouseReleased", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_MouseMotionAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_MouseMotionAdapter.java
index 8810051..d29c431 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_MouseMotionAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_MouseMotionAdapter.java
@@ -25,10 +25,10 @@
public class java_awt_event_MouseMotionAdapter extends EventAdapterImpl
implements MouseMotionListener {
- public void mouseDragged(MouseEvent e) {
+ public void mouseDragged(final MouseEvent e) {
eventProcessor.processEvent ("mouseDragged", new Object[]{e});
}
- public void mouseMoved(MouseEvent e) {
+ public void mouseMoved(final MouseEvent e) {
eventProcessor.processEvent ("mouseMoved", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_TextAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_TextAdapter.java
index 34f0caa..15c7611 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_TextAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_TextAdapter.java
@@ -25,7 +25,7 @@
public class java_awt_event_TextAdapter extends EventAdapterImpl
implements TextListener {
- public void textValueChanged (TextEvent e) {
+ public void textValueChanged (final TextEvent e) {
eventProcessor.processEvent ("textValueChanged", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_WindowAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_WindowAdapter.java
index cee4a73..03a771c 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_WindowAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_awt_event_WindowAdapter.java
@@ -25,25 +25,25 @@
public class java_awt_event_WindowAdapter extends EventAdapterImpl
implements WindowListener {
- public void windowActivated (WindowEvent e) {
+ public void windowActivated (final WindowEvent e) {
eventProcessor.processEvent ("windowActivated", new Object[]{e});
}
- public void windowClosed (WindowEvent e) {
+ public void windowClosed (final WindowEvent e) {
eventProcessor.processEvent ("windowClosed", new Object[]{e});
}
- public void windowClosing (WindowEvent e) {
+ public void windowClosing (final WindowEvent e) {
eventProcessor.processEvent ("windowClosing", new Object[]{e});
}
- public void windowDeactivated (WindowEvent e) {
+ public void windowDeactivated (final WindowEvent e) {
eventProcessor.processEvent ("windowDeactivated", new Object[]{e});
}
- public void windowDeiconified (WindowEvent e) {
+ public void windowDeiconified (final WindowEvent e) {
eventProcessor.processEvent ("windowDeiconified", new Object[]{e});
}
- public void windowIconified (WindowEvent e) {
+ public void windowIconified (final WindowEvent e) {
eventProcessor.processEvent ("windowIconified", new Object[]{e});
}
- public void windowOpened (WindowEvent e) {
+ public void windowOpened (final WindowEvent e) {
eventProcessor.processEvent ("windowOpened", new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_beans_PropertyChangeAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_beans_PropertyChangeAdapter.java
index 63e8595..c5ff9ce 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_beans_PropertyChangeAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_beans_PropertyChangeAdapter.java
@@ -25,7 +25,7 @@
public class java_beans_PropertyChangeAdapter extends EventAdapterImpl
implements PropertyChangeListener {
- public void propertyChange(PropertyChangeEvent e) {
+ public void propertyChange(final PropertyChangeEvent e) {
eventProcessor.processEvent (e.getPropertyName(), new Object[]{e});
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/adapters/java_beans_VetoableChangeAdapter.java b/src/main/java/org/apache/bsf/util/event/adapters/java_beans_VetoableChangeAdapter.java
index 799d01a..c0d46c0 100644
--- a/src/main/java/org/apache/bsf/util/event/adapters/java_beans_VetoableChangeAdapter.java
+++ b/src/main/java/org/apache/bsf/util/event/adapters/java_beans_VetoableChangeAdapter.java
@@ -26,16 +26,16 @@
public class java_beans_VetoableChangeAdapter extends EventAdapterImpl
implements VetoableChangeListener {
- public void vetoableChange (PropertyChangeEvent e) throws PropertyVetoException {
+ public void vetoableChange (final PropertyChangeEvent e) throws PropertyVetoException {
try
{
eventProcessor.processExceptionableEvent (e.getPropertyName(), new Object[]{e});
}
- catch (PropertyVetoException ex)
+ catch (final PropertyVetoException ex)
{
throw ex;
}
- catch (Exception ex)
+ catch (final Exception ex)
{
}
}
diff --git a/src/main/java/org/apache/bsf/util/event/generator/AdapterClassLoader.java b/src/main/java/org/apache/bsf/util/event/generator/AdapterClassLoader.java
index 1d6a809..a859ccf 100644
--- a/src/main/java/org/apache/bsf/util/event/generator/AdapterClassLoader.java
+++ b/src/main/java/org/apache/bsf/util/event/generator/AdapterClassLoader.java
@@ -46,7 +46,7 @@
logger = BSF_LogFactory.getLog(this.getClass().getName());
}
- public synchronized Class defineClass(String name, byte[] b)
+ public synchronized Class defineClass(final String name, final byte[] b)
{
if ((c = getLoadedClass(name)) == null)
{
@@ -56,18 +56,18 @@
{
c = defineClass(tmpName, b, 0, b.length); // rgf, 2006-02-03
}
- catch (NoClassDefFoundError e) // note "Error": Java thread would be killed otherwise!
+ catch (final NoClassDefFoundError e) // note "Error": Java thread would be killed otherwise!
{
// now try the Thread's current context class loader, but don't cache it
- ClassLoader tccl=Thread.currentThread().getContextClassLoader();
+ final ClassLoader tccl=Thread.currentThread().getContextClassLoader();
if (tccl!=null)
{
try
{
- LocalThreadClassLoader ltcl=new LocalThreadClassLoader(tccl);
+ final LocalThreadClassLoader ltcl=new LocalThreadClassLoader(tccl);
return ltcl.defineClass(tmpName,b);
}
- catch (NoClassDefFoundError e1) // (NoClassDefFoundError e1)
+ catch (final NoClassDefFoundError e1) // (NoClassDefFoundError e1)
{
logger.error("AdapterClassLoader: NoClassDefFoundError ERROR for class ["+tmpName+"]!");
throw e1; // rethrow error
@@ -91,17 +91,17 @@
return c;
}
- final protected Class findClass(String name)
+ final protected Class findClass(final String name)
{
return get(name);
}
- final protected Class get(String name)
+ final protected Class get(final String name)
{
return (Class)classCache.get(name);
}
- public synchronized Class getLoadedClass(String name)
+ public synchronized Class getLoadedClass(final String name)
{
Class c = findLoadedClass(name);
@@ -111,7 +111,7 @@
{
c = findSystemClass(name);
}
- catch (ClassNotFoundException e)
+ catch (final ClassNotFoundException e)
{
}
}
@@ -124,7 +124,7 @@
// rgf, 2008-07-04
if (c==null) // not found so far, try to use the current Thread's context class loader instead
{
- LocalThreadClassLoader ltcl=new LocalThreadClassLoader(Thread.currentThread().getContextClassLoader());
+ final LocalThreadClassLoader ltcl=new LocalThreadClassLoader(Thread.currentThread().getContextClassLoader());
c = ltcl.findLoadedClass(name,'0');
@@ -134,13 +134,13 @@
{
c = ltcl.findSystemClass(name,'0');
}
- catch (ClassNotFoundException e)
+ catch (final ClassNotFoundException e)
{
try
{
c = ltcl.findClass(name,'0');
}
- catch (ClassNotFoundException e1)
+ catch (final ClassNotFoundException e1)
{}
}
}
@@ -149,10 +149,10 @@
return c;
}
- protected synchronized Class loadClass(String name, boolean resolve)
+ protected synchronized Class loadClass(final String name, final boolean resolve)
throws ClassNotFoundException
{
- Class c = getLoadedClass(name);
+ final Class c = getLoadedClass(name);
if (c != null && resolve)
{
@@ -162,7 +162,7 @@
return c;
}
- final protected void put(String name, Class c)
+ final protected void put(final String name, final Class c)
{
classCache.put(name, c);
}
@@ -172,30 +172,30 @@
class LocalThreadClassLoader extends ClassLoader
{
// public LocalThreadClassLoader(){super (Thread.currentThread().getContextClassLoader());};
- public LocalThreadClassLoader (ClassLoader cl)
+ public LocalThreadClassLoader (final ClassLoader cl)
{
super (cl);
}
- public Class defineClass(String name, byte[] b)
+ public Class defineClass(final String name, final byte[] b)
{
return defineClass(name, b, 0, b.length); // protected in ClassLoader, hence invoking it this way
}
// use a signature that allows invoking super's protected method via inheritance resolution
- Class findLoadedClass(String name, char nixi)
+ Class findLoadedClass(final String name, final char nixi)
{
return findLoadedClass(name);
}
// use a signature that allows invoking super's protected method via inheritance resolution
- Class findClass(String name, char nixi) throws ClassNotFoundException
+ Class findClass(final String name, final char nixi) throws ClassNotFoundException
{
return findClass(name);
}
// use a signature that allows invoking super's protected method via inheritance resolution
- Class findSystemClass(String name, char nixi) throws ClassNotFoundException
+ Class findSystemClass(final String name, final char nixi) throws ClassNotFoundException
{
return findSystemClass(name);
}
diff --git a/src/main/java/org/apache/bsf/util/event/generator/ByteUtility.java b/src/main/java/org/apache/bsf/util/event/generator/ByteUtility.java
index a9143da..a18b8fb 100644
--- a/src/main/java/org/apache/bsf/util/event/generator/ByteUtility.java
+++ b/src/main/java/org/apache/bsf/util/event/generator/ByteUtility.java
@@ -28,11 +28,11 @@
*/
public class ByteUtility
{
- public static byte[] addBytes(byte[] array,byte[] value)
+ public static byte[] addBytes(byte[] array,final byte[] value)
{
if( null != array )
{
- byte newarray[] = new byte[array.length + value.length];
+ final byte newarray[] = new byte[array.length + value.length];
System.arraycopy(array,0,newarray,0,array.length);
System.arraycopy(value,0,newarray,array.length,value.length);
array = newarray;
@@ -43,11 +43,11 @@
}
return array;
}
- public static byte[] addBytes(byte[] array, byte value)
+ public static byte[] addBytes(byte[] array, final byte value)
{
if( null != array )
{
- byte newarray[] = new byte[array.length + 1];
+ final byte newarray[] = new byte[array.length + 1];
System.arraycopy(array,0,newarray,0,array.length);
newarray[newarray.length-1] = value;
array = newarray;
@@ -59,11 +59,11 @@
}
return array;
}
- public static byte[] addBytes(byte[] array, int value)
+ public static byte[] addBytes(byte[] array, final int value)
{
if( null != array )
{
- byte newarray[] = new byte[array.length + 3];
+ final byte newarray[] = new byte[array.length + 3];
System.arraycopy(array,0,newarray,0,array.length);
newarray[newarray.length-3] = (byte) (( value >> 16 ) & 0xFF);
newarray[newarray.length-2] = (byte) (( value >> 8 ) & 0xFF);
@@ -79,11 +79,11 @@
}
return array;
}
- public static byte[] addBytes(byte[] array, long value)
+ public static byte[] addBytes(byte[] array, final long value)
{
if( null != array )
{
- byte newarray[] = new byte[array.length + 4];
+ final byte newarray[] = new byte[array.length + 4];
System.arraycopy(array,0,newarray,0,array.length);
newarray[newarray.length-4] = (byte) (( value >> 24 ) & 0xFF);
newarray[newarray.length-3] = (byte) (( value >> 16 ) & 0xFF);
@@ -101,13 +101,13 @@
}
return array;
}
- public static byte[] addBytes(byte[] array,String value)
+ public static byte[] addBytes(byte[] array,final String value)
{
if( null != value )
{
if( null != array)
{
- byte newarray[] = new byte[array.length + value.length()];
+ final byte newarray[] = new byte[array.length + value.length()];
System.arraycopy(array,0,newarray,0,array.length);
System.arraycopy(value.getBytes(),0,newarray,array.length,value.length());
array = newarray;
@@ -119,11 +119,11 @@
}
return array;
}
- public static byte[] addBytes(byte[] array, short value)
+ public static byte[] addBytes(byte[] array, final short value)
{
if( null != array)
{
- byte newarray[] = new byte[array.length + 2];
+ final byte newarray[] = new byte[array.length + 2];
System.arraycopy(array,0,newarray,0,array.length);
newarray[newarray.length-2] = (byte) (( value >> 8 ) & 0xFF);
newarray[newarray.length-1] = (byte) ( value & 0xFF);
@@ -137,7 +137,7 @@
}
return array;
}
- public static double byteArrayToDouble(byte high[], byte low[])
+ public static double byteArrayToDouble(final byte high[], final byte low[])
{
double temp = 0;
// high bytes
@@ -152,10 +152,10 @@
temp += (((long)low[3]) & 0xFF);
return temp;
}
- public static double byteArrayToDouble(byte value[])
+ public static double byteArrayToDouble(final byte value[])
{
- byte high[] = new byte[4];
- byte low[] = new byte[4];
+ final byte high[] = new byte[4];
+ final byte low[] = new byte[4];
high[0] = value[0];
high[1] = value[1];
high[2] = value[2];
@@ -166,7 +166,7 @@
low[3] = value[7];
return byteArrayToDouble(high,low);
}
- public static float byteArrayToFloat(byte value[])
+ public static float byteArrayToFloat(final byte value[])
{
float temp = 0;
temp += (value[0] & 0xFF) << 24;
@@ -175,7 +175,7 @@
temp += (value[3] & 0xFF);
return temp;
}
- public static int byteArrayToInt(byte value[])
+ public static int byteArrayToInt(final byte value[])
{
int temp = 0;
temp += (value[0] & 0xFF) << 24;
@@ -184,10 +184,10 @@
temp += (value[3] & 0xFF);
return temp;
}
- public static long byteArrayToLong(byte value[])
+ public static long byteArrayToLong(final byte value[])
{
- byte high[] = new byte[4];
- byte low[] = new byte[4];
+ final byte high[] = new byte[4];
+ final byte low[] = new byte[4];
high[0] = value[0];
high[1] = value[1];
high[2] = value[2];
@@ -198,7 +198,7 @@
low[3] = value[7];
return byteArrayToLong(high,low);
}
- public static long byteArrayToLong(byte high[], byte low[])
+ public static long byteArrayToLong(final byte high[], final byte low[])
{
long temp = 0;
// high bytes
@@ -214,14 +214,14 @@
return temp;
}
// make the following loops with check on array length *****************
- public static short byteArrayToShort(byte value[])
+ public static short byteArrayToShort(final byte value[])
{
short temp = 0;
temp += (value[0] & 0xFF) << 8;
temp += (value[1] & 0xFF);
return temp;
}
- public static String byteToHexString(byte value)
+ public static String byteToHexString(final byte value)
{
String temp = null;
diff --git a/src/main/java/org/apache/bsf/util/event/generator/Bytecode.java b/src/main/java/org/apache/bsf/util/event/generator/Bytecode.java
index 18821cb..b4ae174 100644
--- a/src/main/java/org/apache/bsf/util/event/generator/Bytecode.java
+++ b/src/main/java/org/apache/bsf/util/event/generator/Bytecode.java
@@ -50,17 +50,17 @@
// return array;
//}
- public static byte[] addClass(byte[] array,short value)
+ public static byte[] addClass(final byte[] array,final short value)
{ return addRef(C_Class,array,value); }
- public static byte[] addFieldRef(byte[] array,short value1,short value2)
+ public static byte[] addFieldRef(final byte[] array,final short value1,final short value2)
{ return addRef(C_FieldRef,array,value1,value2); }
- public static byte[] addInteger(byte[] array,int value)
+ public static byte[] addInteger(byte[] array,final int value)
{
array = ByteUtility.addBytes(array,C_Integer);
array = ByteUtility.addBytes(array,value);
return array;
}
- public static byte[] addInterfaceMethodRef(byte[] array,short value1,short value2)
+ public static byte[] addInterfaceMethodRef(final byte[] array,final short value1,final short value2)
{ return addRef(C_InterfaceMethodRef,array,value1,value2); }
//public static byte[] addFloat(byte[] array,float value)
//{
@@ -69,34 +69,34 @@
// return array;
//}
- public static byte[] addLong(byte[] array,long value)
+ public static byte[] addLong(byte[] array,final long value)
{
array = ByteUtility.addBytes(array,C_Long);
array = ByteUtility.addBytes(array,value);
return array;
}
- public static byte[] addMethodRef(byte[] array,short value1,short value2)
+ public static byte[] addMethodRef(final byte[] array,final short value1,final short value2)
{ return addRef(C_MethodRef,array,value1,value2); }
- public static byte[] addNameAndType(byte[] array,short value1,short value2)
+ public static byte[] addNameAndType(final byte[] array,final short value1,final short value2)
{ return addRef(C_NameAndType,array,value1,value2); }
- public static byte[] addRef(byte refType,byte[] array,short value)
+ public static byte[] addRef(final byte refType,byte[] array,final short value)
{
array = ByteUtility.addBytes(array,refType);
array = ByteUtility.addBytes(array,value);
return array;
}
// Generic Bytecode Methods
- public static byte[] addRef(byte refType,byte[] array,short value1,short value2)
+ public static byte[] addRef(final byte refType,byte[] array,final short value1,final short value2)
{
array = ByteUtility.addBytes(array,refType);
array = ByteUtility.addBytes(array,value1);
array = ByteUtility.addBytes(array,value2);
return array;
}
- public static byte[] addString(byte[] array,short value)
+ public static byte[] addString(final byte[] array,final short value)
{ return addRef(C_String,array,value); }
// Constant Pool Item Methods
- public static byte[] addUtf8(byte[] array,String value)
+ public static byte[] addUtf8(byte[] array,final String value)
{
array = ByteUtility.addBytes(array,C_Utf8);
array = ByteUtility.addBytes(array,(short)value.length());
diff --git a/src/main/java/org/apache/bsf/util/event/generator/EventAdapterGenerator.java b/src/main/java/org/apache/bsf/util/event/generator/EventAdapterGenerator.java
index 223c38a..d5d9b68 100644
--- a/src/main/java/org/apache/bsf/util/event/generator/EventAdapterGenerator.java
+++ b/src/main/java/org/apache/bsf/util/event/generator/EventAdapterGenerator.java
@@ -68,7 +68,7 @@
// logger = LogFactory.getLog((org.apache.bsf.util.event.generator.EventAdapterGenerator.class).getName());
logger = BSF_LogFactory.getLog((org.apache.bsf.util.event.generator.EventAdapterGenerator.class).getName());
- String USERCLASSPACKAGE = System.getProperty("DynamicEventClassPackage",
+ final String USERCLASSPACKAGE = System.getProperty("DynamicEventClassPackage",
"");
if (!USERCLASSPACKAGE.equals(""))
@@ -96,14 +96,14 @@
// rgf, 20070917: first try context class loader, then BSFManager's defining class loader
EVENTLISTENER=null;
- ClassLoader tccl=Thread.currentThread().getContextClassLoader();
+ final ClassLoader tccl=Thread.currentThread().getContextClassLoader();
if (tccl!=null)
{
try {
EVENTLISTENER = tccl.loadClass ("java.util.EventListener");
}
- catch(ClassNotFoundException ex01)
+ catch(final ClassNotFoundException ex01)
{}
}
@@ -113,7 +113,7 @@
}
}
- catch(ClassNotFoundException ex)
+ catch(final ClassNotFoundException ex)
{
System.err.println(ex.getMessage());
ex.printStackTrace();
@@ -209,7 +209,7 @@
}
/* methods that take an EventListener Class Type to create an EventAdapterClass */
- public static Class makeEventAdapterClass(Class listenerType,boolean writeClassFile)
+ public static Class makeEventAdapterClass(final Class listenerType,final boolean writeClassFile)
{
logger.debug("EventAdapterGenerator");
@@ -225,9 +225,9 @@
short nonExceptionableCount;
/* Derive Names */
- String listenerTypeName = listenerType.getName();
+ final String listenerTypeName = listenerType.getName();
logger.debug("ListenerTypeName: "+listenerTypeName);
- String adapterClassName =
+ final String adapterClassName =
CLASSPACKAGE+
(listenerTypeName.endsWith("Listener")
? listenerTypeName.substring(0, listenerTypeName.length() - 8)
@@ -250,7 +250,7 @@
return cached;
}
}
- catch(VerifyError ex)
+ catch(final VerifyError ex)
{
System.err.println(ex.getMessage());
ex.printStackTrace();
@@ -260,10 +260,10 @@
}
while (cached != null);
- String eventListenerName = listenerTypeName.replace('.', '/');
+ final String eventListenerName = listenerTypeName.replace('.', '/');
/* method stuff */
- java.lang.reflect.Method lms[] = listenerType.getMethods();
+ final java.lang.reflect.Method lms[] = listenerType.getMethods();
/* ****************************************************************************************** */
// Listener interface
@@ -285,7 +285,7 @@
// do we have nonExceptionalble event, exceptionable or both
for (int i = 0 ; i < lms.length ; ++i)
{
- Class exceptionTypes[] = lms[i].getExceptionTypes();
+ final Class exceptionTypes[] = lms[i].getExceptionTypes();
if( 0 < exceptionTypes.length)
{ exceptionable = true; }
else
@@ -318,9 +318,9 @@
exceptionableCount = 0;
if(exceptionable)
{
- int classIndex = BASECPCOUNT + cpCount + 1;
- int nameIndex = BASECPCOUNT + cpCount + 0;
- int natIndex = BASECPCOUNT + cpCount + 3;
+ final int classIndex = BASECPCOUNT + cpCount + 1;
+ final int nameIndex = BASECPCOUNT + cpCount + 0;
+ final int natIndex = BASECPCOUNT + cpCount + 3;
exceptionableCount = 5;
cpCount += exceptionableCount;
@@ -348,8 +348,8 @@
for (int i = 0 ; i < lms.length ; ++i)
{
- String eventMethodName = lms[i].getName();
- String eventName = lms[i].getParameterTypes()[0].getName().replace('.','/');
+ final String eventMethodName = lms[i].getName();
+ final String eventName = lms[i].getParameterTypes()[0].getName().replace('.','/');
cpCount += 3;
// cp items for event methods
constantPool = Bytecode.addUtf8(constantPool,eventMethodName);
@@ -357,11 +357,11 @@
constantPool = Bytecode.addString(constantPool,(short)(BASECPCOUNT+cpCount-3));
}/* End for*/
- boolean propertyChangeFlag[] = new boolean[lms.length];
+ final boolean propertyChangeFlag[] = new boolean[lms.length];
int cpIndexPCE = 0;
for (int i = 0 ; i < lms.length ; ++i)
{
- String eventName = lms[i].getParameterTypes()[0].getName().replace('.','/');
+ final String eventName = lms[i].getParameterTypes()[0].getName().replace('.','/');
// cp items for PropertyChangeEvent special handling
if(eventName.equalsIgnoreCase("java/beans/PropertyChangeEvent"))
{
@@ -390,10 +390,10 @@
cpExceptionBaseIndex = (short)(BASECPCOUNT + cpCount);
logger.debug("cpExceptionBaseIndex: " + cpExceptionBaseIndex);
- int excpIndex[][] = new int[lms.length][];
+ final int excpIndex[][] = new int[lms.length][];
for (int i = 0 ; i < lms.length ; ++i)
{
- Class exceptionTypes[] = lms[i].getExceptionTypes();
+ final Class exceptionTypes[] = lms[i].getExceptionTypes();
excpIndex[i] = new int[exceptionTypes.length];
for ( int j = 0 ; j < exceptionTypes.length ; j++)
{
@@ -410,7 +410,7 @@
/* start */
byte newClass[] = CLASSHEADER; // magic, version (fixed)
- short count = (short)(BASECPCOUNT + cpCount);
+ final short count = (short)(BASECPCOUNT + cpCount);
newClass = ByteUtility.addBytes(newClass,count); // constant_pool_count (variable)
newClass = ByteUtility.addBytes(newClass,BASECP); // constant_pool (fixed)
newClass = ByteUtility.addBytes(newClass,constantPool); // constant_pool (variable)
@@ -562,11 +562,11 @@
try
{
// removed "WRITEDIRECTORY+", as this path is already part of 'finalAdapterClassName'
- FileOutputStream fos = new FileOutputStream(finalAdapterClassName+".class");
+ final FileOutputStream fos = new FileOutputStream(finalAdapterClassName+".class");
fos.write(newClass);
fos.close();
}
- catch(IOException ex)
+ catch(final IOException ex)
{
System.err.println(ex.getMessage());
ex.printStackTrace();
@@ -574,13 +574,13 @@
try
{
- Class ret = ldr.loadClass(finalAdapterClassName);
+ final Class ret = ldr.loadClass(finalAdapterClassName);
logger.debug("EventAdapterGenerator: " +
ret.getName() +
" dynamically generated");
return ret;
}
- catch (ClassNotFoundException ex)
+ catch (final ClassNotFoundException ex)
{
System.err.println(ex.getMessage());
ex.printStackTrace();
@@ -589,14 +589,14 @@
try
{
- Class ret = ldr.defineClass(finalAdapterClassName,newClass);
+ final Class ret = ldr.defineClass(finalAdapterClassName,newClass);
logger.debug("EventAdapterGenerator: " +
ret.getName() +
" dynamically generated");
return ret;
}
- catch(Throwable ex) // rgf, 2012-01-15
+ catch(final Throwable ex) // rgf, 2012-01-15
{
System.err.println(ex.getMessage());
ex.printStackTrace();
diff --git a/src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java b/src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java
index 6b680a6..abe552a 100644
--- a/src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java
+++ b/src/main/java/org/apache/bsf/util/type/TypeConvertorRegistry.java
@@ -38,7 +38,7 @@
public TypeConvertorRegistry () {
// no-op convertors: cvt from primitive wrappers to the object wrapper
TypeConvertor tc = new TypeConvertor () {
- public Object convert (Class from, Class to, Object obj) {
+ public Object convert (final Class from, final Class to, final Object obj) {
return obj;
}
@@ -69,7 +69,7 @@
// if the target is string and there is no special convertor available
// otherwise
tc = new TypeConvertor () {
- public Object convert (Class from, Class to, Object obj) {
+ public Object convert (final Class from, final Class to, final Object obj) {
return (obj == null) ? "(null)" : obj.toString ();
}
@@ -84,8 +84,8 @@
// convert strings to various primitives (both their object versions
// and wrappers for primitive versions)
tc = new TypeConvertor () {
- public Object convert (Class from, Class to, Object obj) {
- String str = (String) obj;
+ public Object convert (final Class from, final Class to, final Object obj) {
+ final String str = (String) obj;
if (to == Boolean.class || to == boolean.class) {
return Boolean.valueOf (str);
} else if (to == Byte.class || to == byte.class) {
@@ -151,7 +151,7 @@
// strings to fonts
tc = new TypeConvertor () {
- public Object convert (Class from, Class to, Object obj) {
+ public Object convert (final Class from, final Class to, final Object obj) {
return Font.decode ((String) obj);
}
@@ -165,7 +165,7 @@
// strings to colors
tc = new TypeConvertor () {
- public Object convert (Class from, Class to, Object obj) {
+ public Object convert (final Class from, final Class to, final Object obj) {
return Color.decode ((String) obj);
}
@@ -178,9 +178,9 @@
register (String.class, Color.class, tc);
}
// lookup a convertor
- public TypeConvertor lookup (Class from, Class to) {
- String key = from.getName () + " -> " + to.getName ();
- TypeConvertor tc = (TypeConvertor) reg.get (key);
+ public TypeConvertor lookup (final Class from, final Class to) {
+ final String key = from.getName () + " -> " + to.getName ();
+ final TypeConvertor tc = (TypeConvertor) reg.get (key);
if (tc == null) {
if (from != void.class
&& from != Void.class
@@ -192,16 +192,16 @@
return tc;
}
// lookup a convertor by key
- public TypeConvertor lookupByKey (Object key) {
+ public TypeConvertor lookupByKey (final Object key) {
return (TypeConvertor) keyedReg.get (key);
}
// register a convertor
- public void register (Class from, Class to, TypeConvertor convertor) {
- String key = from.getName () + " -> " + to.getName ();
+ public void register (final Class from, final Class to, final TypeConvertor convertor) {
+ final String key = from.getName () + " -> " + to.getName ();
reg.put (key, convertor);
}
// register a convertor by key
- public void registerByKey (Object key, TypeConvertor convertor) {
+ public void registerByKey (final Object key, final TypeConvertor convertor) {
keyedReg.put (key, convertor);
}
}
diff --git a/src/test/java/org/apache/bsf/BSFEngineTestTmpl.java b/src/test/java/org/apache/bsf/BSFEngineTestTmpl.java
index 26dfac1..58dc384 100644
--- a/src/test/java/org/apache/bsf/BSFEngineTestTmpl.java
+++ b/src/test/java/org/apache/bsf/BSFEngineTestTmpl.java
@@ -32,10 +32,10 @@
protected BSFManager bsfManager;
protected PrintStream sysOut;
- private PrintStream tmpOut;
- private ByteArrayOutputStream tmpBaos;
+ private final PrintStream tmpOut;
+ private final ByteArrayOutputStream tmpBaos;
- public BSFEngineTestTmpl(String name) {
+ public BSFEngineTestTmpl(final String name) {
super(name);
sysOut = System.out;
@@ -61,7 +61,7 @@
tmpBaos.reset();
}
- protected String failMessage(String failure, Exception e) {
+ protected String failMessage(final String failure, final Exception e) {
String message = failure;
message += "\nReason:\n";
message += e.getMessage();
diff --git a/src/test/java/org/apache/bsf/BSFTest.java b/src/test/java/org/apache/bsf/BSFTest.java
index 28b260c..eaf9314 100644
--- a/src/test/java/org/apache/bsf/BSFTest.java
+++ b/src/test/java/org/apache/bsf/BSFTest.java
@@ -37,13 +37,13 @@
public class BSFTest extends BSFEngineTestTmpl {
public static String[] testNames;
- public BSFTest(String name) {
+ public BSFTest(final String name) {
super(name);
}
- public static void main(String args[]) {
- TestRunner runner = new TestRunner();
- TestSuite suite = (TestSuite) suite();
+ public static void main(final String args[]) {
+ final TestRunner runner = new TestRunner();
+ final TestSuite suite = (TestSuite) suite();
TestResult results;
for (int i = 0; i < suite.testCount(); i++) {
@@ -61,7 +61,7 @@
/*
* Please add testcases here as needed.
*/
- TestSuite suite = new TestSuite();
+ final TestSuite suite = new TestSuite();
testNames = new String [8];
suite.addTestSuite(BSFTest.class);
@@ -100,7 +100,7 @@
assertEquals("fakeEngine",
BSFManager.getLangFromFilename("Test.fE"));
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("getLangFromFilename() test failed", e));
}
}
@@ -109,7 +109,7 @@
try {
bsfManager.exec("fakeEngine", "Test.fE", 0, 0, "Fake syntax");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("exec() test failed", e));
}
@@ -124,7 +124,7 @@
"Test.fE", 0, 0,
"Fake Syntax");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("eval() test failed", e));
}
@@ -135,7 +135,7 @@
try {
bsfManager.iexec("fakeEngine", "Test.fE", 0, 0, "Fake syntax");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("iexec() test failed", e));
}
@@ -146,7 +146,7 @@
try {
bsfManager.declareBean("foo", new Integer(1), Integer.class);
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("declareBean() test failed", e));
}
@@ -158,7 +158,7 @@
bsfManager.declareBean("foo", new Integer(1), Integer.class);
bsfManager.undeclareBean("foo");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("undeclareBean() test failed", e));
}
@@ -170,7 +170,7 @@
bsfManager.loadScriptingEngine("fakeEngine");
bsfManager.terminate();
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("terminate() test failed", e));
}
diff --git a/src/test/java/org/apache/bsf/FakeEngine.java b/src/test/java/org/apache/bsf/FakeEngine.java
index b9ccd7e..4375a99 100644
--- a/src/test/java/org/apache/bsf/FakeEngine.java
+++ b/src/test/java/org/apache/bsf/FakeEngine.java
@@ -22,25 +22,25 @@
public class FakeEngine extends BSFEngineImpl {
- public Object call(Object object, String method, Object[] args)
+ public Object call(final Object object, final String method, final Object[] args)
throws BSFException
{
return Boolean.TRUE;
}
- public Object eval(String source, int lineNo, int columnNo, Object expr)
+ public Object eval(final String source, final int lineNo, final int columnNo, final Object expr)
throws BSFException
{
return Boolean.TRUE;
}
- public void iexec(String source, int lineNo, int columnNo, Object script)
+ public void iexec(final String source, final int lineNo, final int columnNo, final Object script)
throws BSFException
{
System.out.print("PASSED");
}
- public void exec(String source, int lineNo, int columnNo, Object script)
+ public void exec(final String source, final int lineNo, final int columnNo, final Object script)
throws BSFException
{
System.out.print("PASSED");
diff --git a/src/test/java/org/apache/bsf/engines/JaclTest.java b/src/test/java/org/apache/bsf/engines/JaclTest.java
index 65de8f2..b104023 100644
--- a/src/test/java/org/apache/bsf/engines/JaclTest.java
+++ b/src/test/java/org/apache/bsf/engines/JaclTest.java
@@ -28,7 +28,7 @@
public class JaclTest extends BSFEngineTestTmpl {
private BSFEngine jaclEngine;
- public JaclTest(String name) {
+ public JaclTest(final String name) {
super(name);
}
@@ -38,7 +38,7 @@
try {
jaclEngine = bsfManager.loadScriptingEngine("jacl");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("Failure attempting to load jacl", e));
}
}
@@ -48,7 +48,7 @@
jaclEngine.exec("Test.jacl", 0, 0,
"puts -nonewline \"PASSED\"");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("exec() test failed", e));
}
@@ -62,7 +62,7 @@
retval = (Integer) jaclEngine.eval("Test.jacl", 0, 0,
"expr 1 + 1");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("eval() test failed", e));
}
@@ -70,7 +70,7 @@
}
public void testCall() {
- Object[] args = { new Integer(1) };
+ final Object[] args = { new Integer(1) };
Integer retval = null;
try {
@@ -78,7 +78,7 @@
"proc addOne {f} {\n return [expr $f + 1]\n}");
retval = (Integer) jaclEngine.call(null, "addOne", args);
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("call() test failed", e));
}
@@ -90,7 +90,7 @@
jaclEngine.iexec("Test.jacl", 0, 0,
"puts -nonewline \"PASSED\"");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("iexec() test failed", e));
}
@@ -104,7 +104,7 @@
retval = (Integer) bsfManager.eval("jacl", "Test.jacl", 0, 0,
"expr 1 + 1");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("BSFManager eval() test failed", e));
}
@@ -112,7 +112,7 @@
}
public void testRegisterBean() {
- Integer foo = new Integer(1);
+ final Integer foo = new Integer(1);
Integer bar = null;
try {
@@ -120,7 +120,7 @@
bar = (Integer) jaclEngine.eval("Test.jacl", 0, 0,
"bsf lookupBean \"foo\"");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("registerBean() test failed", e));
}
@@ -128,7 +128,7 @@
}
public void testUnregisterBean() {
- Integer foo = new Integer(1);
+ final Integer foo = new Integer(1);
Integer bar = null;
try {
@@ -137,10 +137,10 @@
bar = (Integer) jaclEngine.eval("Test.jacl", 0, 0,
"bsf lookupBean \"foo\"");
}
- catch (BSFException bsfE) {
+ catch (final BSFException bsfE) {
// Do nothing. This is the expected case.
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("unregisterBean() test failed", e));
}
@@ -148,7 +148,7 @@
}
public void testDeclareBean() {
- Integer foo = new Integer(1);
+ final Integer foo = new Integer(1);
Integer bar = null;
try {
@@ -158,7 +158,7 @@
"proc ret {} {\n upvar 1 foo lfoo\n " +
"return $lfoo\n }\n ret");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("declareBean() test failed", e));
}
@@ -166,7 +166,7 @@
}
public void testUndeclareBean() {
- Integer foo = new Integer(1);
+ final Integer foo = new Integer(1);
Integer bar = null;
try {
@@ -176,7 +176,7 @@
jaclEngine.eval("Test.jacl", 0, 0,
"expr $foo + 1");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("undeclareBean() test failed", e));
}
diff --git a/src/test/java/org/apache/bsf/engines/JavascriptTest.java b/src/test/java/org/apache/bsf/engines/JavascriptTest.java
index 857cf8e..9c18467 100644
--- a/src/test/java/org/apache/bsf/engines/JavascriptTest.java
+++ b/src/test/java/org/apache/bsf/engines/JavascriptTest.java
@@ -66,7 +66,7 @@
public class JavascriptTest extends BSFEngineTestTmpl {
private BSFEngine javascriptEngine;
- public JavascriptTest(String name) {
+ public JavascriptTest(final String name) {
super(name);
}
@@ -76,7 +76,7 @@
try {
javascriptEngine = bsfManager.loadScriptingEngine("javascript");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("Failure attempting to load Rhino", e));
}
}
@@ -87,7 +87,7 @@
"java.lang.System.out.print " +
"(\"PASSED\");");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("exec() test failed", e));
}
@@ -101,7 +101,7 @@
retval = new Double((javascriptEngine.eval("Test.js", 0, 0,
"1 + 1;").toString()));
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("eval() test failed", e));
}
@@ -109,7 +109,7 @@
}
public void testCall() {
- Object[] args = { new Double(1) };
+ final Object[] args = { new Double(1) };
Double retval = null;
try {
@@ -119,7 +119,7 @@
new Double((javascriptEngine.call(null, "addOne",
args).toString()));
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("call() test failed", e));
}
@@ -132,7 +132,7 @@
"java.lang.System.out.print " +
"(\"PASSED\");");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("iexec() test failed", e));
}
@@ -146,7 +146,7 @@
retval = new Double((bsfManager.eval("javascript", "Test.js", 0,
0, "1 + 1;")).toString());
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("BSFManager eval() test failed", e));
}
@@ -160,7 +160,7 @@
retval = javascriptEngine.eval("Test.js", 0, 0,
"bsf.lookupBean(\"foo\");");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("Test of BSFManager availability failed", e));
}
@@ -168,7 +168,7 @@
}
public void testRegisterBean() {
- Double foo = new Double(1);
+ final Double foo = new Double(1);
Double bar = null;
try {
@@ -177,7 +177,7 @@
javascriptEngine.eval("Test.js", 0, 0,
"bsf.lookupBean(\"foo\");");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("registerBean() test failed", e));
}
@@ -185,7 +185,7 @@
}
public void testUnregisterBean() {
- Double foo = new Double(1);
+ final Double foo = new Double(1);
Double bar = null;
try {
@@ -195,7 +195,7 @@
javascriptEngine.eval("Test.js", 0, 0,
"bsf.lookupBean(\"foo\");");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("unregisterBean() test failed", e));
}
@@ -203,14 +203,14 @@
}
public void testDeclareBean() {
- Double foo = new Double(1);
+ final Double foo = new Double(1);
Double bar = null;
try {
bsfManager.declareBean("foo", foo, Double.class);
bar = (Double) javascriptEngine.eval("Test.js", 0, 0, "foo + 1;");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("declareBean() test failed", e));
}
@@ -218,7 +218,7 @@
}
public void testUndeclareBean() {
- Double foo = new Double(1);
+ final Double foo = new Double(1);
Double bar = null;
try {
@@ -227,10 +227,10 @@
bar = (Double) javascriptEngine.eval("Test.js", 0, 0,
"foo + 1");
}
- catch (BSFException bsfE) {
+ catch (final BSFException bsfE) {
// Do nothing. This is the expected case.
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("undeclareBean() test failed", e));
}
diff --git a/src/test/java/org/apache/bsf/engines/JythonTest.java b/src/test/java/org/apache/bsf/engines/JythonTest.java
index 7a69bc2..1ac6cfe 100644
--- a/src/test/java/org/apache/bsf/engines/JythonTest.java
+++ b/src/test/java/org/apache/bsf/engines/JythonTest.java
@@ -66,7 +66,7 @@
public class JythonTest extends BSFEngineTestTmpl {
private BSFEngine jythonEngine;
- public JythonTest(String name) {
+ public JythonTest(final String name) {
super(name);
}
@@ -76,7 +76,7 @@
try {
jythonEngine = bsfManager.loadScriptingEngine("jython");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("Failure attempting to load jython", e));
}
}
@@ -86,7 +86,7 @@
jythonEngine.exec("Test.py", 0, 0,
"print \"PASSED\",");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("exec() test failed", e));
}
@@ -100,7 +100,7 @@
retval = new Integer((jythonEngine.eval("Test.py", 0, 0,
"1 + 1")).toString());
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("eval() test failed", e));
}
@@ -108,7 +108,7 @@
}
public void testCall() {
- Object[] args = { new Integer(1) };
+ final Object[] args = { new Integer(1) };
Integer retval = null;
try {
@@ -118,7 +118,7 @@
new Integer((jythonEngine.call(null, "addOne",
args).toString()));
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("call() test failed", e));
}
@@ -132,7 +132,7 @@
jythonEngine.iexec("Test.py", 0, 0,
"print \"PASSED\"," + "\n" + "print \"FAILED\",");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("iexec() test failed", e));
}
@@ -146,7 +146,7 @@
retval = new Integer((bsfManager.eval("jython", "Test.py", 0, 0,
"1 + 1")).toString());
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("BSFManager eval() test failed", e));
}
@@ -160,7 +160,7 @@
retval = jythonEngine.eval("Test.py", 0, 0,
"bsf.lookupBean(\"foo\")");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("Test of BSFManager availability failed", e));
}
@@ -168,7 +168,7 @@
}
public void testRegisterBean() {
- Integer foo = new Integer(1);
+ final Integer foo = new Integer(1);
Integer bar = null;
try {
@@ -177,7 +177,7 @@
"bsf.lookupBean(\"foo\")"))
.toString());
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("registerBean() test failed", e));
}
@@ -185,7 +185,7 @@
}
public void testUnregisterBean() {
- Integer foo = new Integer(1);
+ final Integer foo = new Integer(1);
Object bar = null;
try {
@@ -194,7 +194,7 @@
bar = jythonEngine.eval("Test.py", 0, 0,
"bsf.lookupBean(\"foo\")");
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("unregisterBean() test failed", e));
}
@@ -202,7 +202,7 @@
}
public void testDeclareBean() {
- Integer foo = new Integer(1);
+ final Integer foo = new Integer(1);
Integer bar = null;
try {
@@ -210,7 +210,7 @@
bar = new Integer((jythonEngine.eval("Test.py", 0, 0,
"foo + 1")).toString());
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("declareBean() test failed", e));
}
@@ -218,7 +218,7 @@
}
public void testUndeclareBean() {
- Integer foo = new Integer(1);
+ final Integer foo = new Integer(1);
Integer bar = null;
try {
@@ -227,10 +227,10 @@
bar = new Integer((jythonEngine.eval("Test.py", 0, 0,
"foo + 1")).toString());
}
- catch (BSFException bsfE) {
+ catch (final BSFException bsfE) {
// Do nothing. This is the expected case.
}
- catch (Exception e) {
+ catch (final Exception e) {
fail(failMessage("undeclareBean() test failed", e));
}
diff --git a/src/test/java/org/apache/bsf/engines/NetrexxTest.java b/src/test/java/org/apache/bsf/engines/NetrexxTest.java
index 7e6ccd6..4e85833 100644
--- a/src/test/java/org/apache/bsf/engines/NetrexxTest.java
+++ b/src/test/java/org/apache/bsf/engines/NetrexxTest.java
@@ -68,9 +68,9 @@
public class NetrexxTest extends BSFEngineTestTmpl {
private BSFEngine netrexxEngine;
- private String lineSeparatorStr = System.getProperty("line.separator");
+ private final String lineSeparatorStr = System.getProperty("line.separator");
- public NetrexxTest(String name) {
+ public NetrexxTest(final String name) {
super(name);
}
@@ -80,7 +80,7 @@
try {
netrexxEngine = bsfManager.loadScriptingEngine("netrexx");
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
fail(failMessage("fail while attempting to load netrexx", bsfe));
}
}
@@ -90,7 +90,7 @@
}
public void testDeclareBean() {
- Integer foo = new Integer(0);
+ final Integer foo = new Integer(0);
Integer bar = null;
try {
@@ -98,7 +98,7 @@
bar = new Integer((netrexxEngine.eval("Test.nrx", 0, 0,
"foo.intValue() + 1")).toString());
}
- catch (Exception ex) {
+ catch (final Exception ex) {
fail(failMessage("declaredBean() test failed", ex));
}
@@ -106,7 +106,7 @@
}
public void testRegisterBean() {
- Integer foo = new Integer(0);
+ final Integer foo = new Integer(0);
Integer bar = null;
try {
@@ -114,7 +114,7 @@
bar = new Integer((netrexxEngine.eval("Test.nrx", 0, 0,
"bsf.lookupBean(\"foo\")").toString()));
}
- catch (Exception ex) {
+ catch (final Exception ex) {
fail(failMessage("registerBean() test fail", ex));
}
@@ -126,7 +126,7 @@
netrexxEngine.exec("Test.nrx", 0, 0,
"say \"PASSED\"");
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
fail(failMessage("exec() test fail", bsfe));
}
@@ -135,7 +135,7 @@
public void testUndeclareBean() {
// FIXME: Netrexx is a little chatty about the missing variable...
- Integer foo = new Integer(0);
+ final Integer foo = new Integer(0);
Object bar = null;
try {
@@ -144,10 +144,10 @@
bar = netrexxEngine.eval("Test.nrx", 0, 0,
"foo + 1");
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
// don't do anything .. this is the expected case
}
- catch (Exception ex) {
+ catch (final Exception ex) {
fail(failMessage("undeclareBean() test failed", ex));
}
@@ -155,7 +155,7 @@
}
public void testUnregisterBean(){
- Integer foo = new Integer(0);
+ final Integer foo = new Integer(0);
Object retValue = null;
try {
@@ -164,7 +164,7 @@
retValue = netrexxEngine.eval("Test.nrx", 0, 0,
"bsf.lookupBean(\"foo\")");
}
- catch (Exception ex) {
+ catch (final Exception ex) {
fail(failMessage("unregisterBean() test fail", ex));
}
@@ -178,7 +178,7 @@
retValue = bsfManager.eval("netrexx", "Test.nrx", 0, 0,
"bsf.lookupBean(\"foo\")");
}
- catch (Exception ex) {
+ catch (final Exception ex) {
fail(failMessage("BSFManagerAvailability() test failed", ex));
}
@@ -192,7 +192,7 @@
retValue = new Integer((bsfManager.eval("netrexx", "Test.nrx", 0, 0,
"1 + (-1)")).toString());
}
- catch (Exception ex) {
+ catch (final Exception ex) {
fail(failMessage("BSFManagerEval() test failed", ex));
}
diff --git a/src/test/java/org/apache/bsf/util/EngineUtilsTest.java b/src/test/java/org/apache/bsf/util/EngineUtilsTest.java
index 60b554c..26a1158 100644
--- a/src/test/java/org/apache/bsf/util/EngineUtilsTest.java
+++ b/src/test/java/org/apache/bsf/util/EngineUtilsTest.java
@@ -34,7 +34,7 @@
Object result=null;
- public EngineUtilsTest(String name) {
+ public EngineUtilsTest(final String name) {
super(name);
}
@@ -45,12 +45,12 @@
public void testCallBeanMethod() {
Object[] args = new Object[]{new String("MoreConfirmation")};
- TestBean bean = new TestBean("TestBean");
+ final TestBean bean = new TestBean("TestBean");
try {
result = EngineUtils.callBeanMethod(bean, "getStringValue", null);
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
fail("createBean method failed"+bsfe);
}
@@ -59,7 +59,7 @@
try {
EngineUtils.callBeanMethod(bean,"setValue",args);
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
fail("createBean method failed"+bsfe);
}
@@ -70,7 +70,7 @@
try {
EngineUtils.callBeanMethod(bean,"setValue",args);
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
fail("createBean method failed"+bsfe);
}
@@ -84,18 +84,18 @@
args);
fail();
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
}
}
public void testCreateBean() throws BSFException {
- Object args[] = new Object[]{ new String("test") };
+ final Object args[] = new Object[]{ new String("test") };
try {
result = EngineUtils.createBean("org.apache.bsf.util.TestBean", args);
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
fail("createBean method failed"+bsfe);
}
@@ -108,15 +108,15 @@
EngineUtils.createBean("nonExsitentClass",null);
fail();
}
- catch (BSFException bsfe) {
+ catch (final BSFException bsfe) {
}
}
public void testGetTypeSignatureString() {
//test for a non primitive type
- Integer int1 = new Integer(10);
- Object obj = EngineUtils.getTypeSignatureString(int1.getClass());
+ final Integer int1 = new Integer(10);
+ final Object obj = EngineUtils.getTypeSignatureString(int1.getClass());
assertEquals("Ljava/lang/Integer;",(String)obj);
assertEquals("I", EngineUtils.getTypeSignatureString(int.class));
diff --git a/src/test/java/org/apache/bsf/util/IOUtilsTest.java b/src/test/java/org/apache/bsf/util/IOUtilsTest.java
index be9cee6..c4d7d32 100644
--- a/src/test/java/org/apache/bsf/util/IOUtilsTest.java
+++ b/src/test/java/org/apache/bsf/util/IOUtilsTest.java
@@ -80,31 +80,31 @@
static private final String lineSeparator =
System.getProperty("line.separator","/n");
- public IOUtilsTest(String name) {
+ public IOUtilsTest(final String name) {
super(name);
}
public void testGetStringFromReader() throws IOException {
String result;
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
pw.println("IOUtilsTest");
pw.flush();
- StringReader sr = new StringReader(sw.toString());
+ final StringReader sr = new StringReader(sw.toString());
result = IOUtils.getStringFromReader(sr);
assertTrue(result.equals(new String("IOUtilsTest" + lineSeparator)));
- File myFile = File.createTempFile("Test", "txt");
+ final File myFile = File.createTempFile("Test", "txt");
- FileWriter fw = new FileWriter(myFile);
- PrintWriter npw = new PrintWriter(fw);
+ final FileWriter fw = new FileWriter(myFile);
+ final PrintWriter npw = new PrintWriter(fw);
npw.println("file name : Test.txt");
npw.flush();
- FileReader fr = new FileReader(myFile);
+ final FileReader fr = new FileReader(myFile);
result = IOUtils.getStringFromReader(fr);
assertTrue(result.equals(new String("file name : Test.txt" +
diff --git a/src/test/java/org/apache/bsf/util/StringUtilsTest.java b/src/test/java/org/apache/bsf/util/StringUtilsTest.java
index 8f5af15..bd16592 100644
--- a/src/test/java/org/apache/bsf/util/StringUtilsTest.java
+++ b/src/test/java/org/apache/bsf/util/StringUtilsTest.java
@@ -84,7 +84,7 @@
* Constructor for StringUtilsTest.
* @param arg0
*/
- public StringUtilsTest (String arg0) {
+ public StringUtilsTest (final String arg0) {
super(arg0);
}
@@ -152,7 +152,7 @@
String result;
- Vector vector = new Vector();
+ final Vector vector = new Vector();
vector.add(new Character('a'));
vector.add(new Character('b'));
@@ -169,15 +169,15 @@
Reader reader;
- File myFile = File.createTempFile("Test", "txt");
+ final File myFile = File.createTempFile("Test", "txt");
- FileWriter fw = new FileWriter(myFile);
- PrintWriter pw = new PrintWriter(fw);
+ final FileWriter fw = new FileWriter(myFile);
+ final PrintWriter pw = new PrintWriter(fw);
pw.println("file name : Test.txt");
pw.flush();
reader = StringUtils.getContentAsReader(myFile.toURL());
- BufferedReader bf = new BufferedReader(reader);
+ final BufferedReader bf = new BufferedReader(reader);
assertTrue(bf.readLine().equals(
new String("file name : Test.txt")));
@@ -187,10 +187,10 @@
String result;
- File myFile = File.createTempFile("Test", "txt");
+ final File myFile = File.createTempFile("Test", "txt");
- FileWriter fw = new FileWriter(myFile);
- PrintWriter pw = new PrintWriter(fw);
+ final FileWriter fw = new FileWriter(myFile);
+ final PrintWriter pw = new PrintWriter(fw);
pw.println("file name : Test.txt");
pw.flush();
diff --git a/src/test/java/org/apache/bsf/util/TestBean.java b/src/test/java/org/apache/bsf/util/TestBean.java
index bd71f7d..7d92e39 100644
--- a/src/test/java/org/apache/bsf/util/TestBean.java
+++ b/src/test/java/org/apache/bsf/util/TestBean.java
@@ -71,15 +71,15 @@
public TestBean(){
}
- public TestBean(String value){
+ public TestBean(final String value){
this.strValue = value;
}
- public void setValue(String value){
+ public void setValue(final String value){
this.strValue = value;
}
- public void setValue(String sValue, Number nValue){
+ public void setValue(final String sValue, final Number nValue){
this.strValue = sValue;
this.numValue = nValue;
}