1.出错日志 Caused by: java.lang.NullPointerException: charsetName
at java.lang.String.(String.java:403)
at jxl.biff.StringHelper.getString(StringHelper.java:164)
at jxl.biff.FormatRecord.(FormatRecord.java:161)
at jxl.read.biff.WorkbookParser.parse(WorkbookParser.java:638)
at jxl.Workbook.getWorkbook(Workbook.java:237)
at jxl.Workbook.getWorkbook(Workbook.java:198)
at com.ppet.inv.BalanceUpdateAction.execute(BalanceUpdateAction.java:106)
... 36 more
2. BalanceUpdateAction.execute:代码截图
----------------------
这个是excel更新库存时的出错信息……
请问,出现这个错误的原因可能是什么呢?
at java.lang.String.(String.java:403)
at jxl.biff.StringHelper.getString(StringHelper.java:164)
at jxl.biff.FormatRecord.(FormatRecord.java:161)
at jxl.read.biff.WorkbookParser.parse(WorkbookParser.java:638)
at jxl.Workbook.getWorkbook(Workbook.java:237)
at jxl.Workbook.getWorkbook(Workbook.java:198)
at com.ppet.inv.BalanceUpdateAction.execute(BalanceUpdateAction.java:106)
... 36 more
2. BalanceUpdateAction.execute:代码截图
----------------------
这个是excel更新库存时的出错信息……
请问,出现这个错误的原因可能是什么呢?
解决方案 »
- 请教一个HQL两个简单的表关联查询的问题请大家帮助谢谢
- Tomcat启动时报错,啥问题呀!
- 帮忙看一下这段代码哪里出了问题
- 如何让一个页面提交多个FORM?
- 高分求教 Tree 的一般做法
- struts的初学者用什么书比较好?
- 请问SqlServer2000Driver JDBC驱动放到什么地方?急!急!高分相送!
- 菜鸟求助ejb3.0的not bound问题
- 请问,如何实现对一段英语文字的单词拼写检查呢?
- 请问各位大虾我有一个表单,里面有很多字段要提交到数据库,你们是用getParameter一个一个的获得值呢还是有什么其它好的办法,教教小弟!
- 求解,javamail 的问题,环境 linux(一台可以运行,项目部署到另一台就不行了) ,一下是错误提示 求解
- ibatis调用oracle存储过程返回结果集的问题
public WorkbookSettings()
{
initialFileSize = DEFAULT_INITIAL_FILE_SIZE;
arrayGrowSize = DEFAULT_ARRAY_GROW_SIZE;
localeFunctionNames = new HashMap();
excelDisplayLanguage = CountryCode.USA.getCode();
excelRegionalSettings = CountryCode.UK.getCode();
refreshAll = false;
template = false;
excel9file = false;
windowProtected = false;
hideobj = HIDEOBJ_SHOW_ALL; // Initialize other properties from the system properties
try
{
boolean suppressWarnings = Boolean.getBoolean("jxl.nowarnings");
setSuppressWarnings(suppressWarnings);
drawingsDisabled = Boolean.getBoolean("jxl.nodrawings");
namesDisabled = Boolean.getBoolean("jxl.nonames");
gcDisabled = Boolean.getBoolean("jxl.nogc");
rationalizationDisabled = Boolean.getBoolean("jxl.norat");
mergedCellCheckingDisabled =
Boolean.getBoolean("jxl.nomergedcellchecks");
formulaReferenceAdjustDisabled =
Boolean.getBoolean("jxl.noformulaadjust");
propertySetsDisabled = Boolean.getBoolean("jxl.nopropertysets");
ignoreBlankCells = Boolean.getBoolean("jxl.ignoreblanks");
cellValidationDisabled = Boolean.getBoolean("jxl.nocellvalidation");
autoFilterDisabled = !Boolean.getBoolean("jxl.autofilter");
// autofilter currently disabled by default
useTemporaryFileDuringWrite =
Boolean.getBoolean("jxl.usetemporaryfileduringwrite");
String tempdir =
System.getProperty("jxl.temporaryfileduringwritedirectory"); if (tempdir != null)
{
temporaryFileDuringWriteDirectory = new File(tempdir);
}
//在这里设置的
encoding = System.getProperty("file.encoding");
}
catch (SecurityException e)
{
logger.warn("Error accessing system properties.", e);
} // Initialize the locale to the system locale
try
{
if (System.getProperty("jxl.lang") == null ||
System.getProperty("jxl.country") == null)
{
locale = Locale.getDefault();
}
else
{
locale = new Locale(System.getProperty("jxl.lang"),
System.getProperty("jxl.country"));
} if (System.getProperty("jxl.encoding") != null)
{
encoding = System.getProperty("jxl.encoding");
}
}
catch (SecurityException e)
{
logger.warn("Error accessing system properties.", e);
locale = Locale.getDefault();
}
}
StringHelper使用的就是这个encoding: public static String getString(byte[] d, int length, int pos,
WorkbookSettings ws)
{
if( length == 0 )
{
return ""; // Reduces number of new Strings
} try
{
return new String(d, pos, length, ws.getEncoding());
// byte[] b = new byte[length];
// System.arraycopy(d, pos, b, 0, length);
// return new String(b, ws.getEncoding());
}
catch (UnsupportedEncodingException e)
{
logger.warn(e.toString());
return "";
}
}
查看下System.getProperty("file.encoding")获得的系统编码是否正确。
// Initialize the locale to the system locale
try
{
if (System.getProperty("jxl.lang") == null ||
System.getProperty("jxl.country") == null)
{
locale = Locale.getDefault();
}
else
{
locale = new Locale(System.getProperty("jxl.lang"),
System.getProperty("jxl.country"));
} if (System.getProperty("jxl.encoding") != null)
{
//这里覆盖
encoding = System.getProperty("jxl.encoding");
}
}
catch (SecurityException e)
{
logger.warn("Error accessing system properties.", e);
locale = Locale.getDefault();
}