jdk/src/share/classes/com/sun/naming/internal/VersionHelper12.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
child 10324 e28265130e4f
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.naming.internal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.net.MalformedURLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.net.URLClassLoader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.security.PrivilegedAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.security.PrivilegedActionException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.security.PrivilegedExceptionAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.util.NoSuchElementException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.util.Properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import javax.naming.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * VersionHelper was used by JNDI to accommodate differences between
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * JDK 1.1.x and the Java 2 platform. As this is no longer necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * since JNDI's inclusion in the platform, this class currently
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * serves as a set of utilities for performing system-level things,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * such as class-loading and reading system properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @author Rosanna Lee
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @author Scott Seligman
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
final class VersionHelper12 extends VersionHelper {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private boolean getSystemPropsFailed = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    VersionHelper12() {} // Disallow external from creating one of these.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    public Class loadClass(String className) throws ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        ClassLoader cl = getContextClassLoader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        return Class.forName(className, true, cl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
      * Package private.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    Class loadClass(String className, ClassLoader cl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        throws ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        return Class.forName(className, true, cl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @param className A non-null fully qualified class name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @param codebase A non-null, space-separated list of URL strings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    public Class loadClass(String className, String codebase)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        throws ClassNotFoundException, MalformedURLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        ClassLoader cl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        ClassLoader parent = getContextClassLoader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        cl = URLClassLoader.newInstance(getUrlArray(codebase), parent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        return Class.forName(className, true, cl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    String getJndiProperty(final int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        return (String) AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            new PrivilegedAction() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                        return System.getProperty(PROPS[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                    } catch (SecurityException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    String[] getJndiProperties() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        if (getSystemPropsFailed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            return null;        // after one failure, don't bother trying again
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        Properties sysProps = (Properties) AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            new PrivilegedAction() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                        return System.getProperties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                    } catch (SecurityException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                        getSystemPropsFailed = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        if (sysProps == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        String[] jProps = new String[PROPS.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        for (int i = 0; i < PROPS.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            jProps[i] = sysProps.getProperty(PROPS[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        return jProps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    InputStream getResourceAsStream(final Class c, final String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        return (InputStream) AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            new PrivilegedAction() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                    return c.getResourceAsStream(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    InputStream getJavaHomeLibStream(final String filename) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        return (InputStream) AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            new PrivilegedAction() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                        String javahome = System.getProperty("java.home");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                        if (javahome == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                        String pathname = javahome + java.io.File.separator +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                            "lib" + java.io.File.separator + filename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                        return new java.io.FileInputStream(pathname);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                    } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    NamingEnumeration getResources(final ClassLoader cl, final String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        Enumeration urls;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            urls = (Enumeration) AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                new PrivilegedExceptionAction() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                    public Object run() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                        return (cl == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                            ? ClassLoader.getSystemResources(name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                            : cl.getResources(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        } catch (PrivilegedActionException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            throw (IOException)e.getException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        return new InputStreamEnumeration(urls);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    ClassLoader getContextClassLoader() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        return (ClassLoader) AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            new PrivilegedAction() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                    return Thread.currentThread().getContextClassLoader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Given an enumeration of URLs, an instance of this class represents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * an enumeration of their InputStreams.  Each operation on the URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * enumeration is performed within a doPrivileged block.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * This is used to enumerate the resources under a foreign codebase.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * This class is not MT-safe.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    class InputStreamEnumeration implements NamingEnumeration {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        private final Enumeration urls;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        private Object nextElement = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        InputStreamEnumeration(Enumeration urls) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            this.urls = urls;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
         * Returns the next InputStream, or null if there are no more.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
         * An InputStream that cannot be opened is skipped.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        private Object getNextElement() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            return AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                new PrivilegedAction() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                    public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                        while (urls.hasMoreElements()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                                return ((URL)urls.nextElement()).openStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                            } catch (IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                                // skip this URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        public boolean hasMore() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            if (nextElement != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            nextElement = getNextElement();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            return (nextElement != null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        public boolean hasMoreElements() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            return hasMore();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        public Object next() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            if (hasMore()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                Object res = nextElement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                nextElement = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                return res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                throw new NoSuchElementException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        public Object nextElement() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            return next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        public void close() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
}