Author: keith
Date: Fri Apr 4 02:12:45 2008
New Revision: 15551
Log:
minor code clenup (IDEA suggetions)
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/utils/MashupUtils.java
Fri Apr 4 02:12:45 2008
@@ -62,7 +62,6 @@
import org.wso2.wsas.ServerManager;
import org.wso2.wsas.persistence.PersistenceManager;
import org.wso2.wsas.persistence.dataobject.ServiceUserDO;
-import org.wso2.ws.dataservice.DBConstants;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
@@ -222,7 +221,7 @@
beanName = new
ObjectName("org.wso2.monitor.mbeans:type=ServerMonitor");
// Call notification method of mbean.
- Object[] params = { new Boolean(serverRunning) };
+ Object[] params = { Boolean.valueOf(serverRunning) };
String[] signatures = { "boolean" };
beanServer.invoke(beanName, "setServerRunning", params,
signatures);
}
@@ -260,10 +259,8 @@
ConfigurationContext configContext = serverManager.configContext;
AxisService service =
configContext.getAxisConfiguration().getService(serviceName);
String value = (String)
service.getParameterValue(ServerConstants.SERVICE_TYPE);
- if (MashupConstants.MASHUP_JS_SERVICE.equals(value) ||
ServerConstants.SERVICE_TYPE_DB.equals(value)) {
- return true;
- }
- return false;
+ return MashupConstants.MASHUP_JS_SERVICE.equals(value) ||
+ ServerConstants.SERVICE_TYPE_DB.equals(value);
}
public static String getServiceName(String address, String
serviceContextPath) {
@@ -368,12 +365,12 @@
}
try {
- if (serviceJs.exists()) {
+ if (serviceJs != null && serviceJs.exists()) {
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(new
FileReader(serviceJs));
char[] buf = new char[1024];
- int numRead = 0;
+ int numRead;
while ((numRead = reader.read(buf)) != -1) {
fileData.append(buf, 0, numRead);
}
@@ -400,10 +397,6 @@
String serviceUiSource =
"The custom UI code for the specified mashup was not found on
the server.";
- //Extracting the service name from the path provided
- String[] pathContents = path.split("/");
- String serviceName = pathContents[3];
-
//Extracting the real path from the registry path provided
ServerManager serverManager = ServerManager.getInstance();
ConfigurationContext configContext = serverManager.configContext;
@@ -421,7 +414,7 @@
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(new
FileReader(serviceUiFile));
char[] buf = new char[1024];
- int numRead = 0;
+ int numRead;
while ((numRead = reader.read(buf)) != -1) {
fileData.append(buf, 0, numRead);
}
@@ -439,7 +432,7 @@
StringBuffer fileData = new StringBuffer(1000);
BufferedReader reader = new BufferedReader(new
FileReader(serviceUiFile));
char[] buf = new char[1024];
- int numRead = 0;
+ int numRead;
while ((numRead = reader.read(buf)) != -1) {
fileData.append(buf, 0, numRead);
}
@@ -772,13 +765,13 @@
public static String calculateFileMD5(File file) throws MashupFault {
String retMD5 = "";
- MessageDigest digest = null;
+ MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
InputStream is = new FileInputStream(file);
byte[] buffer = new byte[8192];
- int read = 0;
+ int read;
try {
while ((read = is.read(buffer)) > 0) {
digest.update(buffer, 0, read);
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev