List of usage examples for java.lang Error Error
public Error(Throwable cause)
From source file:com.appeligo.search.actions.ProgramAlertAction.java
public String createProgramAlert() throws Exception { User user = getUser();//w ww . java 2 s . c o m log.debug("Creating program alert for user " + user.getUsername() + " on program " + programId); String rtn = checkInput(); if (!rtn.equals(SUCCESS)) { return rtn; } ProgramAlert programAlert = new ProgramAlert(); setProgramAlert(programAlert); if (reminderType.equals("episode") || reminderType.equals("game") || reminderType.equals("team")) { programAlert.setProgramId(programId); } else if (reminderType.equals("series")) { programId = Program.getShowId(programId); programAlert.setProgramId(programId); programAlert.setNewEpisodes(newEpisodes); } else if (reminderType.equals("awayTeam")) { EPGProvider epg = AlertManager.getInstance().getEpg(); Program program = epg.getProgram(programId); Program team = epg.getProgramForTeam(program.getSportName(), program.getAwayTeamName()); programAlert.setProgramId(team.getProgramId()); } else if (reminderType.equals("homeTeam")) { EPGProvider epg = AlertManager.getInstance().getEpg(); Program program = epg.getProgram(programId); Program team = epg.getProgramForTeam(program.getSportName(), program.getHomeTeamName()); programAlert.setProgramId(team.getProgramId()); } else { throw new Error("reminderType must be episode, series, game, team, awayTeam, or homeTeam"); } programAlert.setUser(user); Set<ProgramAlert> programAlerts = getUser().getLiveProgramAlerts(); if (programAlerts.size() >= getUser().getMaxEntries()) { setReturnMessage( "Sorry. You've exceeded your quota. Delete some old reminders or send us feedback if you think you need more."); log.fatal(getUsername() + " exceeded the maximum number of ProgramAlerts. maxEntries=" + getUser().getMaxEntries()); return INPUT; } for (ProgramAlert element : programAlerts) { if (element.equals(programAlert)) { setReturnMessage("A reminder already exists with these settings."); setReturnUrlExplicitely(getReturnUrl() + "&existingProgramAlertId=" + element.getId()); return INPUT; } } programAlerts.add(programAlert); programAlert.save(); // to guarantee the id is set, needed for the web displays StringBuilder sb = getCookieValue(); sb.append("|reminder="); sb.append(reminderType); sb.append("|programId="); sb.append(programId); sb.append("|sportName="); sb.append(sportName); sb.append("|teamName="); sb.append(teamName); queryLog.info(sb.toString()); AlertManager.getInstance().checkIfPending(programAlert); return SUCCESS; }
From source file:com.googlecode.ddom.frontend.saaj.impl.SwAProfile.java
@Override public String getContentType() { MimeType contentType;//from w ww .j ava 2 s . co m try { contentType = new MimeType("multipart", "related"); } catch (MimeTypeParseException ex) { throw new Error(ex); } contentType.setParameter("type", getSOAPVersion().getContentType()); contentType.setParameter("boundary", boundary); return contentType.toString(); }
From source file:fitnesse.slim.test.TestSlim.java
public void die() { throw new Error("blah"); }
From source file:TestModelBuilder.java
public void setAttributeValue(String name, String value) { if (name.equals("class") && value.equals("mammal")) setAnimalClass(MAMMAL);/*w w w .j a va 2s .c o m*/ else throw new Error("No such attribute: " + name); }
From source file:org.fcrepo.auth.xacml.XACMLAuthorizationDelegate.java
/** * Configures the delegate.// ww w. j a v a2s. c o m */ @PostConstruct public final void init() { pdp = pdpFactory.makePDP(); if (pdp == null) { throw new Error("There is no PDP wired by the factory in the Spring context."); } }
From source file:com.good.example.contributor.jhawkins.pathstore.PathStore.java
public Object toJSON() { if (obj != null) { JSONObject ret = new JSONObject(); Iterator<String> iterator = obj.keys(); while (iterator.hasNext()) { String key = iterator.next(); Object obji;//from w ww .j a va2 s . c o m try { obji = obj.get(key); if (obji.getClass() == PathStore.class) { ret.put(key, ((PathStore) obji).toJSON()); } else { ret.put(key, obji); } } catch (JSONException e) { throw new Error("Failure in PathStore.toJSON() obj:" + obj.toString() + ". " + e.toString()); } } return ret; } else if (arr != null) { JSONArray ret = new JSONArray(); for (int i = 0; i < arr.length(); i++) { try { Object obji = arr.get(i); if (obji.getClass() == PathStore.class) { ret.put(i, ((PathStore) obji).toJSON()); } else { ret.put(i, obji); } } catch (JSONException e) { throw new Error("Failure in PathStore.toJSON()arr:" + arr.toString() + ". " + e.toString()); } } return ret; } else { return null; } }
From source file:com.manydesigns.portofino.pageactions.crud.configuration.database.SelectionProviderReference.java
public void init(Table table) { if (displayModeName != null) { displayMode = DisplayMode.valueOf(displayModeName); } else {/*from ww w . j a v a 2 s .c om*/ displayMode = DisplayMode.DROPDOWN; } if (searchDisplayModeName != null) { searchDisplayMode = SearchDisplayMode.valueOf(searchDisplayModeName); } else { searchDisplayMode = SearchDisplayMode.DROPDOWN; } if (!StringUtils.isEmpty(foreignKeyName)) { foreignKey = DatabaseLogic.findForeignKeyByName(table, foreignKeyName); } else if (!StringUtils.isEmpty(selectionProviderName)) { selectionProvider = DatabaseLogic.findSelectionProviderByName(table, selectionProviderName); } else { throw new Error("foreignKey and selectionProvider are both null"); } }
From source file:nats.client.spring.NatsFactoryBean.java
@Override public Nats getObject() throws Exception { if (nats != null) { return nats; }//from w w w .j a va 2 s . c o m LOGGER.debug("Creating NATS client"); final NatsBuilder connector = new NatsBuilder(applicationEventPublisher); if (hostUris == null) { throw new IllegalStateException("At least one host URI must be provided."); } for (String uri : hostUris) { connector.addHost(uri); } connector.automaticReconnect(autoReconnect); if (connectionStateListener != null) { connector.addConnectionStateListener(connectionStateListener); } if (callbackExecutor != null) { connector.calllbackExecutor(callbackExecutor); } if (eventLoopGroup != null) { connector.eventLoopGroup(eventLoopGroup); } if (reconnectWaitTime >= 0) { connector.reconnectWaitTime(reconnectWaitTime, TimeUnit.MILLISECONDS); } nats = connector.connect(); for (SubscriptionConfig subscription : subscriptions) { final Object bean = subscription.getBean(); final Method method = bean.getClass().getMethod(subscription.getMethodName(), Message.class); nats.subscribe(subscription.getSubscription(), subscription.getQueueGroup()) .addMessageHandler(new MessageHandler() { @Override public void onMessage(Message message) { try { method.invoke(bean, message); } catch (IllegalAccessException e) { throw new Error(e); } catch (InvocationTargetException e) { throw new NatsException(e.getTargetException()); } } }); } return nats; }
From source file:io.servicecomb.swagger.generator.core.utils.ParamUtils.java
public static void setParameterType(Swagger swagger, Method method, int paramIdx, AbstractSerializableParameter<?> parameter) { Type paramType = ParamUtils.getGenericParameterType(method, paramIdx); ParamUtils.addDefinitions(swagger, paramType); Property property = ModelConverters.getInstance().readAsProperty(paramType); if (isComplexProperty(property)) { // ?????? String msg = String.format( "not allow complex type for %s parameter, method=%s:%s, paramIdx=%d, type=%s", parameter.getIn(), method.getDeclaringClass().getName(), method.getName(), paramIdx, paramType.getTypeName()); throw new Error(msg); }//from w ww . j a va 2 s .com parameter.setProperty(property); }
From source file:net.lightbody.bmp.proxy.jetty.xml.XmlParser.java
/** * Construct/*from ww w.j av a 2 s . co m*/ */ public XmlParser() { try { SAXParserFactory factory = SAXParserFactory.newInstance(); boolean notValidating = Boolean.getBoolean("net.lightbody.bmp.proxy.jetty.xml.XmlParser.NotValidating"); factory.setValidating(!notValidating); _parser = factory.newSAXParser(); try { if (!notValidating) _parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/schema", true); } catch (Exception e) { log.warn("Schema validation may not be supported"); log.debug("", e); notValidating = true; } _parser.getXMLReader().setFeature("http://xml.org/sax/features/validation", !notValidating); _parser.getXMLReader().setFeature("http://xml.org/sax/features/namespaces", !notValidating); _parser.getXMLReader().setFeature("http://xml.org/sax/features/namespace-prefixes", !notValidating); } catch (Exception e) { log.warn(LogSupport.EXCEPTION, e); throw new Error(e.toString()); } }