summaryrefslogtreecommitdiff
path: root/qadevOOo/runner
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/runner
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/runner')
-rw-r--r--qadevOOo/runner/complexlib/ComplexTestCase.java19
-rw-r--r--qadevOOo/runner/convwatch/BorderRemover.java10
-rw-r--r--qadevOOo/runner/convwatch/ImageHelper.java7
-rw-r--r--qadevOOo/runner/graphical/ImageHelper.java7
-rw-r--r--qadevOOo/runner/graphical/ParameterHelper.java8
-rw-r--r--qadevOOo/runner/helper/ConfigHelper.java8
-rw-r--r--qadevOOo/runner/helper/StreamSimulator.java11
-rw-r--r--qadevOOo/runner/org/openoffice/Runner.java1
-rw-r--r--qadevOOo/runner/util/FrameDsc.java3
9 files changed, 28 insertions, 46 deletions
diff --git a/qadevOOo/runner/complexlib/ComplexTestCase.java b/qadevOOo/runner/complexlib/ComplexTestCase.java
index ff8b4fd7ad4d..2486692130bb 100644
--- a/qadevOOo/runner/complexlib/ComplexTestCase.java
+++ b/qadevOOo/runner/complexlib/ComplexTestCase.java
@@ -39,12 +39,6 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest
* The method name which will be written into f.e. the data base
**/
private String mTestMethodName = null;
- /** Maximal time one method is allowed to execute
- * Can be set with parameter 'ThreadTimeOut'
- **/
- private int m_nThreadTimeOut = 0;
-
-
private boolean m_bBeforeCalled;
@@ -90,10 +84,13 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest
private void test_method(DescEntry _entry)
{
- m_nThreadTimeOut = param.getInt("ThreadTimeOut");
- if (m_nThreadTimeOut == 0)
+ /* Maximal time one method is allowed to execute
+ * Can be set with parameter 'ThreadTimeOut'
+ **/
+ int nThreadTimeOut = param.getInt("ThreadTimeOut");
+ if (nThreadTimeOut == 0)
{
- m_nThreadTimeOut = 300000;
+ nThreadTimeOut = 300000;
}
for (int i = 0; i < _entry.SubEntries.length; i++)
@@ -153,7 +150,7 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest
int sleepingStep = 1000;
int factor = 0;
- while (th.isAlive() && (lastPing != newPing || factor * sleepingStep < m_nThreadTimeOut))
+ while (th.isAlive() && (lastPing != newPing || factor * sleepingStep < nThreadTimeOut))
{
Thread.sleep(sleepingStep);
factor++;
@@ -175,7 +172,7 @@ public abstract class ComplexTestCase extends Assurance implements ComplexTest
{
log.println("Destroy " + mTestMethodName);
th.stopRunning();
- subEntry.State = "Test did sleep for " + (m_nThreadTimeOut / 1000) + " seconds and has been killed!";
+ subEntry.State = "Test did sleep for " + (nThreadTimeOut / 1000) + " seconds and has been killed!";
subEntry.hasErrorMsg = true;
subEntry.ErrorMsg = subEntry.State;
continue;
diff --git a/qadevOOo/runner/convwatch/BorderRemover.java b/qadevOOo/runner/convwatch/BorderRemover.java
index 87ba90a42456..af7ee46a99bc 100644
--- a/qadevOOo/runner/convwatch/BorderRemover.java
+++ b/qadevOOo/runner/convwatch/BorderRemover.java
@@ -46,8 +46,6 @@ class Rect
class BorderRemover
{
- private ImageHelper m_aImage;
-
// Helper values, filled after find Border
// --------------------------------- test mode ---------------------------------
@@ -121,12 +119,12 @@ class BorderRemover
public boolean createNewImageWithoutBorder(String _sFilenameFrom, String _sFilenameTo)
throws java.io.IOException
{
- m_aImage = ImageHelper.createImageHelper(_sFilenameFrom);
+ ImageHelper aImageHelper = ImageHelper.createImageHelper(_sFilenameFrom);
- int nBorderColor = m_aImage.getPixel(0,0);
- Rect aInnerRect = findBorder(m_aImage, nBorderColor);
+ int nBorderColor = aImageHelper.getPixel(0,0);
+ Rect aInnerRect = findBorder(aImageHelper, nBorderColor);
- RenderedImage aImage = createImage(m_aImage, aInnerRect);
+ RenderedImage aImage = createImage(aImageHelper, aInnerRect);
File aWriteFile = new File(_sFilenameTo);
diff --git a/qadevOOo/runner/convwatch/ImageHelper.java b/qadevOOo/runner/convwatch/ImageHelper.java
index 914c70ef7a4f..2644223e2ebb 100644
--- a/qadevOOo/runner/convwatch/ImageHelper.java
+++ b/qadevOOo/runner/convwatch/ImageHelper.java
@@ -29,7 +29,6 @@ class ImageHelper
private Image m_aImage;
private int[] m_aPixels;
private int m_w = 0;
- private int m_h = 0;
private ImageHelper(Image _aImage)
@@ -38,11 +37,11 @@ class ImageHelper
// grab all (consume much memory)
m_w = getWidth();
- m_h = getHeight();
+ int h = getHeight();
int x = 0;
int y = 0;
- m_aPixels = new int[m_w * m_h];
- PixelGrabber pg = new PixelGrabber(m_aImage, x, y, m_w, m_h, m_aPixels, 0, m_w);
+ m_aPixels = new int[m_w * h];
+ PixelGrabber pg = new PixelGrabber(m_aImage, x, y, m_w, h, m_aPixels, 0, m_w);
try {
pg.grabPixels();
} catch (InterruptedException e) {
diff --git a/qadevOOo/runner/graphical/ImageHelper.java b/qadevOOo/runner/graphical/ImageHelper.java
index b1ec0ca649de..8f4249697192 100644
--- a/qadevOOo/runner/graphical/ImageHelper.java
+++ b/qadevOOo/runner/graphical/ImageHelper.java
@@ -29,7 +29,6 @@ class ImageHelper
private Image m_aImage;
private int[] m_aPixels;
private int m_w = 0;
- private int m_h = 0;
private ImageHelper(Image _aImage)
@@ -38,11 +37,11 @@ class ImageHelper
// grab all (consume much memory)
m_w = getWidth();
- m_h = getHeight();
+ int h = getHeight();
int x = 0;
int y = 0;
- m_aPixels = new int[m_w * m_h];
- PixelGrabber pg = new PixelGrabber(m_aImage, x, y, m_w, m_h, m_aPixels, 0, m_w);
+ m_aPixels = new int[m_w * h];
+ PixelGrabber pg = new PixelGrabber(m_aImage, x, y, m_w, h, m_aPixels, 0, m_w);
try
{
pg.grabPixels();
diff --git a/qadevOOo/runner/graphical/ParameterHelper.java b/qadevOOo/runner/graphical/ParameterHelper.java
index 4e028583ac4d..0f3c06d8aa83 100644
--- a/qadevOOo/runner/graphical/ParameterHelper.java
+++ b/qadevOOo/runner/graphical/ParameterHelper.java
@@ -69,8 +69,6 @@ public class ParameterHelper
private int m_nResolutionInDPI = 180;
- private boolean m_bIncludeSubdirectories;
-
private String m_sInputPath = null;
private String m_sOutputPath = null;
@@ -126,7 +124,7 @@ public class ParameterHelper
public boolean isIncludeSubDirectories()
{
- m_bIncludeSubdirectories = true;
+ boolean bIncludeSubdirectories = true;
String sRECURSIVE = (String)getTestParameters().get( PropertyName.DOC_COMPARATOR_INCLUDE_SUBDIRS );
// TODO: I need to get the boolean value with get("name") because, if it is not given getBool() returns
// with a default of 'false' which is not very helpful if the default should be 'true'
@@ -138,9 +136,9 @@ public class ParameterHelper
if (sRECURSIVE.equalsIgnoreCase("no") ||
sRECURSIVE.equalsIgnoreCase("false"))
{
- m_bIncludeSubdirectories = false;
+ bIncludeSubdirectories = false;
}
- return m_bIncludeSubdirectories;
+ return bIncludeSubdirectories;
}
public String getReferenceType()
diff --git a/qadevOOo/runner/helper/ConfigHelper.java b/qadevOOo/runner/helper/ConfigHelper.java
index cfa61a3bf15a..a373ce03d319 100644
--- a/qadevOOo/runner/helper/ConfigHelper.java
+++ b/qadevOOo/runner/helper/ConfigHelper.java
@@ -85,7 +85,6 @@ import com.sun.star.util.*;
*/
public class ConfigHelper
{
- private XMultiServiceFactory m_xSMGR = null;
private XHierarchicalNameAccess m_xConfig = null;
@@ -94,12 +93,9 @@ public class ConfigHelper
boolean bReadOnly )
throws com.sun.star.uno.Exception
{
- m_xSMGR = xSMGR;
-
XMultiServiceFactory xConfigRoot = UnoRuntime.queryInterface(
- XMultiServiceFactory.class,
- m_xSMGR.createInstance(
- "com.sun.star.configuration.ConfigurationProvider"));
+ XMultiServiceFactory.class,
+ xSMGR.createInstance("com.sun.star.configuration.ConfigurationProvider"));
PropertyValue[] lParams = new PropertyValue[1];
lParams[0] = new PropertyValue();
diff --git a/qadevOOo/runner/helper/StreamSimulator.java b/qadevOOo/runner/helper/StreamSimulator.java
index 7571ce6864cf..8e17e910b5bb 100644
--- a/qadevOOo/runner/helper/StreamSimulator.java
+++ b/qadevOOo/runner/helper/StreamSimulator.java
@@ -46,7 +46,6 @@ public class StreamSimulator implements com.sun.star.io.XInputStream ,
* @member m_bOutWasUsed indicates, that the output stream interface was used
*/
- private String m_sFileName ;
private com.sun.star.io.XInputStream m_xInStream ;
private com.sun.star.io.XOutputStream m_xOutStream ;
private com.sun.star.io.XSeekable m_xSeek ;
@@ -57,7 +56,7 @@ public class StreamSimulator implements com.sun.star.io.XInputStream ,
/**
* construct a new instance of this class
- * It set the name of the correspojnding file on disk, which
+ * It set the name of the corresponding file on disk, which
* should be source or target for the following operations on
* this object. And it regulate if it should function as
* input or output stream.
@@ -74,13 +73,11 @@ public class StreamSimulator implements com.sun.star.io.XInputStream ,
*
* @throw com.sun.star.io.NotConnectedException
* in case the internal streams to the file on disk couldn't established.
- * They are necessary. Otherwhise this simulator can't really work.
+ * They are necessary. Otherwise this simulator can't really work.
*/
public StreamSimulator( String sFileName , boolean bInput ,
lib.TestParameters param ) throws com.sun.star.io.NotConnectedException
{
- m_sFileName = sFileName ;
-
try
{
XSimpleFileAccess xHelper = UnoRuntime.queryInterface(XSimpleFileAccess.class,
@@ -91,14 +88,14 @@ public class StreamSimulator implements com.sun.star.io.XInputStream ,
if (bInput)
{
- m_xInStream = xHelper.openFileRead(m_sFileName);
+ m_xInStream = xHelper.openFileRead(sFileName);
m_xSeek = UnoRuntime.queryInterface(
com.sun.star.io.XSeekable.class,
m_xInStream);
}
else
{
- m_xOutStream = xHelper.openFileWrite(m_sFileName);
+ m_xOutStream = xHelper.openFileWrite(sFileName);
m_xSeek = UnoRuntime.queryInterface(
com.sun.star.io.XSeekable.class,
m_xOutStream);
diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java
index ff1bff4109b5..42b77674fb37 100644
--- a/qadevOOo/runner/org/openoffice/Runner.java
+++ b/qadevOOo/runner/org/openoffice/Runner.java
@@ -21,7 +21,6 @@ import helper.CfgParser;
import helper.ClParser;
import java.util.Enumeration;
-import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
diff --git a/qadevOOo/runner/util/FrameDsc.java b/qadevOOo/runner/util/FrameDsc.java
index 348cc8d5d3fb..644a2530c5e5 100644
--- a/qadevOOo/runner/util/FrameDsc.java
+++ b/qadevOOo/runner/util/FrameDsc.java
@@ -30,7 +30,6 @@ import com.sun.star.beans.XPropertySet;
*/
public class FrameDsc extends InstDescr {
- private Size size = null;
private int height = 2000;
private int width = 2000;
private String name = null;
@@ -77,7 +76,7 @@ public class FrameDsc extends InstDescr {
public XInterface createInstance( XMultiServiceFactory docMSF ) {
Object SrvObj = null;
- size = new Size();
+ Size size = new Size();
size.Height = height;
size.Width = width;