List of usage examples for java.lang InternalError InternalError
public InternalError(Throwable cause)
From source file:de.micromata.genome.util.strings.ReducedReflectionToStringBuilder.java
/** * Append fields in internal.//from ww w . j av a 2 s . com * * @param clazz the clazz * @return true, if successful */ protected boolean appendFieldsInInternal(Class<?> clazz) { registerObject(getObject()); if (clazz.isArray()) { this.reflectionAppendArray(this.getObject()); return false; } Field[] fields = clazz.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; String fieldName = field.getName(); if (this.accept(field) == false) { continue; } try { // Warning: Field.get(Object) creates wrappers objects // for primitive types. Object fieldValue = this.getValue(field); if (isObjectRegistered(fieldValue) == true && field.getType().isPrimitive() == false) { this.getStringBuffer().append(fieldName).append("="); this.appendAsObjectToString(fieldValue); this.getStringBuffer().append(","); } else { this.append(fieldName, fieldValue); } } catch (IllegalAccessException ex) { // this can't happen. Would get a Security exception // instead // throw a runtime exception in case the impossible // happens. throw new InternalError("Unexpected IllegalAccessException: " + ex.getMessage()); } } return true; }
From source file:org.jtester.module.utils.ObjectFormatter.java
/** * Formats the field values of the given object. * * @param object The object, not null * @param clazz The class for which to format the fields, not null * @param currentDepth The current recursion depth * @param result The builder to append the result to, not null */// w w w . j a va 2 s. c om protected void formatFields(Object object, Class<?> clazz, int currentDepth, StringBuilder result) { Field[] fields = clazz.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (int i = 0; i < fields.length; i++) { // skip transient and static fields Field field = fields[i]; if (isTransient(field.getModifiers()) || isStatic(field.getModifiers()) || field.isSynthetic()) { continue; } try { if (i > 0) { result.append(", "); } result.append(field.getName()); result.append("="); formatImpl(field.get(object), currentDepth + 1, result); } catch (IllegalAccessException e) { // this can't happen. Would get a Security exception instead // throw a runtime exception in case the impossible happens. throw new InternalError("Unexpected IllegalAccessException"); } } // format fields declared in superclass Class<?> superclazz = clazz.getSuperclass(); while (superclazz != null && !superclazz.getName().startsWith("java.lang")) { formatFields(object, superclazz, currentDepth, result); superclazz = superclazz.getSuperclass(); } }
From source file:com.commsen.apropos.core.PropertiesManager.java
/** * Adds new {@link Property} in {@link PropertyPackage} called <code>packageName</code> by * calling {@link PropertyPackage#addProperty(Property)}. * /*from www. j a va 2 s . c o m*/ * @param packageName the name of the package. Can not be <code>null</code> or empty. * @param property the {@link Property} to add. Can not be <code>null</code> * @return a new clone of the {@link PropertyPackage} made after the property is added * @throws PropertiesException if no package called <code>packageName</code> found or if such * {@link Property} already exists in this package * @throws IllegalArgumentException if any of the arguments is <code>null</code> */ public static synchronized PropertyPackage addProperty(String packageName, Property property) throws PropertiesException { if (StringUtils.isBlank(packageName)) throw new IllegalArgumentException("package name can not be null nor empty string"); if (property == null) throw new IllegalArgumentException("property can not be null"); if (!allPackages.containsKey(packageName)) throw new PropertiesException("No package called " + packageName + " found "); PropertyPackage propertyPackage = allPackages.get(packageName); try { propertyPackage.addProperty((Property) property.clone()); save(); return (PropertyPackage) propertyPackage.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.toString()); } }
From source file:com.intuit.tank.http.xml.GenericXMLHandler.java
/** * Clone the object//w ww . ja va2 s.co m */ public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.toString()); } }
From source file:com.clustercontrol.jobmanagement.dialog.JobDialog.java
/** * ????/*from w ww. j a va 2 s . c om*/ * <P> * ?????? * * @param parent ? * * @see com.clustercontrol.jobmanagement.bean.JobInfo * @see com.clustercontrol.bean.JobConstant */ @Override protected void customizeDialog(Composite parent) { m_shell = this.getShell(); Label label = null; RowLayout layout = new RowLayout(); layout.type = SWT.VERTICAL; layout.spacing = 0; layout.marginWidth = 10; layout.marginHeight = 10; layout.marginBottom = 0; layout.fill = true; parent.setLayout(layout); JobInfo info = m_jobTreeItem.getData(); if (info == null) throw new InternalError("info is null."); // ??????setJobFull JobPropertyUtil.setJobFull(m_managerName, info); if (info.getType() == JobConstant.TYPE_JOBUNIT) { parent.getShell().setText(Messages.getString("dialog.job.create.modify.jobunit")); } else if (info.getType() == JobConstant.TYPE_JOBNET) { parent.getShell().setText(Messages.getString("dialog.job.create.modify.jobnet")); } else if (info.getType() == JobConstant.TYPE_JOB) { parent.getShell().setText(Messages.getString("dialog.job.create.modify.job")); } else if (info.getType() == JobConstant.TYPE_FILEJOB) { parent.getShell().setText(Messages.getString("dialog.job.create.modify.forward.file.job")); } else if (info.getType() == JobConstant.TYPE_REFERJOB || info.getType() == JobConstant.TYPE_REFERJOBNET) { parent.getShell().setText(Messages.getString("dialog.job.create.modify.refer.job")); } else if (info.getType() == JobConstant.TYPE_APPROVALJOB) { parent.getShell().setText(Messages.getString("dialog.job.create.modify.approval.job")); } else if (info.getType() == JobConstant.TYPE_MONITORJOB) { parent.getShell().setText(Messages.getString("dialog.job.create.modify.monitor.job")); } boolean initFlag = true; if (info.getId() != null && info.getId().length() > 0) { initFlag = false; } // Composite Composite jobInfoComposite = new Composite(parent, SWT.NONE); GridLayout jobInfoGridLayout = new GridLayout(4, false); jobInfoComposite.setLayout(jobInfoGridLayout); // ID label = new Label(jobInfoComposite, SWT.NONE); label.setText(Messages.getString("job.id") + " : "); label.setLayoutData(new GridData(120, SizeConstant.SIZE_LABEL_HEIGHT)); // ID this.m_jobIdText = new Text(jobInfoComposite, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_jobIdText", m_jobIdText); this.m_jobIdText.setLayoutData(new GridData(200, SizeConstant.SIZE_TEXT_HEIGHT)); if (m_isCallJobHistory) { this.m_jobIdText.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_1024)); } else { this.m_jobIdText.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_64)); } this.m_jobIdText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // this.m_editButton = new Button(jobInfoComposite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_editButton", m_editButton); m_editButton.setText(Messages.getString("edit")); m_editButton.setEnabled(false); this.m_editButton.setLayoutData(new GridData(40, SizeConstant.SIZE_BUTTON_HEIGHT)); ((GridData) this.m_editButton.getLayoutData()).horizontalSpan = 2; m_editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { super.widgetSelected(event); JobTreeItem jobunitItem = JobUtil.getTopJobUnitTreeItem(m_jobTreeItem); String jobunitId = jobunitItem.getData().getJobunitId(); JobEditState JobEditState = JobEditStateUtil.getJobEditState(m_managerName); // ? Long updateTime = JobEditState.getJobunitUpdateTime(jobunitId); Integer result = null; try { result = JobUtil.getEditLock(m_managerName, jobunitId, updateTime, false); } catch (OtherUserGetLock_Exception e) { // ?????? String message = HinemosMessage.replace(e.getMessage()); if (MessageDialog.openQuestion(null, Messages.getString("confirmed"), message)) { try { result = JobUtil.getEditLock(m_managerName, jobunitId, updateTime, true); } catch (Exception e1) { // ?????????? m_log.error("run() : logical error"); } } } if (result != null) { // ??? m_log.debug("run() : get editLock(jobunitId=" + jobunitId + ")"); JobEditState.addLockedJobunit(jobunitItem.getData(), JobTreeItemUtil.clone(jobunitItem, null), result); if (m_jobTreeComposite != null) { m_jobTreeComposite.refresh(jobunitItem.getParent()); } //? m_readOnly = false; updateWidgets(); } else { // ????? m_log.debug("run() : cannot get editLock(jobunitId=" + jobunitId + ")"); } } }); // ?? label = new Label(jobInfoComposite, SWT.NONE); label.setText(Messages.getString("job.name") + " : "); label.setLayoutData(new GridData(120, SizeConstant.SIZE_LABEL_HEIGHT)); // ?? this.m_jobNameText = new Text(jobInfoComposite, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_jobNameText", m_jobNameText); this.m_jobNameText.setLayoutData(new GridData(200, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_jobNameText.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_64)); this.m_jobNameText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // this.m_moduleRegisteredCondition = new Button(jobInfoComposite, SWT.CHECK); WidgetTestUtil.setTestId(this, "m_moduleRegistCondition", this.m_moduleRegisteredCondition); this.m_moduleRegisteredCondition.setText(Messages.getString("job.module.registration")); this.m_moduleRegisteredCondition.setLayoutData(new GridData(150, SizeConstant.SIZE_BUTTON_HEIGHT)); ((GridData) this.m_moduleRegisteredCondition.getLayoutData()).horizontalSpan = 2; this.m_moduleRegisteredCondition.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); if (info.getType() == JobConstant.TYPE_JOBNET || info.getType() == JobConstant.TYPE_APPROVALJOB || info.getType() == JobConstant.TYPE_JOB || info.getType() == JobConstant.TYPE_FILEJOB || info.getType() == JobConstant.TYPE_MONITORJOB) { m_moduleRegisteredCondition.setEnabled(!m_readOnly); } else { m_moduleRegisteredCondition.setEnabled(false); } // label = new Label(jobInfoComposite, SWT.NONE); label.setText(Messages.getString("description") + " : "); label.setLayoutData(new GridData(120, SizeConstant.SIZE_LABEL_HEIGHT)); // m_jobAnnotationText = new Text(jobInfoComposite, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_jobAnnotationText", m_jobAnnotationText); m_jobAnnotationText.setLayoutData(new GridData(200, SizeConstant.SIZE_TEXT_HEIGHT)); m_jobAnnotationText.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_256)); // dummy new Label(jobInfoComposite, SWT.NONE); // dummy new Label(jobInfoComposite, SWT.NONE); // ID label = new Label(jobInfoComposite, SWT.NONE); label.setText(Messages.getString("owner.role.id") + " : "); label.setLayoutData(new GridData(120, SizeConstant.SIZE_LABEL_HEIGHT)); // ID // ????? // ????JobInfo.createTime?? if (info.getType() == JobConstant.TYPE_JOBUNIT && info.getCreateTime() == null) { this.m_ownerRoleId = new RoleIdListComposite(jobInfoComposite, SWT.NONE, this.m_managerName, true, Mode.OWNER_ROLE); this.m_ownerRoleId.getComboRoleId().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { m_messageComposite.getNotifyId().setOwnerRoleId(m_ownerRoleId.getText(), false); } }); } else { this.m_ownerRoleId = new RoleIdListComposite(jobInfoComposite, SWT.NONE, this.m_managerName, false, Mode.OWNER_ROLE); } GridData ownerRoleIdGridData = new GridData(); ownerRoleIdGridData.widthHint = 207; this.m_ownerRoleId.setLayoutData(ownerRoleIdGridData); // ID if (info.getType() != JobConstant.TYPE_JOBUNIT) { // ID label = new Label(jobInfoComposite, SWT.NONE); label.setText(Messages.getString("icon.id") + " : "); label.setLayoutData(new GridData(70, SizeConstant.SIZE_LABEL_HEIGHT)); // ID m_iconIdCombo = new Combo(jobInfoComposite, SWT.DROP_DOWN | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "m_iconIdCombo", m_iconIdCombo); m_iconIdCombo.setLayoutData(new GridData(120, SizeConstant.SIZE_COMBO_HEIGHT)); } else { // dummy new Label(jobInfoComposite, SWT.NONE); // dummy new Label(jobInfoComposite, SWT.NONE); } // m_tabFolder = new TabFolder(parent, SWT.NONE); WidgetTestUtil.setTestId(this, null, m_tabFolder); if (info.getType() == JobConstant.TYPE_JOBNET) { //?? m_startComposite = new WaitRuleComposite(m_tabFolder, SWT.NONE, info.getType()); WidgetTestUtil.setTestId(this, "m_startComposite", m_startComposite); TabItem tabItem1 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem1", tabItem1); tabItem1.setText(Messages.getString("wait.rule")); tabItem1.setControl(m_startComposite); // m_controlComposite = new ControlComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_controlComposite", m_controlComposite); TabItem tabItem2 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem2", tabItem2); tabItem2.setText(Messages.getString("control.job")); tabItem2.setControl(m_controlComposite); //? m_startDelayComposite = new StartDelayComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_startDelayComposite", m_startDelayComposite); TabItem tabItem3 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem3", tabItem3); tabItem3.setText(Messages.getString("start.delay")); tabItem3.setControl(m_startDelayComposite); //? m_endDelayComposite = new EndDelayComposite(m_tabFolder, SWT.NONE, false); WidgetTestUtil.setTestId(this, "m_endDelayComposite", m_endDelayComposite); TabItem tabItem4 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem4", tabItem4); tabItem4.setText(Messages.getString("end.delay")); tabItem4.setControl(m_endDelayComposite); } else if (info.getType() == JobConstant.TYPE_JOB) { //?? m_startComposite = new WaitRuleComposite(m_tabFolder, SWT.NONE, info.getType()); WidgetTestUtil.setTestId(this, "m_startComposite", m_startComposite); TabItem tabItem1 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem1", tabItem1); tabItem1.setText(Messages.getString("wait.rule")); tabItem1.setControl(m_startComposite); //() m_controlComposite = new ControlComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_controlComposite", m_controlComposite); TabItem tabItem2 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem2", tabItem2); tabItem2.setText(Messages.getString("control.job")); tabItem2.setControl(m_controlComposite); //() m_controlNodeComposite = new ControlNodeComposite(m_tabFolder, SWT.NONE, info.getType()); WidgetTestUtil.setTestId(this, "m_controlNodeComposite", m_controlNodeComposite); TabItem tabItem3 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem3", tabItem3); tabItem3.setText(Messages.getString("control.node")); tabItem3.setControl(m_controlNodeComposite); // m_executeComposite = new CommandComposite(m_tabFolder, SWT.NONE); m_executeComposite.setManagerName(m_managerName); WidgetTestUtil.setTestId(this, "m_executeComposite", m_executeComposite); TabItem tabItem4 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem4", tabItem4); tabItem4.setText(Messages.getString("command")); tabItem4.setControl(m_executeComposite); //? m_startDelayComposite = new StartDelayComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_startDelayComposite", m_startDelayComposite); TabItem tabItem5 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem5", tabItem5); tabItem5.setText(Messages.getString("start.delay")); tabItem5.setControl(m_startDelayComposite); //? m_endDelayComposite = new EndDelayComposite(m_tabFolder, SWT.NONE, false); WidgetTestUtil.setTestId(this, "m_endDelayComposite", m_endDelayComposite); TabItem tabItem6 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem6", tabItem6); tabItem6.setText(Messages.getString("end.delay")); tabItem6.setControl(m_endDelayComposite); } else if (info.getType() == JobConstant.TYPE_FILEJOB) { //?? m_startComposite = new WaitRuleComposite(m_tabFolder, SWT.NONE, info.getType()); WidgetTestUtil.setTestId(this, "m_startComposite", m_startComposite); TabItem tabItem1 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem1", tabItem1); tabItem1.setText(Messages.getString("wait.rule")); tabItem1.setControl(m_startComposite); // m_controlComposite = new ControlComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_controlComposite", m_controlComposite); TabItem tabItem2 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem2", tabItem2); tabItem2.setText(Messages.getString("control.job")); tabItem2.setControl(m_controlComposite); //() m_controlNodeComposite = new ControlNodeComposite(m_tabFolder, SWT.NONE, info.getType()); WidgetTestUtil.setTestId(this, "m_controlNodeComposite", m_controlNodeComposite); TabItem tabItem6 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem2", tabItem2); tabItem6.setText(Messages.getString("control.node")); tabItem6.setControl(m_controlNodeComposite); //? m_fileComposite = new FileComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_fileComposite", m_fileComposite); TabItem tabItem3 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem2", tabItem2); tabItem3.setText(Messages.getString("forward.file")); tabItem3.setControl(m_fileComposite); //? m_startDelayComposite = new StartDelayComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_startDelayComposite", m_startDelayComposite); TabItem tabItem4 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem2", tabItem2); tabItem4.setText(Messages.getString("start.delay")); tabItem4.setControl(m_startDelayComposite); //? m_endDelayComposite = new EndDelayComposite(m_tabFolder, SWT.NONE, true); WidgetTestUtil.setTestId(this, "m_endDelayComposite", m_endDelayComposite); TabItem tabItem5 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem2", tabItem2); tabItem5.setText(Messages.getString("end.delay")); tabItem5.setControl(m_endDelayComposite); } //?/?? else if (info.getType() == JobConstant.TYPE_REFERJOB || info.getType() == JobConstant.TYPE_REFERJOBNET) { //?? m_startComposite = new WaitRuleComposite(m_tabFolder, SWT.NONE, info.getType()); WidgetTestUtil.setTestId(this, "m_startComposite", m_startComposite); TabItem tabItem1 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem1", tabItem1); tabItem1.setText(Messages.getString("wait.rule")); tabItem1.setControl(m_startComposite); //? m_referComposite = new ReferComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_referComposite", m_referComposite); TabItem tabItem2 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabyitem2", tabItem2); tabItem2.setText(Messages.getString("refer")); tabItem2.setControl(m_referComposite); } else if (info.getType() == JobConstant.TYPE_APPROVALJOB) { //?? m_startComposite = new WaitRuleComposite(m_tabFolder, SWT.NONE, info.getType()); WidgetTestUtil.setTestId(this, "m_startComposite", m_startComposite); TabItem tabItem1 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem1", tabItem1); tabItem1.setText(Messages.getString("wait.rule")); tabItem1.setControl(m_startComposite); //() m_controlComposite = new ControlComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_controlComposite", m_controlComposite); TabItem tabItem2 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem2", tabItem2); tabItem2.setText(Messages.getString("control.job")); tabItem2.setControl(m_controlComposite); //? m_approvalComposite = new ApprovalComposite(m_tabFolder, SWT.NONE, m_managerName); WidgetTestUtil.setTestId(this, "m_approvalComposite", m_approvalComposite); TabItem tabItem3 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem3", tabItem3); tabItem3.setText(Messages.getString("approval")); tabItem3.setControl(m_approvalComposite); //? m_startDelayComposite = new StartDelayComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_startDelayComposite", m_startDelayComposite); TabItem tabItem4 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem4", tabItem4); tabItem4.setText(Messages.getString("start.delay")); tabItem4.setControl(m_startDelayComposite); //? m_endDelayComposite = new EndDelayComposite(m_tabFolder, SWT.NONE, false); WidgetTestUtil.setTestId(this, "m_endDelayComposite", m_endDelayComposite); TabItem tabItem5 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabItem5", tabItem5); tabItem5.setText(Messages.getString("end.delay")); tabItem5.setControl(m_endDelayComposite); } else if (info.getType() == JobConstant.TYPE_MONITORJOB) { //?? m_startComposite = new WaitRuleComposite(m_tabFolder, SWT.NONE, info.getType()); WidgetTestUtil.setTestId(this, "m_startComposite", m_startComposite); TabItem tabItem1 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem1", tabItem1); tabItem1.setText(Messages.getString("wait.rule")); tabItem1.setControl(m_startComposite); //() m_controlComposite = new ControlComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_controlComposite", m_controlComposite); TabItem tabItem2 = new TabItem(m_tabFolder, SWT.NONE); tabItem2.setText(Messages.getString("control.job")); tabItem2.setControl(m_controlComposite); // m_monitorComposite = new MonitorComposite(m_tabFolder, SWT.NONE); m_monitorComposite.setManagerName(m_managerName); WidgetTestUtil.setTestId(this, "m_monitorComposite", m_monitorComposite); TabItem tabItem4 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem4", tabItem4); tabItem4.setText(Messages.getString("monitor")); tabItem4.setControl(m_monitorComposite); //? m_startDelayComposite = new StartDelayComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_startDelayComposite", m_startDelayComposite); TabItem tabItem5 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem5", tabItem5); tabItem5.setText(Messages.getString("start.delay")); tabItem5.setControl(m_startDelayComposite); //? m_endDelayComposite = new EndDelayComposite(m_tabFolder, SWT.NONE, false); WidgetTestUtil.setTestId(this, "m_endDelayComposite", m_endDelayComposite); TabItem tabItem6 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem6", tabItem6); tabItem6.setText(Messages.getString("end.delay")); tabItem6.setControl(m_endDelayComposite); } //?/????? if (info.getType() != JobConstant.TYPE_REFERJOB && info.getType() != JobConstant.TYPE_REFERJOBNET) { // m_endComposite = new EndStatusComposite(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "m_endComposite", m_endComposite); TabItem tabItem7 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem7", tabItem7); tabItem7.setText(Messages.getString("end.status")); tabItem7.setControl(m_endComposite); //? m_messageComposite = new NotificationsComposite(m_tabFolder, SWT.NONE, m_managerName); WidgetTestUtil.setTestId(this, "m_messageComposite", m_messageComposite); TabItem tabItem8 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem8", tabItem8); tabItem8.setText(Messages.getString("notifications")); tabItem8.setControl(m_messageComposite); } if (info.getType() == JobConstant.TYPE_JOBUNIT) { // m_parameterComposite = new ParameterComposite(m_tabFolder, SWT.NONE, initFlag); WidgetTestUtil.setTestId(this, "m_parameterComposite", m_parameterComposite); TabItem tabItem9 = new TabItem(m_tabFolder, SWT.NONE); WidgetTestUtil.setTestId(this, "tabitem9", tabItem9); tabItem9.setText(Messages.getString("job.parameter")); tabItem9.setControl(m_parameterComposite); } m_tabFolder.setSelection(0); // ?? Display display = m_shell.getDisplay(); m_shell.setLocation((display.getBounds().width - m_shell.getSize().x) / 2, (display.getBounds().height - m_shell.getSize().y) / 2); //?? reflectJobInfo(info); updateWidgets(); }
From source file:com.healthmarketscience.rmiio.RemoteRetry.java
/** * Cleanup method which returns an InternalError. This is necessary if the * given exception did not match any of the given types (which should never * happen)./* www . j a v a 2s .c o m*/ */ private static Error handleNoMatches(Throwable throwable) { return (InternalError) (new InternalError("Impossible exception thrown")).initCause(throwable); }
From source file:org.jtester.hamcrest.matcher.property.report.ObjectFormatter.java
/** * Formats the field values of the given object. * /* ww w . j a v a 2 s . co m*/ * @param object * The object, not null * @param clazz * The class for which to format the fields, not null * @param currentDepth * The current recursion depth * @param result * The builder to append the result to, not null */ protected void formatFields(Object object, Class clazz, int currentDepth, StringBuilder result) { Field[] fields = clazz.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (int i = 0; i < fields.length; i++) { // skip transient and static fields Field field = fields[i]; if (isTransient(field.getModifiers()) || isStatic(field.getModifiers()) || field.isSynthetic()) { continue; } try { if (i > 0) { result.append(", "); } result.append(field.getName()); result.append("="); formatImpl(field.get(object), currentDepth + 1, result); } catch (IllegalAccessException e) { // this can't happen. Would get a Security exception instead // throw a runtime exception in case the impossible happens. throw new InternalError("Unexpected IllegalAccessException"); } } // format fields declared in superclass Class superclazz = clazz.getSuperclass(); while (superclazz != null && !superclazz.getName().startsWith("java.lang")) { formatFields(object, superclazz, currentDepth, result); superclazz = superclazz.getSuperclass(); } }
From source file:org.spantus.math.dtw.abeel.dtw.AbeelDTW.java
private static double euclideanDist(double vector1[], double vector2[]) { if (vector1.length != vector2.length) throw new InternalError("ERROR: cannot calculate the distance between vectors of different sizes."); double sqSum = 0.0D; for (int x = 0; x < vector1.length; x++) { double diff = vector1[x] - vector2[x]; sqSum += diff * diff;/* w ww . j ava 2 s. co m*/ } return Math.sqrt(sqSum); }
From source file:com.hmsinc.epicenter.model.analysis.AnalysisParameters.java
@Override public Object clone() { final AnalysisParameters clone; try {/*from w w w . java 2s . co m*/ clone = (AnalysisParameters) super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.toString()); } clone.getAttributes().addAll(attributes); clone.getClassifications().addAll(classifications); clone.getContainers().addAll(containers); return clone; }
From source file:edu.ku.brc.af.ui.forms.persist.View.java
public BusinessRulesIFace createBusinessRule() { BusinessRulesIFace businessRule = null; if (StringUtils.isNotEmpty(businessRulesClassName)) { try {/*from w w w . j av a 2 s . co m*/ businessRule = (BusinessRulesIFace) Class.forName(businessRulesClassName).newInstance(); } catch (Exception e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(View.class, e); InternalError error = new InternalError( "Can't instantiate BusinessRulesIFace [" + businessRulesClassName + "]"); error.initCause(e); throw error; } } else if (useDefaultBusRules) { businessRule = DBTableIdMgr.getInstance().getBusinessRule(className); } return businessRule; }