sonar issues

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898297 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-02-22 01:06:13 +00:00
parent b3c4857222
commit 877d9f33a5
7 changed files with 23 additions and 70 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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 {

View File

@ -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>

View File

@ -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.

View File

@ -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
}