summaryrefslogtreecommitdiff
path: root/qadevOOo/tests
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-12 09:55:57 +0200
committerNoel Grandin <noelgrandin@gmail.com>2014-11-12 11:03:29 +0000
commitbb437029c1e5331bcc3f8fb2fc87837142a52f33 (patch)
tree56bde4059792a5284e90ae3b10ee4388cc913a54 /qadevOOo/tests
parent84f7f412bfc9e18b1ff8b133ceda7757eae28c36 (diff)
java: convert fields to local variables where possible
found by PMD Change-Id: I05b45382b8fb1b734657ce9421a20e6ef6fbe542 Reviewed-on: https://gerrit.libreoffice.org/12376 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'qadevOOo/tests')
-rw-r--r--qadevOOo/tests/java/ifc/frame/_XSynchronousFrameLoader.java3
-rw-r--r--qadevOOo/tests/java/ifc/i18n/_XCollator.java3
-rw-r--r--qadevOOo/tests/java/ifc/i18n/_XTransliteration.java3
-rw-r--r--qadevOOo/tests/java/ifc/io/_XObjectInputStream.java5
-rw-r--r--qadevOOo/tests/java/ifc/ucb/_XCachedDynamicResultSetStubFactory.java3
-rw-r--r--qadevOOo/tests/java/ifc/ui/dialogs/_XControlAccess.java3
-rw-r--r--qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java6
-rw-r--r--qadevOOo/tests/java/mod/_dbaccess/ORowSet.java9
-rw-r--r--qadevOOo/tests/java/mod/_forms/GenericModelTest.java9
9 files changed, 17 insertions, 27 deletions
diff --git a/qadevOOo/tests/java/ifc/frame/_XSynchronousFrameLoader.java b/qadevOOo/tests/java/ifc/frame/_XSynchronousFrameLoader.java
index 2151d77957ba..109dfa5fbb4b 100644
--- a/qadevOOo/tests/java/ifc/frame/_XSynchronousFrameLoader.java
+++ b/qadevOOo/tests/java/ifc/frame/_XSynchronousFrameLoader.java
@@ -55,7 +55,6 @@ import com.sun.star.util.XURLTransformer;
public class _XSynchronousFrameLoader extends MultiMethodTest {
public XSynchronousFrameLoader oObj = null; // oObj filled by MultiMethodTest
- private String url = null ;
private XFrame frame = null ;
private XComponent frameSup = null ;
private PropertyValue[] descr = null;
@@ -72,7 +71,7 @@ public class _XSynchronousFrameLoader extends MultiMethodTest {
*/
@Override
public void before() {
- url = (String) tEnv.getObjRelation("FrameLoader.URL") ;
+ String url = (String) tEnv.getObjRelation("FrameLoader.URL") ;
frame = (XFrame) tEnv.getObjRelation("FrameLoader.Frame") ;
if (url == null) {
diff --git a/qadevOOo/tests/java/ifc/i18n/_XCollator.java b/qadevOOo/tests/java/ifc/i18n/_XCollator.java
index e47e6a7f7166..48a3d7f50204 100644
--- a/qadevOOo/tests/java/ifc/i18n/_XCollator.java
+++ b/qadevOOo/tests/java/ifc/i18n/_XCollator.java
@@ -44,7 +44,6 @@ import com.sun.star.lang.Locale;
public class _XCollator extends MultiMethodTest {
public XCollator oObj = null;
private String[] alg = null ;
- private int[] opt = null ;
Locale loc = new Locale("en", "EN", "");
/**
@@ -75,7 +74,7 @@ public class _XCollator extends MultiMethodTest {
*/
public void _listCollatorOptions() {
requiredMethod("listCollatorAlgorithms()") ;
- opt = oObj.listCollatorOptions(alg[0]) ;
+ int[] opt = oObj.listCollatorOptions(alg[0]) ;
log.println("Collator '" + alg[0] + "' options :");
if (opt != null) {
for (int i = 0; i < opt.length; i++) {
diff --git a/qadevOOo/tests/java/ifc/i18n/_XTransliteration.java b/qadevOOo/tests/java/ifc/i18n/_XTransliteration.java
index 055f9c43fa66..17991b1429fe 100644
--- a/qadevOOo/tests/java/ifc/i18n/_XTransliteration.java
+++ b/qadevOOo/tests/java/ifc/i18n/_XTransliteration.java
@@ -48,7 +48,6 @@ import com.sun.star.lang.Locale;
public class _XTransliteration extends MultiMethodTest {
public XTransliteration oObj = null;
- private String[] mod = null ;
private Locale loc = new Locale("en", "EN", "") ;
/**
@@ -57,7 +56,7 @@ public class _XTransliteration extends MultiMethodTest {
* one module name.
*/
public void _getAvailableModules() {
- mod = oObj.getAvailableModules(loc, TransliterationType.ONE_TO_ONE);
+ String[] mod = oObj.getAvailableModules(loc, TransliterationType.ONE_TO_ONE);
if (mod != null) {
log.println("Available modules :") ;
diff --git a/qadevOOo/tests/java/ifc/io/_XObjectInputStream.java b/qadevOOo/tests/java/ifc/io/_XObjectInputStream.java
index 197a97086629..5f55f0b778d2 100644
--- a/qadevOOo/tests/java/ifc/io/_XObjectInputStream.java
+++ b/qadevOOo/tests/java/ifc/io/_XObjectInputStream.java
@@ -47,8 +47,6 @@ import com.sun.star.uno.UnoRuntime;
public class _XObjectInputStream extends MultiMethodTest {
public XObjectInputStream oObj = null;
- private Object objRead = null ;
- private Object objWrite = null ;
/**
* Test reads perisist object from stream and compares properties
@@ -58,7 +56,7 @@ public class _XObjectInputStream extends MultiMethodTest {
* of objects properties are equal. <p>
*/
public void _readObject() {
- objWrite = tEnv.getObjRelation("PersistObject") ;
+ Object objWrite = tEnv.getObjRelation("PersistObject") ;
if (objWrite == null) {
log.println("PersistObject not found in relations") ;
tRes.tested("readObject()", false) ;
@@ -77,6 +75,7 @@ public class _XObjectInputStream extends MultiMethodTest {
return;
}
+ Object objRead = null ;
try {
objRead = oObj.readObject() ;
} catch(com.sun.star.io.IOException e) {
diff --git a/qadevOOo/tests/java/ifc/ucb/_XCachedDynamicResultSetStubFactory.java b/qadevOOo/tests/java/ifc/ucb/_XCachedDynamicResultSetStubFactory.java
index 5d12bc102acd..41e8ff16917f 100644
--- a/qadevOOo/tests/java/ifc/ucb/_XCachedDynamicResultSetStubFactory.java
+++ b/qadevOOo/tests/java/ifc/ucb/_XCachedDynamicResultSetStubFactory.java
@@ -52,7 +52,6 @@ public class _XCachedDynamicResultSetStubFactory extends MultiMethodTest {
*/
public XCachedDynamicResultSetStubFactory oObj;
private XDynamicResultSet resSet = null ;
- private XDynamicResultSet resSetStub = null ;
/**
* Retrieves object relation.
@@ -77,7 +76,7 @@ public class _XCachedDynamicResultSetStubFactory extends MultiMethodTest {
public void _createCachedDynamicResultSetStub() {
boolean result = true ;
- resSetStub = oObj.createCachedDynamicResultSetStub(resSet) ;
+ XDynamicResultSet resSetStub = oObj.createCachedDynamicResultSetStub(resSet) ;
if (resSetStub == null) {
log.println("!!! Method returned null !!!") ;
diff --git a/qadevOOo/tests/java/ifc/ui/dialogs/_XControlAccess.java b/qadevOOo/tests/java/ifc/ui/dialogs/_XControlAccess.java
index 7d6bf621d2aa..e290ab4d9191 100644
--- a/qadevOOo/tests/java/ifc/ui/dialogs/_XControlAccess.java
+++ b/qadevOOo/tests/java/ifc/ui/dialogs/_XControlAccess.java
@@ -44,7 +44,6 @@ import com.sun.star.uno.UnoRuntime;
public class _XControlAccess extends MultiMethodTest {
public XControlAccess oObj = null;
- private XControlInformation xCI = null ;
private String[] supControls = null ;
private String[][] supProperties = null ;
@@ -58,7 +57,7 @@ public class _XControlAccess extends MultiMethodTest {
*/
@Override
protected void before() {
- xCI = UnoRuntime.queryInterface
+ XControlInformation xCI = UnoRuntime.queryInterface
(XControlInformation.class, oObj);
if (xCI == null) throw new StatusException
diff --git a/qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java b/qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java
index d27ad7b96001..bff1ecdf22c7 100644
--- a/qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java
+++ b/qadevOOo/tests/java/mod/_dbaccess/ODatabaseSource.java
@@ -78,8 +78,6 @@ public class ODatabaseSource extends TestCase {
private static int uniqueSuffixStat = 0 ;
private int uniqueSuffix = 0 ;
- private XNamingService xDBContextNameServ = null ;
- private String databaseName = null ;
private XOfficeDatabaseDocument xDBDoc = null;
/**
@@ -136,7 +134,7 @@ public class ODatabaseSource extends TestCase {
throw new StatusException("Service not available", e) ;
}
- xDBContextNameServ = UnoRuntime.queryInterface(XNamingService.class, oInterface) ;
+ XNamingService xDBContextNameServ = UnoRuntime.queryInterface(XNamingService.class, oInterface) ;
// retrieving temp directory for database
String tmpDatabaseUrl = utils.getOfficeTempDir(Param.getMSF());
@@ -179,7 +177,7 @@ public class ODatabaseSource extends TestCase {
throw new StatusException("Could not set property 'URL' ", e) ;
}
- databaseName = "NewDatabaseSource" + uniqueSuffix ;
+ String databaseName = "NewDatabaseSource" + uniqueSuffix ;
// make sure that the DatabaseContext isn't already registered
try {
diff --git a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
index dbb72469ea0a..5a6d42c972b5 100644
--- a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
+++ b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
@@ -134,7 +134,6 @@ public class ORowSet extends TestCase {
private Object m_rowSet = null;
private DataSource m_dataSource;
private String m_tableFile;
- private XMultiServiceFactory m_orb = null;
/**
* Initializes some class fields. Then creates DataSource, which serves
@@ -160,13 +159,13 @@ public class ORowSet extends TestCase {
protected void initialize ( TestParameters Param, PrintWriter _log)
throws StatusException
{
- m_orb = Param.getMSF();
+ XMultiServiceFactory orb = Param.getMSF();
- String tmpDir = utils.getOfficeTemp( m_orb );
+ String tmpDir = utils.getOfficeTemp( orb );
origDB = util.utils.getFullTestDocName("TestDB/testDB.dbf");
- dbTools = new DBTools( m_orb );
+ dbTools = new DBTools( orb );
// creating DataSource and registering it in DatabaseContext
String dbURL = (String) Param.get("test.db.url");
@@ -174,7 +173,7 @@ public class ORowSet extends TestCase {
String dbPassword = (String) Param.get("test.db.password");
log.println("Creating and registering DataSource ...");
- srcInf = new DataSourceDescriptor( m_orb );
+ srcInf = new DataSourceDescriptor( orb );
if (dbURL != null && dbUser != null && dbPassword != null)
{
isMySQLDB = true;
diff --git a/qadevOOo/tests/java/mod/_forms/GenericModelTest.java b/qadevOOo/tests/java/mod/_forms/GenericModelTest.java
index 26d38a8a6719..ed7ba409d2ed 100644
--- a/qadevOOo/tests/java/mod/_forms/GenericModelTest.java
+++ b/qadevOOo/tests/java/mod/_forms/GenericModelTest.java
@@ -126,7 +126,6 @@ import util.utils;
public class GenericModelTest extends TestCase {
private XTextDocument m_xTextDoc;
private Object m_dbSrc = null;
- private DBTools.DataSourceInfo m_srcInf = null;
/**
* This is the name of the Data Base which the test uses: "APITestDatabase"
*/
@@ -403,11 +402,11 @@ public class GenericModelTest extends TestCase {
m_dbTools = new DBTools( xMSF );
String tmpDir = utils.getOfficeTemp((xMSF));
- m_srcInf = m_dbTools.newDataSourceInfo();
- m_srcInf.URL = "sdbc:dbase:" + DBTools.dirToUrl(tmpDir);
- log.println("data source: " + m_srcInf.URL);
+ DBTools.DataSourceInfo srcInf = m_dbTools.newDataSourceInfo();
+ srcInf.URL = "sdbc:dbase:" + DBTools.dirToUrl(tmpDir);
+ log.println("data source: " + srcInf.URL);
- m_dbSrc = m_srcInf.getDataSourceService();
+ m_dbSrc = srcInf.getDataSourceService();
m_dbTools.reRegisterDB(m_dbSourceName, m_dbSrc);
m_XFormLoader = FormTools.bindForm(m_xTextDoc, m_dbSourceName,