-================================================================================\r
- Licensed to the Apache Software Foundation (ASF) under one or more\r
- contributor license agreements. See the NOTICE file distributed with\r
- this work for additional information regarding copyright ownership.\r
- The ASF licenses this file to You under the Apache License, Version 2.0\r
- (the "License"); you may not use this file except in compliance with\r
- the License. You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-================================================================================\r
-\r
-$Id: $\r
-\r
- =====================================================\r
- An outline plan for the first stable Tomcat 7 release\r
- =====================================================\r
-\r
-1. Update trunk with new API from Servlet Spec 3.0 PR\r
-\r
-2. Provide NOOP implementations with TODO SRV3 markers so it will build\r
-\r
-3. Implement all the new Servlet 3 features\r
-\r
-4. Do an alpha realease (from trunk)\r
- - Create tc7.0.x\tags to hold release tags\r
- - Create Bugzilla project\r
- - Add to web site\r
- - Update Wiki version status page\r
-\r
-5. Fix issues as they get reported\r
-\r
-6. Update for next public draft(s) of the spec if any.\r
-\r
-7. Aim for first stable TC7 release with final release of Servlet 3 spec\r
- - Create tc7.0.x\trunk from trunk at first stable release\r
-\r
-8. Nice to haves in first Tomcat 7 stable release\r
- - Remove old, unused code\r
- - Clean up internal API (eg remove unused params from methods)\r
- - Code needs to be ID'd and deprecated in 6.x first\r
- - Support for standalone EL\r
- - http://issues.apache.org/bugzilla/show_bug.cgi?id=43819\r
+================================================================================
+ 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.
+================================================================================
+
+$Id: $
+
+ =====================================================
+ An outline plan for the first stable Tomcat 7 release
+ =====================================================
+
+1. Update trunk with new API from Servlet Spec 3.0 PR
+
+2. Provide NOOP implementations with TODO SRV3 markers so it will build
+
+3. Implement all the new Servlet 3 features
+
+4. Do an alpha realease (from trunk)
+ - Create tc7.0.x\tags to hold release tags
+ - Create Bugzilla project
+ - Add to web site
+ - Update Wiki version status page
+
+5. Fix issues as they get reported
+
+6. Update for next public draft(s) of the spec if any.
+
+7. Aim for first stable TC7 release with final release of Servlet 3 spec
+ - Create tc7.0.x\trunk from trunk at first stable release
+
+8. Nice to haves in first Tomcat 7 stable release
+ - Remove old, unused code
+ - Clean up internal API (eg remove unused params from methods)
+ - Code needs to be ID'd and deprecated in 6.x first
+ - Support for standalone EL
+ - http://issues.apache.org/bugzilla/show_bug.cgi?id=43819
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one or more\r
- * contributor license agreements. See the NOTICE file distributed with\r
- * this work for additional information regarding copyright ownership.\r
- * The ASF licenses this file to You under the Apache License, Version 2.0\r
- * (the "License"); you may not use this file except in compliance with\r
- * the License. You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- */\r
-package org.apache.catalina.tribes.group.interceptors;\r
-\r
-import static java.util.concurrent.TimeUnit.MILLISECONDS;\r
-\r
-import java.util.Arrays;\r
-import java.util.concurrent.atomic.AtomicBoolean;\r
-\r
-import org.apache.catalina.tribes.ChannelException;\r
-import org.apache.catalina.tribes.Member;\r
-import org.apache.catalina.tribes.group.AbsoluteOrder;\r
-import org.apache.catalina.tribes.group.ChannelInterceptorBase;\r
-\r
-/**\r
- * A dinky coordinator, just uses a sorted version of the member array.\r
- * \r
- * @author rnewson\r
- * \r
- */\r
-public class SimpleCoordinator extends ChannelInterceptorBase {\r
-\r
- private Member[] view;\r
-\r
- private AtomicBoolean membershipChanged = new AtomicBoolean();\r
-\r
- private void membershipChanged() {\r
- membershipChanged.set(true);\r
- }\r
-\r
- @Override\r
- public void memberAdded(final Member member) {\r
- super.memberAdded(member);\r
- membershipChanged();\r
- installViewWhenStable();\r
- }\r
-\r
- @Override\r
- public void memberDisappeared(final Member member) {\r
- super.memberDisappeared(member);\r
- membershipChanged();\r
- installViewWhenStable();\r
- }\r
-\r
- /**\r
- * Override to receive view changes.\r
- * \r
- * @param view\r
- */\r
- protected void viewChange(final Member[] view) {\r
- }\r
-\r
- @Override\r
- public void start(int svc) throws ChannelException {\r
- super.start(svc);\r
- installViewWhenStable();\r
- }\r
-\r
- private void installViewWhenStable() {\r
- int stableCount = 0;\r
-\r
- while (stableCount < 10) {\r
- if (membershipChanged.compareAndSet(true, false)) {\r
- stableCount = 0;\r
- } else {\r
- stableCount++;\r
- }\r
- try {\r
- MILLISECONDS.sleep(250);\r
- } catch (final InterruptedException e) {\r
- Thread.currentThread().interrupt();\r
- }\r
- }\r
-\r
- final Member[] members = getMembers();\r
- final Member[] view = new Member[members.length+1];\r
- System.arraycopy(members, 0, view, 0, members.length);\r
- view[members.length] = getLocalMember(false);\r
- Arrays.sort(view, AbsoluteOrder.comp);\r
- if (Arrays.equals(view, this.view)) {\r
- return;\r
- }\r
- this.view = view;\r
- viewChange(view);\r
- }\r
-\r
- @Override\r
- public void stop(int svc) throws ChannelException {\r
- super.stop(svc);\r
- }\r
-\r
- public Member[] getView() {\r
- return view;\r
- }\r
-\r
- public Member getCoordinator() {\r
- return view == null ? null : view[0];\r
- }\r
-\r
- public boolean isCoordinator() {\r
- return view == null ? false : getLocalMember(false).equals(\r
- getCoordinator());\r
- }\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.apache.catalina.tribes.group.interceptors;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
+import java.util.Arrays;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.group.AbsoluteOrder;
+import org.apache.catalina.tribes.group.ChannelInterceptorBase;
+
+/**
+ * A dinky coordinator, just uses a sorted version of the member array.
+ *
+ * @author rnewson
+ *
+ */
+public class SimpleCoordinator extends ChannelInterceptorBase {
+
+ private Member[] view;
+
+ private AtomicBoolean membershipChanged = new AtomicBoolean();
+
+ private void membershipChanged() {
+ membershipChanged.set(true);
+ }
+
+ @Override
+ public void memberAdded(final Member member) {
+ super.memberAdded(member);
+ membershipChanged();
+ installViewWhenStable();
+ }
+
+ @Override
+ public void memberDisappeared(final Member member) {
+ super.memberDisappeared(member);
+ membershipChanged();
+ installViewWhenStable();
+ }
+
+ /**
+ * Override to receive view changes.
+ *
+ * @param view
+ */
+ protected void viewChange(final Member[] view) {
+ }
+
+ @Override
+ public void start(int svc) throws ChannelException {
+ super.start(svc);
+ installViewWhenStable();
+ }
+
+ private void installViewWhenStable() {
+ int stableCount = 0;
+
+ while (stableCount < 10) {
+ if (membershipChanged.compareAndSet(true, false)) {
+ stableCount = 0;
+ } else {
+ stableCount++;
+ }
+ try {
+ MILLISECONDS.sleep(250);
+ } catch (final InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ final Member[] members = getMembers();
+ final Member[] view = new Member[members.length+1];
+ System.arraycopy(members, 0, view, 0, members.length);
+ view[members.length] = getLocalMember(false);
+ Arrays.sort(view, AbsoluteOrder.comp);
+ if (Arrays.equals(view, this.view)) {
+ return;
+ }
+ this.view = view;
+ viewChange(view);
+ }
+
+ @Override
+ public void stop(int svc) throws ChannelException {
+ super.stop(svc);
+ }
+
+ public Member[] getView() {
+ return view;
+ }
+
+ public Member getCoordinator() {
+ return view == null ? null : view[0];
+ }
+
+ public boolean isCoordinator() {
+ return view == null ? false : getLocalMember(false).equals(
+ getCoordinator());
+ }
+
+}
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one or more\r
- * contributor license agreements. See the NOTICE file distributed with\r
- * this work for additional information regarding copyright ownership.\r
- * The ASF licenses this file to You under the Apache License, Version 2.0\r
- * (the "License"); you may not use this file except in compliance with\r
- * the License. You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.apache.el.parser;\r
-\r
-import javax.el.ValueExpression;\r
-\r
-import org.apache.el.ExpressionFactoryImpl;\r
-import org.apache.jasper.el.ELContextImpl;\r
-\r
-import junit.framework.TestCase;\r
-\r
-public class TestELParser extends TestCase {\r
- \r
- public void testBug45511() {\r
- // Test cases provided by OP\r
- assertEquals("true", evaluateExpression("${empty ('')}"));\r
- assertEquals("true", evaluateExpression("${empty('')}"));\r
- assertEquals("false", evaluateExpression("${(true) and (false)}"));\r
- assertEquals("false", evaluateExpression("${(true)and(false)}"));\r
- }\r
- \r
-\r
- public void testBug42565() {\r
- // Test cases provided by OP\r
- assertEquals("false", evaluateExpression("${false?true:false}"));\r
- }\r
-\r
-\r
- public void testMisc() {\r
- // From bug 45451 - not a parser bug\r
- assertEquals("\\", evaluateExpression("\\\\"));\r
- }\r
- \r
-\r
- private String evaluateExpression(String expression) {\r
- ELContextImpl ctx = new ELContextImpl();\r
- ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();\r
- ValueExpression ve =\r
- exprFactory.createValueExpression(ctx, expression, String.class );\r
- return (String) ve.getValue(ctx);\r
- }\r
-}\r
+/*
+ * 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 org.apache.el.parser;
+
+import javax.el.ValueExpression;
+
+import org.apache.el.ExpressionFactoryImpl;
+import org.apache.jasper.el.ELContextImpl;
+
+import junit.framework.TestCase;
+
+public class TestELParser extends TestCase {
+
+ public void testBug45511() {
+ // Test cases provided by OP
+ assertEquals("true", evaluateExpression("${empty ('')}"));
+ assertEquals("true", evaluateExpression("${empty('')}"));
+ assertEquals("false", evaluateExpression("${(true) and (false)}"));
+ assertEquals("false", evaluateExpression("${(true)and(false)}"));
+ }
+
+
+ public void testBug42565() {
+ // Test cases provided by OP
+ assertEquals("false", evaluateExpression("${false?true:false}"));
+ }
+
+
+ public void testMisc() {
+ // From bug 45451 - not a parser bug
+ assertEquals("\\", evaluateExpression("\\\\"));
+ }
+
+
+ private String evaluateExpression(String expression) {
+ ELContextImpl ctx = new ELContextImpl();
+ ExpressionFactoryImpl exprFactory = new ExpressionFactoryImpl();
+ ValueExpression ve =
+ exprFactory.createValueExpression(ctx, expression, String.class );
+ return (String) ve.getValue(ctx);
+ }
+}