Skip to content

Commit

Permalink
codebase cleanup
Browse files Browse the repository at this point in the history
use resources the maven way,
fix some compiler warnings

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Apr 1, 2022
1 parent 876ae85 commit 955d8f8
Show file tree
Hide file tree
Showing 103 changed files with 488 additions and 513 deletions.
80 changes: 69 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,26 @@
</mailingLists>

<properties>
<copyright.exclude>${config.dir}/copyright-exclude</copyright.exclude>
<project.build.commonResourcesDirectory>${project.build.directory}/common-resources</project.build.commonResourcesDirectory>
<legal.doc.source>${project.build.commonResourcesDirectory}/legal</legal.doc.source>
<copyright.exclude>${project.build.commonResourcesDirectory}/config/copyright-exclude</copyright.exclude>
<copyright.ignoreyear>false</copyright.ignoreyear>
<copyright.scmonly>true</copyright.scmonly>
<copyright.template>${config.dir}/edl-copyright.txt</copyright.template>
<copyright.template>${project.build.commonResourcesDirectory}/config/edl-copyright.txt</copyright.template>
<copyright.update>false</copyright.update>
<spotbugs.exclude>${config.dir}/exclude.xml</spotbugs.exclude>
<spotbugs.exclude>${project.build.commonResourcesDirectory}/config/exclude.xml</spotbugs.exclude>
<spotbugs.skip>false</spotbugs.skip>
<spotbugs.threshold>Low</spotbugs.threshold>
<spotbugs.version>4.5.3.0</spotbugs.version>
<spotbugs.version>4.6.0.0</spotbugs.version>

<config.dir>etc/config</config.dir>
<legal.doc.source>../</legal.doc.source>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.testRelease>${maven.compiler.release}</maven.compiler.testRelease>
<!-- exclude big groups from the Xlint -->
<comp.xlint>-Xlint:all,-rawtypes</comp.xlint>
<!-- -Xdoclint:-missing does not seem to work properly on the infra -->
<comp.xdoclint>-Xdoclint:all,-missing</comp.xdoclint>
<warn.limit>150</warn.limit>
<jdoc.doclint>-missing</jdoc.doclint>

<activation-api.version>2.1.0</activation-api.version>
<angus-activation.version>1.0.0</angus-activation.version>
Expand Down Expand Up @@ -115,7 +123,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.9.0</version>
<version>3.10.1</version>
</plugin>
<plugin>
<groupId>org.glassfish.copyright</groupId>
Expand Down Expand Up @@ -181,6 +189,16 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -221,10 +239,6 @@
<resources>
<resource>
<directory>${legal.doc.source}</directory>
<includes>
<include>NOTICE.md</include>
<include>LICENSE.md</include>
</includes>
<targetPath>META-INF</targetPath>
</resource>
</resources>
Expand All @@ -249,6 +263,50 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>common-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>single</goal>
</goals>
<inherited>false</inherited>
<configuration>
<descriptors>
<descriptor>src/main/assembly/resources.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>metro-saaj</artifactId>
<version>${project.version}</version>
<classifier>resources</classifier>
<type>zip</type>
<outputDirectory>${project.build.commonResourcesDirectory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
Expand Down
17 changes: 11 additions & 6 deletions saaj-ri/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Copyright (c) 2011, 2021 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -41,12 +41,16 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>11</release>
<compilerArgs combine.children="append">
<arg>${comp.xlint}</arg>
<arg>${comp.xdoclint}</arg>
<arg>-Xmaxwarns</arg>
<arg>${warn.limit}</arg>
<arg>-Xmaxerrs</arg>
<arg>${warn.limit}</arg>
</compilerArgs>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -125,8 +129,9 @@
<addDefaultEntries>false</addDefaultEntries>
</manifest>
</archive>
<release>11</release>
<notimestamp>true</notimestamp>
<doclint>${jdoc.doclint}</doclint>
<quiet>true</quiet>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -31,6 +31,9 @@
* problem, such as an error in parsing a header.
*/
public class SOAPExceptionImpl extends SOAPException {

private static final long serialVersionUID = 449323096527796613L;

private Throwable cause;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand All @@ -26,6 +26,8 @@

public class MessagingException extends Exception {

private static final long serialVersionUID = 6248253386214122360L;

/**
* The next exception in the chain.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -190,7 +190,7 @@ public Token next() throws ParseException {
* Peek at the next token, without actually removing the token
* from the parse stream. Invoking this method multiple times
* will return successive tokens, until <code>next()</code> is
* called. <p>
* called.
*
* @return the next Token
* @exception ParseException if the parse fails
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -57,7 +57,7 @@
*/
public final class InternetHeaders {

private final FinalArrayList<hdr> headers = new FinalArrayList<hdr>();
private final FinalArrayList<Header> headers = new FinalArrayList<>();

/**
* Lazily cerated view of header lines (Strings).
Expand Down Expand Up @@ -151,7 +151,7 @@ public String[] getHeader(String name) {

int len = headers.size();
for( int i=0; i<len; i++ ) {
hdr h = headers.get(i);
hdr h = (hdr) headers.get(i);
if (name.equalsIgnoreCase(h.name)) {
v.add(h.getValue());
}
Expand Down Expand Up @@ -205,7 +205,7 @@ public void setHeader(String name, String value) {
boolean found = false;

for (int i = 0; i < headers.size(); i++) {
hdr h = headers.get(i);
hdr h = (hdr) headers.get(i);
if (name.equalsIgnoreCase(h.name)) {
if (!found) {
int j;
Expand Down Expand Up @@ -237,7 +237,7 @@ public void setHeader(String name, String value) {
public void addHeader(String name, String value) {
int pos = headers.size();
for (int i = headers.size() - 1; i >= 0; i--) {
hdr h = headers.get(i);
hdr h = (hdr) headers.get(i);
if (name.equalsIgnoreCase(h.name)) {
headers.add(i + 1, new hdr(name, value));
return;
Expand All @@ -256,7 +256,7 @@ public void addHeader(String name, String value) {
*/
public void removeHeader(String name) {
for (int i = 0; i < headers.size(); i++) {
hdr h = headers.get(i);
hdr h = (hdr) headers.get(i);
if (name.equalsIgnoreCase(h.name)) {
headers.remove(i);
i--; // have to look at i again
Expand All @@ -270,7 +270,7 @@ public void removeHeader(String name) {
*
* @return Header objects
*/
public FinalArrayList<hdr> getAllHeaders() {
public FinalArrayList<Header> getAllHeaders() {
return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
}

Expand All @@ -287,7 +287,7 @@ public void addHeaderLine(String line) {
try {
char c = line.charAt(0);
if (c == ' ' || c == '\t') {
hdr h = headers.get(headers.size() - 1);
hdr h = (hdr) headers.get(headers.size() - 1);
h.line += "\r\n" + line;
} else
headers.add(new hdr(line));
Expand All @@ -309,7 +309,7 @@ public List<String> getAllHeaderLines() {
headerValueView = new AbstractList<String>() {
@Override
public String get(int index) {
return headers.get(index).line;
return ((hdr) headers.get(index)).line;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand All @@ -17,6 +17,7 @@
package com.sun.xml.messaging.saaj.packaging.mime.internet;


import com.sun.xml.messaging.saaj.packaging.mime.Header;
import com.sun.xml.messaging.saaj.packaging.mime.MessagingException;
import com.sun.xml.messaging.saaj.packaging.mime.util.OutputUtil;
import com.sun.xml.messaging.saaj.util.ByteOutputStream;
Expand Down Expand Up @@ -757,7 +758,7 @@ public InputStream getInputStream()
* Produce the raw bytes of the content. This method is used
* when creating a DataHandler object for the content. Subclasses
* that can provide a separate input stream for just the MimeBodyPart
* content might want to override this method. <p>
* content might want to override this method.
*
* @see #content
*/
Expand Down Expand Up @@ -1079,7 +1080,7 @@ public void removeHeader(String name) {
*
* @return all headers
*/
public FinalArrayList<hdr> getAllHeaders() {
public FinalArrayList<Header> getAllHeaders() {
return headers.getAllHeaders();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -172,7 +172,7 @@ public MimeMultipart(DataSource ds, ContentType ct) throws MessagingException {
/**
* Set the subtype. This method should be invoked only on a new
* MimeMultipart object created by the client. The default subtype
* of such a multipart object is "mixed". <p>
* of such a multipart object is "mixed".
*
* @param subtype Subtype
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -205,7 +205,7 @@ public static String getEncoding(DataSource ds) {
* "text/plain" String) because all the I/O is done in this
* thread. In the case requiring an <code>InputStream</code> the
* <code>DataHandler</code> uses a thread, a pair of pipe streams,
* and the <code>writeTo</code> method to produce the data. <p>
* and the <code>writeTo</code> method to produce the data.
*
* @param dh data handler
*
Expand Down Expand Up @@ -582,7 +582,7 @@ public static String encodeWord(String word)
* characters, it is first character-encoded using the specified
* charset, then transfer-encoded using either the B or Q encoding.
* The resulting bytes are then returned as a Unicode string
* containing only ASCII characters. <p>
* containing only ASCII characters.
*
* @param word unicode string
* @param charset the MIME charset
Expand Down Expand Up @@ -711,7 +711,7 @@ private static void doEncode(String string, boolean b64,
* an "encoded-word". If the parse fails, a ParseException is
* thrown. Otherwise, it is transfer-decoded, and then
* charset-converted into Unicode. If the charset-conversion
* fails, an UnsupportedEncodingException is thrown.<p>
* fails, an UnsupportedEncodingException is thrown.
*
* @param eword the possibly encoded value
* @return deocoded word
Expand Down Expand Up @@ -1035,8 +1035,8 @@ private static int indexOfAny(String s, String any, int start) {
}

/**
* Convert a MIME charset name into a valid Java charset name. <p>
*
* Convert a MIME charset name into a valid Java charset name.
*
* @param charset the MIME charset name
* @return the Java charset equivalent. If a suitable mapping is
* not available, the passed in charset is itself returned.
Expand Down Expand Up @@ -1079,7 +1079,7 @@ public static String mimeCharset(String charset) {
* Get the default charset corresponding to the system's current
* default locale. If the System property <code>mail.mime.charset</code>
* is set, a system charset corresponding to this MIME charset will be
* returned. <p>
* returned.
*
* @return the default charset of the system's default locale,
* as a Java charset. (NOT a MIME charset)
Expand Down
Loading

0 comments on commit 955d8f8

Please sign in to comment.