tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject incubator-tamaya git commit: TAMAYA-53 Reduced the number of statements executed in a privileged block.
Date Mon, 09 Feb 2015 08:01:08 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master c82940e2f -> 897703d8c


TAMAYA-53 Reduced the number of statements executed in a privileged block.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/897703d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/897703d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/897703d8

Branch: refs/heads/master
Commit: 897703d8c2bfda05724f4f0627c6c49de0cc7ea3
Parents: c82940e
Author: Oliver B. Fischer <plexus@apache.org>
Authored: Mon Feb 9 09:00:47 2015 +0100
Committer: Oliver B. Fischer <plexus@apache.org>
Committed: Mon Feb 9 09:00:47 2015 +0100

----------------------------------------------------------------------
 .../resources/findbugs/findbugs-exclude.xml     | 31 +++++++-------------
 .../tamaya/inject/internal/ConfiguredField.java | 12 ++++----
 2 files changed, 15 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/897703d8/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
----------------------------------------------------------------------
diff --git a/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml b/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
index 7712adf..3da23a4 100644
--- a/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
+++ b/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
@@ -19,7 +19,7 @@ under the License.
 -->
 <FindBugsFilter>
     <Match>
-        <!-- Note:
+        <!-- Note: @todo Write a bug report
           The current version of FindBugs (version 3.0.0) is not able to detect
           the usage of this method via a method reference.
           Oliver B. Fischer, 17.01.2015
@@ -28,6 +28,15 @@ under the License.
     </Match>
 
     <Match>
+        <!-- Note: @todo Write a bug report
+          The current version of FindBugs (version 3.0.0) is not able to detect
+          correctly caught exceptions.
+          Oliver B. Fischer, 09.02.2015
+        -->
+        <Bug pattern="REC_CATCH_EXCEPTION"/>
+    </Match>
+
+    <Match>
         <!-- Note: We will not fail because of an unread field. -->
         <Bug pattern="URF_UNREAD_FIELD" />
     </Match>
@@ -39,26 +48,6 @@ under the License.
 
     <Match>
         <!-- Note:
-             False positive reported by FindBugs 3.0.0 for exception
-             thrown in try-with-resource.
-             Oliver B. Fischer, 17.01.2015
-        -->
-        <Class name='org.apache.tamaya.format.PropertiesXmlFormat'/>
-        <Bug pattern="REC_CATCH_EXCEPTION"/>
-    </Match>
-
-    <Match>
-        <!-- Note:
-             False positive reported by FindBugs 3.0.0 for exception
-             thrown in try-with-resource.
-             Oliver B. Fischer, 17.01.2015
-        -->
-        <Class name='org.apache.tamaya.format.PropertiesFormat'/>
-        <Bug pattern="REC_CATCH_EXCEPTION"/>
-    </Match>
-
-    <Match>
-        <!-- Note:
              Intended. See the inline comment on this issue in the source file
              in revision ae66299e25b41167008021ffe95cad236f6e2bd3
              Oliver B. Fischer, 17.01.2015

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/897703d8/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
index f2a0869..8bde306 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredField.java
@@ -83,14 +83,12 @@ public class ConfiguredField {
             // Check for adapter/filter
             Object value = InjectionUtils.adaptValue(this.annotatedField, TypeLiteral.of(this.annotatedField.getType()),
evaluatedValue);
 
-            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
-                @Override
-                public Object run() throws Exception {
-                    annotatedField.setAccessible(true);
-                    annotatedField.set(target, value);
-                    return value;
-                }
+            AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () ->
{
+                annotatedField.setAccessible(true);
+                return annotatedField;
             });
+
+            annotatedField.set(target, value);
         } catch (Exception e) {
             throw new ConfigException("Failed to annotation configured field: " + this.annotatedField.getDeclaringClass()
                     .getName() + '.' + annotatedField.getName(), e);


Mime
View raw message