Jtest logo




Contents  Previous  Next  Index

PORT.ENV


Do not use "System.getenv()"

Description

This rule flags any occurrence of `System.getenv()'.

`System.getenv()' has been deprecated because it is not portable.

Example

 package PORT;
 public class ENV {
     void method (String name) {
         System.getenv(name);
         java.lang.System.getenv(name);
     }
 }

Repair

Use `System.getProperty()' and the corresponding `getTypeName()' methods of the "boolean", "integer", and "long" primitive types.

Reference

Flanagan, David. Java in a Nutshell. O'Reilly, 1999, pp.190-192.


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft