Author: schor Date: Fri Jan 26 21:46:32 2018 New Revision: 1822354 URL: http://svn.apache.org/viewvc?rev=1822354&view=rev Log: no Jira fix bugs caught by findbugs
Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java?rev=1822354&r1=1822353&r2=1822354&view=diff ============================================================================== --- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java (original) +++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasCompare.java Fri Jan 26 21:46:32 2018 @@ -507,8 +507,8 @@ public class CasCompare { int i1 = 0; int i2 = 0; - final int maxId1 = c1.peekNextFsId(); - final int maxId2 = c2.peekNextFsId(); + maxId1 = c1.peekNextFsId(); + maxId2 = c2.peekNextFsId(); // convert_linear_lists_to_arrays may add more items Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java?rev=1822354&r1=1822353&r2=1822354&view=diff ============================================================================== --- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java (original) +++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java Fri Jan 26 21:46:32 2018 @@ -294,31 +294,38 @@ public class UIMAFramework_impl extends if (o == null) // source class logger not available { - // create new Logger for the source class - // set method argument type - Class[] argumentTypes = { Class.class }; - // set argument value - Object[] arguments = { component }; - try { - // get static method getInstance(Class component) - Method instanceMethod = mLoggerClass.getMethod("getInstance", argumentTypes); - // invoke getInstance(Class component) method and retrieve logger object - o = (Logger) instanceMethod.invoke(null, arguments); - if (AnalysisComponent_ImplBase.class.isAssignableFrom(component) || - // Watch out: next Annotat_ImplBase class exists in 2 packages, this one is old one, needed for backwards compat. - org.apache.uima.analysis_engine.annotator.Annotator_ImplBase.class.isAssignableFrom(component)) { - ((Logger_common_impl)o).setAnnotatorLogger(true); - } - } catch (NoSuchMethodException e) { - throw new UIMARuntimeException(e); - } catch (InvocationTargetException e) { - throw new UIMARuntimeException(e); - } catch (IllegalAccessException e) { - throw new UIMARuntimeException(e); - } + synchronized (this) { + o = mLoggers.get(component.getName()); - // put created logger to the HashMap - mLoggers.put(component.getName(), o); + if (o == null) { // source class logger not available + + // create new Logger for the source class + // set method argument type + Class[] argumentTypes = { Class.class }; + // set argument value + Object[] arguments = { component }; + try { + // get static method getInstance(Class component) + Method instanceMethod = mLoggerClass.getMethod("getInstance", argumentTypes); + // invoke getInstance(Class component) method and retrieve logger object + o = (Logger) instanceMethod.invoke(null, arguments); + if (AnalysisComponent_ImplBase.class.isAssignableFrom(component) || + // Watch out: next Annotat_ImplBase class exists in 2 packages, this one is old one, needed for backwards compat. + org.apache.uima.analysis_engine.annotator.Annotator_ImplBase.class.isAssignableFrom(component)) { + ((Logger_common_impl)o).setAnnotatorLogger(true); + } + } catch (NoSuchMethodException e) { + throw new UIMARuntimeException(e); + } catch (InvocationTargetException e) { + throw new UIMARuntimeException(e); + } catch (IllegalAccessException e) { + throw new UIMARuntimeException(e); + } + + // put created logger to the HashMap + mLoggers.put(component.getName(), o); + } + } } return o;