diff --git a/build.gradle b/build.gradle index 44c8e7e..2b8fd32 100644 --- a/build.gradle +++ b/build.gradle @@ -80,7 +80,7 @@ configure(javaProjects) { jar { manifest { - version = project.version.replace("-", "."); + version = project.version.replace("-", ".") } } cobertura { @@ -232,30 +232,30 @@ task javadocAll(type: Javadoc) { task writeSettings { doLast { - Writer out = new OutputStreamWriter(new FileOutputStream("build/settings.gradle")); - out.write("include "); - boolean first = true; + Writer out = new OutputStreamWriter(new FileOutputStream("build/settings.gradle")) + out.write("include ") + boolean first = true for (Project myproject : distributionProjects) { if (!myproject.getProjectDir().equals(getProjectDir())) { if (first == true) { - first = false; + first = false } else { - out.write ", "; + out.write ", " } out.write '"' + myproject.name + '"' } } - out.write "\n\n"; + out.write "\n\n" for (Project myproject : distributionProjects) { if (myproject.getProjectDir().equals(getProjectDir())) { - continue; + continue } println myproject.name - out.write 'project(":' + myproject.name + '").projectDir = file("' + myproject.getProjectDir().toString().substring((int) (getProjectDir().toString().size() + 1)) + '")\n'; + out.write 'project(":' + myproject.name + '").projectDir = file("' + myproject.getProjectDir().toString().substring((int) (getProjectDir().toString().size() + 1)) + '")\n' } - out.close(); + out.close() } } diff --git a/src/main/java/com/beanit/josistack/AcseAssociationListener.java b/src/main/java/com/beanit/josistack/AcseAssociationListener.java index 2f3617f..b538e1e 100644 --- a/src/main/java/com/beanit/josistack/AcseAssociationListener.java +++ b/src/main/java/com/beanit/josistack/AcseAssociationListener.java @@ -18,7 +18,7 @@ import java.nio.ByteBuffer; public interface AcseAssociationListener { - public void connectionIndication(AcseAssociation acseAssociation, ByteBuffer data); + void connectionIndication(AcseAssociation acseAssociation, ByteBuffer data); - public void serverStoppedListeningIndication(IOException e); + void serverStoppedListeningIndication(IOException e); } diff --git a/src/main/java/com/beanit/jositransport/TConnectionListener.java b/src/main/java/com/beanit/jositransport/TConnectionListener.java index 0958db9..09149f5 100644 --- a/src/main/java/com/beanit/jositransport/TConnectionListener.java +++ b/src/main/java/com/beanit/jositransport/TConnectionListener.java @@ -17,7 +17,7 @@ import java.io.IOException; public interface TConnectionListener { - public void connectionIndication(TConnection tConnection); + void connectionIndication(TConnection tConnection); /** * This function is only called when an IOException in ServerSocket.accept() occurred which was @@ -25,5 +25,5 @@ public interface TConnectionListener { * * @param e The IOException caught form ServerSocket.accept() */ - public void serverStoppedListeningIndication(IOException e); + void serverStoppedListeningIndication(IOException e); } diff --git a/src/main/java/com/beanit/openiec61850/BdaDoubleBitPos.java b/src/main/java/com/beanit/openiec61850/BdaDoubleBitPos.java index bf9d3af..58edb0d 100644 --- a/src/main/java/com/beanit/openiec61850/BdaDoubleBitPos.java +++ b/src/main/java/com/beanit/openiec61850/BdaDoubleBitPos.java @@ -83,7 +83,7 @@ public final class BdaDoubleBitPos extends BdaBitString { BAD_STATE(3); private final int value; - private DoubleBitPos(int value) { + DoubleBitPos(int value) { this.value = value; } diff --git a/src/main/java/com/beanit/openiec61850/BdaQuality.java b/src/main/java/com/beanit/openiec61850/BdaQuality.java index 496f0a5..ea96c99 100644 --- a/src/main/java/com/beanit/openiec61850/BdaQuality.java +++ b/src/main/java/com/beanit/openiec61850/BdaQuality.java @@ -220,7 +220,7 @@ public final class BdaQuality extends BdaBitString { QUESTIONABLE(3); private final int value; - private Validity(int value) { + Validity(int value) { this.value = value; } diff --git a/src/main/java/com/beanit/openiec61850/BdaTapCommand.java b/src/main/java/com/beanit/openiec61850/BdaTapCommand.java index feade46..5c90dfe 100644 --- a/src/main/java/com/beanit/openiec61850/BdaTapCommand.java +++ b/src/main/java/com/beanit/openiec61850/BdaTapCommand.java @@ -78,7 +78,7 @@ public final class BdaTapCommand extends BdaBitString { RESERVED(3); private final int value; - private TapCommand(int value) { + TapCommand(int value) { this.value = value; } diff --git a/src/main/java/com/beanit/openiec61850/BdaType.java b/src/main/java/com/beanit/openiec61850/BdaType.java index 335af4e..eb9b71a 100644 --- a/src/main/java/com/beanit/openiec61850/BdaType.java +++ b/src/main/java/com/beanit/openiec61850/BdaType.java @@ -40,5 +40,5 @@ public enum BdaType { TAP_COMMAND, TRIGGER_CONDITIONS, OPTFLDS, - REASON_FOR_INCLUSION; + REASON_FOR_INCLUSION } diff --git a/src/main/java/com/beanit/openiec61850/ClientAssociation.java b/src/main/java/com/beanit/openiec61850/ClientAssociation.java index 5e49d6e..9146317 100644 --- a/src/main/java/com/beanit/openiec61850/ClientAssociation.java +++ b/src/main/java/com/beanit/openiec61850/ClientAssociation.java @@ -840,9 +840,7 @@ public final class ClientAssociation { } boolean moreFollows = - (fileDirectoryRes.getMoreFollows() == null) - ? false - : fileDirectoryRes.getMoreFollows().value; + (fileDirectoryRes.getMoreFollows() != null) && fileDirectoryRes.getMoreFollows().value; return moreFollows; } @@ -1304,7 +1302,7 @@ public final class ClientAssociation { } else if (!existingDs.isDeletable()) { return; } else { - serverModel.removeDataSet(dsObjRef.toString()); + serverModel.removeDataSet(dsObjRef); serverModel.addDataSet(dataSet); } } @@ -1873,10 +1871,7 @@ public final class ClientAssociation { getDataValues(sbo); - if (sbo.getValue().length == 0) { - return false; - } - return true; + return sbo.getValue().length != 0; } /** diff --git a/src/main/java/com/beanit/openiec61850/ClientEventListener.java b/src/main/java/com/beanit/openiec61850/ClientEventListener.java index 3b5155e..02cd547 100644 --- a/src/main/java/com/beanit/openiec61850/ClientEventListener.java +++ b/src/main/java/com/beanit/openiec61850/ClientEventListener.java @@ -31,7 +31,7 @@ public interface ClientEventListener { * * @param report the report that arrived. */ - public void newReport(Report report); + void newReport(Report report); /** * Invoked when an IOException occurred for the association. An IOException implies that the @@ -40,5 +40,5 @@ public interface ClientEventListener { * * @param e the exception that occured. */ - public void associationClosed(IOException e); + void associationClosed(IOException e); } diff --git a/src/main/java/com/beanit/openiec61850/DataDefinitionResParser.java b/src/main/java/com/beanit/openiec61850/DataDefinitionResParser.java index 9915244..64de805 100644 --- a/src/main/java/com/beanit/openiec61850/DataDefinitionResParser.java +++ b/src/main/java/com/beanit/openiec61850/DataDefinitionResParser.java @@ -153,7 +153,7 @@ final class DataDefinitionResParser { for (int i = 0; i < numArrayElements; i++) { arrayChildren.add( getModelNodesFromTypeSpecification( - new ObjectReference(ref + "(" + Integer.toString(i) + ")"), + new ObjectReference(ref + "(" + i + ")"), fc, mmsTypeSpec.getTypeDescription().getArray().getElementType())); } diff --git a/src/main/java/com/beanit/openiec61850/DataSet.java b/src/main/java/com/beanit/openiec61850/DataSet.java index ea1a934..d0e2c5d 100644 --- a/src/main/java/com/beanit/openiec61850/DataSet.java +++ b/src/main/java/com/beanit/openiec61850/DataSet.java @@ -127,7 +127,7 @@ public final class DataSet implements Iterable { int slash = dataSetReference.indexOf('/'); String domainID = dataSetReference.substring(0, slash); String itemID = - dataSetReference.substring(slash + 1, dataSetReference.length()).replace('.', '$'); + dataSetReference.substring(slash + 1).replace('.', '$'); ObjectName.DomainSpecific domainSpecificObjectName = new ObjectName.DomainSpecific(); domainSpecificObjectName.setDomainID(new Identifier(domainID.getBytes())); diff --git a/src/main/java/com/beanit/openiec61850/FcModelNode.java b/src/main/java/com/beanit/openiec61850/FcModelNode.java index 4f93402..40e65a6 100644 --- a/src/main/java/com/beanit/openiec61850/FcModelNode.java +++ b/src/main/java/com/beanit/openiec61850/FcModelNode.java @@ -107,17 +107,11 @@ public abstract class FcModelNode extends ModelNode { } boolean isSelected() { - if (selected == null) { - return false; - } - return true; + return selected != null; } boolean isSelectedBy(ServerAssociation association) { - if (selected == association) { - return true; - } - return false; + return selected == association; } VariableDefs.SEQUENCE getMmsVariableDef() { diff --git a/src/main/java/com/beanit/openiec61850/ModelNode.java b/src/main/java/com/beanit/openiec61850/ModelNode.java index a03fc05..c0dae8d 100644 --- a/src/main/java/com/beanit/openiec61850/ModelNode.java +++ b/src/main/java/com/beanit/openiec61850/ModelNode.java @@ -69,7 +69,7 @@ public abstract class ModelNode implements Iterable { if (children == null) { return null; } - return (Collection) ((Collection) children.values()); + return (Collection) children.values(); } protected Iterator> getIterators() { diff --git a/src/main/java/com/beanit/openiec61850/ObjectReference.java b/src/main/java/com/beanit/openiec61850/ObjectReference.java index f7f8af0..a721576 100644 --- a/src/main/java/com/beanit/openiec61850/ObjectReference.java +++ b/src/main/java/com/beanit/openiec61850/ObjectReference.java @@ -112,7 +112,7 @@ public final class ObjectReference implements Iterable { int lastDelim = -1; int nextDelim = objectReference.indexOf('/'); if (nextDelim == -1) { - nodeNames.add(objectReference.substring(lastDelim + 1, objectReference.length())); + nodeNames.add(objectReference.substring(lastDelim + 1)); return; } @@ -143,7 +143,7 @@ public final class ObjectReference implements Iterable { } if (dotIndex == openingbracketIndex && dotIndex == closingbracketIndex) { - nodeNames.add(objectReference.substring(lastDelim + 1, objectReference.length())); + nodeNames.add(objectReference.substring(lastDelim + 1)); return; } diff --git a/src/main/java/com/beanit/openiec61850/ReportEntryData.java b/src/main/java/com/beanit/openiec61850/ReportEntryData.java index 954f0a3..b541078 100644 --- a/src/main/java/com/beanit/openiec61850/ReportEntryData.java +++ b/src/main/java/com/beanit/openiec61850/ReportEntryData.java @@ -16,7 +16,7 @@ package com.beanit.openiec61850; public class ReportEntryData { /** Not specified in IEC61850 but useful for data persistence */ - private long id;; + private long id; /** Reference to to {@link DataSet}-member */ private String dataRef; /** Attribute value to be reported */ @@ -67,7 +67,7 @@ public class ReportEntryData { this.report = report; } - public static enum ReasonCode { + public enum ReasonCode { DCHG, QCHG, DUPD, diff --git a/src/main/java/com/beanit/openiec61850/ServerEventListener.java b/src/main/java/com/beanit/openiec61850/ServerEventListener.java index a365ffc..bb3984a 100644 --- a/src/main/java/com/beanit/openiec61850/ServerEventListener.java +++ b/src/main/java/com/beanit/openiec61850/ServerEventListener.java @@ -29,7 +29,7 @@ public interface ServerEventListener { * @return a list of service errors indicating errors writing the corresponding basic data * attributes. */ - public List write(List bdas); + List write(List bdas); void serverStoppedListening(ServerSap serverSAP); } diff --git a/src/main/java/com/beanit/openiec61850/clientgui/DataTreeNode.java b/src/main/java/com/beanit/openiec61850/clientgui/DataTreeNode.java index 2d569e4..82946e8 100644 --- a/src/main/java/com/beanit/openiec61850/clientgui/DataTreeNode.java +++ b/src/main/java/com/beanit/openiec61850/clientgui/DataTreeNode.java @@ -20,17 +20,17 @@ import javax.swing.tree.TreeNode; public interface DataTreeNode { - public abstract BasicDataBind getData(); + BasicDataBind getData(); - public abstract void reset(ClientAssociation association) throws ServiceError, IOException; + void reset(ClientAssociation association) throws ServiceError, IOException; - public abstract void writeValues(ClientAssociation association) throws ServiceError, IOException; + void writeValues(ClientAssociation association) throws ServiceError, IOException; - public abstract int getChildCount(); + int getChildCount(); - public abstract TreeNode getChildAt(int index); + TreeNode getChildAt(int index); - public abstract boolean writable(); + boolean writable(); - public abstract boolean readable(); + boolean readable(); } diff --git a/src/test/java/com/beanit/openiec61850/integrationtests/ClientServerITest.java b/src/test/java/com/beanit/openiec61850/integrationtests/ClientServerITest.java index 713f59c..5d66d99 100644 --- a/src/test/java/com/beanit/openiec61850/integrationtests/ClientServerITest.java +++ b/src/test/java/com/beanit/openiec61850/integrationtests/ClientServerITest.java @@ -112,7 +112,7 @@ public class ClientServerITest extends Thread implements ServerEventListener, Cl @Test public void testClientServerCom() - throws IOException, ServiceError, ConfigurationException, javax.naming.ConfigurationException, + throws IOException, ServiceError, javax.naming.ConfigurationException, SclParseException, InterruptedException { clientSap.setTSelRemote(new byte[] {0, 1}); diff --git a/src/test/java/com/beanit/openiec61850/integrationtests/ClientServerITest2.java b/src/test/java/com/beanit/openiec61850/integrationtests/ClientServerITest2.java index b985d68..47ad750 100644 --- a/src/test/java/com/beanit/openiec61850/integrationtests/ClientServerITest2.java +++ b/src/test/java/com/beanit/openiec61850/integrationtests/ClientServerITest2.java @@ -100,7 +100,7 @@ public class ClientServerITest2 extends Thread implements ServerEventListener, C @Test public void testClientServerCom() - throws IOException, ServiceError, ConfigurationException, javax.naming.ConfigurationException, + throws IOException, ServiceError, javax.naming.ConfigurationException, SclParseException, InterruptedException { clientSap.setTSelRemote(new byte[] {0, 1}); diff --git a/src/test/java/com/beanit/openiec61850/integrationtests/ReportingTest.java b/src/test/java/com/beanit/openiec61850/integrationtests/ReportingTest.java index aed852f..4b23e2b 100644 --- a/src/test/java/com/beanit/openiec61850/integrationtests/ReportingTest.java +++ b/src/test/java/com/beanit/openiec61850/integrationtests/ReportingTest.java @@ -60,12 +60,12 @@ public class ReportingTest implements ClientEventListener { @Before public void startServerAndClient() - throws SclParseException, UnknownHostException, IOException, ServiceError { + throws SclParseException, IOException, ServiceError { startServer(); startClient(); } - private void startClient() throws IOException, UnknownHostException, ServiceError { + private void startClient() throws IOException, ServiceError { ClientSap clientSap = new ClientSap(); this.clientAssociation = clientSap.associate(InetAddress.getByName("localhost"), PORT, "", this);