Skip to content

Commit

Permalink
Fix compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
elestedt committed Sep 15, 2020
1 parent e4d8725 commit a866321
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 15 deletions.
8 changes: 5 additions & 3 deletions java/src/jmri/jmrix/ipocs/IpocsClientHandler.java
Expand Up @@ -16,7 +16,7 @@
import jmri.jmrix.ipocs.protocol.packets.Packet;

public class IpocsClientHandler implements CompletionHandler<Integer, ByteBuffer> {
private final static Logger log = LoggerFactory.getLogger(IpocsSocketAcceptor.class);
private final static Logger log = LoggerFactory.getLogger(IpocsClientHandler.class);
private final AsynchronousSocketChannel client;
private byte unitId;
private List<IpocsClientListener> clientListeners = new ArrayList<IpocsClientListener>();
Expand Down Expand Up @@ -50,7 +50,7 @@ public void completed(final Integer bytesRead, final ByteBuffer recvBuffer) {
listener.clientDisconnected(this);
}
} catch (final IOException ex) {
log.error("Unable to close client: {0}", ex.getMessage());
log.error("Unable to close client: {}", ex.getMessage());
}
return;
}
Expand Down Expand Up @@ -98,7 +98,9 @@ public void completed(final Integer bytesRead, final ByteBuffer recvBuffer) {
public void failed(final Throwable exc, final ByteBuffer attachment) {
try {
client.close();
} catch (IOException ex) {}
} catch (IOException ex) {
log.error("Error closing connection", ex);
}
for (IpocsClientListener listener : clientListeners) {
listener.clientDisconnected(this);
}
Expand Down
2 changes: 1 addition & 1 deletion java/src/jmri/jmrix/ipocs/IpocsLight.java
Expand Up @@ -12,7 +12,7 @@
import jmri.jmrix.ipocs.protocol.packets.SetOutputPacket;

public class IpocsLight extends AbstractLight implements IpocsClientListener {
private final static Logger log = LoggerFactory.getLogger(IpocsTurnout.class);
private final static Logger log = LoggerFactory.getLogger(IpocsLight.class);
private IpocsPortController portController;

public IpocsLight(IpocsPortController portController, String systemName, String userName) {
Expand Down
Expand Up @@ -57,7 +57,7 @@ public boolean load(Element shared, Element perNode) throws JmriConfigureXmlExce
try {
portController.connect();
} catch (IOException ex) {
log.error("Unable to start service: {0}", ex.getMessage());
log.error("Unable to start service: {}", ex.getMessage());
}
}
return true;
Expand All @@ -77,4 +77,4 @@ protected void getInstance(IpocsConnectionConfig o) {
protected void register() {
this.register(new IpocsConnectionConfig(portController));
}
}
}
2 changes: 1 addition & 1 deletion java/src/jmri/jmrix/ipocs/protocol/enums/RqAlarmState.java
Expand Up @@ -19,4 +19,4 @@ public static RqAlarmState valueOf(byte value) {
}
return null;
}
}
}
Expand Up @@ -19,4 +19,4 @@ public static RqControllerState valueOf(byte value) {
}
return null;
}
}
}
2 changes: 1 addition & 1 deletion java/src/jmri/jmrix/ipocs/protocol/enums/RqDisconnect.java
Expand Up @@ -21,4 +21,4 @@ public static RqDisconnect valueOf(byte value) {
}
return null;
}
}
}
Expand Up @@ -21,7 +21,7 @@ protected void parseSpecific(ByteBuffer buffer) {

@Override
protected byte[] serializeSpecific() {
ByteBuffer buffer = ByteBuffer.allocate(2);
ByteBuffer buffer = ByteBuffer.allocate(1);
buffer.put(reason.value);
buffer.rewind();
return buffer.array();
Expand Down
3 changes: 0 additions & 3 deletions java/test/jmri/jmrix/ipocs/IpocsTurnoutTest.java
Expand Up @@ -35,13 +35,10 @@ public int numListeners() {

@Override
public void checkThrownMsgSent() throws InterruptedException {
// TODO Auto-generated method stub

}

@Override
public void checkClosedMsgSent() throws InterruptedException {
// TODO Auto-generated method stub
}

@Test
Expand Down
@@ -1,19 +1,28 @@
package jmri.jmrix.ipocs.configurexml;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

import jmri.jmrix.ipocs.IpocsConnectionConfig;
import jmri.jmrix.ipocs.IpocsPortController;

public class IpocsConnectionConfigXmlTest extends jmri.jmrix.configurexml.AbstractConnectionConfigXmlTestBase {

private IpocsPortController portController;

@BeforeEach
@Override
public void setUp() {
jmri.util.JUnitUtil.setUp();
jmri.util.JUnitUtil.initDefaultUserMessagePreferences();
xmlAdapter = new IpocsConnectionConfigXml();
cc = new IpocsConnectionConfig();
portController = mock(IpocsPortController.class);
when(portController.getOptions()).thenReturn(new String[] {});
cc = new IpocsConnectionConfig(portController);
((IpocsConnectionConfigXml)xmlAdapter).getInstance((IpocsConnectionConfig)cc);
}

@AfterEach
Expand Down
Expand Up @@ -10,7 +10,7 @@
import jmri.jmrix.ipocs.protocol.enums.RqDerailerCommand;

public class SetDerailerPacketTest {
private byte[] testPacket = { RqDerailerCommand.Passable.value, 0x00, 0x10, 0x01 };
private byte[] testPacket = { RqDerailerCommand.Passable.value };

@Test
public void getIdTest() {
Expand Down

0 comments on commit a866321

Please sign in to comment.