mrglavas    2004/03/11 14:59:15

  Modified:    java/samples/xni ObjectFactory.java
  Log:
  Fixing a bug.

  Pass the package name not the class name to check package.
  
  Revision  Changes    Path
  1.4       +6 -3      xml-xerces/java/samples/xni/ObjectFactory.java
  
  Index: ObjectFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/samples/xni/ObjectFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ObjectFactory.java        11 Mar 2004 22:39:00 -0000      1.3
  +++ ObjectFactory.java        11 Mar 2004 22:59:15 -0000      1.4
  @@ -340,8 +340,11 @@
           //restrict the access to package as speicified in java.security policy
           SecurityManager security = System.getSecurityManager();
           try{
  -            if(security != null){
  -                security.checkPackageAccess(className);
  +            if (security != null) {
  +                final int lastDot = className.lastIndexOf(".");
  +                String packageName = className;
  +                if (lastDot != -1) packageName = className.substring(0, lastDot);
  +                security.checkPackageAccess(packageName);
               }
           }catch(SecurityException e){
               throw e ;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to