Example usage for java.lang NoSuchMethodError NoSuchMethodError

List of usage examples for java.lang NoSuchMethodError NoSuchMethodError

Introduction

In this page you can find the example usage for java.lang NoSuchMethodError NoSuchMethodError.

Prototype

public NoSuchMethodError(String s) 

Source Link

Document

Constructs a NoSuchMethodError with the specified detail message.

Usage

From source file:node.Mailbox.java

/**
 * Accept a message from a socket. Adds the message to the appropriate queue
 *///from   w  ww. j  a  v  a2  s. c om
private void acceptMessage(Socket socket) {
    // get the source address
    String srcIP = socket.getInetAddress().getHostAddress();
    ObjectInputStream ois;
    try {
        InputStream is = socket.getInputStream();
        BufferedInputStream bis = new BufferedInputStream(is);
        ois = new ObjectInputStream(bis);
        // now the Mailbox can block until it receives all message bytes
        // accept the message object
        AbstractMessage a = (AbstractMessage) ois.readObject();
        println("Received msg " + a.toString());
        // TODO MARK MESSAGE WITH OLD TIMESTAMP
        // save the srcIP for later. srcPort is already part of the message
        a.srcIP = srcIP;

        // cast to the appropriate message type
        if (a.msgType < MessageType.CONTROL) {
            // call the appropriate verifier, place the message in the queue
            // and call the appropriate message handler to reconstruct the
            // message over the network
            ControlMessage m = (ControlMessage) a;
            ctrlMsgsRecv.add(m);
        } else if (a.msgType < MessageType.EVOLVE) {
            EvolveMessage m = (EvolveMessage) a;
            evolveMsgsRecv.add(m);
        } else if (a.msgType < MessageType.DATA) {
            // TODO handle Data-specific messages (dataset/indexing
            // information, db webserver address, etc)
            throw new NoSuchMethodError("Handling DATA messages is not yet implemented");
        }
    } catch (StreamCorruptedException e) {
        println("Caught StreamCorruptedException: client must have terminated transmission", true);
    } catch (EOFException e) {
        println("Caught EOFException: client must have terminated transmission", true);
    } catch (IOException e) {
        log.log(Level.SEVERE, "Mailbox error: failed to accept message due to IOException", e);
        e.printStackTrace();
        log.severe(ExceptionUtils.getStackTrace(e));
    } catch (ClassNotFoundException e) {
        log.log(Level.SEVERE, "Mailbox error: failed to accept message due to ClassNotFoundException", e);
        e.printStackTrace();
        log.severe(ExceptionUtils.getStackTrace(e));
    }
}

From source file:org.apache.hadoop.hbase.client.TestFastFailWithoutTestUtil.java

@Test
public void testExceptionsIdentifiedByInterceptor() throws IOException {
    Throwable[] networkexceptions = new Throwable[] { new ConnectException("Mary is unwell"),
            new SocketTimeoutException("Mike is too late"), new ClosedChannelException(),
            new SyncFailedException("Dave is not on the same page"), new TimeoutException("Mike is late again"),
            new EOFException("This is the end... "), new ConnectionClosingException("Its closing") };
    final String INDUCED = "Induced";
    Throwable[] nonNetworkExceptions = new Throwable[] { new IOException("Bob died"),
            new RemoteException("Bob's cousin died", null), new NoSuchMethodError(INDUCED),
            new NullPointerException(INDUCED), new DoNotRetryIOException(INDUCED), new Error(INDUCED) };

    Configuration conf = HBaseConfiguration.create();
    long CLEANUP_TIMEOUT = 0;
    long FAST_FAIL_THRESHOLD = 1000000;
    conf.setBoolean(HConstants.HBASE_CLIENT_FAST_FAIL_MODE_ENABLED, true);
    conf.setLong(HConstants.HBASE_CLIENT_FAST_FAIL_CLEANUP_MS_DURATION_MS, CLEANUP_TIMEOUT);
    conf.setLong(HConstants.HBASE_CLIENT_FAST_FAIL_THREASHOLD_MS, FAST_FAIL_THRESHOLD);
    for (Throwable e : networkexceptions) {
        PreemptiveFastFailInterceptor interceptor = TestFastFailWithoutTestUtil
                .createPreemptiveInterceptor(conf);
        FastFailInterceptorContext context = (FastFailInterceptorContext) interceptor.createEmptyContext();

        RetryingCallable<?> callable = getDummyRetryingCallable(getSomeServerName());
        context.prepare(callable, 0);//w  ww  . ja  v a2 s  . co  m
        interceptor.intercept(context);
        interceptor.handleFailure(context, e);
        interceptor.updateFailureInfo(context);
        assertTrue("The call shouldn't have been successful if there was a ConnectException",
                context.getCouldNotCommunicateWithServer().booleanValue());
    }
    for (Throwable e : nonNetworkExceptions) {
        try {
            PreemptiveFastFailInterceptor interceptor = TestFastFailWithoutTestUtil
                    .createPreemptiveInterceptor(conf);
            FastFailInterceptorContext context = (FastFailInterceptorContext) interceptor.createEmptyContext();

            RetryingCallable<?> callable = getDummyRetryingCallable(getSomeServerName());
            context.prepare(callable, 0);
            interceptor.intercept(context);
            interceptor.handleFailure(context, e);
            interceptor.updateFailureInfo(context);
            assertFalse("The call shouldn't have been successful if there was a ConnectException",
                    context.getCouldNotCommunicateWithServer().booleanValue());
        } catch (NoSuchMethodError t) {
            assertTrue("Exception not induced", t.getMessage().contains(INDUCED));
        } catch (NullPointerException t) {
            assertTrue("Exception not induced", t.getMessage().contains(INDUCED));
        } catch (DoNotRetryIOException t) {
            assertTrue("Exception not induced", t.getMessage().contains(INDUCED));
        } catch (Error t) {
            assertTrue("Exception not induced", t.getMessage().contains(INDUCED));
        }
    }
}

From source file:org.kitodo.dataaccess.storage.memory.MemoryNode.java

@Override
public IdentifiableNode getByIdentifier(String identifier) {
    MemoryResult found = new MemoryResult();
    for (Entry<String, Collection<ObjectType>> predicate : edges.entrySet()) {
        for (ObjectType object : predicate.getValue()) {
            if (object instanceof IdentifiableNode) {
                IdentifiableNode nodeObject = (IdentifiableNode) object;
                String id = nodeObject.getIdentifier();
                if (id.equals(identifier)) {
                    found.add(nodeObject);
                }/*from   w w  w  .j a v a2  s.  c  om*/
            }
        }
    }
    switch (found.size()) {
    case 0:
        throw new NoSuchElementException();
    case 1:
        return found.identifiableNodeExpectable();
    default:
        throw new NoSuchMethodError("Merging nodes not yet implemented.");
    }
}

From source file:gov.loc.www.zing.srw.srw_bindings.SRWSoapBindingImpl.java

public static String getQualifier(CQLTermNode t) {
    Object args;/*from  w  ww .ja  va 2  s . co  m*/
    try {
        args = cqlWorkaroundMethod.invoke(t, new Object[0]);
    } catch (IllegalArgumentException ex) {
        throw new NoSuchMethodError("getIndex; IllegalArgumentException");
    } catch (IllegalAccessException ex) {
        throw new NoSuchMethodError("getIndex; IllegalAccessException");
    } catch (InvocationTargetException ex) {
        throw new NoSuchMethodError("getIndex; InvocationTargetException");
    }

    return (String) args;
}