List of usage examples for java.lang IllegalStateException IllegalStateException
public IllegalStateException(Throwable cause)
From source file:de.kaiserpfalzEdv.iam.identity.IdentityQueryBuilder.java
@Override public IdentityQuery build() { if (query.isValid()) return query; throw new IllegalStateException("The IdentityQuery object could not be built."); }
From source file:com.genericworkflownodes.knime.workflowexporter.export.KnimeWorkflowExporterProvider.java
/** * Gets the instance of this singleton.// w w w. j ava 2s.c o m * * @return The instance. */ public static KnimeWorkflowExporterProvider getInstance() { LOCK.lock(); try { if (INSTANCE == null) { throw new IllegalStateException("initInstance() should be called before calling getInstance()"); } return INSTANCE; } finally { LOCK.unlock(); } }
From source file:com.qcadoo.mes.cmmsMachineParts.constants.FaultTypeAppliesTo.java
public static FaultTypeAppliesTo parseString(final String appliesTo) { if (StringUtils.isEmpty(appliesTo)) { return NONE; } else if ("01workstationOrSubassembly".equals(appliesTo)) { return WORKSTATION_OR_SUBASSEMBLY; } else if ("02workstationType".equals(appliesTo)) { return WORKSTATION_TYPE; }/*from w w w.ja va 2s . c o m*/ throw new IllegalStateException("Unsupported AppliesTo: " + appliesTo); }
From source file:de.zib.gndms.kit.access.GNDMSBinding.java
/** * Set's the default (fallback) Injector instance * * May only be called once, this is done during initialize by GNDMSystem * * @param aInjector//from w ww . jav a 2 s. c o m */ @SuppressWarnings({ "StaticMethodOnlyUsedInOneClass" }) public static void setDefaultInjector(final @NotNull Injector aInjector) { if (!DEFAULT.compareAndSet(null, aInjector)) throw new IllegalStateException("Default Injector already set"); LOGGER.info("Default Injector set as a fallback for GNDMSBinding"); }
From source file:com.amalto.core.storage.hibernate.UpdateReportMappingCreator.java
public UpdateReportMappingCreator(TypeMetadata updateReportType, MetadataRepository repository, MappingRepository mappings, boolean preferClobUse) { this.repository = repository; if (updateReportType == null) { throw new IllegalStateException("Update report type cannot be null."); //$NON-NLS-1$ }/*from ww w . j a va 2s. c o m*/ USER_UPDATE_REPORT_TYPE = (ComplexTypeMetadata) updateReportType; this.mappings = mappings; ComplexTypeMetadata databaseUpdateReportType = new ComplexTypeMetadataImpl(StringUtils.EMPTY, "X_UPDATE_REPORT", true); //$NON-NLS-1$ TypeMetadata stringType = new SimpleTypeMetadata(XMLConstants.W3C_XML_SCHEMA_NS_URI, Types.STRING); TypeMetadata longStringType = new SimpleTypeMetadata(XMLConstants.W3C_XML_SCHEMA_NS_URI, Types.STRING); TypeMetadata longType = new SimpleTypeMetadata(XMLConstants.W3C_XML_SCHEMA_NS_URI, Types.LONG); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, false, false, false, "x_user_name", stringType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, true, false, true, "x_source", stringType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, true, false, true, "x_time_in_millis", longType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, false, false, false, "x_operation_type", stringType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, false, false, false, "x_revision_id", stringType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, false, false, false, "x_data_cluster", stringType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, false, false, false, "x_data_model", stringType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, false, false, false, "x_concept", stringType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); databaseUpdateReportType.addField(new SimpleTypeFieldMetadata(databaseUpdateReportType, false, false, false, "x_key", stringType, Collections.<String>emptyList(), Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), StringUtils.EMPTY)); SimpleTypeFieldMetadata items_xml = new SimpleTypeFieldMetadata(databaseUpdateReportType, false, false, false, "x_items_xml", longStringType, Collections.<String>emptyList(), //$NON-NLS-1$ Collections.<String>emptyList(), Collections.<String>emptyList(), StringUtils.EMPTY); items_xml.getType().setData(TypeMapping.SQL_TYPE, preferClobUse ? TypeMapping.SQL_TYPE_CLOB : TypeMapping.SQL_TYPE_TEXT); databaseUpdateReportType.addField(items_xml); DATABASE_UPDATE_REPORT_TYPE = (ComplexTypeMetadata) databaseUpdateReportType.freeze(); }
From source file:org.thingsplode.server.bus.executors.AbstractSyncExecutor.java
public void process(Message<?> msg) { AbstractRequest req = (AbstractRequest) msg.getPayload(); Device callerDevice = getDeviceRepo().findByIdentification(req.getDeviceId()); if (callerDevice == null) { throw new IllegalStateException(String.format("The device identified by id [%s] is not registered", req.getDeviceId() != null ? req.getDeviceId() : "<NULL>")); }//from ww w . jav a2 s . co m try { executeImpl((REQ) msg.getPayload(), msg.getHeaders(), callerDevice); } catch (SrvExecutionException ex) { logger.error(ex.getMessage(), ex); getMsgTemplate().send(MessageBuilder .withPayload(new ErrorMessage(ex.getExecutionStatus(), ex.getResponseCode(), ex)).build()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); getMsgTemplate().send(MessageBuilder .withPayload(new ErrorMessage(ExecutionStatus.DECLINED, determineResponseCode(ex), ex)) .build()); } }
From source file:com.haulmont.cuba.gui.components.ValuePathHelper.java
public static String[] parse(String path) { if (!path.contains(".") && !path.contains("[")) return new String[] { path }; List<String> elements = new ArrayList<>(); int bracketCount = 0; StringBuilder buffer = new StringBuilder(); for (int i = 0; i < path.length(); i++) { char c = path.charAt(i); if (c == '[') { bracketCount++;//from w w w . j a v a 2 s . c o m continue; } if (c == ']') { bracketCount--; continue; } if ('.' != c || bracketCount > 0) buffer.append(c); if ('.' == c && bracketCount == 0) { String element = buffer.toString(); if (!StringUtils.isEmpty(element)) { elements.add(element); } else { throw new IllegalStateException("Wrong value path format"); } buffer = new StringBuilder(); } } elements.add(buffer.toString()); return elements.toArray(new String[elements.size()]); }
From source file:de.xaniox.heavyspleef.core.i18n.I18NManager.java
/** * Sets the {@link I18NBuilder} for initializing the * global I18N.<br><br>//from w w w .java 2 s . c o m * * This may throw an exception when there is already a builder set * * @param builder The builder for initializing * @see #getGlobal() */ public static void setGlobalBuilder(I18NBuilder builder) { if (globalBuilder != null) { throw new IllegalStateException("Global I18NBuilder has already been set"); } I18NManager.globalBuilder = builder; }
From source file:hr.fer.zemris.vhdllab.platform.ui.command.DevCreateUncaughtExceptionCommand.java
@Override protected void doExecuteCommand() { throw new IllegalStateException("Forced unchaught error"); }
From source file:com.amazon.services.awsrum.utils.S3Utils.java
/** * Create a S3 bucket if it does not exist. * /* ww w . j a v a 2 s. co m*/ * @param client * The {@link AmazonS3Client} with read and write permissions * @param bucketName * The bucket to create * @throws IllegalStateException * The bucket is not created before timeout occurs */ public static void createBucket(AmazonS3Client client, String bucketName) { if (!bucketExists(client, bucketName)) { CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName); createBucketRequest.setRegion(Region.US_Standard.toString()); client.createBucket(createBucketRequest); } long startTime = System.currentTimeMillis(); long endTime = startTime + 60 * 1000; while (!bucketExists(client, bucketName) && endTime > System.currentTimeMillis()) { try { LOG.info("Waiting for S3 to create bucket " + bucketName); Thread.sleep(1000 * 10); } catch (InterruptedException e) { } } if (!bucketExists(client, bucketName)) { throw new IllegalStateException("Could not create bucket " + bucketName); } LOG.info("Created S3 bucket " + bucketName); }