You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/10/25 10:37:26 UTC
[tomcat] 09/15: Add TesterClassLoader from Commons DBCP 1.5 branch,
commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit f406df20d22c62244cc2df9633693f5622d381a5
Author: Phil Steitz <ph...@gmail.com>
AuthorDate: Sat Oct 19 14:46:09 2019 -0700
Add TesterClassLoader from Commons DBCP 1.5 branch, commit fa9c1eb250c76dd9af5ee23bf2ecd5351cad4e04.
---
.../apache/tomcat/dbcp/dbcp/TesterClassLoader.java | 40 ++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/test/org/apache/tomcat/dbcp/dbcp/TesterClassLoader.java b/test/org/apache/tomcat/dbcp/dbcp/TesterClassLoader.java
new file mode 100644
index 0000000..166041c
--- /dev/null
+++ b/test/org/apache/tomcat/dbcp/dbcp/TesterClassLoader.java
@@ -0,0 +1,40 @@
+/*
+ * 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.commons.dbcp;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Simple class loader that just records the classes it was asked to load.
+ */
+public class TesterClassLoader extends ClassLoader {
+
+ private Set<String> loadedClasses = new HashSet<String>();
+
+ @Override
+ protected synchronized Class<?> loadClass(String name, boolean resolve)
+ throws ClassNotFoundException {
+ Class<?> clazz = super.loadClass(name, resolve);
+ loadedClasses.add(name);
+ return clazz;
+ }
+
+ public boolean didLoad(String className) {
+ return loadedClasses.contains(className);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org