From 5db1494e85fb624f4f4208f315d3e7a0b49f058a Mon Sep 17 00:00:00 2001 From: jeb228 Date: Mon, 24 Jan 2011 21:40:08 +0000 Subject: [PATCH] NIHVIVO-1835 Guard against a File Bytestream individual whose AliasURL is the same as its URI. --- .../vitro/webapp/controller/EntityController.java | 9 ++++++++- .../controller/freemarker/IndividualController.java | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityController.java index 95875f9a6..df41562f3 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityController.java @@ -505,7 +505,14 @@ public class EntityController extends VitroHttpServlet { String url = fileInfo.getBytestreamAliasUrl(); log.debug("Alias URL for '" + entity.getURI() + "' is '" + url + "'"); - return url; + + if (entity.getURI().equals(url)) { + // Avoid a tight loop; if the alias URL is equal to the URI, then + // don't recognize it as a File Bytestream. + return null; + } else { + return url; + } } private Model getRDF(Individual entity, OntModel contextModel, Model newModel, int recurseDepth ) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java index da2bca154..e6487fcb8 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualController.java @@ -536,7 +536,14 @@ public class IndividualController extends FreemarkerHttpServlet { String url = fileInfo.getBytestreamAliasUrl(); log.debug("Alias URL for '" + entity.getURI() + "' is '" + url + "'"); - return url; + + if (entity.getURI().equals(url)) { + // Avoid a tight loop; if the alias URL is equal to the URI, then + // don't recognize it as a File Bytestream. + return null; + } else { + return url; + } } private Model getRDF(Individual entity, OntModel contextModel, Model newModel, int recurseDepth ) {