本文整理了Java中java.io.EOFException.getMessage()
方法的一些代码示例,展示了EOFException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EOFException.getMessage()
方法的具体详情如下:
包路径:java.io.EOFException
类名称:EOFException
方法名:getMessage
暂无
代码示例来源:origin: fabric8io/docker-maven-plugin
throw new IOException("Failed to read log header. Could not read all 8 bytes. " + e.getMessage(), e);
ByteStreams.readFully(is, payload.array());
} catch (EOFException e) {
throw new IOException("Failed to read log message. Could not read all " + size + " bytes. " + e.getMessage() +
" [ Header: " + Hex.encodeHexString(headerBuffer.array()) + "]", e);
代码示例来源:origin: loklak/loklak_server
return ImageIO.read(new ByteArrayInputStream(tileb));
} catch (final EOFException e) {
DAO.log("OSMTile: cannot parse image: " + e.getMessage());
return null;
} catch (final IOException e) {
代码示例来源:origin: apache/activemq
JMSException jmsEx = new MessageEOFException(e.getMessage());
jmsEx.setLinkedException(e);
throw jmsEx;
代码示例来源:origin: apache/activemq
JMSException jmsEx = new MessageEOFException(e.getMessage());
jmsEx.setLinkedException(e);
throw jmsEx;
代码示例来源:origin: square/okio
@Test public void eofExceptionProvidesLimitedContent() throws IOException {
data.writeUtf8("aaaaaaaabbbbbbbbccccccccdddddddde");
try {
source.readUtf8LineStrict();
fail();
} catch (EOFException expected) {
assertEquals("\\n not found: limit=33 content=616161616161616162626262626262626363636363636363"
+ "6464646464646464…", expected.getMessage());
}
}
代码示例来源:origin: square/okio
@Test public void readUtf8LineStrictNoBytesConsumedOnFailure() throws IOException {
data.writeUtf8("abc\n");
try {
source.readUtf8LineStrict(2);
fail();
} catch (EOFException expected) {
assertTrue(expected.getMessage().startsWith("\\n not found: limit=2 content=61626"));
}
assertEquals("abc", source.readUtf8LineStrict(3));
}
代码示例来源:origin: square/okio
@Test public void readLines() throws IOException {
data.writeUtf8("abc\ndef\n");
assertEquals("abc", source.readUtf8LineStrict());
assertEquals("def", source.readUtf8LineStrict());
try {
source.readUtf8LineStrict();
fail();
} catch (EOFException expected) {
assertEquals("\\n not found: limit=0 content=…", expected.getMessage());
}
}
代码示例来源:origin: square/okio
@Test public void newlineAtEnd() throws IOException {
data.writeUtf8("abc\n");
assertEquals("abc", source.readUtf8LineStrict(3));
assertTrue(source.exhausted());
data.writeUtf8("abc\r\n");
assertEquals("abc", source.readUtf8LineStrict(3));
assertTrue(source.exhausted());
data.writeUtf8("abc\r");
try {
source.readUtf8LineStrict(3);
fail();
} catch (EOFException expected) {
assertEquals("\\n not found: limit=3 content=6162630d…", expected.getMessage());
}
source.readUtf8();
data.writeUtf8("abc");
try {
source.readUtf8LineStrict(3);
fail();
} catch (EOFException expected) {
assertEquals("\\n not found: limit=3 content=616263…", expected.getMessage());
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected synchronized boolean protocolConnect(String host, int portNum,
String user, String passwd) throws MessagingException {
// check for non-null values of host, password, user
if (host == null || passwd == null || user == null)
return false;
// if port is not specified, set it to value of mail.pop3.port
// property if it exists, otherwise default to 110
if (portNum == -1)
portNum = PropUtil.getIntSessionProperty(session,
"mail." + name + ".port", -1);
if (portNum == -1)
portNum = defaultPort;
this.host = host;
this.portNum = portNum;
this.user = user;
this.passwd = passwd;
try {
port = getPort(null);
} catch (EOFException eex) {
throw new AuthenticationFailedException(eex.getMessage());
} catch (SocketConnectException scex) {
throw new MailConnectException(scex);
} catch (IOException ioex) {
throw new MessagingException("Connect failed", ioex);
}
return true;
}
代码示例来源:origin: com.sun.mail/javax.mail
@Override
protected synchronized boolean protocolConnect(String host, int portNum,
String user, String passwd) throws MessagingException {
// check for non-null values of host, password, user
if (host == null || passwd == null || user == null)
return false;
// if port is not specified, set it to value of mail.pop3.port
// property if it exists, otherwise default to 110
if (portNum == -1)
portNum = PropUtil.getIntProperty(session.getProperties(),
"mail." + name + ".port", -1);
if (portNum == -1)
portNum = defaultPort;
this.host = host;
this.portNum = portNum;
this.user = user;
this.passwd = passwd;
try {
port = getPort(null);
} catch (EOFException eex) {
throw new AuthenticationFailedException(eex.getMessage());
} catch (SocketConnectException scex) {
throw new MailConnectException(scex);
} catch (IOException ioex) {
throw new MessagingException("Connect failed", ioex);
}
return true;
}
代码示例来源:origin: org.drools/drools-compiler
public KieSession loadSession( FileInputStream input ) throws IOException, ClassNotFoundException {
KieSession ksession = null;
DroolsObjectInputStream droolsIn = new DroolsObjectInputStream( input, this.getClass().getClassLoader() );
try {
KieBase kbase = (KieBase) droolsIn.readObject();
Marshaller mas = createMarshaller( kbase );
ksession = mas.unmarshall(droolsIn);
} catch ( EOFException e ) {
e.printStackTrace();
fail( e.getMessage() );
} finally {
droolsIn.close();
}
return ksession;
}
代码示例来源:origin: codefollower/Tomcat-Research
@Override
public void onDataAvailable() {
try {
wsFrame.onDataAvailable();
} catch (WsIOException ws) {
wsProtocolHandler.close(ws.getCloseReason());
} catch (EOFException eof) {
CloseReason cr = new CloseReason(
CloseCodes.CLOSED_ABNORMALLY, eof.getMessage());
wsProtocolHandler.close(cr);
} catch (IOException ioe) {
onError(ioe);
CloseReason cr = new CloseReason(
CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage());
wsProtocolHandler.close(cr);
}
}
代码示例来源:origin: org.jboss.web/jbossweb
@Override
public void onDataAvailable() {
try {
wsFrame.onDataAvailable();
} catch (WsIOException ws) {
wsProtocolHandler.close(ws.getCloseReason());
} catch (EOFException eof) {
CloseReason cr = new CloseReason(
CloseCodes.CLOSED_ABNORMALLY, eof.getMessage());
wsProtocolHandler.close(cr);
} catch (IOException ioe) {
onError(ioe);
CloseReason cr = new CloseReason(
CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage());
wsProtocolHandler.close(cr);
}
}
代码示例来源:origin: Unidata/thredds
@Test
public void testSmall() throws IOException {
try ( RandomAccessFile raf = new RandomAccessFile(
TestDir.cdmLocalTestDataDir + "hdf4/Level3_GYX_N0R_20151012_1441.nids.invalidhdf4", "r")) {
assert !H4header.isValidFile(raf);
} catch (EOFException e) {
System.out.print(e.getMessage());
assert false;
}
}
代码示例来源:origin: org.exoplatform.jcr/exo.jcr.component.core
private void restoreWorkspaceDataSize(String repositoryName, String workspaceName, ZipObjectReader in)
throws IOException
{
in.getNextEntry();
try
{
Long dataSize = in.readLong();
setWorkspaceDataSize(repositoryName, workspaceName, dataSize);
}
catch (EOFException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace(e.getMessage(), e);
}
}
}
代码示例来源:origin: jpos/jPOS
@Test
public void testReadMoreThanInputThrowsEOFException() throws Throwable {
FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema");
InputStream is = new ByteArrayInputStream(new byte[2]);
InputStreamReader r = new InputStreamReader(is);
try {
fSDMsg.read(r, 100, null, null);
fail("Expected EOFException to be thrown");
} catch (EOFException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertEquals("(ByteArrayInputStream) is.available()", 0, is.available());
}
}
代码示例来源:origin: jpos/jPOS
@Test
public void testReadFieldTypeNullLengthToMuchThrowsEOFException1() throws Throwable {
FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath");
InputStream is = new ByteArrayInputStream(new byte[1]);
InputStreamReader r = new InputStreamReader(is);
try {
fSDMsg.readField(r, "testFSDMsgFieldName", 100, null, null);
fail("Expected EOFException to be thrown");
} catch (EOFException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size());
assertEquals("(ByteArrayInputStream) is.available()", 0, is.available());
}
}
代码示例来源:origin: org.apache.shindig/shindig-gadgets
@Test
public void testToByteArraySafeThrowsException2() throws Exception {
String exceptionMessage = "EOF Exception and Any Random Cause";
EOFException e = new EOFException(exceptionMessage);
EasyMock.expect(mockInputStream.read(EasyMock.isA(byte[].class))).andThrow(e).anyTimes();
EasyMock.replay(mockEntity, mockInputStream);
boolean exceptionCaught = false;
try {
fetcher.toByteArraySafe(mockEntity);
} catch (EOFException eofe) {
assertEquals(exceptionMessage, eofe.getMessage());
exceptionCaught = true;
}
assertTrue(exceptionCaught);
EasyMock.verify(mockEntity, mockInputStream);
}
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-gadgets
@Test
public void testToByteArraySafeThrowsException2() throws Exception {
String exceptionMessage = "EOF Exception and Any Random Cause";
EOFException e = new EOFException(exceptionMessage);
EasyMock.expect(mockInputStream.read(EasyMock.isA(byte[].class))).andThrow(e).anyTimes();
EasyMock.replay(mockEntity, mockInputStream);
boolean exceptionCaught = false;
try {
fetcher.toByteArraySafe(mockEntity);
} catch (EOFException eofe) {
assertEquals(exceptionMessage, eofe.getMessage());
exceptionCaught = true;
}
assertTrue(exceptionCaught);
EasyMock.verify(mockEntity, mockInputStream);
}
代码示例来源:origin: com.lmco.shindig/shindig-gadgets
@Test
public void testToByteArraySafeThrowsException2() throws Exception {
String exceptionMessage = "EOF Exception and Any Random Cause";
EOFException e = new EOFException(exceptionMessage);
EasyMock.expect(mockInputStream.read(EasyMock.isA(byte[].class))).andThrow(e).anyTimes();
EasyMock.replay(mockEntity, mockInputStream);
boolean exceptionCaught = false;
try {
fetcher.toByteArraySafe(mockEntity);
} catch (EOFException eofe) {
assertEquals(exceptionMessage, eofe.getMessage());
exceptionCaught = true;
}
assertTrue(exceptionCaught);
EasyMock.verify(mockEntity, mockInputStream);
}
内容来源于网络,如有侵权,请联系作者删除!