Hi, I have submitted a patch for review:
https://gerrit.libreoffice.org/3547 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/47/3547/1 Bug 62096 - Replace O(U)String compareTo with == Change-Id: I3a8befcf51cea862e9bcc2670bce506004c1be9a --- M odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java M odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java M odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java M odk/examples/java/Inspector/InspectorAddon.java M odk/examples/java/Inspector/ProtocolHandlerAddon.java M odk/examples/java/Spreadsheet/EuroAdaption.java M odk/examples/java/Text/StyleInitialization.java 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java index 27a97ec..7c9c69a 100644 --- a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java +++ b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java @@ -125,7 +125,7 @@ // XJobExecutor public void trigger(String sEvent) { - if ( sEvent.compareTo( "execute" ) == 0 ) { + if ( sEvent = "execute" ) { try { createDialog(); } diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java index 86d58da..c92249e 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java @@ -150,12 +150,12 @@ /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Protocol == "org.openoffice.Office.addon.example:" ) { + if ( aURL.Path == "Function1" ) xRet = this; - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path == "Function2 ) xRet = this; - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path == "Help" ) xRet = this; } return xRet; @@ -177,17 +177,17 @@ public void dispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) + if ( aURL.Protocol == "org.openoffice.Office.addon.example:" ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Path == "Function1" ) { showMessageBox("SDK DevGuide Add-On example", "Function 1 activated"); } - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path == "Function2" ) { showMessageBox("SDK DevGuide Add-On example", "Function 2 activated"); } - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path == "Help" ) { showMessageBox("About SDK DevGuide Add-On example", "This is the SDK Add-On example"); } diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java index c0e165e..9ab74c5 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java @@ -390,7 +390,7 @@ String sCommand = aEvent.getActionCommand(); //----------------------------- // open any file from disk - if( sCommand.compareTo(COMMAND_OPEN) == 0 ) + if( sCommand == COMMAND_OPEN ) { String sURL = FunctionHelper.askUserForFileURL(DocumentView.this,true); if(sURL!=null) @@ -399,14 +399,14 @@ else //----------------------------- // save current document - if( sCommand.compareTo(COMMAND_SAVE) == 0 ) + if( sCommand == COMMAND_SAVE ) { DocumentView.this.save(); } else //----------------------------- // export current document to html - if( sCommand.compareTo(COMMAND_EXPORT) == 0 ) + if( sCommand == COMMAND_EXPORT ) { String sURL = FunctionHelper.askUserForFileURL(DocumentView.this,false); if(sURL!=null) @@ -415,7 +415,7 @@ else //----------------------------- // exit application - if( sCommand.compareTo(COMMAND_EXIT) == 0 ) + if( sCommand == COMMAND_EXIT ) { // This will force deleting of this and // all other currently opened views automaticly! diff --git a/odk/examples/java/Inspector/InspectorAddon.java b/odk/examples/java/Inspector/InspectorAddon.java index f7605fd..6ed8659 100644 --- a/odk/examples/java/Inspector/InspectorAddon.java +++ b/odk/examples/java/Inspector/InspectorAddon.java @@ -72,8 +72,8 @@ public XDispatch queryDispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ) { - if ( aURL.Path.compareTo( "inspect" ) == 0 ){ + if ( aURL.Protocol == "org.openoffice.Office.addon.Inspector:" ) { + if ( aURL.Path == "inspect" ){ // Todo: Check if the frame is already administered (use hashtable) xRet = new Dispatcher(m_xFrame); } @@ -114,7 +114,7 @@ // XDispatch public void dispatch( /*IN*/com.sun.star.util.URL _aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { try{ - if ( _aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ){ + if ( _aURL.Protocol == "org.openoffice.Office.addon.Inspector:" ){ if ( _aURL.Path.equals("inspect")){ Object oUnoInspectObject = xModel; com.sun.star.lang.XMultiComponentFactory xMCF = m_xContext.getServiceManager(); diff --git a/odk/examples/java/Inspector/ProtocolHandlerAddon.java b/odk/examples/java/Inspector/ProtocolHandlerAddon.java index e20d3a2..7736d1d 100644 --- a/odk/examples/java/Inspector/ProtocolHandlerAddon.java +++ b/odk/examples/java/Inspector/ProtocolHandlerAddon.java @@ -151,12 +151,12 @@ /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Protocol == "org.openoffice.Office.addon.example:" ) { + if ( aURL.Path == "Function1" ) xRet = this; - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path == "Function2" ) xRet = this; - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path == "Help" ) xRet = this; } return xRet; @@ -178,13 +178,13 @@ public void dispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) + if ( aURL.Protocol == "org.openoffice.Office.addon.example:" ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Path == "Function1" ) { showMessageBox("SDK DevGuide Add-On example", "Function 1 activated"); } - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path == "Function2" ) { showMessageBox("SDK DevGuide Add-On example", "Function 2 activated"); } diff --git a/odk/examples/java/Spreadsheet/EuroAdaption.java b/odk/examples/java/Spreadsheet/EuroAdaption.java index 2f4f1d4..56aa57d 100644 --- a/odk/examples/java/Spreadsheet/EuroAdaption.java +++ b/odk/examples/java/Spreadsheet/EuroAdaption.java @@ -192,7 +192,7 @@ // change the numberformat only on cellranges with a // currency numberformat if( ( (fType & com.sun.star.util.NumberFormat.CURRENCY) > 0) && - ( sCurrencySymbol.compareTo( sOldSymbol ) == 0 ) ) { + ( sCurrencySymbol == sOldSymbol ) ) { boolean bThousandSep = aAnyConv.toBoolean( xFormat.getPropertyValue("ThousandsSeparator")); boolean bNegativeRed = aAnyConv.toBoolean( diff --git a/odk/examples/java/Text/StyleInitialization.java b/odk/examples/java/Text/StyleInitialization.java index e092a36..f31a8b2 100644 --- a/odk/examples/java/Text/StyleInitialization.java +++ b/odk/examples/java/Text/StyleInitialization.java @@ -206,7 +206,7 @@ sFontname = sFontname.toLowerCase(); // if the style use the font 'Albany', apply it to the current paragraph - if( sFontname.compareTo("albany") == 0 ) { + if( sFontname == "albany" ) { // create a property set from the current paragraph, to change the paragraph style xPropertySet = UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xTextRange ); -- To view, visit https://gerrit.libreoffice.org/3547 To unsubscribe, visit https://gerrit.libreoffice.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3a8befcf51cea862e9bcc2670bce506004c1be9a Gerrit-PatchSet: 1 Gerrit-Project: core Gerrit-Branch: master Gerrit-Owner: Anurag Kanungo <anuragkanu...@gmail.com> _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice