Skip to content

Commit 985fb6b

Browse files
committed
WICKET-7024 javadoc + code cleanup
1 parent 692c257 commit 985fb6b

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java

+6-19
Original file line numberDiff line numberDiff line change
@@ -869,24 +869,19 @@ public PackageResource readBuffered(boolean readBuffered)
869869
return this;
870870
}
871871

872+
/**
873+
* @return UrlAttributes with an existent locale/style/variation if a resource is bound to the
874+
* scope+name
875+
*/
872876
public static ResourceReference.UrlAttributes sanitize(
873877
ResourceReference.UrlAttributes urlAttributes, Class<?> scope, String name)
874878
{
875879
IResourceStream filesystemMatch = getResourceStream(scope, name, urlAttributes.getLocale(),
876880
urlAttributes.getStyle(), urlAttributes.getVariation(), false);
877-
878881
if (filesystemMatch == null)
879882
{
880883
return urlAttributes;
881884
}
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-
890885
try
891886
{
892887
filesystemMatch.close();
@@ -895,16 +890,8 @@ public static ResourceReference.UrlAttributes sanitize(
895890
{
896891
log.error("failed to close", e);
897892
}
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());
908895
}
909896

910897
}

0 commit comments

Comments
 (0)