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
public LogWriter getLog()
{
return ComplexTestCase.log;
return log;
}
public void Functions() throws com.sun.star.uno.Exception, com.sun.star.beans.UnknownPropertyException
......
......@@ -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
......
......@@ -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
......
......@@ -50,7 +50,7 @@ public class CheckAPI {
/**
* The test parameters
*/
private static TestParameters param = null;
private TestParameters param = null;
/**
*
......
......@@ -49,7 +49,7 @@ public class CheckImageManager {
/**
* The test parameters
*/
private static TestParameters param = null;
private TestParameters param = null;
@Before public void before()
{
......
......@@ -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
......
......@@ -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;
}
/**
......
......@@ -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());
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
**/
......
......@@ -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;
}
......
......@@ -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 {
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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>
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -75,7 +75,7 @@ public class RDFRepositoryTest
/**
* The test parameters
*/
private static TestParameters param = null;
private TestParameters param = null;
@Before public void before()
{
......
......@@ -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.
......
......@@ -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)
{
......
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