summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-08-03 21:07:43 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-08-06 10:33:47 +0100
commit5f09718dba16ac7eb8f0917051f1ea532940a788 (patch)
tree53d0091698a22fbbcd599ddbe6a9353a0a155a7a /android
parent69207d1f69ea258b95f456e494657dfdc7c22f13 (diff)
android: fewer exceptions, and more debug output on null renderables
cleanup some library mentions
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LibreOffice4Android/Makefile3
-rw-r--r--android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java34
-rw-r--r--android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java33
-rw-r--r--android/qa/desktop/Makefile3
4 files changed, 46 insertions, 27 deletions
diff --git a/android/experimental/LibreOffice4Android/Makefile b/android/experimental/LibreOffice4Android/Makefile
index 577cf38cb76d..f3c4fe5dfe30 100644
--- a/android/experimental/LibreOffice4Android/Makefile
+++ b/android/experimental/LibreOffice4Android/Makefile
@@ -21,11 +21,9 @@ copy-stuff:
#
for F in $(strip \
analysislo \
- avmedialo \
basebmplo \
basegfxlo \
bootstrap.uno \
- canvastoolslo \
chartcontrollerlo \
chartcorelo \
comphelpgcc3 \
@@ -34,7 +32,6 @@ copy-stuff:
datelo \
dbaxmllo \
dbtoolslo \
- drawinglayerlo \
embobj \
evtattlo \
expwrap.uno \
diff --git a/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java b/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java
index 487fc7ee77ef..e883bb189af1 100644
--- a/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java
+++ b/android/experimental/LibreOffice4Android/src/org/libreoffice/android/DocumentLoader.java
@@ -279,6 +279,12 @@ public class DocumentLoader
// Use dummySmallDevice with no scale of offset just to find out
// the paper size of this page.
Log.i( TAG , "Render( " + Integer.toString( number ) + " )");
+
+ if (renderable == null) {
+ Log.i( TAG , "no renderable");
+ return null;
+ }
+
PropertyValue renderProps[] = new PropertyValue[3];
renderProps[0] = new PropertyValue();
renderProps[0].Name = "IsPrinter";
@@ -356,13 +362,18 @@ public class DocumentLoader
return null;
}
-
+
ByteBuffer renderPage(int number, int width , int height)
{
try {
// Use dummySmallDevice with no scale of offset just to find out
// the paper size of this page.
+ if (renderable == null) {
+ Log.i( TAG , "no renderable to render page ( " + Integer.toString(number) + " )" );
+ return null;
+ }
+
PropertyValue renderProps[] = new PropertyValue[3];
renderProps[0] = new PropertyValue();
renderProps[0].Name = "IsPrinter";
@@ -686,7 +697,8 @@ public class DocumentLoader
doc = componentLoader.loadComponentFromURL(url, "_blank", 0, loadProps);
publishProgress( new Integer( 33 ));
long t1 = System.currentTimeMillis();
- Log.i(TAG, "Loading took " + ((t1-t0)-timingOverhead) + " ms");
+ Log.i(TAG, "Loading took " + ((t1-t0)-timingOverhead) + " ms => " +
+ (doc == null ? "null" : "have") + "document");
Object toolkitService = mcf.createInstanceWithContext
("com.sun.star.awt.Toolkit", context);
@@ -711,10 +723,18 @@ public class DocumentLoader
renderProps[2].Name = "View";
renderProps[2].Value = new MyXController();
- t0 = System.currentTimeMillis();
- pageCount = renderable.getRendererCount(doc, renderProps);
- t1 = System.currentTimeMillis();
- Log.i(TAG, "getRendererCount: " + pageCount + ", took " + ((t1-t0)-timingOverhead) + " ms");
+ if (renderable != null)
+ {
+ t0 = System.currentTimeMillis();
+ pageCount = renderable.getRendererCount(doc, renderProps);
+ t1 = System.currentTimeMillis();
+ Log.i(TAG, "getRendererCount: " + pageCount + ", took " + ((t1-t0)-timingOverhead) + " ms");
+ }
+ else
+ {
+ pageCount = 1; // hack
+ Log.i(TAG, "no / null renderable interface!");
+ }
}
catch (Exception e) {
e.printStackTrace(System.err);
@@ -726,7 +746,7 @@ public class DocumentLoader
protected void onProgressUpdate(Integer progress){
progressView.setProgress( progress.intValue() );
}
-
+
protected void onPostExecute(Integer result){
Log.i(TAG, "onPostExecute: " + result);
if (result == -1)
diff --git a/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java b/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java
index bbf0db431252..50fc6cbdc51c 100644
--- a/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java
+++ b/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java
@@ -71,33 +71,38 @@ public class FileUtilities {
private static final String getExtension(String filename)
{
- int nExt = filename.lastIndexOf('.');
- if (nExt < 0)
- return "";
- return filename.substring(nExt);
+ if (filename == null)
+ return "";
+ int nExt = filename.lastIndexOf('.');
+ if (nExt < 0)
+ return "";
+ return filename.substring(nExt);
}
private static final int lookupExtension(String filename)
{
- String extn = getExtension (filename);
- if (!mExtnMap.containsKey(extn))
- return UNKNOWN;
- return mExtnMap.get (extn);
+ String extn = getExtension (filename);
+ if (!mExtnMap.containsKey(extn))
+ return UNKNOWN;
+ return mExtnMap.get (extn);
}
static int getType(String filename)
{
- int type = lookupExtension (filename);
- android.util.Log.d("debug", "extn : " + filename + " -> " + type);
- return type;
+ int type = lookupExtension (filename);
+ android.util.Log.d("debug", "extn : " + filename + " -> " + type);
+ return type;
}
// Filter by mode, and/or in future by filename/wildcard
static private boolean doAccept(String filename, int byMode, String byFilename)
{
android.util.Log.d("debug", "doAccept : " + filename + " mode " + byMode + " byFilename " + byFilename);
- if (byMode == ALL && byFilename == ""){
- if( filename.startsWith(".")){//ignore hidden files
+ if (filename == null)
+ return false;
+
+ if (byMode == ALL && byFilename == "") {
+ if( filename.startsWith(".")) {//ignore hidden files
return false;
}
return true;
@@ -105,7 +110,7 @@ public class FileUtilities {
// check extension
if (byMode != ALL) {
if (mExtnMap.get (getExtension (filename)) != byMode)
- return false;
+ return false;
}
if (byFilename != "") {
// FIXME return false on a non-match
diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile
index 2c87ac904bc5..b2f57d1e3431 100644
--- a/android/qa/desktop/Makefile
+++ b/android/qa/desktop/Makefile
@@ -93,14 +93,11 @@ copy-stuff: buildrcs
#
for F in $(strip \
analysislo \
- avmedialo \
basebmplo \
basegfxlo \
bootstrap.uno \
- canvastoolslo \
comphelpgcc3 \
cppcanvaslo \
- drawinglayerlo \
embobj \
expwrap.uno \
fileacc \