diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-12 15:27:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-19 14:57:18 +0200 |
commit | 4b4bff34027cca49fd13e82d33d1b399848838fa (patch) | |
tree | 361bde1ae9cf88160694bec9d5f3c1893d398f66 | |
parent | c552aac9f889b094caaa35c3fd9d12fe7c3fc73c (diff) |
java: no need to instantiate String objects directly
Change-Id: I7610774c94bf673ed3b574ffce04c4ee6ca93c03
60 files changed, 132 insertions, 150 deletions
diff --git a/chart2/qa/TestCaseOldAPI.java b/chart2/qa/TestCaseOldAPI.java index fec6430ca002..849c5597e12d 100644 --- a/chart2/qa/TestCaseOldAPI.java +++ b/chart2/qa/TestCaseOldAPI.java @@ -504,7 +504,7 @@ public class TestCaseOldAPI extends ComplexTestCase { try { - String aMyServiceName = new String( "com.sun.star.chart.BarDiagram" ); + String aMyServiceName = "com.sun.star.chart.BarDiagram"; String aServices[] = xFact.getAvailableServiceNames(); boolean bServiceFound = false; for( int i = 0; i < aServices.length; ++i ) @@ -753,7 +753,7 @@ public class TestCaseOldAPI extends ComplexTestCase { XMultiServiceFactory.class, mxOldDoc ); assure( "document is no factory", xFact != null ); - String aMyServiceName = new String( "com.sun.star.chart.StockDiagram" ); + String aMyServiceName = "com.sun.star.chart.StockDiagram"; XDiagram xDia = UnoRuntime.queryInterface( XDiagram.class, xFact.createInstance( aMyServiceName )); assure( aMyServiceName + " could not be created", xDia != null ); diff --git a/embeddedobj/test/Container1/EmbedContApp.java b/embeddedobj/test/Container1/EmbedContApp.java index b0b2708d5467..94a4e99e9367 100644 --- a/embeddedobj/test/Container1/EmbedContApp.java +++ b/embeddedobj/test/Container1/EmbedContApp.java @@ -1524,23 +1524,6 @@ public class EmbedContApp extends Applet Object oEmbObj = null; if ( xNameAccess.hasByName( "LinkName" ) && xTargetStorage.isStreamElement( "LinkName" ) ) { - /* - // OOo links will not be tested until they have correct persistence - XStream xLinkStream = xTargetStorage.openStreamElement( "LinkName", ElementModes.ELEMENT_READ ); - if ( xLinkStream != null ) - { - XInputStream xInStream = xLinkStream.getInputStream(); - if ( xInStream != null ) - { - byte[][] pBuff = new byte[1][0]; - int nRead = xInStream.readBytes( pBuff, 1000 ); - m_aLinkURI = new String( pBuff[0] ); - xInStream.closeInput(); - oEmbObj = xEmbedCreator.createInstanceLink( m_aLinkURI ); - m_bLinkObj = true; - } - } - */ } else oEmbObj = xEmbedCreator.createInstanceInitFromEntry( xTargetStorage, diff --git a/extensions/qa/integration/extensions/MethodHandler.java b/extensions/qa/integration/extensions/MethodHandler.java index 771784b66c1f..b2a56037b4a6 100644 --- a/extensions/qa/integration/extensions/MethodHandler.java +++ b/extensions/qa/integration/extensions/MethodHandler.java @@ -119,7 +119,7 @@ public class MethodHandler implements XPropertyHandler { XIdlMethod method = impl_getMethod( _propertyName ); - String signature = new String(); + String signature = ""; signature += method.getReturnType().getName(); signature += " "; signature += method.getName(); diff --git a/extensions/qa/integration/extensions/ObjectInspector.java b/extensions/qa/integration/extensions/ObjectInspector.java index f0f1f3104215..84fcf0e77696 100644 --- a/extensions/qa/integration/extensions/ObjectInspector.java +++ b/extensions/qa/integration/extensions/ObjectInspector.java @@ -34,7 +34,7 @@ public class ObjectInspector extends complexlib.ComplexTestCase private XMultiServiceFactory m_orb; private Frame m_desktop; - final private String m_inspectorFrameName = new String( "ObjectInspector" ); + final private String m_inspectorFrameName = "ObjectInspector"; /** Creates a new instance of ValueBinding */ public ObjectInspector() diff --git a/forms/qa/integration/forms/CellBinding.java b/forms/qa/integration/forms/CellBinding.java index d039aee762a2..388ee8112833 100644 --- a/forms/qa/integration/forms/CellBinding.java +++ b/forms/qa/integration/forms/CellBinding.java @@ -110,9 +110,9 @@ public class CellBinding extends complexlib.ComplexTestCase { final short col = 0; final short row = 2; - final String text = new String( "content" ); - final String otherText = new String( "something else" ); - final String yetAnotherText = new String( "yet another text" ); + final String text = "content"; + final String otherText = "something else"; + final String yetAnotherText = "yet another text"; // cretae a normal text control XPropertySet controlModel = m_formLayer.createControlAndShape( "DatabaseTextField", 30, 9, 30, 6 ); @@ -182,8 +182,8 @@ public class CellBinding extends complexlib.ComplexTestCase XPropertySet secondaryRadio = createRadio( 51, "radio button B", "radio ref group", "secodary" ); // give the ref values - String refValueA = new String( "ref value A" ); - String refValueB = new String( "ref value B" ); + String refValueA = "ref value A"; + String refValueB = "ref value B"; primaryRadio.setPropertyValue( "RefValue", refValueA ); secondaryRadio.setPropertyValue( "RefValue", refValueB ); @@ -241,7 +241,7 @@ public class CellBinding extends complexlib.ComplexTestCase /* ------------------------------------------------------------------ */ public void checkStringCheckBoxBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception { - String refValue = new String( "checked " ); + String refValue = "checked "; XPropertySet checkBox = m_formLayer.createControlAndShape( "DatabaseCheckBox", 30, 68, 40, 4 ); checkBox.setPropertyValue( "Label", "check box with ref value" ); diff --git a/forms/qa/integration/forms/DocumentViewHelper.java b/forms/qa/integration/forms/DocumentViewHelper.java index bd4a34474751..5c82fa40b51e 100644 --- a/forms/qa/integration/forms/DocumentViewHelper.java +++ b/forms/qa/integration/forms/DocumentViewHelper.java @@ -100,7 +100,7 @@ public 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; } diff --git a/forms/qa/integration/forms/FormControlTest.java b/forms/qa/integration/forms/FormControlTest.java index d78fd581d133..d574640e3038 100644 --- a/forms/qa/integration/forms/FormControlTest.java +++ b/forms/qa/integration/forms/FormControlTest.java @@ -186,7 +186,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE } // okay, now remove the image - xImageModel.setPropertyValue( "ImageURL", new String() ); + xImageModel.setPropertyValue( "ImageURL", "" ); if ( !verifyReferenceImage( new byte[0] ) ) { failed( "image control failed to remove the image" ); @@ -563,8 +563,8 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE XPropertySet xRadio = m_formLayer.createControlAndShape( "DatabaseRadioButton", 106, nYPos, 25, 6 ); xRadio.setPropertyValue( "Label", label ); xRadio.setPropertyValue( "RefValue", refValue ); - xRadio.setPropertyValue( "Name", new String( "radio_group" ) ); - xRadio.setPropertyValue( "DataField", new String( "f_text_enum" ) ); + xRadio.setPropertyValue( "Name", "radio_group" ); + xRadio.setPropertyValue( "DataField", "f_text_enum"); } /* ------------------------------------------------------------------ */ diff --git a/forms/qa/integration/forms/SingleControlValidation.java b/forms/qa/integration/forms/SingleControlValidation.java index 239789decabe..7796568dafec 100644 --- a/forms/qa/integration/forms/SingleControlValidation.java +++ b/forms/qa/integration/forms/SingleControlValidation.java @@ -107,18 +107,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/forms/qa/integration/forms/TableCellTextBinding.java b/forms/qa/integration/forms/TableCellTextBinding.java index 5e28bc8ccba8..475ceb6fbd2a 100644 --- a/forms/qa/integration/forms/TableCellTextBinding.java +++ b/forms/qa/integration/forms/TableCellTextBinding.java @@ -55,7 +55,7 @@ public class TableCellTextBinding { m_cellText = UnoRuntime.queryInterface( XTextRange.class, cell ); - m_newCellText = new String(); + m_newCellText = ""; m_listeners = new java.util.LinkedList<com.sun.star.util.XModifyListener>(); start(); diff --git a/forms/qa/org/openoffice/xforms/XMLDocument.java b/forms/qa/org/openoffice/xforms/XMLDocument.java index 339f14a564e6..0f6b337f76c4 100644 --- a/forms/qa/org/openoffice/xforms/XMLDocument.java +++ b/forms/qa/org/openoffice/xforms/XMLDocument.java @@ -91,7 +91,7 @@ public class XMLDocument extends integration.forms.DocumentHelper newModel.setID(_modelName); XFormsUIHelper1 modelHelper = UnoRuntime.queryInterface( XFormsUIHelper1.class, newModel ); - modelHelper.newInstance( "Instance 1", new String(), true ); + modelHelper.newInstance( "Instance 1", "", true ); newModel.initialize(); m_forms.insertByName(_modelName, newModel); diff --git a/framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java b/framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java index 45d0c675ec56..07b73a5974cb 100644 --- a/framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java +++ b/framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java @@ -359,8 +359,8 @@ public class AcceleratorsConfigurationTest { System.out.println("** get command by " + sKeys[i] + " **"); - String sCmdFromCache = new String(); // get a value using XAcceleratorConfiguration API - String sCmdFromConfiguration = new String(); // get a value using configuration API + String sCmdFromCache = ""; // get a value using XAcceleratorConfiguration API + String sCmdFromConfiguration = ""; // get a value using configuration API // GET shortcuts/commands using XAcceleratorConfiguration API sCmdFromCache = xAccelCfg.getCommandByKeyEvent(convertShortcut2AWTKey(sKeys[i])); @@ -538,7 +538,7 @@ public class AcceleratorsConfigurationTest private String getCommandFromConfiguration(XNameAccess xAccess, String sKey) throws java.lang.Exception { - String sCommand = new String(); + String sCommand = ""; if (xAccess.hasByName(sKey)) { @@ -690,7 +690,7 @@ public class AcceleratorsConfigurationTest private String getOfficeLocale() throws java.lang.Exception { - String sLocale = new String(); + String sLocale = ""; String sConfigPath = "org.openoffice.Setup"; boolean bReadOnly = true; diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java index 34e502642e56..c3f950b3031d 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java @@ -129,7 +129,7 @@ public class PropertySet_Test cl.setPropertyValue("PropDoubleA",value); ret= cl.getPropertyValue("PropDoubleA"); r[i++]= ((Double) ret).equals(value); - value= new String("string"); + value= "string"; cl.setPropertyValue("PropStringA",value); ret= cl.getPropertyValue("PropStringA"); r[i++]= ((String) ret).equals(value); @@ -204,7 +204,7 @@ public class PropertySet_Test cl.setPropertyValue("PropObjectA",value); ret= cl.getPropertyValue("PropObjectA"); r[i++]= ((Double) ret).equals(value); - value= new String("string"); + value= "string"; cl.setPropertyValue("PropObjectA",value); ret= cl.getPropertyValue("PropObjectA"); r[i++]= ((String) ret).equals(value); @@ -261,7 +261,7 @@ public class PropertySet_Test cl.setPropertyValue("PropAnyA",value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); - value= new String("string"); + value= "string"; cl.setPropertyValue("PropAnyA",value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); @@ -315,7 +315,7 @@ public class PropertySet_Test cl.setPropertyValue("PropDoubleA",value); ret= cl.getPropertyValue("PropDoubleA"); r[i++]= ret instanceof Double && util.anyEquals(value, ret); - value= new Any(new Type(String.class), new String("string")); + value= new Any(new Type(String.class), "string"); cl.setPropertyValue("PropStringA",value); ret= cl.getPropertyValue("PropStringA"); r[i++]= ret instanceof String && util.anyEquals(value, ret); @@ -370,7 +370,7 @@ public class PropertySet_Test cl.setPropertyValue("PropAnyA",value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); - value= new Any(new Type(String.class), new String("string")); + value= new Any(new Type(String.class), "string"); cl.setPropertyValue("PropAnyA",value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); @@ -462,7 +462,7 @@ public class PropertySet_Test cl.setPropertyValue("PropDoubleClass",value); ret= cl.getPropertyValue("PropDoubleClass"); r[i++]= ret instanceof Double && util.anyEquals(value, ret); - value= new Any(new Type(String.class), new String("string")); + value= new Any(new Type(String.class), "string"); diff --git a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java index 39f8e8b2a3cd..17551bade8ab 100644 --- a/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java +++ b/jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java @@ -60,7 +60,7 @@ public final class Marshaling_Test { Integer.valueOf(0xff000000), Long.valueOf(666L), Short.valueOf((short)444), - new String("blabla"), + "blabla", Integer.valueOf(10), // Any as object Integer.valueOf(10), // Any as object new Any(new Type(Integer.class), Integer.valueOf(10)), // Any as Any @@ -70,7 +70,7 @@ public final class Marshaling_Test { x, new byte[]{1,2,3,4,5,6,7}, // primitive sequence new int[]{7,6,5,4,3,2,1}, // primitive sequence - new Object[]{Integer.valueOf(123), new String("hallo")}, // any sequence + new Object[]{Integer.valueOf(123), "hallo"}, // any sequence new TestPrimitiveStruct[]{new TestPrimitiveStruct(), new TestPrimitiveStruct()}, // sequence of primitive structs new TestPrimitiveSeqStruct[]{new TestPrimitiveSeqStruct(), new TestPrimitiveSeqStruct()}, // sequence of primitive structs new TestNestedStruct(), diff --git a/jurt/test/com/sun/star/uno/AnyConverter_Test.java b/jurt/test/com/sun/star/uno/AnyConverter_Test.java index 0900eeaf64e6..eb55ae1a0fe5 100644 --- a/jurt/test/com/sun/star/uno/AnyConverter_Test.java +++ b/jurt/test/com/sun/star/uno/AnyConverter_Test.java @@ -46,7 +46,7 @@ public final class AnyConverter_Test { Float aFloat= new Float( 3.14); Double aDouble= new Double( 3.145); Object aObj= new ATypeProvider(); - String aStr= new String("I am a string"); + String aStr= "I am a string"; Type aType= new Type(String.class); byte[] arByte= new byte[] {1,2,3}; 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; } diff --git a/qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor.java b/qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor.java index dbcd70bdd543..c0265af60709 100644 --- a/qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor.java +++ b/qadevOOo/tests/java/ifc/sheet/_XDataPilotDescriptor.java @@ -58,7 +58,7 @@ public class _XDataPilotDescriptor extends MultiMethodTest { public XDataPilotDescriptor oObj = null; CellRangeAddress CRA = new CellRangeAddress((short)1, 1, 1, 5, 5); CellRangeAddress oldCRA = null ; - String sTag = new String ("XDataPilotDescriptor_Tag"); + String sTag = "XDataPilotDescriptor_Tag"; String fieldsNames[]; int fieldsAmount = 0; int tEnvFieldsAmount = 0; diff --git a/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java b/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java index 3fcee41580db..37ec42ac882f 100644 --- a/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java +++ b/sc/qa/complex/dataPilot/_XDataPilotDescriptor.java @@ -55,7 +55,7 @@ public class _XDataPilotDescriptor { private XDataPilotDescriptor oObj = null; private CellRangeAddress CRA = new CellRangeAddress((short)1, 0, 0, 5, 5); - private String sTag = new String ("XDataPilotDescriptor_Tag"); + private String sTag = "XDataPilotDescriptor_Tag"; private String fieldsNames[]; private int fieldsAmount = 0; private int tEnvFieldsAmount = 0; diff --git a/scripting/examples/java/Newsgroup/OfficeAttachment.java b/scripting/examples/java/Newsgroup/OfficeAttachment.java index 8e36d1fb47f1..8a008ae18ea8 100644 --- a/scripting/examples/java/Newsgroup/OfficeAttachment.java +++ b/scripting/examples/java/Newsgroup/OfficeAttachment.java @@ -104,11 +104,11 @@ public class OfficeAttachment status.setStatus( 4, statusLine ); PropertyValue[] propertyvalue_html = new PropertyValue[2]; propertyvalue_html[0] = new PropertyValue(); - propertyvalue_html[0].Name = new String("Overwrite"); + propertyvalue_html[0].Name = "Overwrite"; propertyvalue_html[0].Value = Boolean.TRUE; propertyvalue_html[1] = new PropertyValue(); propertyvalue_html[1].Name = ("FilterName"); - propertyvalue_html[1].Value = new String("swriter: HTML (StarWriter)"); + propertyvalue_html[1].Value = "swriter: HTML (StarWriter)"; storedDoc.storeAsURL( filenameURL + ".html", propertyvalue_html); File homedir = new File( templocationSystem ); @@ -130,10 +130,10 @@ public class OfficeAttachment status.setStatus( 4, statusLine ); PropertyValue[] propertyvalue_sxw = new PropertyValue[2]; propertyvalue_sxw[0] = new PropertyValue(); - propertyvalue_sxw[0].Name = new String("Overwrite"); + propertyvalue_sxw[0].Name = "Overwrite"; propertyvalue_sxw[0].Value = Boolean.TRUE; propertyvalue_sxw[1] = new PropertyValue(); - propertyvalue_sxw[1].Name = new String("Overwrite"); + propertyvalue_sxw[1].Name = "Overwrite"; propertyvalue_sxw[1].Value = Boolean.TRUE; storedDoc.storeAsURL( filenameURL + ".sxw", propertyvalue_sxw); diff --git a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java index dfba37555c99..b1bdfff645ad 100644 --- a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java +++ b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java @@ -337,7 +337,7 @@ XInitialization { xPSetCheckBox.setPropertyValue( "State", Short.valueOf((short)0) ); xPSetCheckBox.setPropertyValue( "Name", _checkBoxName ); xPSetCheckBox.setPropertyValue( "TabIndex", Short.valueOf( (short)1 ) ); - xPSetCheckBox.setPropertyValue( "Label", new String(_checkBoxString +checkBoxPath) ); + xPSetCheckBox.setPropertyValue( "Label", _checkBoxString +checkBoxPath ); // insert the control models into the dialog model xNameCont.insertByName( _label2Name, label2Model ); diff --git a/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java index 12be9bc19592..c2f966cbd23f 100644 --- a/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java +++ b/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java @@ -214,7 +214,7 @@ public class ParcelBrowseNode extends PropertySet } else { - String source = new String(provider.getScriptEditor().getTemplate().getBytes()); + String source = provider.getScriptEditor().getTemplate(); String languageName = newName + "." + provider.getScriptEditor().getExtension(); String language = container.getLanguage(); diff --git a/scripting/java/com/sun/star/script/framework/provider/PathUtils.java b/scripting/java/com/sun/star/script/framework/provider/PathUtils.java index 307d3460b9ab..48ca6c9a7cf7 100644 --- a/scripting/java/com/sun/star/script/framework/provider/PathUtils.java +++ b/scripting/java/com/sun/star/script/framework/provider/PathUtils.java @@ -40,7 +40,7 @@ public class PathUtils { } public static String getOidForModel( XModel xModel ) { - String oid = new String(""); + String oid = ""; if ( xModel != null ) { try diff --git a/toolkit/test/accessibility/AccessibleContextHandler.java b/toolkit/test/accessibility/AccessibleContextHandler.java index 01770209b298..8409a9a7da88 100644 --- a/toolkit/test/accessibility/AccessibleContextHandler.java +++ b/toolkit/test/accessibility/AccessibleContextHandler.java @@ -54,7 +54,7 @@ class AccessibleContextHandler if (aParent instanceof AccTreeNode) xContext = ((AccTreeNode)aParent).getContext(); - String sChild = new String(); + String sChild = ""; if (xContext != null) { switch( nIndex ) diff --git a/toolkit/test/accessibility/AccessibleTextHandler.java b/toolkit/test/accessibility/AccessibleTextHandler.java index 6d3d69892d2a..39ecbad6e4bc 100644 --- a/toolkit/test/accessibility/AccessibleTextHandler.java +++ b/toolkit/test/accessibility/AccessibleTextHandler.java @@ -348,7 +348,7 @@ class AccessibleTextHandler extends NodeHandler } catch(com.sun.star.lang.IllegalArgumentException e) { - aPortion = new String (""); + aPortion = ""; } // get attributes and make node with attribute children diff --git a/toolkit/test/accessibility/NodeFactory.java b/toolkit/test/accessibility/NodeFactory.java index 516ab25fb667..8c288396e4a2 100644 --- a/toolkit/test/accessibility/NodeFactory.java +++ b/toolkit/test/accessibility/NodeFactory.java @@ -126,7 +126,7 @@ class NodeFactory } } else - sDisplay = new String ("not accessible"); + sDisplay = "not accessible"; // create node, and add default handlers diff --git a/toolkit/test/accessibility/ov/StateSetView.java b/toolkit/test/accessibility/ov/StateSetView.java index 82a39f7b2c58..8933fb65c197 100644 --- a/toolkit/test/accessibility/ov/StateSetView.java +++ b/toolkit/test/accessibility/ov/StateSetView.java @@ -246,7 +246,7 @@ public static class StateSetSetView XAccessibleStateSet xStateSet = mxContext.getAccessibleStateSet(); if (xStateSet != null) { - String sStates = new String (); + String sStates = ""; short aStates[] = xStateSet.getStates(); for (int i=0; i<aStates.length; i++) { diff --git a/unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java b/unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java index b834d4671462..41f51b377a52 100644 --- a/unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java +++ b/unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java @@ -81,7 +81,7 @@ public class OfficeDocumentView 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; } diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java index 9c79c9898c9f..83efc31d4660 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java @@ -588,7 +588,7 @@ public class TextStyle extends Style implements Cloneable { v[0] = c.getRed(); v[1] = c.getGreen(); v[2] = c.getBlue(); - String colorString = new String("#"); + String colorString = "#"; for (int i = 0; i <= 2; i++) { String xx = Integer.toHexString(v[i]); if (xx.length() < 2) diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java index 20f1a790dcce..fd47549359a1 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/BookSettings.java @@ -38,7 +38,7 @@ public class BookSettings implements OfficeConstants { private org.w3c.dom.Document settings = null; private boolean hasColumnRowHeaders = true; - private String activeSheet = new String(); + private String activeSheet = ""; private ArrayList<SheetSettings> worksheetSettings = new ArrayList<SheetSettings>(); /** diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle.java index 1bde03f48da2..e437e18764d6 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/CellStyle.java @@ -457,7 +457,7 @@ public class CellStyle extends Style implements Cloneable { v[0] = c.getRed(); v[1] = c.getGreen(); v[2] = c.getBlue(); - String colorString = new String("#"); + String colorString = "#"; for (int i = 0; i <= 2; i++) { String xx = Integer.toHexString(v[i]); if (xx.length() < 2) diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java index 3bf1dc70c2ec..8be897c47e9e 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java @@ -369,7 +369,7 @@ public class Format implements Cloneable { */ @Override public String toString() { - return new String("Value : " + getValue() + " Category : " + getCategory()); + return "Value : " + getValue() + " Category : " + getCategory(); } /** diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java index c79abc3a1406..ba060cbf3e4b 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/SxcDocumentSerializer.java @@ -365,7 +365,7 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, repeatedRows = Integer.parseInt(repeatStr); } - String styleName = new String(""); + String styleName = ""; if ( rowStyle != null) { styleName = rowStyle.getNodeValue(); @@ -481,7 +481,7 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, col.setRepeated(repeatedColumns); } - String cellStyleName = new String(""); + String cellStyleName = ""; if(tableDefaultCellStyle!=null) { cellStyleName = tableDefaultCellStyle.getNodeValue(); @@ -502,7 +502,7 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, col.setFormat(defaultFmt); } - String styleName = new String(""); + String styleName = ""; if(tableStyleNode!=null) { styleName = tableStyleNode.getNodeValue(); @@ -568,7 +568,7 @@ public abstract class SxcDocumentSerializer implements OfficeConstants, Node tableStyleNode = cellAtt.getNamedItem(ATTRIBUTE_TABLE_STYLE_NAME); - String styleName = new String(""); + String styleName = ""; if(tableStyleNode!=null) { styleName = tableStyleNode.getNodeValue(); diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList.java index ce942134ef5c..f71dbe5bc80a 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/test/ConverterInfoList.java @@ -66,7 +66,7 @@ public class ConverterInfoList { bis.close(); int i = 1; - String jarFileName = new String(); + String jarFileName = ""; jars = new ArrayList<String>(); while ((jarFileName = props.getProperty("jarname" + i)) != null) { diff --git a/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java b/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java index 4280fb425381..6629a327a0ca 100644 --- a/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java +++ b/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java @@ -110,13 +110,13 @@ public class Main { } static void printUsage() { - String usage = new String( + String usage = "Usage: \n" + "java -jar httpserv [options] \n" + "\n" + "Options are: \n" + "-h --help \t this help \n" + - "-a --accept port \t the port number to which this server listens \n"); + "-a --accept port \t the port number to which this server listens \n"; System.out.println(usage); } } |