jdk/src/share/classes/sun/security/x509/PolicyMappingsExtension.java
changeset 10336 0bb1999251f8
parent 5506 202f599c92aa
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    26 package sun.security.x509;
    26 package sun.security.x509;
    27 
    27 
    28 import java.io.IOException;
    28 import java.io.IOException;
    29 import java.io.OutputStream;
    29 import java.io.OutputStream;
    30 import java.util.*;
    30 import java.util.*;
    31 
       
    32 import java.security.cert.CertificateException;
       
    33 
    31 
    34 import sun.security.util.*;
    32 import sun.security.util.*;
    35 
    33 
    36 /**
    34 /**
    37  * Represent the Policy Mappings Extension.
    35  * Represent the Policy Mappings Extension.
   163     }
   161     }
   164 
   162 
   165     /**
   163     /**
   166      * Set the attribute value.
   164      * Set the attribute value.
   167      */
   165      */
       
   166     @SuppressWarnings("unchecked") // Checked with instanceof
   168     public void set(String name, Object obj) throws IOException {
   167     public void set(String name, Object obj) throws IOException {
   169         if (name.equalsIgnoreCase(MAP)) {
   168         if (name.equalsIgnoreCase(MAP)) {
   170             if (!(obj instanceof List)) {
   169             if (!(obj instanceof List)) {
   171               throw new IOException("Attribute value should be of" +
   170               throw new IOException("Attribute value should be of" +
   172                                     " type List.");
   171                                     " type List.");
   180     }
   179     }
   181 
   180 
   182     /**
   181     /**
   183      * Get the attribute value.
   182      * Get the attribute value.
   184      */
   183      */
   185     public Object get(String name) throws IOException {
   184     public List<CertificatePolicyMap> get(String name) throws IOException {
   186         if (name.equalsIgnoreCase(MAP)) {
   185         if (name.equalsIgnoreCase(MAP)) {
   187             return (maps);
   186             return (maps);
   188         } else {
   187         } else {
   189           throw new IOException("Attribute name not recognized by " +
   188           throw new IOException("Attribute name not recognized by " +
   190                         "CertAttrSet:PolicyMappingsExtension.");
   189                         "CertAttrSet:PolicyMappingsExtension.");