You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/07/27 15:29:10 UTC

svn commit: r560221 - in /activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions: NullPointerException.h NumberFormatException.h

Author: tabish
Date: Fri Jul 27 06:29:07 2007
New Revision: 560221

URL: http://svn.apache.org/viewvc?view=rev&rev=560221
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Adding in new Exception type

Added:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NumberFormatException.h
Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NullPointerException.h

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NullPointerException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NullPointerException.h?view=diff&rev=560221&r1=560220&r2=560221
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NullPointerException.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NullPointerException.h Fri Jul 27 06:29:07 2007
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #ifndef _DECAF_LANG_EXCEPTIONS_NULLPOINTERENTEXCEPTION_H_
 #define _DECAF_LANG_EXCEPTIONS_NULLPOINTERENTEXCEPTION_H_
 

Added: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NumberFormatException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NumberFormatException.h?view=auto&rev=560221
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NumberFormatException.h (added)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/exceptions/NumberFormatException.h Fri Jul 27 06:29:07 2007
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_LANG_EXCEPTIONS_NUMBERFORMATEXCEPTION_H_
+#define _DECAF_LANG_EXCEPTIONS_NUMBERFORMATEXCEPTION_H_
+
+#include <decaf/lang/Exception.h>
+
+namespace decaf{
+namespace lang{
+namespace exceptions{
+
+    /*
+     * Thrown when an error occurs that involves a conversion to a Number from
+     * a string and the string is not a valid number.
+     */
+    class NumberFormatException : public Exception
+    {
+    public:
+
+        /**
+         * Default Constructor
+         */
+        NumberFormatException() {}
+
+        /**
+         * Conversion Constructor from some other Exception
+         * @param An exception that should become this type of Exception
+         */
+        NumberFormatException( const Exception& ex ) throw()
+        : Exception() {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Copy Constructor
+         */
+        NumberFormatException(const NumberFormatException& ex) throw()
+        : Exception() {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occured.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        NumberFormatException( const char* file,
+                               const int lineNumber,
+                               const char* msg, ... ) throw()
+        : Exception() {
+            va_list vargs;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual NumberFormatException* clone() const {
+            return new NumberFormatException( *this );
+        }
+
+        virtual ~NumberFormatException() throw () {}
+
+    };
+
+}}}
+
+#endif /*_DECAF_LANG_EXCEPTIONS_NUMBERFORMATEXCEPTION_H_*/