Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fcrepo 1555 #810

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0bbe914
Replace fedora:Blanknode with fedora:Skolem in the code and in the on…
yinlinchen May 28, 2015
54ca813
swap out guava Optional for java8 Optional
acoburn Jun 1, 2015
e7bac73
remove guava splitter
acoburn Jun 1, 2015
2e8d537
removed guava Function
acoburn Jun 1, 2015
e05bbd5
remove guava Iterables for a java8 stream
acoburn Jun 1, 2015
bb4eee5
replace guava iterables with java8 streams
acoburn Jun 1, 2015
8734270
replace guava nullOrEmpty with Optional
acoburn Jun 1, 2015
8c5d397
replace guava transform with java8 stream map
acoburn Jun 1, 2015
a54ddff
replaced guava Predicate with java8 stream
acoburn Jun 2, 2015
c2ab828
remove guava Predicate in favor of java8 Stream API
acoburn Jun 2, 2015
78be702
removed RdfSerializationUtils class
acoburn Jun 2, 2015
6814fb7
modifications to improve the error msg for a GET-PUT-PUT operation (4…
Jun 2, 2015
aa47128
update PR after feedback from ajs6f
acoburn Jun 2, 2015
454a57f
import Collectors.toList statically
acoburn Jun 2, 2015
4f35aca
restore ternary operator
acoburn Jun 2, 2015
8b05d1b
REST GET-PUT-PUT operations should return a 409 error and an improved…
Jun 3, 2015
3ca6749
removed the logger imports used in testing
Jun 3, 2015
8f0b9dd
Thought i'd broken the project, but I hadn't. Minimal changes I think…
Jun 3, 2015
3c81f10
Code modifications based upon code review of http://github.com/fcrepo…
Jun 3, 2015
25f62f1
Merge pull request #809 from acoburn/fcrepo-1563
ajs6f Jun 4, 2015
e6b0305
Merge pull request #805 from yinlinchen/fcrepo-1394
ajs6f Jun 4, 2015
1a96fe7
Suggestion for not wrapping ServerManagedPropertyExceptions
Jun 4, 2015
7591601
FedoraEvent now mints internal UUID for downstream use
escowles Jun 4, 2015
17aa1d2
Using awoods work on non-wrapping ServerManagedPropertyExceptions, ma…
Jun 5, 2015
3d11cdb
Merge branch 'fcrepo-1555' of github.com:robyj/fcrepo4 into fcrepo-1555
Jun 6, 2015
7994f54
Merge pull request #1 from awoods/fcrepo-1555
robyj Sep 24, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import static java.util.regex.Pattern.compile;
import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static javax.ws.rs.core.Response.Status.CONFLICT;
import static javax.ws.rs.core.Response.Status.CREATED;
import static javax.ws.rs.core.Response.Status.NOT_MODIFIED;
import static javax.ws.rs.core.Response.Status.NO_CONTENT;
Expand Down Expand Up @@ -1597,7 +1598,7 @@ public void testRepeatedPut() throws Exception {

final HttpPut secondPut = new HttpPut(serverAddress + pid);
secondPut.setHeader("Content-Type", "text/turtle");
assertEquals(400, getStatus(secondPut));
assertEquals(CONFLICT.getStatusCode(), getStatus(secondPut));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static javax.ws.rs.core.Response.status;
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static javax.ws.rs.core.Response.Status.CONFLICT;
import static org.fcrepo.kernel.RdfLexicon.CONSTRAINED_BY;

import javax.ws.rs.core.Link;
Expand All @@ -25,7 +26,6 @@
import javax.ws.rs.ext.Provider;

import org.fcrepo.kernel.exception.MalformedRdfException;

import org.apache.commons.codec.binary.Base64;

/**
Expand All @@ -39,6 +39,10 @@ public class MalformedRdfExceptionMapper implements ExceptionMapper<MalformedRdf
public Response toResponse(final MalformedRdfException e) {
final Link link = Link.fromUri(getConstraintUri(e)).rel(CONSTRAINED_BY.getURI()).build();
final String msg = e.getMessage();

if (msg.contains("server-managed predicate")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily in this PR, but sometime, we should factor this string out into a constant in the appropriate class.

return status(CONFLICT).entity(msg).links(link).build();
}
if (msg.matches(".*org.*Exception: .*")) {
return status(BAD_REQUEST).entity(msg.replaceAll("org.*Exception: ", "")).links(link).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@ public void removeProperty(final FedoraResource resource,

if (isManagedPredicate.apply(predicate)) {

throw new ServerManagedPropertyException("Could not remove triple containing predicate "
+ predicate.toString()
+ " to node "
+ node.getPath());
throw new ServerManagedPropertyException("Could not remove triple containing server-managed "
+ "predicate "
+ predicate.toString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary toString().

+ " to node "
+ node.getPath());
}

if (objectNode.isURIResource()
Expand Down