On Aug 2, 11:51 am, "Mark Murphy" <[email protected]> wrote:
> -- What javac generated the .class files? If it's not the latest for that
> particular generation (e.g., the latest 1.5, the latest 1.6), can you try
> moving to the latest one and see if your results improve? If it's not the
> Sun javac, can you try the Sun javac?
Good idea. I think I got Eclipse to build with different versions of
Java, but there was no change in the behavior of the class->dex
converter.
> -- Have you been able to narrow it down to a specific .class file? Or do
> several exhibit the behavior? What is unusual about those class files
> compared to others that do not exhibit the problem?
Not easily. I already tried to narrow it down by removing .java files
from the build compilation to .class files. The JXL library has
hundreds of files and they are relatively tightly coupled. There
aren't many .java files in it that can be removed such that the
remaining files fully build without lost references. I could try it
at a later stage, letting it build all the .class files and then only
passing subsets to dx for dex conversion, but I would expect similar
problems, i.e., missing references.
> -- Can the problem be triggered by a .class file generated from source you
> are in position to post to an issue/list, so that others can see if we get
> the same dx errors?
Sure, the JXL library is open source. I can post code here (I
presume).
> -- Are you doing anything unusual in your build (e.g., running an
> obfuscator)?
Nope, very vanilla Eclipse-based android programming.
> -- Eclipse or Ant for your builds? If Eclipse, have you tried Ant/manual
> compile?
I will have to figure out how to build android code outside Eclipse.
I admit I haven't looked very hard yet, it isn't an approach I have
relished. I'll look for some resources online.
In the meantime, the following is the full contents of the file
mentioned in the error shown in a prior post. The specific method
that triggers the exception is trimInvalidChars(String). It all looks
very basic to me.
================================================================================
androidjxlsrc.jxl.write.biff.NumberFormatRecord.NumberFormatRecord.java
================================================================================
/*********************************************************************
*
* Copyright (C) 2002 Andrew Khan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
***************************************************************************/
package androidjxlsrc.jxl.write.biff;
import androidjxlsrc.common.Logger;
import androidjxlsrc.jxl.biff.FormatRecord;
/**
* A class which contains a number format
*/
public class NumberFormatRecord extends FormatRecord
{
/**
* The logger
*/
private static Logger logger = Logger.getLogger
(NumberFormatRecord.class);
// Dummy class to specify non validation
protected static class NonValidatingFormat{public NonValidatingFormat
(){}};
/**
* Constructor. Replaces some of the characters in the java number
* format string with the appropriate excel format characters
*
* @param fmt the number format
*/
protected NumberFormatRecord(String fmt)
{
super();
// Do the replacements in the format string
String fs = fmt;
fs = replace(fs, "E0", "E+0");
fs = trimInvalidChars(fs);
setFormatString(fs);
}
/**
* Constructor. Replaces some of the characters in the java number
* format string with the appropriate excel format characters
*
* @param fmt the number format
*/
protected NumberFormatRecord(String fmt, NonValidatingFormat dummy)
{
super();
// Do the replacements in the format string
String fs = fmt;
fs = replace(fs, "E0", "E+0");
setFormatString(fs);
}
/**
* Remove all but the first characters preceding the # or the 0.
* Remove all characters after the # or the 0, unless it is a )
*
* @param fs the candidate number format
* @return the string with spurious characters removed
*/
private String trimInvalidChars(String fs)
{
int firstHash = fs.indexOf('#');
int firstZero = fs.indexOf('0');
int firstValidChar = 0;
if (firstHash == -1 && firstZero == -1)
{
// The string is complete nonsense. Return a default string
return "#.###";
}
if (firstHash != 0 && firstZero != 0 &&
firstHash != 1 && firstZero != 1)
{
// The string is dodgy. Find the first valid char
firstHash = firstHash == -1?firstHash =
Integer.MAX_VALUE:firstHash;
firstZero = firstZero == -1?firstZero =
Integer.MAX_VALUE:firstZero;
firstValidChar = Math.min(firstHash, firstZero);
StringBuffer tmp = new StringBuffer();
tmp.append(fs.charAt(0));
tmp.append(fs.substring(firstValidChar));
fs = tmp.toString();
}
// Now strip of everything at the end that isn't a # or 0
int lastHash = fs.lastIndexOf('#');
int lastZero = fs.lastIndexOf('0');
if (lastHash == fs.length() ||
lastZero == fs.length())
{
return fs;
}
// Find the last valid character
int lastValidChar = Math.max(lastHash, lastZero);
// Check for the existence of a ) or %
while ((fs.length() > lastValidChar + 1) &&
(fs.charAt(lastValidChar+1) == ')' ||
(fs.charAt(lastValidChar+1) == '%')))
{
lastValidChar++;
}
return fs.substring(0, lastValidChar+1);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---