src/java.base/share/classes/java/security/CodeSource.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 451             }
 452         }
 453         // everything matches
 454         return true;
 455     }
 456 
 457     /**
 458      * Returns a string describing this CodeSource, telling its
 459      * URL and certificates.
 460      *
 461      * @return information about this CodeSource.
 462      */
 463     @Override
 464     public String toString() {
 465         StringBuilder sb = new StringBuilder();
 466         sb.append("(");
 467         sb.append(this.location);
 468 
 469         if (this.certs != null && this.certs.length > 0) {
 470             for (int i = 0; i < this.certs.length; i++) {
 471                 sb.append( " " + this.certs[i]);
 472             }
 473 
 474         } else if (this.signers != null && this.signers.length > 0) {
 475             for (int i = 0; i < this.signers.length; i++) {
 476                 sb.append( " " + this.signers[i]);
 477             }
 478         } else {
 479             sb.append(" <no signer certificates>");
 480         }
 481         sb.append(")");
 482         return sb.toString();
 483     }
 484 
 485     /**
 486      * Writes this object out to a stream (i.e., serializes it).
 487      *
 488      * @serialData An initial {@code URL} is followed by an
 489      * {@code int} indicating the number of certificates to follow
 490      * (a value of "zero" denotes that there are no certificates associated
 491      * with this object).
 492      * Each certificate is written out starting with a {@code String}
 493      * denoting the certificate type, followed by an
 494      * {@code int} specifying the length of the certificate encoding,
 495      * followed by the certificate encoding itself which is written out as an
 496      * array of bytes. Finally, if any code signers are present then the array




 451             }
 452         }
 453         // everything matches
 454         return true;
 455     }
 456 
 457     /**
 458      * Returns a string describing this CodeSource, telling its
 459      * URL and certificates.
 460      *
 461      * @return information about this CodeSource.
 462      */
 463     @Override
 464     public String toString() {
 465         StringBuilder sb = new StringBuilder();
 466         sb.append("(");
 467         sb.append(this.location);
 468 
 469         if (this.certs != null && this.certs.length > 0) {
 470             for (int i = 0; i < this.certs.length; i++) {
 471                 sb.append(' ').append(this.certs[i]);
 472             }
 473 
 474         } else if (this.signers != null && this.signers.length > 0) {
 475             for (int i = 0; i < this.signers.length; i++) {
 476                 sb.append(' ').append(this.signers[i]);
 477             }
 478         } else {
 479             sb.append(" <no signer certificates>");
 480         }
 481         sb.append(")");
 482         return sb.toString();
 483     }
 484 
 485     /**
 486      * Writes this object out to a stream (i.e., serializes it).
 487      *
 488      * @serialData An initial {@code URL} is followed by an
 489      * {@code int} indicating the number of certificates to follow
 490      * (a value of "zero" denotes that there are no certificates associated
 491      * with this object).
 492      * Each certificate is written out starting with a {@code String}
 493      * denoting the certificate type, followed by an
 494      * {@code int} specifying the length of the certificate encoding,
 495      * followed by the certificate encoding itself which is written out as an
 496      * array of bytes. Finally, if any code signers are present then the array