@@ -869,24 +869,19 @@ public PackageResource readBuffered(boolean readBuffered)
869
869
return this ;
870
870
}
871
871
872
+ /**
873
+ * @return UrlAttributes with an existent locale/style/variation if a resource is bound to the
874
+ * scope+name
875
+ */
872
876
public static ResourceReference .UrlAttributes sanitize (
873
877
ResourceReference .UrlAttributes urlAttributes , Class <?> scope , String name )
874
878
{
875
879
IResourceStream filesystemMatch = getResourceStream (scope , name , urlAttributes .getLocale (),
876
880
urlAttributes .getStyle (), urlAttributes .getVariation (), false );
877
-
878
881
if (filesystemMatch == null )
879
882
{
880
883
return urlAttributes ;
881
884
}
882
-
883
- ResourceReference .Key urlKey = new ResourceReference .Key (scope .getName (), name ,
884
- urlAttributes .getLocale (), urlAttributes .getStyle (), urlAttributes .getVariation ());
885
-
886
- ResourceReference .Key filesystemKey = new ResourceReference .Key (scope .getName (), name ,
887
- filesystemMatch .getLocale (), filesystemMatch .getStyle (),
888
- filesystemMatch .getVariation ());
889
-
890
885
try
891
886
{
892
887
filesystemMatch .close ();
@@ -895,16 +890,8 @@ public static ResourceReference.UrlAttributes sanitize(
895
890
{
896
891
log .error ("failed to close" , e );
897
892
}
898
-
899
- if (!urlKey .equals (filesystemKey ))
900
- {
901
- return new ResourceReference .UrlAttributes (filesystemKey .getLocale (),
902
- filesystemKey .getStyle (), filesystemKey .getVariation ());
903
- }
904
- else
905
- {
906
- return urlAttributes ;
907
- }
893
+ return new ResourceReference .UrlAttributes (filesystemMatch .getLocale (),
894
+ filesystemMatch .getStyle (), filesystemMatch .getVariation ());
908
895
}
909
896
910
897
}
0 commit comments