aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-02-22 01:06:13 +0000
committerPJ Fanning <fanningpj@apache.org>2022-02-22 01:06:13 +0000
commit877d9f33a5005d87a729f5b5b52c920f4a480491 (patch)
tree129a8c988eb9130caeda034877a124efea847175
parentb3c48572225a3365b9c1c05639086b37e1c4e38e (diff)
downloadpoi-877d9f33a5005d87a729f5b5b52c920f4a480491.tar.gz
poi-877d9f33a5005d87a729f5b5b52c920f4a480491.zip
sonar issues
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898297 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/model/InternalSheet.java12
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java40
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java4
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/atp/WorkdayCalculator.java28
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java3
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/functions/DollarFr.java2
-rw-r--r--poi/src/main/java/org/apache/poi/ss/usermodel/DateUtil.java4
7 files changed, 23 insertions, 70 deletions
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<HSSFPictureData> getAllPictures() {
// The drawing group record always exists at the top level, so we won't need to do this recursively.
List<HSSFPictureData> 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<EscherRecord> 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<Integer> standardWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.SATURDAY, Calendar.SUNDAY}));
+ new HashSet<>(Arrays.asList(Calendar.SATURDAY, Calendar.SUNDAY));
private static final Set<Integer> sunMonWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.SUNDAY, Calendar.MONDAY}));
+ new HashSet<>(Arrays.asList(Calendar.SUNDAY, Calendar.MONDAY));
private static final Set<Integer> monTuesWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.MONDAY, Calendar.TUESDAY}));
+ new HashSet<>(Arrays.asList(Calendar.MONDAY, Calendar.TUESDAY));
private static final Set<Integer> tuesWedsWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.TUESDAY, Calendar.WEDNESDAY}));
+ new HashSet<>(Arrays.asList(Calendar.TUESDAY, Calendar.WEDNESDAY));
private static final Set<Integer> wedsThursWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.WEDNESDAY, Calendar.THURSDAY}));
+ new HashSet<>(Arrays.asList(Calendar.WEDNESDAY, Calendar.THURSDAY));
private static final Set<Integer> thursFriWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.THURSDAY, Calendar.FRIDAY}));
+ new HashSet<>(Arrays.asList(Calendar.THURSDAY, Calendar.FRIDAY));
private static final Set<Integer> friSatWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.FRIDAY, Calendar.SATURDAY}));
+ new HashSet<>(Arrays.asList(Calendar.FRIDAY, Calendar.SATURDAY));
private static final Set<Integer> monWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.MONDAY}));
+ new HashSet<>(Arrays.asList(Calendar.MONDAY));
private static final Set<Integer> tuesWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.TUESDAY}));
+ new HashSet<>(Arrays.asList(Calendar.TUESDAY));
private static final Set<Integer> wedsWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.WEDNESDAY}));
+ new HashSet<>(Arrays.asList(Calendar.WEDNESDAY));
private static final Set<Integer> thursWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.THURSDAY}));
+ new HashSet<>(Arrays.asList(Calendar.THURSDAY));
private static final Set<Integer> friWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.FRIDAY}));
+ new HashSet<>(Arrays.asList(Calendar.FRIDAY));
private static final Set<Integer> satWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.SATURDAY}));
+ new HashSet<>(Arrays.asList(Calendar.SATURDAY));
private static final Set<Integer> sunWeekend =
- new HashSet<>(Arrays.asList(new Integer[]{Calendar.SUNDAY}));
+ new HashSet<>(Arrays.asList(Calendar.SUNDAY));
private static final Map<Integer, Set<Integer>> 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.
* <p>
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
}