You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Hugo Trippaers <hu...@apache.org> on 2014/09/19 13:41:50 UTC

PrimaryStorageDownloadCommand question

Heya,

I’m looking at fixing a potential NPE in the PrimaryStorageDownloadCommand. When the constructor 'public PrimaryStorageDownloadCommand(String url, StoragePool pool, int wait) ‘ is used it calls 'super(null, url, null, null);’ which in the constructor unboxes the fourth parameter from a Long to a long. This would generate an NPE.

There is several easy fixes, but looking through the code i failed to find where this command is used. Can somebody shine a light on this, or is this class a relic from days gone by that we could remove.

CC Edison as he last touched this piece of code

Cheers,

Hugo

Re: PrimaryStorageDownloadCommand question

Posted by Mike Tutkowski <mi...@solidfire.com>.
In HypervDirectConnectResourceTest appears to be the only place in the
codebase where we actually make an instance of the
PrimaryStorageDownloadCommand (and, as the name of the class implies, it's
for testing purposes):

    private PrimaryStorageDownloadCommand samplePrimaryDownloadCommand() {

        String cmdJson =

            "{\"localPath\":" + s_testLocalStorePathJSON +
",\"poolUuid\":\"" + s_testLocalStoreUUID + "\",\"poolId\":201," +
"\"secondaryStorageUrl\":" +

                "\"nfs://10.70.176.36/mnt/cshv3/secondarystorage\"," +
"\"primaryStorageUrl\":" + "\"nfs://10.70.176.29E:\\\\Disks\\\\Disks\"," +
"\"url\":" +

                "\"nfs://
10.70.176.36/mnt/cshv3/secondarystorage/template/tmpl//2/204//af39aa7f-2b12-37e1-86d3-e23f2f005101.vhdx\
"," +

                "\"format\":\"VHDX\",\"accountId\":2," + "\"name\":" +
"\"204-2-5a1db1ac-932b-3e7e-a0e8-5684c72cb862\"" +
",\"contextMap\":{},\"wait\":10800}";

        PrimaryStorageDownloadCommand cmd = s_gson.fromJson(cmdJson,
PrimaryStorageDownloadCommand.class);

        return cmd;

    }

On Fri, Sep 19, 2014 at 5:41 AM, Hugo Trippaers <hu...@apache.org> wrote:

> Heya,
>
> I’m looking at fixing a potential NPE in the
> PrimaryStorageDownloadCommand. When the constructor 'public
> PrimaryStorageDownloadCommand(String url, StoragePool pool, int wait) ‘ is
> used it calls 'super(null, url, null, null);’ which in the constructor
> unboxes the fourth parameter from a Long to a long. This would generate an
> NPE.
>
> There is several easy fixes, but looking through the code i failed to find
> where this command is used. Can somebody shine a light on this, or is this
> class a relic from days gone by that we could remove.
>
> CC Edison as he last touched this piece of code
>
> Cheers,
>
> Hugo




-- 
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: mike.tutkowski@solidfire.com
o: 303.746.7302
Advancing the way the world uses the cloud
<http://solidfire.com/solution/overview/?video=play>*™*