You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2013/07/05 11:11:24 UTC
svn commit: r1499953 - in /tomcat/trunk: java/javax/el/ELContext.java
test/javax/el/TestELContext.java test/javax/el/TesterELContext.java
Author: violetagg
Date: Fri Jul 5 09:11:24 2013
New Revision: 1499953
URL: http://svn.apache.org/r1499953
Log:
Since EL 2.2 javadoc ELContext.getContext must throw NPE when the key that is provided in NULL.
Added:
tomcat/trunk/test/javax/el/TestELContext.java (with props)
tomcat/trunk/test/javax/el/TesterELContext.java (with props)
Modified:
tomcat/trunk/java/javax/el/ELContext.java
Modified: tomcat/trunk/java/javax/el/ELContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ELContext.java?rev=1499953&r1=1499952&r2=1499953&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/ELContext.java (original)
+++ tomcat/trunk/java/javax/el/ELContext.java Fri Jul 5 09:11:24 2013
@@ -77,7 +77,14 @@ public abstract class ELContext {
}
// Can't use Class<?> because API needs to match specification
+ /**
+ * @throws NullPointerException
+ * If the key is <code>null</code>
+ */
public Object getContext(@SuppressWarnings("rawtypes") Class key) {
+ if (key == null) {
+ throw new NullPointerException();
+ }
if (this.map == null) {
return null;
}
Added: tomcat/trunk/test/javax/el/TestELContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/javax/el/TestELContext.java?rev=1499953&view=auto
==============================================================================
--- tomcat/trunk/test/javax/el/TestELContext.java (added)
+++ tomcat/trunk/test/javax/el/TestELContext.java Fri Jul 5 09:11:24 2013
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+package javax.el;
+
+import org.junit.Test;
+
+public class TestELContext {
+
+ /**
+ * Tests that a null key results in an NPE as per EL Javadoc.
+ */
+ @Test(expected = NullPointerException.class)
+ public void testGetContext() {
+ ELContext elContext = new TesterELContext();
+ elContext.getContext(null);
+ }
+
+}
Propchange: tomcat/trunk/test/javax/el/TestELContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/javax/el/TesterELContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/javax/el/TesterELContext.java?rev=1499953&view=auto
==============================================================================
--- tomcat/trunk/test/javax/el/TesterELContext.java (added)
+++ tomcat/trunk/test/javax/el/TesterELContext.java Fri Jul 5 09:11:24 2013
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+package javax.el;
+
+public class TesterELContext extends ELContext {
+
+ @Override
+ public ELResolver getELResolver() {
+ return null;
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper() {
+ return null;
+ }
+
+ @Override
+ public VariableMapper getVariableMapper() {
+ return null;
+ }
+
+}
Propchange: tomcat/trunk/test/javax/el/TesterELContext.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org