jdk/src/share/classes/sun/security/x509/CertificatePoliciesExtension.java
changeset 10336 0bb1999251f8
parent 5506 202f599c92aa
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 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
   187     }
   187     }
   188 
   188 
   189     /**
   189     /**
   190      * Set the attribute value.
   190      * Set the attribute value.
   191      */
   191      */
       
   192     @SuppressWarnings("unchecked") // Checked with an instanceof check
   192     public void set(String name, Object obj) throws IOException {
   193     public void set(String name, Object obj) throws IOException {
   193         if (name.equalsIgnoreCase(POLICIES)) {
   194         if (name.equalsIgnoreCase(POLICIES)) {
   194             if (!(obj instanceof List)) {
   195             if (!(obj instanceof List)) {
   195                 throw new IOException("Attribute value should be of type List.");
   196                 throw new IOException("Attribute value should be of type List.");
   196             }
   197             }
   204     }
   205     }
   205 
   206 
   206     /**
   207     /**
   207      * Get the attribute value.
   208      * Get the attribute value.
   208      */
   209      */
   209     public Object get(String name) throws IOException {
   210     public List<PolicyInformation> get(String name) throws IOException {
   210         if (name.equalsIgnoreCase(POLICIES)) {
   211         if (name.equalsIgnoreCase(POLICIES)) {
   211             //XXXX May want to consider cloning this
   212             //XXXX May want to consider cloning this
   212             return certPolicies;
   213             return certPolicies;
   213         } else {
   214         } else {
   214           throw new IOException("Attribute name [" + name +
   215           throw new IOException("Attribute name [" + name +