You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jh...@apache.org on 2015/06/11 14:32:09 UTC

ant git commit: little refactoring

Repository: ant
Updated Branches:
  refs/heads/master 3a3575562 -> fdf5d315e


little refactoring


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/fdf5d315
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/fdf5d315
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/fdf5d315

Branch: refs/heads/master
Commit: fdf5d315e0c1fd75f605d49f1a98b41a6a564241
Parents: 3a35755
Author: Jan Matèrne <jh...@apache.org>
Authored: Thu Jun 11 14:18:43 2015 +0200
Committer: Jan Matèrne <jh...@apache.org>
Committed: Thu Jun 11 14:18:43 2015 +0200

----------------------------------------------------------------------
 .../tools/ant/types/resources/JavaConstantResource.java   | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/fdf5d315/src/main/org/apache/tools/ant/types/resources/JavaConstantResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/JavaConstantResource.java b/src/main/org/apache/tools/ant/types/resources/JavaConstantResource.java
index a947c9a..e8c8f02 100644
--- a/src/main/org/apache/tools/ant/types/resources/JavaConstantResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/JavaConstantResource.java
@@ -27,8 +27,8 @@ import java.lang.reflect.Field;
  * This lets you extract values off the classpath and use them elsewhere
  * @since Ant 1.7
  */
-
 public class JavaConstantResource extends AbstractClasspathResource {
+
     /**
      * open the input stream from a specific classloader
      *
@@ -37,20 +37,18 @@ public class JavaConstantResource extends AbstractClasspathResource {
      * @throws IOException if an error occurs.
      */
     protected InputStream openInputStream(ClassLoader cl) throws IOException {
-        Class<?> clazz;
         String constant = getName();
         if (constant == null) {
             throw new IOException("Attribute 'name' must be set.");
         }
-        int index1 = constant.lastIndexOf('.');
-        if (index1 < 0) {
+        int index = constant.lastIndexOf('.');
+        if (index < 0) {
             throw new IOException("No class name in " + constant);
         }
-        int index = index1;
         String classname = constant.substring(0, index);
         String fieldname = constant.substring(index + 1, constant.length());
         try {
-            clazz =
+            Class<?> clazz =
                 cl != null
                 ? Class.forName(classname, true, cl)
                 : Class.forName(classname);