List of usage examples for java.lang Error Error
public Error(Throwable cause)
From source file:org.fenixedu.bennu.spring.portal.PortalHandlerMapping.java
private void registerLonelyControllers(Collection<Object> values) { for (Object bean : values) { Class<?> type = bean.getClass(); Class<?> functionalityType = AnnotationUtils.findAnnotation(type, BennuSpringController.class).value(); Functionality functionality = functionalities.get(functionalityType); if (functionality == null) { throw new Error("Controller " + type.getName() + " declares " + functionalityType.getName() + " as a functionality, but it is not one..."); }/*from w ww . ja v a 2 s . c om*/ functionalities.put(type, functionality); } }
From source file:nl.esciencecenter.ptk.csv.CSVData.java
public void setRow(int rowNr, String[] sourceRow) { this.assertEditable(); if (data == null) { throw new Error("No Data. Create Row first!"); }/*from ww w .j a v a 2 s . co m*/ if (this.data.size() < rowNr) { throw new Error("Row number to high:" + rowNr + ">" + data.size()); } synchronized (data) { String newRow[] = new String[sourceRow.length]; System.arraycopy(sourceRow, 0, newRow, 0, sourceRow.length); data.set(rowNr, newRow); } }
From source file:org.ambraproject.BaseHttpTest.java
private String getTestSolrResponse() { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("test-solr-response.xml"); StringWriter writer = new StringWriter(); try {/*from w w w .ja v a 2 s. co m*/ IOUtils.copy(inputStream, writer); } catch (IOException e) { throw new Error("Error loading test solr xml (should be included in test resources)"); } return writer.toString(); }
From source file:net.paoding.spdy.server.tomcat.impl.supports.SpdyOutputBuffer.java
@Override public int doWrite(ByteChunk chunk, Response coyoteResponse) throws IOException { int chunkLength = chunk.getLength(); if (chunkLength <= 0) { return 0; }/*from w w w . j a v a2 s.c o m*/ // @see org.apache.catalina.connector.CoyoteAdapter#service HttpServletResponse response = (HttpServletResponse) coyoteResponse.getNote(CoyoteAdapter.ADAPTER_NOTES); // chunk.getBuffer()byte?write if (response != null && chunk.getStart() + chunkLength == response.getBufferSize()) { byte[] copied = new byte[chunkLength]; System.arraycopy(chunk.getBuffer(), chunk.getStart(), copied, 0, chunkLength); delay = ChannelBuffers.wrappedBuffer(copied); if (debugEnabled) { logger.debug("writing copied buffer: offset=" + chunk.getStart() + " len=" + chunkLength + " outputBufferSize=" + response.getBufferSize()); } flush(coyoteResponse); } // ????write??chunk.bufferbyte else { if (fin) { throw new Error("spdy buffer error: buffer closed"); } if (debugEnabled) { logger.debug("writing writing buffer: offset=" + chunk.getStart() + " len=" + chunkLength); } delay = ChannelBuffers.wrappedBuffer(chunk.getBuffer(), chunk.getStart(), chunkLength); flushAndClose(coyoteResponse); } return chunk.getLength(); }
From source file:io.servicecomb.common.rest.definition.RestOperationMeta.java
public void init(OperationMeta operationMeta) { this.operationMeta = operationMeta; Swagger swagger = operationMeta.getSchemaMeta().getSwagger(); Operation operation = operationMeta.getSwaggerOperation(); this.produces = operation.getProduces(); if (produces == null) { this.produces = swagger.getProduces(); }// w w w . ja v a 2s.c o m this.createProduceProcessors(); Method method = operationMeta.getMethod(); Type[] genericParamTypes = method.getGenericParameterTypes(); if (genericParamTypes.length != operation.getParameters().size()) { throw new Error("Param count is not equal between swagger and method, path=" + absolutePath); } // ?rest param for (int idx = 0; idx < genericParamTypes.length; idx++) { Parameter parameter = operation.getParameters().get(idx); Type genericParamType = genericParamTypes[idx]; if ("formData".equals(parameter.getIn())) { formData = true; } RestParam param = new RestParam(idx, parameter, genericParamType); addParam(param); } setAbsolutePath(concatPath(swagger.getBasePath(), operationMeta.getOperationPath())); }
From source file:helpers.BaseFilterController.java
protected static void handleError(Exception e) { response.status = 400;/*w ww.j a v a 2 s . c om*/ String message = e.getMessage(); if (e instanceof MalformedURLException) { message = "Invalid URL"; } else if (e instanceof NotSupportedFormatException) { message = "Format not supported"; } else if (e instanceof FileTooBigException) { message = "File is too big. Limit is " + BaseFilter.FILE_SIZE_LIMIT / 1024 / 1024 + "MB."; } renderJSON(new Error(message)); }
From source file:Base64Encoder.java
public byte[] decode(String input) { try {/* w w w . java 2 s . c om*/ ByteArrayOutputStream out = new ByteArrayOutputStream(); StringReader in = new StringReader(input); for (int i = 0; i < input.length(); i += 4) { int a[] = { mapCharToInt(in), mapCharToInt(in), mapCharToInt(in), mapCharToInt(in) }; int oneBigNumber = (a[0] & 0x3f) << 18 | (a[1] & 0x3f) << 12 | (a[2] & 0x3f) << 6 | (a[3] & 0x3f); for (int j = 0; j < 3; j++) if (a[j + 1] >= 0) out.write(0xff & oneBigNumber >> 8 * (2 - j)); } return out.toByteArray(); } catch (IOException e) { throw new Error(e + ": " + e.getMessage()); } }
From source file:TimedPApplet.java
/*************************************************************************** * Initialise the applet by attempting to create and start a Player object * capable of playing the media specified in the applet tag. **************************************************************************/ public void init() { setLayout(new BorderLayout()); setBackground(Color.lightGray); try {//from w w w . ja v a 2 s . c o m nameOfMedia2Play = (new URL(getDocumentBase(), getParameter(MEDIA_NAME_PROPERTY))).toExternalForm(); locator = new MediaLocator(nameOfMedia2Play); player = Manager.createPlayer(locator); player.addControllerListener(this); timer = new SystemTimeBase(); player.start(); } catch (Exception e) { throw new Error("Couldn't initialise BBPApplet: " + e.getMessage()); } }
From source file:com.googlesource.gerrit.plugins.lfs.locks.LfsLocksContext.java
void sendError(int status, String message) throws IOException { sendError(status, new Error(message)); }
From source file:net.sourceforge.fenixedu.domain.inquiries.InquiryResult.java
public static void importResults(String stringResults, DateTime resultDate) { String[] allRows = stringResults.split("\r\n"); String[] rows = new String[199]; for (int iter = 0, cycleCount = 0; iter < allRows.length; iter++, cycleCount++) { if (iter == 0) { continue; }/* www .j a v a 2 s. c o m*/ rows[cycleCount] = allRows[iter]; if (cycleCount == 199 - 1) { WriteRows writeRows = new WriteRows(rows, resultDate); writeRows.start(); try { writeRows.join(); } catch (InterruptedException e) { if (writeRows.domainException != null) { throw writeRows.domainException; } throw new Error(e); } //importRows(rows, resultDate); cycleCount = 0; rows = new String[199]; } } WriteRows writeRows = new WriteRows(rows, resultDate); writeRows.start(); try { writeRows.join(); } catch (InterruptedException e) { if (writeRows.domainException != null) { throw writeRows.domainException; } throw new Error(e); } // importRows(rows, resultDate); }