You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2011/01/23 15:52:15 UTC
svn commit: r1062438 -
/ofbiz/trunk/applications/content/src/ControlApplet.java
Author: mrisaliti
Date: Sun Jan 23 14:52:15 2011
New Revision: 1062438
URL: http://svn.apache.org/viewvc?rev=1062438&view=rev
Log:
Remove some java compilation warnings of ControlApplet (OFBIZ-4102)
Modified:
ofbiz/trunk/applications/content/src/ControlApplet.java
Modified: ofbiz/trunk/applications/content/src/ControlApplet.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/ControlApplet.java?rev=1062438&r1=1062437&r2=1062438&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/ControlApplet.java (original)
+++ ofbiz/trunk/applications/content/src/ControlApplet.java Sun Jan 23 14:52:15 2011
@@ -28,15 +28,17 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
+
+import javolution.util.FastMap;
import org.ofbiz.base.util.UtilValidate;
/**
* Control Applet - Client applet for page pushing and (future) chat
*/
+@SuppressWarnings("serial")
public class ControlApplet extends Applet implements Runnable {
private static String pushUrl = "/commonapp/control/pushapplet";
@@ -130,7 +132,7 @@ public class ControlApplet extends Apple
}
protected void pull() {
- Map params = new HashMap();
+ Map<String, Object> params = FastMap.newInstance();
params.put("sessionId", this.sessionId.trim());
params.put("visitId", this.visitId.trim());
@@ -160,12 +162,11 @@ public class ControlApplet extends Apple
}
protected void push() {
- Map params = new HashMap();
+ Map<String, Object> params = FastMap.newInstance();
params.put("sessionId", this.sessionId.trim());
params.put("visitId", this.visitId.trim());
params.put("currentPage", this.currentPage.trim());
- String pushResp = null;
URL callPushUrl = null;
try {
callPushUrl = new URL(serverUrl + pushUrl);
@@ -174,17 +175,18 @@ public class ControlApplet extends Apple
if (callPushUrl != null) {
try {
- pushResp = callServer(callPushUrl, params);
+ callServer(callPushUrl, params);
} catch (IOException e) {
}
}
}
- private String callServer(URL serverUrl, Map parms) throws IOException {
+ private String callServer(URL serverUrl, Map<String, Object> parms) throws IOException {
// send the request
String parameters = this.encodeArgs(parms);
- if (debug != null && debug.equalsIgnoreCase("true"))
+ if (debug != null && debug.equalsIgnoreCase("true")) {
System.out.println("Sending parameters: " + parameters);
+ }
URLConnection uc = serverUrl.openConnection();
uc.setDoOutput(true);
uc.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
@@ -196,20 +198,21 @@ public class ControlApplet extends Apple
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String responseStr = in.readLine();
in.close();
- if (responseStr != null)
+ if (responseStr != null) {
responseStr = responseStr.trim();
- if (debug != null && debug.equalsIgnoreCase("true"))
+ }
+ if (debug != null && debug.equalsIgnoreCase("true")) {
System.out.println("Receive response: " + responseStr);
+ }
return responseStr;
}
- public String encodeArgs(Map args) {
+ public String encodeArgs(Map<String, Object> args) {
StringBuffer buf = new StringBuffer();
if (args != null) {
- Iterator i = args.entrySet().iterator();
- while (i.hasNext()) {
- Map.Entry entry = (Map.Entry) i.next();
- String name = (String) entry.getKey();
+ Set<Map.Entry<String, Object>> entrySet = args.entrySet();
+ for (Map.Entry<String, Object> entry : entrySet) {
+ String name = entry.getKey();
Object value = entry.getValue();
String valueStr = null;
if (name != null && value != null) {