You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2006/04/24 17:38:54 UTC

svn commit: r396581 - /webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/Calculator.cpp

Author: dicka
Date: Mon Apr 24 08:38:48 2006
New Revision: 396581

URL: http://svn.apache.org/viewcvs?rev=396581&view=rev
Log:
Correct Calculator service implementation, so it also works on Unix platforms.

Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/Calculator.cpp

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/Calculator.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/Calculator.cpp?rev=396581&r1=396580&r2=396581&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/Calculator.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/Calculator.cpp Mon Apr 24 08:38:48 2006
@@ -1,4 +1,4 @@
-// Copyright 2003-2004 The Apache Software Foundation.
+// Copyright 2003-2006 The Apache Software Foundation.
 // 
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,6 +19,25 @@
  */
 #include "Calculator.hpp"
 
+class CalculatorException : public std::exception
+{
+public:
+	CalculatorException(const char *errorMessage)
+	{
+		m_ErrorMessage = errorMessage;
+	};
+
+	~CalculatorException() throw() {}
+
+	virtual const char *what() throw()
+	{
+		return m_ErrorMessage.c_str();
+	}
+
+private:
+	string m_ErrorMessage;
+};
+
 void Calculator::onFault(){}
 
 Calculator::Calculator()
@@ -46,8 +65,9 @@
 	if (Value1 == 0)
 	{
 // This has been done to fit the existing JAVA implementations!
-		throw exception( "java.lang.ArithmeticException: / by zero");
+		throw CalculatorException( "java.lang.ArithmeticException: / by zero");
 	}
 
 	return Value0 / Value1;
 }
+