@Test public void testSendMessageLengthThrowsNullPointerException() throws Throwable { ASCIIChannel aSCIIChannel = new ASCIIChannel(); try { aSCIIChannel.sendMessageLength(9999); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"java.io.DataOutputStream.write(byte[])\" because \"this.serverOut\" is null", ex.getMessage(), "ex.getMessage()"); } } }
protected void sendMessageLength(int len) throws IOException { int maxLen= ten.pow(lengthDigits).intValue() - 1; if (len > maxLen) throw new IOException ("len exceeded ("+len+" > "+maxLen+")"); else if (len < 0) throw new IOException ("invalid negative length ("+len+")"); serverOut.write(ISOUtil.zeropad(len, lengthDigits).getBytes()); }
ASCIIChannel extends BaseChannel { protected void sendMessageLength(int len) throws IOException { int maxLen= ten.pow(lengthDigits).intValue() - 1; if (len > maxLen) throw new IOException ("len exceeded ("+len+" > "+maxLen+")"); else if (len < 0) throw new IOException ("invalid negative length ("+len+")"); serverOut.write(ISOUtil.zeropad(len, lengthDigits).getBytes()); } }
ASCIIChannel extends BaseChannel { protected void sendMessageLength(int len) throws IOException { int maxLen= ten.pow(lengthDigits).intValue() - 1; if (len > maxLen) throw new IOException ("len exceeded ("+len+" > "+maxLen+")"); else if (len < 0) throw new IOException ("invalid negative length ("+len+")"); serverOut.write(ISOUtil.zeropad(len, lengthDigits).getBytes()); } ASCIIChannel();  ASCIIChannel(String host, int port, ISOPackager p);  ASCIIChannel(ISOPackager p);  ASCIIChannel(ISOPackager p, ServerSocket serverSocket); }
ASCIIChannel extends BaseChannel { protected void sendMessageLength(int len) throws IOException { int maxLen= ten.pow(lengthDigits).intValue() - 1; if (len > maxLen) throw new IOException ("len exceeded ("+len+" > "+maxLen+")"); else if (len < 0) throw new IOException ("invalid negative length ("+len+")"); serverOut.write(ISOUtil.zeropad(len, lengthDigits).getBytes()); } ASCIIChannel();  ASCIIChannel(String host, int port, ISOPackager p);  ASCIIChannel(ISOPackager p);  ASCIIChannel(ISOPackager p, ServerSocket serverSocket); void setLengthDigits(int len); int getLengthDigits(); @Override void setConfiguration(Configuration cfg); }
ASCIIChannel extends BaseChannel { protected void sendMessageLength(int len) throws IOException { int maxLen= ten.pow(lengthDigits).intValue() - 1; if (len > maxLen) throw new IOException ("len exceeded ("+len+" > "+maxLen+")"); else if (len < 0) throw new IOException ("invalid negative length ("+len+")"); serverOut.write(ISOUtil.zeropad(len, lengthDigits).getBytes()); } ASCIIChannel();  ASCIIChannel(String host, int port, ISOPackager p);  ASCIIChannel(ISOPackager p);  ASCIIChannel(ISOPackager p, ServerSocket serverSocket); void setLengthDigits(int len); int getLengthDigits(); @Override void setConfiguration(Configuration cfg);  }