File newFile = new File(base, newName);
- file.renameTo(newFile);
+ if (!file.renameTo(newFile)) {
+ throw new NamingException(sm.getString("resources.renameFail",
+ oldName, newName));
+ }
}
resources.alreadyStarted=Resources has already been started
resources.connect=Cannot connect to document base {0}
resources.input=Cannot create input stream for resource {0}
+resources.invalidCache=Unable to create a resource cache of type [{0}]
resources.notStarted=Resources has not yet been started
resources.null=Document base cannot be null
resources.notFound=Resource {0} not found
resources.path=Context relative path {0} must start with ''/''
+resources.renameFail=Failed to rename [{0}] to [{1}]
resources.alreadyBound=Name {0} is already bound in this Context
resources.bindFailed=Bind failed: {0}
resources.unbindFailed=Unbind failed: {0}
cache = (ResourceCache)
Class.forName(cacheClassName).newInstance();
} catch (Exception e) {
- //FIXME
- e.printStackTrace();
+ throw new IllegalArgumentException(sm.getString(
+ "resources.invalidCache", cacheClassName), e);
}
cache.setCacheMaxSize(baseDirContext.getCacheMaxSize());
cacheTTL = baseDirContext.getCacheTTL();
int i = 0;
while (true) {
- i = (b + a) / 2;
+ i = (b + a) >>> 1;
int result = name.compareTo(map[i].name);
if (result > 0) {
a = i;
public int compareTo(Object o) {
if (!(o instanceof Entry))
return (+1);
- return (name.compareTo(((Entry) o).getName()));
+ return name.compareTo(((Entry) o).getName());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof Entry))
+ return false;
+ return name.equals(((Entry) o).getName());
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
}
public ZipEntry getEntry() {
+++ /dev/null
-/*
- * 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.resources.jndi;
-
-import org.apache.naming.resources.DirContextURLStreamHandler;
-
-/**
- * Stream handler to a JNDI directory context.
- *
- * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision$
- */
-public class Handler extends DirContextURLStreamHandler {
-
- public Handler() {
- // NOOP
- }
-}