Skip to content

Commit

Permalink
Fix compiler warnings, editorconfig and checkstyle violations
Browse files Browse the repository at this point in the history
Ignore bin folders (editorconfig), harvester2 package (checkstyle)
  • Loading branch information
fsteeg committed Aug 29, 2022
1 parent 49d97ef commit 1d5e880
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 23 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ editorconfig {
'**/*.bzip2',
'**/*.gzip',
'**/*.xz',
'gradlew*'
'gradlew*',
'**/bin'
]
}

Expand Down Expand Up @@ -242,7 +243,7 @@ gradle.projectsEvaluated {
}
}

//'upload' vs. 'publish, see
//'upload' vs. 'publish, see
//https://medium.com/dot-debug/deploying-artifacts-to-maven-using-gradle-b669acc1b6f8'
/*
task publish {
Expand All @@ -264,7 +265,7 @@ gradle.projectsEvaluated {
repositories {
maven {
name = 'localEmbedded'
// run generated gradle task `./gradlew
// run generated gradle task `./gradlew
// publishMavenArtifactsPublicationToLocalEmbeddedRepository`
// to publish all subprojects into the same local embedded repo:
url = "file://${rootDir}/build/repo"
Expand Down
2 changes: 1 addition & 1 deletion config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<module name="SuppressWarningsFilter" />
<module name="SuppressionSingleFilter">
<property name="checks" value=".*"/>
<property name="files" value="generated-src"/>
<property name="files" value="generated-src|harvester2"/>
</module>
<module name="TreeWalker">
<module name="AbstractClassName"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@

package org.metafacture.biblio;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathException;

import org.metafacture.framework.MetafactureException;
import org.metafacture.framework.ObjectReceiver;
import org.metafacture.framework.annotations.Description;
import org.metafacture.framework.annotations.In;
import org.metafacture.framework.annotations.Out;
import org.metafacture.framework.helpers.DefaultObjectPipe;

import org.oclc.oai.harvester2.app.RawWrite;
import org.xml.sax.SAXException;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathException;

/**
* Opens an OAI-PMH stream and passes a reader to the receiver.
*
Expand Down Expand Up @@ -114,7 +114,7 @@ public void process(final String baseUrl) {
catch (final NoSuchFieldException e) {
e.printStackTrace();
}
catch (XPathException e) {
catch (final XPathException e) {
e.printStackTrace();
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public static void main(String[] args) {
try {
System.out.println(new Date());

HashMap options = getOptions(args);
List rootArgs = (List) options.get("rootArgs");
HashMap<String, Object> options = getOptions(args);
List<?> rootArgs = (List<?>) options.get("rootArgs");
String baseURL = null;
if (rootArgs.size() > 0) {
baseURL = (String) rootArgs.get(0);
Expand Down Expand Up @@ -151,9 +151,9 @@ public static void run(String baseURL, String from, String until,
out.write("</harvest>\n".getBytes("UTF-8"));
}

private static HashMap getOptions(String[] args) {
HashMap options = new HashMap();
ArrayList rootArgs = new ArrayList();
private static HashMap<String, Object> getOptions(String[] args) {
HashMap<String, Object> options = new HashMap<>();
ArrayList<String> rootArgs = new ArrayList<>();
options.put("rootArgs", rootArgs);

for (int i = 0; i < args.length; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
package org.oclc.oai.harvester2.verb;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathExpressionException;
import org.xml.sax.SAXException;
Expand Down Expand Up @@ -106,12 +109,13 @@ private static String getRequestURL(String baseURL, String from, String until, S
* @param baseURL
* @param resumptionToken
* @return
* @throws UnsupportedEncodingException
*/
private static String getRequestURL(String baseURL,
String resumptionToken) {
String resumptionToken) throws UnsupportedEncodingException {
StringBuilder requestURL = new StringBuilder(baseURL);
requestURL.append("?verb=ListIdentifiers");
requestURL.append("&resumptionToken=").append(URLEncoder.encode(resumptionToken));
requestURL.append("&resumptionToken=").append(URLEncoder.encode(resumptionToken, StandardCharsets.UTF_8.name()));
return requestURL.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ListMetadataFormats() {
* @throws javax.xml.xpath.XPathExpressionException
* @throws IOException an I/O error occurred
*/
public ListMetadataFormats(String baseURL) throws IOException, ParserConfigurationException,
public ListMetadataFormats(String baseURL) throws IOException, ParserConfigurationException,
SAXException, XPathExpressionException {
this(baseURL, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public String getPrefix(String namespaceURI) {
}

@Override
public Iterator getPrefixes(String namespaceURI) {
public Iterator<?> getPrefixes(String namespaceURI) {
return null;
}

Expand Down

0 comments on commit 1d5e880

Please sign in to comment.