persistence@glassfish.java.net

review fix for 924

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Wed, 30 Aug 2006 19:08:43 -0700

Team,

Please review. There are 3 changes in the fix:
a) Replaced System.getProperties().getProperty() with
System.getProperty();
b) Added doPrivileged blocks around (b1) one really needed
System.getProperties() call, and (b2) logger.setLevel.

Changes are also attached.

thanks,
-marina


(b1) Index:
src/java/oracle/toplink/essentials/internal/ejb/cmp3/base/PropertiesHandler.java
===================================================================
RCS file:
/cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/ejb/cmp3/base/PropertiesHandler.java,v
retrieving revision 1.1
diff -r1.1 PropertiesHandler.java
28a29,30
> import java.security.AccessController;
> import java.security.PrivilegedAction;
176c178,185
< Iterator it = System.getProperties().entrySet().iterator();
---
>             Iterator it = (Iterator)AccessController.doPrivileged(
>                 new PrivilegedAction() {
>                     public Object run() {
>                         return System.getProperties().entrySet().iterator();
>                     }
>                 }
>             );
>
(b2) Index: src/java/oracle/toplink/essentials/logging/JavaLog.java
===================================================================
RCS file:
/cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/logging/JavaLog.java,v
retrieving revision 1.3
diff -r1.3 JavaLog.java
30a31,32
> import java.security.AccessController;
> import java.security.PrivilegedAction;
121,123c123,130
<     public void setLevel(int level, String category) {
<         Logger logger = getLogger(category);
<         logger.setLevel(getJavaLevel(level));
---
>     public void setLevel(final int level, String category) {
>         final Logger logger = getLogger(category);
>         AccessController.doPrivileged(new PrivilegedAction() {
>             public Object run() {
>                 logger.setLevel(getJavaLevel(level));
>                 return null; // nothing to return
>             }
>         });
(a) Index: src/java/oracle/toplink/essentials/internal/weaving/TopLinkWeaver.java
===================================================================
RCS file:
/cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/weaving/TopLinkWeaver.java,v
retrieving revision 1.8
diff -r1.8 TopLinkWeaver.java
95c95
<             String outputPath =
System.getProperties().getProperty(WEAVING_OUTPUT_PATH, "");
---
>             String outputPath = System.getProperty(WEAVING_OUTPUT_PATH, "");
128c128
<                 if
(!System.getProperties().getProperty(WEAVING_SHOULD_OVERWRITE,
"false").equalsIgnoreCase("true")){
---
>                 if (!System.getProperty(WEAVING_SHOULD_OVERWRITE,
"false").equalsIgnoreCase("true")){