Skip to content

Commit

Permalink
Merge branch 'GetLocatorUnsupportedOperation' into 'master'
Browse files Browse the repository at this point in the history
MediaPath#getLocator UnsupportedOperationException

See merge request exedio/copeconsole!91
  • Loading branch information
rw7 committed Aug 15, 2024
2 parents 808db3f + 1bd5cd9 commit fd3ad00
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/com/exedio/cope/console/Media.jspm
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ final class Media_Jspm
%>
<tr>
<td class="text"><%=item.getCopeID()%></td>
<td class="text"><% writeLocator(out, media.getLocator(item), mediaInline); %></td>
<td class="text"><% writeLocator(out, media, item, mediaInline); %></td>
<td class="text"><%if(contentType!=null){%><%=contentType%><%}%></td>
<td><%=media.getLastModified(item)%><%

Expand All @@ -268,7 +268,7 @@ final class Media_Jspm
if(other!=null)
{
%>
<td class="text"><% writeLocator(out, other.getLocator(item), otherInline); %></td><%
<td class="text"><% writeLocator(out, other, item, otherInline); %></td><%
}
%>
</tr><%
Expand All @@ -295,8 +295,18 @@ final class Media_Jspm
<input type="submit" value="touch"></input><%
}

private static void writeLocator(final Out out, final MediaPath.Locator locator, final boolean inline)
private static void writeLocator(final Out out, final MediaPath mediaPath, final Item item, final boolean inline)
{
final MediaPath.Locator locator;
try
{
locator = mediaPath.getLocator(item);
}
catch (final UnsupportedOperationException e)
{
%><%=e.getClass().getSimpleName()%>: <%=e.getMessage()%><%
return;
}
if(locator!=null)
{
final String contentType = locator.getContentType();
Expand Down

0 comments on commit fd3ad00

Please sign in to comment.