Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

TestBiffViewer.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.hssf.dev;
  16. import java.io.File;
  17. import java.io.IOException;
  18. import java.util.Map;
  19. import org.apache.poi.util.RecordFormatException;
  20. class TestBiffViewer extends BaseTestIteratingXLS {
  21. @Override
  22. protected Map<String, Class<? extends Throwable>> getExcludes() {
  23. Map<String, Class<? extends Throwable>> excludes = super.getExcludes();
  24. // unsupported crypto api header
  25. excludes.put("35897-type4.xls", IllegalArgumentException.class);
  26. excludes.put("51832.xls", IllegalArgumentException.class);
  27. excludes.put("xor-encryption-abc.xls", RecordFormatException.class);
  28. excludes.put("password.xls", IllegalArgumentException.class);
  29. // HSSFWorkbook cannot open it as well
  30. excludes.put("43493.xls", RecordFormatException.class);
  31. // EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class);
  32. // "Name is too long" when setting username
  33. excludes.put("50833.xls", IllegalArgumentException.class);
  34. // "Buffer overrun"
  35. excludes.put("XRefCalc.xls", RuntimeException.class);
  36. excludes.put("61300.xls", IndexOutOfBoundsException.class);
  37. excludes.put("poi-fuzz.xls", RecordFormatException.class);
  38. excludes.put("protected_66115.xls", RecordFormatException.class);
  39. excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5786329142919168.xls", IllegalStateException.class);
  40. excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5889658057523200.xls", IndexOutOfBoundsException.class);
  41. excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5175219985448960.xls", IndexOutOfBoundsException.class);
  42. excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6137883240824832.xls", IndexOutOfBoundsException.class);
  43. return excludes;
  44. }
  45. @Override
  46. void runOneFile(File fileIn) throws IOException {
  47. BiffViewer bv = new BiffViewer();
  48. bv.setInterpretRecords(true);
  49. bv.setDumpBiffHex(true);
  50. bv.parse(fileIn, null);
  51. }
  52. }