DO NOT REPLY [Bug 52446] New: BufferUnderlowException in NPropertyTable

2012-01-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52446

 Bug #: 52446
   Summary: BufferUnderlowException in NPropertyTable
   Product: POI
   Version: 3.8-dev
  Platform: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: POIFS
AssignedTo: dev@poi.apache.org
ReportedBy: antoni.my...@gmail.com
Classification: Unclassified


Created attachment 28131
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=28131
The patch with my workaround

I have a .doc file which is OK from the MSOffice POV

java.nio.BufferUnderflowException
 at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:127)
 at
org.apache.poi.poifs.property.NPropertyTable.buildProperties(NPropertyTable.java:93)
 at org.apache.poi.poifs.property.NPropertyTable.init(NPropertyTable.java:62)
 at
org.apache.poi.poifs.filesystem.NPOIFSFileSystem.readCoreContents(NPOIFSFileSystem.java:379)
 at
org.apache.poi.poifs.filesystem.NPOIFSFileSystem.init(NPOIFSFileSystem.java:293)


The BFFValidator returns 

BFFValidation 
  path=twenty-tips.doc 
  datetime=01/10/12 16:07:25 
  result=ERROR 0x80030109. Docfile zostal uszkodzony.   
  reason=The Microsoft Office Binary File Format Validator encountered an
error reading the file you specified.
/BFFValidation

In English it's Docfile has been corrupted. 

I came up with a workaround. In NPropertyTable.buildProperties, instead of 

data = new byte[bigBlockSize.getBigBlockSize()];

I would put:

int dataSize = bigBlockSize.getBigBlockSize() = bb.remaining() ?
bigBlockSize.getBigBlockSize() : bb.remaining();
 data = new byte[dataSize];

So get the big block size only if it's less than or equal to the number of
remaining bytes. Otherwise, just get the remaining bytes.

The file is obviously corrupted, yet it opens up just fine in Word and I can
get fulltext and metadata with the old POIFSFileSystem. This problem popped up
in my regression tests, when I switched to NPOIFSFileSystem. It seems like a
safe workaround to me. For correct files, it won't change anything, for other
corrupted files it will probably move the error to somewhere within
PropertyFactory.convertToProperties. For my file, it's the difference between
life and death.

Unfortunately I can't share the file.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



DO NOT REPLY [Bug 52446] BufferUnderlowException in NPropertyTable

2012-01-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52446

Nick Burch nick.bu...@alfresco.com changed:

   What|Removed |Added

 Status|NEW |NEEDINFO
 OS/Version||All

--- Comment #1 from Nick Burch nick.bu...@alfresco.com 2012-01-10 15:25:23 
UTC ---
Are you able to give us a bit more info on the property stream that's
misbehaving? 

I'd be interested in knowing:
 * How long is it, in bytes?
 * How many blocks is the property stream split over?
 * If you look at the bytes of the problem block, is it null padded?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



DO NOT REPLY [Bug 52447] New: Unable to Open Excel XLS with hyperlink cells.

2012-01-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52447

 Bug #: 52447
   Summary: Unable to Open Excel XLS with hyperlink cells.
   Product: POI
   Version: 3.8-dev
  Platform: PC
OS/Version: Windows Vista
Status: NEW
  Severity: major
  Priority: P2
 Component: HSSF
AssignedTo: dev@poi.apache.org
ReportedBy: david.st...@windstream.com
Classification: Unclassified


I have a fairly simple workbook that I have successfully opened using POI.
However, when trying a similar file with hyperlinks saved within, POI is unable
to read it. This is the stacktrace I got on repeated attempts:

java.lang.RuntimeException: Unexpected record type
(org.apache.poi.hssf.record.HyperlinkRecord)
at
org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.init(RowRecordsAggregate.java:107)
at org.apache.poi.hssf.model.InternalSheet.init(InternalSheet.java:208)
at
org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:163)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.init(HSSFWorkbook.java:298)
at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:82)
at excelproc.util.ExcelFileWrapper.init(ExcelFileWrapper.java:42)
at
excelproc.exec.InvoiceComparisonIndexBuilder.main(InvoiceComparisonIndexBuilder.java:46)

The hyperlinks are internet URLs, if that makes a difference. Let me know if
more info is needed. Thanks!

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



DO NOT REPLY [Bug 52447] Unable to Open Excel XLS with hyperlink cells.

2012-01-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52447

--- Comment #1 from Dave S. david.st...@windstream.com 2012-01-10 22:47:42 
UTC ---
This is the code I'm using to attempt to open the workbook:

public ExcelFileWrapper(String filename, Timestamp endDate) {
this.filename = filename;
this.endDate = endDate;
final File f = new File(filename);
try {
excelFile = WorkbookFactory.create(f);
} catch (Exception e) {
log.error(Could not open Excel workbook for updating., e);
}
}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



DO NOT REPLY [Bug 52447] Unable to Open Excel XLS with hyperlink cells.

2012-01-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52447

Dave S. david.st...@windstream.com changed:

   What|Removed |Added

 CC||david.st...@windstream.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



DO NOT REPLY [Bug 52385] [REGRESSION] HPSF corrupts output when starting file has unsupported variant props

2012-01-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52385

--- Comment #3 from Niklas Rehfeld niklas.rehf...@gmail.com 2012-01-11 
01:39:30 UTC ---
Created attachment 28134
  -- https://issues.apache.org/bugzilla/attachment.cgi?id=28134
Diagram of the HeadingPair/DocParts TypedProperty structures

Just thought this might be useful for this bug, it shows some of the structure
of the docparts and headingpair properties, which as far as I have been able to
find, are the only ones that use unaligned strings in property sets. 

All the info comes straight from MS-OSHARED (and maybe a little bit from
MS-OLEPS)

Ignore the green stuff on the left, that was from a project that I'm working
on. 

Nik

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org