Kaydet (Commit) 2d82619a authored tarafından Noel Grandin's avatar Noel Grandin

java: static fields that should not be static

Found by FindBugs.

Change-Id: I223841f7bb8c515c9612322abc0b13e134385abd
üst 0ae24c21
...@@ -50,7 +50,7 @@ public class DBaseDriverTest extends ComplexTestCase implements TestCase ...@@ -50,7 +50,7 @@ public class DBaseDriverTest extends ComplexTestCase implements TestCase
public LogWriter getLog() public LogWriter getLog()
{ {
return ComplexTestCase.log; return log;
} }
public void Functions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException public void Functions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
......
...@@ -71,7 +71,7 @@ import static org.junit.Assert.*; ...@@ -71,7 +71,7 @@ import static org.junit.Assert.*;
public class FinalizedMandatoryTest public class FinalizedMandatoryTest
{ {
static XMultiServiceFactory xMSF; XMultiServiceFactory xMSF;
/** Create the environment for following tests. /** Create the environment for following tests.
* Use either a component loader from desktop or * Use either a component loader from desktop or
......
...@@ -35,7 +35,7 @@ import static org.junit.Assert.*; ...@@ -35,7 +35,7 @@ import static org.junit.Assert.*;
public class TypeDetection6FileFormat public class TypeDetection6FileFormat
{ {
static XMultiServiceFactory xMSF; XMultiServiceFactory xMSF;
/** Create the environment for following tests. /** Create the environment for following tests.
* Use either a component loader from desktop or * Use either a component loader from desktop or
......
...@@ -50,7 +50,7 @@ public class CheckAPI { ...@@ -50,7 +50,7 @@ public class CheckAPI {
/** /**
* The test parameters * The test parameters
*/ */
private static TestParameters param = null; private TestParameters param = null;
/** /**
* *
......
...@@ -49,7 +49,7 @@ public class CheckImageManager { ...@@ -49,7 +49,7 @@ public class CheckImageManager {
/** /**
* The test parameters * The test parameters
*/ */
private static TestParameters param = null; private TestParameters param = null;
@Before public void before() @Before public void before()
{ {
......
...@@ -38,7 +38,7 @@ import lib.TestParameters; ...@@ -38,7 +38,7 @@ import lib.TestParameters;
*/ */
public class _XComponent { public class _XComponent {
private static XComponent oObj = null; private XComponent oObj = null;
private XComponent altDispose = null; private XComponent altDispose = null;
private final TestParameters tEnv; private final TestParameters tEnv;
private boolean listenerDisposed[] = new boolean[2]; private boolean listenerDisposed[] = new boolean[2];
...@@ -66,7 +66,7 @@ public class _XComponent { ...@@ -66,7 +66,7 @@ public class _XComponent {
public _XComponent(TestParameters tEnv, XComponent oObj) { public _XComponent(TestParameters tEnv, XComponent oObj) {
this.tEnv = tEnv; this.tEnv = tEnv;
_XComponent.oObj = oObj; this.oObj = oObj;
} }
/** /**
...@@ -115,7 +115,7 @@ public class _XComponent { ...@@ -115,7 +115,7 @@ public class _XComponent {
return true; return true;
} // finished _removeEventListener() } // finished _removeEventListener()
private static boolean disposed = false; private boolean disposed = false;
/** /**
* Disposes the object and then check appropriate listeners were * Disposes the object and then check appropriate listeners were
......
...@@ -41,12 +41,12 @@ public class _XInitialization { ...@@ -41,12 +41,12 @@ public class _XInitialization {
private final TestParameters tEnv; private final TestParameters tEnv;
private static XInitialization oObj = null; private XInitialization oObj = null;
public _XInitialization(TestParameters tEnv, XInitialization oObj) { public _XInitialization(TestParameters tEnv, XInitialization oObj) {
this.tEnv = tEnv; this.tEnv = tEnv;
_XInitialization.oObj = oObj; this.oObj = oObj;
} }
/** /**
......
...@@ -38,11 +38,10 @@ public class _XTypeProvider { ...@@ -38,11 +38,10 @@ public class _XTypeProvider {
private static XTypeProvider oObj = null; private XTypeProvider oObj = null;
private static Type[] types = null;
public _XTypeProvider(TestParameters tEnv, XTypeProvider oObj) { public _XTypeProvider(TestParameters tEnv, XTypeProvider oObj) {
_XTypeProvider.oObj = oObj; this.oObj = oObj;
} }
/** /**
...@@ -69,7 +68,7 @@ public class _XTypeProvider { ...@@ -69,7 +68,7 @@ public class _XTypeProvider {
public boolean _getTypes() { public boolean _getTypes() {
boolean result = false; boolean result = false;
System.out.println("getting Types..."); System.out.println("getting Types...");
types = oObj.getTypes(); Type[] types = oObj.getTypes();
for (int i=0;i<types.length;i++) { for (int i=0;i<types.length;i++) {
int k = i+1; int k = i+1;
System.out.println(k+". Type is "+types[i].toString()); System.out.println(k+". Type is "+types[i].toString());
......
...@@ -38,7 +38,7 @@ import com.sun.star.util.XStringSubstitution; ...@@ -38,7 +38,7 @@ import com.sun.star.util.XStringSubstitution;
public class PathSubstitutionTest public class PathSubstitutionTest
{ {
private static XMultiServiceFactory xMSF; private XMultiServiceFactory xMSF;
// all substitution variables // all substitution variables
private VariableContainer substVars = null; private VariableContainer substVars = null;
......
...@@ -45,10 +45,10 @@ import com.sun.star.lang.XMultiServiceFactory; ...@@ -45,10 +45,10 @@ import com.sun.star.lang.XMultiServiceFactory;
public class java_fat implements TestBase public class java_fat implements TestBase
{ {
private static boolean m_isDebug = false; private boolean m_isDebug = false;
private static boolean keepdocument = false; private boolean keepdocument = false;
private static boolean logging = true; private boolean logging = true;
private static boolean newOffice = false; private boolean newOffice = false;
private DynamicClassLoader m_aDynamicClassLoader = null; private DynamicClassLoader m_aDynamicClassLoader = null;
private lib.TestParameters m_aParams; private lib.TestParameters m_aParams;
......
...@@ -32,9 +32,9 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest ...@@ -32,9 +32,9 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest
{ {
/** The test parameters **/ /** The test parameters **/
protected static TestParameters param = null; protected TestParameters param = null;
/** Log writer **/ /** Log writer **/
protected static LogWriter log = null; protected LogWriter log = null;
/** /**
* The method name which will be written into f.e. the data base * The method name which will be written into f.e. the data base
**/ **/
......
...@@ -24,18 +24,18 @@ import java.io.StringWriter; ...@@ -24,18 +24,18 @@ import java.io.StringWriter;
* Write all logs into a java.io.PrintWriter, i.e. a StringBuffer. * Write all logs into a java.io.PrintWriter, i.e. a StringBuffer.
* Log is gathered there. * Log is gathered there.
*/ */
public class InternalLogWriter extends PrintWriter public class InternalLogWriter implements share.LogWriter {
implements share.LogWriter {
/** log active **/ /** log active **/
private boolean active; private boolean active;
/** write all output to a StringBuffer **/ /** write all output to a StringBuffer **/
private static StringWriter writer = new StringWriter(); private StringWriter writer = new StringWriter();
private PrintWriter printWriter;
/** /**
* c'*tor * c'*tor
*/ */
public InternalLogWriter() { public InternalLogWriter() {
super(new PrintWriter(writer)); printWriter = new PrintWriter(writer);
active = true; active = true;
} }
...@@ -54,21 +54,9 @@ public class InternalLogWriter extends PrintWriter ...@@ -54,21 +54,9 @@ public class InternalLogWriter extends PrintWriter
* Method to print a line that is added to the StringBuffer. * Method to print a line that is added to the StringBuffer.
* @param msg The message that is printed. * @param msg The message that is printed.
*/ */
@Override
public void println(String msg) { public void println(String msg) {
if (active) if (active)
super.println(msg); printWriter.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);
} }
/** /**
...@@ -80,17 +68,17 @@ public class InternalLogWriter extends PrintWriter ...@@ -80,17 +68,17 @@ public class InternalLogWriter extends PrintWriter
public boolean summary(share.DescEntry entry) { public boolean summary(share.DescEntry entry) {
// linePrefix = ""; // linePrefix = "";
String header = "***** State for "+entry.longName+" ******"; String header = "***** State for "+entry.longName+" ******";
println(header); printWriter.println(header);
if (entry.hasErrorMsg) { if (entry.hasErrorMsg) {
println(entry.ErrorMsg); printWriter.println(entry.ErrorMsg);
println("Whole "+entry.EntryType+": "+entry.State); printWriter.println("Whole "+entry.EntryType+": "+entry.State);
} else { } else {
println("Whole "+entry.EntryType+": "+entry.State); printWriter.println("Whole "+entry.EntryType+": "+entry.State);
} }
for (int i=0;i<header.length();i++) { for (int i=0;i<header.length();i++) {
print("*"); printWriter.print("*");
} }
println(""); printWriter.println("");
return true; return true;
} }
......
...@@ -29,8 +29,8 @@ import com.sun.star.uno.UnoRuntime; ...@@ -29,8 +29,8 @@ import com.sun.star.uno.UnoRuntime;
public class _XEventBroadcaster extends MultiMethodTest { public class _XEventBroadcaster extends MultiMethodTest {
public XEventBroadcaster oObj; public XEventBroadcaster oObj;
protected static boolean listenerCalled=false; protected boolean listenerCalled = false;
private static XEventListener listener=null; private XEventListener listener = null;
public class MyEventListener implements XEventListener { public class MyEventListener implements XEventListener {
......
...@@ -113,7 +113,7 @@ public class _XComponent extends MultiMethodTest { ...@@ -113,7 +113,7 @@ public class _XComponent extends MultiMethodTest {
log.println(Thread.currentThread() + " is removing EL " + listener2); log.println(Thread.currentThread() + " is removing EL " + listener2);
} // finished _removeEventListener() } // finished _removeEventListener()
static boolean disposed = false; boolean disposed = false;
/** /**
* Disposes the object and then check appropriate listeners were * Disposes the object and then check appropriate listeners were
......
...@@ -33,14 +33,13 @@ import lib.MultiMethodTest; ...@@ -33,14 +33,13 @@ import lib.MultiMethodTest;
public class _XAvailableLocales extends MultiMethodTest { public class _XAvailableLocales extends MultiMethodTest {
public XAvailableLocales oObj = null; public XAvailableLocales oObj = null;
public static Locale[] locales = new Locale[0];
/** /**
* Test calls the method, stores returned value and checks it. <p> * 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> * Has <b> OK </b> status if length of returned array isn't zero. <p>
*/ */
public void _getAvailableLocales() { 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); tRes.tested("getAvailableLocales()", locales.length > 0);
} }
......
...@@ -35,7 +35,7 @@ import com.sun.star.linguistic2.XSupportedLocales; ...@@ -35,7 +35,7 @@ import com.sun.star.linguistic2.XSupportedLocales;
public class _XSupportedLocales extends MultiMethodTest { public class _XSupportedLocales extends MultiMethodTest {
public XSupportedLocales oObj = null; 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> * Test calls the method, stores returned value and checks it. <p>
......
...@@ -54,8 +54,7 @@ import com.sun.star.uno.UnoRuntime; ...@@ -54,8 +54,7 @@ import com.sun.star.uno.UnoRuntime;
*/ */
public class _XCellCursor extends MultiMethodTest { public class _XCellCursor extends MultiMethodTest {
public static XCellCursor oObj = null; public XCellCursor oObj = null;
public static XSpreadsheet oSheet = null;
/** /**
* <code>XCellRangeAddressable</code> interface is queried * <code>XCellRangeAddressable</code> interface is queried
...@@ -174,7 +173,7 @@ public class _XCellCursor extends MultiMethodTest { ...@@ -174,7 +173,7 @@ public class _XCellCursor extends MultiMethodTest {
*/ */
public void _gotoEnd(){ public void _gotoEnd(){
//gotoEnd gets it's own cursor to see a change //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") ; XCellRange testRange = oSheet.getCellRangeByName("$A$1:$g$7") ;
XSheetCellRange testSheetRange = UnoRuntime.queryInterface(XSheetCellRange.class,testRange); XSheetCellRange testSheetRange = UnoRuntime.queryInterface(XSheetCellRange.class,testRange);
XSheetCellCursor oCellCursor = oSheet.createCursorByRange XSheetCellCursor oCellCursor = oSheet.createCursorByRange
......
...@@ -64,9 +64,9 @@ import com.sun.star.beans.PropertyValue; ...@@ -64,9 +64,9 @@ import com.sun.star.beans.PropertyValue;
*/ */
public class _NumberingLevel { public class _NumberingLevel {
private static HashMap<String, Boolean> NumberingLevel = new HashMap<String,Boolean>(); private HashMap<String, Boolean> NumberingLevel = new HashMap<String,Boolean>();
private static PropertyValue[] PropertyArray = null; private PropertyValue[] PropertyArray = null;
private static LogWriter log = null; private LogWriter log = null;
/** /**
...@@ -77,9 +77,9 @@ public class _NumberingLevel { ...@@ -77,9 +77,9 @@ public class _NumberingLevel {
*/ */
public _NumberingLevel(LogWriter log, TestParameters tParam, PropertyValue[] propertyValues){ public _NumberingLevel(LogWriter log, TestParameters tParam, PropertyValue[] propertyValues){
_NumberingLevel.PropertyArray = propertyValues; this.PropertyArray = propertyValues;
_NumberingLevel.log = log; this.log = log;
//key = PropertyName, value = Ooptional //key = PropertyName, value = Ooptional
NumberingLevel.put("Adjust", Boolean.FALSE); NumberingLevel.put("Adjust", Boolean.FALSE);
......
...@@ -45,7 +45,7 @@ public class Acceptor extends TestCase { ...@@ -45,7 +45,7 @@ public class Acceptor extends TestCase {
*/ */
protected static final int basePort = 10000; protected static final int basePort = 10000;
private int curPort ; private int curPort ;
private static String sOfficeHost = null ; private String sOfficeHost = null ;
/** /**
* Retrieves host name where StarOffice is started from test * Retrieves host name where StarOffice is started from test
......
...@@ -110,7 +110,7 @@ public class _XComponent { ...@@ -110,7 +110,7 @@ public class _XComponent {
return true; return true;
} // finished _removeEventListener() } // finished _removeEventListener()
private static boolean disposed = false; private boolean disposed = false;
/** /**
* Disposes the object and then check appropriate listeners were * Disposes the object and then check appropriate listeners were
......
...@@ -75,7 +75,7 @@ public class RDFRepositoryTest ...@@ -75,7 +75,7 @@ public class RDFRepositoryTest
/** /**
* The test parameters * The test parameters
*/ */
private static TestParameters param = null; private TestParameters param = null;
@Before public void before() @Before public void before()
{ {
......
...@@ -103,7 +103,7 @@ public class CheckMemoryUsage ...@@ -103,7 +103,7 @@ public class CheckMemoryUsage
/** /**
* The test parameters * The test parameters
*/ */
private static TestParameters param = null; private TestParameters param = null;
/** /**
* Collect all documents to load and all filters used for export. * Collect all documents to load and all filters used for export.
......
...@@ -34,10 +34,10 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi ...@@ -34,10 +34,10 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
// ReportTextDocument CurReportDocument; // ReportTextDocument CurReportDocument;
IReportDocument CurReportDocument; IReportDocument CurReportDocument;
private static String sProgressDBConnection; private String sProgressDBConnection;
private static String sProgressDataImport; private String sProgressDataImport;
private static String sProgressTitle; private String sProgressTitle;
private static String sStop; private String sStop;
public Dataimport(XMultiServiceFactory _xMSF) public Dataimport(XMultiServiceFactory _xMSF)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment