diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-17 11:35:04 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-12-19 10:41:58 +0200 |
commit | 2d82619a528ebdf867f242c85ad626462609ba39 (patch) | |
tree | 4653347d1e28bb02a723be5c58b744d277e6697f | |
parent | 0ae24c2189ea68576c96fcbe87299b51256cb468 (diff) |
java: static fields that should not be static
Found by FindBugs.
Change-Id: I223841f7bb8c515c9612322abc0b13e134385abd
23 files changed, 51 insertions, 66 deletions
diff --git a/connectivity/qa/complex/connectivity/DBaseDriverTest.java b/connectivity/qa/complex/connectivity/DBaseDriverTest.java index 6afada84890c..7749fde8d97d 100644 --- a/connectivity/qa/complex/connectivity/DBaseDriverTest.java +++ b/connectivity/qa/complex/connectivity/DBaseDriverTest.java @@ -50,7 +50,7 @@ public class DBaseDriverTest extends ComplexTestCase implements TestCase public LogWriter getLog() { - return ComplexTestCase.log; + return log; } public void Functions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException diff --git a/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java b/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java index 92f91dfcef75..f0c04b679653 100644 --- a/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java +++ b/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java @@ -71,7 +71,7 @@ import static org.junit.Assert.*; public class FinalizedMandatoryTest { - static XMultiServiceFactory xMSF; + XMultiServiceFactory xMSF; /** Create the environment for following tests. * Use either a component loader from desktop or diff --git a/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java b/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java index 8d76aaa61f6b..75903c0181d0 100644 --- a/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java +++ b/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java @@ -35,7 +35,7 @@ import static org.junit.Assert.*; public class TypeDetection6FileFormat { - static XMultiServiceFactory xMSF; + XMultiServiceFactory xMSF; /** Create the environment for following tests. * Use either a component loader from desktop or diff --git a/framework/qa/complex/api_internal/CheckAPI.java b/framework/qa/complex/api_internal/CheckAPI.java index e3ffa8bd584b..dfc77543bde7 100644 --- a/framework/qa/complex/api_internal/CheckAPI.java +++ b/framework/qa/complex/api_internal/CheckAPI.java @@ -50,7 +50,7 @@ public class CheckAPI { /** * The test parameters */ - private static TestParameters param = null; + private TestParameters param = null; /** * diff --git a/framework/qa/complex/imageManager/CheckImageManager.java b/framework/qa/complex/imageManager/CheckImageManager.java index 6495f7935d67..0efb6ed036f5 100644 --- a/framework/qa/complex/imageManager/CheckImageManager.java +++ b/framework/qa/complex/imageManager/CheckImageManager.java @@ -49,7 +49,7 @@ public class CheckImageManager { /** * The test parameters */ - private static TestParameters param = null; + private TestParameters param = null; @Before public void before() { diff --git a/framework/qa/complex/imageManager/_XComponent.java b/framework/qa/complex/imageManager/_XComponent.java index 8b7cdb5404e7..e5a3ea90e918 100644 --- a/framework/qa/complex/imageManager/_XComponent.java +++ b/framework/qa/complex/imageManager/_XComponent.java @@ -38,7 +38,7 @@ import lib.TestParameters; */ public class _XComponent { - private static XComponent oObj = null; + private XComponent oObj = null; private XComponent altDispose = null; private final TestParameters tEnv; private boolean listenerDisposed[] = new boolean[2]; @@ -66,7 +66,7 @@ public class _XComponent { public _XComponent(TestParameters tEnv, XComponent oObj) { this.tEnv = tEnv; - _XComponent.oObj = oObj; + this.oObj = oObj; } /** @@ -115,7 +115,7 @@ public class _XComponent { return true; } // finished _removeEventListener() - private static boolean disposed = false; + private boolean disposed = false; /** * Disposes the object and then check appropriate listeners were diff --git a/framework/qa/complex/imageManager/_XInitialization.java b/framework/qa/complex/imageManager/_XInitialization.java index 14cab34d4ca0..5a5565786e73 100644 --- a/framework/qa/complex/imageManager/_XInitialization.java +++ b/framework/qa/complex/imageManager/_XInitialization.java @@ -41,12 +41,12 @@ public class _XInitialization { private final TestParameters tEnv; - private static XInitialization oObj = null; + private XInitialization oObj = null; public _XInitialization(TestParameters tEnv, XInitialization oObj) { this.tEnv = tEnv; - _XInitialization.oObj = oObj; + this.oObj = oObj; } /** diff --git a/framework/qa/complex/imageManager/_XTypeProvider.java b/framework/qa/complex/imageManager/_XTypeProvider.java index 4af3a74a42a8..0e5e9e6bf92d 100644 --- a/framework/qa/complex/imageManager/_XTypeProvider.java +++ b/framework/qa/complex/imageManager/_XTypeProvider.java @@ -38,11 +38,10 @@ public class _XTypeProvider { - private static XTypeProvider oObj = null; - private static Type[] types = null; + private XTypeProvider oObj = null; public _XTypeProvider(TestParameters tEnv, XTypeProvider oObj) { - _XTypeProvider.oObj = oObj; + this.oObj = oObj; } /** @@ -69,7 +68,7 @@ public class _XTypeProvider { public boolean _getTypes() { boolean result = false; System.out.println("getting Types..."); - types = oObj.getTypes(); + Type[] types = oObj.getTypes(); for (int i=0;i<types.length;i++) { int k = i+1; System.out.println(k+". Type is "+types[i].toString()); diff --git a/framework/qa/complex/path_substitution/PathSubstitutionTest.java b/framework/qa/complex/path_substitution/PathSubstitutionTest.java index 152ee4d5b965..ff331392d5ba 100644 --- a/framework/qa/complex/path_substitution/PathSubstitutionTest.java +++ b/framework/qa/complex/path_substitution/PathSubstitutionTest.java @@ -38,7 +38,7 @@ import com.sun.star.util.XStringSubstitution; public class PathSubstitutionTest { - private static XMultiServiceFactory xMSF; + private XMultiServiceFactory xMSF; // all substitution variables private VariableContainer substVars = null; diff --git a/qadevOOo/runner/base/java_fat.java b/qadevOOo/runner/base/java_fat.java index 04f159a4336a..c9891d4c9f09 100644 --- a/qadevOOo/runner/base/java_fat.java +++ b/qadevOOo/runner/base/java_fat.java @@ -45,10 +45,10 @@ import com.sun.star.lang.XMultiServiceFactory; public class java_fat implements TestBase { - private static boolean m_isDebug = false; - private static boolean keepdocument = false; - private static boolean logging = true; - private static boolean newOffice = false; + private boolean m_isDebug = false; + private boolean keepdocument = false; + private boolean logging = true; + private boolean newOffice = false; private DynamicClassLoader m_aDynamicClassLoader = null; private lib.TestParameters m_aParams; diff --git a/qadevOOo/runner/complexlib/ComplexTestCase.java b/qadevOOo/runner/complexlib/ComplexTestCase.java index 2486692130bb..3e940749b1bf 100644 --- a/qadevOOo/runner/complexlib/ComplexTestCase.java +++ b/qadevOOo/runner/complexlib/ComplexTestCase.java @@ -32,9 +32,9 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest { /** The test parameters **/ - protected static TestParameters param = null; + protected TestParameters param = null; /** Log writer **/ - protected static LogWriter log = null; + protected LogWriter log = null; /** * The method name which will be written into f.e. the data base **/ diff --git a/qadevOOo/runner/stats/InternalLogWriter.java b/qadevOOo/runner/stats/InternalLogWriter.java index d9a0a2de067c..a39e372a61cc 100644 --- a/qadevOOo/runner/stats/InternalLogWriter.java +++ b/qadevOOo/runner/stats/InternalLogWriter.java @@ -24,18 +24,18 @@ import java.io.StringWriter; * Write all logs into a java.io.PrintWriter, i.e. a StringBuffer. * Log is gathered there. */ -public class InternalLogWriter extends PrintWriter - implements share.LogWriter { +public class InternalLogWriter implements share.LogWriter { /** log active **/ private boolean active; /** write all output to a StringBuffer **/ - private static StringWriter writer = new StringWriter(); + private StringWriter writer = new StringWriter(); + private PrintWriter printWriter; /** * c'*tor */ public InternalLogWriter() { - super(new PrintWriter(writer)); + printWriter = new PrintWriter(writer); active = true; } @@ -54,21 +54,9 @@ public class InternalLogWriter extends PrintWriter * Method to print a line that is added to the StringBuffer. * @param msg The message that is printed. */ - @Override public void println(String msg) { if (active) - super.println(msg); - } - - /** - * Method to print to the StringBuffer. - * @param msg The message that is printed. - */ - @Override - public void print(String msg) { - if (active) - super.print(msg); - + printWriter.println(msg); } /** @@ -80,17 +68,17 @@ public class InternalLogWriter extends PrintWriter public boolean summary(share.DescEntry entry) { // linePrefix = ""; String header = "***** State for "+entry.longName+" ******"; - println(header); + printWriter.println(header); if (entry.hasErrorMsg) { - println(entry.ErrorMsg); - println("Whole "+entry.EntryType+": "+entry.State); + printWriter.println(entry.ErrorMsg); + printWriter.println("Whole "+entry.EntryType+": "+entry.State); } else { - println("Whole "+entry.EntryType+": "+entry.State); + printWriter.println("Whole "+entry.EntryType+": "+entry.State); } for (int i=0;i<header.length();i++) { - print("*"); + printWriter.print("*"); } - println(""); + printWriter.println(""); return true; } diff --git a/qadevOOo/tests/java/ifc/document/_XEventBroadcaster.java b/qadevOOo/tests/java/ifc/document/_XEventBroadcaster.java index 02c41b583378..b2b3ff3bb4ca 100644 --- a/qadevOOo/tests/java/ifc/document/_XEventBroadcaster.java +++ b/qadevOOo/tests/java/ifc/document/_XEventBroadcaster.java @@ -29,8 +29,8 @@ import com.sun.star.uno.UnoRuntime; public class _XEventBroadcaster extends MultiMethodTest { public XEventBroadcaster oObj; - protected static boolean listenerCalled=false; - private static XEventListener listener=null; + protected boolean listenerCalled = false; + private XEventListener listener = null; public class MyEventListener implements XEventListener { diff --git a/qadevOOo/tests/java/ifc/lang/_XComponent.java b/qadevOOo/tests/java/ifc/lang/_XComponent.java index 184f6ccad2ab..c05b7c5deffe 100644 --- a/qadevOOo/tests/java/ifc/lang/_XComponent.java +++ b/qadevOOo/tests/java/ifc/lang/_XComponent.java @@ -113,7 +113,7 @@ public class _XComponent extends MultiMethodTest { log.println(Thread.currentThread() + " is removing EL " + listener2); } // finished _removeEventListener() - static boolean disposed = false; + boolean disposed = false; /** * Disposes the object and then check appropriate listeners were diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XAvailableLocales.java b/qadevOOo/tests/java/ifc/linguistic2/_XAvailableLocales.java index 41f093f72c17..0fb7e4f883b0 100644 --- a/qadevOOo/tests/java/ifc/linguistic2/_XAvailableLocales.java +++ b/qadevOOo/tests/java/ifc/linguistic2/_XAvailableLocales.java @@ -33,14 +33,13 @@ import lib.MultiMethodTest; public class _XAvailableLocales extends MultiMethodTest { public XAvailableLocales oObj = null; - public static Locale[] locales = new Locale[0]; /** * Test calls the method, stores returned value and checks it. <p> * Has <b> OK </b> status if length of returned array isn't zero. <p> */ public void _getAvailableLocales() { - locales = oObj.getAvailableLocales("com.sun.star.linguistic2.Hyphenator"); + Locale[] locales = oObj.getAvailableLocales("com.sun.star.linguistic2.Hyphenator"); tRes.tested("getAvailableLocales()", locales.length > 0); } diff --git a/qadevOOo/tests/java/ifc/linguistic2/_XSupportedLocales.java b/qadevOOo/tests/java/ifc/linguistic2/_XSupportedLocales.java index b70eecffd721..269e07c8ac15 100644 --- a/qadevOOo/tests/java/ifc/linguistic2/_XSupportedLocales.java +++ b/qadevOOo/tests/java/ifc/linguistic2/_XSupportedLocales.java @@ -35,7 +35,7 @@ import com.sun.star.linguistic2.XSupportedLocales; public class _XSupportedLocales extends MultiMethodTest { public XSupportedLocales oObj = null; - public static Locale[] locales = new Locale[0]; + public Locale[] locales = new Locale[0]; /** * Test calls the method, stores returned value and checks it. <p> diff --git a/qadevOOo/tests/java/ifc/table/_XCellCursor.java b/qadevOOo/tests/java/ifc/table/_XCellCursor.java index 9c2591f91c42..a01c4667c5b1 100644 --- a/qadevOOo/tests/java/ifc/table/_XCellCursor.java +++ b/qadevOOo/tests/java/ifc/table/_XCellCursor.java @@ -54,8 +54,7 @@ import com.sun.star.uno.UnoRuntime; */ public class _XCellCursor extends MultiMethodTest { - public static XCellCursor oObj = null; - public static XSpreadsheet oSheet = null; + public XCellCursor oObj = null; /** * <code>XCellRangeAddressable</code> interface is queried @@ -174,7 +173,7 @@ public class _XCellCursor extends MultiMethodTest { */ public void _gotoEnd(){ //gotoEnd gets it's own cursor to see a change - oSheet = (XSpreadsheet) tEnv.getObjRelation("SHEET"); + XSpreadsheet oSheet = (XSpreadsheet) tEnv.getObjRelation("SHEET"); XCellRange testRange = oSheet.getCellRangeByName("$A$1:$g$7") ; XSheetCellRange testSheetRange = UnoRuntime.queryInterface(XSheetCellRange.class,testRange); XSheetCellCursor oCellCursor = oSheet.createCursorByRange diff --git a/qadevOOo/tests/java/ifc/text/_NumberingLevel.java b/qadevOOo/tests/java/ifc/text/_NumberingLevel.java index bc9a59442146..a23c7fbcb150 100644 --- a/qadevOOo/tests/java/ifc/text/_NumberingLevel.java +++ b/qadevOOo/tests/java/ifc/text/_NumberingLevel.java @@ -64,9 +64,9 @@ import com.sun.star.beans.PropertyValue; */ public class _NumberingLevel { - private static HashMap<String, Boolean> NumberingLevel = new HashMap<String,Boolean>(); - private static PropertyValue[] PropertyArray = null; - private static LogWriter log = null; + private HashMap<String, Boolean> NumberingLevel = new HashMap<String,Boolean>(); + private PropertyValue[] PropertyArray = null; + private LogWriter log = null; /** @@ -77,9 +77,9 @@ public class _NumberingLevel { */ public _NumberingLevel(LogWriter log, TestParameters tParam, PropertyValue[] propertyValues){ - _NumberingLevel.PropertyArray = propertyValues; + this.PropertyArray = propertyValues; - _NumberingLevel.log = log; + this.log = log; //key = PropertyName, value = Ooptional NumberingLevel.put("Adjust", Boolean.FALSE); diff --git a/qadevOOo/tests/java/mod/_acceptor/Acceptor.java b/qadevOOo/tests/java/mod/_acceptor/Acceptor.java index 67c479485abd..11b1a650df91 100644 --- a/qadevOOo/tests/java/mod/_acceptor/Acceptor.java +++ b/qadevOOo/tests/java/mod/_acceptor/Acceptor.java @@ -45,7 +45,7 @@ public class Acceptor extends TestCase { */ protected static final int basePort = 10000; private int curPort ; - private static String sOfficeHost = null ; + private String sOfficeHost = null ; /** * Retrieves host name where StarOffice is started from test diff --git a/ucb/qa/complex/tdoc/_XComponent.java b/ucb/qa/complex/tdoc/_XComponent.java index 13958ec51169..582b0d66904d 100644 --- a/ucb/qa/complex/tdoc/_XComponent.java +++ b/ucb/qa/complex/tdoc/_XComponent.java @@ -110,7 +110,7 @@ public class _XComponent { return true; } // finished _removeEventListener() - private static boolean disposed = false; + private boolean disposed = false; /** * Disposes the object and then check appropriate listeners were diff --git a/unoxml/qa/complex/unoxml/RDFRepositoryTest.java b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java index 754c21b6e388..ba2bdfd5ab9c 100644 --- a/unoxml/qa/complex/unoxml/RDFRepositoryTest.java +++ b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java @@ -75,7 +75,7 @@ public class RDFRepositoryTest /** * The test parameters */ - private static TestParameters param = null; + private TestParameters param = null; @Before public void before() { diff --git a/vcl/qa/complex/memCheck/CheckMemoryUsage.java b/vcl/qa/complex/memCheck/CheckMemoryUsage.java index 8d53afbcbc04..c37a017adb72 100644 --- a/vcl/qa/complex/memCheck/CheckMemoryUsage.java +++ b/vcl/qa/complex/memCheck/CheckMemoryUsage.java @@ -103,7 +103,7 @@ public class CheckMemoryUsage /** * The test parameters */ - private static TestParameters param = null; + private TestParameters param = null; /** * Collect all documents to load and all filters used for export. diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index 329dcea92d46..17eb4c098a26 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -34,10 +34,10 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi // ReportTextDocument CurReportDocument; IReportDocument CurReportDocument; - private static String sProgressDBConnection; - private static String sProgressDataImport; - private static String sProgressTitle; - private static String sStop; + private String sProgressDBConnection; + private String sProgressDataImport; + private String sProgressTitle; + private String sStop; public Dataimport(XMultiServiceFactory _xMSF) { |