Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David H 9 posts 29 karma points
    Jul 02, 2012 @ 13:14
    David H
    0

    Saving a package with a CourierWebserviceRepositoryProvider gives error

    Hi all,

    Trying to develop quite a complex application to batch up some changes from one Umbraco installation and then apply them to another.

    The pulling part works fine, however when the saving starts I always get the following error:

    <Exception><ExceptionType>System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Object reference not set to an instance of an object.</Message><StackTrace>   at Umbraco.Courier.RepositoryProviders.CourierWebserviceRepositoryProvider.SaveResourceContents(ItemIdentifier itemId, Type itemType, Resource resource, String revisionAlias) in c:\Program Files (x86)\teamcity\buildAgent\work\2d3247b08adc3338\Umbraco.Courier.RepositoryProviders\WebserviceProvider\CourierWebserviceRepositoryProvider.cs:line 559

       at Umbraco.Courier.Core.Packaging.RevisionPackaging.‚&#x2;()

       at Umbraco.Courier.Core.Packaging.RevisionPackaging.Package()

    If I change the provider over to the local one then it works fine and since the issue is coming from inside Courier dll's I can't debug further without using a reflector, is this allowed with Courier?

    Does anyone have any light to shed on this? Or has anyone successfully used the CourierWebserviceRepositoryProvider to save a revision?

    Cheers

    Dave Hughes

     

  • Per Ploug 865 posts 3491 karma points MVP admin
    Jul 02, 2012 @ 15:31
    Per Ploug
    0

    Hi David

    Can you shed some light on what you are trying to do with the revision? maybe a code snippet?

    The Core is obfuscated and under a closed license, but the providers are all open source, and in our github repo: 

    https://github.com/umbraco/Courier/tree/master/Providers/Umbraco.Courier.RepositoryProviders

    which is probably easier then using reflector :)

     

  • David H 9 posts 29 karma points
    Jul 02, 2012 @ 16:02
    David H
    0

    Ah brilliant, the issue lies here on line 559 of CourierWebServiceRespository.cs:

    stringpath=repo.SaveResourceContents(itemId,itemType.ToString(),resource,revisionAlias,loginName,pass);

    The method that this is in is SaveResourceContents and it is called with a null value for the 2nd paramater.

    The above line then tries to do a .ToString() on the value which causes the null reference exception.

    As far as I can tell this happens everytime, I assume it's something to do with the manifest.xml file or the .couriercompare file as these are the only missing files from the revision folder.

    I put a conditional in to pass an empty string if the 2nd parameter is null and so far it seems to be working fine.

    Cheers

     


  • Per Ploug 865 posts 3491 karma points MVP admin
    Jul 03, 2012 @ 09:07
    Per Ploug
    0

    just went through the code, you can safely do that, as the type alias is not used anywhere when the resource is saved to disk

    Will put a fix in for 2.7 final

    /per

  • David H 9 posts 29 karma points
    Jul 03, 2012 @ 09:17
    David H
    0

    Thats brilliant, thanks for all your help! :)

Please Sign in or register to post replies

Write your reply to:

Draft