Eclipse automated refactor/cleanup: add missing @Override and @Deprecated annotations

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765726 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-10-19 21:52:31 +00:00
parent 9eef74edd1
commit 99125ee191
156 changed files with 478 additions and 143 deletions

View File

@ -311,6 +311,7 @@ public class CopyCompare
* <p>The method is called by POI's eventing API for each file in the
* origin POIFS.</p>
*/
@Override
public void processPOIFSReaderEvent(final POIFSReaderEvent event) {
/* The following declarations are shortcuts for accessing the
* "event" object. */

View File

@ -61,6 +61,7 @@ public class ReadCustomPropertySets
static class MyPOIFSReaderListener implements POIFSReaderListener
{
@Override
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
PropertySet ps = null;

View File

@ -54,6 +54,7 @@ public class ReadTitle
static class MyPOIFSReaderListener implements POIFSReaderListener
{
@Override
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
SummaryInformation si = null;

View File

@ -155,6 +155,7 @@ public class WriteAuthorAndTitle
* <p>The method is called by POI's eventing API for each file in the
* origin POIFS.</p>
*/
@Override
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
/* The following declarations are shortcuts for accessing the

View File

@ -133,6 +133,7 @@ public class XLS2CSVmra implements HSSFListener {
* Main HSSFListener method, processes events, and outputs the
* CSV as the file is processed.
*/
@Override
public void processRecord(Record record) {
int thisRow = -1;
int thisColumn = -1;

View File

@ -40,6 +40,7 @@ public class EventExample
* This method listens for incoming records and handles them as required.
* @param record The record that was found while reading.
*/
@Override
public void processRecord(Record record)
{
switch (record.getSid())

View File

@ -61,6 +61,7 @@ public class Outlines implements Closeable {
}
}
@Override
public void close() throws IOException {
wb.close();
}

View File

@ -66,7 +66,8 @@ public class SVBorder extends AbstractBorder {
this.selected = selected;
}
public void paintBorder(Component c, Graphics g, int x, int y, int width,
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width,
int height) {
Color oldColor = g.getColor();

View File

@ -189,7 +189,8 @@ public class SVFractionalFormat extends Format {
throw new RuntimeException("Unexpected Case");
}
public StringBuffer format(Object obj,
@Override
public StringBuffer format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos) {
if (obj instanceof Number) {
@ -199,19 +200,22 @@ public class SVFractionalFormat extends Format {
throw new IllegalArgumentException("Can only handle Numbers");
}
public Object parseObject(String source,
@Override
public Object parseObject(String source,
ParsePosition status) {
//JMH TBD
return null;
}
public Object parseObject(String source)
@Override
public Object parseObject(String source)
throws ParseException {
//JMH TBD
return null;
}
public Object clone() {
@Override
public Object clone() {
//JMH TBD
return null;
}

View File

@ -44,9 +44,11 @@ public class SVRowHeader extends JList {
this.sheet = sheet;
}
@Override
public int getSize() {
return sheet.getLastRowNum() + 1;
}
@Override
public Object getElementAt(int index) {
return Integer.toString(index+1);
}
@ -69,6 +71,7 @@ public class SVRowHeader extends JList {
setFont(header.getFont());
}
@Override
public Component getListCellRendererComponent( JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
Dimension d = getPreferredSize();

View File

@ -114,6 +114,7 @@ public class SVSheetTable extends JTable {
}
private class HeaderCellRenderer implements TableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
@ -128,6 +129,7 @@ public class SVSheetTable extends JTable {
this.formulaDisplay = formulaDisplay;
}
@Override
public void valueChanged(ListSelectionEvent e) {
int row = getSelectedRow();
int col = getSelectedColumn();
@ -187,6 +189,7 @@ public class SVSheetTable extends JTable {
}
addHierarchyListener(new HierarchyListener() {
@Override
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0) {
Container changedParent = e.getChangedParent();

View File

@ -66,7 +66,8 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
*
* @return The cellEditable value
*/
public boolean isCellEditable(java.util.EventObject e) {
@Override
public boolean isCellEditable(java.util.EventObject e) {
if (e instanceof MouseEvent) {
return ((MouseEvent) e).getClickCount() >= 2;
}
@ -74,7 +75,8 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
}
public boolean shouldSelectCell(EventObject anEvent) {
@Override
public boolean shouldSelectCell(EventObject anEvent) {
return true;
}
@ -85,20 +87,23 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
}
public boolean stopCellEditing() {
@Override
public boolean stopCellEditing() {
System.out.println("Stop Cell Editing");
fireEditingStopped();
return true;
}
public void cancelCellEditing() {
@Override
public void cancelCellEditing() {
System.out.println("Cancel Cell Editing");
fireEditingCanceled();
}
public void actionPerformed(ActionEvent e) {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Action performed");
stopCellEditing();
}
@ -109,7 +114,8 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
*
* @return The cellEditorValue value
*/
public Object getCellEditorValue() {
@Override
public Object getCellEditorValue() {
System.out.println("GetCellEditorValue");
//JMH Look at when this method is called. Should it return a HSSFCell?
return editor.getText();
@ -121,7 +127,8 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
*
* @return The tableCellEditorComponent value
*/
public Component getTableCellEditorComponent(JTable table, Object value,
@Override
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected,
int row,
int column) {

View File

@ -137,6 +137,7 @@ public class SVTableCellRenderer extends JLabel
this.wb = wb;
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
boolean isBorderSet = false;
@ -249,14 +250,19 @@ public class SVTableCellRenderer extends JLabel
return this;
}
@Override
public void validate() {}
@Override
public void revalidate() {}
@Override
public void repaint(long tm, int x, int y, int width, int height) {}
@Override
public void repaint(Rectangle r) { }
@Override
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
// Strings get interned...
if (propertyName=="text") {
@ -264,6 +270,7 @@ public class SVTableCellRenderer extends JLabel
}
}
@Override
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { }
/**

View File

@ -55,10 +55,12 @@ public class SVTableModel extends AbstractTableModel {
}
public int getColumnCount() {
@Override
public int getColumnCount() {
return this.maxcol+1;
}
public Object getValueAt(int row, int col) {
@Override
public Object getValueAt(int row, int col) {
HSSFRow r = st.getRow(row);
HSSFCell c = null;
if (r != null) {
@ -66,19 +68,23 @@ public class SVTableModel extends AbstractTableModel {
}
return c;
}
public int getRowCount() {
@Override
public int getRowCount() {
return st.getLastRowNum() + 1;
}
public Class<?> getColumnClass(int c) {
@Override
public Class<?> getColumnClass(int c) {
return HSSFCell.class;
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return true;
}
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if (aValue != null)
System.out.println("SVTableModel.setValueAt. value type = "+aValue.getClass().getName());
else System.out.println("SVTableModel.setValueAt. value type = null");

View File

@ -54,7 +54,8 @@ public class SViewer extends JApplet {
}
/**Initialize the applet*/
public void init() {
@Override
public void init() {
try {
jbInit();
}
@ -104,20 +105,25 @@ public class SViewer extends JApplet {
}
/**Start the applet*/
public void start() {
@Override
public void start() {
}
/**Stop the applet*/
public void stop() {
@Override
public void stop() {
}
/**Destroy the applet*/
public void destroy() {
@Override
public void destroy() {
}
/**Get Applet information*/
public String getAppletInfo() {
@Override
public String getAppletInfo() {
return "Applet Information";
}
/**Get parameter info*/
public String[][] getParameterInfo() {
@Override
public String[][] getParameterInfo() {
return null;
}
@ -149,12 +155,14 @@ public class SViewer extends JApplet {
applet.filename = args[0];
Frame frame;
frame = new Frame() {
@Override
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
@Override
public synchronized void setTitle(String title) {
super.setTitle(title);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);

View File

@ -129,7 +129,8 @@ public class SViewerPanel extends JPanel {
return scroll;
}
public void paint(Graphics g) {
@Override
public void paint(Graphics g) {
//JMH I am only overriding this to get a picture of the time taken to paint
long start = System.currentTimeMillis();
super.paint(g);
@ -180,19 +181,24 @@ public class SViewerPanel extends JPanel {
}
}
@Override
public void mouseClicked(MouseEvent e) {
checkPopup(e);
}
@Override
public void mousePressed(MouseEvent e) {
checkPopup(e);
}
@Override
public void mouseReleased(MouseEvent e) {
checkPopup(e);
}
@Override
public void mouseEntered(MouseEvent e) {}
@Override
public void mouseExited(MouseEvent e) {}
}
@ -202,6 +208,7 @@ public class SViewerPanel extends JPanel {
super("Rename");
}
@Override
public void actionPerformed(ActionEvent e) {
int tabIndex = sheetPane.getSelectedIndex();
if (tabIndex != -1) {
@ -220,6 +227,7 @@ public class SViewerPanel extends JPanel {
super("Insert");
}
@Override
public void actionPerformed(ActionEvent e) {
//Create a new sheet then search for the sheet and make sure that the
//sheetPane shows it.
@ -239,6 +247,7 @@ public class SViewerPanel extends JPanel {
super("Delete");
}
@Override
public void actionPerformed(ActionEvent e) {
int tabIndex = sheetPane.getSelectedIndex();
if (tabIndex != -1) {
@ -267,12 +276,14 @@ public class SViewerPanel extends JPanel {
SViewerPanel p = new SViewerPanel(wb, true);
JFrame frame;
frame = new JFrame() {
@Override
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
@Override
public synchronized void setTitle(String title) {
super.setTitle(title);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);

View File

@ -47,6 +47,7 @@ public class DoubleStroke implements Brush {
*
* @return The created stroke as a new shape.
*/
@Override
public Shape createStrokedShape(Shape s) {
// Use the first stroke to create an outline of the shape
Shape outline = stroke1.createStrokedShape(s);
@ -56,6 +57,7 @@ public class DoubleStroke implements Brush {
}
/** {@inheritDoc} */
@Override
public float getLineWidth() {
return stroke1.getLineWidth() + 2 * stroke2.getLineWidth();
}

View File

@ -31,6 +31,7 @@ import org.apache.poi.util.HexDump;
public class DocumentDescriptorRenderer extends DefaultTreeCellRenderer
{
@Override
public Component getTreeCellRendererComponent(final JTree tree,
final Object value,
final boolean selectedCell,

View File

@ -49,6 +49,7 @@ public class ExtendableTreeCellRenderer implements TreeCellRenderer
renderers = new HashMap<Class<?>,TreeCellRenderer>();
register(Object.class, new DefaultTreeCellRenderer()
{
@Override
public Component getTreeCellRendererComponent
(JTree tree, Object value, boolean selectedCell,
boolean expanded, boolean leaf, int row, boolean hasCellFocus)
@ -97,6 +98,7 @@ public class ExtendableTreeCellRenderer implements TreeCellRenderer
*
* @see TreeCellRenderer#getTreeCellRendererComponent
*/
@Override
public Component getTreeCellRendererComponent
(final JTree tree, final Object value, final boolean selected,
final boolean expanded, final boolean leaf, final int row,

View File

@ -65,6 +65,7 @@ public class POIBrowser extends JFrame
{
addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent e)
{
System.exit(0);

View File

@ -41,6 +41,7 @@ import org.apache.poi.util.HexDump;
public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer
{
@Override
public Component getTreeCellRendererComponent(final JTree tree,
final Object value,
final boolean selectedCell,

View File

@ -121,6 +121,7 @@ public class TreeReaderListener implements POIFSReaderListener
* reading. This method retrieves properties of the document and
* adds them to a tree model.</p>
*/
@Override
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
DocumentDescriptor d;

View File

@ -764,6 +764,7 @@ public class ToCSV {
* file ends with either '.xls' or '.xlsx' and false will be
* returned in all other instances.
*/
@Override
public boolean accept(File file, String name) {
return(name.endsWith(".xls") || name.endsWith(".xlsx"));
}

View File

@ -33,6 +33,7 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction ;
*/
public class CalculateMortgage implements FreeRefFunction {
@Override
public ValueEval evaluate( ValueEval[] args, OperationEvaluationContext ec ) {
// verify that we have enough data

View File

@ -56,6 +56,7 @@ public class SettingExternalFunction {
// don't care about the implementation, we are not interested in evaluation
// and this method will never be called
FreeRefFunction NA = new FreeRefFunction() {
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
return ErrorEval.NA;
}
@ -66,6 +67,7 @@ public class SettingExternalFunction {
_functionsByName.put("BDS", NA);
}
@Override
public FreeRefFunction findFunction(String name) {
return _functionsByName.get(name.toUpperCase(Locale.ROOT));
}

View File

@ -42,6 +42,7 @@ public class HSSFHtmlHelper implements HtmlHelper {
colors = wb.getCustomPalette();
}
@Override
public void colorStyles(CellStyle style, Formatter out) {
HSSFCellStyle cs = (HSSFCellStyle) style;
out.format(" /* fill pattern = %d */%n", cs.getFillPattern());

View File

@ -28,6 +28,7 @@ import org.apache.poi.xssf.usermodel.XSSFColor;
* @author Ken Arnold, Industrious Media LLC
*/
public class XSSFHtmlHelper implements HtmlHelper {
@Override
public void colorStyles(CellStyle style, Formatter out) {
XSSFCellStyle cs = (XSSFCellStyle) style;
styleColor(out, "background-color", cs.getFillForegroundXSSFColor());

View File

@ -83,6 +83,7 @@ public class XLSX2CSV {
}
}
@Override
public void startRow(int rowNum) {
// If there were gaps, output the missing rows
outputMissingRows(rowNum-currentRow-1);
@ -92,6 +93,7 @@ public class XLSX2CSV {
currentCol = -1;
}
@Override
public void endRow(int rowNum) {
// Ensure the minimum number of columns
for (int i=currentCol; i<minColumns; i++) {
@ -100,6 +102,7 @@ public class XLSX2CSV {
output.append('\n');
}
@Override
public void cell(String cellReference, String formattedValue,
XSSFComment comment) {
if (firstCellOfRow) {
@ -132,6 +135,7 @@ public class XLSX2CSV {
}
}
@Override
public void headerFooter(String text, boolean isHeader, String tagName) {
// Skip, no headers or footers in CSV
}

View File

@ -116,6 +116,7 @@ public class FromHowTo {
this.sst = sst;
}
@Override
public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException {
// c => cell
@ -131,6 +132,7 @@ public class FromHowTo {
lastContents = "";
}
@Override
public void endElement(String uri, String localName, String name)
throws SAXException {
// Process the last contents as required.
@ -152,6 +154,7 @@ public class FromHowTo {
}
}
@Override
public void characters(char[] ch, int start, int length) throws SAXException { // NOSONAR
lastContents += new String(ch, start, length);
}

View File

@ -42,6 +42,7 @@ public class HybridStreaming {
InputStream sourceBytes = new FileInputStream("workbook.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(sourceBytes) {
/** Avoid DOM parse of large sheet */
@Override
public void parseSheet(java.util.Map<String,XSSFSheet> shIdMap, CTSheet ctSheet) {
if (!SHEET_TO_STREAM.equals(ctSheet.getName())) {
super.parseSheet(shIdMap, ctSheet);
@ -59,15 +60,19 @@ public class HybridStreaming {
private static SheetContentsHandler createSheetContentsHandler() {
return new SheetContentsHandler() {
@Override
public void startRow(int rowNum) {
}
@Override
public void headerFooter(String text, boolean isHeader, String tagName) {
}
@Override
public void endRow(int rowNum) {
}
@Override
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
}
};

View File

@ -102,6 +102,7 @@ public class ExcelAntEvaluateCell extends Task {
return precisionToUse;
}
@Override
public void execute() throws BuildException {
precisionToUse = 0 ;

View File

@ -58,6 +58,7 @@ public class ExcelAntHandlerTask extends Task {
wbUtil = wkbkUtil ;
}
@Override
public void execute() throws BuildException {
log( "handling the workbook with class " + className, Project.MSG_INFO ) ;
try {

View File

@ -50,6 +50,7 @@ public class ExcelAntSetDoubleCell extends ExcelAntSet {
return cellValue;
}
@Override
public void execute() throws BuildException {
wbUtil.setDoubleValue(cellStr, cellValue ) ;

View File

@ -43,6 +43,7 @@ public class ExcelAntSetFormulaCell extends ExcelAntSet {
return cellValue;
}
@Override
public void execute() throws BuildException {
wbUtil.setFormulaValue( cellStr, cellValue ) ;

View File

@ -50,6 +50,7 @@ public class ExcelAntSetStringCell extends ExcelAntSet {
return stringValue;
}
@Override
public void execute() throws BuildException {
wbUtil.setStringValue(cellStr, stringValue ) ;

View File

@ -78,6 +78,7 @@ public class ExcelAntTask extends Task {
functions.add( def ) ;
}
@Override
public void execute() throws BuildException {
checkClassPath();

View File

@ -124,6 +124,7 @@ public class ExcelAntTest extends Task{
return evaluators;
}
@Override
public void execute() throws BuildException {
Iterator<Task> taskIt = testTasks.iterator();

View File

@ -35,6 +35,7 @@ import org.apache.poi.ss.formula.functions.FreeRefFunction ;
*/
public class CalculateMortgageFunction implements FreeRefFunction {
@Override
public ValueEval evaluate( ValueEval[] args, OperationEvaluationContext ec ) {
// verify that we have enough data

View File

@ -500,6 +500,7 @@ public abstract class BuildFileTest extends TestCase {
this.buffer = buffer;
}
@Override
public void write(int b) {
buffer.append((char) b);
}
@ -522,6 +523,7 @@ public abstract class BuildFileTest extends TestCase {
/**
* Fired before any targets are started.
*/
@Override
public void buildStarted(BuildEvent event) {
}
@ -531,6 +533,7 @@ public abstract class BuildFileTest extends TestCase {
*
* @see BuildEvent#getException()
*/
@Override
public void buildFinished(BuildEvent event) {
}
@ -539,6 +542,7 @@ public abstract class BuildFileTest extends TestCase {
*
* @see BuildEvent#getTarget()
*/
@Override
public void targetStarted(BuildEvent event) {
//System.out.println("targetStarted " + event.getTarget().getName());
}
@ -549,6 +553,7 @@ public abstract class BuildFileTest extends TestCase {
*
* @see BuildEvent#getException()
*/
@Override
public void targetFinished(BuildEvent event) {
//System.out.println("targetFinished " + event.getTarget().getName());
}
@ -558,6 +563,7 @@ public abstract class BuildFileTest extends TestCase {
*
* @see BuildEvent#getTask()
*/
@Override
public void taskStarted(BuildEvent event) {
//System.out.println("taskStarted " + event.getTask().getTaskName());
}
@ -568,6 +574,7 @@ public abstract class BuildFileTest extends TestCase {
*
* @see BuildEvent#getException()
*/
@Override
public void taskFinished(BuildEvent event) {
//System.out.println("taskFinished " + event.getTask().getTaskName());
}
@ -578,6 +585,7 @@ public abstract class BuildFileTest extends TestCase {
* @see BuildEvent#getMessage()
* @see BuildEvent#getPriority()
*/
@Override
public void messageLogged(BuildEvent event) {
if (event.getPriority() > logLevel) {
// ignore event

View File

@ -26,10 +26,12 @@ public class MockExcelAntWorkbookHandler implements IExcelAntWorkbookHandler {
public static Workbook workbook = null;
@Override
public void setWorkbook(Workbook workbook) {
MockExcelAntWorkbookHandler.workbook = workbook;
}
@Override
public void execute() {
executed = true;
assertNotNull(workbook);

View File

@ -53,6 +53,7 @@ public abstract class AbstractFileHandler implements FileHandler {
EXPECTED_EXTRACTOR_FAILURES.add("poifs/Notes.ole2");
}
@Override
public void handleExtracting(File file) throws Exception {
boolean before = ExtractorFactory.getThreadPrefersEventExtractors();
try {

View File

@ -51,6 +51,7 @@ public class HDGFFileHandler extends POIFSFileHandler {
}
// a test-case to test this locally without executing the full TestAllFiles
@Override
@Test
public void test() throws Exception {
File file = new File("test-data/diagram/44501.vsd");

View File

@ -39,6 +39,7 @@ public class HPBFFileHandler extends POIFSFileHandler {
}
// a test-case to test this locally without executing the full TestAllFiles
@Override
@Test
public void test() throws Exception {
File file = new File("test-data/publisher/SampleBrochure.pub");

View File

@ -37,6 +37,7 @@ public class HPSFFileHandler extends POIFSFileHandler {
}
// a test-case to test this locally without executing the full TestAllFiles
@Override
@Test
public void test() throws Exception {
InputStream stream = new FileInputStream("test-data/hpsf/Test0313rur.adm");

View File

@ -49,6 +49,7 @@ public class HSLFFileHandler extends SlideShowHandler {
}
// a test-case to test this locally without executing the full TestAllFiles
@Override
@Test
public void test() throws Exception {
InputStream stream = new FileInputStream("test-data/hpsf/Test_Humor-Generation.ppt");

View File

@ -72,6 +72,7 @@ public class HSMFFileHandler extends POIFSFileHandler {
// }
// a test-case to test this locally without executing the full TestAllFiles
@Override
@Test
public void test() throws Exception {
InputStream stream = new FileInputStream("test-data/hsmf/example_received_regular.msg");

View File

@ -38,6 +38,7 @@ public class HWPFFileHandler extends POIFSFileHandler {
}
// a test-case to test this locally without executing the full TestAllFiles
@Override
@Test
public void test() throws Exception {
File file = new File("test-data/document/52117.doc");

View File

@ -55,6 +55,7 @@ public class OPCFileHandler extends AbstractFileHandler {
}
}
@Override
public void handleExtracting(File file) throws Exception {
// text-extraction is not possible currenlty for these types of files
}

View File

@ -46,6 +46,7 @@ public class XSLFFileHandler extends SlideShowHandler {
slide.close();
}
@Override
public void handleExtracting(File file) throws Exception {
super.handleExtracting(file);
@ -65,6 +66,7 @@ public class XSLFFileHandler extends SlideShowHandler {
}
// a test-case to test this locally without executing the full TestAllFiles
@Override
@Test
public void test() throws Exception {
InputStream stream = new FileInputStream("test-data/slideshow/ae.ac.uaeu.faculty_nafaachbili_GeomLec1.pptx");

View File

@ -203,39 +203,71 @@ public class XSSFFileHandler extends SpreadsheetHandler {
@SuppressWarnings("resource")
NullPrintStream() {
super(new OutputStream() {
@Override
public void write(int b) {}
@Override
public void write(byte[] b) {}
@Override
public void write(byte[] b, int off, int len) {}
});
}
@Override
public void write(int b) {}
@Override
public void write(byte[] buf, int off, int len) {}
@Override
public void print(boolean b) {}
@Override
public void print(char c) {}
@Override
public void print(int i) {}
@Override
public void print(long l) {}
@Override
public void print(float f) {}
@Override
public void print(double d) {}
@Override
public void print(char[] s) {}
@Override
public void print(String s) {}
@Override
public void print(Object obj) {}
@Override
public void println() {}
@Override
public void println(boolean x) {}
@Override
public void println(char x) {}
@Override
public void println(int x) {}
@Override
public void println(long x) {}
@Override
public void println(float x) {}
@Override
public void println(double x) {}
@Override
public void println(char[] x) {}
@Override
public void println(String x) {}
@Override
public void println(Object x) {}
@Override
public PrintStream printf(String format, Object... args) { return this; }
@Override
public PrintStream printf(Locale l, String format, Object... args) { return this; }
@Override
public PrintStream format(String format, Object... args) { return this; }
@Override
public PrintStream format(Locale l, String format, Object... args) { return this; }
@Override
public PrintStream append(CharSequence csq) { return this; }
@Override
public PrintStream append(CharSequence csq, int start, int end) { return this; }
@Override
public PrintStream append(char c) { return this; }
@Override
public void write(byte[] b) {}
}
}

View File

@ -79,6 +79,7 @@ public final class TestPOIXMLDocument {
//
}
@Override
protected POIXMLRelation getDescriptor(String relationshipType) {
return null;
}

View File

@ -57,10 +57,12 @@ public class AesZipFileZipEntrySource implements ZipEntrySource {
* Note: the file sizes are rounded up to the next cipher block size,
* so don't rely on file sizes of these custom encrypted zip file entries!
*/
@Override
public Enumeration<? extends ZipEntry> getEntries() {
return zipFile.entries();
}
@Override
@SuppressWarnings("resource")
public InputStream getInputStream(ZipEntry entry) throws IOException {
InputStream is = zipFile.getInputStream(entry);
@ -113,6 +115,7 @@ public class AesZipFileZipEntrySource implements ZipEntrySource {
zos.putNextEntry(zeNew);
FilterOutputStream fos2 = new FilterOutputStream(zos){
// don't close underlying ZipOutputStream
@Override
public void close() {}
};
CipherOutputStream cos = new CipherOutputStream(fos2, ciEnc);

View File

@ -57,6 +57,7 @@ public class TestCellFormatPart extends CellFormatTestBase {
@Test
public void testGeneralFormat() throws Exception {
runFormatTests("GeneralFormatTests.xlsx", new CellValue() {
@Override
public Object getValue(Cell cell) {
switch (CellFormat.ultimateTypeEnum(cell)) {
case BOOLEAN:
@ -72,6 +73,7 @@ public class TestCellFormatPart extends CellFormatTestBase {
public void testNumberFormat() throws Exception {
runFormatTests("NumberFormatTests.xlsx", new CellValue() {
@Override
public Object getValue(Cell cell) {
return cell.getNumericCellValue();
}
@ -81,6 +83,7 @@ public class TestCellFormatPart extends CellFormatTestBase {
@Test
public void testNumberApproxFormat() throws Exception {
runFormatTests("NumberFormatApproxTests.xlsx", new CellValue() {
@Override
public Object getValue(Cell cell) {
return cell.getNumericCellValue();
}
@ -104,6 +107,7 @@ public class TestCellFormatPart extends CellFormatTestBase {
LocaleUtil.setUserTimeZone(TimeZone.getTimeZone("CET"));
try {
runFormatTests("DateFormatTests.xlsx", new CellValue() {
@Override
public Object getValue(Cell cell) {
return cell.getDateCellValue();
}
@ -116,6 +120,7 @@ public class TestCellFormatPart extends CellFormatTestBase {
@Test
public void testElapsedFormat() throws Exception {
runFormatTests("ElapsedFormatTests.xlsx", new CellValue() {
@Override
public Object getValue(Cell cell) {
return cell.getNumericCellValue();
}
@ -125,6 +130,7 @@ public class TestCellFormatPart extends CellFormatTestBase {
@Test
public void testTextFormat() throws Exception {
runFormatTests("TextFormatTests.xlsx", new CellValue() {
@Override
public Object getValue(Cell cell) {
switch(CellFormat.ultimateTypeEnum(cell)) {
case BOOLEAN:
@ -139,6 +145,7 @@ public class TestCellFormatPart extends CellFormatTestBase {
@Test
public void testConditions() throws Exception {
runFormatTests("FormatConditionTests.xlsx", new CellValue() {
@Override
Object getValue(Cell cell) {
return cell.getNumericCellValue();
}

View File

@ -30,6 +30,7 @@ public class TestXDGFVisioExtractor extends TestCase {
private OPCPackage pkg;
private XmlVisioDocument xml;
@Override
protected void setUp() throws Exception {
diagrams = POIDataSamples.getDiagramInstance();

View File

@ -48,10 +48,12 @@ public class TestXSLFTextParagraph {
super(p);
}
@Override
public void breakText(Graphics2D graphics) {
super.breakText(graphics);
}
@Override
public double getWrappingWidth(boolean firstLine, Graphics2D graphics) {
return super.getWrappingWidth(firstLine, graphics);
}

View File

@ -95,6 +95,7 @@ public final class TestSXSSFSheet extends BaseTestXSheet {
super.bug35084();
}
@Override
@Test
public void getCellComment() throws IOException {
// TODO: reading cell comments via Sheet does not work currently as it tries

View File

@ -36,6 +36,7 @@ public class TestXSSFConditionalFormatting extends BaseTestConditionalFormatting
super(XSSFITestDataProvider.instance);
}
@Override
protected void assertColour(String hexExpected, Color actual) {
assertNotNull("Colour must be given", actual);
XSSFColor colour = (XSSFColor)actual;

View File

@ -42,6 +42,7 @@ public final class TestXSSFDataFormat extends BaseTestDataFormat {
/**
* [Bug 49928] formatCellValue returns incorrect value for \u00a3 formatted cells
*/
@Override
@Test
public void test49928() throws IOException {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("49928.xlsx");
@ -68,6 +69,7 @@ public final class TestXSSFDataFormat extends BaseTestDataFormat {
/**
* [Bug 58532] Handle formats that go numnum, numK, numM etc
*/
@Override
@Test
public void test58532() throws IOException {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("FormatKM.xlsx");

View File

@ -22,6 +22,7 @@ import org.apache.poi.ss.usermodel.Workbook;
public class TestXSSFForkedEvaluator extends TestForkedEvaluator {
@Override
protected Workbook newWorkbook() {
return new XSSFWorkbook();
}

View File

@ -33,6 +33,7 @@ public class TestXWPFDecorators extends TestCase {
private XWPFDocument hyperlink;
private XWPFDocument comments;
@Override
protected void setUp() throws IOException {
simple = XWPFTestDataSamples.openSampleDocument("SampleDoc.docx");
hyperlink = XWPFTestDataSamples.openSampleDocument("TestDocument.docx");

View File

@ -37,6 +37,7 @@ public class TestXWPFHeaderFooterPolicy extends TestCase {
private XWPFDocument oddEven;
private XWPFDocument diffFirst;
@Override
protected void setUp() throws IOException {
noHeader = XWPFTestDataSamples.openSampleDocument("NoHeadFoot.docx");
header = XWPFTestDataSamples.openSampleDocument("ThreeColHead.docx");

View File

@ -37,6 +37,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder;
* Tests for XWPF Tables
*/
public class TestXWPFTable extends TestCase {
@Override
protected void setUp() {
/*
XWPFDocument doc = new XWPFDocument();

View File

@ -47,6 +47,7 @@ public final class TestPOIDocumentScratchpad extends TestCase {
* Set things up, using a PowerPoint document and
* a Word Document for our testing
*/
@Override
public void setUp() throws Exception {
doc = new HSLFSlideShowImpl(POIDataSamples.getSlideShowInstance().openResourceAsStream("basic_test_ppt_file.ppt"));

View File

@ -30,6 +30,7 @@ public final class TestHDGFCore extends TestCase {
private POIFSFileSystem fs;
@Override
protected void setUp() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("Test_Visio-Some_Random_Text.vsd"));
}

View File

@ -31,6 +31,7 @@ public final class TestVisioExtractor extends TestCase {
private String defFilename;
private int defTextChunks;
@Override
protected void setUp() {
defFilename = "Test_Visio-Some_Random_Text.vsd";
defTextChunks = 5;

View File

@ -33,10 +33,15 @@ public abstract class StreamTest extends TestCase {
this.format = format;
}
@Override
public boolean destinationCompressed() { return compressed; }
@Override
public boolean destinationHasChunks() { return false; }
@Override
public boolean destinationHasPointers() { return hasPointers; }
@Override
public boolean destinationHasStrings() { return false; }
@Override
public int getSizeInBytes() { return -1; }
}
}

View File

@ -36,6 +36,7 @@ public final class TestStreamBugs extends StreamTest {
private PointerFactory ptrFactory;
private POIFSFileSystem filesystem;
@Override
protected void setUp() throws Exception {
ptrFactory = new PointerFactory(11);
chunkFactory = new ChunkFactory(11);

View File

@ -34,6 +34,7 @@ public final class TestStreamComplex extends StreamTest {
private ChunkFactory chunkFactory;
private PointerFactory ptrFactory;
@Override
protected void setUp() throws Exception {
ptrFactory = new PointerFactory(11);
chunkFactory = new ChunkFactory(11);

View File

@ -44,7 +44,8 @@ public final class TestMAPIAttributes extends TestCase {
}
protected void tearDown() throws Exception {
@Override
protected void tearDown() throws Exception {
stream.close();
super.tearDown();

View File

@ -144,6 +144,7 @@ public final class TestRecordContainer extends TestCase {
assertEquals(ch.length-1, recordContainer.getChildRecords().length);
}
@Override
protected void setUp() throws Exception {
super.setUp();

View File

@ -38,6 +38,7 @@ import org.apache.poi.hslf.usermodel.HSLFSlideShow;
public final class TestTxMasterStyleAtom extends TestCase {
protected HSLFSlideShow _ppt;
@Override
public void setUp() {
_ppt = new HSLFSlideShow();
}

View File

@ -48,6 +48,7 @@ public final class TestAddingSlides extends TestCase {
/**
* Create/open the slideshows
*/
@Override
public void setUp() throws Exception {
hss_empty = HSLFSlideShowImpl.create();
ss_empty = new HSLFSlideShow(hss_empty);

View File

@ -863,11 +863,13 @@ public final class TestBugs {
assertEquals(hlRun.getEndIndex(), hlShape.getEndIndex());
OutputStream nullOutput = new OutputStream(){
@Override
public void write(int b) throws IOException {}
};
final boolean found[] = { false };
DummyGraphics2d dgfx = new DummyGraphics2d(new PrintStream(nullOutput)){
@Override
public void drawString(AttributedCharacterIterator iterator, float x, float y) {
// For the test file, common sl draws textruns one by one and not mixed
// so we evaluate the whole iterator

View File

@ -55,6 +55,7 @@ public class TestExcelConverterSuite
"../spreadsheet" );
for ( final File child : directory.listFiles( new FilenameFilter()
{
@Override
public boolean accept( File dir, String name )
{
return name.endsWith( ".xls" ) && !failingFiles.contains( name );

View File

@ -105,6 +105,7 @@ public class TestHwmfParsing {
while ((ze = zis.getNextEntry()) != null) {
String basename = ze.getName().replaceAll(".*?([^/]+)\\.wmf", "$1");
FilterInputStream fis = new FilterInputStream(zis){
@Override
public void close() throws IOException {}
};
try {
@ -138,6 +139,7 @@ public class TestHwmfParsing {
final String startFile = "";
File files[] = indir.listFiles(new FileFilter() {
boolean foundStartFile = false;
@Override
public boolean accept(File pathname) {
foundStartFile |= startFile.isEmpty() || pathname.getName().contains(startFile);
return foundStartFile && pathname.getName().matches("(?i).*\\.wmf?$");

View File

@ -29,6 +29,7 @@ public abstract class HWPFTestCase extends TestCase {
protected HWPFTestCase() {
}
@Override
protected void setUp() throws Exception {
super.setUp();
/** @todo verify the constructors */
@ -42,6 +43,7 @@ public abstract class HWPFTestCase extends TestCase {
return HWPFDocFixture.DEFAULT_TEST_FILE;
}
@Override
protected void tearDown() throws Exception {
if (_hWPFDocFixture != null) {
_hWPFDocFixture.tearDown();

View File

@ -68,6 +68,7 @@ public class TestFieldsTables extends HWPFTestCase
{
}
@Override
protected String getTestFile()
{
return "test-fields.doc";

View File

@ -44,6 +44,7 @@ public final class TestHWPFPictures extends TestCase {
private String imgCFile;
private String imgDFile;
@Override
protected void setUp() {
docAFile = "testPictures.doc";

View File

@ -93,6 +93,7 @@ public final class TestHWPFRangeParts extends TestCase {
*/
private HWPFDocument docUnicode;
@Override
public void setUp() {
docUnicode = HWPFTestDataSamples.openSampleFile("HeaderFooterUnicode.doc");
docAscii = HWPFTestDataSamples.openSampleFile("ThreeColHeadFoot.doc");

View File

@ -54,6 +54,7 @@ public class TestWordToConverterSuite
"../document" );
for ( final File child : directory.listFiles( new FilenameFilter()
{
@Override
public boolean accept( File dir, String name )
{
return name.endsWith( ".doc" ) && !failingFiles.contains( name );

View File

@ -59,6 +59,7 @@ public class TestWordToHtmlConverter
{
wordToHtmlConverter.setPicturesManager( new PicturesManager()
{
@Override
public String savePicture( byte[] content,
PictureType pictureType, String suggestedName,
float widthInches, float heightInches )

View File

@ -49,6 +49,7 @@ public final class TestDifferentRoutes extends TestCase {
private HWPFDocument doc;
@Override
protected void setUp() {
doc = HWPFTestDataSamples.openSampleFile("test2.doc");
}

View File

@ -80,6 +80,7 @@ public final class TestWordExtractor extends TestCase {
// With footnote
private String filename6;
@Override
protected void setUp() throws Exception {
String filename = "test2.doc";

View File

@ -73,7 +73,8 @@ public final class TestCHPBinTable
}
}
protected void setUp()
@Override
protected void setUp()
throws Exception
{
super.setUp();
@ -82,7 +83,8 @@ public final class TestCHPBinTable
_hWPFDocFixture.setUp();
}
protected void tearDown()
@Override
protected void tearDown()
throws Exception
{
_cHPBinTable = null;

View File

@ -53,7 +53,8 @@ public final class TestFontTable
}
protected void setUp()
@Override
protected void setUp()
throws Exception
{
super.setUp();
@ -63,7 +64,8 @@ public final class TestFontTable
_hWPFDocFixture.setUp();
}
protected void tearDown()
@Override
protected void tearDown()
throws Exception
{
_hWPFDocFixture.tearDown();

View File

@ -56,7 +56,8 @@ public final class TestPlexOfCps
assertEquals(node.getEnd()-node.getStart(), span);
}
}
protected void setUp()
@Override
protected void setUp()
throws Exception
{
super.setUp();
@ -66,7 +67,8 @@ public final class TestPlexOfCps
_hWPFDocFixture.setUp();
}
protected void tearDown()
@Override
protected void tearDown()
throws Exception
{
_plexOfCps = null;

View File

@ -85,7 +85,8 @@ public final class TestSectionTable
}
}
protected void setUp()
@Override
protected void setUp()
throws Exception
{
super.setUp();
@ -95,7 +96,8 @@ public final class TestSectionTable
_hWPFDocFixture.setUp();
}
protected void tearDown()
@Override
protected void tearDown()
throws Exception
{
_hWPFDocFixture.tearDown();

View File

@ -61,7 +61,8 @@ public final class TestStyleSheet
assertEquals(newStyleSheet, _styleSheet);
}
protected void setUp()
@Override
protected void setUp()
throws Exception
{
super.setUp();
@ -76,7 +77,8 @@ public final class TestStyleSheet
_styleSheet = new StyleSheet(tableStream, fib.getFcStshf());
}
protected void tearDown()
@Override
protected void tearDown()
throws Exception
{
_styleSheet = null;

View File

@ -35,6 +35,7 @@ public final class TestHeaderStories extends TestCase {
private HWPFDocument unicode;
private HWPFDocument withFields;
@Override
protected void setUp() {
none = HWPFTestDataSamples.openSampleFile("NoHeadFoot.doc");

View File

@ -46,6 +46,7 @@ public final class TestRangeDelete extends TestCase {
private String illustrativeDocFile;
@Override
protected void setUp() {
illustrativeDocFile = "testRangeDelete.doc";
}

View File

@ -38,6 +38,7 @@ public final class TestRangeInsertion extends TestCase {
private String illustrativeDocFile;
@Override
protected void setUp() {
illustrativeDocFile = "testRangeInsertion.doc";
}

View File

@ -64,6 +64,7 @@ public final class TestRangeProperties extends TestCase {
private HWPFDocument u;
private HWPFDocument a;
@Override
protected void setUp() {
u = HWPFTestDataSamples.openSampleFile("HeaderFooterUnicode.doc");
a = HWPFTestDataSamples.openSampleFile("SampleDoc.doc");

View File

@ -138,9 +138,13 @@ public final class TestEscherContainerRecord extends TestCase {
private static final class DummyEscherRecord extends EscherRecord {
public DummyEscherRecord() { }
@Override
public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) { return 0; }
@Override
public int serialize(int offset, byte[] data, EscherSerializationListener listener) { return 0; }
@Override
public int getRecordSize() { return 10; }
@Override
public String getRecordName() { return ""; }
}

View File

@ -57,6 +57,7 @@ public class AllDataFilesTester {
final File dataDir = _samples.getFile("");
final File[] docs = dataDir.listFiles(new FileFilter()
{
@Override
public boolean accept(final File file)
{
return file.isFile() && file.getName().startsWith("Test");

View File

@ -64,6 +64,7 @@ public final class TestEmptyProperties extends TestCase {
* does not exist
* @exception IOException if an I/O exception occurs
*/
@Override
public void setUp() throws FileNotFoundException, IOException
{
POIDataSamples samples = POIDataSamples.getHPSFInstance();

View File

@ -52,6 +52,7 @@ public final class TestMetaDataIPI extends TestCase{
* Setup is used to get the document ready. Gets the DocumentSummaryInformation and the
* SummaryInformation to reasonable values
*/
@Override
public void setUp() throws Exception {
bout = new ByteArrayOutputStream();
poifs = new POIFSFileSystem();

View File

@ -54,6 +54,7 @@ public class TestUnicode extends TestCase {
* @exception FileNotFoundException if the file to be read does not exist.
* @exception IOException if any other I/O exception occurs
*/
@Override
protected void setUp() {
POIDataSamples samples = POIDataSamples.getHPSFInstance();
data = samples.getFile(POI_FS);

View File

@ -236,6 +236,7 @@ public class TestWrite
final POIFSReader r = new POIFSReader();
r.registerListener(new POIFSReaderListener()
{
@Override
public void processPOIFSReaderEvent
(final POIFSReaderEvent event)
{
@ -318,6 +319,7 @@ public class TestWrite
final POIFSReader r = new POIFSReader();
r.registerListener(new POIFSReaderListener()
{
@Override
public void processPOIFSReaderEvent
(final POIFSReaderEvent event)
{
@ -352,6 +354,7 @@ public class TestWrite
static class MyPOIFSReaderListener implements POIFSReaderListener
{
@Override
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
try

View File

@ -133,6 +133,7 @@ final class Util {
POIFSReader r = new POIFSReader();
POIFSReaderListener pfl = new POIFSReaderListener()
{
@Override
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
try
@ -201,6 +202,7 @@ final class Util {
final POIFSReader r = new POIFSReader();
POIFSReaderListener pfl = new POIFSReaderListener()
{
@Override
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
try

View File

@ -47,6 +47,7 @@ public final class TestEventRecordFactory extends TestCase {
final boolean[] wascalled = { false, }; // hack to pass boolean by ref into inner class
ERFListener listener = new ERFListener() {
@Override
public boolean processRecord(Record rec) {
wascalled[0] = true;
assertTrue("must be BOFRecord got SID="+rec.getSid(),
@ -154,6 +155,7 @@ public final class TestEventRecordFactory extends TestCase {
ContinueRecord.class.getName(),
ContinueRecord.class.getName()
};
@Override
public boolean processRecord(Record rec)
{
// System.out.println(rec.toString());

Some files were not shown because too many files have changed in this diff Show More