findbugs fixes - SE_COMPARATOR_SHOULD_BE_SERIALIZABLE

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1736114 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-03-21 23:42:56 +00:00
parent 762864d0f2
commit 197aef5420
7 changed files with 15 additions and 10 deletions

View File

@ -18,6 +18,7 @@
package org.apache.poi.poifs.property; package org.apache.poi.poifs.property;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
@ -119,8 +120,8 @@ public class DirectoryProperty extends Property implements Parent, Iterable<Prop
return result; return result;
} }
public static class PropertyComparator implements Comparator<Property> { public static class PropertyComparator implements Comparator<Property>, Serializable {
/** /**
* compare method. Assumes both parameters are non-null * compare method. Assumes both parameters are non-null
* instances of Property. One property is less than another if * instances of Property. One property is less than another if

View File

@ -21,6 +21,7 @@ import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable;
import java.util.Comparator; import java.util.Comparator;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
@ -189,7 +190,7 @@ public final class XmlSort
* The constructor accepts an argument indicating whether the comparison order is the same as * The constructor accepts an argument indicating whether the comparison order is the same as
* the lexicographic order of the strings or the reverse. * the lexicographic order of the strings or the reverse.
*/ */
public static final class QNameComparator implements Comparator<XmlCursor> public static final class QNameComparator implements Comparator<XmlCursor>, Serializable
{ {
public static final int ASCENDING = 1; public static final int ASCENDING = 1;
public static final int DESCENDING = 2; public static final int DESCENDING = 2;

View File

@ -18,6 +18,7 @@
package org.apache.poi.hslf.usermodel; package org.apache.poi.hslf.usermodel;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@ -169,7 +170,7 @@ implements HSLFShapeContainer, TableShape<HSLFShape,HSLFTextParagraph> {
updateRowHeightsProperty(); updateRowHeightsProperty();
} }
private static class TableCellComparator implements Comparator<HSLFShape> { private static class TableCellComparator implements Comparator<HSLFShape>, Serializable {
public int compare( HSLFShape o1, HSLFShape o2 ) { public int compare( HSLFShape o1, HSLFShape o2 ) {
Rectangle2D anchor1 = o1.getAnchor(); Rectangle2D anchor1 = o1.getAnchor();
Rectangle2D anchor2 = o2.getAnchor(); Rectangle2D anchor2 = o2.getAnchor();

View File

@ -32,6 +32,7 @@ import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_RENDERING;
import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_SIZE; import static org.apache.poi.hsmf.datatypes.MAPIProperty.ATTACH_SIZE;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@ -185,7 +186,7 @@ public class AttachmentChunks implements ChunkGroup {
/** /**
* Orders by the attachment number. * Orders by the attachment number.
*/ */
public static class AttachmentChunksSorter implements Comparator<AttachmentChunks> { public static class AttachmentChunksSorter implements Comparator<AttachmentChunks>, Serializable {
public int compare(AttachmentChunks a, AttachmentChunks b) { public int compare(AttachmentChunks a, AttachmentChunks b) {
return a.poifsName.compareTo(b.poifsName); return a.poifsName.compareTo(b.poifsName);
} }

View File

@ -17,6 +17,7 @@
package org.apache.poi.hsmf.datatypes; package org.apache.poi.hsmf.datatypes;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@ -222,7 +223,7 @@ public final class RecipientChunks implements ChunkGroupWithProperties {
/** /**
* Orders by the recipient number. * Orders by the recipient number.
*/ */
public static class RecipientChunksSorter implements Comparator<RecipientChunks> { public static class RecipientChunksSorter implements Comparator<RecipientChunks>, Serializable {
public int compare(RecipientChunks a, RecipientChunks b) { public int compare(RecipientChunks a, RecipientChunks b) {
if(a.recipientNumber < b.recipientNumber) if(a.recipientNumber < b.recipientNumber)
return -1; return -1;

View File

@ -17,6 +17,7 @@
package org.apache.poi.hwpf.model; package org.apache.poi.hwpf.model;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
@ -497,7 +498,7 @@ public class TextPieceTable implements CharIndexTranslator
return textPlex.toByteArray(); return textPlex.toByteArray();
} }
private static class FCComparator implements Comparator<TextPiece> private static class FCComparator implements Comparator<TextPiece>, Serializable
{ {
public int compare( TextPiece textPiece, TextPiece textPiece1 ) public int compare( TextPiece textPiece, TextPiece textPiece1 )
{ {

View File

@ -16,6 +16,7 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.hwpf.usermodel; package org.apache.poi.hwpf.usermodel;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -262,9 +263,7 @@ public class FieldsImpl implements Fields
} }
} }
private static final class PlexOfFieldComparator implements private static final class PlexOfFieldComparator implements Comparator<PlexOfField>, Serializable {
Comparator<PlexOfField>
{
public int compare( PlexOfField o1, PlexOfField o2 ) public int compare( PlexOfField o1, PlexOfField o2 )
{ {
int thisVal = o1.getFcStart(); int thisVal = o1.getFcStart();