poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54443] ClassCastException in HSSFOptimiser
Date Tue, 13 Aug 2013 05:37:34 GMT

--- Comment #5 from dzareba@hotmail.com ---
(In reply to dzareba from comment #4)
> When there are duplicate cell styles ( i.e. via equals ), such that the
> later one has been used, because with HSSFOptimiser.optimiseCellStyles the
> way it works is that it removes the later duplicate but the earlier one wil
> also be removed if it has not been "used". This will effectively remove
> duplicated entries and mess up the records list.
> I suggest to change HSSFOptimiser so slightly, as to say
> isUsed[ newPos[ oldXf ] ] = true; for the part that removes unused styles,
> as the used one is now always the very first of all duplicates, and to not
> set the newPos[ duplicatedIndex ] to zero. I have tested it and no longer
> get an exception in such scenarios.

There's another way. The thing is that duplicates should not be marked as being
used. This is logical. Going through all the cells, get each and every one of
their XF indexes. The XF index will always return the one which it is using,
and so you want to be not using the duplicated ones, as they are going to get
deleted. So mark the very first one as being used. Then what is not used has
two alternatives. If it hasn't been zapped, that means it is a true unused one,
else if it's already been zapped don't bother changing the positions as it
already has been. Mark the new position as zero as usual for the true unused
ones, as a sign of courtesy.

You are receiving this mail because:
You are the assignee for the bug.

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

View raw message