diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2020-04-13 21:55:05 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2020-04-13 21:55:05 +0000 |
commit | f9417a92b2d54e9be3c1f4815155a27d05be2ff9 (patch) | |
tree | 8fe8a66e4e5cdb832b2b2f603fa5e5dd3c7f7653 /src/java/org/apache | |
parent | 4fd05fac12a32de2e6312e93c463277a40b6ff20 (diff) | |
download | poi-f9417a92b2d54e9be3c1f4815155a27d05be2ff9.tar.gz poi-f9417a92b2d54e9be3c1f4815155a27d05be2ff9.zip |
#64036 - Replace reflection calls in factories for Java 9+ (HSSF Record Factory)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876467 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
4 files changed, 239 insertions, 564 deletions
diff --git a/src/java/org/apache/poi/hssf/record/HSSFRecordTypes.java b/src/java/org/apache/poi/hssf/record/HSSFRecordTypes.java index 85654634ec..e8edcd9beb 100644 --- a/src/java/org/apache/poi/hssf/record/HSSFRecordTypes.java +++ b/src/java/org/apache/poi/hssf/record/HSSFRecordTypes.java @@ -19,8 +19,10 @@ package org.apache.poi.hssf.record; -import java.util.HashMap; +import java.util.Arrays; import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; import org.apache.poi.hssf.record.chart.*; import org.apache.poi.hssf.record.pivottable.DataItemRecord; @@ -32,176 +34,176 @@ import org.apache.poi.hssf.record.pivottable.ViewFieldsRecord; import org.apache.poi.hssf.record.pivottable.ViewSourceRecord; public enum HSSFRecordTypes { - UNKNOWN(-1, UnknownRecord::new), - FORMULA(0x0006, FormulaRecord::new), - EOF(0x000A, EOFRecord::new), - CALC_COUNT(0x000C, CalcCountRecord::new), - CALC_MODE(0x000D, CalcModeRecord::new), - PRECISION(0x000E, PrecisionRecord::new), - REF_MODE(0x000F, RefModeRecord::new), - DELTA(0x0010, DeltaRecord::new), - ITERATION(0x0011, IterationRecord::new), - PROTECT(0x0012, ProtectRecord::new), - PASSWORD(0x0013, PasswordRecord::new), - HEADER(0x0014, HeaderRecord::new), - FOOTER(0x0015, FooterRecord::new), - EXTERN_SHEET(0x0017, ExternSheetRecord::new), - NAME(0x0018, NameRecord::new), - WINDOW_PROTECT(0x0019, WindowProtectRecord::new), - VERTICAL_PAGE_BREAK(0x001A, VerticalPageBreakRecord::new), - HORIZONTAL_PAGE_BREAK(0x001B, HorizontalPageBreakRecord::new), - NOTE(0x001C, NoteRecord::new), - SELECTION(0x001D, SelectionRecord::new), - DATE_WINDOW_1904(0x0022, DateWindow1904Record::new), - EXTERNAL_NAME(0x0023, ExternalNameRecord::new), - LEFT_MARGIN(0x0026, LeftMarginRecord::new), - RIGHT_MARGIN(0x0027, RightMarginRecord::new), - TOP_MARGIN(0x0028, TopMarginRecord::new), - BOTTOM_MARGIN(0x0029, BottomMarginRecord::new), - PRINT_HEADERS(0x002A, PrintHeadersRecord::new), - PRINT_GRIDLINES(0X002B, PrintGridlinesRecord::new), - FILE_PASS(0x002F, FilePassRecord::new), - FONT(0x0031, FontRecord::new), - CONTINUE(0x003C, ContinueRecord::new), - WINDOW_ONE(0x003D, WindowOneRecord::new), - BACKUP(0x0040, BackupRecord::new), - PANE(0x0041, PaneRecord::new), - CODEPAGE(0x0042, CodepageRecord::new), - DCON_REF(0x0051, DConRefRecord::new), - DEFAULT_COL_WIDTH(0x0055, DefaultColWidthRecord::new), - CRN_COUNT(0x0059, CRNCountRecord::new), - CRN(0x005A, CRNRecord::new), - WRITE_ACCESS(0x005C, WriteAccessRecord::new), - FILE_SHARING(0x005B, FileSharingRecord::new), - OBJ(0x005D, ObjRecord::new), - UNCALCED(0x005E, UncalcedRecord::new), - SAVE_RECALC(0x005F, SaveRecalcRecord::new), - OBJECT_PROTECT(0x0063, ObjectProtectRecord::new), - COLUMN_INFO(0x007D, ColumnInfoRecord::new), - GUTS(0x0080, GutsRecord::new), - WS_BOOL(0x0081, WSBoolRecord::new), - GRIDSET(0x0082, GridsetRecord::new), - H_CENTER(0x0083, HCenterRecord::new), - V_CENTER(0x0084, VCenterRecord::new), - BOUND_SHEET(0x0085, BoundSheetRecord::new), - WRITE_PROTECT(0x0086, WriteProtectRecord::new), - COUNTRY(0X008C, CountryRecord::new), - HIDE_OBJ(0x008D, HideObjRecord::new), - PALETTE(0x0092, PaletteRecord::new), - FN_GROUP_COUNT(0x009c, FnGroupCountRecord::new), - AUTO_FILTER_INFO(0x009D, AutoFilterInfoRecord::new), - SCL(0x00A0, SCLRecord::new), - PRINT_SETUP(0x00A1, PrintSetupRecord::new), - VIEW_DEFINITION(0x00B0, ViewDefinitionRecord::new), - VIEW_FIELDS(0x00B1, ViewFieldsRecord::new), - PAGE_ITEM(0x00B6, PageItemRecord::new), - MUL_BLANK(0x00BE, MulBlankRecord::new), - MUL_RK(0x00BD, MulRKRecord::new), - MMS(0x00C1, MMSRecord::new), - DATA_ITEM(0x00C5, DataItemRecord::new), - STREAM_ID(0x00D5, StreamIDRecord::new), - DB_CELL(0x00D7, DBCellRecord::new), - BOOK_BOOL(0x00DA, BookBoolRecord::new), - SCENARIO_PROTECT(0x00DD, ScenarioProtectRecord::new), - EXTENDED_FORMAT(0x00E0, ExtendedFormatRecord::new), - INTERFACE_HDR(0x00E1, InterfaceHdrRecord::new), - INTERFACE_END(0x00E2, InterfaceEndRecord::create), - VIEW_SOURCE(0x00E3, ViewSourceRecord::new), - MERGE_CELLS(0x00E5, MergeCellsRecord::new), - DRAWING_GROUP(0x00EB, DrawingGroupRecord::new), - DRAWING(0x00EC, DrawingRecord::new), - DRAWING_SELECTION(0x00ED, DrawingSelectionRecord::new), - SST(0x00FC, SSTRecord::new), - LABEL_SST(0X00FD, LabelSSTRecord::new), - EXT_SST(0x00FF, ExtSSTRecord::new), - EXTENDED_PIVOT_TABLE_VIEW_FIELDS(0x0100, ExtendedPivotTableViewFieldsRecord::new), - TAB_ID(0x013D, TabIdRecord::new), - USE_SEL_FS(0x0160, UseSelFSRecord::new), - DSF(0x0161, DSFRecord::new), - USER_SVIEW_BEGIN(0x01AA, UserSViewBegin::new), - USER_SVIEW_END(0x01AB, UserSViewEnd::new), - SUP_BOOK(0x01AE, SupBookRecord::new), - PROTECTION_REV_4(0x01AF, ProtectionRev4Record::new), - CF_HEADER(0x01B0, CFHeaderRecord::new), - CF_RULE(0x01B1, CFRuleRecord::new), - DVAL(0x01B2, DVALRecord::new), - TEXT_OBJECT(0x01B6, TextObjectRecord::new), - REFRESH_ALL(0x01B7, RefreshAllRecord::new), - HYPERLINK(0x01B8, HyperlinkRecord::new), - PASSWORD_REV_4(0x01BC, PasswordRev4Record::new), - DV(0x01BE, DVRecord::new), - RECALC_ID(0x01C1, RecalcIdRecord::new), - DIMENSIONS(0x0200, DimensionsRecord::new), - BLANK(0x0201, BlankRecord::new), - NUMBER(0x0203, NumberRecord::new), - LABEL(0x0204, LabelRecord::new), - BOOL_ERR(0x0205, BoolErrRecord::new), - STRING(0x0207, StringRecord::new), - ROW(0x0208, RowRecord::new), - INDEX(0x020B, IndexRecord::new), - ARRAY(0x0221, ArrayRecord::new), - DEFAULT_ROW_HEIGHT(0x0225, DefaultRowHeightRecord::new), - TABLE(0x0236, TableRecord::new), - WINDOW_TWO(0x023E, WindowTwoRecord::new), - RK(0x027E, RKRecord::new), - STYLE(0x0293, StyleRecord::new), - FORMAT(0x041E, FormatRecord::new), - SHARED_FORMULA(0x04BC, SharedFormulaRecord::new), - BOF(0x0809, BOFRecord::new), - CHART_FRT_INFO(0x0850, ChartFRTInfoRecord::new), - CHART_START_BLOCK(0x0852, ChartStartBlockRecord::new), - CHART_END_BLOCK(0x0853, ChartEndBlockRecord::new), - CHART_START_OBJECT(0x0854, ChartStartObjectRecord::new), - CHART_END_OBJECT(0x0855, ChartEndObjectRecord::new), - CAT_LAB(0x0856, CatLabRecord::new), - FEAT_HDR(0x0867, FeatHdrRecord::new), - FEAT(0x0868, FeatRecord::new), - DATA_LABEL_EXTENSION(0x086A, DataLabelExtensionRecord::new), - CF_HEADER_12(0x0879, CFHeader12Record::new), - CF_RULE_12(0x087A, CFRule12Record::new), - TABLE_STYLES(0x088E, TableStylesRecord::new), - NAME_COMMENT(0x0894, NameCommentRecord::new), - HEADER_FOOTER(0x089C, HeaderFooterRecord::new), - UNITS(0x1001, UnitsRecord::new), - CHART(0x1002, ChartRecord::new), - SERIES(0x1003, SeriesRecord::new), - DATA_FORMAT(0x1006, DataFormatRecord::new), - LINE_FORMAT(0x1007, LineFormatRecord::new), - AREA_FORMAT(0x100A, AreaFormatRecord::new), - SERIES_LABELS(0x100C, SeriesLabelsRecord::new), - SERIES_TEXT(0x100D, SeriesTextRecord::new), - CHART_FORMAT(0x1014, ChartFormatRecord::new), - LEGEND(0x1015, LegendRecord::new), - SERIES_LIST(0x1016, SeriesListRecord::new), - BAR(0x1017, BarRecord::new), - AREA(0x101A, AreaRecord::new), - AXIS(0x101D, AxisRecord::new), - TICK(0x101E, TickRecord::new), - VALUE_RANGE(0x101F, ValueRangeRecord::new), - CATEGORY_SERIES_AXIS(0x1020, CategorySeriesAxisRecord::new), - AXIS_LINE_FORMAT(0x1021, AxisLineFormatRecord::new), - DEFAULT_DATA_LABEL_TEXT_PROPERTIES(0x1024, DefaultDataLabelTextPropertiesRecord::new), - TEXT(0x1025, TextRecord::new), - FONT_INDEX(0x1026, FontIndexRecord::new), - OBJECT_LINK(0x1027, ObjectLinkRecord::new), - FRAME(0x1032, FrameRecord::new), - BEGIN(0x1033, BeginRecord::new), - END(0x1034, EndRecord::new), - PLOT_AREA(0x1035, PlotAreaRecord::new), - AXIS_PARENT(0x1041, AxisParentRecord::new), - SHEET_PROPERTIES(0x1044, SheetPropertiesRecord::new), - SERIES_CHART_GROUP_INDEX(0x1045, SeriesChartGroupIndexRecord::new), - AXIS_USED(0x1046, AxisUsedRecord::new), - NUMBER_FORMAT_INDEX(0x104E, NumberFormatIndexRecord::new), - CHART_TITLE_FORMAT(0x1050, ChartTitleFormatRecord::new), - LINKED_DATA(0x1051, LinkedDataRecord::new), - FONT_BASIS(0x1060, FontBasisRecord::new), - AXIS_OPTIONS(0x1062, AxisOptionsRecord::new), - DAT(0x1063, DatRecord::new), - PLOT_GROWTH(0x1064, PlotGrowthRecord::new), - SERIES_INDEX(0x1065, SeriesIndexRecord::new), + UNKNOWN(-1, UnknownRecord.class, UnknownRecord::new, false), + FORMULA(0x0006, FormulaRecord.class, FormulaRecord::new), + EOF(0x000A, EOFRecord.class, EOFRecord::new), + CALC_COUNT(0x000C, CalcCountRecord.class, CalcCountRecord::new), + CALC_MODE(0x000D, CalcModeRecord.class, CalcModeRecord::new), + PRECISION(0x000E, PrecisionRecord.class, PrecisionRecord::new), + REF_MODE(0x000F, RefModeRecord.class, RefModeRecord::new), + DELTA(0x0010, DeltaRecord.class, DeltaRecord::new), + ITERATION(0x0011, IterationRecord.class, IterationRecord::new), + PROTECT(0x0012, ProtectRecord.class, ProtectRecord::new), + PASSWORD(0x0013, PasswordRecord.class, PasswordRecord::new), + HEADER(0x0014, HeaderRecord.class, HeaderRecord::new), + FOOTER(0x0015, FooterRecord.class, FooterRecord::new), + EXTERN_SHEET(0x0017, ExternSheetRecord.class, ExternSheetRecord::new), + NAME(0x0018, NameRecord.class, NameRecord::new), + WINDOW_PROTECT(0x0019, WindowProtectRecord.class, WindowProtectRecord::new), + VERTICAL_PAGE_BREAK(0x001A, VerticalPageBreakRecord.class, VerticalPageBreakRecord::new), + HORIZONTAL_PAGE_BREAK(0x001B, HorizontalPageBreakRecord.class, HorizontalPageBreakRecord::new), + NOTE(0x001C, NoteRecord.class, NoteRecord::new), + SELECTION(0x001D, SelectionRecord.class, SelectionRecord::new), + DATE_WINDOW_1904(0x0022, DateWindow1904Record.class, DateWindow1904Record::new), + EXTERNAL_NAME(0x0023, ExternalNameRecord.class, ExternalNameRecord::new), + LEFT_MARGIN(0x0026, LeftMarginRecord.class, LeftMarginRecord::new), + RIGHT_MARGIN(0x0027, RightMarginRecord.class, RightMarginRecord::new), + TOP_MARGIN(0x0028, TopMarginRecord.class, TopMarginRecord::new), + BOTTOM_MARGIN(0x0029, BottomMarginRecord.class, BottomMarginRecord::new), + PRINT_HEADERS(0x002A, PrintHeadersRecord.class, PrintHeadersRecord::new), + PRINT_GRIDLINES(0X002B, PrintGridlinesRecord.class, PrintGridlinesRecord::new), + FILE_PASS(0x002F, FilePassRecord.class, FilePassRecord::new), + FONT(0x0031, FontRecord.class, FontRecord::new), + CONTINUE(0x003C, ContinueRecord.class, ContinueRecord::new), + WINDOW_ONE(0x003D, WindowOneRecord.class, WindowOneRecord::new), + BACKUP(0x0040, BackupRecord.class, BackupRecord::new), + PANE(0x0041, PaneRecord.class, PaneRecord::new), + CODEPAGE(0x0042, CodepageRecord.class, CodepageRecord::new), + DCON_REF(0x0051, DConRefRecord.class, DConRefRecord::new), + DEFAULT_COL_WIDTH(0x0055, DefaultColWidthRecord.class, DefaultColWidthRecord::new), + CRN_COUNT(0x0059, CRNCountRecord.class, CRNCountRecord::new), + CRN(0x005A, CRNRecord.class, CRNRecord::new), + WRITE_ACCESS(0x005C, WriteAccessRecord.class, WriteAccessRecord::new), + FILE_SHARING(0x005B, FileSharingRecord.class, FileSharingRecord::new), + OBJ(0x005D, ObjRecord.class, ObjRecord::new), + UNCALCED(0x005E, UncalcedRecord.class, UncalcedRecord::new), + SAVE_RECALC(0x005F, SaveRecalcRecord.class, SaveRecalcRecord::new), + OBJECT_PROTECT(0x0063, ObjectProtectRecord.class, ObjectProtectRecord::new), + COLUMN_INFO(0x007D, ColumnInfoRecord.class, ColumnInfoRecord::new), + GUTS(0x0080, GutsRecord.class, GutsRecord::new), + WS_BOOL(0x0081, WSBoolRecord.class, WSBoolRecord::new), + GRIDSET(0x0082, GridsetRecord.class, GridsetRecord::new), + H_CENTER(0x0083, HCenterRecord.class, HCenterRecord::new), + V_CENTER(0x0084, VCenterRecord.class, VCenterRecord::new), + BOUND_SHEET(0x0085, BoundSheetRecord.class, BoundSheetRecord::new), + WRITE_PROTECT(0x0086, WriteProtectRecord.class, WriteProtectRecord::new), + COUNTRY(0X008C, CountryRecord.class, CountryRecord::new), + HIDE_OBJ(0x008D, HideObjRecord.class, HideObjRecord::new), + PALETTE(0x0092, PaletteRecord.class, PaletteRecord::new), + FN_GROUP_COUNT(0x009c, FnGroupCountRecord.class, FnGroupCountRecord::new), + AUTO_FILTER_INFO(0x009D, AutoFilterInfoRecord.class, AutoFilterInfoRecord::new), + SCL(0x00A0, SCLRecord.class, SCLRecord::new, false), + PRINT_SETUP(0x00A1, PrintSetupRecord.class, PrintSetupRecord::new), + VIEW_DEFINITION(0x00B0, ViewDefinitionRecord.class, ViewDefinitionRecord::new), + VIEW_FIELDS(0x00B1, ViewFieldsRecord.class, ViewFieldsRecord::new), + PAGE_ITEM(0x00B6, PageItemRecord.class, PageItemRecord::new), + MUL_BLANK(0x00BE, MulBlankRecord.class, MulBlankRecord::new), + MUL_RK(0x00BD, MulRKRecord.class, MulRKRecord::new), + MMS(0x00C1, MMSRecord.class, MMSRecord::new), + DATA_ITEM(0x00C5, DataItemRecord.class, DataItemRecord::new), + STREAM_ID(0x00D5, StreamIDRecord.class, StreamIDRecord::new), + DB_CELL(0x00D7, DBCellRecord.class, DBCellRecord::new), + BOOK_BOOL(0x00DA, BookBoolRecord.class, BookBoolRecord::new), + SCENARIO_PROTECT(0x00DD, ScenarioProtectRecord.class, ScenarioProtectRecord::new), + EXTENDED_FORMAT(0x00E0, ExtendedFormatRecord.class, ExtendedFormatRecord::new), + INTERFACE_HDR(0x00E1, InterfaceHdrRecord.class, InterfaceHdrRecord::new), + INTERFACE_END(0x00E2, InterfaceEndRecord.class, InterfaceEndRecord::create), + VIEW_SOURCE(0x00E3, ViewSourceRecord.class, ViewSourceRecord::new), + MERGE_CELLS(0x00E5, MergeCellsRecord.class, MergeCellsRecord::new), + DRAWING_GROUP(0x00EB, DrawingGroupRecord.class, DrawingGroupRecord::new), + DRAWING(0x00EC, DrawingRecord.class, DrawingRecord::new), + DRAWING_SELECTION(0x00ED, DrawingSelectionRecord.class, DrawingSelectionRecord::new), + SST(0x00FC, SSTRecord.class, SSTRecord::new), + LABEL_SST(0X00FD, LabelSSTRecord.class, LabelSSTRecord::new), + EXT_SST(0x00FF, ExtSSTRecord.class, ExtSSTRecord::new), + EXTENDED_PIVOT_TABLE_VIEW_FIELDS(0x0100, ExtendedPivotTableViewFieldsRecord.class, ExtendedPivotTableViewFieldsRecord::new), + TAB_ID(0x013D, TabIdRecord.class, TabIdRecord::new), + USE_SEL_FS(0x0160, UseSelFSRecord.class, UseSelFSRecord::new), + DSF(0x0161, DSFRecord.class, DSFRecord::new), + USER_SVIEW_BEGIN(0x01AA, UserSViewBegin.class, UserSViewBegin::new), + USER_SVIEW_END(0x01AB, UserSViewEnd.class, UserSViewEnd::new), + SUP_BOOK(0x01AE, SupBookRecord.class, SupBookRecord::new), + PROTECTION_REV_4(0x01AF, ProtectionRev4Record.class, ProtectionRev4Record::new), + CF_HEADER(0x01B0, CFHeaderRecord.class, CFHeaderRecord::new), + CF_RULE(0x01B1, CFRuleRecord.class, CFRuleRecord::new), + DVAL(0x01B2, DVALRecord.class, DVALRecord::new), + TEXT_OBJECT(0x01B6, TextObjectRecord.class, TextObjectRecord::new), + REFRESH_ALL(0x01B7, RefreshAllRecord.class, RefreshAllRecord::new), + HYPERLINK(0x01B8, HyperlinkRecord.class, HyperlinkRecord::new), + PASSWORD_REV_4(0x01BC, PasswordRev4Record.class, PasswordRev4Record::new), + DV(0x01BE, DVRecord.class, DVRecord::new), + RECALC_ID(0x01C1, RecalcIdRecord.class, RecalcIdRecord::new), + DIMENSIONS(0x0200, DimensionsRecord.class, DimensionsRecord::new), + BLANK(0x0201, BlankRecord.class, BlankRecord::new), + NUMBER(0x0203, NumberRecord.class, NumberRecord::new), + LABEL(0x0204, LabelRecord.class, LabelRecord::new), + BOOL_ERR(0x0205, BoolErrRecord.class, BoolErrRecord::new), + STRING(0x0207, StringRecord.class, StringRecord::new), + ROW(0x0208, RowRecord.class, RowRecord::new), + INDEX(0x020B, IndexRecord.class, IndexRecord::new), + ARRAY(0x0221, ArrayRecord.class, ArrayRecord::new), + DEFAULT_ROW_HEIGHT(0x0225, DefaultRowHeightRecord.class, DefaultRowHeightRecord::new), + TABLE(0x0236, TableRecord.class, TableRecord::new), + WINDOW_TWO(0x023E, WindowTwoRecord.class, WindowTwoRecord::new), + RK(0x027E, RKRecord.class, RKRecord::new), + STYLE(0x0293, StyleRecord.class, StyleRecord::new), + FORMAT(0x041E, FormatRecord.class, FormatRecord::new), + SHARED_FORMULA(0x04BC, SharedFormulaRecord.class, SharedFormulaRecord::new), + BOF(0x0809, BOFRecord.class, BOFRecord::new), + CHART_FRT_INFO(0x0850, ChartFRTInfoRecord.class, ChartFRTInfoRecord::new), + CHART_START_BLOCK(0x0852, ChartStartBlockRecord.class, ChartStartBlockRecord::new), + CHART_END_BLOCK(0x0853, ChartEndBlockRecord.class, ChartEndBlockRecord::new), + CHART_START_OBJECT(0x0854, ChartStartObjectRecord.class, ChartStartObjectRecord::new), + CHART_END_OBJECT(0x0855, ChartEndObjectRecord.class, ChartEndObjectRecord::new), + CAT_LAB(0x0856, CatLabRecord.class, CatLabRecord::new), + FEAT_HDR(0x0867, FeatHdrRecord.class, FeatHdrRecord::new), + FEAT(0x0868, FeatRecord.class, FeatRecord::new), + DATA_LABEL_EXTENSION(0x086A, DataLabelExtensionRecord.class, DataLabelExtensionRecord::new, false), + CF_HEADER_12(0x0879, CFHeader12Record.class, CFHeader12Record::new), + CF_RULE_12(0x087A, CFRule12Record.class, CFRule12Record::new), + TABLE_STYLES(0x088E, TableStylesRecord.class, TableStylesRecord::new), + NAME_COMMENT(0x0894, NameCommentRecord.class, NameCommentRecord::new), + HEADER_FOOTER(0x089C, HeaderFooterRecord.class, HeaderFooterRecord::new), + UNITS(0x1001, UnitsRecord.class, UnitsRecord::new, false), + CHART(0x1002, ChartRecord.class, ChartRecord::new), + SERIES(0x1003, SeriesRecord.class, SeriesRecord::new), + DATA_FORMAT(0x1006, DataFormatRecord.class, DataFormatRecord::new), + LINE_FORMAT(0x1007, LineFormatRecord.class, LineFormatRecord::new, false), + AREA_FORMAT(0x100A, AreaFormatRecord.class, AreaFormatRecord::new, false), + SERIES_LABELS(0x100C, SeriesLabelsRecord.class, SeriesLabelsRecord::new, false), + SERIES_TEXT(0x100D, SeriesTextRecord.class, SeriesTextRecord::new), + CHART_FORMAT(0x1014, ChartFormatRecord.class, ChartFormatRecord::new, false), + LEGEND(0x1015, LegendRecord.class, LegendRecord::new), + SERIES_LIST(0x1016, SeriesListRecord.class, SeriesListRecord::new, false), + BAR(0x1017, BarRecord.class, BarRecord::new, false), + AREA(0x101A, AreaRecord.class, AreaRecord::new), + AXIS(0x101D, AxisRecord.class, AxisRecord::new, false), + TICK(0x101E, TickRecord.class, TickRecord::new, false), + VALUE_RANGE(0x101F, ValueRangeRecord.class, ValueRangeRecord::new), + CATEGORY_SERIES_AXIS(0x1020, CategorySeriesAxisRecord.class, CategorySeriesAxisRecord::new, false), + AXIS_LINE_FORMAT(0x1021, AxisLineFormatRecord.class, AxisLineFormatRecord::new, false), + DEFAULT_DATA_LABEL_TEXT_PROPERTIES(0x1024, DefaultDataLabelTextPropertiesRecord.class, DefaultDataLabelTextPropertiesRecord::new, false), + TEXT(0x1025, TextRecord.class, TextRecord::new, false), + FONT_INDEX(0x1026, FontIndexRecord.class, FontIndexRecord::new, false), + OBJECT_LINK(0x1027, ObjectLinkRecord.class, ObjectLinkRecord::new, false), + FRAME(0x1032, FrameRecord.class, FrameRecord::new, false), + BEGIN(0x1033, BeginRecord.class, BeginRecord::new), + END(0x1034, EndRecord.class, EndRecord::new), + PLOT_AREA(0x1035, PlotAreaRecord.class, PlotAreaRecord::new, false), + AXIS_PARENT(0x1041, AxisParentRecord.class, AxisParentRecord::new, false), + SHEET_PROPERTIES(0x1044, SheetPropertiesRecord.class, SheetPropertiesRecord::new, false), + SERIES_CHART_GROUP_INDEX(0x1045, SeriesChartGroupIndexRecord.class, SeriesChartGroupIndexRecord::new), + AXIS_USED(0x1046, AxisUsedRecord.class, AxisUsedRecord::new, false), + NUMBER_FORMAT_INDEX(0x104E, NumberFormatIndexRecord.class, NumberFormatIndexRecord::new, false), + CHART_TITLE_FORMAT(0x1050, ChartTitleFormatRecord.class, ChartTitleFormatRecord::new), + LINKED_DATA(0x1051, LinkedDataRecord.class, LinkedDataRecord::new), + FONT_BASIS(0x1060, FontBasisRecord.class, FontBasisRecord::new, false), + AXIS_OPTIONS(0x1062, AxisOptionsRecord.class, AxisOptionsRecord::new, false), + DAT(0x1063, DatRecord.class, DatRecord::new, false), + PLOT_GROWTH(0x1064, PlotGrowthRecord.class, PlotGrowthRecord::new, false), + SERIES_INDEX(0x1065, SeriesIndexRecord.class, SeriesIndexRecord::new, false), // Dummy record - ESCHER_AGGREGATE(9876, (in) -> new EscherAggregate(true)) + ESCHER_AGGREGATE(9876, EscherAggregate.class, (in) -> new EscherAggregate(true)) ; @FunctionalInterface @@ -209,25 +211,42 @@ public enum HSSFRecordTypes { T apply(RecordInputStream in); } - private static final Map<Short,HSSFRecordTypes> LOOKUP; - - static { - LOOKUP = new HashMap<>(); - for(HSSFRecordTypes s : values()) { - LOOKUP.put(s.sid, s); - } - } + private static final Map<Short,HSSFRecordTypes> LOOKUP = + Arrays.stream(values()).collect(Collectors.toMap(HSSFRecordTypes::getSid, Function.identity())); public final short sid; - public final RecordConstructor<?> recordConstructor; + public final Class<? extends org.apache.poi.hssf.record.Record> clazz; + public final RecordConstructor<? extends org.apache.poi.hssf.record.Record> recordConstructor; + public final boolean parse; + + HSSFRecordTypes(int sid, Class<? extends org.apache.poi.hssf.record.Record> clazz, RecordConstructor<? extends org.apache.poi.hssf.record.Record> recordConstructor) { + this(sid, clazz, recordConstructor,true); + } - HSSFRecordTypes(int sid, RecordConstructor<?> recordConstructor) { + HSSFRecordTypes(int sid, Class<? extends org.apache.poi.hssf.record.Record> clazz, RecordConstructor<? extends org.apache.poi.hssf.record.Record> recordConstructor, boolean parse) { this.sid = (short)sid; + this.clazz = clazz; this.recordConstructor = recordConstructor; + this.parse = parse; + } + + public static HSSFRecordTypes forSID(int sid) { + return LOOKUP.getOrDefault((short)sid, UNKNOWN); } - public static HSSFRecordTypes forTypeID(int typeID) { - return LOOKUP.getOrDefault((short)typeID, UNKNOWN); + public short getSid() { + return sid; } + public Class<? extends Record> getClazz() { + return clazz; + } + + public RecordConstructor<? extends org.apache.poi.hssf.record.Record> getRecordConstructor() { + return recordConstructor; + } + + public boolean isParseable() { + return parse; + } } diff --git a/src/java/org/apache/poi/hssf/record/RecordFactory.java b/src/java/org/apache/poi/hssf/record/RecordFactory.java index cb79743ddc..86014c4d2b 100644 --- a/src/java/org/apache/poi/hssf/record/RecordFactory.java +++ b/src/java/org/apache/poi/hssf/record/RecordFactory.java @@ -18,44 +18,9 @@ package org.apache.poi.hssf.record; import java.io.InputStream; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import org.apache.poi.EncryptedDocumentException; -import org.apache.poi.hssf.record.chart.BeginRecord; -import org.apache.poi.hssf.record.chart.CatLabRecord; -import org.apache.poi.hssf.record.chart.ChartEndBlockRecord; -import org.apache.poi.hssf.record.chart.ChartEndObjectRecord; -import org.apache.poi.hssf.record.chart.ChartFRTInfoRecord; -import org.apache.poi.hssf.record.chart.ChartRecord; -import org.apache.poi.hssf.record.chart.ChartStartBlockRecord; -import org.apache.poi.hssf.record.chart.ChartStartObjectRecord; -import org.apache.poi.hssf.record.chart.ChartTitleFormatRecord; -import org.apache.poi.hssf.record.chart.DataFormatRecord; -import org.apache.poi.hssf.record.chart.EndRecord; -import org.apache.poi.hssf.record.chart.LegendRecord; -import org.apache.poi.hssf.record.chart.LinkedDataRecord; -import org.apache.poi.hssf.record.chart.SeriesChartGroupIndexRecord; -import org.apache.poi.hssf.record.chart.SeriesRecord; -import org.apache.poi.hssf.record.chart.SeriesTextRecord; -import org.apache.poi.hssf.record.chart.ValueRangeRecord; -import org.apache.poi.hssf.record.pivottable.DataItemRecord; -import org.apache.poi.hssf.record.pivottable.ExtendedPivotTableViewFieldsRecord; -import org.apache.poi.hssf.record.pivottable.PageItemRecord; -import org.apache.poi.hssf.record.pivottable.StreamIDRecord; -import org.apache.poi.hssf.record.pivottable.ViewDefinitionRecord; -import org.apache.poi.hssf.record.pivottable.ViewFieldsRecord; -import org.apache.poi.hssf.record.pivottable.ViewSourceRecord; /** * Title: Record Factory<p> @@ -66,226 +31,7 @@ import org.apache.poi.hssf.record.pivottable.ViewSourceRecord; public final class RecordFactory { private static final int NUM_RECORDS = 512; - private interface I_RecordCreator { - Record create(RecordInputStream in); - - Class<? extends Record> getRecordClass(); - } - private static final class ReflectionConstructorRecordCreator implements I_RecordCreator { - - private final Constructor<? extends Record> _c; - public ReflectionConstructorRecordCreator(Constructor<? extends Record> c) { - _c = c; - } - @Override - public Record create(RecordInputStream in) { - Object[] args = { in, }; - try { - return _c.newInstance(args); - } catch (IllegalArgumentException | IllegalAccessException | InstantiationException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - Throwable t = e.getTargetException(); - if (t instanceof org.apache.poi.util.RecordFormatException) { - throw (org.apache.poi.util.RecordFormatException)t; - } else if (t instanceof EncryptedDocumentException) { - throw (EncryptedDocumentException)t; - } else { - throw new org.apache.poi.util.RecordFormatException("Unable to construct record instance" , t); - } - } - } - @Override - public Class<? extends Record> getRecordClass() { - return _c.getDeclaringClass(); - } - } - /** - * A "create" method is used instead of the usual constructor if the created record might - * be of a different class to the declaring class. - */ - private static final class ReflectionMethodRecordCreator implements I_RecordCreator { - private final Method _m; - public ReflectionMethodRecordCreator(Method m) { - _m = m; - } - @Override - public Record create(RecordInputStream in) { - Object[] args = { in, }; - try { - return (org.apache.poi.hssf.record.Record) _m.invoke(null, args); - } catch (IllegalArgumentException | IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - throw new org.apache.poi.util.RecordFormatException("Unable to construct record instance" , e.getTargetException()); - } - } - @Override - @SuppressWarnings("unchecked") - public Class<? extends Record> getRecordClass() { - return (Class<? extends Record>) _m.getDeclaringClass(); - } - } - - private static final Class<?>[] CONSTRUCTOR_ARGS = { RecordInputStream.class, }; - - /** - * contains the classes for all the records we want to parse.<br> - * Note - this most but not *every* subclass of Record. - */ - @SuppressWarnings("unchecked") - private static final Class<? extends Record>[] recordClasses = new Class[] { - ArrayRecord.class, - AutoFilterInfoRecord.class, - BackupRecord.class, - BlankRecord.class, - BOFRecord.class, - BookBoolRecord.class, - BoolErrRecord.class, - BottomMarginRecord.class, - BoundSheetRecord.class, - CalcCountRecord.class, - CalcModeRecord.class, - CFHeaderRecord.class, - CFHeader12Record.class, - CFRuleRecord.class, - CFRule12Record.class, - ChartRecord.class, - ChartTitleFormatRecord.class, - CodepageRecord.class, - ColumnInfoRecord.class, - ContinueRecord.class, - CountryRecord.class, - CRNCountRecord.class, - CRNRecord.class, - DateWindow1904Record.class, - DBCellRecord.class, - DConRefRecord.class, - DefaultColWidthRecord.class, - DefaultRowHeightRecord.class, - DeltaRecord.class, - DimensionsRecord.class, - DrawingGroupRecord.class, - DrawingRecord.class, - DrawingSelectionRecord.class, - DSFRecord.class, - DVALRecord.class, - DVRecord.class, - EOFRecord.class, - ExtendedFormatRecord.class, - ExternalNameRecord.class, - ExternSheetRecord.class, - ExtSSTRecord.class, - FeatRecord.class, - FeatHdrRecord.class, - FilePassRecord.class, - FileSharingRecord.class, - FnGroupCountRecord.class, - FontRecord.class, - FooterRecord.class, - FormatRecord.class, - FormulaRecord.class, - GridsetRecord.class, - GutsRecord.class, - HCenterRecord.class, - HeaderRecord.class, - HeaderFooterRecord.class, - HideObjRecord.class, - HorizontalPageBreakRecord.class, - HyperlinkRecord.class, - IndexRecord.class, - InterfaceEndRecord.class, - InterfaceHdrRecord.class, - IterationRecord.class, - LabelRecord.class, - LabelSSTRecord.class, - LeftMarginRecord.class, - LegendRecord.class, - MergeCellsRecord.class, - MMSRecord.class, - MulBlankRecord.class, - MulRKRecord.class, - NameRecord.class, - NameCommentRecord.class, - NoteRecord.class, - NumberRecord.class, - ObjectProtectRecord.class, - ObjRecord.class, - PaletteRecord.class, - PaneRecord.class, - PasswordRecord.class, - PasswordRev4Record.class, - PrecisionRecord.class, - PrintGridlinesRecord.class, - PrintHeadersRecord.class, - PrintSetupRecord.class, - ProtectionRev4Record.class, - ProtectRecord.class, - RecalcIdRecord.class, - RefModeRecord.class, - RefreshAllRecord.class, - RightMarginRecord.class, - RKRecord.class, - RowRecord.class, - SaveRecalcRecord.class, - ScenarioProtectRecord.class, - SelectionRecord.class, - SeriesRecord.class, - SeriesTextRecord.class, - SharedFormulaRecord.class, - SSTRecord.class, - StringRecord.class, - StyleRecord.class, - SupBookRecord.class, - TabIdRecord.class, - TableRecord.class, - TableStylesRecord.class, - TextObjectRecord.class, - TopMarginRecord.class, - UncalcedRecord.class, - UseSelFSRecord.class, - UserSViewBegin.class, - UserSViewEnd.class, - ValueRangeRecord.class, - VCenterRecord.class, - VerticalPageBreakRecord.class, - WindowOneRecord.class, - WindowProtectRecord.class, - WindowTwoRecord.class, - WriteAccessRecord.class, - WriteProtectRecord.class, - WSBoolRecord.class, - - // chart records - BeginRecord.class, - ChartFRTInfoRecord.class, - ChartStartBlockRecord.class, - ChartEndBlockRecord.class, - // TODO ChartFormatRecord.class, - ChartStartObjectRecord.class, - ChartEndObjectRecord.class, - CatLabRecord.class, - DataFormatRecord.class, - EndRecord.class, - LinkedDataRecord.class, - SeriesChartGroupIndexRecord.class, - - // pivot table records - DataItemRecord.class, - ExtendedPivotTableViewFieldsRecord.class, - PageItemRecord.class, - StreamIDRecord.class, - ViewDefinitionRecord.class, - ViewFieldsRecord.class, - ViewSourceRecord.class, - }; - - /** - * cache of the recordsToMap(); - */ - private static final Map<Integer, I_RecordCreator> _recordCreatorsById = recordsToMap(recordClasses); - - private static short[] _allKnownRecordSIDs; + private RecordFactory() {} /** * Debug / diagnosis method<p> @@ -300,11 +46,7 @@ public final class RecordFactory { * {@code null} if the specified record is not interpreted by POI. */ public static Class<? extends Record> getRecordClass(int sid) { - I_RecordCreator rc = _recordCreatorsById.get(Integer.valueOf(sid)); - if (rc == null) { - return null; - } - return rc.getRecordClass(); + return HSSFRecordTypes.forSID(sid).clazz; } /** @@ -330,13 +72,11 @@ public final class RecordFactory { } public static org.apache.poi.hssf.record.Record createSingleRecord(RecordInputStream in) { - I_RecordCreator constructor = _recordCreatorsById.get(Integer.valueOf(in.getSid())); - - if (constructor == null) { - return new UnknownRecord(in); + HSSFRecordTypes rec = HSSFRecordTypes.forSID(in.getSid()); + if (!rec.isParseable()) { + rec = HSSFRecordTypes.UNKNOWN; } - - return constructor.create(in); + return rec.recordConstructor.apply(in); } /** @@ -399,77 +139,15 @@ public final class RecordFactory { * @return an array of all the SIDS for all known records */ public static short[] getAllKnownRecordSIDs() { - if (_allKnownRecordSIDs == null) { - short[] results = new short[ _recordCreatorsById.size() ]; - int i = 0; - - for (Integer sid : _recordCreatorsById.keySet()) { - results[i++] = sid.shortValue(); - } - Arrays.sort(results); - _allKnownRecordSIDs = results; + int[] intSid = Arrays.stream(HSSFRecordTypes.values()).mapToInt(HSSFRecordTypes::getSid).toArray(); + short[] shortSid = new short[intSid.length]; + for (int i=0; i<intSid.length; i++) { + shortSid[i] = (short)intSid[i]; } - - return _allKnownRecordSIDs.clone(); + return shortSid; } /** - * gets the record constructors and sticks them in the map by SID - * @return map of SIDs to short,short,byte[] constructors for Record classes - * most of org.apache.poi.hssf.record.* - */ - private static Map<Integer, I_RecordCreator> recordsToMap(Class<? extends Record> [] records) { - Map<Integer, I_RecordCreator> result = new HashMap<>(); - Set<Class<?>> uniqueRecClasses = new HashSet<>(records.length * 3 / 2); - - for (Class<? extends Record> recClass : records) { - if(!Record.class.isAssignableFrom(recClass)) { - throw new RuntimeException("Invalid record sub-class (" + recClass.getName() + ")"); - } - if(Modifier.isAbstract(recClass.getModifiers())) { - throw new RuntimeException("Invalid record class (" + recClass.getName() + ") - must not be abstract"); - } - if(!uniqueRecClasses.add(recClass)) { - throw new RuntimeException("duplicate record class (" + recClass.getName() + ")"); - } - - int sid; - try { - sid = recClass.getField("sid").getShort(null); - } catch (Exception illegalArgumentException) { - throw new org.apache.poi.util.RecordFormatException( - "Unable to determine record types"); - } - Integer key = Integer.valueOf(sid); - if (result.containsKey(key)) { - Class<?> prevClass = result.get(key).getRecordClass(); - throw new RuntimeException("duplicate record sid 0x" + - Integer.toHexString(sid).toUpperCase(Locale.ROOT) - + " for classes (" + recClass.getName() + ") and (" - + prevClass.getName() + ")"); - } - result.put(key, getRecordCreator(recClass)); - } - // result.put(Integer.valueOf(0x0406), result.get(Integer.valueOf(0x06))); - return result; - } - - private static I_RecordCreator getRecordCreator(Class<? extends Record> recClass) { - try { - Constructor<? extends Record> constructor; - constructor = recClass.getConstructor(CONSTRUCTOR_ARGS); - return new ReflectionConstructorRecordCreator(constructor); - } catch (NoSuchMethodException e) { - // fall through and look for other construction methods - } - try { - Method m = recClass.getDeclaredMethod("create", CONSTRUCTOR_ARGS); - return new ReflectionMethodRecordCreator(m); - } catch (NoSuchMethodException e) { - throw new RuntimeException("Failed to find constructor or create method for (" + recClass.getName() + ")."); - } - } - /** * Create an array of records from an input stream * * @param in the InputStream from which the records will be obtained diff --git a/src/java/org/apache/poi/hssf/record/SubRecord.java b/src/java/org/apache/poi/hssf/record/SubRecord.java index 0bfa673d69..0c41e051de 100644 --- a/src/java/org/apache/poi/hssf/record/SubRecord.java +++ b/src/java/org/apache/poi/hssf/record/SubRecord.java @@ -18,9 +18,11 @@ package org.apache.poi.hssf.record; import java.io.ByteArrayOutputStream; -import java.util.HashMap; +import java.util.Arrays; import java.util.Map; +import java.util.function.Function; import java.util.function.Supplier; +import java.util.stream.Collectors; import org.apache.poi.common.Duplicatable; import org.apache.poi.common.usermodel.GenericRecord; @@ -50,8 +52,6 @@ public abstract class SubRecord implements Duplicatable, GenericRecord { COMMON_OBJECT_DATA(0x0015, CommonObjectDataSubRecord::new), ; - - @FunctionalInterface public interface RecordConstructor<T extends SubRecord> { /** @@ -65,14 +65,8 @@ public abstract class SubRecord implements Duplicatable, GenericRecord { T apply(LittleEndianInput in, int size, int cmoOt); } - private static final Map<Short,SubRecordTypes> LOOKUP; - - static { - LOOKUP = new HashMap<>(); - for(SubRecordTypes s : values()) { - LOOKUP.put(s.sid, s); - } - } + private static final Map<Short,SubRecordTypes> LOOKUP = + Arrays.stream(values()).collect(Collectors.toMap(SubRecordTypes::getSid, Function.identity())); public final short sid; public final RecordConstructor<?> recordConstructor; @@ -82,10 +76,13 @@ public abstract class SubRecord implements Duplicatable, GenericRecord { this.recordConstructor = recordConstructor; } - public static SubRecordTypes forTypeID(int typeID) { - return LOOKUP.getOrDefault((short)typeID, UNKNOWN); + public static SubRecordTypes forSID(int sid) { + return LOOKUP.getOrDefault((short)sid, UNKNOWN); } + public short getSid() { + return sid; + } } @@ -106,29 +103,10 @@ public abstract class SubRecord implements Duplicatable, GenericRecord { */ public static SubRecord createSubRecord(LittleEndianInput in, int cmoOt) { int sid = in.readUShort(); - int secondUShort = in.readUShort(); // Often (but not always) the datasize for the sub-record - - switch (sid) { - case CommonObjectDataSubRecord.sid: - return new CommonObjectDataSubRecord(in, secondUShort); - case EmbeddedObjectRefSubRecord.sid: - return new EmbeddedObjectRefSubRecord(in, secondUShort); - case GroupMarkerSubRecord.sid: - return new GroupMarkerSubRecord(in, secondUShort); - case EndSubRecord.sid: - return new EndSubRecord(in, secondUShort); - case NoteStructureSubRecord.sid: - return new NoteStructureSubRecord(in, secondUShort); - case LbsDataSubRecord.sid: - return new LbsDataSubRecord(in, secondUShort, cmoOt); - case FtCblsSubRecord.sid: - return new FtCblsSubRecord(in, secondUShort); - case FtPioGrbitSubRecord.sid: - return new FtPioGrbitSubRecord(in, secondUShort); - case FtCfSubRecord.sid: - return new FtCfSubRecord(in, secondUShort); - } - return new UnknownSubRecord(in, sid, secondUShort); + // Often (but not always) the datasize for the sub-record + int size = in.readUShort(); + SubRecordTypes srt = SubRecordTypes.forSID(sid); + return srt.recordConstructor.apply(in, size, srt == SubRecordTypes.UNKNOWN ? sid : cmoOt); } @Override @@ -172,7 +150,7 @@ public abstract class SubRecord implements Duplicatable, GenericRecord { private final int _sid; private final byte[] _data; - public UnknownSubRecord(LittleEndianInput in, int sid, int size) { + public UnknownSubRecord(LittleEndianInput in, int size, int sid) { _sid = sid; byte[] buf = IOUtils.safelyAllocate(size, MAX_RECORD_LENGTH); in.readFully(buf); diff --git a/src/java/org/apache/poi/hssf/record/SupBookRecord.java b/src/java/org/apache/poi/hssf/record/SupBookRecord.java index 2ba5814bb1..fd98ec88be 100644 --- a/src/java/org/apache/poi/hssf/record/SupBookRecord.java +++ b/src/java/org/apache/poi/hssf/record/SupBookRecord.java @@ -52,8 +52,8 @@ public final class SupBookRecord extends StandardRecord { private short field_1_number_of_sheets; private String field_2_encoded_url; - private String[] field_3_sheet_names; - private boolean _isAddInFunctions; + private final String[] field_3_sheet_names; + private final boolean _isAddInFunctions; public SupBookRecord(SupBookRecord other) { super(other); @@ -185,14 +185,16 @@ public final class SupBookRecord extends StandardRecord { } public String getURL() { String encodedUrl = field_2_encoded_url; - switch(encodedUrl == null ? -1 : encodedUrl.charAt(0)) { - case 0: // Reference to an empty workbook name - return encodedUrl.substring(1); // will this just be empty string? - case 1: // encoded file name - return decodeFileName(encodedUrl); - case 2: // Self-referential external reference - return encodedUrl.substring(1); + if (encodedUrl != null && encodedUrl.length() >= 2) { + switch(encodedUrl.charAt(0)) { + case 0: // Reference to an empty workbook name + case 2: // Self-referential external reference + // will this just be empty string? + return encodedUrl.substring(1); + case 1: // encoded file name + return decodeFileName(encodedUrl); + } } return encodedUrl; } @@ -212,9 +214,7 @@ public final class SupBookRecord extends StandardRecord { } break; case CH_SAME_VOLUME: - sb.append(PATH_SEPERATOR); - break; - case CH_DOWN_DIR: + case CH_DOWN_DIR: sb.append(PATH_SEPERATOR); break; case CH_UP_DIR: |