ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/naming/NamingContextBindingsEnumeration.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/naming/NamingContextBindingsEnumeration.java
Status
scanned
Type
file
Name
NamingContextBindingsEnumeration.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
3256 (3.2 KB)
MD5
a2ab56b53c139b082aa4f2413662974d
SHA1
5c4967eaf149341bd5e2ec90d7a71b2f1f6d7c69
SHA256
b5ec6e2076b3a33dd79a7d5f0405a4a1a1ad8375b8fc71a0b3284d9f9e83a102
SHA512

      
    
SHA1_git
9a6344a3562f62a876eaa73a67d2321e6d1f5e09
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
NamingContextBindingsEnumeration.java | 3.2 KB |

/* * 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.naming; import java.util.Iterator; import javax.naming.Binding; import javax.naming.CompositeName; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; /** * Naming enumeration implementation. */ public class NamingContextBindingsEnumeration implements NamingEnumeration<Binding> { // ----------------------------------------------------------- Constructors public NamingContextBindingsEnumeration(Iterator<NamingEntry> entries, Context ctx) { iterator = entries; this.ctx = ctx; } // -------------------------------------------------------------- Variables /** * Underlying enumeration. */ protected final Iterator<NamingEntry> iterator; /** * The context for which this enumeration is being generated. */ private final Context ctx; // --------------------------------------------------------- Public Methods @Override public Binding next() throws NamingException { return nextElementInternal(); } @Override public boolean hasMore() throws NamingException { return iterator.hasNext(); } @Override public void close() throws NamingException { } @Override public boolean hasMoreElements() { return iterator.hasNext(); } @Override public Binding nextElement() { try { return nextElementInternal(); } catch (NamingException e) { throw new RuntimeException(e.getMessage(), e); } } private Binding nextElementInternal() throws NamingException { NamingEntry entry = iterator.next(); Object value; // If the entry is a reference, resolve it if (entry.type == NamingEntry.REFERENCE || entry.type == NamingEntry.LINK_REF) { try { value = ctx.lookup(new CompositeName(entry.name)); } catch (NamingException e) { throw e; } catch (Exception e) { NamingException ne = new NamingException(e.getMessage()); ne.initCause(e); throw ne; } } else { value = entry.value; } return new Binding(entry.name, value.getClass().getName(), value, true); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
38.89
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9