Skip to content

Commit

Permalink
Servlet 6.0 removed the restriction on calling these getter methods
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Jan 14, 2022
1 parent 25b0e07 commit a009fe9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ public class TestListener implements ServletContextListener {
* The ServletContextEvent
*/
public void contextInitialized(ServletContextEvent sce) {
boolean passed = true;
boolean passed = false;
ServletContext context = sce.getServletContext();
StringBuilder log = new StringBuilder();

try {
context.getClassLoader();
passed = false;
passed = true;
log.append(
"Expected UnsupportedOperationException not thrown by getClassLoader().");
"UnsupportedOperationException not thrown by getClassLoader().");
} catch (UnsupportedOperationException ex) {
log.append(
"Expected UnsupportedOperationException thrown by getClassLoader().");
"UnsupportedOperationException thrown by getClassLoader().");
}

context.setAttribute("TCK_TEST_STATUS", log.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -33,16 +33,16 @@ public class TestListener implements ServletContextListener {
* The ServletContextEvent
*/
public void contextInitialized(ServletContextEvent sce) {
boolean passed = true;
boolean passed = false;
ServletContext context = sce.getServletContext();
StringBuilder log = new StringBuilder();

try {
context.getDefaultSessionTrackingModes();
passed = false;
log.append("Expected UnsupportedOperationException not thrown.");
passed = true;
log.append("UnsupportedOperationException not thrown.");
} catch (UnsupportedOperationException ex) {
log.append("Expected UnsupportedOperationException thrown.");
log.append("UnsupportedOperationException thrown.");
}

context.setAttribute("TCK_TEST_STATUS", log.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ public class TestListener implements ServletContextListener {
* The ServletContextEvent
*/
public void contextInitialized(ServletContextEvent sce) {
boolean passed = true;
boolean passed = false;
ServletContext context = sce.getServletContext();
StringBuilder log = new StringBuilder();

try {
context.getEffectiveMajorVersion();
passed = false;
passed = true;
log.append(
"Expected UnsupportedOperationException not thrown by getEffectiveMajorVersion().");
"UnsupportedOperationException not thrown by getEffectiveMajorVersion().");
} catch (UnsupportedOperationException ex) {
log.append(
"Expected UnsupportedOperationException thrown by getEffectiveMajorVersion().");
"UnsupportedOperationException thrown by getEffectiveMajorVersion().");
}

context.setAttribute("TCK_TEST_STATUS", log.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ public class TestListener implements ServletContextListener {
* The ServletContextEvent
*/
public void contextInitialized(ServletContextEvent sce) {
boolean passed = true;
boolean passed = false;
ServletContext context = sce.getServletContext();
StringBuilder log = new StringBuilder();

try {
context.getEffectiveMajorVersion();
passed = false;
log.append("Expected UnsupportedOperationException not thrown.");
passed = true;
log.append("UnsupportedOperationException not thrown.");
} catch (UnsupportedOperationException ex) {
log.append("Expected UnsupportedOperationException thrown.");
log.append("UnsupportedOperationException thrown.");
}

context.setAttribute("TCK_TEST_STATUS", log.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -33,16 +33,16 @@ public class TestListener implements ServletContextListener {
* The ServletContextEvent
*/
public void contextInitialized(ServletContextEvent sce) {
boolean passed = true;
boolean passed = false;
ServletContext context = sce.getServletContext();
StringBuilder log = new StringBuilder();

try {
context.getEffectiveSessionTrackingModes();
passed = false;
log.append("Expected UnsupportedOperationException not thrown.");
passed = true;
log.append("UnsupportedOperationException not thrown.");
} catch (UnsupportedOperationException ex) {
log.append("Expected UnsupportedOperationException thrown.");
log.append("UnsupportedOperationException thrown.");
}

context.setAttribute("TCK_TEST_STATUS", log.toString());
Expand Down

0 comments on commit a009fe9

Please sign in to comment.