11/*
2- * Copyright (c) 1997, 2022 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 1997, 2023 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
5050import java .io .Serializable ;
5151import java .security .AccessController ;
5252import java .security .PrivilegedAction ;
53+ import java .util .Objects ;
5354import java .util .StringTokenizer ;
5455
5556import sun .awt .AWTAccessor ;
@@ -850,10 +851,7 @@ public static ICC_Profile getInstance(int cspace) {
850851 * {@code java.class.path} property; finally, in a directory used to store
851852 * profiles always available, such as the profile for sRGB. Built-in
852853 * profiles use {@code .pf} as the file name extension for profiles, e.g.
853- * {@code sRGB.pf}. This method throws an {@code IOException} if the
854- * specified file cannot be opened or if an I/O error occurs while reading
855- * the file. It throws an {@code IllegalArgumentException} if the file does
856- * not contain valid ICC Profile data.
854+ * {@code sRGB.pf}.
857855 *
858856 * @param fileName the file that contains the data for the profile
859857 * @return an {@code ICC_Profile} object corresponding to the data in the
@@ -864,6 +862,7 @@ public static ICC_Profile getInstance(int cspace) {
864862 * Profile data
865863 * @throws SecurityException If a security manager is installed and it does
866864 * not permit read access to the given file
865+ * @throws NullPointerException if {@code fileName} is {@code null}
867866 */
868867 public static ICC_Profile getInstance (String fileName ) throws IOException {
869868 InputStream is ;
@@ -883,19 +882,18 @@ public static ICC_Profile getInstance(String fileName) throws IOException {
883882
884883 /**
885884 * Constructs an {@code ICC_Profile} corresponding to the data in an
886- * {@code InputStream}. This method throws an
887- * {@code IllegalArgumentException} if the stream does not contain valid ICC
888- * Profile data. It throws an {@code IOException} if an I/O error occurs
889- * while reading the stream.
885+ * {@code InputStream}.
890886 *
891887 * @param s the input stream from which to read the profile data
892888 * @return an {@code ICC_Profile} object corresponding to the data in the
893889 * specified {@code InputStream}
894890 * @throws IOException If an I/O error occurs while reading the stream
895891 * @throws IllegalArgumentException If the stream does not contain valid ICC
896892 * Profile data
893+ * @throws NullPointerException if {@code s} is {@code null}
897894 */
898895 public static ICC_Profile getInstance (InputStream s ) throws IOException {
896+ Objects .requireNonNull (s );
899897 return getInstance (getProfileDataFromStream (s ));
900898 }
901899
@@ -1046,6 +1044,7 @@ public int getPCSType() {
10461044 * @param fileName the file to write the profile data to
10471045 * @throws IOException If the file cannot be opened for writing or an I/O
10481046 * error occurs while writing to the file
1047+ * @throws NullPointerException if {@code fileName} is {@code null}
10491048 */
10501049 public void write (String fileName ) throws IOException {
10511050 try (OutputStream out = new FileOutputStream (fileName )) {
@@ -1058,6 +1057,7 @@ public void write(String fileName) throws IOException {
10581057 *
10591058 * @param s the stream to write the profile data to
10601059 * @throws IOException If an I/O error occurs while writing to the stream
1060+ * @throws NullPointerException if {@code s} is {@code null}
10611061 */
10621062 public void write (OutputStream s ) throws IOException {
10631063 s .write (getData ());
0 commit comments