You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2013/05/07 10:33:09 UTC
[6/6] git commit: fixed error in UserService (facading is now more
strict)
fixed error in UserService (facading is now more strict)
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/baa6c4d1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/baa6c4d1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/baa6c4d1
Branch: refs/heads/develop
Commit: baa6c4d1115ce60247116d40b764c854e98a3d78
Parents: 79265a7
Author: Jakob Frank <ja...@apache.org>
Authored: Tue May 7 10:31:30 2013 +0200
Committer: Jakob Frank <ja...@apache.org>
Committed: Tue May 7 10:31:30 2013 +0200
----------------------------------------------------------------------
.../core/services/user/UserServiceImpl.java | 47 ++++++++-------
1 files changed, 25 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/baa6c4d1/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/user/UserServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/user/UserServiceImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/user/UserServiceImpl.java
index ace5c2c..6fcd12f 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/user/UserServiceImpl.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/user/UserServiceImpl.java
@@ -271,29 +271,32 @@ public class UserServiceImpl implements UserService {
try {
RepositoryConnection conn = sesameService.getConnection();
-
- URI webId = conn.getValueFactory().createURI(webId_str);
-
- log.info("creating user with webId: {} ", webId.stringValue());
-
- if (!login.equals(ANONYMOUS_LOGIN) && !login.equals(ADMIN_LOGIN)) {
- MarmottaUser u = FacadingFactory.createFacading(conn).createFacade(webId, MarmottaUser.class);
- u.setFirstName(firstName);
- u.setLastName(lastName);
- u.setNick(login);
- }
-
- if(login.equals(ANONYMOUS_LOGIN)) {
- anonUser = webId;
- }
- if(login.equals(ADMIN_LOGIN)) {
- adminUser = webId;
+ try {
+ conn.begin();
+ URI webId = conn.getValueFactory().createURI(webId_str);
+
+ log.info("creating user with webId: {} ", webId.stringValue());
+
+ if (!login.equals(ANONYMOUS_LOGIN) && !login.equals(ADMIN_LOGIN)) {
+ MarmottaUser u = FacadingFactory.createFacading(conn).createFacade(webId, MarmottaUser.class);
+ u.setFirstName(firstName);
+ u.setLastName(lastName);
+ u.setNick(login);
+ }
+
+ if(login.equals(ANONYMOUS_LOGIN)) {
+ anonUser = webId;
+ }
+ if(login.equals(ADMIN_LOGIN)) {
+ adminUser = webId;
+ }
+
+ conn.commit();
+
+ return webId;
+ } finally {
+ conn.close();
}
-
- conn.commit();
- conn.close();
-
- return webId;
} catch(RepositoryException ex) {
handleRepositoryException(ex);
return null;