Skip to content

Commit

Permalink
rfe9338: Improve error message due to session port connection failure
Browse files Browse the repository at this point in the history
Added error message to refer to documentation url on franz.com.

The error message is unfortunately vague because other
causes are possible.

tests run:      prepush
tests added:    none, must be tested manually, requires remote server
performance:    no impact

<release-note>
rfe9338: Improve error message due to session port connection failure

When using method that start a session (setAutoCommit, addRules, and
registerSNAGenerator), if there is a connection error, give message
to point to the documentation about SessionPorts.
</release-note>

Change-Id: I2fe0979d2c83a3bad01a63aab70b56f76eef0927
Reviewed-on: https://gerrit.franz.com:9080/1163
Reviewed-by: John O'Rourke <john.orourke@franz.com>
Reviewed-by: Ahmon Dancy <dancy@franz.com>
Tested-by: Kevin Layer <layer@franz.com>
  • Loading branch information
Mike Hinchey authored and dklayer committed Feb 11, 2011
1 parent eb9c973 commit 436fb2f
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/com/franz/agraph/http/AGHttpRepoClient.java
@@ -1,5 +1,5 @@
/******************************************************************************
** Copyright (c) 2008-2010 Franz Inc.
** Copyright (c) 2008-2011 Franz Inc.
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the Eclipse Public License v1.0
** which accompanies this distribution, and is available at
Expand Down Expand Up @@ -342,7 +342,19 @@ public void setAutoCommit(boolean autoCommit) throws RepositoryException {
} catch (RDFParseException e) {
throw new RepositoryException(e);
} catch (IOException e) {
throw new RepositoryException(e);
throw handleSessionConnectionError(e, url);
}
}

private RepositoryException handleSessionConnectionError(IOException e, String url) throws RepositoryException {
if (e instanceof java.net.ConnectException) {
// To test this exception, setup remote server and only open port to
// the main port, not the SessionPorts and run TutorialTest.example6()
return new RepositoryException("Session port connection failure. Consult the Server Installation document for correct settings for SessionPorts. Url: " + url
+ ". Documentation: http://www.franz.com/agraph/support/documentation/v4/server-installation.html#sessionport", e);
} else {
return new RepositoryException("Possible session port connection failure. Consult the Server Installation document for correct settings for SessionPorts. Url: " + url
+ ". Documentation: http://www.franz.com/agraph/support/documentation/v4/server-installation.html#sessionport", e);
}
}

Expand Down Expand Up @@ -1154,7 +1166,7 @@ public void addRules(InputStream rulestream) throws RepositoryException {
} catch (RDFParseException e) {
throw new RepositoryException(e);
} catch (IOException e) {
throw new RepositoryException(e);
throw handleSessionConnectionError(e, url);
}
}

Expand Down Expand Up @@ -1437,7 +1449,7 @@ public void registerSNAGenerator(String generator, List<String> objectOfs, List<
} catch (HttpException e) {
throw new RepositoryException(e);
} catch (IOException e) {
throw new RepositoryException(e);
throw handleSessionConnectionError(e, url);
} catch (AGHttpException e) {
throw new RepositoryException(e);
} // TODO: need an RDFParseException for query param?
Expand Down

0 comments on commit 436fb2f

Please sign in to comment.