summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-12 15:27:21 +0200
committerNoel Grandin <noel@peralex.com>2014-08-19 14:57:18 +0200
commit4b4bff34027cca49fd13e82d33d1b399848838fa (patch)
tree361bde1ae9cf88160694bec9d5f3c1893d398f66 /odk
parentc552aac9f889b094caaa35c3fd9d12fe7c3fc73c (diff)
java: no need to instantiate String objects directly
Change-Id: I7610774c94bf673ed3b574ffce04c4ee6ca93c03
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java6
-rw-r--r--odk/examples/DevelopersGuide/Charts/CalcHelper.java2
-rw-r--r--odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java6
-rw-r--r--odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java2
-rw-r--r--odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java2
-rw-r--r--odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java2
-rw-r--r--odk/examples/DevelopersGuide/Forms/DataAwareness.java10
-rw-r--r--odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java4
-rw-r--r--odk/examples/DevelopersGuide/Forms/GridFieldValidator.java4
-rw-r--r--odk/examples/DevelopersGuide/Forms/KeyGenerator.java4
-rw-r--r--odk/examples/DevelopersGuide/Forms/SalesFilter.java2
-rw-r--r--odk/examples/DevelopersGuide/Forms/SingleControlValidation.java8
-rw-r--r--odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java26
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java14
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java14
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java2
-rw-r--r--odk/examples/DevelopersGuide/UCB/Helper.java7
-rw-r--r--odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java4
-rw-r--r--odk/examples/java/Inspector/ProtocolHandlerAddon.java2
-rw-r--r--odk/examples/java/Text/StyleCreation.java4
-rw-r--r--odk/examples/java/Text/StyleInitialization.java2
28 files changed, 74 insertions, 75 deletions
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
index c455e5ff9f2d..2b25f21fba1b 100644
--- a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
+++ b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java
@@ -151,7 +151,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor
xPSetDialog.setPropertyValue( "PositionY", Integer.valueOf( 100 ) );
xPSetDialog.setPropertyValue( "Width", Integer.valueOf( 150 ) );
xPSetDialog.setPropertyValue( "Height", Integer.valueOf( 100 ) );
- xPSetDialog.setPropertyValue( "Title", new String( "Runtime Dialog Demo" ) );
+ xPSetDialog.setPropertyValue( "Title", "Runtime Dialog Demo" );
// get the service manager from the dialog model
XMultiServiceFactory xMultiServiceFactory = ( XMultiServiceFactory )UnoRuntime.queryInterface(
@@ -168,7 +168,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor
xPSetButton.setPropertyValue( "Height", Integer.valueOf( 14 ) );
xPSetButton.setPropertyValue( "Name", _buttonName );
xPSetButton.setPropertyValue( "TabIndex", Short.valueOf( (short)0 ) );
- xPSetButton.setPropertyValue( "Label", new String( "Click Me" ) );
+ xPSetButton.setPropertyValue( "Label", "Click Me" );
// create the label model and set the properties
Object labelModel = xMultiServiceFactory.createInstance(
@@ -195,7 +195,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor
xPSetCancelButton.setPropertyValue( "Name", _cancelButtonName );
xPSetCancelButton.setPropertyValue( "TabIndex", Short.valueOf( (short)2 ) );
xPSetCancelButton.setPropertyValue( "PushButtonType", Short.valueOf( (short)2 ) );
- xPSetCancelButton.setPropertyValue( "Label", new String( "Cancel" ) );
+ xPSetCancelButton.setPropertyValue( "Label", "Cancel" );
// insert the control models into the dialog model
XNameContainer xNameCont = ( XNameContainer )UnoRuntime.queryInterface(
diff --git a/odk/examples/DevelopersGuide/Charts/CalcHelper.java b/odk/examples/DevelopersGuide/Charts/CalcHelper.java
index fa02dc398ac0..ca9ea94438d3 100644
--- a/odk/examples/DevelopersGuide/Charts/CalcHelper.java
+++ b/odk/examples/DevelopersGuide/Charts/CalcHelper.java
@@ -303,7 +303,7 @@ public class CalcHelper
}
else
{
- aFormula = new String( "=" );
+ aFormula = "=";
if( nCol % 2 == 0 )
aFormula += "SIN";
else
diff --git a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java
index 8d15ff9d95d5..31b3cf888598 100644
--- a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java
+++ b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java
@@ -283,7 +283,7 @@ public class JavaSampleChartAddIn extends WeakBase implements
// XServiceName
public String getServiceName() throws RuntimeException
{
- return new String( smServiceName );
+ return smServiceName;
}
// XServiceInfo
@@ -312,7 +312,7 @@ public class JavaSampleChartAddIn extends WeakBase implements
// XDiagram
public String getDiagramType() throws RuntimeException
{
- return new String( smServiceName );
+ return smServiceName;
}
public XPropertySet getDataRowProperties( int nRow )
@@ -349,7 +349,7 @@ public class JavaSampleChartAddIn extends WeakBase implements
// XShapeDescriptor : XShape : XDiagram
public String getShapeType() throws RuntimeException
{
- return new String( "com.sun.star.comp.Chart.JavaSampleDiagramShape" );
+ return "com.sun.star.comp.Chart.JavaSampleDiagramShape";
}
diff --git a/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java b/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
index 60ac0b0d5b26..30700ed90faf 100644
--- a/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
+++ b/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
@@ -159,7 +159,7 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
public void chartDataChanged( ChartDataChangeEvent aEvent )
{
// update subtitle
- String aTitle = new String( "Last Update: " + new java.util.Date( System.currentTimeMillis() ));
+ String aTitle = "Last Update: " + new java.util.Date();
try
{
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
index bb1cdb86109d..8c2e95af56f5 100644
--- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
@@ -206,7 +206,7 @@ public class ProtocolHandlerAddon {
// describe window properties.
WindowDescriptor aDescriptor = new WindowDescriptor();
aDescriptor.Type = WindowClass.MODALTOP;
- aDescriptor.WindowServiceName = new String( "infobox" );
+ aDescriptor.WindowServiceName = "infobox";
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = UnoRuntime.queryInterface(
XWindowPeer.class, m_xFrame.getContainerWindow());
diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
index 7376fddab860..4004a50a9c3e 100644
--- a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
+++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
@@ -171,7 +171,7 @@ public class DialogComponent {
// describe window properties.
WindowDescriptor aDescriptor = new WindowDescriptor();
aDescriptor.Type = WindowClass.MODALTOP;
- aDescriptor.WindowServiceName = new String( "infobox" );
+ aDescriptor.WindowServiceName = "infobox";
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = UnoRuntime.queryInterface(
XWindowPeer.class, m_xFrame.getContainerWindow());
diff --git a/odk/examples/DevelopersGuide/Forms/DataAwareness.java b/odk/examples/DevelopersGuide/Forms/DataAwareness.java
index 1386aa316385..f831d63fa86c 100644
--- a/odk/examples/DevelopersGuide/Forms/DataAwareness.java
+++ b/odk/examples/DevelopersGuide/Forms/DataAwareness.java
@@ -70,7 +70,7 @@ class PrintComponentTree extends ComponentTreeTraversal
public PrintComponentTree()
{
- m_sPrefix = new String();
+ m_sPrefix = "";
}
@Override
@@ -186,11 +186,11 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan
XNamed xNameAcc = UnoRuntime.queryInterface( XNamed.class, xContainer );
if ( null == xNameAcc )
- sObjectName = new String( "<unnamed>" );
+ sObjectName = "<unnamed>";
else
sObjectName = xNameAcc.getName();
- System.out.println( new String( "enumerating the container named \"" ) + sObjectName +
- new String( "\"\n" ) );
+ System.out.println( "enumerating the container named \"" + sObjectName +
+ "\"\n" );
PrintComponentTree aPrinter = new PrintComponentTree();
aPrinter.handle( xContainer );
@@ -745,7 +745,7 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan
xSalesFormProps.setPropertyValue( "DataSourceName", m_database.getDocumentURL() );
xSalesFormProps.setPropertyValue( "CommandType", Integer.valueOf( CommandType.COMMAND ) );
- String sCommand = new String( "SELECT * FROM " );
+ String sCommand = "SELECT * FROM ";
sCommand += s_tableNameSales;
sCommand += " WHERE " + s_tableNameSales + ".SNR = :salesmen";
xSalesFormProps.setPropertyValue( "Command", sCommand );
diff --git a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
index 9cac2a864ca7..148eecd2f91e 100644
--- a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
+++ b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java
@@ -99,7 +99,7 @@ class DocumentViewHelper
XURLTransformer.class, m_orb.createInstance( "com.sun.star.util.URLTransformer" ) );
xTransformer.parseStrict( aURL );
- xReturn = xProvider.queryDispatch( aURL[0], new String( ), 0 );
+ xReturn = xProvider.queryDispatch( aURL[0], "", 0 );
}
return xReturn;
}
@@ -151,7 +151,7 @@ class DocumentViewHelper
{
// get a dispatcher for the toggle URL
URL[] aToggleURL = new URL[] { new URL() };
- aToggleURL[0].Complete = new String( ".uno:SwitchControlDesignMode" );
+ aToggleURL[0].Complete = ".uno:SwitchControlDesignMode";
XDispatch xDispatcher = getDispatcher( aToggleURL );
// dispatch the URL - this will result in toggling the mode
diff --git a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
index aa5a63d65e6e..2a3d92466923 100644
--- a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
+++ b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java
@@ -95,9 +95,9 @@ class GridFieldValidator implements XUpdateListener
sMessage += "\" is not allowed to contain empty strings.";
SQLContext aError = new SQLContext(
- new String( "Invalid Value Entered" ),
+ "Invalid Value Entered",
null,
- new String( "S1000" ),
+ "S1000",
0,
new Any( new Type(), null ),
sMessage
diff --git a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
index 2e00c842ce81..1b1157b91c1e 100644
--- a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
+++ b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java
@@ -101,9 +101,9 @@ class UniqueColumnValue
*/
private String composeUniqueyKeyStatement( XPropertySet xForm, String sFieldName ) throws com.sun.star.uno.Exception
{
- String sStatement = new String( "SELECT MAX( " );
+ String sStatement = "SELECT MAX( ";
sStatement += sFieldName;
- sStatement += new String( ") + 1 FROM " );
+ sStatement += ") + 1 FROM ";
// the table name is a property of the form
sStatement += extractTableName( xForm );
diff --git a/odk/examples/DevelopersGuide/Forms/SalesFilter.java b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
index ee2aedf1c99d..5a1b46cfc9ec 100644
--- a/odk/examples/DevelopersGuide/Forms/SalesFilter.java
+++ b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
@@ -214,7 +214,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
GregorianCalendar aCal = new GregorianCalendar();
aCal.setTime( (java.util.Date)aDate );
- sOdbcDate += new String( "{D '" );
+ sOdbcDate += "{D '";
sOdbcDate += (Integer.valueOf( aCal.get( Calendar.YEAR ) ) ).toString();
sOdbcDate += "-";
diff --git a/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java b/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
index 115d4c381bff..a3fe49b7b58f 100644
--- a/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
+++ b/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java
@@ -103,18 +103,18 @@ public class SingleControlValidation implements XFormComponentValidityListener
controlPos += 4;
XPropertySet xLabel = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null );
- xLabel.setPropertyValue( "Label", new String( "Status:" ) );
+ xLabel.setPropertyValue( "Label", "Status:" );
controlPos += 4;
m_statusField = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null );
- m_statusField.setPropertyValue( "Label", new String( "" ) );
+ m_statusField.setPropertyValue( "Label", "" );
controlPos += 6;
xLabel = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null );
- xLabel.setPropertyValue( "Label", new String( "Explanation for invalidity:" ) );
+ xLabel.setPropertyValue( "Label", "Explanation for invalidity:" );
controlPos += 4;
m_explanationField = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null );
- m_explanationField.setPropertyValue( "Label", new String( "" ) );
+ m_explanationField.setPropertyValue( "Label", "" );
XValidatable xValidatable = UnoRuntime.queryInterface( XValidatable.class, m_inputField );
xValidatable.setValidator( m_validator );
diff --git a/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java b/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java
index a7daf3550241..0d95df29b127 100644
--- a/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java
+++ b/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java
@@ -52,7 +52,7 @@ public class TableCellTextBinding
{
m_cellText = UnoRuntime.queryInterface( XTextRange.class, cell );
- m_newCellText = new String();
+ m_newCellText = "";
m_listeners = new java.util.LinkedList<XModifyListener>();
start();
diff --git a/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java b/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java
index eaecc4c5e44e..bb5a8bd6e1f4 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java
@@ -69,7 +69,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
com.sun.star.text.XTextDocument xDoc =UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class,
xComponent);
- String infoMsg = new String("All context menus of the created document frame contains now a 'Help' entry with the submenus 'Content', 'Help Agent' and 'Tips'.\n\nPress 'Return' in the shell to remove the context menu interceptor and finish the example!");
+ String infoMsg = "All context menus of the created document frame contains now a 'Help' entry with the submenus 'Content', 'Help Agent' and 'Tips'.\n\nPress 'Return' in the shell to remove the context menu interceptor and finish the example!";
xDoc.getText().setString(infoMsg);
// ensure that the document content is optimal visible
@@ -176,9 +176,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
"com.sun.star.ui.ActionTriggerContainer" ));
// intialize root menu entry
- xRootMenuEntry.setPropertyValue( "Text", new String( "Help" ));
- xRootMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5410" ));
- xRootMenuEntry.setPropertyValue( "HelpURL", new String( "5410" ));
+ xRootMenuEntry.setPropertyValue( "Text", "Help");
+ xRootMenuEntry.setPropertyValue( "CommandURL", "slot:5410");
+ xRootMenuEntry.setPropertyValue( "HelpURL", "5410");
xRootMenuEntry.setPropertyValue( "SubContainer", xSubMenuContainer );
// create menu entries for the new sub menu
@@ -188,9 +188,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
XPropertySet.class, xMenuElementFactory.createInstance(
"com.sun.star.ui.ActionTrigger" ));
- xMenuEntry.setPropertyValue( "Text", new String( "Content" ));
- xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5401" ));
- xMenuEntry.setPropertyValue( "HelpURL", new String( "5401" ));
+ xMenuEntry.setPropertyValue( "Text", "Content" );
+ xMenuEntry.setPropertyValue( "CommandURL", "slot:5401" );
+ xMenuEntry.setPropertyValue( "HelpURL", "5401" );
// insert menu entry to sub menu
xSubMenuContainer.insertByIndex( 0, xMenuEntry );
@@ -200,9 +200,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
com.sun.star.beans.XPropertySet.class,
xMenuElementFactory.createInstance(
"com.sun.star.ui.ActionTrigger" ));
- xMenuEntry.setPropertyValue( "Text", new String( "Help Agent" ));
- xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5962" ));
- xMenuEntry.setPropertyValue( "HelpURL", new String( "5962" ));
+ xMenuEntry.setPropertyValue( "Text", "Help Agent" );
+ xMenuEntry.setPropertyValue( "CommandURL", "slot:5962" );
+ xMenuEntry.setPropertyValue( "HelpURL", "5962" );
// insert menu entry to sub menu
xSubMenuContainer.insertByIndex( 1, xMenuEntry );
@@ -212,9 +212,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
com.sun.star.beans.XPropertySet.class,
xMenuElementFactory.createInstance(
"com.sun.star.ui.ActionTrigger" ));
- xMenuEntry.setPropertyValue( "Text", new String( "Tips" ));
- xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5404" ));
- xMenuEntry.setPropertyValue( "HelpURL", new String( "5404" ));
+ xMenuEntry.setPropertyValue( "Text", "Tips" );
+ xMenuEntry.setPropertyValue( "CommandURL", "slot:5404" );
+ xMenuEntry.setPropertyValue( "HelpURL", "5404" );
// insert menu entry to sub menu
xSubMenuContainer.insertByIndex( 2, xMenuEntry );
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
index 77779e73be54..d21f8d36705b 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
@@ -60,8 +60,8 @@ public class Desk
public static void main(String[] lArguments)
{
// Analyze command line parameters.
- String sMode = new String("inplace");
- String sFile = new String("private:factory/swriter");
+ String sMode = "inplace";
+ String sFile = "private:factory/swriter";
for(int i=0; i<lArguments.length; ++i)
{
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
index 7439b31fe898..bffa7321678a 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
@@ -668,13 +668,13 @@ public class FunctionHelper
// Find out possible filter name.
String sFilter = null;
if(xInfo.supportsService("com.sun.star.text.TextDocument")==true)
- sFilter = new String("HTML (StarWriter)");
+ sFilter = "HTML (StarWriter)";
else
if(xInfo.supportsService("com.sun.star.text.WebDocument")==true)
- sFilter = new String("HTML");
+ sFilter = "HTML";
else
if(xInfo.supportsService("com.sun.star.sheet.SpreadsheetDocument")==true)
- sFilter = new String("HTML (StarCalc)");
+ sFilter = "HTML (StarCalc)";
// Check for existing state of this filter.
if(sFilter!=null)
@@ -842,23 +842,23 @@ public class FunctionHelper
for (int i=0; i<nCount; ++i )
{
com.sun.star.frame.XFrame xFrame = (com.sun.star.frame.XFrame)AnyConverter.toObject(new com.sun.star.uno.Type(com.sun.star.frame.XFrame.class), xContainer.getByIndex(i));
- sName = new String(BASEFRAMENAME+mnViewCount);
+ sName = BASEFRAMENAME+mnViewCount;
while(sName.equals(xFrame.getName()))
{
++mnViewCount;
- sName = new String(BASEFRAMENAME+mnViewCount);
+ sName = BASEFRAMENAME+mnViewCount;
}
}
}
catch(com.sun.star.uno.Exception exCreateFailed)
{
- sName = new String(BASEFRAMENAME);
+ sName = BASEFRAMENAME;
}
if (sName==null)
{
System.out.println("invalid name!");
- sName = new String(BASEFRAMENAME);
+ sName = BASEFRAMENAME;
}
return sName;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
index 37fbc0988c3c..d600609dc3d9 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
@@ -52,10 +52,10 @@ public class DisableCommandsTest extends java.lang.Object {
*/
final static private String[] aCommandURLTestSet =
{
- new String( "Open" ),
- new String( "About" ),
- new String( "SelectAll" ),
- new String( "Quit" ),
+ "Open",
+ "About",
+ "SelectAll",
+ "Quit",
};
private static XComponentContext xRemoteContext = null;
@@ -252,7 +252,7 @@ public class DisableCommandsTest extends java.lang.Object {
new com.sun.star.beans.PropertyValue[1];
lParams[0] = new com.sun.star.beans.PropertyValue();
- lParams[0].Name = new String("nodepath");
+ lParams[0].Name = "nodepath";
lParams[0].Value = "/org.openoffice.Office.Commands/Execute/Disabled";
try {
@@ -308,7 +308,7 @@ public class DisableCommandsTest extends java.lang.Object {
new com.sun.star.beans.PropertyValue[1];
lParams[0] = new com.sun.star.beans.PropertyValue();
- lParams[0].Name = new String("nodepath");
+ lParams[0].Name = "nodepath";
lParams[0].Value = "/org.openoffice.Office.Commands/Execute/Disabled";
try {
@@ -345,7 +345,7 @@ public class DisableCommandsTest extends java.lang.Object {
if ( xPropertySet != null ) {
// Create a unique node name.
- String aCmdNodeName = new String( "Command-" );
+ String aCmdNodeName = "Command-";
aCmdNodeName += i;
// Insert the node into the Disabled set
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
index c09e7ce8057d..f12b2cf2d1d8 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
@@ -144,7 +144,7 @@ public class AsciiReplaceFilter
}
// these are safe, thus no errorhandling needed:
- m_sInternalName = new String() ;
+ m_sInternalName = "" ;
m_xDocument = null ;
m_bImport = true ;
m_nFilterProcState = FILTERPROC_STOPPED ;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
index 5d6e9a3dda5b..ce221117201a 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
@@ -121,8 +121,8 @@ public class FilterOptions
m_xOutput = null ;
m_bStreamOwner = false ;
m_sURL = null ;
- m_sOld = new String();
- m_sNew = new String();
+ m_sOld = "";
+ m_sNew = "";
m_bCaseChange = false ;
m_bLower = false ;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java
index 01b9acd7f9c9..f0200973dfdc 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java
@@ -61,11 +61,11 @@ public class XHyphenatedWord_impl implements
//!! none of these cases should ever occur!
//!! values provided only for safety
if (this.aWord == null)
- this.aWord = new String();
+ this.aWord = "";
if (this.aLang == null)
this.aLang = new Locale();
if (this.aHyphenatedWord == null)
- this.aHyphenatedWord = new String();
+ this.aHyphenatedWord = "";
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java
index 0df2eb430b09..9f4cf4d5b4bb 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java
@@ -48,7 +48,7 @@ public class XMeaning_impl implements
//!! none of these cases should ever occur!
//!! values provided only for safety
if (this.aMeaning == null)
- this.aMeaning = new String();
+ this.aMeaning = "";
// a meaning without synonyms may be OK though.
// still for safety an empty existing array has to be provided.
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java
index cf59d407bf13..5ffb37d34dcd 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java
@@ -56,11 +56,11 @@ public class XPossibleHyphens_impl implements
//!! none of these cases should ever occur!
//!! values provided only for safety
if (this.aWord == null)
- this.aWord = new String();
+ this.aWord = "";
if (this.aLang == null)
this.aLang = new Locale();
if (this.aHyphWord == null)
- this.aHyphWord = new String();
+ this.aHyphWord = "";
// having no hyphenation positions is OK though.
// still for safety an empty existing array has to be provided.
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java
index ae26a447ce55..aeb0275c978c 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java
@@ -57,7 +57,7 @@ public class XSpellAlternatives_impl implements
//!! none of these cases should ever occur!
//!! values provided only for safety
if (this.aWord == null)
- this.aWord = new String();
+ this.aWord = "";
if (this.aLanguage == null)
this.aLanguage = new Locale();
diff --git a/odk/examples/DevelopersGuide/UCB/Helper.java b/odk/examples/DevelopersGuide/UCB/Helper.java
index 015e6976e264..0bc7fb1bb7c1 100644
--- a/odk/examples/DevelopersGuide/UCB/Helper.java
+++ b/odk/examples/DevelopersGuide/UCB/Helper.java
@@ -181,7 +181,7 @@ public class Helper {
{
e.printStackTrace();
}
- return new String();
+ return "";
}
public static String prependCurrentDirAsAbsoluteFileURL( String relativeURL )
@@ -217,8 +217,7 @@ public class Helper {
try
{
file.createNewFile();
- String content = new String(
- "This is the content of a sample data file." );
+ String content = "This is the content of a sample data file.";
FileOutputStream stream = new FileOutputStream( file );
stream.write( content.getBytes() );
stream.close();
@@ -235,6 +234,6 @@ public class Helper {
e.printStackTrace();
}
- return new String();
+ return "";
}
}
diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
index 80a09136986b..fda786241ac1 100644
--- a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
+++ b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
@@ -251,7 +251,7 @@ public final class OwnEmbeddedObject extends WeakBase
XInputStream xInStream = xStream.getInputStream();
byte[][] aData = new byte[1][];
aData[0] = new byte[0];
- String aResult = new String();
+ String aResult = "";
int nLen = 0;
do
@@ -661,7 +661,7 @@ public final class OwnEmbeddedObject extends WeakBase
if ( m_bDisposed )
throw new com.sun.star.lang.DisposedException();
- return new String();
+ return "";
}
diff --git a/odk/examples/java/Inspector/ProtocolHandlerAddon.java b/odk/examples/java/Inspector/ProtocolHandlerAddon.java
index 1515759b4000..714593b496c6 100644
--- a/odk/examples/java/Inspector/ProtocolHandlerAddon.java
+++ b/odk/examples/java/Inspector/ProtocolHandlerAddon.java
@@ -208,7 +208,7 @@ public class ProtocolHandlerAddon {
// describe window properties.
WindowDescriptor aDescriptor = new WindowDescriptor();
aDescriptor.Type = WindowClass.MODALTOP;
- aDescriptor.WindowServiceName = new String( "infobox" );
+ aDescriptor.WindowServiceName = "infobox";
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = UnoRuntime.queryInterface(
XWindowPeer.class, m_xFrame.getContainerWindow());
diff --git a/odk/examples/java/Text/StyleCreation.java b/odk/examples/java/Text/StyleCreation.java
index 2861131aed0e..63f8825acd02 100644
--- a/odk/examples/java/Text/StyleCreation.java
+++ b/odk/examples/java/Text/StyleCreation.java
@@ -89,7 +89,7 @@ public class StyleCreation {
System.out.println( "create a PropertySet to set the properties for the new Paragraphstyle" );
// set some properties from the Paragraph style
- xPropertySet.setPropertyValue("CharFontName", new String( "Helvetica" ) );
+ xPropertySet.setPropertyValue("CharFontName", "Helvetica" );
System.out.println( "set name of the font to 'Helvetica'" );
xPropertySet.setPropertyValue("CharHeight", new Float( 36 ) );
@@ -129,7 +129,7 @@ public class StyleCreation {
// To run the sample with StarOffice 5.2 you'll have to change
// 'ParaStyleName' to 'ParaStyle' in the next line
xParagraphPropertySet.setPropertyValue("ParaStyleName",
- new String( "myheading" ) );
+ "myheading" );
System.out.println( "apply the new paragraph style");
}
catch( Exception e) {
diff --git a/odk/examples/java/Text/StyleInitialization.java b/odk/examples/java/Text/StyleInitialization.java
index 76d498df2173..be65e05bf6fa 100644
--- a/odk/examples/java/Text/StyleInitialization.java
+++ b/odk/examples/java/Text/StyleInitialization.java
@@ -212,7 +212,7 @@ public class StyleInitialization {
// To run the sample with StarOffice 5.2 you'll have to change 'ParaStyleName'
// to 'ParaStyle' in the next line
- xPropertySet.setPropertyValue("ParaStyleName", new String( sElementNames[iCounter] ) );
+ xPropertySet.setPropertyValue("ParaStyleName", sElementNames[iCounter] );
System.out.println( "Apply the paragraph style : " + sElementNames[iCounter] );
break;
}