[jboss-cvs] JBossAS SVN: r96615 - projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 20 00:54:08 EST 2009
Author: ALRubinger
Date: 2009-11-20 00:54:08 -0500 (Fri, 20 Nov 2009)
New Revision: 96615
Removed:
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable/UrlCopyUtil.java
Modified:
projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable/DeployableUrl.java
Log:
[EMB-68] Remove utility class, move single method into DeployableUrl
Modified: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable/DeployableUrl.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable/DeployableUrl.java 2009-11-20 05:52:18 UTC (rev 96614)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable/DeployableUrl.java 2009-11-20 05:54:08 UTC (rev 96615)
@@ -16,6 +16,7 @@
*/
package org.jboss.embedded.core.deployable;
+import java.net.MalformedURLException;
import java.net.URL;
import org.jboss.embedded.api.Deployable;
@@ -57,7 +58,7 @@
}
// Set (a defensive copy)
- this.url = UrlCopyUtil.copyURL(url);
+ this.url = copyURL(url);
}
//-------------------------------------------------------------------------------------||
@@ -71,7 +72,7 @@
@Override
public URL getTarget()
{
- return UrlCopyUtil.copyURL(this.url);
+ return copyURL(this.url);
}
//-------------------------------------------------------------------------------------||
@@ -125,4 +126,34 @@
{
return this.getClass().getSimpleName() + " [url=" + url.toExternalForm() + "]";
}
+
+ //-------------------------------------------------------------------------------------||
+ // Internal Helper Methods ------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Copies and returns the specified URL. Used
+ * to ensure we don't export mutable URLs (thread safety)
+ *
+ * @param url
+ * @return
+ */
+ private static URL copyURL(final URL url)
+ {
+ // If null, return
+ if (url == null)
+ {
+ return url;
+ }
+
+ try
+ {
+ // Copy
+ return new URL(url.toExternalForm());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException("Error in copying URL", e);
+ }
+ }
}
Deleted: projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable/UrlCopyUtil.java
===================================================================
--- projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable/UrlCopyUtil.java 2009-11-20 05:52:18 UTC (rev 96614)
+++ projects/embedded/trunk/core/src/main/java/org/jboss/embedded/core/deployable/UrlCopyUtil.java 2009-11-20 05:54:08 UTC (rev 96615)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.embedded.core.deployable;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * Simple utility to copy URLs
- * (so that we don't export mutable objects)
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-final class UrlCopyUtil
-{
-
- //-------------------------------------------------------------------------------------||
- // Constructor ------------------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- private UrlCopyUtil()
- {
- throw new UnsupportedOperationException("No instances permitted");
- }
-
- //-------------------------------------------------------------------------------------||
- // Functional Methods -----------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
-
- /**
- * Copies and returns the specified URL. Used
- * to ensure we don't export mutable URLs (thread safety)
- *
- * @param url
- * @return
- */
- static URL copyURL(final URL url)
- {
- // If null, return
- if (url == null)
- {
- return url;
- }
-
- try
- {
- // Copy
- return new URL(url.toExternalForm());
- }
- catch (MalformedURLException e)
- {
- throw new RuntimeException("Error in copying URL", e);
- }
- }
-}
More information about the jboss-cvs-commits
mailing list