You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2014/03/06 18:48:08 UTC

[4/6] git commit: MARMOTTA-449: cosmetic details

MARMOTTA-449: cosmetic details


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/2f3fbdd8
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/2f3fbdd8
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/2f3fbdd8

Branch: refs/heads/ldp
Commit: 2f3fbdd8f84c48d3e1000e53ace7b662ced2351e
Parents: 424bc33
Author: Sergio Fernández <wi...@apache.org>
Authored: Thu Mar 6 16:46:15 2014 +0100
Committer: Sergio Fernández <wi...@apache.org>
Committed: Thu Mar 6 16:46:15 2014 +0100

----------------------------------------------------------------------
 .../platform/ldp/webservices/LdpWebService.java | 46 +++++++++-----------
 1 file changed, 21 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/2f3fbdd8/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java b/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java
index f10da48..75515a1 100644
--- a/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java
+++ b/platform/marmotta-ldp/src/main/java/org/apache/marmotta/platform/ldp/webservices/LdpWebService.java
@@ -83,29 +83,25 @@ public class LdpWebService {
     @GET
     public Response GET(@Context final UriInfo uriInfo, @Context Request r, @HeaderParam(HttpHeaders.ACCEPT) MediaType type) throws RepositoryException {
         final String resource = getResourceUri(uriInfo);
-        if (log.isDebugEnabled()) {
-            log.debug("GET to LDPR <{}>", resource);
-        }
+        log.debug("GET to LDPR <{}>", resource);
         return buildGetResponse(resource, r, type).build();
     }
 
     @HEAD
     public Response HEAD(@Context final UriInfo uriInfo, @Context Request r, @HeaderParam(HttpHeaders.ACCEPT) MediaType type)  throws RepositoryException {
         final String resource = getResourceUri(uriInfo);
-        if (log.isDebugEnabled()) {
-            log.debug("HEAD to LDPR <{}>", resource);
-        }
+        log.debug("HEAD to LDPR <{}>", resource);
         return buildGetResponse(resource, r, type).entity(null).build();
     }
 
     private Response.ResponseBuilder buildGetResponse(final String resource, Request r, MediaType type) throws RepositoryException {
-        final RepositoryConnection con = sesameService.getConnection();
+        final RepositoryConnection conn = sesameService.getConnection();
         try {
-            con.begin();
+            conn.begin();
 
-            if (!ldpService.exists(con, resource)) {
-                final Response.ResponseBuilder resp = createResponse(con, Response.Status.NOT_FOUND, resource);
-                con.rollback();
+            if (!ldpService.exists(conn, resource)) {
+                final Response.ResponseBuilder resp = createResponse(conn, Response.Status.NOT_FOUND, resource);
+                conn.rollback();
                 return resp;
             }
 
@@ -119,14 +115,14 @@ public class LdpWebService {
                     @Override
                     public void write(OutputStream out) throws IOException, WebApplicationException {
                         try {
-                            ldpService.exportResource(con, resource, out);
+                            ldpService.exportResource(conn, resource, out);
                         } catch (RepositoryException | IOException e) {
                             throw new WebApplicationException(e, createResponse(Response.status(Response.Status.INTERNAL_SERVER_ERROR)).entity(e).build());
                         }
                     }
                 };
-                final Response.ResponseBuilder resp = createResponse(con, Response.Status.OK, resource).entity(entity).type(format.getDefaultMIMEType());
-                con.commit();
+                final Response.ResponseBuilder resp = createResponse(conn, Response.Status.OK, resource).entity(entity).type(format.getDefaultMIMEType());
+                conn.commit();
                 return resp;
             } else {
                 // Deliver all triples with <subject> as subject.
@@ -134,34 +130,34 @@ public class LdpWebService {
                     @Override
                     public void write(OutputStream output) throws IOException, WebApplicationException {
                         try {
-                            final RepositoryConnection outputCon = sesameService.getConnection();;
+                            final RepositoryConnection outputConn = sesameService.getConnection();;
                             try {
-                                outputCon.begin();
-                                ldpService.exportResource(outputCon, resource, output, format);
-                                outputCon.commit();
+                                outputConn.begin();
+                                ldpService.exportResource(outputConn, resource, output, format);
+                                outputConn.commit();
                             } catch (RDFHandlerException e) {
-                                outputCon.rollback();
+                                outputConn.rollback();
                                 throw new NoLogWebApplicationException(e, createResponse(Response.status(Response.Status.INTERNAL_SERVER_ERROR)).entity(e.getMessage()).build());
                             } catch (final Throwable t) {
-                                outputCon.rollback();
+                                outputConn.rollback();
                                 throw t;
                             } finally {
-                                outputCon.close();
+                                outputConn.close();
                             }
                         } catch (RepositoryException e) {
                             throw new WebApplicationException(e, createResponse(Response.status(Response.Status.INTERNAL_SERVER_ERROR)).entity(e).build());
                         }
                     }
                 };
-                final Response.ResponseBuilder resp = createResponse(con, Response.Status.OK, resource).entity(entity).type(format.getDefaultMIMEType());
-                con.commit();
+                final Response.ResponseBuilder resp = createResponse(conn, Response.Status.OK, resource).entity(entity).type(format.getDefaultMIMEType());
+                conn.commit();
                 return resp;
             }
         } catch (final Throwable t) {
-            con.rollback();
+            conn.rollback();
             throw t;
         } finally {
-            con.close();
+            conn.close();
         }
     }