summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-10-15 16:25:10 +0200
committerNoel Grandin <noel@peralex.com>2014-10-16 08:15:52 +0200
commitfa22664be218c211c41342c6296616c316b2c3b1 (patch)
tree2118e12dffce57f5027ef4aed227d27acf8c6ed6
parent94ae3e827b71da5be77ff04522ff156770801b25 (diff)
java: always use braces for while loops
Change-Id: Iff896b0cace8b8305528b3b0140004ea856169ce
-rw-r--r--javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java3
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java6
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java9
-rw-r--r--jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java12
-rw-r--r--nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java3
-rw-r--r--qadevOOo/runner/convwatch/FileHelper.java3
-rw-r--r--qadevOOo/runner/helper/URLHelper.java3
-rw-r--r--qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange.java4
-rw-r--r--qadevOOo/tests/java/ifc/style/_CharacterProperties.java3
-rw-r--r--qadevOOo/tests/java/mod/_defreg/NestedRegistry.java3
-rw-r--r--qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java3
-rw-r--r--qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java3
-rw-r--r--qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java3
-rw-r--r--scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java3
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModel.java3
-rw-r--r--toolkit/test/accessibility/AccessibleTextHandler.java6
-rw-r--r--toolkit/test/accessibility/AccessibleTreeCellRenderer.java3
-rw-r--r--toolkit/test/accessibility/Canvas.java4
-rw-r--r--toolkit/test/accessibility/InformationWriter.java3
-rw-r--r--toolkit/test/accessibility/MessageArea.java3
-rw-r--r--toolkit/test/accessibility/TextUpdateListener.java6
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java3
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java3
23 files changed, 62 insertions, 33 deletions
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
index 9ebcb0684894..f8e738d0d8f8 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
@@ -87,8 +87,9 @@ public final class XOutputStreamToByteArrayAdapter
{
if ( externalBuffer )
throw new BufferSizeExceededException("out of buffer space, cannot grow external buffer");
- while ( values.length > size-position )
+ while ( values.length > size-position ) {
size *= 2;
+ }
byte[] newBuffer = new byte[size];
System.arraycopy(buffer, 0, newBuffer, 0, position);
buffer = newBuffer;
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java
index 2437f364bbb6..10a39694d9dc 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer.java
@@ -138,14 +138,16 @@ public class MultiTypeInterfaceContainer
{
it= map.values().iterator();
}
- while (it.hasNext() )
+ while (it.hasNext() ) {
it.next().disposeAndClear(evt);
+ }
}
synchronized public void clear()
{
Iterator<InterfaceContainer> it= map.values().iterator();
- while (it.hasNext())
+ while (it.hasNext()) {
it.next().clear();
+ }
}
}
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
index 7459fae4085a..d9488114d420 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
@@ -571,11 +571,13 @@ public class InterfaceContainer_Test
cont.addAll(list1);
// go to the end of our list and list1
ListIterator it= cont.listIterator();
- while (it.hasNext())
+ while (it.hasNext()) {
it.next();
+ }
ListIterator it_list1= list1.listIterator();
- while (it_list1.hasNext())
+ while (it_list1.hasNext()) {
it_list1.next();
+ }
while (it.hasPrevious())
{
@@ -612,8 +614,9 @@ public class InterfaceContainer_Test
ListIterator it;
cont.addAll(list1);
it= cont.listIterator();
- while (it.hasNext())
+ while (it.hasNext()) {
it.next();
+ }
assertEquals(it.previousIndex(), 2);
it.previous();
diff --git a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
index 94dfb884392f..aff5def10cb8 100644
--- a/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
+++ b/jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
@@ -73,8 +73,9 @@ public class ThreadPool_Test {
synchronized(workAt) {
putJob(workAt, false, threadId, "notifyme");
- while(!workAt._notified)
+ while(!workAt._notified) {
workAt.wait();
+ }
}
assertEquals(TestWorkAt.MESSAGES, workAt._counter);
@@ -94,8 +95,9 @@ public class ThreadPool_Test {
synchronized(workAt) {
putJob(workAt, true, threadId, "notifyme");
- while(!workAt._notified)
+ while(!workAt._notified) {
workAt.wait();
+ }
}
assertEquals(TestWorkAt.MESSAGES, workAt._counter);
@@ -161,8 +163,9 @@ public class ThreadPool_Test {
synchronized(workAt) {
putJob(workAt, true, threadId, "notifyme");
- while(!workAt._notified)
+ while(!workAt._notified) {
workAt.wait();
+ }
}
assertTrue(workAt.passedAsyncTest());
@@ -322,8 +325,9 @@ public class ThreadPool_Test {
synchronized(workAt) {
putJob(workAt, false, threadId, "notifyme");
- while(!workAt._notified)
+ while(!workAt._notified) {
workAt.wait();
+ }
}
assertEquals(TestWorkAt.MESSAGES, workAt._async_counter);
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
index fc77d0f9a42e..cb33daae9f19 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalString.java
@@ -39,8 +39,9 @@ public class GlobalString {
public static String[] tokenize(String input , String tokenKey) {
ArrayList<String> v = new ArrayList<String>();
StringTokenizer t = new StringTokenizer(input, tokenKey);
- while (t.hasMoreTokens())
+ while (t.hasMoreTokens()) {
v.add(t.nextToken());
+ }
return v.toArray(new String[v.size()]);
}
diff --git a/qadevOOo/runner/convwatch/FileHelper.java b/qadevOOo/runner/convwatch/FileHelper.java
index dab33c32e1f5..515fe8ea7365 100644
--- a/qadevOOo/runner/convwatch/FileHelper.java
+++ b/qadevOOo/runner/convwatch/FileHelper.java
@@ -277,8 +277,9 @@ public class FileHelper
out = new java.io.FileWriter(outputFile);
int c;
- while ((c = in.read()) != -1)
+ while ((c = in.read()) != -1) {
out.write(c);
+ }
}
finally
diff --git a/qadevOOo/runner/helper/URLHelper.java b/qadevOOo/runner/helper/URLHelper.java
index 4ca5605761d8..fa54496a193a 100644
--- a/qadevOOo/runner/helper/URLHelper.java
+++ b/qadevOOo/runner/helper/URLHelper.java
@@ -139,8 +139,9 @@ public class URLHelper
if (lSubFiles != null)
{
Iterator<File> aSnapshot = lSubFiles.iterator();
- while (aSnapshot.hasNext())
+ while (aSnapshot.hasNext()) {
lFilteredFiles.add(aSnapshot.next());
+ }
}
}
}
diff --git a/qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange.java b/qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange.java
index 7fa5a7feccbd..87f7aee16cdc 100644
--- a/qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange.java
+++ b/qadevOOo/tests/java/ifc/sheet/_XArrayFormulaRange.java
@@ -152,8 +152,8 @@ public class _XArrayFormulaRange extends MultiMethodTest {
s1 = s1.trim() ;
s2 = s2.trim() ;
while (p1 < s1.length() && p2 < s2.length()) {
- while (s1.charAt(p1) == ' ') p1 ++ ;
- while (s2.charAt(p2) == ' ') p2 ++ ;
+ while (s1.charAt(p1) == ' ') { p1 ++; }
+ while (s2.charAt(p2) == ' ') { p2 ++; }
if (s1.charAt(p1) != s2.charAt(p2)) return false ;
p1 ++ ;
p2 ++ ;
diff --git a/qadevOOo/tests/java/ifc/style/_CharacterProperties.java b/qadevOOo/tests/java/ifc/style/_CharacterProperties.java
index 27270b74c631..6e968337a353 100644
--- a/qadevOOo/tests/java/ifc/style/_CharacterProperties.java
+++ b/qadevOOo/tests/java/ifc/style/_CharacterProperties.java
@@ -499,8 +499,9 @@ public class _CharacterProperties extends MultiPropertyTest {
int count = members.size();
String[] res = new String[count];
int i=0;
- while(oEnum.hasNext())
+ while(oEnum.hasNext()) {
res[i++] = oEnum.next();
+ }
return res;
}
diff --git a/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java b/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java
index 2aa02482f779..a6cc37bdd93b 100644
--- a/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java
+++ b/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java
@@ -97,8 +97,9 @@ public class NestedRegistry extends TestCase {
byte[] buf = new byte[1024] ;
int bytesRead = 0 ;
- while ((bytesRead = fIn.read(buf)) > 0)
+ while ((bytesRead = fIn.read(buf)) > 0) {
fOut.write(buf, 0, bytesRead) ;
+ }
fIn.close() ;
fOut.close() ;
diff --git a/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java b/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java
index 10e72c09cc73..99caad5b8a52 100644
--- a/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java
+++ b/qadevOOo/tests/java/mod/_nestedreg/uno/NestedRegistry.java
@@ -94,8 +94,9 @@ public class NestedRegistry extends TestCase {
byte[] buf = new byte[1024] ;
int bytesRead = 0 ;
- while ((bytesRead = fIn.read(buf)) > 0)
+ while ((bytesRead = fIn.read(buf)) > 0) {
fOut.write(buf, 0, bytesRead) ;
+ }
fIn.close() ;
fOut.close() ;
diff --git a/qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java b/qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java
index 8fd5b48bda1c..4e6d8bbf27ae 100644
--- a/qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java
+++ b/qadevOOo/tests/java/mod/_simplereg/uno/SimpleRegistry.java
@@ -76,8 +76,9 @@ public class SimpleRegistry extends TestCase {
byte[] buf = new byte[1024] ;
int bytesRead = 0 ;
- while ((bytesRead = fIn.read(buf)) > 0)
+ while ((bytesRead = fIn.read(buf)) > 0) {
fOut.write(buf, 0, bytesRead) ;
+ }
fIn.close() ;
fOut.close() ;
diff --git a/qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java b/qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java
index edafcccd5f9c..8f167de4fd3d 100644
--- a/qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java
+++ b/qadevOOo/tests/java/mod/_simreg/SimpleRegistry.java
@@ -79,8 +79,9 @@ public class SimpleRegistry extends TestCase {
byte[] buf = new byte[1024] ;
int bytesRead = 0 ;
- while ((bytesRead = fIn.read(buf)) > 0)
+ while ((bytesRead = fIn.read(buf)) > 0) {
fOut.write(buf, 0, bytesRead) ;
+ }
fIn.close() ;
fOut.close() ;
diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java
index f8b5d0ddb960..93e36a8be1d0 100644
--- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java
+++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java
@@ -233,8 +233,9 @@ public class ParcelDescriptor {
public void setScriptEntries(Iterator<ScriptEntry> scripts) {
clearEntries();
- while (scripts.hasNext())
+ while (scripts.hasNext()) {
addScriptEntry(scripts.next());
+ }
}
private String getLanguageProperty(String name) {
diff --git a/toolkit/test/accessibility/AccessibilityTreeModel.java b/toolkit/test/accessibility/AccessibilityTreeModel.java
index 623507a70e5a..55b56fef0e0f 100644
--- a/toolkit/test/accessibility/AccessibilityTreeModel.java
+++ b/toolkit/test/accessibility/AccessibilityTreeModel.java
@@ -160,9 +160,10 @@ public class AccessibilityTreeModel
else
{
// depth-first removal of children
- while (aNode.getChildCount() > 0)
+ while (aNode.getChildCount() > 0) {
if ( ! removeChild (aNode.getChildNoCreate (0)))
break;
+ }
// Remove node from its parent.
AccessibleTreeNode aParent = aNode.getParent();
diff --git a/toolkit/test/accessibility/AccessibleTextHandler.java b/toolkit/test/accessibility/AccessibleTextHandler.java
index d29eefdab6ae..dfecd974803c 100644
--- a/toolkit/test/accessibility/AccessibleTextHandler.java
+++ b/toolkit/test/accessibility/AccessibleTextHandler.java
@@ -650,13 +650,15 @@ class TextEditDialog extends TextActionDialog
// count equal characters from front and end
int nFront = 0;
while( (nFront < nMinLength) &&
- (sNew.charAt(nFront) == sOld.charAt(nFront)) )
+ (sNew.charAt(nFront) == sOld.charAt(nFront)) ) {
nFront++;
+ }
int nBack = 0;
while( (nBack < nMinLength) &&
( sNew.charAt(sNew.length()-nBack-1) ==
- sOld.charAt(sOld.length()-nBack-1) ) )
+ sOld.charAt(sOld.length()-nBack-1) ) ) {
nBack++;
+ }
if( nFront + nBack > nMinLength )
nBack = nMinLength - nFront;
diff --git a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
index c46058c551da..cd032b9aa17e 100644
--- a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
+++ b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
@@ -79,8 +79,9 @@ public class AccessibleTreeCellRenderer
*/
public void addChangedLine (int nRow)
{
- while (maChangedLines.size() <= nRow)
+ while (maChangedLines.size() <= nRow) {
maChangedLines.add(null);
+ }
nRow -= 1; // row index is one to large for some reason.
maChangedLines.set (nRow, true);
}
diff --git a/toolkit/test/accessibility/Canvas.java b/toolkit/test/accessibility/Canvas.java
index c600a9e7f91d..aca2e1f209d5 100644
--- a/toolkit/test/accessibility/Canvas.java
+++ b/toolkit/test/accessibility/Canvas.java
@@ -144,9 +144,9 @@ class Canvas
public void clear ()
{
- while (maNodes.size() > 0)
+ while (maNodes.size() > 0) {
removeNode (maNodes.get(0));
-
+ }
maNodes.clear();
maObjects.clear();
maObjectList.clear();
diff --git a/toolkit/test/accessibility/InformationWriter.java b/toolkit/test/accessibility/InformationWriter.java
index 8b1a373760ef..27950c24f579 100644
--- a/toolkit/test/accessibility/InformationWriter.java
+++ b/toolkit/test/accessibility/InformationWriter.java
@@ -222,8 +222,9 @@ public class InformationWriter
{
// Create indentation string.
String sIndent = "";
- while (depth-- > 0)
+ while (depth-- > 0) {
sIndent += " ";
+ }
// Get XAccessibleContext object if given object does not
// already support this interface.
diff --git a/toolkit/test/accessibility/MessageArea.java b/toolkit/test/accessibility/MessageArea.java
index b3108d9c0e53..5b3c1946db14 100644
--- a/toolkit/test/accessibility/MessageArea.java
+++ b/toolkit/test/accessibility/MessageArea.java
@@ -76,8 +76,9 @@ public class MessageArea
*/
public static synchronized void print (int nIndentation, String aMessage)
{
- while (nIndentation-- > 0)
+ while (nIndentation-- > 0) {
aMessage = " " + aMessage;
+ }
Instance().printMessage(aMessage);
}
diff --git a/toolkit/test/accessibility/TextUpdateListener.java b/toolkit/test/accessibility/TextUpdateListener.java
index 7ab8deb5e73a..61b499655879 100644
--- a/toolkit/test/accessibility/TextUpdateListener.java
+++ b/toolkit/test/accessibility/TextUpdateListener.java
@@ -89,13 +89,15 @@ class TextUpdateListener implements TreeModelListener
// count equal characters from front and end
int nFront = 0;
while( (nFront < nMinLength) &&
- (sNew.charAt(nFront) == sOld.charAt(nFront)) )
+ (sNew.charAt(nFront) == sOld.charAt(nFront)) ) {
nFront++;
+ }
int nBack = 0;
while( (nBack < nMinLength) &&
( sNew.charAt(sNew.length()-nBack-1) ==
- sOld.charAt(sOld.length()-nBack-1) ) )
+ sOld.charAt(sOld.length()-nBack-1) ) ) {
nBack++;
+ }
if( nFront + nBack > nMinLength )
nBack = nMinLength - nFront;
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
index 706b58d18cc1..6d0135aaf468 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/OfficeDocument.java
@@ -1062,8 +1062,9 @@ public abstract class OfficeDocument
char[] charArray = new char[4096];
StringBuffer sBuf = new StringBuffer();
int n;
- while ((n=br.read(charArray, 0, charArray.length)) > 0)
+ while ((n=br.read(charArray, 0, charArray.length)) > 0) {
sBuf.append(charArray, 0, n);
+ }
// ensure there is no trailing garbage after the end of the stream.
int sIndex = sBuf.lastIndexOf("</office:document>");
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java
index d72c702fccc5..305100772739 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/OfficeUtil.java
@@ -95,8 +95,9 @@ public class OfficeUtil implements OfficeConstants {
// Compute length of space sequence.
int nrSpaces = 2;
while ((nrSpaces < text.length())
- && text.substring(nrSpaces, nrSpaces + 1).equals(" "))
+ && text.substring(nrSpaces, nrSpaces + 1).equals(" ")) {
nrSpaces++;
+ }
Element spaceNode = parentDoc.createElement(TAG_SPACE);
spaceNode.setAttribute(ATTRIBUTE_SPACE_COUNT,