View | Details | Raw Unified | Return to bug 48038
Collapse All | Expand All

(-)src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java (-1 / +2 lines)
Lines 65-70 Link Here
65
   */
65
   */
66
  public StyleSheet(byte[] tableStream, int offset)
66
  public StyleSheet(byte[] tableStream, int offset)
67
  {
67
  {
68
      int startOffset = offset;
68
      _stshiLength = LittleEndian.getShort(tableStream, offset);
69
      _stshiLength = LittleEndian.getShort(tableStream, offset);
69
      offset += LittleEndian.SHORT_SIZE;
70
      offset += LittleEndian.SHORT_SIZE;
70
      int stdCount = LittleEndian.getShort(tableStream, offset);
71
      int stdCount = LittleEndian.getShort(tableStream, offset);
Lines 88-94 Link Here
88
      _rgftc[2] = LittleEndian.getShort(tableStream, offset);
89
      _rgftc[2] = LittleEndian.getShort(tableStream, offset);
89
      offset += LittleEndian.SHORT_SIZE;
90
      offset += LittleEndian.SHORT_SIZE;
90
91
91
      offset = (LittleEndian.SHORT_SIZE + _stshiLength);
92
      offset = startOffset + LittleEndian.SHORT_SIZE + _stshiLength;
92
      _styleDescriptions = new StyleDescription[stdCount];
93
      _styleDescriptions = new StyleDescription[stdCount];
93
      for(int x = 0; x < stdCount; x++)
94
      for(int x = 0; x < stdCount; x++)
94
      {
95
      {
(-)src/scratchpad/testcases/org/apache/poi/hwpf/model/TestStyleSheet.java (+15 lines)
Lines 46-51 Link Here
46
46
47
  }
47
  }
48
48
49
  public void testReadWriteFromNonZeroOffset()
50
    throws Exception
51
  {
52
    HWPFFileSystem fileSys = new HWPFFileSystem();
53
    HWPFOutputStream tableOut = fileSys.getStream("1Table");
54
55
    tableOut.write(new byte[20]); // 20 bytes of whatever at the front.
56
    _styleSheet.writeTo(tableOut);
57
58
    byte[] newTableStream = tableOut.toByteArray();
59
60
    StyleSheet newStyleSheet = new StyleSheet(newTableStream, 20);
61
    assertEquals(newStyleSheet, _styleSheet);
62
  }
63
49
  protected void setUp()
64
  protected void setUp()
50
    throws Exception
65
    throws Exception
51
  {
66
  {

Return to bug 48038