[Libreoffice-commits] core.git: qadevOOo/runner qadevOOo/tests
Caolán McNamara
caolanm at redhat.com
Sat Dec 19 07:55:15 PST 2015
qadevOOo/runner/helper/OfficeProvider.java | 30 +++++++------
qadevOOo/runner/util/db/DataSource.java | 8 ++-
qadevOOo/tests/java/ifc/view/_XPrintJobBroadcaster.java | 8 ++-
qadevOOo/tests/java/mod/_dbaccess/ORowSet.java | 5 +-
qadevOOo/tests/java/mod/_defreg/NestedRegistry.java | 13 ++++-
qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java | 13 ++++-
qadevOOo/tests/java/mod/_sc/ScModelObj.java | 5 +-
qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java | 5 +-
qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java | 14 +++++-
qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java | 16 +++++-
10 files changed, 88 insertions(+), 29 deletions(-)
New commits:
commit 69fd971e684779bd7e500333a7c7d3814fffd111
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Dec 19 15:24:48 2015 +0000
coverity#1326953 RV: Bad use of return value
and
coverity#1326954 RV: Bad use of return value
coverity#1326955 RV: Bad use of return value
coverity#1326956 RV: Bad use of return value
coverity#1326957 RV: Bad use of return value
coverity#1326958 RV: Bad use of return value
coverity#1326959 RV: Bad use of return value
coverity#1326960 RV: Bad use of return value
coverity#1326961 RV: Bad use of return value
coverity#1326962 RV: Bad use of return value
Change-Id: I02c2f7a5214e348f06a12b78a9400d8501b00e57
diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java
index 6d03e5d..62ac34f 100644
--- a/qadevOOo/runner/helper/OfficeProvider.java
+++ b/qadevOOo/runner/helper/OfficeProvider.java
@@ -738,21 +738,27 @@ public class OfficeProvider implements AppProvider
}
}
-private void deleteFilesAndDirector(File file)
+ private void deleteFilesAndDirector(File file)
+ {
+ File f = file;
+ if(f.isDirectory())
{
- File f = file;
- if(f.isDirectory())
+ File files[] = f.listFiles();
+ for(int i = 0; i < files.length; i++)
{
- File files[] = f.listFiles();
- for(int i = 0; i < files.length; i++)
- {
- deleteFilesAndDirector(files[i]);
- }
- f.delete();
+ deleteFilesAndDirector(files[i]);
}
- else if (f.isFile())
- {
- f.delete();
+ boolean bDeleteOk = f.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
}
}
+ else if (f.isFile())
+ {
+ boolean bDeleteOk = f.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
+ }
+ }
}
diff --git a/qadevOOo/runner/util/db/DataSource.java b/qadevOOo/runner/util/db/DataSource.java
index e2fdcb9..b9f41c3 100644
--- a/qadevOOo/runner/util/db/DataSource.java
+++ b/qadevOOo/runner/util/db/DataSource.java
@@ -113,11 +113,15 @@ public class DataSource
if ( docURL.length() == 0 )
{
final java.io.File tempFile = java.io.File.createTempFile( _registrationName + "_", ".odb" );
- if ( tempFile.exists() )
+ if ( tempFile.exists() ) {
// we did not really want to create that file, we just wanted its local name, but
// createTempFile actually creates it => throw it away
// (This is necessary since some JVM/platform combinations seem to actually lock the file)
- tempFile.delete();
+ boolean bDeleteOk = tempFile.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
+ }
String localPart = tempFile.toURI().toURL().toString();
localPart = localPart.substring( localPart.lastIndexOf( '/' ) + 1 );
docURL = util.utils.getOfficeTemp( m_orb ) + localPart;
diff --git a/qadevOOo/tests/java/ifc/view/_XPrintJobBroadcaster.java b/qadevOOo/tests/java/ifc/view/_XPrintJobBroadcaster.java
index 8a5d12c..99d30f9 100644
--- a/qadevOOo/tests/java/ifc/view/_XPrintJobBroadcaster.java
+++ b/qadevOOo/tests/java/ifc/view/_XPrintJobBroadcaster.java
@@ -120,8 +120,12 @@ public class _XPrintJobBroadcaster extends MultiMethodTest {
public void reset() {
File f = new File(printFileName);
- if (f.exists())
- f.delete();
+ if (f.exists()) {
+ boolean bDeleteOk = f.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
+ }
eventCalled = false;
}
diff --git a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
index a22333bb..1e86ccbd 100644
--- a/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
+++ b/qadevOOo/tests/java/mod/_dbaccess/ORowSet.java
@@ -522,8 +522,9 @@ public class ORowSet extends TestCase {
private final void impl_deleteFile( final String _file )
{
java.io.File file = new java.io.File( _file );
- file.delete();
- if ( file.exists() )
+
+ boolean bDeleteOk = file.delete();
+ if (!bDeleteOk && file.exists())
file.deleteOnExit();
}
diff --git a/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java b/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java
index efd3b33..ab13aa4 100644
--- a/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java
+++ b/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java
@@ -88,8 +88,17 @@ public class NestedRegistry extends TestCase {
File srcF = new File(src) ;
File dstF = new File(dst) ;
- if (dstF.exists()) dstF.delete() ;
- dstF.createNewFile() ;
+ if (dstF.exists()) {
+ boolean bDeleteOk = dstF.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
+ }
+
+ boolean bCreateOk = dstF.createNewFile();
+ if (!bCreateOk) {
+ System.out.println("create failed");
+ }
dstF.deleteOnExit() ;
diff --git a/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java b/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java
index 3790f94..d31137d 100644
--- a/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java
+++ b/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java
@@ -85,8 +85,17 @@ public class NestedRegistry extends TestCase {
File srcF = new File(src) ;
File dstF = new File(dst) ;
- if (dstF.exists()) dstF.delete() ;
- dstF.createNewFile() ;
+ if (dstF.exists()) {
+ boolean bDeleteOk = dstF.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
+ }
+
+ boolean bCreateOk = dstF.createNewFile() ;
+ if (!bCreateOk) {
+ System.out.println("create failed");
+ }
dstF.deleteOnExit() ;
diff --git a/qadevOOo/tests/java/mod/_sc/ScModelObj.java b/qadevOOo/tests/java/mod/_sc/ScModelObj.java
index f7e8970..7a17e82 100644
--- a/qadevOOo/tests/java/mod/_sc/ScModelObj.java
+++ b/qadevOOo/tests/java/mod/_sc/ScModelObj.java
@@ -195,7 +195,10 @@ public class ScModelObj extends TestCase {
String fileName = utils.getOfficeTempDirSys(Param.getMSF())+"printfile.prt" ;
File f = new File(fileName);
if (f.exists()) {
- f.delete();
+ boolean bDeleteOk = f.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
}
_XPrintJobBroadcaster.MyPrintJobListener listener = new _XPrintJobBroadcaster.MyPrintJobListener(oObj, fileName);
tEnv.addObjRelation("XPrintJobBroadcaster.XPrintJobListener", listener);
diff --git a/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java b/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java
index 255dc9d..12519fc 100644
--- a/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java
+++ b/qadevOOo/tests/java/mod/_sd/SdXImpressDocument.java
@@ -156,7 +156,10 @@ public class SdXImpressDocument extends TestCase {
String fileName = utils.getOfficeTempDirSys(Param.getMSF())+"printfile.prt" ;
File f = new File(fileName);
if (f.exists()) {
- f.delete();
+ boolean bDeleteOk = f.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
}
_XPrintJobBroadcaster.MyPrintJobListener listener = new _XPrintJobBroadcaster.MyPrintJobListener(xImpressDoc, fileName);
tEnv.addObjRelation("XPrintJobBroadcaster.XPrintJobListener", listener);
diff --git a/qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java b/qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java
index bcd777a..d209cac 100644
--- a/qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java
+++ b/qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java
@@ -62,9 +62,19 @@ public class SimpleRegistry extends TestCase {
File dstF = new File(dst) ;
System.out.println("H1");
- if (dstF.exists()) dstF.delete() ;
+ if (dstF.exists()) {
+ boolean bDeleteOk = dstF.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
+ }
+
System.out.println("H2");
- dstF.createNewFile() ;
+
+ boolean bCreateOk = dstF.createNewFile();
+ if (!bCreateOk) {
+ System.out.println("create failed");
+ }
dstF.deleteOnExit() ;
System.out.println("H3");
diff --git a/qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java b/qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java
index 4e9e03f..779019b 100644
--- a/qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java
+++ b/qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java
@@ -65,9 +65,19 @@ public class SimpleRegistry extends TestCase {
File dstF = new File(dst) ;
log.println("H1");
- if (dstF.exists()) dstF.delete() ;
- log.println("H2");
- dstF.createNewFile() ;
+ if (dstF.exists()) {
+ boolean bDeleteOk = dstF.delete();
+ if (!bDeleteOk) {
+ System.out.println("delete failed");
+ }
+ }
+
+ System.out.println("H2");
+
+ boolean bCreateOk = dstF.createNewFile();
+ if (!bCreateOk) {
+ System.out.println("create failed");
+ }
dstF.deleteOnExit() ;
log.println("H3");
More information about the Libreoffice-commits
mailing list