diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-05 15:29:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-08 09:48:20 +0200 |
commit | 616b3ad50404f35d84708b3feeb8c66f2f23f1b1 (patch) | |
tree | fbff023a34b3cc62b2c5beb592b95e65ce28251b /wizards | |
parent | b6a83e99c8f4442c3c96198ac816dcb99419a67e (diff) |
java: remove exceptions from throws clauses that are not
.. actually thrown
Change-Id: Ia326ac7f82e11b948ed0f34e20908a96e7adcd10
Diffstat (limited to 'wizards')
11 files changed, 70 insertions, 118 deletions
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java index c559a3ad2b5b..57804e6e8056 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.java +++ b/wizards/com/sun/star/wizards/common/FileAccess.java @@ -201,7 +201,7 @@ public class FileAccess return ResultPath; } - public static ArrayList<String> getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) throws NoValidPathException + public static ArrayList<String> getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) { //This method currently only works with sPath="Template" @@ -317,7 +317,7 @@ public class FileAccess return _sPath; } - public static void combinePaths(XMultiServiceFactory xMSF, ArrayList<String> _aFirstPath, String _sSecondPath) throws NoValidPathException + public static void combinePaths(XMultiServiceFactory xMSF, ArrayList<String> _aFirstPath, String _sSecondPath) { for (int i = 0; i < _aFirstPath.size(); ++i) { diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 46239f8380e8..49e1db3842cf 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -122,7 +122,7 @@ public class SQLQueryComposer } } - public void appendFilterConditions() throws SQLException + public void appendFilterConditions() { try { diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index 24d1bd4d5c5f..eda38213af72 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -24,7 +24,6 @@ import com.sun.star.sdb.application.DatabaseObject; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.PropertyNames; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.NoValidPathException; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.db.DatabaseObjectWizard; import com.sun.star.wizards.db.RelationController; @@ -219,7 +218,7 @@ public class FormWizard extends DatabaseObjectWizard } } - public void buildSteps() throws NoValidPathException + public void buildSteps() { curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411); curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index d1a4df1ed1b2..24e3e62f750f 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -64,7 +64,7 @@ public class StyleApplier private final static int SOBORDERCOLOR = 5; private Short IBorderValue = new Short((short) 1); - public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException + public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument) { this.curFormDocument = _curFormDocument; xMSF = curFormDocument.xMSF; diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java index 2dba91f88410..ff92792e64cc 100644 --- a/wizards/com/sun/star/wizards/form/UIControlArranger.java +++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java @@ -26,7 +26,6 @@ import com.sun.star.awt.XRadioButton; import com.sun.star.lang.EventObject; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.NoValidPathException; import com.sun.star.wizards.document.Control; import com.sun.star.wizards.ui.ButtonList; import com.sun.star.wizards.ui.UIConsts; @@ -51,7 +50,7 @@ public class UIControlArranger private final int SOIMAGELISTHEIGHT = 60; private final String SOALIGNMETHOD = "alignLabelControls"; - public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException + public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument) { this.CurUnoDialog = _CurUnoDialog; this.curFormDocument = _curFormDocument; diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java index 095ff23d9c52..3be19016063b 100644 --- a/wizards/com/sun/star/wizards/report/DBColumn.java +++ b/wizards/com/sun/star/wizards/report/DBColumn.java @@ -68,23 +68,23 @@ public class DBColumn RecordTable CurRecordTable; TextTableHandler oTextTableHandler; - public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) throws Exception + public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) { CurRecordTable = new RecordTable(_oTextTableHandler); initializeRecordTableMembers(CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false); } - public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bforce) throws Exception + public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bforce) { initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, _bforce); } - public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) throws Exception + public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) { initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false); } - private void initializeRecordTableMembers(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bForce) throws Exception + private void initializeRecordTableMembers(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bForce) { this.oTextTableHandler = _oTextTableHandler; this.CurDBMetaData = _CurDBMetaData; @@ -137,8 +137,7 @@ public class DBColumn return false; } - public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName, DBColumn OldDBColumn) throws Exception - { + public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName, DBColumn OldDBColumn) { this.oTextTableHandler = _oTextTableHandler; this.CurDBMetaData = _CurDBMetaData; CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_FieldName); diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java index cd6af8c937f8..ed6a9bcfe319 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java +++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java @@ -346,7 +346,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen } } - public void updateTextSections(String[] SelGroupNames) throws Exception + public void updateTextSections(String[] SelGroupNames) { String TableName; DBColumn OldDBColumn; @@ -395,48 +395,41 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen public void insertColumnstoRecordTable() { - try + int GroupCount = CurDBMetaData.GroupFieldNames.length; + DBColumn CurDBColumn; + // Note for some reason the table might lose its name and has to be renamed therefor + String OldTableName = CurRecordTable.xTableName.getName(); + if (OldTableName.compareTo(TBLRECORDSECTION) != 0) { - int GroupCount = CurDBMetaData.GroupFieldNames.length; - DBColumn CurDBColumn; - // Note for some reason the table might lose its name and has to be renamed therefor - String OldTableName = CurRecordTable.xTableName.getName(); - if (OldTableName.compareTo(TBLRECORDSECTION) != 0) - { - CurRecordTable = new RecordTable(oTextTableHandler); - } - com.sun.star.table.XTableColumns xColumns = CurRecordTable.xTextTable.getColumns(); - int ColCount = xColumns.getCount(); - int RecordCount = CurDBMetaData.getRecordFieldNames().length; - if (ColCount > RecordCount) - { - int RemoveCount = ColCount - RecordCount; - xColumns.removeByIndex(0, RemoveCount); - } - else if (ColCount < RecordCount) + CurRecordTable = new RecordTable(oTextTableHandler); + } + com.sun.star.table.XTableColumns xColumns = CurRecordTable.xTextTable.getColumns(); + int ColCount = xColumns.getCount(); + int RecordCount = CurDBMetaData.getRecordFieldNames().length; + if (ColCount > RecordCount) + { + int RemoveCount = ColCount - RecordCount; + xColumns.removeByIndex(0, RemoveCount); + } + else if (ColCount < RecordCount) + { + int AddCount = RecordCount - ColCount; + CurRecordTable.xTextTable.getColumns().insertByIndex(ColCount, AddCount); + } + for (int i = 0; i < RecordCount; i++) + { + CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i, true); + CurDBColumn.initializeNumberFormat(); + CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape); + if (DBColumnsVector.size() <= (i + GroupCount)) { - int AddCount = RecordCount - ColCount; - CurRecordTable.xTextTable.getColumns().insertByIndex(ColCount, AddCount); + DBColumnsVector.add(CurDBColumn); } - for (int i = 0; i < RecordCount; i++) + else { - CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i, true); - CurDBColumn.initializeNumberFormat(); - CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape); - if (DBColumnsVector.size() <= (i + GroupCount)) - { - DBColumnsVector.add(CurDBColumn); - } - else - { - DBColumnsVector.set(i + GroupCount, CurDBColumn); - } + DBColumnsVector.set(i + GroupCount, CurDBColumn); } } - catch (Exception exception) - { - showCommonReportErrorBox(exception); - } } public boolean addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, ArrayList<String> GroupFieldVector, ArrayList<String> ReportPath, int iSelCount) @@ -473,23 +466,16 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen removeGroupNamesofRecordTable(NewSelGroupNames.length + 1); FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle); GroupFieldVector.remove(CurFieldColumn.getFieldName()); - try + oTextSectionHandler.removeLastTextSection(); + oTextTableHandler.removeLastTextTable(); + // if the previously selected item is somewhere in the middle of the listbox (and not at the end) the + // Textsections have to be updated + if (JavaTools.FieldInList(NewSelGroupNames, CurGroupTitle) == -1) { - oTextSectionHandler.removeLastTextSection(); - oTextTableHandler.removeLastTextTable(); - // if the previously selected item is somewhere in the middle of the listbox (and not at the end) the - // Textsections have to be updated - if (JavaTools.FieldInList(NewSelGroupNames, CurGroupTitle) == -1) - { - updateTextSections(NewSelGroupNames); - } - int iSelItemCount = NewSelGroupNames.length; - DBColumnsVector.remove(iSelItemCount); - } - catch (Exception exception) - { - showCommonReportErrorBox(exception); + updateTextSections(NewSelGroupNames); } + int iSelItemCount = NewSelGroupNames.length; + DBColumnsVector.remove(iSelItemCount); } public void removeGroupNamesofRecordTable(int GroupFieldCount) diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index d6c572398c73..191df4436cab 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -37,7 +37,6 @@ import com.sun.star.ucb.XCommandProcessor; import com.sun.star.uno.UnoRuntime; import com.sun.star.util.XModifiable; import com.sun.star.util.XURLTransformer; -import com.sun.star.wizards.common.NoValidPathException; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.db.FieldColumn; import java.lang.reflect.Constructor; @@ -504,16 +503,9 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { if (m_aReportPath == null) { - try - { - // Check general availability of office paths - m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard"); - FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report"); - } - catch (NoValidPathException ex) - { - Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex); - } + // Check general availability of office paths + m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard"); + FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report"); } return m_aReportPath; } diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java index 0ecc84da19ec..66c818efc3ef 100644 --- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java +++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java @@ -123,7 +123,7 @@ public class TextFieldHandler return xPSet; } - private XDependentTextField[] getTextFieldsByProperty(String _PropertyName, Object _aPropertyValue, String _TypeName) throws Exception + private XDependentTextField[] getTextFieldsByProperty(String _PropertyName, Object _aPropertyValue, String _TypeName) { try { @@ -285,21 +285,14 @@ public class TextFieldHandler public void removeUserFieldByContent(String _FieldContent) { - try + XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String"); + if (xDependentTextFields != null) { - XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String"); - if (xDependentTextFields != null) + for (int i = 0; i < xDependentTextFields.length; i++) { - for (int i = 0; i < xDependentTextFields.length; i++) - { - xDependentTextFields[i].dispose(); - } + xDependentTextFields[i].dispose(); } } - catch (Exception e) - { - e.printStackTrace(System.err); - } } public void changeExtendedUserFieldContent(short UserDataPart, String _FieldContent) diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.java b/wizards/com/sun/star/wizards/ui/DocumentPreview.java index 2421245db16d..56dbc3d06777 100644 --- a/wizards/com/sun/star/wizards/ui/DocumentPreview.java +++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.java @@ -64,7 +64,7 @@ public class DocumentPreview createPreviewFrame(xmsf, xControl); } - protected XComponent setDocument(String url_, String[] propNames, Object[] propValues) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException + protected XComponent setDocument(String url_, String[] propNames, Object[] propValues) throws com.sun.star.lang.IllegalArgumentException, IOException { url = url_; @@ -77,7 +77,7 @@ public class DocumentPreview return setDocument(url, ps.getProperties()); } - protected XComponent setDocument(String url, PropertyValue[] lArgs) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException + protected XComponent setDocument(String url, PropertyValue[] lArgs) throws com.sun.star.lang.IllegalArgumentException, IOException { loadArgs = lArgs; XComponentLoader xCompLoader = UnoRuntime.queryInterface(XComponentLoader.class, xFrame); @@ -100,7 +100,7 @@ public class DocumentPreview } } - public XComponent setDocument(String url, int mode) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException + public XComponent setDocument(String url, int mode) throws com.sun.star.lang.IllegalArgumentException, IOException { switch (mode) { diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java index fed0a32424de..45482fce304e 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.java +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java @@ -458,42 +458,26 @@ public class UnoDialog implements EventNames public XRadioButton insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) { - try - { - XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues); - if (xItemListener != null) - { - xRadioButton.addItemListener(xItemListener); - } - return xRadioButton; - } - catch (com.sun.star.uno.Exception exception) + XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues); + if (xItemListener != null) { - exception.printStackTrace(System.err); - return null; + xRadioButton.addItemListener(xItemListener); } + return xRadioButton; } public XButton insertRadioButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) { - try - { - XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues); - XButton xButton = UnoRuntime.queryInterface(XButton.class, xRadioButton); - if (xActionListener != null) - { - xButton.addActionListener(xActionListener); - } - return xButton; - } - catch (com.sun.star.uno.Exception exception) + XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues); + XButton xButton = UnoRuntime.queryInterface(XButton.class, xRadioButton); + if (xActionListener != null) { - exception.printStackTrace(System.err); - return null; + xButton.addActionListener(xActionListener); } + return xButton; } - public XRadioButton insertRadioButton(String sName, int iControlKey, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception + public XRadioButton insertRadioButton(String sName, int iControlKey, String[] sProperties, Object[] sValues) { XRadioButton xRadioButton = insertRadioButton(sName, sProperties, sValues); Integer ControlKey = new Integer(iControlKey); |