summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2009-01-12 07:33:56 (EST)
committerCarsten Drossel2009-01-12 07:33:56 (EST)
commite9a8436e64ad399b9691f7e823d6e938ac4dc6d0 (patch)
tree326e54b3d4e11f749da195f8da013264ac31bcf6
parent4bb241b0f77894ca3e167cfafbe0b1419d2b5579 (diff)
downloadorg.eclipse.riena-e9a8436e64ad399b9691f7e823d6e938ac4dc6d0.zip
org.eclipse.riena-e9a8436e64ad399b9691f7e823d6e938ac4dc6d0.tar.gz
org.eclipse.riena-e9a8436e64ad399b9691f7e823d6e938ac4dc6d0.tar.bz2
fixed warnings
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ListenerListTest.java12
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java33
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetTest.java110
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetWithControlTest.java92
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MessageBoxRidgetTest.java2
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeRidgetLabelProviderTest.java16
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/lnf/renderer/SubModuleTreeItemMarkerRendererTest.java20
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/security/authentication/module/TestLocalLoginModule.java10
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/security/services/itest/authentication/module/TestRemoteLoginModule.java8
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/tests/nanohttp/NanoHTTPD.java104
10 files changed, 224 insertions, 183 deletions
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ListenerListTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ListenerListTest.java
index 0040a8b..7e9deaf 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ListenerListTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ListenerListTest.java
@@ -83,7 +83,7 @@ public class ListenerListTest extends RienaTestCase {
* adding/removing several anonymous classes from the same listener list.
*/
public void testFixArrayStoreExceptionWithAnonymousClasses() {
- final ListenerList<IWindowRidgetListener> listenerList = new ListenerList<IWindowRidgetListener>(
+ final ListenerList<IWindowRidgetListener> windowListenerList = new ListenerList<IWindowRidgetListener>(
IWindowRidgetListener.class);
IWindowRidgetListener listener1 = new IWindowRidgetListener() {
@@ -93,7 +93,7 @@ public class ListenerListTest extends RienaTestCase {
public void closed() {
}
};
- listenerList.add(listener1);
+ windowListenerList.add(listener1);
IWindowRidgetListener listener2 = new IWindowRidgetListener() {
public void activated() {
@@ -102,14 +102,14 @@ public class ListenerListTest extends RienaTestCase {
public void closed() {
}
};
- listenerList.add(listener2);
+ windowListenerList.add(listener2);
- listenerList.remove(listener1);
- listenerList.remove(listener2);
+ windowListenerList.remove(listener1);
+ windowListenerList.remove(listener2);
}
private static class TestListener implements EventListener {
- public static int pieps;
+ private static int pieps;
public void piep() {
pieps++;
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java
index 78ceaa4..9741351 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java
@@ -90,9 +90,9 @@ public class ReflectionUtilsTest extends TestCase {
Object object = new Thrower();
try {
ReflectionUtils.invokeHidden(object, "setUrl", MalformedURLException.class, "filez://murks.at");
- fail();
- } catch (MalformedURLException e) {
- // ok
+ fail("MalformedURLException expected");
+ } catch (MalformedURLException expected) {
+ // ok, expected
}
}
@@ -173,8 +173,8 @@ public class ReflectionUtilsTest extends TestCase {
public void testSetGetHiddenDeepField() {
TestTestClass ttc = new TestTestClass("Hallo");
- ReflectionUtils.setHidden(ttc, "_string", "hurz");
- String hurz = (String) ReflectionUtils.getHidden(ttc, "_string");
+ ReflectionUtils.setHidden(ttc, "privateString", "hurz");
+ String hurz = (String) ReflectionUtils.getHidden(ttc, "privateString");
assertEquals("hurz", hurz);
}
@@ -193,6 +193,7 @@ public class ReflectionUtilsTest extends TestCase {
/**
* Nomen est Omen!
*/
+ @SuppressWarnings("unchecked")
public void testNewLazyInstanceByClass() {
HaeshMaep.created = false;
Map<String, String> map = ReflectionUtils.newLazyInstance(Map.class, HaeshMaep.class);
@@ -204,6 +205,7 @@ public class ReflectionUtilsTest extends TestCase {
/**
* Nomen est Omen!
*/
+ @SuppressWarnings("unchecked")
public void testNewLazyInstanceByString() {
HaeshMaep.created = false;
Map<String, String> map = ReflectionUtils.newLazyInstance(Map.class, HaeshMaep.class.getName());
@@ -213,35 +215,43 @@ public class ReflectionUtilsTest extends TestCase {
}
private static class TestClass {
+
+ @SuppressWarnings("unused")
+ private String privateString;
private static String string;
- private String _string;
private static Integer integerObject;
private static int intPrimitive;
private TestClass(String str) {
- _string = str;
+ privateString = str;
}
+ @SuppressWarnings("unused")
private static void setString(String string) {
TestClass.string = string;
}
+ @SuppressWarnings("unused")
private static String getString() {
return string;
}
+ @SuppressWarnings("unused")
private static void setIntegerObject(Integer integerObject) {
TestClass.integerObject = integerObject;
}
+ @SuppressWarnings("unused")
private static Integer getIntegerObject() {
return integerObject;
}
+ @SuppressWarnings("unused")
private static void setIntPrimitive(int intPrimitive) {
TestClass.intPrimitive = intPrimitive;
}
+ @SuppressWarnings("unused")
private static int getIntPrimitive() {
return intPrimitive;
}
@@ -255,21 +265,28 @@ public class ReflectionUtilsTest extends TestCase {
super(str);
}
+ @SuppressWarnings("unused")
private static void setString(String string) {
TestTestClass.stringString = string;
}
+ @SuppressWarnings("unused")
private static String getString() {
return stringString;
}
}
- private static class Thrower {
+ private final static class Thrower {
+
+ private Thrower() {
+ }
+ @SuppressWarnings("unused")
private void setUrl(String url) throws MalformedURLException {
new URL(url);
}
+ @SuppressWarnings("unused")
private static String throwIOException() throws IOException {
throw new IOException("Yippie!");
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetTest.java
index fa99f56..55a5a8a 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetTest.java
@@ -277,29 +277,29 @@ public abstract class AbstractSWTRidgetTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
IMarker marker = new MandatoryMarker();
- HashSet<IMarker> before = new HashSet<IMarker>(ridget.getMarkers());
+ HashSet<IMarker> before = new HashSet<IMarker>(markableRidget.getMarkers());
HashSet<IMarker> after = new HashSet<IMarker>(before);
after.add(marker);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
assertEquals(before.size() + 1, after.size());
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_MARKER, before, after);
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_MARKER, after, before);
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
}
@@ -307,26 +307,26 @@ public abstract class AbstractSWTRidgetTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
- ridget.removePropertyChangeListener(propertyChangeListenerMock);
- ridget.addPropertyChangeListener(IMarkableRidget.PROPERTY_ENABLED, propertyChangeListenerMock);
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
+ markableRidget.removePropertyChangeListener(propertyChangeListenerMock);
+ markableRidget.addPropertyChangeListener(IMarkableRidget.PROPERTY_ENABLED, propertyChangeListenerMock);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
expectNoPropertyChangeEvent();
- ridget.setEnabled(true);
+ markableRidget.setEnabled(true);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_ENABLED, Boolean.TRUE, Boolean.FALSE);
- ridget.setEnabled(false);
+ markableRidget.setEnabled(false);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.setEnabled(false);
+ markableRidget.setEnabled(false);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_ENABLED, Boolean.FALSE, Boolean.TRUE);
- ridget.setEnabled(true);
+ markableRidget.setEnabled(true);
verifyPropertyChangeEvents();
}
@@ -334,27 +334,27 @@ public abstract class AbstractSWTRidgetTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
IMarker marker = new DisabledMarker();
- ridget.removePropertyChangeListener(propertyChangeListenerMock);
- ridget.addPropertyChangeListener(IMarkableRidget.PROPERTY_ENABLED, propertyChangeListenerMock);
+ markableRidget.removePropertyChangeListener(propertyChangeListenerMock);
+ markableRidget.addPropertyChangeListener(IMarkableRidget.PROPERTY_ENABLED, propertyChangeListenerMock);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_ENABLED, Boolean.TRUE, Boolean.FALSE);
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_ENABLED, Boolean.FALSE, Boolean.TRUE);
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
}
@@ -365,44 +365,44 @@ public abstract class AbstractSWTRidgetTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
- ridget.setUIControl(null);
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
+ markableRidget.setUIControl(null);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
- ridget.setEnabled(false);
+ markableRidget.setEnabled(false);
- assertFalse(ridget.isEnabled());
+ assertFalse(markableRidget.isEnabled());
- ridget.setEnabled(true);
+ markableRidget.setEnabled(true);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
}
public void testFiresOutputPropertyUsingSetter() {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
- ridget.removePropertyChangeListener(propertyChangeListenerMock);
- ridget.addPropertyChangeListener(IMarkableRidget.PROPERTY_OUTPUT_ONLY, propertyChangeListenerMock);
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
+ markableRidget.removePropertyChangeListener(propertyChangeListenerMock);
+ markableRidget.addPropertyChangeListener(IMarkableRidget.PROPERTY_OUTPUT_ONLY, propertyChangeListenerMock);
- assertFalse(ridget.isOutputOnly());
+ assertFalse(markableRidget.isOutputOnly());
expectNoPropertyChangeEvent();
- ridget.setOutputOnly(false);
+ markableRidget.setOutputOnly(false);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_OUTPUT_ONLY, Boolean.FALSE, Boolean.TRUE);
- ridget.setOutputOnly(true);
+ markableRidget.setOutputOnly(true);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.setOutputOnly(true);
+ markableRidget.setOutputOnly(true);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_OUTPUT_ONLY, Boolean.TRUE, Boolean.FALSE);
- ridget.setOutputOnly(false);
+ markableRidget.setOutputOnly(false);
verifyPropertyChangeEvents();
}
@@ -410,27 +410,27 @@ public abstract class AbstractSWTRidgetTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
IMarker marker = new OutputMarker();
- ridget.removePropertyChangeListener(propertyChangeListenerMock);
- ridget.addPropertyChangeListener(IMarkableRidget.PROPERTY_OUTPUT_ONLY, propertyChangeListenerMock);
+ markableRidget.removePropertyChangeListener(propertyChangeListenerMock);
+ markableRidget.addPropertyChangeListener(IMarkableRidget.PROPERTY_OUTPUT_ONLY, propertyChangeListenerMock);
- assertFalse(ridget.isOutputOnly());
+ assertFalse(markableRidget.isOutputOnly());
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_OUTPUT_ONLY, Boolean.FALSE, Boolean.TRUE);
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_OUTPUT_ONLY, Boolean.TRUE, Boolean.FALSE);
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
}
@@ -439,25 +439,25 @@ public abstract class AbstractSWTRidgetTest extends TestCase {
* ridget.setVisible().
*/
public void testBug257484() {
- Widget widget = getWidget();
- if (!(widget instanceof Control)) {
+ Widget theWidget = getWidget();
+ if (!(theWidget instanceof Control)) {
// skip if not a control - only controls can be hidden / visible
return;
}
- IRidget ridget = getRidget();
- Control control = (Control) widget;
+ IRidget theRidget = getRidget();
+ Control control = (Control) theWidget;
- assertTrue(ridget.isVisible());
+ assertTrue(theRidget.isVisible());
assertTrue(control.isVisible());
- ridget.setVisible(false);
+ theRidget.setVisible(false);
- assertFalse(ridget.isVisible());
+ assertFalse(theRidget.isVisible());
assertFalse(control.isVisible());
- ridget.setVisible(true);
+ theRidget.setVisible(true);
- assertTrue(ridget.isVisible());
+ assertTrue(theRidget.isVisible());
assertTrue(control.isVisible());
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetWithControlTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetWithControlTest.java
index 8d3f7e6..f6fc3b9 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetWithControlTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/AbstractSWTRidgetWithControlTest.java
@@ -280,29 +280,29 @@ public abstract class AbstractSWTRidgetWithControlTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
IMarker marker = new MandatoryMarker();
- HashSet<IMarker> before = new HashSet<IMarker>(ridget.getMarkers());
+ HashSet<IMarker> before = new HashSet<IMarker>(markableRidget.getMarkers());
HashSet<IMarker> after = new HashSet<IMarker>(before);
after.add(marker);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
assertEquals(before.size() + 1, after.size());
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_MARKER, before, after);
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_MARKER, after, before);
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
}
@@ -310,26 +310,26 @@ public abstract class AbstractSWTRidgetWithControlTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
- ridget.removePropertyChangeListener(propertyChangeListenerMock);
- ridget.addPropertyChangeListener(IMarkableRidget.PROPERTY_ENABLED, propertyChangeListenerMock);
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
+ markableRidget.removePropertyChangeListener(propertyChangeListenerMock);
+ markableRidget.addPropertyChangeListener(IMarkableRidget.PROPERTY_ENABLED, propertyChangeListenerMock);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
expectNoPropertyChangeEvent();
- ridget.setEnabled(true);
+ markableRidget.setEnabled(true);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_ENABLED, Boolean.TRUE, Boolean.FALSE);
- ridget.setEnabled(false);
+ markableRidget.setEnabled(false);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.setEnabled(false);
+ markableRidget.setEnabled(false);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_ENABLED, Boolean.FALSE, Boolean.TRUE);
- ridget.setEnabled(true);
+ markableRidget.setEnabled(true);
verifyPropertyChangeEvents();
}
@@ -337,27 +337,27 @@ public abstract class AbstractSWTRidgetWithControlTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
IMarker marker = new DisabledMarker();
- ridget.removePropertyChangeListener(propertyChangeListenerMock);
- ridget.addPropertyChangeListener(IMarkableRidget.PROPERTY_ENABLED, propertyChangeListenerMock);
+ markableRidget.removePropertyChangeListener(propertyChangeListenerMock);
+ markableRidget.addPropertyChangeListener(IMarkableRidget.PROPERTY_ENABLED, propertyChangeListenerMock);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_ENABLED, Boolean.TRUE, Boolean.FALSE);
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_ENABLED, Boolean.FALSE, Boolean.TRUE);
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
}
@@ -368,44 +368,44 @@ public abstract class AbstractSWTRidgetWithControlTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
- ridget.setUIControl(null);
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
+ markableRidget.setUIControl(null);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
- ridget.setEnabled(false);
+ markableRidget.setEnabled(false);
- assertFalse(ridget.isEnabled());
+ assertFalse(markableRidget.isEnabled());
- ridget.setEnabled(true);
+ markableRidget.setEnabled(true);
- assertTrue(ridget.isEnabled());
+ assertTrue(markableRidget.isEnabled());
}
public void testFiresOutputPropertyUsingSetter() {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
- ridget.removePropertyChangeListener(propertyChangeListenerMock);
- ridget.addPropertyChangeListener(IMarkableRidget.PROPERTY_OUTPUT_ONLY, propertyChangeListenerMock);
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
+ markableRidget.removePropertyChangeListener(propertyChangeListenerMock);
+ markableRidget.addPropertyChangeListener(IMarkableRidget.PROPERTY_OUTPUT_ONLY, propertyChangeListenerMock);
- assertFalse(ridget.isOutputOnly());
+ assertFalse(markableRidget.isOutputOnly());
expectNoPropertyChangeEvent();
- ridget.setOutputOnly(false);
+ markableRidget.setOutputOnly(false);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_OUTPUT_ONLY, Boolean.FALSE, Boolean.TRUE);
- ridget.setOutputOnly(true);
+ markableRidget.setOutputOnly(true);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.setOutputOnly(true);
+ markableRidget.setOutputOnly(true);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_OUTPUT_ONLY, Boolean.TRUE, Boolean.FALSE);
- ridget.setOutputOnly(false);
+ markableRidget.setOutputOnly(false);
verifyPropertyChangeEvents();
}
@@ -413,27 +413,27 @@ public abstract class AbstractSWTRidgetWithControlTest extends TestCase {
if (!(getRidget() instanceof IMarkableRidget)) {
return;
}
- IMarkableRidget ridget = (IMarkableRidget) getRidget();
+ IMarkableRidget markableRidget = (IMarkableRidget) getRidget();
IMarker marker = new OutputMarker();
- ridget.removePropertyChangeListener(propertyChangeListenerMock);
- ridget.addPropertyChangeListener(IMarkableRidget.PROPERTY_OUTPUT_ONLY, propertyChangeListenerMock);
+ markableRidget.removePropertyChangeListener(propertyChangeListenerMock);
+ markableRidget.addPropertyChangeListener(IMarkableRidget.PROPERTY_OUTPUT_ONLY, propertyChangeListenerMock);
- assertFalse(ridget.isOutputOnly());
+ assertFalse(markableRidget.isOutputOnly());
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_OUTPUT_ONLY, Boolean.FALSE, Boolean.TRUE);
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.addMarker(marker);
+ markableRidget.addMarker(marker);
verifyPropertyChangeEvents();
expectPropertyChangeEvent(IMarkableRidget.PROPERTY_OUTPUT_ONLY, Boolean.TRUE, Boolean.FALSE);
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
expectNoPropertyChangeEvent();
- ridget.removeMarker(marker);
+ markableRidget.removeMarker(marker);
verifyPropertyChangeEvents();
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MessageBoxRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MessageBoxRidgetTest.java
index a67a9d8..8482987 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MessageBoxRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MessageBoxRidgetTest.java
@@ -440,7 +440,7 @@ public class MessageBoxRidgetTest extends AbstractSWTRidgetWithControlTest {
failNotEquals(null, expected, actual);
}
- private static class MockMessageBox extends MessageBox {
+ private final static class MockMessageBox extends MessageBox {
private String title;
private String text;
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeRidgetLabelProviderTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeRidgetLabelProviderTest.java
index ec37e6e..aa34b81 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeRidgetLabelProviderTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeRidgetLabelProviderTest.java
@@ -38,7 +38,7 @@ import org.eclipse.swt.widgets.TreeColumn;
*/
public class TreeRidgetLabelProviderTest extends TestCase {
- final String[] columnProperties = { "word", "upperCase" };
+ private static final String[] COLUMN_PROPERTIES = { "word", "upperCase" };
private Shell shell;
private TreeViewer viewer;
@@ -56,7 +56,7 @@ public class TreeRidgetLabelProviderTest extends TestCase {
viewer = new TreeViewer(createTree(aShell));
IObservableSet elements = createElements();
- labelProvider = TreeRidgetLabelProvider.createLabelProvider(viewer, WordNode.class, elements, columnProperties,
+ labelProvider = TreeRidgetLabelProvider.createLabelProvider(viewer, WordNode.class, elements, COLUMN_PROPERTIES,
null);
viewer.setContentProvider(new FTTreeContentProvider());
@@ -148,18 +148,18 @@ public class TreeRidgetLabelProviderTest extends TestCase {
}
public void testGetForeground() {
- WordNode node = new WordNode("test");
+ WordNode wordNode = new WordNode("test");
// using upperCase as the enablement accessor; true => enabled; false => disabled
labelProvider = TreeRidgetLabelProvider.createLabelProvider(viewer, WordNode.class, createElements(),
- columnProperties, "upperCase");
+ COLUMN_PROPERTIES, "upperCase");
- node.setUpperCase(true);
- Color colorEnabled = labelProvider.getForeground(node);
+ wordNode.setUpperCase(true);
+ Color colorEnabled = labelProvider.getForeground(wordNode);
assertNull(colorEnabled);
- node.setUpperCase(false);
- Color colorDisabled = labelProvider.getForeground(node);
+ wordNode.setUpperCase(false);
+ Color colorDisabled = labelProvider.getForeground(wordNode);
assertNotNull(colorDisabled);
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/lnf/renderer/SubModuleTreeItemMarkerRendererTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/lnf/renderer/SubModuleTreeItemMarkerRendererTest.java
index eeab6f2..16df45e 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/lnf/renderer/SubModuleTreeItemMarkerRendererTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/lnf/renderer/SubModuleTreeItemMarkerRendererTest.java
@@ -224,11 +224,11 @@ public class SubModuleTreeItemMarkerRendererTest extends TestCase {
*/
private Image createItemImage() {
Image image = new Image(shell.getDisplay(), new Rectangle(0, 0, 10, 10));
- GC gc = new GC(image);
- gc.setForeground(LnfManager.getLnf().getColor("green"));
- gc.setBackground(LnfManager.getLnf().getColor("green"));
- gc.fillRectangle(0, 0, 5, 5);
- gc.dispose();
+ GC imageGC = new GC(image);
+ imageGC.setForeground(LnfManager.getLnf().getColor("green"));
+ imageGC.setBackground(LnfManager.getLnf().getColor("green"));
+ imageGC.fillRectangle(0, 0, 5, 5);
+ imageGC.dispose();
return image;
}
@@ -239,11 +239,11 @@ public class SubModuleTreeItemMarkerRendererTest extends TestCase {
*/
private Image createMarkerImage() {
Image image = new Image(shell.getDisplay(), new Rectangle(0, 0, 5, 5));
- GC gc = new GC(image);
- gc.setForeground(LnfManager.getLnf().getColor("red"));
- gc.setBackground(LnfManager.getLnf().getColor("red"));
- gc.fillRectangle(0, 0, 2, 2);
- gc.dispose();
+ GC imageGC = new GC(image);
+ imageGC.setForeground(LnfManager.getLnf().getColor("red"));
+ imageGC.setBackground(LnfManager.getLnf().getColor("red"));
+ imageGC.fillRectangle(0, 0, 2, 2);
+ imageGC.dispose();
return image;
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/security/authentication/module/TestLocalLoginModule.java b/org.eclipse.riena.tests/src/org/eclipse/riena/security/authentication/module/TestLocalLoginModule.java
index 8f49061..3c0342f 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/security/authentication/module/TestLocalLoginModule.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/security/authentication/module/TestLocalLoginModule.java
@@ -36,13 +36,13 @@ public class TestLocalLoginModule implements LoginModule {
private Subject subject;
private CallbackHandler callbackHandler;
- private Logger LOGGER = Activator.getDefault().getLogger(TestLocalLoginModule.class);
+ private static final Logger LOGGER = Activator.getDefault().getLogger(TestLocalLoginModule.class);
- String username;
- String password;
+ private String username;
+ private String password;
- static String checkedUsername;
- static String checkedPassword;
+ private static String checkedUsername;
+ private static String checkedPassword;
/**
* @param string
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/security/services/itest/authentication/module/TestRemoteLoginModule.java b/org.eclipse.riena.tests/src/org/eclipse/riena/security/services/itest/authentication/module/TestRemoteLoginModule.java
index d356d15..ba61f68 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/security/services/itest/authentication/module/TestRemoteLoginModule.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/security/services/itest/authentication/module/TestRemoteLoginModule.java
@@ -33,14 +33,14 @@ import org.osgi.service.log.LogService;
*/
public class TestRemoteLoginModule implements LoginModule {
- private Logger LOGGER = Activator.getDefault().getLogger(TestRemoteLoginModule.class);
+ private static final Logger LOGGER = Activator.getDefault().getLogger(TestRemoteLoginModule.class);
private CallbackHandler callbackHandler;
- String username;
- String password;
+ private String username;
+ private String password;
// AuthenticationTicket ticket;
- RemoteLoginProxy remoteLoginProxy;
+ private RemoteLoginProxy remoteLoginProxy;
/*
* (non-Javadoc)
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/tests/nanohttp/NanoHTTPD.java b/org.eclipse.riena.tests/src/org/eclipse/riena/tests/nanohttp/NanoHTTPD.java
index a39b460..2c4263d 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/tests/nanohttp/NanoHTTPD.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/tests/nanohttp/NanoHTTPD.java
@@ -192,8 +192,9 @@ public class NanoHTTPD {
Thread t = new Thread(new Runnable() {
public void run() {
try {
- while (!stop)
+ while (!stop) {
new HTTPSession(ss.accept());
+ }
} catch (IOException ioe) {
}
}
@@ -217,19 +218,22 @@ public class NanoHTTPD {
// Show licence if requested
int lopt = -1;
- for (int i = 0; i < args.length; ++i)
+ for (int i = 0; i < args.length; ++i) {
if (args[i].toLowerCase().endsWith("licence")) {
lopt = i;
System.out.println(LICENCE + "\n");
}
+ }
// Change port if requested
int port = 80;
- if (args.length > 0 && lopt != 0)
+ if (args.length > 0 && lopt != 0) {
port = Integer.parseInt(args[0]);
+ }
- if (args.length > 1 && args[1].toLowerCase().endsWith("licence"))
+ if (args.length > 1 && args[1].toLowerCase().endsWith("licence")) {
System.out.println(LICENCE + "\n");
+ }
NanoHTTPD nh = null;
try {
@@ -247,7 +251,6 @@ public class NanoHTTPD {
System.in.read();
} catch (Throwable t) {
}
- ;
}
/**
@@ -265,19 +268,22 @@ public class NanoHTTPD {
public void run() {
try {
InputStream is = mySocket.getInputStream();
- if (is == null)
+ if (is == null) {
return;
+ }
BufferedReader in = new BufferedReader(new InputStreamReader(is));
// Read the request line
StringTokenizer st = new StringTokenizer(in.readLine());
- if (!st.hasMoreTokens())
+ if (!st.hasMoreTokens()) {
sendError(HTTP_BADREQUEST, "BAD REQUEST: Syntax error. Usage: GET /example/file.html");
+ }
String method = st.nextToken();
- if (!st.hasMoreTokens())
+ if (!st.hasMoreTokens()) {
sendError(HTTP_BADREQUEST, "BAD REQUEST: Missing URI. Usage: GET /example/file.html");
+ }
String uri = decodePercent(st.nextToken());
@@ -306,7 +312,7 @@ public class NanoHTTPD {
// If the method is POST, there may be parameters
// in data section, too, read it:
if (method.equalsIgnoreCase("POST")) {
- long size = 0x7FFFFFFFFFFFFFFFl;
+ long size = 0x7FFFFFFFFFFFFFFFL;
String contentLength = header.getProperty("content-length");
if (contentLength != null) {
try {
@@ -320,8 +326,9 @@ public class NanoHTTPD {
while (read >= 0 && size > 0 && !postLine.endsWith("\r\n")) {
size -= read;
postLine += String.valueOf(buf, 0, read);
- if (size > 0)
+ if (size > 0) {
read = in.read(buf);
+ }
}
postLine = postLine.trim();
decodeParms(postLine, parms);
@@ -329,10 +336,11 @@ public class NanoHTTPD {
// Ok, now do the serve()
Response r = serve(uri, method, header, parms);
- if (r == null)
+ if (r == null) {
sendError(HTTP_INTERNALERROR, "SERVER INTERNAL ERROR: Serve() returned a null response.");
- else
+ } else {
sendResponse(r.status, r.mimeType, r.header, r.data);
+ }
in.close();
} catch (IOException ioe) {
@@ -380,15 +388,17 @@ public class NanoHTTPD {
* Properties.
*/
private void decodeParms(String parms, Properties p) throws InterruptedException {
- if (parms == null)
+ if (parms == null) {
return;
+ }
StringTokenizer st = new StringTokenizer(parms, "&");
while (st.hasMoreTokens()) {
String e = st.nextToken();
int sep = e.indexOf('=');
- if (sep >= 0)
+ if (sep >= 0) {
p.put(decodePercent(e.substring(0, sep)).trim(), decodePercent(e.substring(sep + 1)));
+ }
}
}
@@ -406,18 +416,21 @@ public class NanoHTTPD {
*/
private void sendResponse(String status, String mime, Properties header, InputStream data) {
try {
- if (status == null)
+ if (status == null) {
throw new Error("sendResponse(): Status can't be null.");
+ }
OutputStream out = mySocket.getOutputStream();
PrintWriter pw = new PrintWriter(out);
pw.print("HTTP/1.0 " + status + " \r\n");
- if (mime != null)
+ if (mime != null) {
pw.print("Content-Type: " + mime + "\r\n");
+ }
- if (header == null || header.getProperty("Date") == null)
+ if (header == null || header.getProperty("Date") == null) {
pw.print("Date: " + gmtFrmt.format(new Date()) + "\r\n");
+ }
if (header != null) {
Enumeration e = header.keys();
@@ -435,15 +448,17 @@ public class NanoHTTPD {
byte[] buff = new byte[2048];
while (true) {
int read = data.read(buff, 0, 2048);
- if (read <= 0)
+ if (read <= 0) {
break;
+ }
out.write(buff, 0, read);
}
}
out.flush();
out.close();
- if (data != null)
+ if (data != null) {
data.close();
+ }
} catch (IOException ioe) {
// Couldn't write? No can do.
try {
@@ -465,11 +480,11 @@ public class NanoHTTPD {
StringTokenizer st = new StringTokenizer(uri, "/ ", true);
while (st.hasMoreTokens()) {
String tok = st.nextToken();
- if (tok.equals("/"))
+ if (tok.equals("/")) {
newUri += "/";
- else if (tok.equals(" "))
+ } else if (tok.equals(" ")) {
newUri += "%20";
- else {
+ } else {
newUri += URLEncoder.encode(tok);
// For Java 1.4 you'll want to use this instead:
// try { newUri += URLEncoder.encode( tok, "UTF-8" ); } catch (
@@ -492,22 +507,26 @@ public class NanoHTTPD {
*/
public Response serveFile(String uri, Properties header, File homeDir, boolean allowDirectoryListing) {
// Make sure we won't die of an exception later
- if (!homeDir.isDirectory())
+ if (!homeDir.isDirectory()) {
return new Response(HTTP_INTERNALERROR, MIME_PLAINTEXT,
"INTERNAL ERRROR: serveFile(): given homeDir is not a directory.");
+ }
// Remove URL arguments
uri = uri.trim().replace(File.separatorChar, '/');
- if (uri.indexOf('?') >= 0)
+ if (uri.indexOf('?') >= 0) {
uri = uri.substring(0, uri.indexOf('?'));
+ }
// Prohibit getting out of current directory
- if (uri.startsWith("..") || uri.endsWith("..") || uri.indexOf("../") >= 0)
+ if (uri.startsWith("..") || uri.endsWith("..") || uri.indexOf("../") >= 0) {
return new Response(HTTP_FORBIDDEN, MIME_PLAINTEXT, "FORBIDDEN: Won't serve ../ for security reasons.");
+ }
File f = new File(homeDir, uri);
- if (!f.exists())
+ if (!f.exists()) {
return new Response(HTTP_NOTFOUND, MIME_PLAINTEXT, "Error 404, file not found.");
+ }
// List the directory, if necessary
if (f.isDirectory()) {
@@ -522,21 +541,20 @@ public class NanoHTTPD {
}
// First try index.html and index.htm
- if (new File(f, "index.html").exists())
+ if (new File(f, "index.html").exists()) {
f = new File(homeDir, uri + "/index.html");
- else if (new File(f, "index.htm").exists())
+ } else if (new File(f, "index.htm").exists()) {
f = new File(homeDir, uri + "/index.htm");
-
- // No index file, list the directory
- else if (allowDirectoryListing) {
+ } else if (allowDirectoryListing) {
String[] files = f.list();
String msg = "<html><body><h1>Directory " + uri + "</h1><br/>";
if (uri.length() > 1) {
String u = uri.substring(0, uri.length() - 1);
int slash = u.lastIndexOf('/');
- if (slash >= 0 && slash < u.length())
+ if (slash >= 0 && slash < u.length()) {
msg += "<b><a href=\"" + uri.substring(0, slash + 1) + "\">..</a></b><br/>";
+ }
}
for (int i = 0; i < files.length; ++i) {
@@ -553,19 +571,21 @@ public class NanoHTTPD {
if (curFile.isFile()) {
long len = curFile.length();
msg += " &nbsp;<font size=2>(";
- if (len < 1024)
+ if (len < 1024) {
msg += curFile.length() + " bytes";
- else if (len < 1024 * 1024)
+ } else if (len < 1024 * 1024) {
msg += curFile.length() / 1024 + "." + (curFile.length() % 1024 / 10 % 100) + " KB";
- else
+ } else {
msg += curFile.length() / (1024 * 1024) + "." + curFile.length() % (1024 * 1024) / 10 % 100
+ " MB";
+ }
msg += ")</font>";
}
msg += "<br/>";
- if (dir)
+ if (dir) {
msg += "</b>";
+ }
}
return new Response(HTTP_OK, MIME_HTML, msg);
} else {
@@ -577,10 +597,12 @@ public class NanoHTTPD {
// Get MIME type from file name extension, if possible
String mime = null;
int dot = f.getCanonicalPath().lastIndexOf('.');
- if (dot >= 0)
+ if (dot >= 0) {
mime = (String) theMimeTypes.get(f.getCanonicalPath().substring(dot + 1).toLowerCase());
- if (mime == null)
+ }
+ if (mime == null) {
mime = MIME_DEFAULT_BINARY;
+ }
// Support (simple) skipping:
long startFrom = 0;
@@ -589,8 +611,9 @@ public class NanoHTTPD {
if (range.startsWith("bytes=")) {
range = range.substring("bytes=".length());
int minus = range.indexOf('-');
- if (minus > 0)
+ if (minus > 0) {
range = range.substring(0, minus);
+ }
try {
startFrom = Long.parseLong(range);
} catch (NumberFormatException nfe) {
@@ -619,8 +642,9 @@ public class NanoHTTPD {
+ "mp3 audio/mpeg " + "m3u audio/mpeg-url " + "pdf application/pdf " + "doc application/msword "
+ "ogg application/x-ogg " + "zip application/octet-stream " + "exe application/octet-stream "
+ "class application/octet-stream ");
- while (st.hasMoreTokens())
+ while (st.hasMoreTokens()) {
theMimeTypes.put(st.nextToken(), st.nextToken());
+ }
}
/**