diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJena.java index 48b53a856..53db0d845 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserAccountsDaoJena.java @@ -358,9 +358,8 @@ public class UserAccountsDaoJena extends JenaBaseDao implements UserAccountsDao Random random = new Random(System.currentTimeMillis()); for (int attempts = 0; attempts < 30; attempts++) { int upperBound = (int) Math.pow(2, attempts + 13); - uri = namespace + ("n" + random.nextInt(upperBound)); - errMsg = getWebappDaoFactory().checkURI(uri); - if (errMsg == null) { + uri = namespace + ("u" + random.nextInt(upperBound)); + if (!isUriUsed(uri)) { return uri; } } @@ -368,6 +367,10 @@ public class UserAccountsDaoJena extends JenaBaseDao implements UserAccountsDao throw new InsertException("Could not create URI for individual: " + errMsg); } + + private boolean isUriUsed(String uri) { + return (getOntModel().getOntResource(uri) != null); + } /** * Since there is no reasoner on the UserAccountModel, this will return a