Author: markt
Date: Wed Jul 17 13:28:25 2013
New Revision: 1504127
URL: http://svn.apache.org/r1504127
Log:
Provide messages with exceptions
Modified:
tomcat/trunk/java/org/apache/el/Messages.properties
tomcat/trunk/java/org/apache/el/stream/Optional.java
tomcat/trunk/java/org/apache/el/stream/Stream.java
Modified: tomcat/trunk/java/org/apache/el/Messages.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/Messages.properties?rev=1504127&r1=1504126&r2=1504127&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/Messages.properties (original)
+++ tomcat/trunk/java/org/apache/el/Messages.properties Wed Jul 17 13:28:25 2013
@@ -53,3 +53,7 @@ error.context.null=ELContext was null
# Parser
error.identifier.notjava=The identifier [{0}] is not a valid Java identifier
as required by section 1.19 of the EL specification (Identifier ::= Java
language identifier). This check can be disabled by setting the system property
org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.
error.lambda.tooManyMethodParameterSets=There are more sets of method
parameters specified than there are nested lambda expressions
+
+# Stream
+stream.optional.empty=It is illegal to call get() on an empty optional
+stream.compare.notComparable=Stream elements must implement Comparable
\ No newline at end of file
Modified: tomcat/trunk/java/org/apache/el/stream/Optional.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/stream/Optional.java?rev=1504127&r1=1504126&r2=1504127&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/stream/Optional.java (original)
+++ tomcat/trunk/java/org/apache/el/stream/Optional.java Wed Jul 17 13:28:25
2013
@@ -19,6 +19,8 @@ package org.apache.el.stream;
import javax.el.ELException;
import javax.el.LambdaExpression;
+import org.apache.el.util.MessageFactory;
+
public class Optional {
private final Object obj;
@@ -32,7 +34,7 @@ public class Optional {
public Object get() throws ELException {
if (obj == null) {
- throw new ELException();
+ throw new ELException(MessageFactory.get("stream.optional.empty"));
} else {
return obj;
}
Modified: tomcat/trunk/java/org/apache/el/stream/Stream.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/stream/Stream.java?rev=1504127&r1=1504126&r2=1504127&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/stream/Stream.java (original)
+++ tomcat/trunk/java/org/apache/el/stream/Stream.java Wed Jul 17 13:28:25 2013
@@ -30,6 +30,7 @@ import javax.el.LambdaExpression;
import org.apache.el.lang.ELArithmetic;
import org.apache.el.lang.ELSupport;
+import org.apache.el.util.MessageFactory;
public class Stream {
@@ -412,7 +413,8 @@ public class Stream {
if ((obj instanceof Comparable)) {
result = (Comparable) obj;
} else {
- throw new ELException();
+ throw new ELException(
+ MessageFactory.get("stream.compare.notComparable"));
}
}
@@ -425,7 +427,8 @@ public class Stream {
result = (Comparable) obj;
}
} else {
- throw new ELException();
+ throw new ELException(
+ MessageFactory.get("stream.compare.notComparable"));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]