Skip to content

Commit

Permalink
move to src level 11,
Browse files Browse the repository at this point in the history
update build plugins,
fix build time warnings,
clean up codebase

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Feb 10, 2022
1 parent 2994beb commit 0339eb7
Show file tree
Hide file tree
Showing 24 changed files with 256 additions and 221 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

strategy:
matrix:
java_version: [ 11, 17-ea ]
java_version: [ 17 ]

steps:
- name: Checkout for build
Expand All @@ -33,5 +33,8 @@ jobs:
with:
distribution: 'zulu'
java-version: ${{ matrix.java_version }}
cache: maven
- name: Verify
run: cd api && mvn -B -V -U -C -Poss-release -Pstaging clean verify -Dgpg.skip=true
run: |
cd api
mvn -B -V -U -C -Poss-release,staging clean verify -Dgpg.skip=true org.glassfish.copyright:glassfish-copyright-maven-plugin:check -Dcopyright.ignoreyear=true
55 changes: 21 additions & 34 deletions api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 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 @@ -30,11 +30,12 @@
<spotbugs.exclude>${project.basedir}/../etc/spotbugs-exclude.xml</spotbugs.exclude>
<spotbugs.skip>false</spotbugs.skip>
<spotbugs.threshold>Low</spotbugs.threshold>
<spotbugs.version>4.3.0</spotbugs.version>
<spotbugs.version>4.5.3.0</spotbugs.version>

<maven.compiler.release>11</maven.compiler.release>
<extension.name>jakarta.xml.soap</extension.name>
<spec.version>1.4</spec.version>
<new.spec.version>2.0</new.spec.version>
<spec.version>2.0</spec.version>
<new.spec.version>3.0</new.spec.version>
<non.final>false</non.final>
<activation.version>2.1.0</activation.version>
<legal.doc.source>${project.basedir}/..</legal.doc.source>
Expand Down Expand Up @@ -110,7 +111,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.glassfish.copyright</groupId>
Expand All @@ -125,7 +126,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.9.0</version>
</plugin>
<plugin>
<groupId>org.glassfish.build</groupId>
Expand All @@ -135,7 +136,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version>
<version>5.1.4</version>
<configuration>
<instructions>
<_noextraheaders>true</_noextraheaders>
Expand All @@ -145,7 +146,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -155,7 +156,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
Expand All @@ -169,7 +170,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -261,27 +262,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>9</release>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-Werror</arg>
<arg>-Xdoclint:all,-missing</arg>
</compilerArgs>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
<executions>
<execution>
<id>base-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>8</release>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.glassfish.copyright</groupId>
Expand Down Expand Up @@ -336,6 +324,12 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultEntries>false</addDefaultEntries>
</manifest>
</archive>
<niceManifest>true</niceManifest>
<instructions>
<Bundle-Version>${spec.bundle.version}</Bundle-Version>
<Bundle-SymbolicName>${spec.bundle.symbolic-name}</Bundle-SymbolicName>
Expand Down Expand Up @@ -400,9 +394,10 @@
<addDefaultEntries>false</addDefaultEntries>
</manifest>
</archive>
<release>11</release>
<notimestamp>true</notimestamp>
<docfilessubdirs>true</docfilessubdirs>
<quiet>true</quiet>
<failOnWarnings>true</failOnWarnings>
<groups>
<group>
<title>Jakarta SOAP with Attachments API Packages</title>
Expand All @@ -425,18 +420,10 @@ Use is subject to <a href="{@docRoot}/doc-files/speclicense.html" target="_top">
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
<fork>true</fork>
<excludeFilterFile>${spotbugs.exclude}</excludeFilterFile>
<failThreshold>High</failThreshold>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

Expand Down
9 changes: 8 additions & 1 deletion api/src/main/java/jakarta/xml/soap/AttachmentPart.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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 @@ -102,6 +102,13 @@
*/

public abstract class AttachmentPart {

/**
* Default constructor.
*/
protected AttachmentPart() {
}

/**
* Returns the number of bytes in this {@code AttachmentPart}
* object.
Expand Down
8 changes: 4 additions & 4 deletions api/src/main/java/jakarta/xml/soap/Detail.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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 @@ -61,7 +61,7 @@ public interface Detail extends SOAPFaultElement {
*
* @see Detail#addDetailEntry(QName qname)
*/
public DetailEntry addDetailEntry(Name name) throws SOAPException;
DetailEntry addDetailEntry(Name name) throws SOAPException;

/**
* Creates a new {@code DetailEntry} object with the given
Expand All @@ -80,13 +80,13 @@ public interface Detail extends SOAPFaultElement {
* @see Detail#addDetailEntry(Name name)
* @since 1.6, SAAJ 1.3
*/
public DetailEntry addDetailEntry(QName qname) throws SOAPException;
DetailEntry addDetailEntry(QName qname) throws SOAPException;

/**
* Gets an Iterator over all of the {@code DetailEntry}s in this {@code Detail} object.
*
* @return an {@code Iterator} object over the {@code DetailEntry}
* objects in this {@code Detail} object
*/
public Iterator<DetailEntry> getDetailEntries();
Iterator<DetailEntry> getDetailEntries();
}
28 changes: 14 additions & 14 deletions api/src/main/java/jakarta/xml/soap/FactoryFinder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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 @@ -230,28 +230,29 @@ private static boolean isOsgi() {
return true;
} catch (ClassNotFoundException ignored) {
logger.log(
Level.SEVERE,
Level.FINER,
"Class " + OSGI_SERVICE_LOADER_CLASS_NAME + " cannot be loaded",
ignored
);
}
return false;
}

private static Object lookupUsingOSGiServiceLoader(String factoryId) {
private static <T> T lookupUsingOSGiServiceLoader(String factoryId) {
try {
logger.fine("Trying to create the provider from the OSGi ServiceLoader");
// Use reflection to avoid having any dependendcy on HK2 ServiceLoader class
Class<?> serviceClass = Class.forName(factoryId);
Class<?>[] args = new Class[]{serviceClass};
Class<?>[] args = new Class<?>[]{serviceClass};
Class<?> target = Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME);
Method m = target.getMethod("lookupProviderInstances", Class.class);
Iterator<?> iter = ((Iterable) m.invoke(null, (Object[]) args)).iterator();
@SuppressWarnings({"unchecked"})
Iterator<T> iter = ((Iterable<T>) m.invoke(null, (Object[]) args)).iterator();
return iter.hasNext() ? iter.next() : null;
} catch (Exception ignored) {
// log and continue
logger.log(
Level.SEVERE,
Level.FINER,
"Access to the system property with key " + factoryId + " is not allowed",
ignored
);
Expand All @@ -271,7 +272,7 @@ private static Object lookupUsingOSGiServiceLoader(String factoryId) {
* @return
* the URL for the class or null if it wasn't found
*/
static URL which(Class clazz) {
static URL which(Class<?> clazz) {
return which(clazz, getClassClassLoader(clazz));
}

Expand All @@ -287,7 +288,7 @@ static URL which(Class clazz) {
* @return
* the URL for the class or null if it wasn't found
*/
static URL which(Class clazz, ClassLoader loader) {
static URL which(Class<?> clazz, ClassLoader loader) {

String classnameAsResource = clazz.getName().replace('.', '/') + ".class";

Expand All @@ -302,18 +303,17 @@ private static ClassLoader getSystemClassLoader() {
if (System.getSecurityManager() == null) {
return ClassLoader.getSystemClassLoader();
} else {
return (ClassLoader) java.security.AccessController.doPrivileged(
(PrivilegedAction) ClassLoader::getSystemClassLoader);
return java.security.AccessController.doPrivileged(
(PrivilegedAction<ClassLoader>) ClassLoader::getSystemClassLoader);
}
}

@SuppressWarnings("unchecked")
private static ClassLoader getClassClassLoader(final Class c) {
private static ClassLoader getClassClassLoader(final Class<?> c) {
if (System.getSecurityManager() == null) {
return c.getClassLoader();
} else {
return (ClassLoader) java.security.AccessController.doPrivileged(
(PrivilegedAction) c::getClassLoader);
return java.security.AccessController.doPrivileged(
(PrivilegedAction<ClassLoader>) c::getClassLoader);
}
}

Expand Down
12 changes: 9 additions & 3 deletions api/src/main/java/jakarta/xml/soap/MessageFactory.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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 @@ -54,7 +54,13 @@
public abstract class MessageFactory {

private static final String DEFAULT_MESSAGE_FACTORY
= "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl";
= "com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl";

/**
* Default constructor.
*/
protected MessageFactory() {
}

/**
* Creates a new {@code MessageFactory} object that is an instance
Expand All @@ -74,7 +80,7 @@ public static MessageFactory newInstance() throws SOAPException {


try {
MessageFactory factory = (MessageFactory) FactoryFinder.find(
MessageFactory factory = FactoryFinder.find(
MessageFactory.class,
DEFAULT_MESSAGE_FACTORY,
false);
Expand Down
14 changes: 7 additions & 7 deletions api/src/main/java/jakarta/xml/soap/Node.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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 @@ -34,7 +34,7 @@ public interface Node extends org.w3c.dom.Node {
* {@code Text} object if such a child exists;
* {@code null} otherwise.
*/
public String getValue();
String getValue();

/**
* If this is a Text node then this method will set its value,
Expand All @@ -51,7 +51,7 @@ public interface Node extends org.w3c.dom.Node {
*
* @since 1.6, SAAJ 1.2
*/
public void setValue(String value);
void setValue(String value);

/**
* Sets the parent of this {@code Node} object to the given
Expand All @@ -64,7 +64,7 @@ public interface Node extends org.w3c.dom.Node {
* parent to the given element
* @see #getParentElement
*/
public void setParentElement(SOAPElement parent) throws SOAPException;
void setParentElement(SOAPElement parent) throws SOAPException;

/**
* Returns the parent element of this {@code Node} object.
Expand All @@ -79,12 +79,12 @@ public interface Node extends org.w3c.dom.Node {
* kept in memory
* @see #setParentElement
*/
public SOAPElement getParentElement();
SOAPElement getParentElement();

/**
* Removes this {@code Node} object from the tree.
*/
public void detachNode();
void detachNode();

/**
* Notifies the implementation that this {@code Node}
Expand All @@ -95,6 +95,6 @@ public interface Node extends org.w3c.dom.Node {
* Calling the method {@code recycleNode} implies that the method
* {@code detachNode} has been called previously.
*/
public void recycleNode();
void recycleNode();

}

0 comments on commit 0339eb7

Please sign in to comment.