Skip to content

Commit

Permalink
Revert "Task-29069 : Display correct error message when a file is not…
Browse files Browse the repository at this point in the history
… more accessible - JCR part (#64)"

This reverts commit f981828.
  • Loading branch information
boubaker committed Dec 16, 2023
1 parent 281cc67 commit 09f6ebb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
Expand Down Expand Up @@ -1843,12 +1842,6 @@ protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry na
{
throw new RepositoryException(e);
}
catch (FileNotFoundException e)
{
LOG.error("Unable to read binary content from disk for node " + parent.getQPath() + ". The binary content is not "
+ "accessible, it was removed, or may have been quarantined by an antivirus.",e);
throw new RepositoryException(e);
}
catch (IOException e)
{
throw new RepositoryException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;

import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
Expand All @@ -59,7 +58,6 @@
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;

/**
Expand Down Expand Up @@ -172,17 +170,6 @@ else if (ifModifiedSince != null)
}
}

try {
resource.getProperty(new QName("jcr","data","jcr"));
} catch (RepositoryException exc) {
//it can fail here if the binary data is not available
//(due to data corruption or antivirus quarantine)
//In this case, we should display a readable message for the user
LOG.error(exc.getMessage(), exc);
String message = "The requested resource ("+path+") is no longer available. Please contact your administrator.";
return Response.status(HTTPStatus.NOT_FOUND).entity(message).build();
}

HierarchicalProperty contentLengthProperty = resource.getProperty(FileResource.GETCONTENTLENGTH);
long contentLength = new Long(contentLengthProperty.getValue());

Expand Down

0 comments on commit 09f6ebb

Please sign in to comment.