commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joe...@apache.org
Subject svn commit: r1153271 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/exception/ site/changes/ test/java/org/apache/commons/lang3/exception/
Date Tue, 02 Aug 2011 21:04:40 GMT
Author: joehni
Date: Tue Aug  2 21:04:35 2011
New Revision: 1153271

URL: http://svn.apache.org/viewvc?rev=1153271&view=rev
Log:
Missing method getRawMessage for ContextedException and ContextedRuntimeException (LANG-737).

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedException.java
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
    commons/proper/lang/trunk/src/site/changes/changes.xml
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedException.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedException.java?rev=1153271&r1=1153270&r2=1153271&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedException.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedException.java
Tue Aug  2 21:04:35 2011
@@ -227,10 +227,20 @@ public class ContextedException extends 
     }
 
     /**
+     * Provides the message explaining the exception without the contextual data.
+     * 
+     * @see java.lang.Throwable#getMessage()
+     * @return the message
+     * @since 3.0.1
+     */
+    public String getRawMessage() {
+        return super.getMessage();
+    }
+
+    /**
      * {@inheritDoc}
      */
     public String getFormattedExceptionMessage(String baseMessage) {
         return exceptionContext.getFormattedExceptionMessage(baseMessage);
     }
-
 }

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java?rev=1153271&r1=1153270&r2=1153271&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/exception/ContextedRuntimeException.java
Tue Aug  2 21:04:35 2011
@@ -227,6 +227,17 @@ public class ContextedRuntimeException e
     }
 
     /**
+     * Provides the message explaining the exception without the contextual data.
+     * 
+     * @see java.lang.Throwable#getMessage()
+     * @return the message
+     * @since 3.0.1
+     */
+    public String getRawMessage() {
+        return super.getMessage();
+    }
+
+    /**
      * {@inheritDoc}
      */
     public String getFormattedExceptionMessage(String baseMessage) {

Modified: commons/proper/lang/trunk/src/site/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/site/changes/changes.xml?rev=1153271&r1=1153270&r2=1153271&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/site/changes/changes.xml (original)
+++ commons/proper/lang/trunk/src/site/changes/changes.xml Tue Aug  2 21:04:35 2011
@@ -35,6 +35,7 @@
     <action type="add" issue="LANG-730">EnumSet -&gt; bit vector</action>
     <action type="fix" issue="LANG-734">The CHAR_ARRAY cache in CharUtils duplicates
the cache in java.lang.Character</action>
     <action type="update" issue="LANG-735">Deprecate CharUtils.toCharacterObject(char)
in favor of java.lang.Character.valueOf(char)</action>
+    <action type="add" issue="LANG-737">Missing method getRawMessage for ContextedException
and ContextedRuntimeException</action>
   </release>
 
   <release version="3.0" date="2011-07-18" description="Backwards incompatible update
of Commons Lang to Java 5">  

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java?rev=1153271&r1=1153270&r2=1153271&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedExceptionTest.java
Tue Aug  2 21:04:35 2011
@@ -88,4 +88,11 @@ public class ContextedExceptionTest exte
         assertTrue(message != null);
     }
 
+    public void testRawMessage() {
+        assertEquals(Exception.class.getName() + ": " + TEST_MESSAGE, exceptionContext.getRawMessage());
+        exceptionContext = new ContextedException(TEST_MESSAGE_2, new Exception(TEST_MESSAGE),
new DefaultExceptionContext());
+        assertEquals(TEST_MESSAGE_2, exceptionContext.getRawMessage());
+        exceptionContext = new ContextedException(null, new Exception(TEST_MESSAGE), new
DefaultExceptionContext());
+        assertNull(exceptionContext.getRawMessage());
+    }
 }

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java?rev=1153271&r1=1153270&r2=1153271&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/exception/ContextedRuntimeExceptionTest.java
Tue Aug  2 21:04:35 2011
@@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUt
 
 /**
  * JUnit tests for ContextedRuntimeException.
- *
  */
 public class ContextedRuntimeExceptionTest extends AbstractExceptionContextTest<ContextedRuntimeException>
{
     
@@ -88,4 +87,12 @@ public class ContextedRuntimeExceptionTe
         String message = exceptionContext.getMessage();
         assertTrue(message != null);
     }
+
+    public void testRawMessage() {
+        assertEquals(Exception.class.getName() + ": " + TEST_MESSAGE, exceptionContext.getRawMessage());
+        exceptionContext = new ContextedRuntimeException(TEST_MESSAGE_2, new Exception(TEST_MESSAGE),
new DefaultExceptionContext());
+        assertEquals(TEST_MESSAGE_2, exceptionContext.getRawMessage());
+        exceptionContext = new ContextedRuntimeException(null, new Exception(TEST_MESSAGE),
new DefaultExceptionContext());
+        assertNull(exceptionContext.getRawMessage());
+    }
 }



Mime
View raw message