Java 类java.lang.IllegalStateException 实例源码

项目:joai-project    文件:SessionRegistry.java   
/**
 *  Unregister a sessionBean by calling its {@link org.dlese.dpc.schemedit.SessionBean#destroy() destroy}
 *  method (releasing all held locks), and removing its entry from the sessionBeanMap.
 *
 * @param  sessionId  Description of the Parameter
 */
public void unregisterSessionBean(String sessionId) {
    prtln("unregistering Session Bean for " + sessionId);
    SessionBean sessionBean = null;
    try {
        sessionBean = getSessionBean(sessionId);
    } catch (IllegalStateException ise) {
        prtlnErr("ERROR: getSessionBean (" + sessionId + "): " + ise.getMessage());
    }
    if (sessionBean != null) {
        sessionBean.destroy();
    }
    else {
        // if the session has been timed-out, sessionBean will be null, so we must explicitly release locks ...
        releaseAllLocks(sessionId);
    }
    synchronized (sessionBeanMap) {
        sessionBeanMap.remove(sessionId);
    }
}
项目:PotRoom    文件:RoomViewHolder_ViewBinding.java   
@Override
@CallSuper
public void unbind() {
  RoomViewHolder target = this.target;
  if (target == null) throw new IllegalStateException("Bindings already cleared.");
  this.target = null;

  target.txtNumberPerson = null;
  target.txtNameRoom = null;
}
项目:PotRoom    文件:ConnectedUserFragment_ViewBinding.java   
@Override
@CallSuper
public void unbind() {
  ConnectedUserFragment target = this.target;
  if (target == null) throw new IllegalStateException("Bindings already cleared.");
  this.target = null;

  target.recyclerView = null;
}
项目:PotRoom    文件:JoinActivity_ViewBinding.java   
@Override
@CallSuper
public void unbind() {
  JoinActivity target = this.target;
  if (target == null) throw new IllegalStateException("Bindings already cleared.");
  this.target = null;

  target.editRoomName = null;

  view2131689606.setOnClickListener(null);
  view2131689606 = null;
  view2131689605.setOnClickListener(null);
  view2131689605 = null;
}
项目:ActivityScreens    文件:ListsActivityScreen.java   
private static void checkArguments(Bundle bundle) {
    if (!bundle.containsKey("list1")) {
        throw new IllegalStateException("Required argument list1 with key 'list1' is not set");
    }
    if (!bundle.containsKey("list2")) {
        throw new IllegalStateException("Required argument list2 with key 'list2' is not set");
    }
    if (!bundle.containsKey("list3")) {
        throw new IllegalStateException("Required argument list3 with key 'list3' is not set");
    }
    if (!bundle.containsKey("list4")) {
        throw new IllegalStateException("Required argument list4 with key 'list4' is not set");
    }
    if (!bundle.containsKey("list5")) {
        throw new IllegalStateException("Required argument list5 with key 'list5' is not set");
    }
    if (!bundle.containsKey("list6")) {
        throw new IllegalStateException("Required argument list6 with key 'list6' is not set");
    }
    if (!bundle.containsKey("list7")) {
        throw new IllegalStateException("Required argument list7 with key 'list7' is not set");
    }
}
项目:ActivityScreens    文件:PrimitiveTypesActivityScreen.java   
private static void checkArguments(Bundle bundle) {
    if (!bundle.containsKey("field1")) {
        throw new IllegalStateException("Required argument field1 with key 'field1' is not set");
    }
    if (!bundle.containsKey("field2")) {
        throw new IllegalStateException("Required argument field2 with key 'field2' is not set");
    }
    if (!bundle.containsKey("field3")) {
        throw new IllegalStateException("Required argument field3 with key 'field3' is not set");
    }
    if (!bundle.containsKey("field4")) {
        throw new IllegalStateException("Required argument field4 with key 'field4' is not set");
    }
    if (!bundle.containsKey("field5")) {
        throw new IllegalStateException("Required argument field5 with key 'field5' is not set");
    }
    if (!bundle.containsKey("field6")) {
        throw new IllegalStateException("Required argument field6 with key 'field6' is not set");
    }
    if (!bundle.containsKey("field7")) {
        throw new IllegalStateException("Required argument field7 with key 'field7' is not set");
    }
    if (!bundle.containsKey("field8")) {
        throw new IllegalStateException("Required argument field8 with key 'field8' is not set");
    }
}
项目:ActivityScreens    文件:PrimitiveWrappersActivityScreen.java   
private static void checkArguments(Bundle bundle) {
    if (!bundle.containsKey("field1")) {
        throw new IllegalStateException("Required argument field1 with key 'field1' is not set");
    }
    if (!bundle.containsKey("field2")) {
        throw new IllegalStateException("Required argument field2 with key 'field2' is not set");
    }
    if (!bundle.containsKey("field3")) {
        throw new IllegalStateException("Required argument field3 with key 'field3' is not set");
    }
    if (!bundle.containsKey("field4")) {
        throw new IllegalStateException("Required argument field4 with key 'field4' is not set");
    }
    if (!bundle.containsKey("field5")) {
        throw new IllegalStateException("Required argument field5 with key 'field5' is not set");
    }
    if (!bundle.containsKey("field6")) {
        throw new IllegalStateException("Required argument field6 with key 'field6' is not set");
    }
    if (!bundle.containsKey("field7")) {
        throw new IllegalStateException("Required argument field7 with key 'field7' is not set");
    }
    if (!bundle.containsKey("field8")) {
        throw new IllegalStateException("Required argument field8 with key 'field8' is not set");
    }
}
项目:pluotsorbet    文件:constructor.java   
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    IllegalStateException object1 = new IllegalStateException();
    harness.check(object1 != null);
    harness.check(object1.toString(), "java.lang.IllegalStateException");

    IllegalStateException object2 = new IllegalStateException("nothing happens");
    harness.check(object2 != null);
    harness.check(object2.toString(), "java.lang.IllegalStateException: nothing happens");

    IllegalStateException object3 = new IllegalStateException((String)null);
    harness.check(object3 != null);
    harness.check(object3.toString(), "java.lang.IllegalStateException");

}
项目:salt-payment-client-java    文件:AbstractSample.java   
protected void retrieveMerchantKeys() {
    Properties merchantProp = new Properties();
    try {
        merchantProp.load(getClass().getClassLoader().getResourceAsStream(propertiesFile));


        //get the property values
        apiToken = merchantProp.getProperty("merchant.apiToken");
        merchantId = Integer.parseInt(merchantProp.getProperty("merchant.Id"));
        storageTokenId = merchantProp.getProperty("merchant.storageToken");
        orderId = merchantProp.getProperty("merchant.orderId");
        url = merchantProp.getProperty("sold.gateway.ur");
        refundOrderId = merchantProp.getProperty("refund.OrderId");

    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
项目:girafAdmin    文件:TransmissionHandler.java   
private final XMLWrapper findXMLlength(byte[] buf) {
    String data = this.bytesToString(buf);

    Pattern expr = Pattern.compile("MXML\\[");
    Matcher match = expr.matcher(data);
    if (match.find() != true) {
        throw new IllegalStateException("Could not find MXML length !");
    }
    String length = data.substring(match.end() + 1, match.end() + 10);

    expr = Pattern.compile(",[0-1]\\]");
    match = expr.matcher(data);
    if (match.find() != true) {
        throw new IllegalStateException("Could not find MXML anyFiles !");
    }
    String anyFiles = data.substring(match.start() + 1, match.end() -1);
    boolean result = (anyFiles.contains("1") == true) ? true : false;

    return new XMLWrapper(Integer.parseInt(length), result);
}
项目:girafAdmin    文件:TransmissionHandler.java   
private final FileWrapper findFilelength(byte[] buf) {
    String data = this.bytesToString(buf);

    Pattern expr = Pattern.compile("FILE\\[");
    Matcher match = expr.matcher(data);
    if (match.find() != true) {
        throw new IllegalStateException("Could not find FILE length, FILE name");
    }
    String length = data.substring(match.end() + 1, match.end() + 19);
    String name = this.getfileName(data.substring(match.end() + 21, match.end() + 276));

    expr = Pattern.compile(",[0-1]\\]");
    match = expr.matcher(data);
    if (match.find() != true) {
        throw new IllegalStateException("Could not find FILE moreFiles !");
    }
    boolean moreFiles = (Integer.parseInt(data.substring(match.start() + 1, match.end() -1)) == 1) ? true : false;

    return new FileWrapper(Long.parseLong(length), name, moreFiles);
}
项目:girafAdmin    文件:TransmissionHandler.java   
private final boolean ACCEPT(InputStream is) throws IOException {
    /*
        -------------------------
                ACCEPT
        -------------------------
        keyword     = 6
        tag-stuff   = 8
        total       = 10
     */
    byte[] buf = new byte[10];
    @SuppressWarnings("unused")
    int len = is.read(buf);
    String data = this.bytesToString(buf);

    Pattern expr = Pattern.compile("\\[ACCEPT\\]");
    Matcher match = expr.matcher(data);
    if (match.find() != true) {
        throw new IllegalStateException("Could not find ACCEPT !");
    }
    //      String result = data.substring(match.start() + 1, match.end() -1);

    return (data.substring(match.start() + 1, match.end() -1).equals("ACCEPT") == true) ? true : false;
}
项目:PotRoom    文件:MessageViewHolder_ViewBinding.java   
@Override
@CallSuper
public void unbind() {
  MessageViewHolder target = this.target;
  if (target == null) throw new IllegalStateException("Bindings already cleared.");
  this.target = null;

  target.imageUser = null;
}
项目:PotRoom    文件:TalkActivity_ViewBinding.java   
@Override
@CallSuper
public void unbind() {
  TalkActivity target = this.target;
  if (target == null) throw new IllegalStateException("Bindings already cleared.");
  this.target = null;

  target.btnSpeak = null;
  target.mFlIndicator = null;
  target.recyclerView = null;
  target.blanketView = null;
  target.mTvLog = null;
  target.txtWhoSpeak = null;
  target.btnUserOnline = null;
  target.txtWhatHappen = null;
  target.mTvRecordingHint = null;
  target.pulsator = null;
  target.viewAvatar = null;
  target.imageUser = null;
  target.progressView = null;
  target.iconSettings = null;

  view2131689621.setOnClickListener(null);
  view2131689621 = null;
  view2131689606.setOnClickListener(null);
  view2131689606 = null;
}
项目:PotRoom    文件:NameActivity_ViewBinding.java   
@Override
@CallSuper
public void unbind() {
  NameActivity target = this.target;
  if (target == null) throw new IllegalStateException("Bindings already cleared.");
  this.target = null;

  target.editUsername = null;
  target.profileImage = null;
  target.progresView = null;

  view2131689614.setOnClickListener(null);
  view2131689614 = null;
  view2131689616.setOnClickListener(null);
  view2131689616 = null;
}
项目:PotRoom    文件:ListRoomsActivity_ViewBinding.java   
@Override
@CallSuper
public void unbind() {
  ListRoomsActivity target = this.target;
  if (target == null) throw new IllegalStateException("Bindings already cleared.");
  this.target = null;

  target.recyclerView = null;
  target.txtCurrentRooms = null;
  target.viewLoading = null;
  target.txtNoRoom = null;

  view2131689610.setOnClickListener(null);
  view2131689610 = null;
  view2131689612.setOnClickListener(null);
  view2131689612 = null;
}
项目:LivroJavaComoProgramar10Edicao    文件:ReadTextFile.java   
public static void readRecords()
{
   System.out.printf("%-10s%-12s%-12s%10s%n", "Account",
      "First Name", "Last Name", "Balance");

   try 
   {
      while (input.hasNext()) // while there is more to read
      {
         // display record contents                     
         System.out.printf("%-10d%-12s%-12s%10.2f%n", input.nextInt(), 
            input.next(), input.next(), input.nextDouble());
      }
   } 
   catch (NoSuchElementException elementException)
   {
      System.err.println("File improperly formed. Terminating.");
   } 
   catch (IllegalStateException stateException)
   {
      System.err.println("Error reading from file. Terminating.");
   } 
}
项目:embedded-jms-junit    文件:CallablesForSendingAndReceiving.java   
static Callable<String> messagesFromTestQueue(final ConnectionFactory connectionFactory, final String queueName) {
    return () -> {
        final Connection connection = connectionFactory.createConnection();
        connection.start();
        try {
            final Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            try {
                final Queue queue = consumerSession.createQueue(queueName);
                final MessageConsumer messageConsumer = consumerSession.createConsumer(queue);
                final Message message = messageConsumer.receive(TimeUnit.SECONDS.toMillis(30L));
                if (message instanceof TextMessage) {
                    return ((TextMessage) message).getText();
                } else {
                    throw new IllegalStateException("Illegal message type received");
                }
            } finally {
                consumerSession.close();
            }
        } finally {
            connection.close();
        }
    };
}
项目:dls-repository-stack    文件:SessionRegistry.java   
/**
 *  Unregister a sessionBean by calling its {@link edu.ucar.dls.schemedit.SessionBean#destroy() destroy}
 *  method (releasing all held locks), and removing its entry from the sessionBeanMap.
 *
 * @param  sessionId  Description of the Parameter
 */
public void unregisterSessionBean(String sessionId) {
    prtln("unregistering Session Bean for " + sessionId);
    SessionBean sessionBean = null;
    try {
        sessionBean = getSessionBean(sessionId);
    } catch (IllegalStateException ise) {
        prtlnErr("ERROR: getSessionBean (" + sessionId + "): " + ise.getMessage());
    }
    if (sessionBean != null) {
        sessionBean.destroy();
    }
    else {
        // if the session has been timed-out, sessionBean will be null, so we must explicitly release locks ...
        releaseAllLocks(sessionId);
    }
    synchronized (sessionBeanMap) {
        sessionBeanMap.remove(sessionId);
    }
}
项目:fsharpadvent2016    文件:LispReader.java   
public Object invoke(Object reader, Object pct, Object opts, Object pendingForms) {
    PushbackReader r = (PushbackReader) reader;
    if(ARG_ENV.deref() == null)
        {
        return interpretToken(readToken(r, '%'));
        }
    int ch = read1(r);
    unread(r, ch);
    //% alone is first arg
    if(ch == -1 || isWhitespace(ch) || isTerminatingMacro(ch))
        {
        return registerArg(1);
        }
    Object n = read(r, true, null, true, opts, ensurePending(pendingForms));
    if(n.equals(Compiler._AMP_))
        return registerArg(-1);
    if(!(n instanceof Number))
        throw new IllegalStateException("arg literal must be %, %& or %integer");
    return registerArg(((Number) n).intValue());
}
项目:eclojure    文件:LispReader.java   
public Object invoke(Object reader, Object pct, Object opts, Object pendingForms) {
    PushbackReader r = (PushbackReader) reader;
    if(ARG_ENV.deref() == null)
        {
        return interpretToken(readToken(r, '%'));
        }
    int ch = read1(r);
    unread(r, ch);
    //% alone is first arg
    if(ch == -1 || isWhitespace(ch) || isTerminatingMacro(ch))
        {
        return registerArg(1);
        }
    Object n = read(r, true, null, true, opts, ensurePending(pendingForms));
    if(n.equals(Compiler._AMP_))
        return registerArg(-1);
    if(!(n instanceof Number))
        throw new IllegalStateException("arg literal must be %, %& or %integer");
    return registerArg(((Number) n).intValue());
}
项目:JavaIncrementalParser    文件:JmsClient.java   
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)        // <1> we need to send message in the middle of the method, therefore we cannot be transactional
public String process(String request) {

    TextMessage requestMessage = jms.createTextMessage(request);
    TemporaryQueue responseQueue = jms.createTemporaryQueue();
    jms.createProducer()
            .setJMSReplyTo(responseQueue)                            // <2> set the temporary queue as replyToDestination
            .send(requestQueue, requestMessage);                     // <3> immediately send the request message

    try (JMSConsumer consumer = jms.createConsumer(responseQueue)) { // <4> listen on the temporary queue

        String response = consumer.receiveBody(String.class, 2000);  // <5> wait for a +TextMessage+ to arrive

        if (response == null) {                                      // <6> +receiveBody+  returns +null+ in case of timeout
            throw new IllegalStateException("Message processing timed out");
        } else {
            return response;
        }
    }
}
项目:PotRoom    文件:UserViewHolder_ViewBinding.java   
@Override
@CallSuper
public void unbind() {
  UserViewHolder target = this.target;
  if (target == null) throw new IllegalStateException("Bindings already cleared.");
  this.target = null;

  target.imageUser = null;
  target.txtUsername = null;
}
项目:qbit-extensions    文件:JmsServiceBuilder.java   
/**
 * @return destination
 * @see JmsServiceBuilder#destinationSupplier
 */
public Function<String, Destination> getDestinationSupplier() {

    final Context context = getContext();
    final String prefix = getDestinationPrefix();

    if (destinationSupplier == null) {
        destinationSupplier = destinationName -> {

            try {
                return (Destination) context.lookup(prefix + destinationName);
            } catch (NamingException e) {
                throw new IllegalStateException("Unable to lookup destination " + prefix + destinationName, e);

            }
        };
    }
    return destinationSupplier;
}
项目:ActivityScreens    文件:PrimitiveArraysActivityScreen.java   
private static void checkArguments(Bundle bundle) {
    if (!bundle.containsKey("array1")) {
        throw new IllegalStateException("Required argument array1 with key 'array1' is not set");
    }
    if (!bundle.containsKey("array2")) {
        throw new IllegalStateException("Required argument array2 with key 'array2' is not set");
    }
    if (!bundle.containsKey("array3")) {
        throw new IllegalStateException("Required argument array3 with key 'array3' is not set");
    }
    if (!bundle.containsKey("array4")) {
        throw new IllegalStateException("Required argument array4 with key 'array4' is not set");
    }
    if (!bundle.containsKey("array5")) {
        throw new IllegalStateException("Required argument array5 with key 'array5' is not set");
    }
    if (!bundle.containsKey("array6")) {
        throw new IllegalStateException("Required argument array6 with key 'array6' is not set");
    }
    if (!bundle.containsKey("array7")) {
        throw new IllegalStateException("Required argument array7 with key 'array7' is not set");
    }
    if (!bundle.containsKey("array8")) {
        throw new IllegalStateException("Required argument array8 with key 'array8' is not set");
    }
}
项目:LivroJavaComoProgramar10Edicao    文件:CreditInquiry.java   
private static void readRecords(MenuOption accountType)
{
   // open file and process contents
   try (Scanner input = new Scanner(Paths.get("clients.txt")))
   {
      while (input.hasNext()) // more data to read
      { 
         int accountNumber = input.nextInt();
         String firstName = input.next();
         String lastName = input.next();
         double balance = input.nextDouble();

         // if proper acount type, display record
         if (shouldDisplay(accountType, balance))       
            System.out.printf("%-10d%-12s%-12s%10.2f%n", accountNumber,
               firstName, lastName, balance);
         else
            input.nextLine(); // discard the rest of the current record
      }
   }
   catch (NoSuchElementException | 
      IllegalStateException | IOException e)
   {
      System.err.println("Error processing file. Terminating.");
      System.exit(1);
   } 
}
项目:RNLearn_Project1    文件:WebSocketModule.java   
@ReactMethod
public void send(String message, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(RequestBody.create(WebSocket.TEXT, message));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:RNLearn_Project1    文件:WebSocketModule.java   
@ReactMethod
public void sendBinary(String base64String, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(
      RequestBody.create(WebSocket.BINARY, ByteString.decodeBase64(base64String)));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:RNLearn_Project1    文件:WebSocketModule.java   
@ReactMethod
public void ping(int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    Buffer buffer = new Buffer();
    client.sendPing(buffer);
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:RNLearn_Project1    文件:WebSocketModule.java   
@ReactMethod
public void send(String message, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(RequestBody.create(WebSocket.TEXT, message));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:RNLearn_Project1    文件:WebSocketModule.java   
@ReactMethod
public void sendBinary(String base64String, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(
      RequestBody.create(WebSocket.BINARY, ByteString.decodeBase64(base64String)));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:RNLearn_Project1    文件:WebSocketModule.java   
@ReactMethod
public void ping(int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    Buffer buffer = new Buffer();
    client.sendPing(buffer);
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:ReactNativeSignatureExample    文件:WebSocketModule.java   
@ReactMethod
public void send(String message, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(
      WebSocket.PayloadType.TEXT,
      new Buffer().writeUtf8(message));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:react-native-ibeacon-android    文件:WebSocketModule.java   
@ReactMethod
public void send(String message, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(
      WebSocket.PayloadType.TEXT,
      new Buffer().writeUtf8(message));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:react-native-box-loaders    文件:WebSocketModule.java   
@ReactMethod
public void send(String message, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(
      WebSocket.PayloadType.TEXT,
      new Buffer().writeUtf8(message));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:react-native-box-loaders    文件:WebSocketModule.java   
@ReactMethod
public void sendBinary(String base64String, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(
      WebSocket.PayloadType.BINARY,
      new Buffer().write(ByteString.decodeBase64(base64String)));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:Android-plugin-support    文件:DynamicApkManager.java   
public DynamicApkParser.Component queryClassName(String name, int type) {
    switch (type) {
        case DynamicConstants.RESOLVE_ACTIVITY:
            return mActivities.mActivities.get(name);
        case DynamicConstants.RESOLVE_RECEIVER:
            return mReceivers.mActivities.get(name);
        case DynamicConstants.RESOLVE_SERVICE:
            return mServices.mServices.get(name);
        case DynamicConstants.RESOLVE_PROVIDER:
            return mProviders.mProviders.get(name);
        default:
            throw new IllegalStateException("Error resolved flag !");
    }
}
项目:Android-plugin-support    文件:DynamicApkManager.java   
public List<ResolveInfo> resolveIntent(Intent intent, String resolvedType, int type) {
    switch (type) {
        case DynamicConstants.RESOLVE_ACTIVITY:
            return mActivities.queryIntent(intent, resolvedType);
        case DynamicConstants.RESOLVE_RECEIVER:
            return mReceivers.queryIntent(intent, resolvedType);
        case DynamicConstants.RESOLVE_SERVICE:
            return mServices.queryIntent(intent, resolvedType);
        case DynamicConstants.RESOLVE_PROVIDER:
            return mProviders.queryIntent(intent, resolvedType);
        default:
            throw new IllegalStateException("Error resolved flag !");
    }
}
项目:Ironman    文件:WebSocketModule.java   
@ReactMethod
public void send(String message, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(RequestBody.create(WebSocket.TEXT, message));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}
项目:Ironman    文件:WebSocketModule.java   
@ReactMethod
public void sendBinary(String base64String, int id) {
  WebSocket client = mWebSocketConnections.get(id);
  if (client == null) {
    // This is a programmer error
    throw new RuntimeException("Cannot send a message. Unknown WebSocket id " + id);
  }
  try {
    client.sendMessage(
      RequestBody.create(WebSocket.BINARY, ByteString.decodeBase64(base64String)));
  } catch (IOException | IllegalStateException e) {
    notifyWebSocketFailed(id, e.getMessage());
  }
}