From 4b4bff34027cca49fd13e82d33d1b399848838fa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Aug 2014 15:27:21 +0200 Subject: java: no need to instantiate String objects directly Change-Id: I7610774c94bf673ed3b574ffce04c4ee6ca93c03 --- chart2/qa/TestCaseOldAPI.java | 4 ++-- embeddedobj/test/Container1/EmbedContApp.java | 17 -------------- .../qa/integration/extensions/MethodHandler.java | 2 +- .../qa/integration/extensions/ObjectInspector.java | 2 +- forms/qa/integration/forms/CellBinding.java | 12 +++++----- forms/qa/integration/forms/DocumentViewHelper.java | 2 +- forms/qa/integration/forms/FormControlTest.java | 6 ++--- .../integration/forms/SingleControlValidation.java | 8 +++---- .../qa/integration/forms/TableCellTextBinding.java | 2 +- forms/qa/org/openoffice/xforms/XMLDocument.java | 2 +- .../AcceleratorsConfigurationTest.java | 8 +++---- .../sun/star/lib/uno/helper/PropertySet_Test.java | 12 +++++----- .../lib/uno/protocols/urp/Marshaling_Test.java | 4 ++-- jurt/test/com/sun/star/uno/AnyConverter_Test.java | 2 +- .../CreatingDialogs/SampleDialog.java | 6 ++--- .../DevelopersGuide/Charts/CalcHelper.java | 2 +- .../Charts/JavaSampleChartAddIn.java | 6 ++--- .../Charts/ListenAtCalcRangeInDraw.java | 2 +- .../ProtocolHandlerAddon.java | 2 +- .../dialogcomponent/DialogComponent.java | 2 +- .../DevelopersGuide/Forms/DataAwareness.java | 10 ++++----- .../DevelopersGuide/Forms/DocumentViewHelper.java | 4 ++-- .../DevelopersGuide/Forms/GridFieldValidator.java | 4 ++-- .../DevelopersGuide/Forms/KeyGenerator.java | 4 ++-- .../DevelopersGuide/Forms/SalesFilter.java | 2 +- .../Forms/SingleControlValidation.java | 8 +++---- .../Forms/TableCellTextBinding.java | 2 +- .../OfficeDev/ContextMenuInterceptor.java | 26 +++++++++++----------- .../OfficeDev/DesktopEnvironment/Desk.java | 4 ++-- .../DesktopEnvironment/FunctionHelper.java | 14 ++++++------ .../DisableCommands/DisableCommandsTest.java | 14 ++++++------ .../AsciiFilter/AsciiReplaceFilter.java | 2 +- .../AsciiFilter/FilterOptions.java | 4 ++-- .../OfficeDev/Linguistic/XHyphenatedWord_impl.java | 4 ++-- .../OfficeDev/Linguistic/XMeaning_impl.java | 2 +- .../Linguistic/XPossibleHyphens_impl.java | 4 ++-- .../Linguistic/XSpellAlternatives_impl.java | 2 +- odk/examples/DevelopersGuide/UCB/Helper.java | 7 +++--- .../EmbeddedObject/OwnEmbeddedObject.java | 4 ++-- .../java/Inspector/ProtocolHandlerAddon.java | 2 +- odk/examples/java/Text/StyleCreation.java | 4 ++-- odk/examples/java/Text/StyleInitialization.java | 2 +- .../java/ifc/sheet/_XDataPilotDescriptor.java | 2 +- sc/qa/complex/dataPilot/_XDataPilotDescriptor.java | 2 +- .../examples/java/Newsgroup/OfficeAttachment.java | 8 +++---- .../script/framework/security/SecurityDialog.java | 2 +- .../script/framework/browse/ParcelBrowseNode.java | 2 +- .../star/script/framework/provider/PathUtils.java | 2 +- .../accessibility/AccessibleContextHandler.java | 2 +- .../test/accessibility/AccessibleTextHandler.java | 2 +- toolkit/test/accessibility/NodeFactory.java | 2 +- toolkit/test/accessibility/ov/StateSetView.java | 2 +- .../openoffice/test/tools/OfficeDocumentView.java | 2 +- .../openoffice/xmerge/converter/xml/TextStyle.java | 2 +- .../xmerge/converter/xml/sxc/BookSettings.java | 2 +- .../xmerge/converter/xml/sxc/CellStyle.java | 2 +- .../xmerge/converter/xml/sxc/Format.java | 2 +- .../converter/xml/sxc/SxcDocumentSerializer.java | 8 +++---- .../openoffice/xmerge/test/ConverterInfoList.java | 2 +- .../tools/httpserv/src/httpserv/Main.java | 4 ++-- 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(); 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( "" ); + sObjectName = ""; 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(); 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 worksheetSettings = new ArrayList(); /** 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(); 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); } } -- cgit