[fixed] NRE in ISO/Zip-ResourceAccessor (1 Viewer)

morpheus_xx

Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Accessing properties of an ISO/ZIP-ResourceAccessor can throw a NRE, because the underlying proxy object is disposed/set to null:

    Code:
    [2012-11-18 15:22:56,555] [2733063] [FanArt Downloader 0] [DEBUG] - MovieTheMovieDbMatcher Download: Finished saving banners for ID 4982
    [2012-11-18 15:22:57,740] [2734249] [Importer ] [ERROR] - MediaAccessor: Error extracting metadata from metadata extractor 'Movies thumbnail extractor' (Id: 'fb0aa0ed-97b2-4721-be74-ac67e77a17b2')
    System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
      bei MediaPortal.Extensions.ResourceProviders.IsoResourceProvider.IsoResourceAccessor.get_CanonicalLocalResourcePath()
      bei MediaPortal.Extensions.MetadataExtractors.MovieThumbnailer.MovieThumbnailer.TryExtractMetadata(IResourceAccessor mediaItemAccessor, IDictionary`2 extractedAspectData, Boolean forceQuickMode)
      bei MediaPortal.Common.Services.MediaManagement.MediaAccessor.ExtractMetadata(IResourceAccessor mediaItemAccessor, IEnumerable`1 metadataExtractors, Boolean forceQuickMode)

    Code:
        public bool TryExtractMetadata(IResourceAccessor mediaItemAccessor, IDictionary<Guid, MediaItemAspect> extractedAspectData, bool forceQuickMode)
        {
          try
          {
            if (forceQuickMode)
              return false;
     
            if (!(mediaItemAccessor is IFileSystemResourceAccessor))
              return false;
            using (IFileSystemResourceAccessor fsra = (IFileSystemResourceAccessor) mediaItemAccessor.Clone())
            using (ILocalFsResourceAccessor lfsra = StreamedResourceToLocalFsAccessBridge.GetLocalFsResourceAccessor(fsra))
              return ExtractThumbnail(lfsra, extractedAspectData);
          }
          catch (Exception e)
          {
            // Only log at the info level here - And simply return false. This lets the caller know that we
            // couldn't perform our task here.
            ServiceRegistration.Get<ILogger>().Info("MovieThumbnailer: Exception reading resource '{0}' (Text: '{1}')", mediaItemAccessor.CanonicalLocalResourcePath, e.Message);
          }
          return false;
        }

    The NRE occures when accessing properties like:

    Code:
        public ResourcePath CanonicalLocalResourcePath
        {
          get { return _isoProxy.IsoFileResourceAccessor.CanonicalLocalResourcePath.ChainUp(IsoResourceProvider.ISO_RESOURCE_PROVIDER_ID, _pathToDirOrFile); }
        }
    where _isoProxy is null already.

    This problem also occure from other places of Importer, not only from the MovieThumbnailerMDE above
     
    Last edited:

    Users who are viewing this thread

    Top Bottom