You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Xuelei Fan <xu...@vimino.com> on 2013/08/13 10:18:29 UTC

Patch, DEREncodedKeyValue.supportedKeyTypes should be private

Hi,

In package org.apache.xml.security.keys.content, field 
DEREncodedKeyValue.supportedKeyTypes is declared as public:

     public static final String supportedKeyTypes[] = { "RSA", "DSA", "EC"};

However, the field is never used in other classes.  It's better to 
declare it as private to minimize the scope of this variable. 
Otherwise, FindBugs would complain that "Field should be package protected".

Here is the simple patch:

$ svn  diff DEREncodedKeyValue.java
Index: DEREncodedKeyValue.java
===================================================================
--- DEREncodedKeyValue.java     (revision 1513379)
+++ DEREncodedKeyValue.java     (working copy)
@@ -38,7 +38,7 @@
public class DEREncodedKeyValue extends Signature11ElementProxy 
implements KeyInfoContent {

      /** JCA algorithm key types supported by this implementation. */
-    public static final String supportedKeyTypes[] = { "RSA", "DSA", "EC"};
+    private static final String supportedKeyTypes[] = { "RSA", "DSA", 
"EC"};

      /**
       * Constructor DEREncodedKeyValue


Regards,
Xuelei Fan

Re: Patch, DEREncodedKeyValue.supportedKeyTypes should be private

Posted by Colm O hEigeartaigh <co...@apache.org>.
I will make it package protected, thanks for your contribution.

Colm.


On Tue, Aug 13, 2013 at 9:18 AM, Xuelei Fan <xu...@vimino.com> wrote:

> Hi,
>
> In package org.apache.xml.security.keys.**content, field
> DEREncodedKeyValue.**supportedKeyTypes is declared as public:
>
>     public static final String supportedKeyTypes[] = { "RSA", "DSA", "EC"};
>
> However, the field is never used in other classes.  It's better to declare
> it as private to minimize the scope of this variable. Otherwise, FindBugs
> would complain that "Field should be package protected".
>
> Here is the simple patch:
>
> $ svn  diff DEREncodedKeyValue.java
> Index: DEREncodedKeyValue.java
> ==============================**==============================**=======
> --- DEREncodedKeyValue.java     (revision 1513379)
> +++ DEREncodedKeyValue.java     (working copy)
> @@ -38,7 +38,7 @@
> public class DEREncodedKeyValue extends Signature11ElementProxy implements
> KeyInfoContent {
>
>      /** JCA algorithm key types supported by this implementation. */
> -    public static final String supportedKeyTypes[] = { "RSA", "DSA",
> "EC"};
> +    private static final String supportedKeyTypes[] = { "RSA", "DSA",
> "EC"};
>
>      /**
>       * Constructor DEREncodedKeyValue
>
>
> Regards,
> Xuelei Fan
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com