New Defects reported by Coverity Scan for cloudstack

2016-01-25 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

4 new defect(s) introduced to cloudstack found with Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 4 of 4 defect(s)


** CID 1147055:  Null pointer dereferences  (REVERSE_INULL)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2204 in 
com.cloud.storage.VolumeApiServiceImpl.extractVolume(org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd)()



*** CID 1147055:  Null pointer dereferences  (REVERSE_INULL)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2204 in 
com.cloud.storage.VolumeApiServiceImpl.extractVolume(org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd)()
2198 
2199 VMTemplateVO template = 
ApiDBUtils.findTemplateById(volume.getTemplateId());
2200 if (template != null) { // For ISO based volumes template 
= null and
2201 // we allow extraction of all ISO based
2202 // volumes
2203 boolean isExtractable = template.isExtractable() && 
template.getTemplateType() != Storage.TemplateType.SYSTEM;
>>> CID 1147055:  Null pointer dereferences  (REVERSE_INULL)
>>> Null-checking "account" suggests that it may be null, but it has 
>>> already been dereferenced on all paths leading to the check.
2204 if (!isExtractable && account != null && 
!_accountMgr.isRootAdmin(account.getId())) {
2205 // Global admins are always allowed to extract
2206 PermissionDeniedException ex = new 
PermissionDeniedException("The volume with specified volumeId is not allowed to 
be extracted");
2207 ex.addProxyObject(volume.getUuid(), "volumeId");
2208 throw ex;
2209 }

** CID 1192794:(REVERSE_INULL)
/server/src/com/cloud/api/query/QueryManagerImpl.java: 2959 in 
com.cloud.api.query.QueryManagerImpl.listDataCentersInternal(org.apache.cloudstack.api.command.user.zone.ListZonesCmd)()
/server/src/com/cloud/api/query/QueryManagerImpl.java: 2959 in 
com.cloud.api.query.QueryManagerImpl.listDataCentersInternal(org.apache.cloudstack.api.command.user.zone.ListZonesCmd)()



*** CID 1192794:(REVERSE_INULL)
/server/src/com/cloud/api/query/QueryManagerImpl.java: 2959 in 
com.cloud.api.query.QueryManagerImpl.listDataCentersInternal(org.apache.cloudstack.api.command.user.zone.ListZonesCmd)()
2953 }
2954 }
2955 
2956 // handle available=FALSE option, only return zones with 
at least
2957 // one VM running there
2958 Boolean available = cmd.isAvailable();
>>> CID 1192794:(REVERSE_INULL)
>>> Null-checking "account" suggests that it may be null, but it has 
>>> already been dereferenced on all paths leading to the check.
2959 if (account != null) {
2960 if ((available != null) && 
Boolean.FALSE.equals(available)) {
2961 Set dcIds = new HashSet(); // data 
centers with
2962 // at least one VM
2963 // running
2964 List routers = 
_routerDao.listBy(account.getId());
/server/src/com/cloud/api/query/QueryManagerImpl.java: 2959 in 
com.cloud.api.query.QueryManagerImpl.listDataCentersInternal(org.apache.cloudstack.api.command.user.zone.ListZonesCmd)()
2953 }
2954 }
2955 
2956 // handle available=FALSE option, only return zones with 
at least
2957 // one VM running there
2958 Boolean available = cmd.isAvailable();
>>> CID 1192794:(REVERSE_INULL)
>>> Null-checking "account" suggests that it may be null, but it has 
>>> already been dereferenced on all paths leading to the check.
2959 if (account != null) {
2960 if ((available != null) && 
Boolean.FALSE.equals(available)) {
2961 Set dcIds = new HashSet(); // data 
centers with
2962 // at least one VM
2963 // running
2964 List routers = 
_routerDao.listBy(account.getId());

** CID 1349986:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xen610/XenServer610MigrateWithStorageSendCommandWrapper.java:
 76 in 
com.cloud.hypervisor.xenserver.resource.wrapper.xen610.XenServer610MigrateWithStorageSendCommandWrapper.execute(com.cloud.agent.api.MigrateWithStorageSendCommand,
 com.cloud.hypervisor.xenserver.resource.XenServer610Resource)()



New Defects reported by Coverity Scan for cloudstack

2016-01-18 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

1 new defect(s) introduced to cloudstack found with Coverity Scan.
1 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1349405:  Null pointer dereferences  (FORWARD_NULL)
/server/src/com/cloud/network/router/NicProfileHelperImpl.java: 90 in 
com.cloud.network.router.NicProfileHelperImpl.createPrivateNicProfileForGateway(com.cloud.network.vpc.VpcGateway,
 com.cloud.network.router.VirtualRouter)()



*** CID 1349405:  Null pointer dereferences  (FORWARD_NULL)
/server/src/com/cloud/network/router/NicProfileHelperImpl.java: 90 in 
com.cloud.network.router.NicProfileHelperImpl.createPrivateNicProfileForGateway(com.cloud.network.vpc.VpcGateway,
 com.cloud.network.router.VirtualRouter)()
84 privateNicProfile =
85 new NicProfile(privateNic, privateNetwork, 
privateNic.getBroadcastUri(), privateNic.getIsolationUri(), 
_networkModel.getNetworkRate(
86 privateNetwork.getId(), router.getId()), 
_networkModel.isSecurityGroupSupportedInNetwork(privateNetwork), 
_networkModel.getNetworkTag(
87 router.getHypervisorType(), 
privateNetwork));
88 } else {
89 final String netmask = 
NetUtils.getCidrNetmask(privateNetwork.getCidr());
>>> CID 1349405:  Null pointer dereferences  (FORWARD_NULL)
>>> Calling a method on null object "ipVO".
90 final PrivateIpAddress ip =
91 new PrivateIpAddress(ipVO, 
privateNetwork.getBroadcastUri().toString(), privateNetwork.getGateway(), 
netmask,
92 
NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ipVO.getMacAddress(;
93 
94 final URI netUri = 
BroadcastDomainType.fromString(ip.getBroadcastUri());
95 privateNicProfile.setIPv4Address(ip.getIpAddress());



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/cloudstack?tab=overview

To manage Coverity Scan email notifications for "dev@cloudstack.apache.org", 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-11-30 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

2 new defect(s) introduced to cloudstack found with Coverity Scan.
4 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1341073:  Null pointer dereferences  (FORWARD_NULL)
/server/src/com/cloud/api/ApiServer.java: 676 in 
com.cloud.api.ApiServer.queueCommand(org.apache.cloudstack.api.BaseCmd, 
java.util.Map, java.lang.StringBuilder)()



*** CID 1341073:  Null pointer dereferences  (FORWARD_NULL)
/server/src/com/cloud/api/ApiServer.java: 676 in 
com.cloud.api.ApiServer.queueCommand(org.apache.cloudstack.api.BaseCmd, 
java.util.Map, java.lang.StringBuilder)()
670 Long instanceId = (objectId == null) ? 
asyncCmd.getInstanceId() : objectId;
671 
672 // users can provide the job id they want to use, so log as 
it is a uuid and is unique
673 String injectedJobId = asyncCmd.getInjectedJobId();
674 _uuidMgr.checkUuidSimple(injectedJobId, AsyncJob.class);
675 
>>> CID 1341073:  Null pointer dereferences  (FORWARD_NULL)
>>> Calling a method on null object "caller".
676 AsyncJobVO job = new AsyncJobVO("", callerUserId, 
caller.getId(), cmdObj.getClass().getName(),
677 ApiGsonHelper.getBuilder().create().toJson(params), 
instanceId,
678 asyncCmd.getInstanceType() != null ? 
asyncCmd.getInstanceType().toString() : null,
679 injectedJobId);
680 job.setDispatcher(_asyncDispatcher.getName());
681 

** CID 1341076:  Control flow issues  (DEADCODE)
/server/src/com/cloud/api/ApiServer.java: 658 in 
com.cloud.api.ApiServer.queueCommand(org.apache.cloudstack.api.BaseCmd, 
java.util.Map, java.lang.StringBuilder)()



*** CID 1341076:  Control flow issues  (DEADCODE)
/server/src/com/cloud/api/ApiServer.java: 658 in 
com.cloud.api.ApiServer.queueCommand(org.apache.cloudstack.api.BaseCmd, 
java.util.Map, java.lang.StringBuilder)()
652 }
653 
654 long startEventId = ctx.getStartEventId();
655 asyncCmd.setStartEventId(startEventId);
656 
657 // save the scheduled event
>>> CID 1341076:  Control flow issues  (DEADCODE)
>>> Execution cannot reach this expression "1L" inside statement "eventId = 
>>> com.cloud.event.A...".
658 final Long eventId =
659 
ActionEventUtils.onScheduledActionEvent((callerUserId == null) ? 
(Long)User.UID_SYSTEM : callerUserId, asyncCmd.getEntityOwnerId(), 
asyncCmd.getEventType(),
660 asyncCmd.getEventDescription(), 
asyncCmd.isDisplay(), startEventId);
661 if (startEventId == 0) {
662 // There was no create event before, set current event 
id as start eventId
663 startEventId = eventId;



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/cloudstack?tab=overview

To manage Coverity Scan email notifications for "dev@cloudstack.apache.org", 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-11-23 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

98 new defect(s) introduced to cloudstack found with Coverity Scan.
6 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 98 defect(s)


** CID 1194809:  Null pointer dereferences  (NULL_RETURNS)
/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java:
 45 in 
org.apache.cloudstack.framework.ws.jackson.CSJacksonAnnotationIntrospector.findSerializer(com.fasterxml.jackson.databind.introspect.Annotated)()



*** CID 1194809:  Null pointer dereferences  (NULL_RETURNS)
/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java:
 45 in 
org.apache.cloudstack.framework.ws.jackson.CSJacksonAnnotationIntrospector.findSerializer(com.fasterxml.jackson.databind.introspect.Annotated)()
39 return new Version(1, 7, 0, "abc", "org.apache.cloudstack", 
"cloudstack-framework-rest");
40 }
41 
42 @Override
43 public Object findSerializer(Annotated a) {
44 AnnotatedElement ae = a.getAnnotated();
>>> CID 1194809:  Null pointer dereferences  (NULL_RETURNS)
>>> Calling a method on null object "ae".
45 Url an = ae.getAnnotation(Url.class);
46 if (an == null) {
47 return null;
48 }
49 
50 if (an.type() == String.class) {

** CID 1339965:  FindBugs: Bad practice  
(FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/DownloadManagerImpl.java:
 563 in 
org.apache.cloudstack.storage.template.DownloadManagerImpl.downloadPublicTemplate(long,
 java.lang.String, java.lang.String, com.cloud.storage.Storage$ImageFormat, 
boolean, java.lang.Long, java.lang.String, java.lang.String, java.lang.String, 
java.lang.String, java.lang.String, java.lang.String, long, 
com.cloud.utils.net.Proxy, 
org.apache.cloudstack.storage.command.DownloadCommand$ResourceType)()



*** CID 1339965:  FindBugs: Bad practice  
(FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/DownloadManagerImpl.java:
 563 in 
org.apache.cloudstack.storage.template.DownloadManagerImpl.downloadPublicTemplate(long,
 java.lang.String, java.lang.String, com.cloud.storage.Storage$ImageFormat, 
boolean, java.lang.Long, java.lang.String, java.lang.String, java.lang.String, 
java.lang.String, java.lang.String, java.lang.String, long, 
com.cloud.utils.net.Proxy, 
org.apache.cloudstack.storage.command.DownloadCommand$ResourceType)()
557 }
558 // TO DO - define constant for volume properties.
559 File file =
560 ResourceType.TEMPLATE == resourceType ? 
_storage.getFile(tmpDir + File.separator + TemplateLocation.Filename) : 
_storage.getFile(tmpDir + File.separator +
561 "volume.properties");
562 if (file.exists()) {
>>> CID 1339965:  FindBugs: Bad practice  
>>> (FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
>>> exceptional return value of java.io.File.delete() ignored
563 file.delete();
564 }
565 
566 if (!file.createNewFile()) {
567 s_logger.warn("Unable to create new file: " + 
file.getAbsolutePath());
568 return "Unable to create new file: " + 
file.getAbsolutePath();

** CID 1339967:  FindBugs: Dodgy code  (FB.EQ_DOESNT_OVERRIDE_EQUALS)
/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowAnswer.java:
 20 in ()



*** CID 1339967:  FindBugs: Dodgy code  (FB.EQ_DOESNT_OVERRIDE_EQUALS)
/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowAnswer.java:
 20 in ()
14 // KIND, either express or implied.  See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 package com.cloud.agent.api;
18 
19 
>>> CID 1339967:  FindBugs: Dodgy code  (FB.EQ_DOESNT_OVERRIDE_EQUALS)
>>> com.cloud.agent.api.OvsSetTagAndFlowAnswer doesn't override 
>>> Answer.equals(Object)
20 public class OvsSetTagAndFlowAnswer extends Answer {
21 Long vmId;
22 Long seqno;
23 
24 public OvsSetTagAndFlowAnswer(Command cmd, boolean success, String 
details) {
25 super(cmd, success, details);

** CID 1339968:  FindBugs: Dodgy code  

New Defects reported by Coverity Scan for cloudstack

2015-11-09 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

1 new defect(s) introduced to cloudstack found with Coverity Scan.
1 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1338387:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3HypervisorGuru.java:
 115 in 
com.cloud.hypervisor.ovm3.resources.Ovm3HypervisorGuru.performSideEffectsForDelegationOnCommand(long,
 com.cloud.agent.api.Command)()



*** CID 1338387:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3HypervisorGuru.java:
 115 in 
com.cloud.hypervisor.ovm3.resources.Ovm3HypervisorGuru.performSideEffectsForDelegationOnCommand(long,
 com.cloud.agent.api.Command)()
109 LOGGER.debug("Snapshot to Template: " + cmd);
110 DataStoreTO srcStore = srcData.getDataStore();
111 DataStoreTO destStore = destData.getDataStore();
112 if (srcStore instanceof NfsTO && destStore instanceof 
NfsTO) {
113 HostVO host = hostDao.findById(hostId);
114 EndPoint ep = 
endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId()));
>>> CID 1338387:  Null pointer dereferences  (NULL_RETURNS)
>>> Calling a method on null object "ep".
115 host = hostDao.findById(ep.getId());
116 hostDao.loadDetails(host);
117 }
118 }
119 }
120 }



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/cloudstack?tab=overview

To manage Coverity Scan email notifications for "dev@cloudstack.apache.org", 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-11-01 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

1 new defect(s) introduced to cloudstack found with Coverity Scan.
2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1338016:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 1258 in 
com.cloud.storage.VolumeApiServiceImpl.deleteVolume(long, 
com.cloud.user.Account)()



*** CID 1338016:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 1258 in 
com.cloud.storage.VolumeApiServiceImpl.deleteVolume(long, 
com.cloud.user.Account)()
1252 List cacheVols = 
volFactory.listVolumeOnCache(volume.getId());
1253 for (VolumeInfo volOnCache : cacheVols) {
1254 s_logger.info("Delete volume from image cache store: " 
+ volOnCache.getDataStore().getName());
1255 volOnCache.delete();
1256 }
1257 
>>> CID 1338016:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
>>> Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
>>> for Exception
1258 } catch (Exception e) {
1259 s_logger.warn("Failed to expunge volume:", e);
1260 return false;
1261 }
1262 
1263 return true;



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/cloudstack?tab=overview

To manage Coverity Scan email notifications for "dev@cloudstack.apache.org", 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-09-14 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

5 new defect(s) introduced to cloudstack found with Coverity Scan.
3 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 5 of 5 defect(s)


** CID 1324347:  Null pointer dereferences  (NULL_RETURNS)
/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/DownloadManagerImpl.java:
 359 in 
org.apache.cloudstack.storage.template.DownloadManagerImpl.postRemoteDownload(java.lang.String)()



*** CID 1324347:  Null pointer dereferences  (NULL_RETURNS)
/services/secondary-storage/server/src/org/apache/cloudstack/storage/template/DownloadManagerImpl.java:
 359 in 
org.apache.cloudstack.storage.template.DownloadManagerImpl.postRemoteDownload(java.lang.String)()
353 
354 if (td.getFileExtension().equalsIgnoreCase("QCOW2")) {
355 // The QCOW2 is the only format with a header,
356 // and as such can be easily read.
357 
358 try {
>>> CID 1324347:  Null pointer dereferences  (NULL_RETURNS)
>>> Assigning: "inputStream" = null return value from 
>>> "com.cloud.storage.template.S3TemplateDownloader.getS3ObjectInputStream()".
359 InputStream inputStream = td.getS3ObjectInputStream();
360 
361 
dnld.setTemplatesize(QCOW2Utils.getVirtualSize(inputStream));
362 
363 inputStream.close();
364 }

** CID 1324349:  Null pointer dereferences  (FORWARD_NULL)
/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java:
 242 in 
org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl.createVolumeAsyncCallback(org.apache.cloudstack.framework.async.AsyncCallbackDispatcher,
 org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl$CreateContext)()



*** CID 1324349:  Null pointer dereferences  (FORWARD_NULL)
/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java:
 242 in 
org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl.createVolumeAsyncCallback(org.apache.cloudstack.framework.async.AsyncCallbackDispatcher,
 org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl$CreateContext)()
236 answer.getDownloadStatus() == 
VMTemplateStorageResourceAssoc.Status.ABANDONED || answer.getDownloadStatus() 
== VMTemplateStorageResourceAssoc.Status.UNKNOWN) {
237 CreateCmdResult result = new CreateCmdResult(null, null);
238 result.setSuccess(false);
239 result.setResult(answer.getErrorString());
240 caller.complete(result);
241 String msg = "Failed to upload volume: " + obj.getUuid() + 
" with error: " + answer.getErrorString();
>>> CID 1324349:  Null pointer dereferences  (FORWARD_NULL)
>>> Calling a method on null object "volStoreVO".
242 
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_UPLOAD_FAILED, 
volStoreVO.getZoneId(), null, msg, msg);
243 s_logger.error(msg);
244 } else if (answer.getDownloadStatus() == 
VMTemplateStorageResourceAssoc.Status.DOWNLOADED) {
245 CreateCmdResult result = new CreateCmdResult(null, null);
246 caller.complete(result);
247 }

** CID 1324350:  FindBugs: Bad practice  
(FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
/agent/src/com/cloud/agent/Agent.java: 767 in 
com.cloud.agent.Agent$WatchTask.runInContext()()



*** CID 1324350:  FindBugs: Bad practice  
(FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
/agent/src/com/cloud/agent/Agent.java: 767 in 
com.cloud.agent.Agent$WatchTask.runInContext()()
761 protected void runInContext() {
762 if (s_logger.isTraceEnabled()) {
763 s_logger.trace("Scheduling " + (_request instanceof 
Response ? "Ping" : "Watch Task"));
764 }
765 try {
766 if (_request instanceof Response) {
>>> CID 1324350:  FindBugs: Bad practice  
>>> (FB.RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)
>>> exceptional return value of 
>>> java.util.concurrent.AbstractExecutorService.submit(Callable) ignored
767 _ugentTaskPool.submit(new 
ServerHandler(Task.Type.OTHER, _link, _request));
768 } else {
769 _link.schedule(new ServerHandler(Task.Type.OTHER, 
_link, _request));
770 }
771 } catch (final ClosedChannelException e) {
772 

New Defects reported by Coverity Scan for cloudstack

2015-09-07 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

1 new defect(s) introduced to cloudstack found with Coverity Scan.
1 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1323172:  Null pointer dereferences  (NULL_RETURNS)
/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java:
 412 in 
org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.revertSnapshot(org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo)()



*** CID 1323172:  Null pointer dereferences  (NULL_RETURNS)
/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java:
 412 in 
org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl.revertSnapshot(org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo)()
406 
407 }
408 
409 @Override
410 public boolean revertSnapshot(SnapshotInfo snapshot) {
411 SnapshotInfo snapshotOnPrimaryStore = 
_snapshotFactory.getSnapshot(snapshot.getId(), DataStoreRole.Primary);
>>> CID 1323172:  Null pointer dereferences  (NULL_RETURNS)
>>> Calling a method on null object "snapshotOnPrimaryStore".
412 PrimaryDataStore store = 
(PrimaryDataStore)snapshotOnPrimaryStore.getDataStore();
413 
414 AsyncCallFuture future = new 
AsyncCallFuture();
415 RevertSnapshotContext context = new 
RevertSnapshotContext(null, snapshot, future);
416 AsyncCallbackDispatcher 
caller = AsyncCallbackDispatcher.create(this);
417 
caller.setCallback(caller.getTarget().revertSnapshotCallback(null, 
null)).setContext(context);



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/cloudstack?tab=overview

To manage Coverity Scan email notifications for "dev@cloudstack.apache.org", 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-08-31 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

3 new defect(s) introduced to cloudstack found with Coverity Scan.
2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 3 of 3 defect(s)


** CID 1320908:  FindBugs: Dodgy code  (FB.BC_VACUOUS_INSTANCEOF)
/server/src/com/cloud/vm/UserVmManagerImpl.java: 2194 in 
com.cloud.vm.UserVmManagerImpl.updateVirtualMachine(org.apache.cloudstack.api.command.user.vm.UpdateVMCmd)()



*** CID 1320908:  FindBugs: Dodgy code  (FB.BC_VACUOUS_INSTANCEOF)
/server/src/com/cloud/vm/UserVmManagerImpl.java: 2194 in 
com.cloud.vm.UserVmManagerImpl.updateVirtualMachine(org.apache.cloudstack.api.command.user.vm.UpdateVMCmd)()
2188 }
2189 
2190 if (details != null && !details.isEmpty()) {
2191 _vmDao.loadDetails(vmInstance);
2192 
2193 for(Map.Entry entry : details.entrySet()) {
>>> CID 1320908:  FindBugs: Dodgy code  (FB.BC_VACUOUS_INSTANCEOF)
>>> instanceof will always return true for all nonnull values, since all 
>>> java.util.Map$Entry are instances of 
>>> java.util.Map$Entry
2194 if(entry instanceof Map.Entry) {
2195 vmInstance.setDetail(entry.getKey(), 
entry.getValue());
2196 }
2197 }
2198 _vmDao.saveDetails(vmInstance);
2199 }

** CID 1320905:  Null pointer dereferences  (NULL_RETURNS)
/utils/src/main/java/com/cloud/utils/net/NetUtils.java: 1267 in 
com.cloud.utils.net.NetUtils.getIp6FromRange(java.lang.String)()



*** CID 1320905:  Null pointer dereferences  (NULL_RETURNS)
/utils/src/main/java/com/cloud/utils/net/NetUtils.java: 1267 in 
com.cloud.utils.net.NetUtils.getIp6FromRange(java.lang.String)()
1261 // Can cover 127 bits
1262 public static String getIp6FromRange(final String ip6Range) {
1263 final String[] ips = ip6Range.split("-");
1264 final String startIp = ips[0];
1265 final IPv6Address start = IPv6Address.fromString(startIp);
1266 final BigInteger gap = countIp6InRange(ip6Range);
>>> CID 1320905:  Null pointer dereferences  (NULL_RETURNS)
>>> Calling a method on null object "gap".
1267 BigInteger next = new BigInteger(gap.bitLength(), s_rand);
1268 while (next.compareTo(gap) >= 0) {
1269 next = new BigInteger(gap.bitLength(), s_rand);
1270 }
1271 InetAddress resultAddr = null;
1272 final BigInteger startInt = 
convertIPv6AddressToBigInteger(start);

** CID 1320904:  Null pointer dereferences  (NULL_RETURNS)
/utils/src/main/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtil.java:
 53 in 
org.apache.cloudstack.utils.imagestore.ImageStoreUtil.checkTemplateFormat(java.lang.String,
 java.lang.String)()



*** CID 1320904:  Null pointer dereferences  (NULL_RETURNS)
/utils/src/main/java/org/apache/cloudstack/utils/imagestore/ImageStoreUtil.java:
 53 in 
org.apache.cloudstack.utils.imagestore.ImageStoreUtil.checkTemplateFormat(java.lang.String,
 java.lang.String)()
47 if (isCompressedExtension(uripath)) {
48 command = "file -z ";
49 }
50 String output = Script.runSimpleBashScript(command + path + " | 
cut -d: -f2", 6);
51 
52 // vmdk
>>> CID 1320904:  Null pointer dereferences  (NULL_RETURNS)
>>> Calling a method on null object "output".
53 if ((output.contains("VMware") || output.contains("data")) && 
isCorrectExtension(uripath, "vmdk")) {
54 s_logger.debug("File at path " + path + " looks like a 
vmware image :" + output);
55 return "";
56 }
57 // raw
58 if ((output.contains("x86 boot") || output.contains("data")) && 
(isCorrectExtension(uripath, "raw") || isCorrectExtension(uripath, "img"))) {



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/cloudstack?tab=overview

To manage Coverity Scan email notifications for "dev@cloudstack.apache.org", 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-08-10 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

17 new defect(s) introduced to cloudstack found with Coverity Scan.
55 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 17 of 17 defect(s)


** CID 1114596:  Class hierarchy inconsistencies  (CALL_SUPER)
/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java: 475 in 
com.cloud.bridge.io.DimeDelimitedInputStream.close()()



*** CID 1114596:  Class hierarchy inconsistencies  (CALL_SUPER)
/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java: 475 in 
com.cloud.bridge.io.DimeDelimitedInputStream.close()()
469  * This will take care of flushing any remaining data to the stream.
470  * Multiple calls to this method will result in the stream being 
closed once
471  * and then all subsequent calls being ignored.
472  *
473  * @throws IOException if the stream could not be closed
474  */
 CID 1114596:  Class hierarchy inconsistencies  (CALL_SUPER)
 Missing call to java.io.FilterInputStream.close() (as is done 
 elsewhere 5 out of 7 times).
475 public void close() throws IOException {
476 synchronized (this) {
477 if (closed)
478 return;
479 closed = true;//mark it closed.
480 }

** CID 1315774:  Resource leaks  (RESOURCE_LEAK)
/framework/db/src/com/cloud/utils/db/DbUtil.java: 257 in 
com.cloud.utils.db.DbUtil.releaseGlobalLock(java.lang.String)()



*** CID 1315774:  Resource leaks  (RESOURCE_LEAK)
/framework/db/src/com/cloud/utils/db/DbUtil.java: 257 in 
com.cloud.utils.db.DbUtil.releaseGlobalLock(java.lang.String)()
251 } catch (Throwable e) {
252 s_logger.error(RELEASE_LOCK() throws exception , e);
253 } finally {
254 closeResultSet(rs);
255 closeStatement(pstmt);
256 closeConnection(conn);
 CID 1315774:  Resource leaks  (RESOURCE_LEAK)
 Variable pstmt going out of scope leaks the resource it refers to.
257 }
258 return false;
259 }
260 
261 public static void closeResources(final Connection connection, 
final Statement statement, final ResultSet resultSet) {
262 

** CID 1315775:(RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 51 in 
com.cloud.upgrade.dao.Upgrade30xBase.getNetworkLabelFromConfig(java.sql.Connection,
 java.lang.String)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 52 in 
com.cloud.upgrade.dao.Upgrade30xBase.getNetworkLabelFromConfig(java.sql.Connection,
 java.lang.String)()



*** CID 1315775:(RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 51 in 
com.cloud.upgrade.dao.Upgrade30xBase.getNetworkLabelFromConfig(java.sql.Connection,
 java.lang.String)()
45 }
46 } catch (SQLException e) {
47 throw new CloudRuntimeException(Unable to fetch network 
label from configuration, e);
48 } finally {
49 closeAutoCloseable(rs);
50 closeAutoCloseable(pstmt);
 CID 1315775:(RESOURCE_LEAK)
 Variable pstmt going out of scope leaks the resource it refers to.
51 }
52 return networkLabel;
53 }
54 
55 protected long addPhysicalNetworkToZone(Connection conn, long 
zoneId, String zoneName, String networkType, String vnet, Long domainId) {
56 
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 52 in 
com.cloud.upgrade.dao.Upgrade30xBase.getNetworkLabelFromConfig(java.sql.Connection,
 java.lang.String)()
46 } catch (SQLException e) {
47 throw new CloudRuntimeException(Unable to fetch network 
label from configuration, e);
48 } finally {
49 closeAutoCloseable(rs);
50 closeAutoCloseable(pstmt);
51 }
 CID 1315775:(RESOURCE_LEAK)
 Variable pstmt going out of scope leaks the resource it refers to.
52 return networkLabel;
53 }
54 
55 protected long addPhysicalNetworkToZone(Connection conn, long 
zoneId, String zoneName, String networkType, String vnet, Long domainId) {
56 
57 String getNextNetworkSequenceSql = SELECT value from 
`cloud`.`sequence` where name='physical_networks_seq';

** CID 1315776:  Exceptional resource leaks  (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 135 in 

New Defects reported by Coverity Scan for cloudstack

2015-07-20 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

2 new defect(s) introduced to cloudstack found with Coverity Scan.
11 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1312009:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java: 938 in 
com.cloud.consoleproxy.ConsoleProxyManagerImpl.allocCapacity(long)()



*** CID 1312009:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java: 938 in 
com.cloud.consoleproxy.ConsoleProxyManagerImpl.allocCapacity(long)()
932 
933 if (consoleProxyVmFromStoppedPool) {
934 destroyProxy(proxyVmId);
935 }
936 }
937 }
 CID 1312009:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
 Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
 for Exception
938 } catch (Exception e) {
939errorString = e.getMessage();
940throw e;
941 } finally {
942 // TODO - For now put all the alerts as creation failure. 
Distinguish between creation vs start failure in future.
943 // Also add failure reason since startvm masks some of them.

** CID 1312010:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java:
 230 in 
org.apache.cloudstack.storage.cache.manager.StorageCacheManagerImpl.createCacheObject(org.apache.cloudstack.engine.subsystem.api.storage.DataObject,
 org.apache.cloudstack.engine.subsystem.api.storage.DataStore)()



*** CID 1312010:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
/engine/storage/cache/src/org/apache/cloudstack/storage/cache/manager/StorageCacheManagerImpl.java:
 230 in 
org.apache.cloudstack.storage.cache.manager.StorageCacheManagerImpl.createCacheObject(org.apache.cloudstack.engine.subsystem.api.storage.DataObject,
 org.apache.cloudstack.engine.subsystem.api.storage.DataStore)()
224 @Override
225 public DataObject createCacheObject(DataObject data, DataStore 
store) {
226 DataObject objOnCacheStore = null;
227 final Object lock;
228 final DataObjectType type = data.getType();
229 final String typeName;
 CID 1312010:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
 Dead store to role
230 final DataStoreRole role = store.getRole();
231 final long storeId = store.getId();
232 final long dataId = data.getId();
233 
234 /*
235  * Make sure any thread knows own lock type.



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for dev@cloudstack.apache.org, 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.orgtoken=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-07-13 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

3 new defect(s) introduced to cloudstack found with Coverity Scan.
32 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 3 of 3 defect(s)


** CID 1311706:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
 5378 in 
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.AttachConfigDriveToMigratedVm(com.xensource.xenapi.Connection,
 java.lang.String, java.lang.String)()



*** CID 1311706:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
 5378 in 
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.AttachConfigDriveToMigratedVm(com.xensource.xenapi.Connection,
 java.lang.String, java.lang.String)()
5372 break;
5373 
5374 }
5375 
5376 return true;
5377 
 CID 1311706:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
 Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
 for Exception
5378 }catch (Exception ex) {
5379 s_logger.debug(Failed to attach config drive ISO to the 
VM  + vmName +  In host  + ipAddr );
5380 return false;
5381 }
5382 
5383 }
5384 

** CID 1311707:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/framework/db/src/com/cloud/utils/db/SequenceFetcher.java: 159 in 
com.cloud.utils.db.SequenceFetcher$Fetcher.call()()



*** CID 1311707:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/framework/db/src/com/cloud/utils/db/SequenceFetcher.java: 159 in 
com.cloud.utils.db.SequenceFetcher$Fetcher.call()()
153 txn.commit();
154 return (T)obj;
155 } catch (SQLException e) {
156 s_logger.warn(Caught this exception when 
running:  + (updateStmt != null ? updateStmt.toString() : ), e);
157 }
158 }
 CID 1311707:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
 Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
 for Exception
159 } catch (Exception e) {
160 s_logger.warn(Caught this exception when running., e);
161 }
162 return null;
163 }
164 }

** CID 1311708:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java: 661 in 
com.cloud.vm.dao.UserVmDaoImpl.getVmsDetailByNames(java.util.Set, 
java.lang.String)()



*** CID 1311708:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java: 661 in 
com.cloud.vm.dao.UserVmDaoImpl.getVmsDetailByNames(java.util.Set, 
java.lang.String)()
655 new PairLong, 
String(rs.getLong(vm_instance.id), rs.getString(user_vm_details.value;
656 }
657 } catch (Exception e) {
658 s_logger.error(GetVmsDetailsByNames: Exception:  + 
e.getMessage());
659 throw new CloudRuntimeException(GetVmsDetailsByNames: 
Exception:  + e.getMessage());
660 }
 CID 1311708:  FindBugs: Dodgy code  (FB.REC_CATCH_EXCEPTION)
 Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
 for Exception
661 } catch (Exception e) {
662 s_logger.error(GetVmsDetailsByNames: Exception in sql:  + 
e.getMessage());
663 throw new CloudRuntimeException(GetVmsDetailsByNames: 
Exception:  + e.getMessage());
664 }
665 
666 return vmsDetailByNames;
667 }



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for dev@cloudstack.apache.org, 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.orgtoken=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-07-07 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

2 new defect(s) introduced to cloudstack found with Coverity Scan.
3 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1310067:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/api/ApiResponseHelper.java: 2647 in 
com.cloud.api.ApiResponseHelper.createResourceTagResponse(com.cloud.server.ResourceTag,
 boolean)()



*** CID 1310067:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/api/ApiResponseHelper.java: 2647 in 
com.cloud.api.ApiResponseHelper.createResourceTagResponse(com.cloud.server.ResourceTag,
 boolean)()
2641 
response.setPortableipServiceEnabled(region.checkIfServiceEnabled(Region.Service.PortableIp));
2642 return response;
2643 }
2644 
2645 @Override
2646 public ResourceTagResponse createResourceTagResponse(ResourceTag 
resourceTag, boolean keyValueOnly) {
 CID 1310067:  Null pointer dereferences  (NULL_RETURNS)
 Assigning: rto = null return value from 
 com.cloud.api.ApiDBUtils.newResourceTagView(com.cloud.server.ResourceTag).
2647 ResourceTagJoinVO rto = 
ApiDBUtils.newResourceTagView(resourceTag);
2648 return ApiDBUtils.newResourceTagResponse(rto, keyValueOnly);
2649 }
2650 
2651 @Override
2652 public VpcOfferingResponse createVpcOfferingResponse(VpcOffering 
offering) {

** CID 1310072:(NULL_RETURNS)
/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java:
 221 in 
org.apache.cloudstack.saml.SAMLUtils.encodeSAMLRequest(org.opensaml.xml.XMLObject)()
/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java:
 221 in 
org.apache.cloudstack.saml.SAMLUtils.encodeSAMLRequest(org.opensaml.xml.XMLObject)()



*** CID 1310072:(NULL_RETURNS)
/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java:
 221 in 
org.apache.cloudstack.saml.SAMLUtils.encodeSAMLRequest(org.opensaml.xml.XMLObject)()
215 Deflater deflater = new Deflater(Deflater.DEFLATED, true);
216 ByteArrayOutputStream byteArrayOutputStream = new 
ByteArrayOutputStream();
217 DeflaterOutputStream deflaterOutputStream = new 
DeflaterOutputStream(byteArrayOutputStream, deflater);
218 
deflaterOutputStream.write(requestMessage.getBytes(Charset.forName(UTF-8)));
219 deflaterOutputStream.close();
220 String encodedRequestMessage = 
Base64.encodeBytes(byteArrayOutputStream.toByteArray(), 
Base64.DONT_BREAK_LINES);
 CID 1310072:(NULL_RETURNS)
 Dereferencing a pointer that might be null encodedRequestMessage when 
 calling java.net.URLEncoder.encode(java.lang.String, java.lang.String).
221 encodedRequestMessage = 
URLEncoder.encode(encodedRequestMessage, HttpUtils.UTF_8).trim();
222 return encodedRequestMessage;
223 }
224 
225 public static Response decodeSAMLResponse(String responseMessage)
226 throws ConfigurationException, ParserConfigurationException,
/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java:
 221 in 
org.apache.cloudstack.saml.SAMLUtils.encodeSAMLRequest(org.opensaml.xml.XMLObject)()
215 Deflater deflater = new Deflater(Deflater.DEFLATED, true);
216 ByteArrayOutputStream byteArrayOutputStream = new 
ByteArrayOutputStream();
217 DeflaterOutputStream deflaterOutputStream = new 
DeflaterOutputStream(byteArrayOutputStream, deflater);
218 
deflaterOutputStream.write(requestMessage.getBytes(Charset.forName(UTF-8)));
219 deflaterOutputStream.close();
220 String encodedRequestMessage = 
Base64.encodeBytes(byteArrayOutputStream.toByteArray(), 
Base64.DONT_BREAK_LINES);
 CID 1310072:(NULL_RETURNS)
 Dereferencing a pointer that might be null encodedRequestMessage when 
 calling java.net.URLEncoder.encode(java.lang.String, java.lang.String).
221 encodedRequestMessage = 
URLEncoder.encode(encodedRequestMessage, HttpUtils.UTF_8).trim();
222 return encodedRequestMessage;
223 }
224 
225 public static Response decodeSAMLResponse(String responseMessage)
226 throws ConfigurationException, ParserConfigurationException,



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for 

New Defects reported by Coverity Scan for cloudstack

2015-07-07 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

2 new defect(s) introduced to cloudstack found with Coverity Scan.
3 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1310067:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/api/ApiResponseHelper.java: 2647 in 
com.cloud.api.ApiResponseHelper.createResourceTagResponse(com.cloud.server.ResourceTag,
 boolean)()



*** CID 1310067:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/api/ApiResponseHelper.java: 2647 in 
com.cloud.api.ApiResponseHelper.createResourceTagResponse(com.cloud.server.ResourceTag,
 boolean)()
2641 
response.setPortableipServiceEnabled(region.checkIfServiceEnabled(Region.Service.PortableIp));
2642 return response;
2643 }
2644 
2645 @Override
2646 public ResourceTagResponse createResourceTagResponse(ResourceTag 
resourceTag, boolean keyValueOnly) {
 CID 1310067:  Null pointer dereferences  (NULL_RETURNS)
 Assigning: rto = null return value from 
 com.cloud.api.ApiDBUtils.newResourceTagView(com.cloud.server.ResourceTag).
2647 ResourceTagJoinVO rto = 
ApiDBUtils.newResourceTagView(resourceTag);
2648 return ApiDBUtils.newResourceTagResponse(rto, keyValueOnly);
2649 }
2650 
2651 @Override
2652 public VpcOfferingResponse createVpcOfferingResponse(VpcOffering 
offering) {

** CID 1310072:(NULL_RETURNS)
/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java:
 221 in 
org.apache.cloudstack.saml.SAMLUtils.encodeSAMLRequest(org.opensaml.xml.XMLObject)()
/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java:
 221 in 
org.apache.cloudstack.saml.SAMLUtils.encodeSAMLRequest(org.opensaml.xml.XMLObject)()



*** CID 1310072:(NULL_RETURNS)
/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java:
 221 in 
org.apache.cloudstack.saml.SAMLUtils.encodeSAMLRequest(org.opensaml.xml.XMLObject)()
215 Deflater deflater = new Deflater(Deflater.DEFLATED, true);
216 ByteArrayOutputStream byteArrayOutputStream = new 
ByteArrayOutputStream();
217 DeflaterOutputStream deflaterOutputStream = new 
DeflaterOutputStream(byteArrayOutputStream, deflater);
218 
deflaterOutputStream.write(requestMessage.getBytes(Charset.forName(UTF-8)));
219 deflaterOutputStream.close();
220 String encodedRequestMessage = 
Base64.encodeBytes(byteArrayOutputStream.toByteArray(), 
Base64.DONT_BREAK_LINES);
 CID 1310072:(NULL_RETURNS)
 Dereferencing a pointer that might be null encodedRequestMessage when 
 calling java.net.URLEncoder.encode(java.lang.String, java.lang.String).
221 encodedRequestMessage = 
URLEncoder.encode(encodedRequestMessage, HttpUtils.UTF_8).trim();
222 return encodedRequestMessage;
223 }
224 
225 public static Response decodeSAMLResponse(String responseMessage)
226 throws ConfigurationException, ParserConfigurationException,
/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAMLUtils.java:
 221 in 
org.apache.cloudstack.saml.SAMLUtils.encodeSAMLRequest(org.opensaml.xml.XMLObject)()
215 Deflater deflater = new Deflater(Deflater.DEFLATED, true);
216 ByteArrayOutputStream byteArrayOutputStream = new 
ByteArrayOutputStream();
217 DeflaterOutputStream deflaterOutputStream = new 
DeflaterOutputStream(byteArrayOutputStream, deflater);
218 
deflaterOutputStream.write(requestMessage.getBytes(Charset.forName(UTF-8)));
219 deflaterOutputStream.close();
220 String encodedRequestMessage = 
Base64.encodeBytes(byteArrayOutputStream.toByteArray(), 
Base64.DONT_BREAK_LINES);
 CID 1310072:(NULL_RETURNS)
 Dereferencing a pointer that might be null encodedRequestMessage when 
 calling java.net.URLEncoder.encode(java.lang.String, java.lang.String).
221 encodedRequestMessage = 
URLEncoder.encode(encodedRequestMessage, HttpUtils.UTF_8).trim();
222 return encodedRequestMessage;
223 }
224 
225 public static Response decodeSAMLResponse(String responseMessage)
226 throws ConfigurationException, ParserConfigurationException,



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for 

New Defects reported by Coverity Scan for cloudstack

2015-06-29 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

2 new defect(s) introduced to cloudstack found with Coverity Scan.
9 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1308939:  FindBugs: Bad practice  (FB.NP_BOOLEAN_RETURN_NULL)
/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java:
 43 in 
org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd.getBootable()()



*** CID 1308939:  FindBugs: Bad practice  (FB.NP_BOOLEAN_RETURN_NULL)
/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java:
 43 in 
org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd.getBootable()()
37 /
38 /// Accessors ///
39 /
40 
41 @Override
42 public Boolean getBootable() {
 CID 1308939:  FindBugs: Bad practice  (FB.NP_BOOLEAN_RETURN_NULL)
 
 org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd.getBootable()
  has Boolean return type and returns explicit null
43 return null;
44 }
45 
46 /
47 /// API Implementation///
48 /

** CID 1308940:  FindBugs: Bad practice  (FB.NP_BOOLEAN_RETURN_NULL)
/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java: 48 in 
org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd.getPasswordEnabled()()



*** CID 1308940:  FindBugs: Bad practice  (FB.NP_BOOLEAN_RETURN_NULL)
/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java: 48 in 
org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd.getPasswordEnabled()()
42 public Boolean getRequiresHvm() {
43 return null;
44 }
45 
46 @Override
47 public Boolean getPasswordEnabled() {
 CID 1308940:  FindBugs: Bad practice  (FB.NP_BOOLEAN_RETURN_NULL)
 
 org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd.getPasswordEnabled()
  has Boolean return type and returns explicit null
48 return null;
49 }
50 
51 @Override
52 public String getFormat() {
53 return null;



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for dev@cloudstack.apache.org, 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.orgtoken=494aabd5ba647999fa41b6d766646231



New Defects reported by Coverity Scan for cloudstack

2015-06-02 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

35 new defect(s) introduced to cloudstack found with Coverity Scan.
13 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 35 defect(s)


** CID 1302946:  Null pointer dereferences  (REVERSE_INULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixCreateVMSnapshotCommandWrapper.java:
 107 in 
com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixCreateVMSnapshotCommandWrapper.execute(com.cloud.agent.api.CreateVMSnapshotCommand,
 com.cloud.hypervisor.xenserver.resource.CitrixResourceBase)()



*** CID 1302946:  Null pointer dereferences  (REVERSE_INULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixCreateVMSnapshotCommandWrapper.java:
 107 in 
com.cloud.hypervisor.xenserver.resource.wrapper.xenbase.CitrixCreateVMSnapshotCommandWrapper.execute(com.cloud.agent.api.CreateVMSnapshotCommand,
 com.cloud.hypervisor.xenserver.resource.CitrixResourceBase)()
101 } catch (final Exception e) {
102 if (!snapshotMemory) {
103 vm = citrixResourceBase.createWorkingVM(conn, 
vmName, guestOSType, platformEmulator, listVolumeTo);
104 }
105 }
106 
 CID 1302946:  Null pointer dereferences  (REVERSE_INULL)
 Null-checking vm suggests that it may be null, but it has already 
 been dereferenced on all paths leading to the check.
107 if (vm == null) {
108 return new CreateVMSnapshotAnswer(command, false, 
Creating VM Snapshot Failed due to can not find vm:  + vmName);
109 }
110 
111 // call Xenserver API
112 if (!snapshotMemory) {

** CID 1302947:  Resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/MemStat.java: 57 
in org.apache.cloudstack.utils.linux.MemStat.refresh()()



*** CID 1302947:  Resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/MemStat.java: 57 
in org.apache.cloudstack.utils.linux.MemStat.refresh()()
51 }
52 
53 public void refresh() {
54 try {
55 Scanner fileScanner = new Scanner(new File(MEMINFO_FILE));
56 parseFromScanner(fileScanner);
 CID 1302947:  Resource leaks  (RESOURCE_LEAK)
 Variable fileScanner going out of scope leaks the resource it refers 
 to.
57 } catch (FileNotFoundException ex) {
58 throw new RuntimeException(File  + MEMINFO_FILE +  not 
found: + ex.toString());
59 }
60 }
61 
62 protected void parseFromScanner(Scanner scanner) {

** CID 1302948:  Exceptional resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
 5029 in 
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVmdataFiles(java.lang.String,
 java.util.List, java.lang.String)()



*** CID 1302948:  Exceptional resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
 5029 in 
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.createVmdataFiles(java.lang.String,
 java.util.List, java.lang.String)()
5023 
5024 if (result  content != null  
!content.isEmpty()) {
5025 try {
5026 File file = new 
File(folder+/+fileName+.txt);
5027 FileWriter fw = new 
FileWriter(file.getAbsoluteFile());
5028 BufferedWriter bw = new 
BufferedWriter(fw);
 CID 1302948:  Exceptional resource leaks  (RESOURCE_LEAK)
 Variable fw going out of scope leaks the resource it refers to.
5029 bw.write(content);
5030 bw.close();
5031 s_logger.debug(created file: + file 
+  in folder:+folder);
5032 } catch (IOException ex) {
5033 s_logger.debug(Failed to create file 
+ ex.getMessage());
5034 return false;

** CID 1302949:  Resource leaks  (RESOURCE_LEAK)
/plugins/hypervisors/kvm/src/org/apache/cloudstack/utils/linux/CPUStat.java: 56 
in 

New Defects reported by Coverity Scan for cloudstack

2015-05-08 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

300 new defect(s) introduced to cloudstack found with Coverity Scan.
70 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 300 defect(s)


** CID 1012179:  FindBugs: Dodgy code  (FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)
/plugins/hypervisors/ovm/src/com/cloud/ovm/object/Test.java: 79 in ()



*** CID 1012179:  FindBugs: Dodgy code  
(FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)
/plugins/hypervisors/ovm/src/com/cloud/ovm/object/Test.java: 79 in ()
73 vm.disks.add(dataDisk);
74 vm.disks.add(dataDisk);
75 vm.disks.add(dataDisk);
76 OvmVif.Details vif = new OvmVif.Details();
77 vif.mac = 00:ff:ff:ff:ff:ee;
78 vif.bridge = xenbr0;
 CID 1012179:  FindBugs: Dodgy code  
 (FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)
 Unread public/protected field: com.cloud.ovm.object.OvmVif$Details.type
79 vif.type = OvmVif.NETFRONT;
80 vm.vifs.add(vif);
81 vm.vifs.add(vif);
82 vm.vifs.add(vif);
83 vm.vifs.add(vif);
84 vm.vifs.add(vif);

** CID 1114588:  Concurrent data access violations  (ATOMICITY)
/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyGCThread.java:
 80 in com.cloud.consoleproxy.ConsoleProxyGCThread.run()()



*** CID 1114588:  Concurrent data access violations  (ATOMICITY)
/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyGCThread.java:
 80 in com.cloud.consoleproxy.ConsoleProxyGCThread.run()()
74 EnumerationString e = connMap.keys();
75 while (e.hasMoreElements()) {
76 String key;
77 ConsoleProxyClient client;
78 
79 synchronized (connMap) {
 CID 1114588:  Concurrent data access violations  (ATOMICITY)
 Using an unreliable value of e inside the second locked section. If 
 the data that e depends on was changed by another thread, this use might 
 be incorrect.
80 key = e.nextElement();
81 client = connMap.get(key);
82 }
83 
84 long seconds_unused = (System.currentTimeMillis() - 
client.getClientLastFrontEndActivityTime()) / 1000;
85 if (seconds_unused  MAX_SESSION_IDLE_SECONDS) {

** CID 1114589:  Concurrent data access violations  (ATOMICITY)
/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientStatsCollector.java:
 58 in 
com.cloud.consoleproxy.ConsoleProxyClientStatsCollector.setConnections(java.util.Hashtable)()



*** CID 1114589:  Concurrent data access violations  (ATOMICITY)
/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientStatsCollector.java:
 58 in 
com.cloud.consoleproxy.ConsoleProxyClientStatsCollector.setConnections(java.util.Hashtable)()
52 private void setConnections(HashtableString, ConsoleProxyClient 
connMap) {
53 
54 ArrayListConsoleProxyConnection conns = new 
ArrayListConsoleProxyConnection();
55 EnumerationString e = connMap.keys();
56 while (e.hasMoreElements()) {
57 synchronized (connMap) {
 CID 1114589:  Concurrent data access violations  (ATOMICITY)
 Using an unreliable value of e inside the second locked section. If 
 the data that e depends on was changed by another thread, this use might 
 be incorrect.
58 String key = e.nextElement();
59 ConsoleProxyClient client = connMap.get(key);
60 
61 ConsoleProxyConnection conn = new 
ConsoleProxyConnection();
62 
63 conn.id = client.getClientId();

** CID 1114594:  Class hierarchy inconsistencies  (CALL_SUPER)
/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java: 
284 in 
com.cloud.hypervisor.kvm.discoverer.LibvirtServerDiscoverer.configure(java.lang.String,
 java.util.Map)()



*** CID 1114594:  Class hierarchy inconsistencies  (CALL_SUPER)
/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java: 
284 in 
com.cloud.hypervisor.kvm.discoverer.LibvirtServerDiscoverer.configure(java.lang.String,
 java.util.Map)()
278 } else {
279 return null;
280 }
281 }
282 
283 

New Defects reported by Coverity Scan for cloudstack

2015-03-16 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

47 new defect(s) introduced to cloudstack found with Coverity Scan.
590 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 47 defect(s)


** CID 1288552:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/network/NetworkUsageManagerImpl.java: 147 in 
com.cloud.network.NetworkUsageManagerImpl.addTrafficMonitor(org.apache.cloudstack.api.command.admin.usage.AddTrafficMonitorCmd)()



*** CID 1288552:  Null pointer dereferences  (NULL_RETURNS)
/server/src/com/cloud/network/NetworkUsageManagerImpl.java: 147 in 
com.cloud.network.NetworkUsageManagerImpl.addTrafficMonitor(org.apache.cloudstack.api.command.admin.usage.AddTrafficMonitorCmd)()
141 throw new InvalidParameterValueException(Could not find 
zone with ID:  + zoneId);
142 } else {
143 zoneName = zone.getName();
144 }
145 
146 ListHostVO trafficMonitorsInZone = 
_resourceMgr.listAllHostsInOneZoneByType(Host.Type.TrafficMonitor, zoneId);
 CID 1288552:  Null pointer dereferences  (NULL_RETURNS)
 Calling a method on null object trafficMonitorsInZone.
147 if (trafficMonitorsInZone.size() != 0) {
148 throw new InvalidParameterValueException(Already added an 
traffic monitor in zone:  + zoneName);
149 }
150 
151 URI uri;
152 try {



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for dev@cloudstack.apache.org, 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.orgtoken=494aabd5ba647999fa41b6d766646231
 .



New Defects reported by Coverity Scan for cloudstack

2015-02-23 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

1 new defect(s) introduced to cloudstack found with Coverity Scan.
1 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1271073:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
 1913 in 
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.execute(com.cloud.agent.api.storage.ResizeVolumeCommand)()



*** CID 1271073:  Null pointer dereferences  (NULL_RETURNS)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
 1913 in 
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.execute(com.cloud.agent.api.storage.ResizeVolumeCommand)()
1907 resizecmd.add(-t, type);
1908 resizecmd.add(-r, String.valueOf(shrinkOk));
1909 resizecmd.add(-v, vmInstanceName);
1910 String result = resizecmd.execute();
1911 
1912 if (result != null) {
 CID 1271073:  Null pointer dereferences  (NULL_RETURNS)
 Calling a method on null object type.
1913 if(type.equals(notifyOnlyType)) {
1914 return new ResizeVolumeAnswer(cmd, true, Resize 
succeeded, but need reboot to notify guest);
1915 } else {
1916 return new ResizeVolumeAnswer(cmd, false, result);
1917 }
1918 }



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for dev@cloudstack.apache.org, 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.orgtoken=494aabd5ba647999fa41b6d766646231
 .



New Defects reported by Coverity Scan for cloudstack

2015-01-26 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

1 new defect(s) introduced to cloudstack found with Coverity Scan.
2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1267242:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java:
 575 in 
org.apache.cloudstack.storage.datastore.driver.SolidFirePrimaryDataStoreDriver.takeSnapshot(org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo,
 org.apache.cloudstack.framework.async.AsyncCompletionCallback)()



*** CID 1267242:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFirePrimaryDataStoreDriver.java:
 575 in 
org.apache.cloudstack.storage.datastore.driver.SolidFirePrimaryDataStoreDriver.takeSnapshot(org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo,
 org.apache.cloudstack.framework.async.AsyncCompletionCallback)()
569 CreateObjectAnswer createObjectAnswer = new 
CreateObjectAnswer(snapshotObjectTo);
570 
571 result = new CreateCmdResult(null, createObjectAnswer);
572 
573 result.setResult(null);
574 }
 CID 1267242:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
 Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
 for Exception
575 catch (Exception ex) {
576 s_logger.debug(SolidFireUtil.LOG_PREFIX + Failed to take 
CloudStack snapshot:  + snapshotInfo.getId(), ex);
577 
578 result = new CreateCmdResult(null, new 
CreateObjectAnswer(ex.toString()));
579 
580 result.setResult(ex.toString());



To view the defects in Coverity Scan visit, 
https://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for dev@cloudstack.apache.org, 
click 
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.orgtoken=494aabd5ba647999fa41b6d766646231
 .



New Defects reported by Coverity Scan for cloudstack

2015-01-19 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

1 new defect(s) introduced to cloudstack found with Coverity Scan.
2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1264632:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/utils/src/com/cloud/utils/ConstantTimeComparator.java: 37 in 
com.cloud.utils.ConstantTimeComparator.compareStrings(java.lang.String, 
java.lang.String)()



*** CID 1264632:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/utils/src/com/cloud/utils/ConstantTimeComparator.java: 37 in 
com.cloud.utils.ConstantTimeComparator.compareStrings(java.lang.String, 
java.lang.String)()
31 result |= b1[i] ^ b2[i];
32 }
33 return result == 0;
34 }
35 
36 public static boolean compareStrings(String s1, String s2) {
 CID 1264632:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
 Found reliance on default encoding: String.getBytes()
37 return compareBytes(s1.getBytes(), s2.getBytes());
38 }



To view the defects in Coverity Scan visit, 
http://scan.coverity.com/projects/943?tab=overview

To manage Coverity Scan email notifications for dev@cloudstack.apache.org, 
click 
http://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.orgtoken=494aabd5ba647999fa41b6d766646231
 .



New Defects reported by Coverity Scan for cloudstack

2015-01-12 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

17 new defect(s) introduced to cloudstack found with Coverity Scan.
9 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 17 of 17 defect(s)


** CID 1115476:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115475:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115478:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115464:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115438:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115437:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115922:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115921:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115919:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1115075:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1116418:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/template/TemplateManagerImpl.java: 1387 in 
com.cloud.template.TemplateManagerImpl.createPrivateTemplate(org.apache.cloudstack.api.command.user.template.CreateTemplateCmd)()

** CID 1116368:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/template/TemplateManagerImpl.java: 1036 in 
com.cloud.template.TemplateManagerImpl.attachISOToVM(long, long, boolean)()

** CID 1125350:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1153007:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1191675:  Explicit null dereferenced  (FORWARD_NULL)

** CID 1194809:  Dereference null return value  (NULL_RETURNS)
/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java:
 45 in 
org.apache.cloudstack.framework.ws.jackson.CSJacksonAnnotationIntrospector.findSerializer(com.fasterxml.jackson.databind.introspect.Annotated)()

** CID 1233058:  Explicit null dereferenced  (FORWARD_NULL)



*** CID 1115476:  Explicit null dereferenced  (FORWARD_NULL)
/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java:
 868 in 
org.apache.cloudstack.storage.volume.VolumeServiceImpl.copyVolumeFromImageToPrimary(org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo,
 org.apache.cloudstack.engine.subsystem.api.storage.DataStore)()
862 destVolume = (VolumeInfo)destStore.create(srcVolume);
863 destVolume.processEvent(Event.CopyingRequested);
864 srcVolume.processEvent(Event.CopyingRequested);
865 
866 CopyVolumeContextVolumeApiResult context = new 
CopyVolumeContextVolumeApiResult(null, future, srcVolume, destVolume, 
destStore);
867 AsyncCallbackDispatcherVolumeServiceImpl, 
CopyCommandResult caller = AsyncCallbackDispatcher.create(this);
 CID 1115476:  Explicit null dereferenced  (FORWARD_NULL)
 Passing null to function 
 org.apache.cloudstack.storage.volume.VolumeServiceImpl.copyVolumeFromImageToPrimaryCallback(org.apache.cloudstack.framework.async.AsyncCallbackDispatcher,
  
 org.apache.cloudstack.storage.volume.VolumeServiceImpl.CopyVolumeContext), 
 which dereferences it.
868 
caller.setCallback(caller.getTarget().copyVolumeFromImageToPrimaryCallback(null,
 null)).setContext(context);
869 
870 motionSrv.copyAsync(srcVolume, destVolume, caller);
871 return future;
872 } catch (Exception e) {
873 s_logger.error(failed to copy volume from image store, e);


*** CID 1115475:  Explicit null dereferenced  (FORWARD_NULL)
/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java:
 923 in 
org.apache.cloudstack.storage.volume.VolumeServiceImpl.copyVolumeFromPrimaryToImage(org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo,
 org.apache.cloudstack.engine.subsystem.api.storage.DataStore)()
917 destVolume = (VolumeInfo)destStore.create(srcVolume);
918 srcVolume.processEvent(Event.MigrationRequested);// 
this is just used for locking that src volume record in DB to avoid using lock
919 destVolume.processEventOnly(Event.CreateOnlyRequested);
920 
921 CopyVolumeContextVolumeApiResult context = new 
CopyVolumeContextVolumeApiResult(null, future, srcVolume, destVolume, 
destStore);
922 AsyncCallbackDispatcherVolumeServiceImpl, 
CopyCommandResult caller = AsyncCallbackDispatcher.create(this);
 CID 1115475:  Explicit null dereferenced  (FORWARD_NULL)
 Passing null to function 
 

New Defects reported by Coverity Scan for cloudstack

2015-01-05 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

6 new defect(s) introduced to cloudstack found with Coverity Scan.
17 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 6 of 6 defect(s)


** CID 1261671:  Dereference after null check  (FORWARD_NULL)
/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java: 150 in 
com.cloud.domain.dao.DomainDaoImpl.remove(java.lang.Long)()

** CID 1261670:  Dereference after null check  (FORWARD_NULL)
/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java:
 193 in 
org.apache.cloudstack.storage.motion.AncientDataMotionStrategy.copyObject(org.apache.cloudstack.engine.subsystem.api.storage.DataObject,
 org.apache.cloudstack.engine.subsystem.api.storage.DataObject, 
com.cloud.host.Host)()

** CID 1261669:  Dereference after null check  (FORWARD_NULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
 4247 in 
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getHostInfo(com.xensource.xenapi.Connection)()

** CID 1261667:  Dereference null return value  (NULL_RETURNS)

** CID 1261668:  Dereference null return value  (NULL_RETURNS)

** CID 1261666:  Dereference null return value  (NULL_RETURNS)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java:
 164 in 
com.cloud.hypervisor.xenserver.discoverer.XcpServerDiscoverer.poolHasHotFix(com.xensource.xenapi.Connection,
 java.lang.String, java.lang.String)()



*** CID 1261671:  Dereference after null check  (FORWARD_NULL)
/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java: 150 in 
com.cloud.domain.dao.DomainDaoImpl.remove(java.lang.Long)()
144 }
145 
146 @Override
147 @DB
148 public boolean remove(Long id) {
149 // check for any active users / domains assigned to the given 
domain id and don't remove the domain if there are any
 CID 1261671:  Dereference after null check  (FORWARD_NULL)
 Comparing id to null implies that id might be null.
150 if (id != null  id.longValue() == Domain.ROOT_DOMAIN) {
151 s_logger.error(Can not remove domain  + id +  as it is 
ROOT domain);
152 return false;
153 }
154 
155 DomainVO domain = findById(id);


*** CID 1261670:  Dereference after null check  (FORWARD_NULL)
/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java:
 193 in 
org.apache.cloudstack.storage.motion.AncientDataMotionStrategy.copyObject(org.apache.cloudstack.engine.subsystem.api.storage.DataObject,
 org.apache.cloudstack.engine.subsystem.api.storage.DataObject, 
com.cloud.host.Host)()
187, uuid:  + cacheUuid + ));
188 cacheMgr.deleteCacheObject(srcForCopy);
189 } else {
190 // for template, we want to leave it on cache for 
performance reason
191 if ((answer == null || !answer.getResult())  
srcForCopy.getRefCount()  2) {
192 // cache object created by this copy, not 
already there
 CID 1261670:  Dereference after null check  (FORWARD_NULL)
 Calling a method on null object ep.
193 s_logger.warn(Copy may not be handled 
correctly by agent(id:  + ep.getId() + ). +
194Delete  + cacheType +  
cache(id:  + cacheId +
195   , uuid:  + cacheUuid + ));
196 cacheMgr.deleteCacheObject(srcForCopy);
197 } else {
198 s_logger.debug(Decrease reference count of  + 
cacheType +


*** CID 1261669:  Dereference after null check  (FORWARD_NULL)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java:
 4247 in 
com.cloud.hypervisor.xenserver.resource.CitrixResourceBase.getHostInfo(com.xensource.xenapi.Connection)()
4241 throw new CloudRuntimeException(Cannot get the 
numbers of cpu from XenServer host  + _host.ip);
4242 }
4243 MapString, String cpuInfo = myself.getCpuInfo(conn);
4244 if (cpuInfo.get(socket_count) != null) {
4245 _host.cpuSockets = 
Integer.parseInt(cpuInfo.get(socket_count));
4246 }
 CID 1261669:  Dereference after null check  

New Defects reported by Coverity Scan for cloudstack

2014-12-29 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

3 new defect(s) introduced to cloudstack found with Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 3 of 3 defect(s)


** CID 1260703:  RC: Questionable use of reference equality rather than calling 
equals  (FB.RC_REF_COMPARISON)
/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java: 1764 in 
com.cloud.vm.VirtualMachineManagerImpl.orchestrateStorageMigration(java.lang.String,
 com.cloud.storage.StoragePool)()

** CID 1260702:  Dereference null return value  (NULL_RETURNS)
/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java:
 100 in 
org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd.execute()()

** CID 1260701:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java: 2277 in 
com.cloud.network.lb.LoadBalancingRulesManagerImpl.searchForLBHealthCheckPolicies(org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd)()



*** CID 1260703:  RC: Questionable use of reference equality rather than 
calling equals  (FB.RC_REF_COMPARISON)
/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java: 1764 in 
com.cloud.vm.VirtualMachineManagerImpl.orchestrateStorageMigration(java.lang.String,
 com.cloud.storage.StoragePool)()
1758 vm.setPodIdToDeployIn(destPool.getPodId());
1759 
1760 // If VM was cold migrated between clusters belonging 
to two different VMware DCs,
1761 // unregister the VM from the source host and cleanup 
the associated VM files.
1762 if 
(vm.getHypervisorType().equals(HypervisorType.VMware)) {
1763 Long destClusterId = destPool.getClusterId();
 CID 1260703:  RC: Questionable use of reference equality rather than 
 calling equals  (FB.RC_REF_COMPARISON)
 Suspicious comparison of Long references
1764 if (srcClusterId != null  destClusterId != null 
 srcClusterId != destClusterId) {
1765 String srcDcName = 
_clusterDetailsDao.getVmwareDcName(srcClusterId);
1766 String destDcName = 
_clusterDetailsDao.getVmwareDcName(destClusterId);
1767 if (srcDcName != null  destDcName != null  
!srcDcName.equals(destDcName)) {
1768 s_logger.debug(Since VM's storage was 
successfully migrated across VMware Datacenters, unregistering VM:  + 
vm.getInstanceName() +
1769  from source host:  + 
srcHost.getId());


*** CID 1260702:  Dereference null return value  (NULL_RETURNS)
/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBHealthCheckPoliciesCmd.java:
 100 in 
org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd.execute()()
94 lbRuleId = _lbService.findLBIdByHealtCheckPolicyId(hId);
95 } else {
96 throw new InvalidParameterValueException(Either LB 
Ruleid or HealthCheckpolicy Id should be specified);
97 }
98 }
99 
 CID 1260702:  Dereference null return value  (NULL_RETURNS)
 Unboxing null object lbRuleId.
100 LoadBalancer lb = _lbService.findById(lbRuleId);
101 if (lb != null) {
102 List? extends HealthCheckPolicy healthCheckPolicies = 
_lbService.searchForLBHealthCheckPolicies(this);
103 LBHealthCheckResponse spResponse = 
_responseGenerator.createLBHealthCheckPolicyResponse(healthCheckPolicies, lb);
104 hcpResponses.add(spResponse);
105 response.setResponses(hcpResponses);


*** CID 1260701:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java: 2277 in 
com.cloud.network.lb.LoadBalancingRulesManagerImpl.searchForLBHealthCheckPolicies(org.apache.cloudstack.api.command.user.loadbalancer.ListLBHealthCheckPoliciesCmd)()
2271 LoadBalancerVO loadBalancer = _lbDao.findById(loadBalancerId);
2272 if (loadBalancer == null) {
2273 return null;
2274 }
2275 
2276 _accountMgr.checkAccess(caller, null, true, loadBalancer);
 CID 1260701:  Dereference null return value  (NULL_RETURNS)
 Unboxing null object loadBalancerId.
2277 ListLBHealthCheckPolicyVO hcDbpolicies = 
_lb2healthcheckDao.listByLoadBalancerIdAndDisplayFlag(loadBalancerId, 
forDisplay);
2278 

New Defects reported by Coverity Scan for cloudstack

2014-12-15 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

5 new defect(s) introduced to cloudstack found with Coverity Scan.
2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 5 of 5 defect(s)


** CID 1258460:  RC: Questionable use of reference equality rather than calling 
equals  (FB.RC_REF_COMPARISON)
/server/src/com/cloud/network/rules/RulesManagerImpl.java: 1530 in 
com.cloud.network.rules.RulesManagerImpl.updatePortForwardingRule(long, 
java.lang.Integer, java.lang.Long, com.cloud.utils.net.Ip, java.lang.String, 
java.lang.Boolean)()

** CID 1258459:  UPM: Private method is never called  
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2672 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(com.cloud.vm.VmWorkExtractVolume)()

** CID 1258458:  UrF: Unread field  (FB.URF_UNREAD_FIELD)
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 70 in ()
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 78 in ()
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 74 in ()

** CID 1258457:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/server/ManagementServerImpl.java: 3614 in 
com.cloud.server.ManagementServerImpl.registerSSHKeyPair(org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd)()

** CID 1258456:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2127 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(long, long)()
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2102 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(long, long)()



*** CID 1258460:  RC: Questionable use of reference equality rather than 
calling equals  (FB.RC_REF_COMPARISON)
/server/src/com/cloud/network/rules/RulesManagerImpl.java: 1530 in 
com.cloud.network.rules.RulesManagerImpl.updatePortForwardingRule(long, 
java.lang.Integer, java.lang.Long, com.cloud.utils.net.Ip, java.lang.String, 
java.lang.Boolean)()
1524 }
1525 
1526 if (forDisplay != null) {
1527 rule.setDisplay(forDisplay);
1528 }
1529 
 CID 1258460:  RC: Questionable use of reference equality rather than 
 calling equals  (FB.RC_REF_COMPARISON)
 Suspicious comparison of Integer references
1530 if (rule.getSourcePortStart() != rule.getSourcePortEnd()  
privatePort != null) {
1531 throw new InvalidParameterValueException(Unable to update 
the private port of port forwarding rule as  the rule has port range :  + 
rule.getSourcePortStart() +  to  + rule.getSourcePortEnd());
1532 }
1533 if (virtualMachineId == null  vmGuestIp != null) {
1534 throw new InvalidParameterValueException(vmguestip should 
be set along with virtualmachineid);
1535 }


*** CID 1258459:  UPM: Private method is never called  
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2672 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(com.cloud.vm.VmWorkExtractVolume)()
2666 
AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(workJob.getId());
2667 
2668 return new VmJobSnapshotOutcome(workJob,snapshotId);
2669 }
2670 
2671 @ReflectionUse
 CID 1258459:  UPM: Private method is never called  
 (FB.UPM_UNCALLED_PRIVATE_METHOD)
 Private method 
 com.cloud.storage.VolumeApiServiceImpl.orchestrateExtractVolume(VmWorkExtractVolume)
  is never called
2672 private PairJobInfo.Status, String 
orchestrateExtractVolume(VmWorkExtractVolume work) throws Exception {
2673 String volUrl = orchestrateExtractVolume(work.getVolumeId(), 
work.getZoneId());
2674 return new PairJobInfo.Status, 
String(JobInfo.Status.SUCCEEDED, _jobMgr.marshallResultObject(volUrl));
2675 }
2676 
2677 @ReflectionUse


*** CID 1258458:  UrF: Unread field  (FB.URF_UNREAD_FIELD)
/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java: 70 in ()
64 
65 public void setFingerprint(String fingerprint) {
66 this.fingerprint = fingerprint;
67 }
68 
69 public void setAccountName(String accountName) {
 CID 1258458:  UrF: Unread field  (FB.URF_UNREAD_FIELD)
 Unread field: 
 org.apache.cloudstack.api.response.SSHKeyPairResponse.accountName
70 this.accountName = 

New Defects reported by Coverity Scan for cloudstack

2014-12-08 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

7 new defect(s) introduced to cloudstack found with Coverity Scan.
8 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 7 of 7 defect(s)


** CID 1257440:  Logically dead code  (DEADCODE)
/server/src/com/cloud/configuration/ConfigurationManagerImpl.java: 2575 in 
com.cloud.configuration.ConfigurationManagerImpl.deleteDiskOffering(org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd)()

** CID 1257439:  Bx: Questionable Boxing of primitive value  
(FB.BX_UNBOXING_IMMEDIATELY_REBOXED)
/server/src/com/cloud/api/query/dao/DomainJoinDaoImpl.java: 131 in 
com.cloud.api.query.dao.DomainJoinDaoImpl.setResourceLimits(com.cloud.api.query.vo.DomainJoinVO,
 boolean, org.apache.cloudstack.api.response.ResourceLimitAndCountResponse)()

** CID 1257438:  Bx: Questionable Boxing of primitive value  
(FB.BX_BOXING_IMMEDIATELY_UNBOXED)
/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java: 1107 in 
com.cloud.storage.snapshot.SnapshotManagerImpl.allocSnapshot(java.lang.Long, 
java.lang.Long, java.lang.String)()

** CID 1257437:  Logically dead code  (DEADCODE)
/server/src/com/cloud/configuration/ConfigurationManagerImpl.java: 2488 in 
com.cloud.configuration.ConfigurationManagerImpl.updateDiskOffering(org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd)()

** CID 1257436:  Dereference null return value  (NULL_RETURNS)
/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java:
 725 in 
org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource.registerTemplateOnSwift(org.apache.cloudstack.storage.command.DownloadCommand)()

** CID 1257435:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java:
 734 in 
org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource.registerTemplateOnSwift(org.apache.cloudstack.storage.command.DownloadCommand)()

** CID 1257434:  Resource leak  (RESOURCE_LEAK)
/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java:
 743 in 
org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource.registerTemplateOnSwift(org.apache.cloudstack.storage.command.DownloadCommand)()



*** CID 1257440:  Logically dead code  (DEADCODE)
/server/src/com/cloud/configuration/ConfigurationManagerImpl.java: 2575 in 
com.cloud.configuration.ConfigurationManagerImpl.deleteDiskOffering(org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd)()
2569 if (offering == null) {
2570 throw new InvalidParameterValueException(Unable to find 
disk offering by id  + diskOfferingId);
2571 }
2572 
2573 Long userId = CallContext.current().getCallingUserId();
2574 if (userId == null) {
 CID 1257440:  Logically dead code  (DEADCODE)
 Execution cannot reach this statement userId = java.lang.Long.val
2575 userId = Long.valueOf(User.UID_SYSTEM);
2576 }
2577 User user = _userDao.findById(userId);
2578 if (user == null || user.getRemoved() != null) {
2579 throw new InvalidParameterValueException(Unable to find 
active user by id  + userId);
2580 }


*** CID 1257439:  Bx: Questionable Boxing of primitive value  
(FB.BX_UNBOXING_IMMEDIATELY_REBOXED)
/server/src/com/cloud/api/query/dao/DomainJoinDaoImpl.java: 131 in 
com.cloud.api.query.dao.DomainJoinDaoImpl.setResourceLimits(com.cloud.api.query.vo.DomainJoinVO,
 boolean, org.apache.cloudstack.api.response.ResourceLimitAndCountResponse)()
125 response.setSnapshotLimit(snapshotLimitDisplay);
126 response.setSnapshotTotal(snapshotTotal);
127 response.setSnapshotAvailable(snapshotAvail);
128 
129 Long templateLimit = 
ApiDBUtils.findCorrectResourceLimitForDomain(domain.getTemplateLimit(), 
fullView, ResourceType.template, domain.getId());
130 String templateLimitDisplay = (fullView || templateLimit == -1) 
? Unlimited : String.valueOf(templateLimit);
 CID 1257439:  Bx: Questionable Boxing of primitive value  
 (FB.BX_UNBOXING_IMMEDIATELY_REBOXED)
 Boxed value is unboxed and then immediately reboxed
131 Long templateTotal = (domain.getTemplateTotal() == null) ? 0 : 
domain.getTemplateTotal();
132 String templateAvail = (fullView || templateLimit == -1) ? 
Unlimited : String.valueOf(templateLimit - templateTotal);
133 

New Defects reported by Coverity Scan for cloudstack

2014-12-01 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

6 new defect(s) introduced to cloudstack found with Coverity Scan.
5 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent 
build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 6 of 6 defect(s)


** CID 1256278:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/server/src/com/cloud/user/AccountManagerImpl.java: 2061 in 
com.cloud.user.AccountManagerImpl.authenticateUser(java.lang.String, 
java.lang.String, java.lang.Long, java.net.InetAddress, java.util.Map)()
/server/src/com/cloud/user/AccountManagerImpl.java: 2057 in 
com.cloud.user.AccountManagerImpl.authenticateUser(java.lang.String, 
java.lang.String, java.lang.Long, java.net.InetAddress, java.util.Map)()
/server/src/com/cloud/user/AccountManagerImpl.java: 2059 in 
com.cloud.user.AccountManagerImpl.authenticateUser(java.lang.String, 
java.lang.String, java.lang.Long, java.net.InetAddress, java.util.Map)()

** CID 1256277:  SBSC: String concatenation in loop using + operator  
(FB.SBSC_USE_STRINGBUFFER_CONCATENATION)
/server/src/com/cloud/user/AccountManagerImpl.java: 2042 in 
com.cloud.user.AccountManagerImpl.authenticateUser(java.lang.String, 
java.lang.String, java.lang.Long, java.net.InetAddress, java.util.Map)()

** CID 1256276:  WMI: Inefficient Map Iterator  (FB.WMI_WRONG_MAP_ITERATOR)
/server/src/com/cloud/user/AccountManagerImpl.java: 2013 in 
com.cloud.user.AccountManagerImpl.authenticateUser(java.lang.String, 
java.lang.String, java.lang.Long, java.net.InetAddress, java.util.Map)()

** CID 1256275:  Resource leak  (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java: 237 in 
com.cloud.upgrade.dao.Upgrade442to450.updateSystemVmTemplates(java.sql.Connection)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java: 291 in 
com.cloud.upgrade.dao.Upgrade442to450.updateSystemVmTemplates(java.sql.Connection)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java: 266 in 
com.cloud.upgrade.dao.Upgrade442to450.updateSystemVmTemplates(java.sql.Connection)()

** CID 1256274:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java: 115 in 
com.cloud.upgrade.dao.Upgrade442to450.upgradeMemoryOfVirtualRoutervmOffering(java.sql.Connection)()

** CID 1256273:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java: 157 in 
com.cloud.upgrade.dao.Upgrade442to450.upgradeMemoryOfInternalLoadBalancervmOffering(java.sql.Connection)()



*** CID 1256278:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/server/src/com/cloud/user/AccountManagerImpl.java: 2061 in 
com.cloud.user.AccountManagerImpl.authenticateUser(java.lang.String, 
java.lang.String, java.lang.Long, java.net.InetAddress, java.util.Map)()
2055 
2056 Mac mac = Mac.getInstance(HmacSHA1);
2057 SecretKeySpec keySpec = new 
SecretKeySpec(key.getBytes(), HmacSHA1);
2058 mac.init(keySpec);
2059 mac.update(unsignedRequest.getBytes());
2060 byte[] encryptedBytes = mac.doFinal();
 CID 1256278:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
 Found reliance on default encoding: new String(byte[])
2061 String computedSignature = new 
String(Base64.encodeBase64(encryptedBytes));
2062 boolean equalSig = signature.equals(computedSignature);
2063 if (!equalSig) {
2064 s_logger.info(User signature:  + signature +  
is not equaled to computed signature:  + computedSignature);
2065 } else {
2066 user = _userAccountDao.getUserAccount(username, 
domainId);
/server/src/com/cloud/user/AccountManagerImpl.java: 2057 in 
com.cloud.user.AccountManagerImpl.authenticateUser(java.lang.String, 
java.lang.String, java.lang.Long, java.net.InetAddress, java.util.Map)()
2051 return null;
2052 }
2053 
2054 unsignedRequest = unsignedRequest.toLowerCase();
2055 
2056 Mac mac = Mac.getInstance(HmacSHA1);
 CID 1256278:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
 Found reliance on default encoding: String.getBytes()
2057 SecretKeySpec keySpec = new 
SecretKeySpec(key.getBytes(), HmacSHA1);
2058 mac.init(keySpec);
2059 mac.update(unsignedRequest.getBytes());
2060 byte[] encryptedBytes = mac.doFinal();
2061 String computedSignature = new 
String(Base64.encodeBase64(encryptedBytes));
2062 boolean equalSig = signature.equals(computedSignature);

New Defects reported by Coverity Scan for cloudstack

2014-11-24 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

9 new defect(s) introduced to cloudstack found with Coverity Scan.
22 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 9 of 9 defect(s)


** CID 1147101:  NP: Null pointer dereference  (FB.NP_BOOLEAN_RETURN_NULL)
/plugins/hypervisors/hyperv/src/com/cloud/ha/HypervInvestigator.java: 52 in 
com.cloud.ha.HypervInvestigator.isVmAlive(com.cloud.vm.VirtualMachine, 
com.cloud.host.Host)()

** CID 1255922:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java: 85 in 
org.apache.cloudstack.utils.graphite.GraphiteClient.sendMetrics(java.util.Map, 
long)()

** CID 1255921:  UPM: Private method is never called  
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2566 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateAttachVolumeToVM(com.cloud.vm.VmWorkAttachVolume)()

** CID 1255920:  UPM: Private method is never called  
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2589 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateMigrateVolume(com.cloud.vm.VmWorkMigrateVolume)()

** CID 1255919:  UPM: Private method is never called  
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2581 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateResizeVolume(com.cloud.vm.VmWorkResizeVolume)()

** CID 1255918:  UPM: Private method is never called  
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2596 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateTakeVolumeSnapshot(com.cloud.vm.VmWorkTakeVolumeSnapshot)()

** CID 1255917:  UPM: Private method is never called  
(FB.UPM_UNCALLED_PRIVATE_METHOD)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2574 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateDetachVolumeFromVM(com.cloud.vm.VmWorkDetachVolume)()

** CID 1255916:  Dereference null return value  (NULL_RETURNS)
/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java:
 1422 in 
org.apache.cloudstack.engine.orchestration.VolumeOrchestrator.cleanupStorageJobs()()
/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java:
 1425 in 
org.apache.cloudstack.engine.orchestration.VolumeOrchestrator.cleanupStorageJobs()()
/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java:
 1428 in 
org.apache.cloudstack.engine.orchestration.VolumeOrchestrator.cleanupStorageJobs()()

** CID 1255915:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/storage/VolumeApiServiceImpl.java: 2591 in 
com.cloud.storage.VolumeApiServiceImpl.orchestrateMigrateVolume(com.cloud.vm.VmWorkMigrateVolume)()



*** CID 1147101:  NP: Null pointer dereference  (FB.NP_BOOLEAN_RETURN_NULL)
/plugins/hypervisors/hyperv/src/com/cloud/ha/HypervInvestigator.java: 52 in 
com.cloud.ha.HypervInvestigator.isVmAlive(com.cloud.vm.VirtualMachine, 
com.cloud.host.Host)()
46 @Override
47 public Boolean isVmAlive(com.cloud.vm.VirtualMachine vm, Host host) {
48 Status status = isAgentAlive(host);
49 if (status == null) {
50 return null;
51 }
 CID 1147101:  NP: Null pointer dereference  (FB.NP_BOOLEAN_RETURN_NULL)
 Another occurrence here
52 return status == Status.Up ? true : null;
53 }
54 
55 @Override
56 public Status isAgentAlive(Host agent) {
57 if (agent.getHypervisorType() != 
Hypervisor.HypervisorType.Hyperv) {


*** CID 1255922:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java: 85 in 
org.apache.cloudstack.utils.graphite.GraphiteClient.sendMetrics(java.util.Map, 
long)()
79  */
80 public void sendMetrics(MapString, Integer metrics, long 
timeStamp) {
81 try (DatagramSocket sock = new DatagramSocket()){
82 InetAddress addr = InetAddress.getByName(this.graphiteHost);
83 
84 for (Map.EntryString, Integer metric: metrics.entrySet()) {
 CID 1255922:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
 Found reliance on default encoding: String.getBytes()
85 byte[] message = new String(metric.getKey() +   + 
metric.getValue() +   + timeStamp + \n).getBytes();
86 DatagramPacket packet = new DatagramPacket(message, 
message.length, addr, graphitePort);
87 sock.send(packet);

New Defects reported by Coverity Scan for cloudstack

2014-11-17 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

11 new defect(s) introduced to cloudstack found with Coverity Scan.
18 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 11 of 11 defect(s)


** CID 1254843:  Copy-paste error  (COPY_PASTE_ERROR)
/server/src/com/cloud/capacity/CapacityManagerImpl.java: 712 in 
com.cloud.capacity.CapacityManagerImpl.updateCapacityForHost(com.cloud.host.Host)()

** CID 1254842:  Bx: Questionable Boxing of primitive value  
(FB.BX_UNBOXING_IMMEDIATELY_REBOXED)
/server/src/com/cloud/network/NetworkServiceImpl.java: 1409 in 
com.cloud.network.NetworkServiceImpl.commitNetwork(java.lang.Long, 
java.lang.String, java.lang.String, java.lang.String, java.lang.String, 
java.lang.String, java.lang.String, java.lang.String, java.lang.String, 
com.cloud.user.Account, java.lang.Long, java.lang.Long, java.lang.Long, 
boolean, java.lang.Boolean, java.lang.Long, java.lang.String, java.lang.String, 
java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Long, 
java.lang.String, com.cloud.offerings.NetworkOfferingVO, 
com.cloud.network.PhysicalNetwork, 
org.apache.cloudstack.acl.ControlledEntity$ACLType, com.cloud.user.Account, 
java.lang.String, boolean)()

** CID 1254841:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java: 
2577 in 
com.cloud.network.router.VirtualNetworkApplianceManagerImpl.postStateTransitionEvent(com.cloud.utils.fsm.StateMachine2$Transition,
 com.cloud.vm.VirtualMachine, boolean, java.lang.Object)()

** CID 1254840:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java:
 1054 in 
com.cloud.hypervisor.xenserver.resource.Xenserver625StorageProcessor.createTemplateFromSnapshot2(org.apache.cloudstack.storage.command.CopyCommand)()

** CID 1254839:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java: 86 in 
org.apache.cloudstack.graphite.GraphiteClient.sendMetrics(java.util.Map, long)()

** CID 1254838:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java:
 1102 in 
com.cloud.hypervisor.xenserver.resource.Xenserver625StorageProcessor.createTemplateFromSnapshot2(org.apache.cloudstack.storage.command.CopyCommand)()

** CID 1254837:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/server/src/com/cloud/server/StatsCollector.java: 515 in 
com.cloud.server.StatsCollector$VmStatsCollector.runInContext()()

** CID 1254835:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 63 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 69 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 80 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 91 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 110 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 121 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 135 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()

** CID 1254834:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 62 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 68 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 78 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 92 in 

New Defects reported by Coverity Scan for cloudstack

2014-11-10 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

2 new defect(s) introduced to cloudstack found with Coverity Scan.
16 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1251370:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java:
 1559 in 
com.cloud.hypervisor.xenserver.resource.XenServerStorageProcessor.createTemplateFromSnapshot(org.apache.cloudstack.storage.command.CopyCommand)()

** CID 1251369:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java: 323 in 
com.cloud.storage.snapshot.SnapshotManagerImpl.createSnapshot(java.lang.Long, 
java.lang.Long, java.lang.Long, com.cloud.user.Account)()



*** CID 1251370:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java:
 1559 in 
com.cloud.hypervisor.xenserver.resource.XenServerStorageProcessor.createTemplateFromSnapshot(org.apache.cloudstack.storage.command.CopyCommand)()
1553 newTemplate.setPhysicalSize(physicalSize);
1554 newTemplate.setName(templateUuid);
1555 
1556 result = true;
1557 
1558 return new CopyCmdAnswer(newTemplate);
 CID 1251370:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
 Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
 for Exception
1559 } catch (Exception ex) {
1560 s_logger.error(Failed to create a template from a 
snapshot, ex);
1561 
1562 return new CopyCmdAnswer(Failed to create a template from 
a snapshot:  + ex.toString());
1563 } finally {
1564 if (!result) {


*** CID 1251369:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java: 323 in 
com.cloud.storage.snapshot.SnapshotManagerImpl.createSnapshot(java.lang.Long, 
java.lang.Long, java.lang.Long, com.cloud.user.Account)()
317 if(snapshot != null)
318 {
319 s_logger.debug(Failed to create snapshot);
320 throw new CloudRuntimeException(Failed to create 
snapshot);
321 }
322 try {
 CID 1251369:  Dereference after null check  (FORWARD_NULL)
 Calling a method on null object snapshot.
323 postCreateSnapshot(volumeId, snapshot.getId(), policyId);
324 //Check if the snapshot was removed while backingUp. If 
yes, do not log snapshot create usage event
325 SnapshotVO freshSnapshot = 
_snapshotDao.findById(snapshot.getId());
326 if (freshSnapshot != null)  {
327 
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, 
snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, 
snapshot.getName(),
328 null, null, volume.getSize(), 
snapshot.getClass().getName(), snapshot.getUuid());



To view the defects in Coverity Scan visit, 
http://scan.coverity.com/projects/943?tab=overview

To unsubscribe from the email notification for new defects, 
http://scan5.coverity.com/cgi-bin/unsubscribe.py





New Defects reported by Coverity Scan for cloudstack

2014-10-28 Thread scan-admin

Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

15 new defect(s) introduced to cloudstack found with Coverity Scan.
52 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 15 of 15 defect(s)


** CID 1249790:  Dereference after null check  (FORWARD_NULL)
/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java:
 993 in 
org.apache.cloudstack.secondarystorage.SecondaryStorageManagerImpl.destroySecStorageVm(long)()

** CID 1249792:  Explicit null dereferenced  (FORWARD_NULL)
/server/src/com/cloud/network/rules/DhcpSubNetRules.java: 142 in 
com.cloud.network.rules.DhcpSubNetRules.accept(org.apache.cloudstack.network.topology.NetworkTopologyVisitor,
 com.cloud.network.router.VirtualRouter)()

** CID 1249789:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/api/ApiResponseHelper.java: 508 in 
com.cloud.api.ApiResponseHelper.getDataStoreRole(com.cloud.storage.Snapshot)()

** CID 1249786:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/template/TemplateManagerImpl.java: 1486 in 
com.cloud.template.TemplateManagerImpl.getDataStoreRole(com.cloud.storage.Snapshot)()

** CID 1249793:  Dereference null return value  (NULL_RETURNS)
/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java:
 408 in 
org.apache.cloudstack.storage.snapshot.StorageSystemSnapshotStrategy.canHandle(com.cloud.storage.Snapshot,
 
org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy$SnapshotOperation)()

** CID 1249791:  Dereference null return value  (NULL_RETURNS)
/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java:
 118 in 
org.apache.cloudstack.api.command.user.firewall.DeleteEgressFirewallRuleCmd.getSyncObjId()()

** CID 1249787:  Dereference null return value  (NULL_RETURNS)
/server/src/com/cloud/network/router/VpcNetworkHelperImpl.java: 91 in 
com.cloud.network.router.VpcNetworkHelperImpl.createRouterNetworks(org.cloud.network.router.deployment.RouterDeploymentDefinition)()

** CID 1249800:  RE: Regular expressions  (FB.RE_POSSIBLE_UNINTENDED_PATTERN)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
 3614 in 
com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.getOsVersion()()

** CID 1249801:  ES: Checking String equality using == or !=  
(FB.ES_COMPARING_STRINGS_WITH_EQ)
/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java:
 221 in com.cloud.hypervisor.kvm.resource.LibvirtVMDef$FeaturesDef.toString()()

** CID 1249803:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java:
 933 in 
com.cloud.network.resource.NetscalerResource.execute(com.cloud.agent.api.routing.CreateLoadBalancerApplianceCommand,
 int)()

** CID 1249802:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java: 
1924 in 
com.cloud.network.router.VirtualNetworkApplianceManagerImpl.createDefaultEgressFirewallRule(java.util.List,
 long)()

** CID 1249796:  WMI: Inefficient Map Iterator  (FB.WMI_WRONG_MAP_ITERATOR)
/server/src/com/cloud/network/rules/NicPlugInOutRules.java: 97 in 
com.cloud.network.rules.NicPlugInOutRules.accept(org.apache.cloudstack.network.topology.NetworkTopologyVisitor,
 com.cloud.network.router.VirtualRouter)()

** CID 1249794:  UuF: Unused field  (FB.UUF_UNUSED_FIELD)
/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/util/SolidFireUtil.java:
 1620 in ()

** CID 1249798:  SIC: Inner class could be made static  
(FB.SIC_INNER_SHOULD_BE_STATIC)
/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java:
 154 in ()

** CID 1249797:  UrF: Unread field  (FB.URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD)
/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java:
 164 in ()



*** CID 1249790:  Dereference after null check  (FORWARD_NULL)
/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java:
 993 in 
org.apache.cloudstack.secondarystorage.SecondaryStorageManagerImpl.destroySecStorageVm(long)()


*** CID 1249792:  Explicit null dereferenced  (FORWARD_NULL)
/server/src/com/cloud/network/rules/DhcpSubNetRules.java: 142 in 
com.cloud.network.rules.DhcpSubNetRules.accept(org.apache.cloudstack.network.topology.NetworkTopologyVisitor,
 com.cloud.network.router.VirtualRouter)()
136 s_logger.info(unable to