Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

rfe9338: Improve error message due to session port connection failure

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...
commit 436fb2ff39bfb5b91a2c21ab77670fb58dba001c 1 parent eb9c973
Mike Hinchey authored January 28, 2011 dklayer committed February 11, 2011
20  src/com/franz/agraph/http/AGHttpRepoClient.java
... ...
@@ -1,5 +1,5 @@
1 1
 /******************************************************************************
2  
-** Copyright (c) 2008-2010 Franz Inc.
  2
+** Copyright (c) 2008-2011 Franz Inc.
3 3
 ** All rights reserved. This program and the accompanying materials
4 4
 ** are made available under the terms of the Eclipse Public License v1.0
5 5
 ** which accompanies this distribution, and is available at
@@ -342,7 +342,19 @@ public void setAutoCommit(boolean autoCommit) throws RepositoryException {
342 342
 		} catch (RDFParseException e) {
343 343
 			throw new RepositoryException(e);
344 344
 		} catch (IOException e) {
345  
-			throw new RepositoryException(e);
  345
+			throw handleSessionConnectionError(e, url);
  346
+		}
  347
+	}
  348
+
  349
+	private RepositoryException handleSessionConnectionError(IOException e, String url) throws RepositoryException {
  350
+		if (e instanceof java.net.ConnectException) {
  351
+			// To test this exception, setup remote server and only open port to
  352
+			// the main port, not the SessionPorts and run TutorialTest.example6()
  353
+			return new RepositoryException("Session port connection failure. Consult the Server Installation document for correct settings for SessionPorts. Url: " + url
  354
+					+ ". Documentation: http://www.franz.com/agraph/support/documentation/v4/server-installation.html#sessionport", e);
  355
+		} else {
  356
+			return new RepositoryException("Possible session port connection failure. Consult the Server Installation document for correct settings for SessionPorts. Url: " + url
  357
+					+ ". Documentation: http://www.franz.com/agraph/support/documentation/v4/server-installation.html#sessionport", e);
346 358
 		}
347 359
 	}
348 360
 
@@ -1154,7 +1166,7 @@ public void addRules(InputStream rulestream) throws RepositoryException {
1154 1166
 		} catch (RDFParseException e) {
1155 1167
 			throw new RepositoryException(e);
1156 1168
 		} catch (IOException e) {
1157  
-			throw new RepositoryException(e);
  1169
+			throw handleSessionConnectionError(e, url);
1158 1170
 		}
1159 1171
 	}
1160 1172
 
@@ -1437,7 +1449,7 @@ public void registerSNAGenerator(String generator, List<String> objectOfs, List<
1437 1449
 		} catch (HttpException e) {
1438 1450
 			throw new RepositoryException(e);
1439 1451
 		} catch (IOException e) {
1440  
-			throw new RepositoryException(e);
  1452
+			throw handleSessionConnectionError(e, url);
1441 1453
 		} catch (AGHttpException e) {
1442 1454
 			throw new RepositoryException(e);
1443 1455
 		} // TODO: need an RDFParseException for query param?

0 notes on commit 436fb2f

Please sign in to comment.
Something went wrong with that request. Please try again.