diff --git a/poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java b/poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java index 055acaae99..37e7595a53 100644 --- a/poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java +++ b/poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java @@ -561,17 +561,17 @@ public final class InternalSheet { boolean haveSerializedIndex = false; for (int k = 0; k < _records.size(); k++) { - RecordBase record = _records.get(k); + RecordBase recordBase = _records.get(k); - if (record instanceof RecordAggregate) { - RecordAggregate agg = (RecordAggregate) record; + if (recordBase instanceof RecordAggregate) { + RecordAggregate agg = (RecordAggregate) recordBase; agg.visitContainedRecords(ptv); - } else { - ptv.visitRecord((Record) record); + } else if (recordBase instanceof Record) { + ptv.visitRecord((Record) recordBase); } // If the BOF record was just serialized then add the IndexRecord - if (record instanceof BOFRecord) { + if (recordBase instanceof BOFRecord) { if (!haveSerializedIndex) { haveSerializedIndex = true; // Add an optional UncalcedRecord. However, we should add diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java deleted file mode 100644 index 3a31f0cc70..0000000000 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java +++ /dev/null @@ -1,40 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - - - -/* - * DateUtil.java - * - * Created on January 19, 2002, 9:30 AM - */ -package org.apache.poi.hssf.usermodel; - -import java.util.Calendar; - -import org.apache.poi.ss.usermodel.DateUtil; - -/** - * Contains methods for dealing with Excel dates. - * @deprecated Use {@link DateUtil} instead - */ -@Deprecated -public final class HSSFDateUtil extends DateUtil { - protected static int absoluteDay(Calendar cal, boolean use1904windowing) { - return DateUtil.absoluteDay(cal, use1904windowing); - } -} diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 9b79919177..10d3d4964b 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -1763,7 +1763,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { } } if (refModeRecord == null) { - continue; + //no-op } else if (refModeRecord.getMode() == RefModeRecord.USE_R1C1_MODE) { return CellReferenceType.R1C1; } else if (refModeRecord.getMode() == RefModeRecord.USE_A1_MODE) { @@ -2043,7 +2043,7 @@ public final class HSSFWorkbook extends POIDocument implements Workbook { public List getAllPictures() { // The drawing group record always exists at the top level, so we won't need to do this recursively. List pictures = new ArrayList<>(); - for (RecordBase r : workbook.getRecords()) { + for (org.apache.poi.hssf.record.Record r : workbook.getRecords()) { if (r instanceof AbstractEscherHolderRecord) { ((AbstractEscherHolderRecord) r).decode(); List escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords(); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayCalculator.java b/poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayCalculator.java index 67b20b3954..1ed7533907 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayCalculator.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayCalculator.java @@ -36,33 +36,33 @@ public class WorkdayCalculator { public static final WorkdayCalculator instance = new WorkdayCalculator(); private static final Set standardWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.SATURDAY, Calendar.SUNDAY})); + new HashSet<>(Arrays.asList(Calendar.SATURDAY, Calendar.SUNDAY)); private static final Set sunMonWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.SUNDAY, Calendar.MONDAY})); + new HashSet<>(Arrays.asList(Calendar.SUNDAY, Calendar.MONDAY)); private static final Set monTuesWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.MONDAY, Calendar.TUESDAY})); + new HashSet<>(Arrays.asList(Calendar.MONDAY, Calendar.TUESDAY)); private static final Set tuesWedsWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.TUESDAY, Calendar.WEDNESDAY})); + new HashSet<>(Arrays.asList(Calendar.TUESDAY, Calendar.WEDNESDAY)); private static final Set wedsThursWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.WEDNESDAY, Calendar.THURSDAY})); + new HashSet<>(Arrays.asList(Calendar.WEDNESDAY, Calendar.THURSDAY)); private static final Set thursFriWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.THURSDAY, Calendar.FRIDAY})); + new HashSet<>(Arrays.asList(Calendar.THURSDAY, Calendar.FRIDAY)); private static final Set friSatWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.FRIDAY, Calendar.SATURDAY})); + new HashSet<>(Arrays.asList(Calendar.FRIDAY, Calendar.SATURDAY)); private static final Set monWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.MONDAY})); + new HashSet<>(Arrays.asList(Calendar.MONDAY)); private static final Set tuesWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.TUESDAY})); + new HashSet<>(Arrays.asList(Calendar.TUESDAY)); private static final Set wedsWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.WEDNESDAY})); + new HashSet<>(Arrays.asList(Calendar.WEDNESDAY)); private static final Set thursWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.THURSDAY})); + new HashSet<>(Arrays.asList(Calendar.THURSDAY)); private static final Set friWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.FRIDAY})); + new HashSet<>(Arrays.asList(Calendar.FRIDAY)); private static final Set satWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.SATURDAY})); + new HashSet<>(Arrays.asList(Calendar.SATURDAY)); private static final Set sunWeekend = - new HashSet<>(Arrays.asList(new Integer[]{Calendar.SUNDAY})); + new HashSet<>(Arrays.asList(Calendar.SUNDAY)); private static final Map> weekendTypeMap = new HashMap<>(); static { diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java index 9da3e3bb4a..8d37156491 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java @@ -24,9 +24,6 @@ import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.ValueEval; -import java.math.BigDecimal; -import java.math.MathContext; - /** * Implementation for Excel BESSELJ() function. *

diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/DollarFr.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/DollarFr.java index 75dcc58543..b08b562ea4 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/DollarFr.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/DollarFr.java @@ -26,8 +26,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; import java.math.BigDecimal; import java.math.MathContext; -import java.text.NumberFormat; -import java.util.Locale; /** * Implementation for Excel DOLLARFR() function. diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java b/poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java index 154127a50c..36f4af592e 100644 --- a/poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java +++ b/poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java @@ -23,7 +23,6 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; -import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.temporal.ChronoField; @@ -42,8 +41,7 @@ import org.apache.poi.util.LocaleUtil; * Contains methods for dealing with Excel dates. */ public class DateUtil { - // FIXME this should be changed to private and the class marked final once HSSFDateUtil can be removed - protected DateUtil() { + private DateUtil() { // no instances of this class }