[jboss-svn-commits] JBL Code SVN: r35316 - in labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss: internal/soa/esb/services/registry and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Sep 27 15:05:44 EDT 2010
Author: tcunning
Date: 2010-09-27 15:05:42 -0400 (Mon, 27 Sep 2010)
New Revision: 35316
Modified:
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/parameters/ParamFileRepository.java
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/listeners/StandAloneBootStrapper.java
Log:
JBESB-2969
FindBugs fixes - mainly checking the results of method calls,
changing one switch/case to match what FindBugs wants.
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/parameters/ParamFileRepository.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/parameters/ParamFileRepository.java 2010-09-27 17:39:47 UTC (rev 35315)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/parameters/ParamFileRepository.java 2010-09-27 19:05:42 UTC (rev 35316)
@@ -89,10 +89,10 @@
{
File paramFile = toParamFile(nameParam);
File parentDir = paramFile.getParentFile();
- if (null==parentDir)
- parentDir=new File("");
+ if (null == parentDir)
+ parentDir = new File("");
- parentDir.mkdirs();
+ boolean result = parentDir.mkdirs();
FileOutputStream fileStream = null;
try
{
@@ -174,7 +174,7 @@
File paramFile = toParamFile(paramName);
if (paramFile.exists())
{
- paramFile.delete();
+ boolean delResult = paramFile.delete();
}
}
}
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java 2010-09-27 17:39:47 UTC (rev 35315)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/services/registry/JAXRRegistryImpl.java 2010-09-27 19:05:42 UTC (rev 35316)
@@ -322,8 +322,6 @@
Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
try {
final Concept jbossTModel = getJBossESBTModel(connection);
- RegistryService rs = connection.getRegistryService();
- BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
Service service = findService(category, serviceName);
if (service==null){
@@ -376,8 +374,6 @@
Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
try {
final Concept jbossTModel = getJBossESBTModel(connection);
- RegistryService rs = connection.getRegistryService();
- BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
Service service = findService(category, serviceName);
if (service==null){
@@ -611,12 +607,10 @@
Connection connection)
throws JAXRException
{
- String eprDescription = binding.getDescription().getValue();
try {
final Concept jbossTModel = getJBossESBTModel(connection);
RegistryService rs = connection.getRegistryService();
- BusinessQueryManager bqm = rs.getBusinessQueryManager();
BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
fromService.removeServiceBinding(binding);
@@ -645,7 +639,6 @@
{
try {
RegistryService rs = connection.getRegistryService();
- BusinessQueryManager bqm = rs.getBusinessQueryManager();
BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
blm.deleteServiceBindings(keys);
@@ -665,7 +658,6 @@
{
try {
RegistryService rs = connection.getRegistryService();
- BusinessQueryManager bqm = rs.getBusinessQueryManager();
BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
Collection<Key> serviceKeys = new ArrayList<Key>();
@@ -923,11 +915,18 @@
ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, JBOSS_ESB_CATEGORY);
// If the scheme returned null, then we have to create a org.jboss.soa.esb.:category scheme to use
if (cScheme == null) {
+ BulkResponse br = null;
try {
ClassificationScheme scheme = blm.createClassificationScheme(JBOSS_ESB_CATEGORY, JBOSS_ESB_CATEGORY);
ArrayList<ClassificationScheme> cSchemes = new ArrayList<ClassificationScheme>();
cSchemes.add(scheme);
- BulkResponse br = blm.saveClassificationSchemes(cSchemes);
+ br = blm.saveClassificationSchemes(cSchemes);
+
+ if (br!=null && br.getStatus() != JAXRResponse.STATUS_SUCCESS) {
+ throw new JAXRException("Tried to saveClassificationsSchemes, got result "
+ + br.getStatus());
+ }
+
} catch (Exception e) {
throw new JAXRException(e);
}
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java 2010-09-27 17:39:47 UTC (rev 35315)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java 2010-09-27 19:05:42 UTC (rev 35316)
@@ -32,6 +32,7 @@
import java.net.URI;
import java.net.URISyntaxException;
+import org.apache.log4j.Logger;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.jboss.soa.esb.ConfigurationException;
@@ -56,7 +57,7 @@
*/
public class FtpImpl implements RemoteFileSystem
{
-
+ private static Logger logger = Logger.getLogger(FtpImpl.class);
private static final String TMP_SUFFIX = ".rosettaPart";
private boolean m_bPassive;
@@ -123,10 +124,12 @@
final int saLen = (sa == null ? 0 : sa.length) ;
switch(saLen)
{
- case 2:
- m_sPasswd = sa[1] ;
case 1:
m_sUser = sa[0] ;
+ break;
+ case 2:
+ m_sUser = sa[0] ;
+ m_sPasswd = sa[1] ;
}
m_sRemoteDir = uri.getPath();
@@ -292,14 +295,22 @@
final File to = new File(p_sFinalName) ;
final File oLocalDir = new File(m_sLocalDir);
final File oNew = (to.isAbsolute() ? to : new File(oLocalDir, p_sFinalName)) ;
- if (oNew.exists())
- oNew.delete();
+ if (oNew.exists()) {
+ boolean result = oNew.delete();
+ if (!result) {
+ logger.error("Could not delete file " + oNew.getAbsolutePath());
+ }
+ }
final File toTmp = new File(p_sFinalName + TMP_SUFFIX) ;
final File oNewTmp = (toTmp.isAbsolute() ? toTmp : new File(oLocalDir, p_sFinalName + TMP_SUFFIX)) ;
- if (oNewTmp.exists())
- oNewTmp.delete();
-
+ if (oNewTmp.exists()) {
+ boolean result = oNewTmp.delete();
+ if (!result) {
+ logger.error("Could not delete file " + oNewTmp.getAbsolutePath());
+ }
+ }
+
changeRemoteDirectory() ;
final InputStream is = m_oConn.retrieveFileStream(p_sFile) ;
if (is == null)
@@ -325,7 +336,10 @@
}
if (!m_oConn.completePendingCommand())
{
- oNewTmp.delete() ;
+ boolean result = oNewTmp.delete();
+ if (!result) {
+ logger.error("Could not delete file " + oNewTmp.getAbsolutePath());
+ }
throw new RemoteFileSystemException("Failed to download contents: " + m_oConn.getReplyString()) ;
}
FileUtil.renameTo(oNewTmp, oNew) ;
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java 2010-09-27 17:39:47 UTC (rev 35315)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/internal/soa/esb/util/JBossDeployerUtil.java 2010-09-27 19:05:42 UTC (rev 35316)
@@ -178,7 +178,10 @@
{
return null;
}
- esbDir.mkdir();
+ boolean result = esbDir.mkdir();
+ if (!result) {
+ log.error("Could not create " + esbDir.getAbsolutePath());
+ }
}
final int lastSeparator = esbName.lastIndexOf('.');
@@ -190,7 +193,10 @@
public static File createDir(final File parentDir, String dirName)
{
final File esbWarFiles = new File(parentDir, dirName);
- esbWarFiles.mkdirs();
+ boolean result = esbWarFiles.mkdirs();
+ if (!result) {
+ log.error("Could not create directory " + esbWarFiles.getAbsolutePath());
+ }
return esbWarFiles;
}
Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/listeners/StandAloneBootStrapper.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/listeners/StandAloneBootStrapper.java 2010-09-27 17:39:47 UTC (rev 35315)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/listeners/StandAloneBootStrapper.java 2010-09-27 19:05:42 UTC (rev 35316)
@@ -216,7 +216,10 @@
File listenerFile = new File(configDir, esbConf);
if (listenerFile.exists())
{
- listenerFile.delete();
+ boolean result = listenerFile.delete();
+ if (!result) {
+ _logger.error("Could not delete file " + listenerFile.getAbsolutePath());
+ }
}
File gatewayFile = new File(configDir, gwConf);
if (gatewayFile.exists())
More information about the jboss-svn-commits
mailing list