提交 53b2d360 编写于 作者: V vinnie

6557615: Method toString() of java.security.Timestamp throws...

6557615: Method toString() of java.security.Timestamp throws IndexOutOfBoundsException if CertPath has empty
Reviewed-by: mullan
上级 29797b71
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -26,9 +26,11 @@
package java.security;
import java.io.Serializable;
import java.security.cert.Certificate;
import java.security.cert.CertPath;
import java.security.cert.X509Extension;
import java.util.Date;
import java.util.List;
/**
* This class encapsulates information about a signed timestamp.
......@@ -142,7 +144,12 @@ public final class Timestamp implements Serializable {
StringBuffer sb = new StringBuffer();
sb.append("(");
sb.append("timestamp: " + timestamp);
sb.append("TSA: " + signerCertPath.getCertificates().get(0));
List<? extends Certificate> certs = signerCertPath.getCertificates();
if (!certs.isEmpty()) {
sb.append("TSA: " + certs.get(0));
} else {
sb.append("TSA: <empty>");
}
sb.append(")");
return sb.toString();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册