java.lang.IllegalStateException Java Examples
The following examples show how to use
java.lang.IllegalStateException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JMSReceiverClient.java From maestro-java with Apache License 2.0 | 7 votes |
@Override public long receiveMessages(int sessionMode) throws Exception { final Message message = consumer.receive(RECEIVE_TIMEOUT_MILLIS); if (message == null) { return ReceiverClient.noMessagePayload(); } else if (sessionMode == Session.CLIENT_ACKNOWLEDGE) { message.acknowledge(); } else if (sessionMode == Session.SESSION_TRANSACTED) { logger.warn("Acknowledging the transaction"); session.commit(); } final int readBytes = getReadBytes((BytesMessage) message); if (readBytes == PAYLOAD_SIZE || readBytes == -1) { //can read the timestamp using the default endianness of the content strategy return payloadBytes.getLong(0); } throw new IllegalStateException("the received message hasn't any benchmark payload"); }
Example #2
Source File: constructor.java From pluotsorbet with GNU General Public License v2.0 | 6 votes |
/** * 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"); }
Example #3
Source File: ModelViewWithParisModel_.java From epoxy with Apache License 2.0 | 6 votes |
@Override public void handlePreBind(final EpoxyViewHolder holder, final ModelViewWithParis object, final int position) { validateStateHasNotChangedSinceAdded("The model was changed between being added to the controller and being bound.", position); if (!Objects.equals(style, object.getTag(R.id.epoxy_saved_view_style))) { AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() { public void run() { try { StyleApplierUtils.Companion.assertSameAttributes(new ModelViewWithParisStyleApplier(object), style, DEFAULT_PARIS_STYLE); } catch(AssertionError e) { throw new IllegalStateException("ModelViewWithParisModel_ model at position " + position + " has an invalid style:\n\n" + e.getMessage()); } } } ); } }
Example #4
Source File: TestManyTypesViewModel_.java From epoxy with Apache License 2.0 | 6 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(10)) { throw new IllegalStateException("A value is required for setArrayValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(12)) { throw new IllegalStateException("A value is required for setClickListener"); } if (!assignedAttributes_epoxyGeneratedModel.get(9)) { throw new IllegalStateException("A value is required for setBooleanValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setStringValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(7)) { throw new IllegalStateException("A value is required for setIntegerValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(11)) { throw new IllegalStateException("A value is required for setListValue"); } }
Example #5
Source File: StyleableModelViewModel_.java From epoxy with Apache License 2.0 | 6 votes |
@Override public void handlePreBind(final EpoxyViewHolder holder, final StyleableModelView object, final int position) { validateStateHasNotChangedSinceAdded("The model was changed between being added to the controller and being bound.", position); if (!Objects.equals(style, object.getTag(R.id.epoxy_saved_view_style))) { AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() { public void run() { try { StyleApplierUtils.Companion.assertSameAttributes(new StyleableModelViewStyleApplier(object), style, DEFAULT_PARIS_STYLE); } catch(AssertionError e) { throw new IllegalStateException("StyleableModelViewModel_ model at position " + position + " has an invalid style:\n\n" + e.getMessage()); } } } ); } }
Example #6
Source File: JmsProxyImpl.java From c2mon with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void registerBroadcastMessageListener(final BroadcastMessageListener broadcastMessageListener) { if (broadcastMessageListener == null) { throw new NullPointerException("Trying to register null BroadcastMessage listener with JmsProxy."); } if (adminMessageTopic == null) { throw new IllegalStateException(String.format("Cannot register '%s' without having the admin message topic", BroadcastMessageListener.class.getSimpleName())); } broadcastMessageListenerWrapper.addListener(broadcastMessageListener); }
Example #7
Source File: MessageBean.java From tomee with Apache License 2.0 | 5 votes |
public void callRed() { try { process(cf, red, "red", Session.SESSION_TRANSACTED); } catch (Exception e) { throw new IllegalStateException(e); } }
Example #8
Source File: SavedStateViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setClickListener"); } }
Example #9
Source File: AllTypesModelViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(8)) { throw new IllegalStateException("A value is required for setBoxedIntValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(1)) { throw new IllegalStateException("A value is required for setBoxedBooleanValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(3)) { throw new IllegalStateException("A value is required for setBoxedDoubleValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(6)) { throw new IllegalStateException("A value is required for setEpoxyModelList"); } if (!assignedAttributes_epoxyGeneratedModel.get(10)) { throw new IllegalStateException("A value is required for setBoxedLongValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(14)) { throw new IllegalStateException("A value is required for setStringList"); } if (!assignedAttributes_epoxyGeneratedModel.get(13)) { throw new IllegalStateException("A value is required for setStringValue"); } if (!assignedAttributes_epoxyGeneratedModel.get(11)) { throw new IllegalStateException("A value is required for setOnClickListener"); } if (!assignedAttributes_epoxyGeneratedModel.get(2)) { throw new IllegalStateException("A value is required for setCharSequenceValue"); } }
Example #10
Source File: SampleResourceAdapter.java From tomee with Apache License 2.0 | 5 votes |
public void endpointDeactivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) { final SampleActivationSpec sampleActivationSpec = (SampleActivationSpec) activationSpec; final EndpointTarget endpointTarget = targets.get(sampleActivationSpec); if (endpointTarget == null) { throw new IllegalStateException("No EndpointTarget to undeploy for ActivationSpec " + activationSpec); } endpointTarget.messageEndpoint.release(); }
Example #11
Source File: TryCatch.java From pluotsorbet with GNU General Public License v2.0 | 5 votes |
/** * Runs the test using the specified harness. * * @param harness the test harness (<code>null</code> not permitted). */ public void test(TestHarness harness) { // flag that is set when exception is caught boolean caught = false; try { throw new IllegalStateException("IllegalStateException"); } catch (IllegalStateException e) { // correct exception was caught caught = true; } harness.check(caught); }
Example #12
Source File: MessageBean.java From tomee with Apache License 2.0 | 5 votes |
public void callNoColor() { try { process(cf, noColor, "nocolor", Session.SESSION_TRANSACTED); } catch (Exception e) { throw new IllegalStateException(e); } }
Example #13
Source File: JmsProxyImpl.java From c2mon with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void setBroadcastMessageTopic(final Destination adminMessageTopic) { if (this.adminMessageTopic != null) { throw new IllegalStateException("Cannot set the admin message topic more than one time"); } this.adminMessageTopic = adminMessageTopic; if (connected) { try { subscribeToAdminMessageTopic(); } catch (JMSException e) { log.error("Unable to subscribe to the admin message topic, this functionality may not function properly.", e); } } }
Example #14
Source File: TestFieldPropChildViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for textValue"); } }
Example #15
Source File: DynamicApkManager.java From Android-plugin-support with MIT License | 5 votes |
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 !"); } }
Example #16
Source File: DynamicApkManager.java From Android-plugin-support with MIT License | 5 votes |
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 !"); } }
Example #17
Source File: ListSubtypeModelViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setStringArrayList"); } }
Example #18
Source File: BaseModelWithAttributeViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setClickListener"); } }
Example #19
Source File: IgnoreRequireHashCodeViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setClickListener"); } }
Example #20
Source File: ModelWithDataBindingWithoutDonothashBindingModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override protected void setDataBindingVariables(ViewDataBinding binding) { if (!binding.setVariable(BR.stringValue, stringValue)) { throw new IllegalStateException("The attribute stringValue was defined in your data binding model (com.airbnb.epoxy.DataBindingEpoxyModel) but a data variable of that name was not found in the layout."); } if (!binding.setVariable(BR.clickListener, clickListener)) { throw new IllegalStateException("The attribute clickListener was defined in your data binding model (com.airbnb.epoxy.DataBindingEpoxyModel) but a data variable of that name was not found in the layout."); } }
Example #21
Source File: BaseModelFromPackageConfigViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setClickListener"); } }
Example #22
Source File: TestFieldPropDoNotHashOptionViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for value"); } }
Example #23
Source File: ControllerWithAutoModelWithSuperClass$SubControllerWithAutoModelWithSuperClass_EpoxyHelper.java From epoxy with Apache License 2.0 | 5 votes |
private void validateSameModel(EpoxyModel expectedObject, EpoxyModel actualObject, String fieldName, int id) { if (expectedObject != actualObject) { throw new IllegalStateException("Fields annotated with AutoModel cannot be directly assigned. The controller manages these fields for you. (" + controller.getClass().getSimpleName() + "#" + fieldName + ")"); } if (actualObject != null && actualObject.id() != id) { throw new IllegalStateException("Fields annotated with AutoModel cannot have their id changed manually. The controller manages the ids of these models for you. (" + controller.getClass().getSimpleName() + "#" + fieldName + ")"); } }
Example #24
Source File: OnVisibilityStateChangedViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setTitle"); } }
Example #25
Source File: TextPropDefaultViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for textWithDefault"); } }
Example #26
Source File: ControllerWithAutoModelAndImplicitAdding_EpoxyHelper.java From epoxy with Apache License 2.0 | 5 votes |
private void validateSameModel(EpoxyModel expectedObject, EpoxyModel actualObject, String fieldName, int id) { if (expectedObject != actualObject) { throw new IllegalStateException("Fields annotated with AutoModel cannot be directly assigned. The controller manages these fields for you. (" + controller.getClass().getSimpleName() + "#" + fieldName + ")"); } if (actualObject != null && actualObject.id() != id) { throw new IllegalStateException("Fields annotated with AutoModel cannot have their id changed manually. The controller manages the ids of these models for you. (" + controller.getClass().getSimpleName() + "#" + fieldName + ")"); } }
Example #27
Source File: GridSpanCountViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setClickListener"); } }
Example #28
Source File: BaseModelOverridesPackageConfigViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(0)) { throw new IllegalStateException("A value is required for setClickListener"); } }
Example #29
Source File: PropDefaultsViewModel_.java From epoxy with Apache License 2.0 | 5 votes |
@Override public void addTo(EpoxyController controller) { super.addTo(controller); addWithDebugValidation(controller); if (!assignedAttributes_epoxyGeneratedModel.get(1)) { throw new IllegalStateException("A value is required for noDefaultSoItIsRequired"); } }
Example #30
Source File: MessageBean.java From tomee with Apache License 2.0 | 5 votes |
public void callBlue() { try { process(cf, blue, "blue", Session.SESSION_TRANSACTED); } catch (Exception e) { throw new IllegalStateException(e); } }