1 /*
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.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
354 * or else throw an exception
355 */
356 return false;
357 }
358
359 /*
360 * Clone current state. The state is cloned as each cert is
361 * added to the path. This is necessary if backtracking occurs,
362 * and a prior state needs to be restored.
363 *
364 * Note that this is a SMART clone. Not all fields are fully copied,
365 * because some of them (e.g., subjKeyId) will
366 * not have their contents modified by subsequent calls to updateState.
367 */
368 @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
369 public Object clone() {
370 try {
371 ReverseState clonedState = (ReverseState) super.clone();
372
373 /* clone checkers, if cloneable */
374 clonedState.userCheckers =
375 (ArrayList<PKIXCertPathChecker>)userCheckers.clone();
376 ListIterator<PKIXCertPathChecker> li =
377 clonedState.userCheckers.listIterator();
378 while (li.hasNext()) {
379 PKIXCertPathChecker checker = li.next();
380 if (checker instanceof Cloneable) {
381 li.set((PKIXCertPathChecker)checker.clone());
382 }
383 }
384
385 /* make copy of name constraints */
386 if (nc != null) {
387 clonedState.nc = (NameConstraintsExtension) nc.clone();
388 }
389
390 /* make copy of policy tree */
391 if (rootNode != null) {
392 clonedState.rootNode = rootNode.copyTree();
393 }
394
395 return clonedState;
|
1 /*
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
354 * or else throw an exception
355 */
356 return false;
357 }
358
359 /*
360 * Clone current state. The state is cloned as each cert is
361 * added to the path. This is necessary if backtracking occurs,
362 * and a prior state needs to be restored.
363 *
364 * Note that this is a SMART clone. Not all fields are fully copied,
365 * because some of them (e.g., subjKeyId) will
366 * not have their contents modified by subsequent calls to updateState.
367 */
368 @SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
369 public Object clone() {
370 try {
371 ReverseState clonedState = (ReverseState) super.clone();
372
373 /* clone checkers, if cloneable */
374 clonedState.userCheckers = userCheckers.clone();
375 ListIterator<PKIXCertPathChecker> li =
376 clonedState.userCheckers.listIterator();
377 while (li.hasNext()) {
378 PKIXCertPathChecker checker = li.next();
379 if (checker instanceof Cloneable) {
380 li.set((PKIXCertPathChecker)checker.clone());
381 }
382 }
383
384 /* make copy of name constraints */
385 if (nc != null) {
386 clonedState.nc = (NameConstraintsExtension) nc.clone();
387 }
388
389 /* make copy of policy tree */
390 if (rootNode != null) {
391 clonedState.rootNode = rootNode.copyTree();
392 }
393
394 return clonedState;
|