diff --git a/api/src/main/java/jakarta/mail/EncodingAware.java b/api/src/main/java/jakarta/mail/EncodingAware.java index d05d7dee..2d3697cb 100644 --- a/api/src/main/java/jakarta/mail/EncodingAware.java +++ b/api/src/main/java/jakarta/mail/EncodingAware.java @@ -51,5 +51,5 @@ public interface EncodingAware { * * @return the Content-Transfer-Encoding value, or null */ - public String getEncoding(); + String getEncoding(); } diff --git a/api/src/main/java/jakarta/mail/Flags.java b/api/src/main/java/jakarta/mail/Flags.java index 6d03ca67..da4d4bb7 100644 --- a/api/src/main/java/jakarta/mail/Flags.java +++ b/api/src/main/java/jakarta/mail/Flags.java @@ -537,7 +537,7 @@ public String toString() { return sb.toString(); } - /***** + /* public static void main(String argv[]) throws Exception { // a new flags object Flags f1 = new Flags(); diff --git a/api/src/main/java/jakarta/mail/MailLogger.java b/api/src/main/java/jakarta/mail/MailLogger.java index e7f07a46..b770a689 100644 --- a/api/src/main/java/jakarta/mail/MailLogger.java +++ b/api/src/main/java/jakarta/mail/MailLogger.java @@ -393,7 +393,7 @@ private String packageOf(Class clazz) { */ private StackTraceElement inferCaller() { // Get the stack trace. - StackTraceElement stack[] = (new Throwable()).getStackTrace(); + StackTraceElement[] stack = (new Throwable()).getStackTrace(); // First, search back to a method in the Logger class. int ix = 0; while (ix < stack.length) { diff --git a/api/src/main/java/jakarta/mail/MessageAware.java b/api/src/main/java/jakarta/mail/MessageAware.java index ea154089..5eb7f78f 100644 --- a/api/src/main/java/jakarta/mail/MessageAware.java +++ b/api/src/main/java/jakarta/mail/MessageAware.java @@ -32,5 +32,5 @@ public interface MessageAware { * * @return the message context */ - public MessageContext getMessageContext(); + MessageContext getMessageContext(); } diff --git a/api/src/main/java/jakarta/mail/MultipartDataSource.java b/api/src/main/java/jakarta/mail/MultipartDataSource.java index 1b4dc084..031610b2 100644 --- a/api/src/main/java/jakarta/mail/MultipartDataSource.java +++ b/api/src/main/java/jakarta/mail/MultipartDataSource.java @@ -42,7 +42,7 @@ public interface MultipartDataSource extends DataSource { * * @return number of parts */ - public int getCount(); + int getCount(); /** * Get the specified Part. Parts are numbered starting at 0. @@ -53,6 +53,6 @@ public interface MultipartDataSource extends DataSource { * is out of range. * @throws MessagingException for other failures */ - public BodyPart getBodyPart(int index) throws MessagingException; + BodyPart getBodyPart(int index) throws MessagingException; } diff --git a/api/src/main/java/jakarta/mail/Part.java b/api/src/main/java/jakarta/mail/Part.java index 5eb5bd4d..9743ed1b 100644 --- a/api/src/main/java/jakarta/mail/Part.java +++ b/api/src/main/java/jakarta/mail/Part.java @@ -89,7 +89,7 @@ public interface Part { * @return size of content in bytes * @throws MessagingException for failures */ - public int getSize() throws MessagingException; + int getSize() throws MessagingException; /** * Return the number of lines in the content of this part. @@ -102,7 +102,7 @@ public interface Part { * @return number of lines in the content. * @throws MessagingException for failures */ - public int getLineCount() throws MessagingException; + int getLineCount() throws MessagingException; /** * Returns the Content-Type of the content of this part. @@ -114,7 +114,7 @@ public interface Part { * @throws MessagingException for failures * @see jakarta.activation.DataHandler */ - public String getContentType() throws MessagingException; + String getContentType() throws MessagingException; /** * Is this Part of the specified MIME type? This method @@ -134,7 +134,7 @@ public interface Part { * @return true if this part is of the specified type * @throws MessagingException for failures */ - public boolean isMimeType(String mimeType) throws MessagingException; + boolean isMimeType(String mimeType) throws MessagingException; /** * This part should be presented as an attachment. @@ -142,7 +142,7 @@ public interface Part { * @see #getDisposition * @see #setDisposition */ - public static final String ATTACHMENT = "attachment"; + String ATTACHMENT = "attachment"; /** * This part should be presented inline. @@ -150,7 +150,7 @@ public interface Part { * @see #getDisposition * @see #setDisposition */ - public static final String INLINE = "inline"; + String INLINE = "inline"; /** * Return the disposition of this part. The disposition @@ -169,7 +169,7 @@ public interface Part { * @see #INLINE * @see #getFileName */ - public String getDisposition() throws MessagingException; + String getDisposition() throws MessagingException; /** * Set the disposition of this part. @@ -184,7 +184,7 @@ public interface Part { * @see #INLINE * @see #setFileName */ - public void setDisposition(String disposition) throws MessagingException; + void setDisposition(String disposition) throws MessagingException; /** * Return a description String for this part. This typically @@ -194,7 +194,7 @@ public interface Part { * @return description of this part * @throws MessagingException for failures */ - public String getDescription() throws MessagingException; + String getDescription() throws MessagingException; /** * Set a description String for this part. This typically @@ -207,7 +207,7 @@ public interface Part { * from a READ_ONLY folder * @throws MessagingException for other failures */ - public void setDescription(String description) throws MessagingException; + void setDescription(String description) throws MessagingException; /** * Get the filename associated with this part, if possible. @@ -218,7 +218,7 @@ public interface Part { * @return Filename to associate with this part * @throws MessagingException for failures */ - public String getFileName() throws MessagingException; + String getFileName() throws MessagingException; /** * Set the filename associated with this part, if possible. @@ -233,7 +233,7 @@ public interface Part { * from a READ_ONLY folder * @throws MessagingException for other failures */ - public void setFileName(String filename) throws MessagingException; + void setFileName(String filename) throws MessagingException; /** * Return an input stream for this part's "content". Any @@ -251,7 +251,7 @@ public interface Part { * @see #getDataHandler * @see jakarta.activation.DataHandler#getInputStream */ - public InputStream getInputStream() + InputStream getInputStream() throws IOException, MessagingException; /** @@ -262,7 +262,7 @@ public InputStream getInputStream() * @return DataHandler for the content * @throws MessagingException for failures */ - public DataHandler getDataHandler() throws MessagingException; + DataHandler getDataHandler() throws MessagingException; /** * Return the content as a Java object. The type of the returned @@ -282,7 +282,7 @@ public InputStream getInputStream() * @throws MessagingException for other failures * @see jakarta.activation.DataHandler#getContent */ - public Object getContent() throws IOException, MessagingException; + Object getContent() throws IOException, MessagingException; /** * This method provides the mechanism to set this part's content. @@ -295,7 +295,7 @@ public InputStream getInputStream() * from a READ_ONLY folder * @throws MessagingException for other failures */ - public void setDataHandler(DataHandler dh) throws MessagingException; + void setDataHandler(DataHandler dh) throws MessagingException; /** * A convenience method for setting this part's content. The part @@ -315,7 +315,7 @@ public InputStream getInputStream() * from a READ_ONLY folder * @throws MessagingException for other failures */ - public void setContent(Object obj, String type) + void setContent(Object obj, String type) throws MessagingException; /** @@ -330,7 +330,7 @@ public void setContent(Object obj, String type) * from a READ_ONLY folder * @throws MessagingException for other failures */ - public void setText(String text) throws MessagingException; + void setText(String text) throws MessagingException; /** * This method sets the given Multipart object as this message's @@ -344,7 +344,7 @@ public void setContent(Object obj, String type) * from a READ_ONLY folder * @throws MessagingException for other failures */ - public void setContent(Multipart mp) throws MessagingException; + void setContent(Multipart mp) throws MessagingException; /** * Output a bytestream for this Part. This bytestream is @@ -364,7 +364,7 @@ public void setContent(Object obj, String type) * data to be written * @see jakarta.activation.DataHandler#writeTo */ - public void writeTo(OutputStream os) throws IOException, MessagingException; + void writeTo(OutputStream os) throws IOException, MessagingException; /** * Get all the headers for this header name. Returns null @@ -375,7 +375,7 @@ public void setContent(Object obj, String type) * this name * @throws MessagingException for failures */ - public String[] getHeader(String header_name) + String[] getHeader(String header_name) throws MessagingException; /** @@ -391,7 +391,7 @@ public String[] getHeader(String header_name) * obtained from a READ_ONLY folder * @throws MessagingException for other failures */ - public void setHeader(String header_name, String header_value) + void setHeader(String header_name, String header_value) throws MessagingException; /** @@ -406,7 +406,7 @@ public void setHeader(String header_name, String header_value) * obtained from a READ_ONLY folder * @throws MessagingException for other failures */ - public void addHeader(String header_name, String header_value) + void addHeader(String header_name, String header_value) throws MessagingException; /** @@ -420,7 +420,7 @@ public void addHeader(String header_name, String header_value) * obtained from a READ_ONLY folder * @throws MessagingException for other failures */ - public void removeHeader(String header_name) + void removeHeader(String header_name) throws MessagingException; /** @@ -430,7 +430,7 @@ public void removeHeader(String header_name) * @return enumeration of Header objects * @throws MessagingException for failures */ - public Enumeration
getAllHeaders() throws MessagingException; + Enumeration
getAllHeaders() throws MessagingException; /** * Return matching headers from this part as an Enumeration of @@ -440,7 +440,7 @@ public void removeHeader(String header_name) * @return enumeration of Header objects * @throws MessagingException for failures */ - public Enumeration
getMatchingHeaders(String[] header_names) + Enumeration
getMatchingHeaders(String[] header_names) throws MessagingException; /** @@ -451,6 +451,6 @@ public Enumeration
getMatchingHeaders(String[] header_names) * @return enumeration of Header objects * @throws MessagingException for failures */ - public Enumeration
getNonMatchingHeaders(String[] header_names) + Enumeration
getNonMatchingHeaders(String[] header_names) throws MessagingException; } diff --git a/api/src/main/java/jakarta/mail/Session.java b/api/src/main/java/jakarta/mail/Session.java index 97f960e8..49b60746 100644 --- a/api/src/main/java/jakarta/mail/Session.java +++ b/api/src/main/java/jakarta/mail/Session.java @@ -1430,5 +1430,5 @@ private Iterator lookupUsingHk2ServiceLoader(String factoryId) { * code that loads resources from stream. */ interface StreamLoader { - public void load(InputStream is) throws IOException; + void load(InputStream is) throws IOException; } diff --git a/api/src/main/java/jakarta/mail/UIDFolder.java b/api/src/main/java/jakarta/mail/UIDFolder.java index 799b15b8..5ff77a03 100644 --- a/api/src/main/java/jakarta/mail/UIDFolder.java +++ b/api/src/main/java/jakarta/mail/UIDFolder.java @@ -65,7 +65,7 @@ public interface UIDFolder { * * @see FetchProfile */ - public static class FetchProfileItem extends FetchProfile.Item { + class FetchProfileItem extends FetchProfile.Item { protected FetchProfileItem(String name) { super(name); } @@ -96,7 +96,7 @@ protected FetchProfileItem(String name) { * * @see #getMessagesByUID */ - public static final long LASTUID = -1; + long LASTUID = -1; /** * The largest value possible for a UID, a 32-bit unsigned integer. @@ -113,7 +113,7 @@ protected FetchProfileItem(String name) { * * @since JavaMail 1.6 */ - public static final long MAXUID = 0xffffffffL; // max 32-bit unsigned int + long MAXUID = 0xffffffffL; // max 32-bit unsigned int /** * Returns the UIDValidity value associated with this folder.

@@ -125,7 +125,7 @@ protected FetchProfileItem(String name) { * @return UIDValidity * @throws MessagingException for failures */ - public long getUIDValidity() throws MessagingException; + long getUIDValidity() throws MessagingException; /** * Get the Message corresponding to the given UID. If no such @@ -136,7 +136,7 @@ protected FetchProfileItem(String name) { * if no message corresponding to this UID is obtained. * @throws MessagingException for failures */ - public Message getMessageByUID(long uid) throws MessagingException; + Message getMessageByUID(long uid) throws MessagingException; /** * Get the Messages specified by the given range. The special @@ -155,7 +155,7 @@ protected FetchProfileItem(String name) { * @throws MessagingException for failures * @see #LASTUID */ - public Message[] getMessagesByUID(long start, long end) + Message[] getMessagesByUID(long start, long end) throws MessagingException; /** @@ -170,7 +170,7 @@ public Message[] getMessagesByUID(long start, long end) * @return array of Message objects * @throws MessagingException for failures */ - public Message[] getMessagesByUID(long[] uids) + Message[] getMessagesByUID(long[] uids) throws MessagingException; /** @@ -184,7 +184,7 @@ public Message[] getMessagesByUID(long[] uids) * is not in this Folder. * @throws MessagingException for other failures */ - public long getUID(Message message) throws MessagingException; + long getUID(Message message) throws MessagingException; /** * Returns the predicted UID that will be assigned to the @@ -202,5 +202,5 @@ public Message[] getMessagesByUID(long[] uids) * @throws MessagingException for failures * @since JavaMail 1.6 */ - public long getUIDNext() throws MessagingException; + long getUIDNext() throws MessagingException; } diff --git a/api/src/main/java/jakarta/mail/URLName.java b/api/src/main/java/jakarta/mail/URLName.java index f6dc95e6..0ed9dab0 100644 --- a/api/src/main/java/jakarta/mail/URLName.java +++ b/api/src/main/java/jakarta/mail/URLName.java @@ -619,7 +619,7 @@ private static String _encode(String s) { } - /** + /* * The class contains a utility method for converting from * a MIME format called "x-www-form-urlencoded" * to a String diff --git a/api/src/main/java/jakarta/mail/event/ConnectionListener.java b/api/src/main/java/jakarta/mail/event/ConnectionListener.java index 94da46a9..2cdeb1d7 100644 --- a/api/src/main/java/jakarta/mail/event/ConnectionListener.java +++ b/api/src/main/java/jakarta/mail/event/ConnectionListener.java @@ -29,7 +29,7 @@ public interface ConnectionListener extends java.util.EventListener { * * @param e the ConnectionEvent */ - public void opened(ConnectionEvent e); + void opened(ConnectionEvent e); /** * Invoked when a Store is disconnected. Note that a folder @@ -37,12 +37,12 @@ public interface ConnectionListener extends java.util.EventListener { * * @param e the ConnectionEvent */ - public void disconnected(ConnectionEvent e); + void disconnected(ConnectionEvent e); /** * Invoked when a Store/Folder/Transport is closed. * * @param e the ConnectionEvent */ - public void closed(ConnectionEvent e); + void closed(ConnectionEvent e); } diff --git a/api/src/main/java/jakarta/mail/event/FolderListener.java b/api/src/main/java/jakarta/mail/event/FolderListener.java index 9aa92c19..473dbfb3 100644 --- a/api/src/main/java/jakarta/mail/event/FolderListener.java +++ b/api/src/main/java/jakarta/mail/event/FolderListener.java @@ -28,19 +28,19 @@ public interface FolderListener extends java.util.EventListener { * * @param e the FolderEvent */ - public void folderCreated(FolderEvent e); + void folderCreated(FolderEvent e); /** * Invoked when a folder is deleted. * * @param e the FolderEvent */ - public void folderDeleted(FolderEvent e); + void folderDeleted(FolderEvent e); /** * Invoked when a folder is renamed. * * @param e the FolderEvent */ - public void folderRenamed(FolderEvent e); + void folderRenamed(FolderEvent e); } diff --git a/api/src/main/java/jakarta/mail/event/MessageChangedListener.java b/api/src/main/java/jakarta/mail/event/MessageChangedListener.java index 2622c6c1..49570495 100644 --- a/api/src/main/java/jakarta/mail/event/MessageChangedListener.java +++ b/api/src/main/java/jakarta/mail/event/MessageChangedListener.java @@ -31,5 +31,5 @@ public interface MessageChangedListener extends java.util.EventListener { * @see MessageChangedEvent#FLAGS_CHANGED * @see MessageChangedEvent#ENVELOPE_CHANGED */ - public void messageChanged(MessageChangedEvent e); + void messageChanged(MessageChangedEvent e); } diff --git a/api/src/main/java/jakarta/mail/event/MessageCountListener.java b/api/src/main/java/jakarta/mail/event/MessageCountListener.java index 9f80ce80..f6ee0b01 100644 --- a/api/src/main/java/jakarta/mail/event/MessageCountListener.java +++ b/api/src/main/java/jakarta/mail/event/MessageCountListener.java @@ -28,12 +28,12 @@ public interface MessageCountListener extends java.util.EventListener { * * @param e the MessageCountEvent */ - public void messagesAdded(MessageCountEvent e); + void messagesAdded(MessageCountEvent e); /** * Invoked when messages are removed (expunged) from a folder. * * @param e the MessageCountEvent */ - public void messagesRemoved(MessageCountEvent e); + void messagesRemoved(MessageCountEvent e); } diff --git a/api/src/main/java/jakarta/mail/event/StoreListener.java b/api/src/main/java/jakarta/mail/event/StoreListener.java index a979212f..77c06921 100644 --- a/api/src/main/java/jakarta/mail/event/StoreListener.java +++ b/api/src/main/java/jakarta/mail/event/StoreListener.java @@ -31,5 +31,5 @@ public interface StoreListener extends java.util.EventListener { * @see StoreEvent#ALERT * @see StoreEvent#NOTICE */ - public void notification(StoreEvent e); + void notification(StoreEvent e); } diff --git a/api/src/main/java/jakarta/mail/event/TransportListener.java b/api/src/main/java/jakarta/mail/event/TransportListener.java index e929ec6a..9ba4c098 100644 --- a/api/src/main/java/jakarta/mail/event/TransportListener.java +++ b/api/src/main/java/jakarta/mail/event/TransportListener.java @@ -32,7 +32,7 @@ public interface TransportListener extends java.util.EventListener { * * @param e TransportEvent */ - public void messageDelivered(TransportEvent e); + void messageDelivered(TransportEvent e); /** * Invoked when a Message is not delivered. @@ -40,7 +40,7 @@ public interface TransportListener extends java.util.EventListener { * @param e TransportEvent * @see TransportEvent */ - public void messageNotDelivered(TransportEvent e); + void messageNotDelivered(TransportEvent e); /** * Invoked when a Message is partially delivered. @@ -48,5 +48,5 @@ public interface TransportListener extends java.util.EventListener { * @param e TransportEvent * @see TransportEvent */ - public void messagePartiallyDelivered(TransportEvent e); + void messagePartiallyDelivered(TransportEvent e); } diff --git a/api/src/main/java/jakarta/mail/internet/HeaderTokenizer.java b/api/src/main/java/jakarta/mail/internet/HeaderTokenizer.java index b295a70d..f65b3456 100644 --- a/api/src/main/java/jakarta/mail/internet/HeaderTokenizer.java +++ b/api/src/main/java/jakarta/mail/internet/HeaderTokenizer.java @@ -330,7 +330,7 @@ else if (c == ')') return collectString(endOfAtom, keepEscapes); } currentPos++; // re-position currentPos - char ch[] = new char[1]; + char[] ch = new char[1]; ch[0] = c; return new Token((int) c, new String(ch)); } diff --git a/api/src/main/java/jakarta/mail/internet/InternetAddress.java b/api/src/main/java/jakarta/mail/internet/InternetAddress.java index 54afa818..b74f21ac 100644 --- a/api/src/main/java/jakarta/mail/internet/InternetAddress.java +++ b/api/src/main/java/jakarta/mail/internet/InternetAddress.java @@ -94,7 +94,7 @@ public InternetAddress() { */ public InternetAddress(String address) throws AddressException { // use our address parsing utility routine to parse the string - InternetAddress a[] = parse(address, true); + InternetAddress[] a = parse(address, true); // if we got back anything other than a single address, it's an error if (a.length != 1) throw new AddressException("Illegal address", address); diff --git a/api/src/main/java/jakarta/mail/internet/InternetHeaders.java b/api/src/main/java/jakarta/mail/internet/InternetHeaders.java index be4dfdf2..2d2f8598 100644 --- a/api/src/main/java/jakarta/mail/internet/InternetHeaders.java +++ b/api/src/main/java/jakarta/mail/internet/InternetHeaders.java @@ -154,7 +154,7 @@ static class MatchEnum { private Iterator e; // enum object of headers List // XXX - is this overkill? should we step through in index // order instead? - private String names[]; // names to match, or not + private String[] names; // names to match, or not private boolean match; // return matching headers? private boolean want_line; // return header lines? private InternetHeader next_header; // the next header to be returned @@ -165,7 +165,7 @@ static class MatchEnum { * matching or non-matching headers, and whether to return * header lines or Header objects. */ - MatchEnum(List v, String n[], boolean m, boolean l) { + MatchEnum(List v, String[] n, boolean m, boolean l) { e = v.iterator(); names = n; match = m; @@ -479,7 +479,7 @@ public String[] getHeader(String name) { if (v.size() == 0) return (null); // convert List to an array for return - String r[] = new String[v.size()]; + String[] r = new String[v.size()]; r = v.toArray(r); return (r); } @@ -497,7 +497,7 @@ public String[] getHeader(String name) { * this name, or null if none */ public String getHeader(String name, String delimiter) { - String s[] = getHeader(name); + String[] s = getHeader(name); if (s == null) return null; diff --git a/api/src/main/java/jakarta/mail/internet/MailDateFormat.java b/api/src/main/java/jakarta/mail/internet/MailDateFormat.java index dbfb2214..0f4ae64f 100644 --- a/api/src/main/java/jakarta/mail/internet/MailDateFormat.java +++ b/api/src/main/java/jakarta/mail/internet/MailDateFormat.java @@ -329,14 +329,6 @@ public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { /** * Returns the date, as specified by the parameters. * - * @param dayName - * @param day - * @param month - * @param year - * @param hour - * @param minute - * @param second - * @param zone * @return the date, as specified by the parameters * @throws IllegalArgumentException if this instance's Calendar is * non-lenient and any of the parameters have invalid values, or if dayName diff --git a/api/src/main/java/jakarta/mail/internet/MimeMessage.java b/api/src/main/java/jakarta/mail/internet/MimeMessage.java index 0746b28a..7fc26abb 100644 --- a/api/src/main/java/jakarta/mail/internet/MimeMessage.java +++ b/api/src/main/java/jakarta/mail/internet/MimeMessage.java @@ -1727,7 +1727,7 @@ public Message reply(boolean replyToAll, boolean setAnswered) subject = "Re: " + subject; reply.setHeader("Subject", subject); } - Address a[] = getReplyTo(); + Address[] a = getReplyTo(); reply.setRecipients(Message.RecipientType.TO, a); if (replyToAll) { List

v = new ArrayList<>(); diff --git a/api/src/main/java/jakarta/mail/internet/MimePart.java b/api/src/main/java/jakarta/mail/internet/MimePart.java index 65a30054..ca2a2e81 100644 --- a/api/src/main/java/jakarta/mail/internet/MimePart.java +++ b/api/src/main/java/jakarta/mail/internet/MimePart.java @@ -63,7 +63,7 @@ public interface MimePart extends Part { * this name * @throws MessagingException for failures */ - public String getHeader(String name, String delimiter) + String getHeader(String name, String delimiter) throws MessagingException; /** @@ -76,7 +76,7 @@ public String getHeader(String name, String delimiter) * obtained from a READ_ONLY folder * @throws MessagingException for other failures */ - public void addHeaderLine(String line) throws MessagingException; + void addHeaderLine(String line) throws MessagingException; /** * Get all header lines as an Enumeration of Strings. A Header @@ -86,7 +86,7 @@ public String getHeader(String name, String delimiter) * @return an Enumeration of Strings * @throws MessagingException for failures */ - public Enumeration getAllHeaderLines() throws MessagingException; + Enumeration getAllHeaderLines() throws MessagingException; /** * Get matching header lines as an Enumeration of Strings. @@ -97,7 +97,7 @@ public String getHeader(String name, String delimiter) * @return an Enumeration of Strings * @throws MessagingException for failures */ - public Enumeration getMatchingHeaderLines(String[] names) + Enumeration getMatchingHeaderLines(String[] names) throws MessagingException; /** @@ -109,7 +109,7 @@ public Enumeration getMatchingHeaderLines(String[] names) * @return an Enumeration of Strings * @throws MessagingException for failures */ - public Enumeration getNonMatchingHeaderLines(String[] names) + Enumeration getNonMatchingHeaderLines(String[] names) throws MessagingException; /** @@ -118,7 +118,7 @@ public Enumeration getNonMatchingHeaderLines(String[] names) * @return content-transfer-encoding * @throws MessagingException for failures */ - public String getEncoding() throws MessagingException; + String getEncoding() throws MessagingException; /** * Get the Content-ID of this part. Returns null if none present. @@ -126,7 +126,7 @@ public Enumeration getNonMatchingHeaderLines(String[] names) * @return content-ID * @throws MessagingException for failures */ - public String getContentID() throws MessagingException; + String getContentID() throws MessagingException; /** * Get the Content-MD5 digest of this part. Returns null if @@ -135,7 +135,7 @@ public Enumeration getNonMatchingHeaderLines(String[] names) * @return content-MD5 * @throws MessagingException for failures */ - public String getContentMD5() throws MessagingException; + String getContentMD5() throws MessagingException; /** * Set the Content-MD5 of this part. @@ -146,7 +146,7 @@ public Enumeration getNonMatchingHeaderLines(String[] names) * @throws IllegalStateException if this Part is * obtained from a READ_ONLY folder */ - public void setContentMD5(String md5) throws MessagingException; + void setContentMD5(String md5) throws MessagingException; /** * Get the language tags specified in the Content-Language header @@ -157,7 +157,7 @@ public Enumeration getNonMatchingHeaderLines(String[] names) * @return array of content language strings * @throws MessagingException for failures */ - public String[] getContentLanguage() throws MessagingException; + String[] getContentLanguage() throws MessagingException; /** * Set the Content-Language header of this MimePart. The @@ -169,7 +169,7 @@ public Enumeration getNonMatchingHeaderLines(String[] names) * @throws IllegalStateException if this Part is * obtained from a READ_ONLY folder */ - public void setContentLanguage(String[] languages) + void setContentLanguage(String[] languages) throws MessagingException; /** @@ -192,7 +192,7 @@ public void setContentLanguage(String[] languages) * @see #setText(String text, String charset) */ @Override - public void setText(String text) throws MessagingException; + void setText(String text) throws MessagingException; /** * Convenience method that sets the given String as this part's @@ -205,7 +205,7 @@ public void setContentLanguage(String[] languages) * @param charset the charset to use for the text * @throws MessagingException if an error occurs */ - public void setText(String text, String charset) + void setText(String text, String charset) throws MessagingException; /** @@ -221,6 +221,6 @@ public void setText(String text, String charset) * @throws MessagingException if an error occurs * @since JavaMail 1.4 */ - public void setText(String text, String charset, String subtype) + void setText(String text, String charset, String subtype) throws MessagingException; } diff --git a/api/src/main/java/jakarta/mail/internet/MimeUtility.java b/api/src/main/java/jakarta/mail/internet/MimeUtility.java index 0b9577e5..f2f6f52b 100644 --- a/api/src/main/java/jakarta/mail/internet/MimeUtility.java +++ b/api/src/main/java/jakarta/mail/internet/MimeUtility.java @@ -1585,7 +1585,7 @@ static int checkAscii(InputStream is, int max, boolean breakOnNonAscii) { int linelen = 0; boolean longLine = false, badEOL = false; boolean checkEOL = encodeEolStrict && breakOnNonAscii; - byte buf[] = null; + byte[] buf = null; if (max != 0) { block = (max == ALL) ? 4096 : Math.min(max, 4096); buf = new byte[block]; @@ -1793,12 +1793,12 @@ public void write(int b) throws IOException { } @Override - public void write(byte b[]) throws IOException { + public void write(byte[] b) throws IOException { write(b, 0, b.length); } @Override - public void write(byte b[], int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { len += off; for (int i = off; i < len; i++) check(b[i]); diff --git a/api/src/main/java/jakarta/mail/internet/ParameterList.java b/api/src/main/java/jakarta/mail/internet/ParameterList.java index 4eee4ccb..cfab9a7d 100644 --- a/api/src/main/java/jakarta/mail/internet/ParameterList.java +++ b/api/src/main/java/jakarta/mail/internet/ParameterList.java @@ -757,7 +757,7 @@ private static String quote(String value) { return MimeUtility.quote(value, HeaderTokenizer.MIME); } - private static final char hex[] = { + private static final char[] hex = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; diff --git a/api/src/main/java/jakarta/mail/internet/SharedInputStream.java b/api/src/main/java/jakarta/mail/internet/SharedInputStream.java index 937dd408..bac2c4a8 100644 --- a/api/src/main/java/jakarta/mail/internet/SharedInputStream.java +++ b/api/src/main/java/jakarta/mail/internet/SharedInputStream.java @@ -42,7 +42,7 @@ public interface SharedInputStream { * * @return the current position */ - public long getPosition(); + long getPosition(); /** * Return a new InputStream representing a subset of the data @@ -56,5 +56,5 @@ public interface SharedInputStream { * @param end the ending position + 1 * @return the new stream */ - public InputStream newStream(long start, long end); + InputStream newStream(long start, long end); } diff --git a/api/src/main/java/jakarta/mail/internet/package-info.java b/api/src/main/java/jakarta/mail/internet/package-info.java index 00f863ac..bcf81a00 100644 --- a/api/src/main/java/jakarta/mail/internet/package-info.java +++ b/api/src/main/java/jakarta/mail/internet/package-info.java @@ -512,7 +512,7 @@ * With some network configurations, InetAddress.getCanonicalHostName may be * slow or may return an address instead of a host name. * In that case, setting this System property to false will cause the - * {@link java.net.InetAddress#getHostName InetAddress.getHostName} + * {@link java.net.InetAddress#getHostName() InetAddress.getHostName()} * method to be used instead. * The default is true. * diff --git a/api/src/main/java/jakarta/mail/util/SharedFileInputStream.java b/api/src/main/java/jakarta/mail/util/SharedFileInputStream.java index d6f23d50..199197e8 100644 --- a/api/src/main/java/jakarta/mail/util/SharedFileInputStream.java +++ b/api/src/main/java/jakarta/mail/util/SharedFileInputStream.java @@ -250,7 +250,7 @@ private void fill() throws IOException { int nsz = pos * 2; if (nsz > marklimit) nsz = marklimit; - byte nbuf[] = new byte[nsz]; + byte[] nbuf = new byte[nsz]; System.arraycopy(buf, 0, nbuf, 0, pos); buf = nbuf; } @@ -329,7 +329,7 @@ private int read1(byte[] b, int off, int len) throws IOException { * @throws IOException if an I/O error occurs. */ @Override - public synchronized int read(byte b[], int off, int len) + public synchronized int read(byte[] b, int off, int len) throws IOException { ensureOpen(); if ((off | len | (off + len) | (b.length - (off + len))) < 0) { diff --git a/api/src/main/java/jakarta/mail/util/StreamProvider.java b/api/src/main/java/jakarta/mail/util/StreamProvider.java index 95bdfbcb..4160ae34 100644 --- a/api/src/main/java/jakarta/mail/util/StreamProvider.java +++ b/api/src/main/java/jakarta/mail/util/StreamProvider.java @@ -37,7 +37,7 @@ public interface StreamProvider { * * @since JavaMail 2.1 */ - public static enum EncoderTypes { + enum EncoderTypes { BASE_64("base64"), B_ENCODER("b"), @@ -52,7 +52,7 @@ public static enum EncoderTypes { private final String encoder; - private EncoderTypes(String encoder) { + EncoderTypes(String encoder) { this.encoder = encoder; } @@ -188,7 +188,7 @@ public String getEncoder() { * * @return a stream provider */ - public static StreamProvider provider() { + static StreamProvider provider() { if (System.getSecurityManager() != null) { return AccessController.doPrivileged(new PrivilegedAction() { public StreamProvider run() { diff --git a/api/src/test/java/jakarta/mail/internet/HeaderTokenizerTest.java b/api/src/test/java/jakarta/mail/internet/HeaderTokenizerTest.java index d2335bc8..276e91e5 100644 --- a/api/src/test/java/jakarta/mail/internet/HeaderTokenizerTest.java +++ b/api/src/test/java/jakarta/mail/internet/HeaderTokenizerTest.java @@ -72,7 +72,7 @@ public void test() { test(header, value, expect); } - public static void main(String argv[]) throws Exception { + public static void main(String[] argv) throws Exception { int optind; for (optind = 0; optind < argv.length; optind++) { if (argv[optind].equals("-")) { @@ -197,7 +197,7 @@ public static void parse(BufferedReader in) throws IOException { /** * Test the header's value to see if we can tokenize it as expected. */ - public static void test(String header, String value, String expect[]) { + public static void test(String header, String value, String[] expect) { PrintStream out = System.out; if (gen_test_input) out.println(header + ": " + value); diff --git a/api/src/test/java/jakarta/mail/internet/InternetAddressTest.java b/api/src/test/java/jakarta/mail/internet/InternetAddressTest.java index d602e806..069cd363 100644 --- a/api/src/test/java/jakarta/mail/internet/InternetAddressTest.java +++ b/api/src/test/java/jakarta/mail/internet/InternetAddressTest.java @@ -72,7 +72,7 @@ public static Collection data() throws IOException { return testData; } - public static void main(String argv[]) throws Exception { + public static void main(String[] argv) throws Exception { verbose = true; // default for standalone int optind; for (optind = 0; optind < argv.length; optind++) { @@ -242,7 +242,7 @@ public void testAddress() { /** * Test the header's value to see if we can parse it as expected. */ - public static void test(String header, String value, String expect[], + public static void test(String header, String value, String[] expect, boolean doStrict, boolean doParseHeader) { PrintStream out = System.out; if (gen_test_input)