[Libreoffice-commits] core.git: 10 commits - bean/com javaunohelper/com nlpsolver/ThirdParty qadevOOo/runner qadevOOo/tests reportbuilder/java scripting/java wizards/com xmerge/source
Noel Grandin
noel at peralex.com
Wed Oct 14 00:55:55 PDT 2015
bean/com/sun/star/comp/beans/CallWatchThread.java | 6
javaunohelper/com/sun/star/comp/helper/ComponentContext.java | 147 ++++------
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java | 2
qadevOOo/runner/complexlib/MethodThread.java | 10
qadevOOo/runner/util/ValueChanger.java | 4
qadevOOo/tests/java/ifc/beans/_XProperty.java | 3
qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java | 4
reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java | 7
scripting/java/com/sun/star/script/framework/browse/DialogFactory.java | 10
wizards/com/sun/star/wizards/common/Desktop.java | 18 -
xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/Format.java | 2
11 files changed, 94 insertions(+), 119 deletions(-)
New commits:
commit f6df41376d5cb7fb4a7e08961a3d1b03a9143911
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:53:01 2015 +0200
cid#1326123 Copy-paste error
Change-Id: Ic4dd8d1abfd8bfbeab0a3b8465fa3f7b5a7dafca
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index 4fa7d5b..5793877 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -748,7 +748,7 @@ public class ValueChanger {
newValue = BT4;
if (oldValue.equals(BT4))
newValue = BT5;
- if (oldValue.equals(BT6))
+ if (oldValue.equals(BT5))
newValue = BT6;
if (oldValue.equals(BT6))
newValue = BT7;
commit db91f24947ed12cb793cc32517fd8ca0e9476b6c
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:51:32 2015 +0200
cid#1326122 Copy-paste error
Change-Id: Ifea00b0e656918b22ece1fee56b33a35b6e81432
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index 97ec89c..4fa7d5b 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -354,7 +354,7 @@ public class ValueChanger {
if (oldValue.equals(bm2))
newValue = bm3;
if (oldValue.equals(bm3))
- newValue = bm3;
+ newValue = bm1;
} else if (oldValue instanceof com.sun.star.drawing.TextAdjust) {
com.sun.star.drawing.TextAdjust TA1 = com.sun.star.drawing.TextAdjust.BLOCK;
com.sun.star.drawing.TextAdjust TA2 = com.sun.star.drawing.TextAdjust.CENTER;
commit fa59d0c58709a3620dabdd19a7ea8b85c356d2cb
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:45:53 2015 +0200
cid#1326347 Check of thread-shared field evades lock acquisition
Change-Id: Iaeb21e3a5798c817315f619e0c1c57bd0c37f175
diff --git a/bean/com/sun/star/comp/beans/CallWatchThread.java b/bean/com/sun/star/comp/beans/CallWatchThread.java
index 2f99adc..f03278b 100644
--- a/bean/com/sun/star/comp/beans/CallWatchThread.java
+++ b/bean/com/sun/star/comp/beans/CallWatchThread.java
@@ -79,11 +79,11 @@ public class CallWatchThread extends Thread
{
dbgPrint( "CallWatchThread(" + this + ".run(" + aTag + ") ***** STARTED *****" );
long n = 0;
- while ( aWatchedThread != null )
+ synchronized(this)
{
- dbgPrint( "CallWatchThread(" + this + ").run(" + aTag + ") running #" + ++n );
- synchronized(this)
+ while ( aWatchedThread != null )
{
+ dbgPrint( "CallWatchThread(" + this + ").run(" + aTag + ") running #" + ++n );
bAlive = false;
try
{
commit 7e7014ba139dbcb192b21fc1a28178ef35e1fdc4
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:37:20 2015 +0200
use early returns to make method easier to read
Change-Id: Iabaedbd51d3832eff8e7470fd586132c38e1d039
diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java
index 9d327ec..67579f9 100644
--- a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java
+++ b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java
@@ -121,94 +121,93 @@ public class ComponentContext implements XComponentContext, XComponent
public Object getValueByName( String rName )
{
Object o = m_table.get( rName );
- if (o != null)
+ if (o == null)
{
- if (o instanceof ComponentContextEntry)
+ if (m_xDelegate != null)
{
- ComponentContextEntry entry = (ComponentContextEntry)o;
- if (entry.m_lateInit != null)
- {
- Object xInstance = null;
+ return m_xDelegate.getValueByName( rName );
+ }
+ else
+ {
+ return Any.VOID;
+ }
+ }
- try
- {
- String serviceName = (String)entry.m_lateInit;
- if (serviceName != null)
- {
- if (m_xSMgr != null)
- {
- xInstance = m_xSMgr.createInstanceWithContext( serviceName, this );
- }
- else
- {
- if (DEBUG)
- System.err.println( "### no service manager instance for late init of singleton instance \"" + rName + "\"!" );
- }
- }
- else
- {
- XSingleComponentFactory xCompFac =
- UnoRuntime.queryInterface(
- XSingleComponentFactory.class, entry.m_lateInit );
- if (xCompFac != null)
- {
- xInstance = xCompFac.createInstanceWithContext( this );
- }
- else
- {
- if (DEBUG)
- System.err.println( "### neither service name nor service factory given for late init of singleton instance \"" + rName + "\"!" );
- }
- }
- }
- catch (com.sun.star.uno.Exception exc)
- {
- if (DEBUG)
- System.err.println( "### exception occurred on late init of singleton instance \"" + rName + "\": " + exc.getMessage() );
- }
+ if (!(o instanceof ComponentContextEntry))
+ {
+ // direct value in map
+ return o;
+ }
- if (xInstance != null)
- {
- synchronized (entry)
- {
- if (entry.m_lateInit != null)
- {
- entry.m_value = xInstance;
- entry.m_lateInit = null;
- }
- else // inited in the meantime
- {
- // dispose fresh service instance
- XComponent xComp = UnoRuntime.queryInterface(
- XComponent.class, xInstance );
- if (xComp != null)
- {
- xComp.dispose();
- }
- }
- }
- }
- else
- {
- if (DEBUG)
- System.err.println( "### failed late init of singleton instance \"" + rName + "\"!" );
- }
+ ComponentContextEntry entry = (ComponentContextEntry)o;
+ if (entry.m_lateInit == null)
+ {
+ return entry.m_value;
+ }
+
+ Object xInstance = null;
+ try
+ {
+ String serviceName = (String)entry.m_lateInit;
+ if (serviceName != null)
+ {
+ if (m_xSMgr != null)
+ {
+ xInstance = m_xSMgr.createInstanceWithContext( serviceName, this );
+ }
+ else
+ {
+ if (DEBUG)
+ System.err.println( "### no service manager instance for late init of singleton instance \"" + rName + "\"!" );
}
- return entry.m_value;
}
- else // direct value in map
+ else
{
- return o;
+ XSingleComponentFactory xCompFac = UnoRuntime.queryInterface( XSingleComponentFactory.class, entry.m_lateInit );
+ if (xCompFac != null)
+ {
+ xInstance = xCompFac.createInstanceWithContext( this );
+ }
+ else
+ {
+ if (DEBUG)
+ System.err.println( "### neither service name nor service factory given for late init of singleton instance \"" + rName + "\"!" );
+ }
}
}
- else if (m_xDelegate != null)
+ catch (com.sun.star.uno.Exception exc)
+ {
+ if (DEBUG)
+ System.err.println( "### exception occurred on late init of singleton instance \"" + rName + "\": " + exc.getMessage() );
+ }
+
+ if (xInstance != null)
{
- return m_xDelegate.getValueByName( rName );
+ synchronized (entry)
+ {
+ if (entry.m_lateInit != null)
+ {
+ entry.m_value = xInstance;
+ entry.m_lateInit = null;
+ }
+ else // inited in the meantime
+ {
+ // dispose fresh service instance
+ XComponent xComp = UnoRuntime.queryInterface(
+ XComponent.class, xInstance );
+ if (xComp != null)
+ {
+ xComp.dispose();
+ }
+ }
+ }
}
else
{
- return Any.VOID;
+ if (DEBUG)
+ System.err.println( "### failed late init of singleton instance \"" + rName + "\"!" );
}
+ return entry.m_value;
}
public XMultiComponentFactory getServiceManager()
commit ec0c4ce0a02ed72459de1fcaf3f2f7713bf67b5d
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:33:30 2015 +0200
cid#1326345 Check of thread-shared field evades lock acquisition
Change-Id: I11fc66358c13c6bb1b6f109980384131b38ef18b
diff --git a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java
index 303b600..08cfba4 100644
--- a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java
+++ b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java
@@ -46,15 +46,12 @@ public class DialogFactory {
// singleton
private DialogFactory(XComponentContext xComponentContext) {
this.xComponentContext = xComponentContext;
- factory = this;
}
public static void createDialogFactory(XComponentContext xComponentContext) {
- if (factory == null) {
- synchronized (DialogFactory.class) {
- if (factory == null) {
- factory = new DialogFactory(xComponentContext);
- }
+ synchronized (DialogFactory.class) {
+ if (factory == null) {
+ factory = new DialogFactory(xComponentContext);
}
}
}
@@ -63,7 +60,6 @@ public class DialogFactory {
if (factory == null) {
throw new java.lang.Exception("DialogFactory not initialized");
}
-
return factory;
}
commit 1fd4f35f70fbb740e05200b9591d1e6d0dd5637e
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:28:25 2015 +0200
cid#1326124 Call to an inherently dangerous function
Change-Id: Ia2e2d9222633052266028703a1162cfea4ccac9f
diff --git a/qadevOOo/runner/complexlib/MethodThread.java b/qadevOOo/runner/complexlib/MethodThread.java
index 0d86c73..28ea770 100644
--- a/qadevOOo/runner/complexlib/MethodThread.java
+++ b/qadevOOo/runner/complexlib/MethodThread.java
@@ -102,16 +102,6 @@ public class MethodThread extends Thread
/**
* Stop the running method.
*/
- @Deprecated
- @Override
- public void destroy()
- {
- stop();
- }
-
- /**
- * Stop the running method.
- */
public void stopRunning()
{
try
commit afe95a1d7a3ce6842bb230eeaff70dc94bd24934
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:15:50 2015 +0200
cid#1326608,cid#1326609 CN: Bad implementation of cloneable idiom
Change-Id: Iac74be96b47720ab105f862e7d1a69f909214294
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java
index a590a69..35f5f79 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/space/BasicPoint.java
@@ -20,7 +20,7 @@
package net.adaptivebox.space;
-public class BasicPoint implements Cloneable, ILocationEngine {
+public class BasicPoint implements ILocationEngine {
//store the location information in the search space (S)
private final double[] location;
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 68a62b6..7015847 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
@@ -23,7 +23,7 @@ import java.awt.Color;
/**
* This class specifies the format for a given spreadsheet cell.
*/
-public class Format implements Cloneable {
+public class Format {
/** Horizontal Alignment Constants. */
final public static int RIGHT_ALIGN = 0x01;
commit 47550b1f042c3e0d4340af44fa4f4ae3befb772b
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:11:58 2015 +0200
cid#1326607 Bx: Questionable Boxing of primitive value
Change-Id: Ib1274f55d5e26612dde2753a16ae1ad28007f758
diff --git a/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java b/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java
index 2fae7a2..3a6b274 100644
--- a/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java
+++ b/qadevOOo/tests/java/mod/_toolkit/UnoScrollBarControl.java
@@ -66,8 +66,8 @@ public class UnoScrollBarControl extends TestCase {
Dimension dim = new Dimension(800, 600);
Rectangle newPosSize = xWin.getPosSize();
- newPosSize.Width = new Double(dim.getWidth()).intValue();
- newPosSize.Height = new Double(dim.getHeight()).intValue();
+ newPosSize.Width = (int) dim.getWidth();
+ newPosSize.Height = (int) dim.getHeight();
newPosSize.X = 0;
newPosSize.Y = 0;
commit abd980d4ec16fed637d3fce580e7ae728f69d564
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:09:22 2015 +0200
cid#1326605, cid#1326604 BC: Bad casts of object references
Change-Id: I85fa5fd4671d749850af854a7d4ba934416d892b
diff --git a/qadevOOo/tests/java/ifc/beans/_XProperty.java b/qadevOOo/tests/java/ifc/beans/_XProperty.java
index c81c53f..cb38867 100644
--- a/qadevOOo/tests/java/ifc/beans/_XProperty.java
+++ b/qadevOOo/tests/java/ifc/beans/_XProperty.java
@@ -28,8 +28,7 @@ public class _XProperty extends MultiMethodTest {
public void _getAsProperty() {
Property prop = oObj.getAsProperty();
- boolean res = (prop.Name instanceof String);
- res &= (prop.Type != null);
+ boolean res = (prop.Type != null);
tRes.tested("getAsProperty()", res);
}
}
\ No newline at end of file
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java b/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java
index 9e0e429..6c59855 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/PentahoReportJob.java
@@ -220,11 +220,8 @@ public class PentahoReportJob implements ReportJob
val = reportFunction.getChildValues()[0];
}
}
- if (val instanceof ContextLookup)
- {
- final ContextLookup context = (ContextLookup) val;
- name = context.getName();
- }
+ final ContextLookup context = (ContextLookup) val;
+ name = context.getName();
break;
}
}
commit 97da76a17dd6addfd3213f196f4454e1d5cee417
Author: Noel Grandin <noel at peralex.com>
Date: Wed Oct 14 09:03:36 2015 +0200
cid#1326131 'Constant' variable guards dead code
Change-Id: I832b2fc243404a6ae9796ad994e901880d3b9260
diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java
index 14c3a7a..62b3ea6 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.java
+++ b/wizards/com/sun/star/wizards/common/Desktop.java
@@ -234,24 +234,19 @@ public class Desktop
}
/**
- * Checks if the passed Element Name already exists in the list If yes it appends a
- * suffix to make it unique
+ * Checks if the passed Element Name already exists in the list. If yes it appends a
+ * suffix to make it unique.
* @return a unique Name not being in the passed list.
*/
public static String getUniqueName(String[] _slist, String _sElementName, String _sSuffixSeparator)
{
- int a = 2;
- String scompname = _sElementName;
- boolean bElementexists = true;
- if (_slist == null)
+ if (_slist == null || _slist.length == 0)
{
return _sElementName;
}
- if (_slist.length == 0)
- {
- return _sElementName;
- }
- while (bElementexists)
+ String scompname = _sElementName;
+ int a = 2;
+ while (true)
{
for (int i = 0; i < _slist.length; i++)
{
@@ -262,7 +257,6 @@ public class Desktop
}
scompname = _sElementName + _sSuffixSeparator + a++;
}
- return PropertyNames.EMPTY_STRING;
}
More information about the Libreoffice-commits
mailing list