List of usage examples for java.lang InternalError InternalError
public InternalError(Throwable cause)
From source file:edu.ku.brc.ui.UIRegistry.java
/** * Returns the ViewBasedFacory for the application. * @return the ViewBasedFacory for the application *///from w w w .j av a 2 s . c o m public static ViewBasedDialogFactoryIFace getViewbasedFactory() { if (instance.viewbasedFactory == null) { String className = System.getProperty("edu.ku.brc.ui.ViewBasedDialogFactoryIFace", null); if (StringUtils.isNotEmpty(className)) { try { instance.viewbasedFactory = (ViewBasedDialogFactoryIFace) Class.forName(className) .newInstance(); } catch (Exception e) { InternalError error = new InternalError( "Can't instantiate ViewBasedDialogFactoryIFace factory " + className); error.initCause(e); throw error; } } else { throw new InternalError(MISSING_FACTORY_MSG); } } return instance.viewbasedFactory; }
From source file:net.sf.firemox.clickable.target.card.MCard.java
@Override public int getValue(int index) { if (index == IdTokens.MANA_POOL) { if (idZone == IdZones.STACK) { // return the total cost of associated ability return StackManager.getTotalManaPaid(this); }/*from w w w .j av a 2s.c om*/ return MToolKit.manaPool(cachedRegisters); } if (index == IdTokens.ID) { return getId(); } if (index >= IdTokens.FIRST_FREE_CARD_INDEX) { return registers[index]; } if (cachedRegisters == null) { throw new InternalError("modifiedRegisters is null in getValue in card"); } return cachedRegisters[index]; }
From source file:edu.ku.brc.af.ui.forms.formatters.DataObjFieldFormatMgr.java
/** * Returns the instance to the singleton * @return the instance to the singleton *//*from w w w.j a v a2 s .c o m*/ public static DataObjFieldFormatMgr getInstance() { if (instance.get() != null) { return instance.get(); } synchronized (instance) { if (StringUtils.isEmpty(factoryName)) { instance.set(new DataObjFieldFormatMgr()); } else { // else String factoryNameStr = AccessController.doPrivileged(new java.security.PrivilegedAction<String>() { public String run() { return System.getProperty(factoryName); } }); if (StringUtils.isNotEmpty(factoryNameStr)) { try { instance.set((DataObjFieldFormatMgr) Class.forName(factoryNameStr).newInstance()); } catch (Exception e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(DataObjFieldFormatMgr.class, e); InternalError error = new InternalError( "Can't instantiate DataObjFieldFormatMgr factory " + factoryNameStr); error.initCause(e); throw error; } } if (instance.get() == null) { instance.set(new DataObjFieldFormatMgr()); } } // now that all formats have been loaded, set table/field/formatter // info\ // must be executed after the instance is set for (DataObjSwitchFormatter format : instance.get().formatHash.values()) { format.setTableAndFieldInfo(); } } return instance.get(); }
From source file:net.sf.firemox.clickable.target.card.MCard.java
/** * Set to the register of this card a value to a specified index. The given * operation is uesed to apply operation on old and the given value. To set * the given value as the new one, use the "set" operation. * /*from w ww.j av a 2s .co m*/ * @param index * is the index of register to modify * @param operation * the operation to use * @param rightValue * is the value to use as right operand for the operation */ public void setValue(int index, Operation operation, int rightValue) { registers[index] = operation.process(registers[index], rightValue); if (index == IdCommonToken.DAMAGE) { MContextCardCardIntInt context = null; if (StackManager.getInstance().getAbilityContext() != null && StackManager.triggered.getAbilityContext() instanceof MContextCardCardIntInt && operation instanceof Add) { context = (MContextCardCardIntInt) StackManager.triggered.getAbilityContext(); if (context.getValue() != rightValue) { throw new InternalError( "wrong damage value regValue=" + rightValue + ", context.int=" + context.getValue()); } } if (operation instanceof Add) { Log.debug(new StringBuilder("Add ").append(rightValue).append(" damage to card ") .append(getCardName()).append("@").append(hashCode()).append(":").append(rightValue)); Damage damage = new Damage(context == null ? SystemCard.instance : context.getCard2(), rightValue, context == null ? 0 : context.getValue2()); damage.tap(tapped); add(damage); } else { // in any other cases, we remove all damages clearDamages(); } ui.updateLayout(); } if (index < IdTokens.FIRST_FREE_CARD_INDEX) { // we need to refresh the cache of this index int modifiedRegister = registerModifiers[index] != null ? registerModifiers[index].getValue(getValueIndirection(index)) : getValueIndirection(index); if (this.cachedRegisters[index] != modifiedRegister) { // the register of this card has changed. // Negative values are not cachedRegisters[index] = modifiedRegister < 0 ? 0 : modifiedRegister; ui.resetCachedData(); // no generated event, this managed in the ModifyRegister action } } else { repaint(); } }
From source file:org.bdval.DAVMode.java
private Table readGeoSeries(final Reader reader) { final ArrayTable result = new ArrayTable(); final GeoSoftFamilyParser parser = new GeoSoftFamilyParser(reader); if (parser.skipToDatabaseSection()) { final MutableString databaseName = parser.getSectionAttribute(); System.out.println("Database: " + databaseName); } else {//w w w. java 2 s .c o m System.out.println("No database section found."); } GEOPlatformIndexed platform = null; if (parser.skipToPlatformSection()) { final MutableString platformName = parser.getSectionAttribute(); System.out.println("Platform: " + platformName); platform = parser.parsePlatform(); platform.setName(platformName); System.out.println("Platform has " + platform.getNumProbeIds() + " probes."); } else { System.out.println("No database section found."); } result.setChunk(platform.getNumProbeIds()); result.setInitialSize(platform.getNumProbeIds()); result.addColumn("ID_REF", String.class); // append probeset ids: for (int probeIndex = 0; probeIndex < platform.getNumProbeIds(); probeIndex++) { final String probeId = platform.getProbesetIdentifier(probeIndex).toString(); result.appendObject(0, probeId); } final DefaultSignalAdapter formatAdapter = new DefaultSignalAdapter(true); while (parser.skipToSampleSection()) { // append signal value for each sample: final MutableString sampleName = parser.getSectionAttribute(); final int newColumnIndex = result.addColumn(sampleName.toString(), double.class); final SampleDataCallback callback = formatAdapter.getCallback(platform); parser.parseSampleData(platform, callback); final AffymetrixSampleData data = (AffymetrixSampleData) callback.getParsedData(); for (final float signal : data.signal) { try { result.appendDoubleValue(newColumnIndex, signal); // result.parseAppend(newColumnIndex, Float.toString(signal)); } catch (TypeMismatchException e) { throw new InternalError("Column must be of type double."); } } formatAdapter.analyzeSampleData(platform, callback, sampleName); } return result; }
From source file:org.bdval.DAVMode.java
protected Table filterTable(final DAVOptions options, final Table source, final GeneList geneList) { try {//from www . java 2 s. c o m final Set<String> columnsToKeep = new ObjectOpenHashSet<String>(); columnsToKeep.add("ID_REF"); for (int colIndex = 1; colIndex < source.getColumnNumber(); colIndex++) { final String colId = source.getIdentifier(colIndex); if (geneList.isProbesetInList(colId)) { columnsToKeep.add(colId); } } final Table result = source.copy(new AcceptAllRowFilter(), new KeepSubSetColumnFilter(columnsToKeep)); /* final IntList columnIndicesToRemove = new IntArrayList(); final ObjectList<String> columnIdsToRemove = new ObjectArrayList<String>(); int index=0; for (final int toRemoveIndex : columnIndicesToRemove) { result.removeColumn(toRemoveIndex, columnIdsToRemove.get(index++)); } */ rebuildTrainingPlatform(options, result); return result; } catch (TypeMismatchException e) { throw new InternalError("Should not happen."); } catch (InvalidColumnException e) { throw new InternalError("Should not happen."); } }
From source file:org.bdval.DAVMode.java
/** * Filter processed table to keep only a subset of samples. * * @param processedTable/*from ww w . j a v a2 s. c o m*/ * @param keepSampleIds Those sample ids to keep in the filtered table. * @return filtered table. */ protected Table filterSamples(final Table processedTable, final ObjectSet<String> keepSampleIds) { final int idColumnIndex = 0; final RowFilter myFilter = new IdentifierSetRowFilter(keepSampleIds, idColumnIndex); try { return processedTable.copy(myFilter); } catch (TypeMismatchException e) { throw new InternalError("Must not happen."); } catch (InvalidColumnException e) { throw new InternalError("Must not happen."); } }
From source file:org.pentaho.platform.web.http.api.resources.services.FileServiceTest.java
@Test public void testDoCreateDirsNegative() throws Exception { String pathId = "path:to:file:file1.ext"; doReturn("/path/to/file/file1.ext").when(fileService).idToPath(pathId); RepositoryFileDto parentDir = mock(RepositoryFileDto.class); doReturn("").when(parentDir).getPath(); doReturn(FileUtils.PATH_SEPARATOR).when(parentDir).getId(); when(fileService.getRepoWs().getFile(FileUtils.PATH_SEPARATOR)).thenReturn(parentDir); RepositoryFileDto filePath = mock(RepositoryFileDto.class); doReturn("/path").when(filePath).getPath(); doReturn("/path").when(filePath).getId(); RepositoryFileDto fileTo = mock(RepositoryFileDto.class); doReturn("/path/to").when(fileTo).getPath(); doReturn("/path/to").when(fileTo).getId(); RepositoryFileDto fileFile = mock(RepositoryFileDto.class); doReturn("/path/to/file").when(fileFile).getPath(); doReturn("/path/to/file").when(fileFile).getId(); RepositoryFileDto fileFileExt = mock(RepositoryFileDto.class); doReturn("/path/to/file/file1").when(fileFileExt).getPath(); doReturn("/path/to/file/file1").when(fileFileExt).getId(); when(fileService.getRepoWs().getFile("/path")).thenReturn(filePath); when(fileService.getRepoWs().getFile("/path/to")).thenReturn(fileTo); when(fileService.getRepoWs().getFile("/path/to/file")).thenReturn(fileFile); when(fileService.getRepoWs().getFile("/path/to/file/file1.ext")).thenReturn(fileFileExt); assertFalse(fileService.doCreateDir(pathId)); verify(fileService.getRepoWs(), times(0)).createFolder(anyString(), any(RepositoryFileDto.class), anyString());// ww w . j a v a 2 s. co m when(fileService.getRepoWs().getFile("/path")).thenReturn(null); when(fileService.getRepoWs().createFolder(eq("/"), any(RepositoryFileDto.class), eq("/path"))) .thenThrow(new InternalError("negativetest")); try { fileService.doCreateDir(pathId); } catch (InternalError e) { assertEquals(e.getMessage(), "negativetest"); } }
From source file:edu.ku.brc.af.ui.forms.ViewFactory.java
/** * Returns the singleton for the ViewSetMgr. * @return the singleton for the ViewSetMgr *///from w w w. jav a 2 s . co m public static ViewFactory getInstance() { if (instance != null) { return instance; } // else String factoryNameStr = AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { return System.getProperty(factoryName); } }); if (factoryNameStr != null) { try { instance = (ViewFactory) Class.forName(factoryNameStr).newInstance(); return instance; } catch (Exception e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(AppContextMgr.class, e); InternalError error = new InternalError("Can't instantiate ViewFactory factory " + factoryNameStr); //$NON-NLS-1$ error.initCause(e); throw error; } } return instance = new ViewFactory(); }