android: fewer exceptions, and more debug output on null renderables

cleanup some library mentions
This commit is contained in:
Michael Meeks
2012-08-03 21:07:43 +01:00
parent 69207d1f69
commit 5f09718dba
4 changed files with 46 additions and 27 deletions

View File

@@ -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 \

View File

@@ -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)

View File

@@ -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

View File

@@ -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 \