@@ -129,24 +129,31 @@ internal static void RemoveCapabilityAnnotations()
129129 /// </summary>
130130 internal static void AddLongDescriptionToThumbnail ( )
131131 {
132- // Thumbnail hack - add LongDescription annotation
133- XElement thumbnailComplexType = xMetadata . Descendants ( )
134- . Where ( x => ( string ) x . Name . LocalName == "ComplexType" )
135- . Where ( x => x . Attribute ( "Name" ) . Value == "thumbnail" )
136- . First ( ) ;
137-
138- if ( thumbnailComplexType != null )
132+ try
139133 {
140- // need to specify namespace so default xmlns="" isn't added that breaks VIPR
141- XElement thumbnailAnnotation = new XElement ( thumbnailComplexType . Name . Namespace + "Annotation" ) ;
134+ // Thumbnail hack - add LongDescription annotation
135+ XElement thumbnailComplexType = xMetadata . Descendants ( )
136+ . Where ( x => ( string ) x . Name . LocalName == "ComplexType" )
137+ . Where ( x => x . Attribute ( "Name" ) . Value == "thumbnail" )
138+ . First ( ) ;
139+
140+ if ( thumbnailComplexType != null )
141+ {
142+ // need to specify namespace so default xmlns="" isn't added that breaks VIPR
143+ XElement thumbnailAnnotation = new XElement ( thumbnailComplexType . Name . Namespace + "Annotation" ) ;
142144
143- thumbnailAnnotation . Add ( new XAttribute ( "Term" , "Org.OData.Core.V1.LongDescription" ) ) ;
144- thumbnailAnnotation . Add ( new XAttribute ( "String" , "navigable" ) ) ;
145- thumbnailComplexType . Add ( thumbnailAnnotation ) ;
145+ thumbnailAnnotation . Add ( new XAttribute ( "Term" , "Org.OData.Core.V1.LongDescription" ) ) ;
146+ thumbnailAnnotation . Add ( new XAttribute ( "String" , "navigable" ) ) ;
147+ thumbnailComplexType . Add ( thumbnailAnnotation ) ;
146148
147- Logger . Info ( "AddLongDescriptionToThumbnail rule was applied to the thumbnail complex type." ) ;
149+ Logger . Info ( "AddLongDescriptionToThumbnail rule was applied to the thumbnail complex type." ) ;
150+ }
151+ else
152+ {
153+ Logger . Error ( "AddLongDescriptionToThumbnail rule was not applied to the thumbnail complex type because the type wasn't found." ) ;
154+ }
148155 }
149- else
156+ catch ( InvalidOperationException )
150157 {
151158 Logger . Error ( "AddLongDescriptionToThumbnail rule was not applied to the thumbnail complex type because the type wasn't found." ) ;
152159 }
0 commit comments