JBEHAVE-JXL:java.lang.ArrayIndexOutOfBoundsException:39181

时间:2012-10-12 11:51:47

标签: excel-2007 jxl jbehave indexoutofboundsexception

JXL VERSION = 2.6.12

JBEHAVE VERSION:3.6.8

EXCEL:MS EXCEL 2007

我正在从类路径中读取我的Jbehave步骤类中的excel,如下所示并获取ArrayIndexOutOfBoundsException。相同的代码在独立的Java代码中工作

  

工作簿工作簿= null; InputStream流   = this.getClass()getClassLoader()的getResourceAsStream( “TEST.XLS”)。。 workbook = Workbook.getWorkbook(stream);表单=   workbook.getSheet(0);单元格a1 = sheet.getCell(0,0);

但是,如果我使用文件系统路径在Jbehave项目中读取excel,我可以在excel中加载和读取工作表中的内容

  

workbook = Workbook.getWorkbook(new File(“test.xls”));

下面是堆栈跟踪:

  

java.lang.ArrayIndexOutOfBoundsException:39181           在jxl.read.biff.Record。(Record.java:79)           在jxl.read.biff.File.next(File.java:181)           在jxl.read.biff.WorkbookParser.parse(WorkbookParser.java:569)           在jxl.Workbook.getWorkbook(Workbook.java:271)           在jxl.Workbook.getWorkbook(Workbook.java:253)           在org.teststepgiven.steps.Test.test(Test.java:33)           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)           在java.lang.reflect.Method.invoke(Method.java:597)           at org.jbehave.core.steps.StepCreator $ ParameterisedStep.perform(StepCreator.java:537)           在org.jbehave.core.embedder.StoryRunner $ FineSoFar.run(StoryRunner.java:477)           在org.jbehave.core.embedder.StoryRunner.runStepsWhileKeepingState(StoryRunner.java:457)           在org.jbehave.core.embedder.StoryRunner.runScenarioSteps(StoryRunner.java:421)           在org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:297)           在org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:211)           在org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:172)           at org.jbehave.core.embedder.StoryManager $ EnqueuedStory.call(StoryManager.java:229)           在org.jbehave.core.embedder.StoryManager $ EnqueuedStory.call(StoryManager.java:201)           at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:303)           在java.util.concurrent.FutureTask.run(FutureTask.java:138)           at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:886)           at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:908)           在java.lang.Thread.run(Thread.java:662)

0 个答案:

没有答案