Skip to content

Commit

Permalink
refine conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
XenoAmess committed Jul 15, 2022
1 parent 8fbe396 commit 0793324
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void processAttachment(AttachmentChunks attachment,
* @param args the list of MSG files to process
*/
public static void main(String[] args) {
if(args.length <= 0) {
if(args.length == 0) {
System.err.println("No files names provided");
} else {
for (String arg : args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public XWPFHeaderFooterPolicy(XWPFDocument doc, CTSectPr sectPr) {
CTHdrFtrRef ref = sectPr.getHeaderReferenceArray(i);
POIXMLDocumentPart relatedPart = doc.getRelationById(ref.getId());
XWPFHeader hdr = null;
if (relatedPart != null && relatedPart instanceof XWPFHeader) {
if (relatedPart instanceof XWPFHeader) {
hdr = (XWPFHeader) relatedPart;
}
// Assign it; treat invalid options as "default" POI-60293
Expand All @@ -128,7 +128,7 @@ public XWPFHeaderFooterPolicy(XWPFDocument doc, CTSectPr sectPr) {
CTHdrFtrRef ref = sectPr.getFooterReferenceArray(i);
POIXMLDocumentPart relatedPart = doc.getRelationById(ref.getId());
XWPFFooter ftr = null;
if (relatedPart != null && relatedPart instanceof XWPFFooter) {
if (relatedPart instanceof XWPFFooter) {
ftr = (XWPFFooter) relatedPart;
}
// Assign it; treat invalid options as "default" POI-60293
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public String addPictureData(InputStream is, int format) throws InvalidFormatExc
*/
public XWPFPictureData getPictureDataByID(String blipID) {
POIXMLDocumentPart relatedPart = getRelationById(blipID);
if (relatedPart != null && relatedPart instanceof XWPFPictureData) {
if (relatedPart instanceof XWPFPictureData) {
return (XWPFPictureData) relatedPart;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static void skipPadding( LittleEndianByteArrayInputStream lei ) {
for (int i=0; i<skipBytes; i++) {
lei.mark(1);
int b = lei.read();
if (b == -1 || b != 0) {
if (b != 0) {
lei.reset();
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2552,7 +2552,7 @@ private void setRepeatingRowsAndColumns(
if (rowDef != null) {
row1 = rowDef.getFirstRow();
row2 = rowDef.getLastRow();
if ((row1 == -1 && row2 != -1) || (row1 > row2)
if ((row1 > row2)
|| (row1 < 0 || row1 > maxRowIndex)
|| (row2 < 0 || row2 > maxRowIndex)) {
throw new IllegalArgumentException("Invalid row range specification");
Expand All @@ -2561,7 +2561,7 @@ private void setRepeatingRowsAndColumns(
if (colDef != null) {
col1 = colDef.getFirstColumn();
col2 = colDef.getLastColumn();
if ((col1 == -1 && col2 != -1) || (col1 > col2)
if ((col1 > col2)
|| (col1 < 0 || col1 > maxColIndex)
|| (col2 < 0 || col2 > maxColIndex)) {
throw new IllegalArgumentException("Invalid column range specification");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public static Collection<String> getNotSupportedFunctionNames() {
Collection<String> lst = new TreeSet<>();
for (int i = 0; i < functions.length; i++) {
Function func = functions[i];
if (func != null && (func instanceof NotImplementedFunction)) {
if ((func instanceof NotImplementedFunction)) {
FunctionMetadata metaData = FunctionMetadataRegistry.getFunctionByIndex(i);
lst.add(metaData.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public static double tanh(double d) {
*/
public static double nChooseK(int n, int k) {
double d = 1;
if (n<0 || k<0 || n<k) {
if (k < 0 || n < k) {
d= Double.NaN;
}
else {
Expand Down

0 comments on commit 0793324

Please sign in to comment.