ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1368934 - /ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java
Date Fri, 03 Aug 2012 13:14:27 GMT
Author: jawi
Date: Fri Aug  3 13:14:27 2012
New Revision: 1368934

URL: http://svn.apache.org/viewvc?rev=1368934&view=rev
Log:
Method XmlTag.valueOf is called quite often for non-existing enum values; this causes lots
of overhead due to the generated exceptions. Use a more defensive style of determining an
XmlTag for a given string value.

Modified:
    ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java

Modified: ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java?rev=1368934&r1=1368933&r2=1368934&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java
(original)
+++ ace/sandbox/marrs/org.apache.ace.deployment.provider.repositorybased/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java
Fri Aug  3 13:14:27 2012
@@ -281,12 +281,13 @@ class BaseRepositoryHandler extends Defa
          * @return a {@link XmlTag} representation of the given tag-name, never <code>null</code>.
          */
         public static XmlTag asXmlTag(String name) {
-            try {
-                return valueOf(name);
-            }
-            catch (Exception e) {
-                return XmlTag.unknown;
-            }
+        	XmlTag[] values = { artifacts, attributes, deploymentArtifact, deploymentversion,
deploymentversions, directives, repository, tags, targetID, url, version };
+			for (int i = 0; i < values.length; i++) {
+        		if (values[i].name().equals(name)) {
+        			return values[i];
+        		}
+        	}
+            return XmlTag.unknown;
         }
     }
 }
\ No newline at end of file



Mime
View raw message