List of usage examples for java.lang ArrayIndexOutOfBoundsException getMessage
public String getMessage()
From source file:org.hansel.myAlert.LocationManagement.java
private void getLocation() { if (mLocationClient != null && mLocationClient.isConnected() && isBetterLocation(mLocationClient.getLastLocation(), mLocation)) { mLocation = mLocationClient.getLastLocation(); } else {/*w w w . j a v a2 s . c o m*/ mLocation = mLocationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER); } if (mLocation != null) { // escribe(mBestProvider+ " http://maps.google.com/?q="+mLocation.getLatitude()+"," // +mLocation.getLongitude()); Log.v("" + " http://maps.google.com/?q=" + mLocation.getLatitude() + "," + mLocation.getLongitude()); } else { try { Log.v("error tomando el GPS vamos a hacerlo por celdas "); String posicionCeldas = tMgr.getCellLocation().toString().replace("[", "").replace("]", ""); System.out.println(posicionCeldas); //09-14 12:14:37.599: I/System.out(1980): ....> [8,2703,8,19.4311,-99.16801] try { if (!posicionCeldas.equals("")) { // Vector<String> celdas = Util.splitVector(posicionCeldas, ","); //Latitud = Double.valueOf(celdas.get(3)); //longitud = Double.valueOf( celdas.get(4)); // escribe("Celdas: http://maps.google.com/?q="+Latitud+","+longitud); } } catch (ArrayIndexOutOfBoundsException a) { // TODO: handle exception System.out.println("No se encontro tampoco por las celdas -> " + a.getMessage()); } catch (Exception e) { Log.v("Error usando Celdas:" + e.getMessage()); } } catch (Exception ex) { Log.v("Error obteniendo celdas:" + ex.getMessage()); } } }
From source file:com.ibm.jaggr.core.impl.transport.RequestedModuleNames.java
@Override public List<String> getModules() throws BadRequestException { final String sourceMethod = "getModules"; //$NON-NLS-1$ if (isTraceLogging) { log.entering(RequestedModuleNames.class.getName(), sourceMethod); }/*w w w . ja v a 2 s.c om*/ if (modules == null) { String[] moduleArray = new String[count]; try { unfoldModules(decodeModules(moduleQueryArg), moduleArray); decodeModuleIds(moduleIdsQueryArg, moduleArray); } catch (ArrayIndexOutOfBoundsException ex) { throw new BadRequestException(ex.getMessage(), ex); } catch (JSONException ex) { throw new BadRequestException(ex); } catch (IOException ex) { throw new BadRequestException(ex); } // make sure no empty slots for (String mid : moduleArray) { if (mid == null) { throw new BadRequestException(); } } modules = Collections.unmodifiableList(Arrays.asList(moduleArray)); } if (isTraceLogging) { log.exiting(RequestedModuleNames.class.getName(), sourceMethod, modules); } return modules; }
From source file:org.apache.ambari.view.slider.rest.client.SliderAppMasterClient.java
public Map<String, Number[][]> getMetrics(String appName, String metricsUrl, Set<String> metricsRequested, TemporalInfo temporalInfo, ViewContext context, SliderAppType appType, MetricsHolder metricsHolder) { Map<String, Number[][]> retVal = new HashMap<String, Number[][]>(); if (appType == null || metricsHolder == null || metricsHolder.getTimelineMetrics() == null) { logger.info("AppType must be provided and it must contain " + "timeline_metrics.json to extract jmx properties"); return retVal; }/* www . java 2 s . c o m*/ Map<String, Number[][]> receivedMetrics = null; List<String> components = new ArrayList<String>(); for (SliderAppTypeComponent appTypeComponent : appType.getTypeComponents()) { components.add(appTypeComponent.getName()); } Map<String, Map<String, Map<String, Metric>>> metrics = metricsHolder.getTimelineMetrics(); Map<String, Metric> relevantMetrics = getRelevantMetrics(metrics, components); Set<String> metricsToRead = new HashSet<String>(); Map<String, String> reverseNameLookup = new HashMap<String, String>(); for (String key : relevantMetrics.keySet()) { if (metricsRequested.contains(key)) { String metricName = relevantMetrics.get(key).getMetric(); metricsToRead.add(metricName); reverseNameLookup.put(metricName, key); } } if (metricsToRead.size() != 0) { try { String specWithParams = SliderAppMetricsHelper.getUrlWithParams(appName, metricsUrl, metricsToRead, temporalInfo); logger.info("Using spec: " + specWithParams); if (specWithParams != null) { String spec = null; String params = null; String[] tokens = specWithParams.split("\\?", 2); try { spec = tokens[0]; params = tokens[1]; } catch (ArrayIndexOutOfBoundsException e) { logger.info(e.toString()); } receivedMetrics = SliderAppMetricsHelper.getMetrics(context, spec, params); } } catch (Exception e) { logger.warn("Unable to retrieve metrics. " + e.getMessage()); } } if (receivedMetrics != null) { for (Map.Entry<String, Number[][]> metric : receivedMetrics.entrySet()) { if (reverseNameLookup.containsKey(metric.getKey())) { retVal.put(reverseNameLookup.get(metric.getKey()), metric.getValue()); } } } return retVal; }
From source file:com.baxtern.android.websms.connector.exetel.ConnectorExetel.java
/** * Send some data! (ie. the SMS)//from w w w . j a va 2 s .c o m * * @param context * Context * @param command * ConnectorCommand * @throws WebSMSException * WebSMSException */ private void sendData(final Context context, final ConnectorCommand command) throws WebSMSException { try { // Get the preferences. final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); // The request url. Used for single or multiple receipients. String url = URL_SEND; // Create an array of GET data. ArrayList<BasicNameValuePair> data = new ArrayList<BasicNameValuePair>(); // Username. data.add(new BasicNameValuePair(PARAM_USERNAME, prefs.getString(Preferences.PREFS_USER, ""))); // Password. data.add(new BasicNameValuePair(PARAM_PASSWORD, prefs.getString(Preferences.PREFS_PASSWORD, ""))); // Destination/Recipients. // This code could validate the recipients so that they are numbers // of length maximum 15. data.add(new BasicNameValuePair(PARAM_TO, Utils.joinRecipientsNumbers(command.getRecipients(), RECIPIENTS_DELIMTER, true))); // Sender. final String customSender = command.getCustomSender(); // Default sender. if (customSender == null) { String sender = Utils.national2international(command.getDefPrefix(), Utils.getSender(context, command.getDefSender())); // Remove the + from the start of the sender's number. if (sender.charAt(0) == '+') { sender = sender.substring(1); } data.add(new BasicNameValuePair(PARAM_SENDER, sender)); } // A custom sender. else { String sender = customSender; // Remove the + from the start of the sender's number. if (sender.charAt(0) == '+') { sender = sender.substring(1); } data.add(new BasicNameValuePair(PARAM_SENDER, sender)); } // Message. data.add(new BasicNameValuePair(PARAM_TEXT, command.getText())); // Message type. data.add(new BasicNameValuePair(PARAM_TYPE, HTTP_MESSAGE_TYPE)); // Only if we have to make a GET request. if (!USE_POST) { // Create a string of the data for the url. StringBuilder data_string = new StringBuilder(); data_string.append("?"); for (int i = 0; i < data.size(); i++) { BasicNameValuePair nv = data.get(i); data_string.append(nv.getName()); data_string.append("="); data_string.append(URLEncoder.encode(nv.getValue(), HTTP_REQUEST_ENCODING)); data_string.append("&"); } // Add the data to the end of the url. url.concat(data_string.toString()); } // Log that we're making a Http request. Log.d(TAG, "HTTP REQUEST: " + url); // Do the Http request. HttpResponse response = Utils.getHttpClient(url, null, data, null, null, true); // Get the http response text and status code. int response_code = response.getStatusLine().getStatusCode(); String response_text = Utils.stream2str(response.getEntity().getContent()).trim(); // Log the http response. Log.d(TAG, "HTTP RESPONSE (" + Integer.toString(response_code) + "): " + response_text); // Time to inspect the results of all our hard work! String[] response_data = response_text.split(HTTP_RESPONSE_TEXT_DELIMITER); // Deal with the response data provided by the api. try { // Check that the status is okay. int status = Integer.parseInt(response_data[RETURN_PARAM_STATUS]); if (status != STATUS_SMS_SENT) { // Give the user the api's error message. throw new WebSMSException(response_data[RETURN_PARAM_NOTES]); } } catch (ArrayIndexOutOfBoundsException e) { throw new WebSMSException(context, R.string.error_exetel_invalid_return); } catch (NumberFormatException e) { throw new WebSMSException(context, R.string.error_exetel_invalid_return); } // Catch any annoying IO errors. } catch (IOException e) { Log.e(TAG, null, e); throw new WebSMSException(e.getMessage()); } }
From source file:org.apache.sling.discovery.base.connectors.ping.TopologyRequestValidator.java
/** * Check that the signature is a signature of the body hash. * * @param bodyHash the body hash./*from w ww . j av a 2 s .co m*/ * @param signature the signature. * @return true if the signature can be trusted. */ private boolean checkTrustHeader(String bodyHash, String signature) { try { if (bodyHash == null || signature == null) { return false; } String[] parts = signature.split("/", 2); int keyNo = Integer.parseInt(parts[0]); return hmac(keyNo, bodyHash).equals(parts[1]); } catch (ArrayIndexOutOfBoundsException e) { return false; } catch (IllegalArgumentException e) { return false; } catch (InvalidKeyException e) { throw new RuntimeException(e.getMessage(), e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage(), e); } catch (IllegalStateException e) { throw new RuntimeException(e.getMessage(), e); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e.getMessage(), e); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:org.ejbca.extra.ra.ScepRAServlet.java
private void service(String operation, String message, String remoteAddr, HttpServletResponse response) throws IOException { try {/*from w w w.j a va 2s. c om*/ if ((operation == null) || (message == null)) { log.error("Got request missing operation and/or message parameters."); response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Parameters 'operation' and 'message' must be supplied!"); return; } log.debug("Got request '" + operation + "'"); log.debug("Message: " + message); log.debug("Operation is : " + operation); String alias = scepraks.getAlias(); log.debug("SCEP RA Keystore alias : " + alias); KeyStore raks = scepraks.getKeyStore(); Certificate[] chain = raks.getCertificateChain(alias); X509Certificate cacert = null; if (chain.length > 1) { // This should absolutely be more than one! cacert = (X509Certificate) chain[1]; } else { log.error( "Certificate chain in RA keystore is only 1 certificate long! This is en error, because there should also be CA certificates."); } X509Certificate racert = (X509Certificate) raks.getCertificate(alias); String kspwd = ExtraConfiguration.instance() .getString(ExtraConfiguration.SCEPKEYSTOREPWD + keyStoreNumber); PrivateKey rapriv = (PrivateKey) raks.getKey(alias, kspwd.toCharArray()); if (operation.equals("PKIOperation")) { byte[] scepmsg = Base64.decode(message.getBytes()); // Read the message end get the cert, this also checks authorization boolean includeCACert = true; if (StringUtils.equals("0", getInitParameter("includeCACert"))) { includeCACert = false; } byte[] reply = null; ScepRequestMessage reqmsg = new ScepRequestMessage(scepmsg, includeCACert); String transId = reqmsg.getTransactionId(); log.debug("Received a message of type: " + reqmsg.getMessageType()); if (reqmsg.getMessageType() == ScepRequestMessage.SCEP_TYPE_GETCERTINITIAL) { log.info("Received a GetCertInitial message from host: " + remoteAddr); Message msg = null; try { msg = msgHome.findByMessageId(transId); } catch (Exception e) { // TODO: internal resources log.info("Error looking for message with transId " + transId + " :", e); } if (msg != null) { if (msg.getStatus().equals(Message.STATUS_PROCESSED)) { log.debug("Request is processed with status: " + msg.getStatus()); SubMessages submessagesresp = msg.getSubMessages(null, null, null); Iterator<ISubMessage> iter = submessagesresp.getSubMessages().iterator(); PKCS10Response resp = (PKCS10Response) iter.next(); // create proper ScepResponseMessage IResponseMessage ret = reqmsg.createResponseMessage( org.ejbca.core.protocol.scep.ScepResponseMessage.class, reqmsg, racert, rapriv, cryptProvider); ret.setCACert(cacert); X509Certificate respCert = resp.getCertificate(); if (resp.isSuccessful() && (respCert != null)) { ret.setCertificate(respCert); } else { ret.setStatus(ResponseStatus.FAILURE); ret.setFailInfo(FailInfo.BAD_REQUEST); String failText = resp.getFailInfo(); ret.setFailText(failText); } ret.create(); reply = ret.getResponseMessage(); } else { log.debug("Request is not yet processed, status: " + msg.getStatus()); reply = createPendingResponseMessage(reqmsg, racert, rapriv, cryptProvider) .getResponseMessage(); log.debug("Responding with pending response, still pending."); } } else { // User doesn't exist } } else { if (reqmsg.getMessageType() == ScepRequestMessage.SCEP_TYPE_PKCSREQ) { log.debug("Received a PKCSReq message from host: " + remoteAddr); // Decrypt the Scep message and extract the pkcs10 request if (reqmsg.requireKeyInfo()) { // scep encrypts message with the RAs certificate reqmsg.setKeyInfo(racert, rapriv, cryptProvider); } // Verify the request if (reqmsg.verify() == false) { String msg = "POPO verification failed."; log.error(msg); throw new SignRequestSignatureException(msg); } String username = reqmsg.getUsername(); if (username == null) { String msg = "No username in request, request DN: " + reqmsg.getRequestDN(); log.error(msg); throw new SignRequestException(msg); } log.info("Received a SCEP/PKCS10 request for user: " + username + ", from host: " + remoteAddr); String authPwd = ExtraConfiguration.instance().getString(ExtraConfiguration.SCEPAUTHPWD); if (StringUtils.isNotEmpty(authPwd) && !StringUtils.equals(authPwd, "none")) { log.debug("Requiring authPwd in order to precess SCEP requests"); String pwd = reqmsg.getPassword(); if (!StringUtils.equals(authPwd, pwd)) { log.error("Wrong auth password received in SCEP request: " + pwd); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Auth pwd missmatch"); return; } log.debug("Request passed authPwd test."); } else { log.debug("Not requiring authPwd in order to precess SCEP requests"); } // Try to find the CA name from the issuerDN, if we can't find it (i.e. not defined in web.xml) we use the default String issuerDN = CertTools.stringToBCDNString(reqmsg.getIssuerDN()); String caName = ExtraConfiguration.instance().getString(issuerDN); if (StringUtils.isEmpty(caName)) { caName = ExtraConfiguration.instance().getString(ExtraConfiguration.SCEPDEFAULTCA); log.info("Did not find a CA name from issuerDN: " + issuerDN + ", using the default CA '" + caName + "'"); } else { log.debug("Found a CA name '" + caName + "' from issuerDN: " + issuerDN); } // Get altNames if we can find them String altNames = reqmsg.getRequestAltNames(); byte[] encoded = reqmsg.getCertificationRequest().getEncoded(); String pkcs10 = new String(Base64.encode(encoded, false)); // Create a pkcs10 request String certificateProfile = ExtraConfiguration.instance() .getString(ExtraConfiguration.SCEPCERTPROFILEKEY); String entityProfile = ExtraConfiguration.instance() .getString(ExtraConfiguration.SCEPENTITYPROFILEKEY); boolean createOrEditUser = ExtraConfiguration.instance() .getBoolean(ExtraConfiguration.SCEPEDITUSER); PKCS10Request req = new PKCS10Request(100, username, reqmsg.getRequestDN(), altNames, null, null, entityProfile, certificateProfile, caName, pkcs10); req.setCreateOrEditUser(createOrEditUser); SubMessages submessages = new SubMessages(); submessages.addSubMessage(req); msgHome.create(transId, submessages); reply = createPendingResponseMessage(reqmsg, racert, rapriv, cryptProvider) .getResponseMessage(); } } if (reply == null) { // This is probably a getCert message? log.debug("Sending HttpServletResponse.SC_NOT_IMPLEMENTED (501) response"); response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, "Can not handle request"); return; } // Send back SCEP response, PKCS#7 which contains the end entity's certificate, or pending, or failure sendBinaryBytes(reply, response, "application/x-pki-message", null); } else if (operation.equals("GetCACert")) { // The response has the content type tagged as application/x-x509-ca-cert. // The body of the response is a DER encoded binary X.509 certificate. // For example: "Content-Type:application/x-x509-ca-cert\n\n"<BER-encoded X509> // IF we are not an RA, which in case we should return the same thing as GetCACertChain log.info("Got SCEP cert request for CA '" + message + "'"); if (chain != null) { if (chain.length > 1) { // We are an RA, so return the same as GetCACertChain, but with other content type getCACertChain(message, remoteAddr, response, alias, raks, false); } else { // The CA certificate is no 0 X509Certificate cert = (X509Certificate) chain[0]; if (chain.length > 1) { cert = (X509Certificate) chain[1]; } log.debug("Found cert with DN '" + cert.getSubjectDN().toString() + "'"); log.info("Sent certificate for CA '" + message + "' to SCEP client with ip " + remoteAddr); sendBinaryBytes(cert.getEncoded(), response, "application/x-x509-ca-cert", null); } } else { log.error("No CA certificates found"); response.sendError(HttpServletResponse.SC_NOT_FOUND, "No CA certificates found."); } } else if (operation.equals("GetCACertChain")) { // The response for GetCACertChain is a certificates-only PKCS#7 // SignedDatato carry the certificates to the end entity, with a // Content-Type of application/x-x509-ca-ra-cert-chain. log.info("Got SCEP cert chain request for CA '" + message + "'"); getCACertChain(message, remoteAddr, response, alias, raks, true); } else if (operation.equals("GetCACaps")) { // The response for GetCACaps is a <lf> separated list of capabilities /* "GetNextCACert" CA Supports the GetNextCACert message. "POSTPKIOperation" PKIOPeration messages may be sent via HTTP POST. "SHA-1" CA Supports the SHA-1 hashing algorithm in signatures and fingerprints. If present, the client SHOULD use SHA-1. If absent, the client MUST use MD5 to maintain backward compatability. "Renewal" Clients may use current certificate and key to authenticate an enrollment request for a new certificate. */ log.info("Got SCEP CACaps request for CA '" + message + "'"); response.setContentType("text/plain"); response.getOutputStream().print("POSTPKIOperation\nSHA-1"); } } catch (java.lang.ArrayIndexOutOfBoundsException ae) { log.error("Empty or invalid request received.", ae); // TODO: Send back proper Failure Response response.sendError(HttpServletResponse.SC_BAD_REQUEST, ae.getMessage()); } catch (Exception e) { log.error("Error in ScepRAServlet:", e); // TODO: Send back proper Failure Response response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); } }
From source file:org.apache.carbondata.spark.partition.api.impl.CSVFilePartitioner.java
private long writeTargetStream(HashMap<Partition, CSVWriter> outputStreamsMap, CSVReader dataInputStream, long recordCounter, int[] indexes, DataPartitioner dataPartitioner, String[] headerColumns, String fileAbsolutePath) throws IOException { String[] record = null;// w w w.j a v a2 s . c o m Partition tartgetPartition = null; CSVWriter targetStream = null; record = dataInputStream.readNext(); int skippedLines = 0; if (null == record) { return recordCounter; } else { boolean isEqual = compareHeaderColumnWithFirstRecordInCSV(headerColumns, record); if (isEqual) { record = dataInputStream.readNext(); recordCounter++; } } while (null != record) { tartgetPartition = dataPartitioner.getPartionForTuple(record, recordCounter); targetStream = outputStreamsMap.get(tartgetPartition); try { targetStream.writeNext(pruneColumns(record, indexes)); } catch (ArrayIndexOutOfBoundsException e) { partialSuccess = true; skippedLines++; badRecordslogger.addBadRecordsToBilder(record, record.length, "No. of columns not matched with table columns", null); LOGGER.error("BAD Record Found: No. of columns not matched with table columns, " + "Skipping line: (" + (recordCounter + 1) + ") in File :" + fileAbsolutePath); } catch (Exception e) { partialSuccess = true; skippedLines++; badRecordslogger.addBadRecordsToBilder(record, record.length, e.getMessage(), null); LOGGER.info("Exception while processing the record at line " + (recordCounter + 1) + " in partiton " + tartgetPartition.getUniqueID()); } finally { record = dataInputStream.readNext(); recordCounter++; } } if (skippedLines != 0) { LOGGER.info("No. of bad records skipped: (" + skippedLines + ") in file:" + fileAbsolutePath); } return recordCounter; }
From source file:org.carbondata.integration.spark.partition.api.impl.CSVFilePartitioner.java
private long writeTargetStream(HashMap<Partition, CSVWriter> outputStreamsMap, CSVReader dataInputStream, long recordCounter, int[] indexes, DataPartitioner dataPartitioner, String[] headerColumns, String fileAbsolutePath) throws IOException { String[] record = null;/* ww w . j a v a 2 s.c om*/ Partition tartgetPartition = null; CSVWriter targetStream = null; record = dataInputStream.readNext(); int skippedLines = 0; if (null == record) { return recordCounter; } else { boolean isEqual = compareHeaderColumnWithFirstRecordInCSV(headerColumns, record); if (isEqual) { record = dataInputStream.readNext(); recordCounter++; } } while (null != record) { tartgetPartition = dataPartitioner.getPartionForTuple(record, recordCounter); targetStream = outputStreamsMap.get(tartgetPartition); try { targetStream.writeNext(pruneColumns(record, indexes)); } catch (ArrayIndexOutOfBoundsException e) { partialSuccess = true; skippedLines++; badRecordslogger.addBadRecordsToBilder(record, record.length, "No. of columns not matched with cube columns", null); LOGGER.error("BAD Record Found: No. of columns not matched with cube columns, " + "Skipping line: (" + (recordCounter + 1) + ") in File :" + fileAbsolutePath); } catch (Exception e) { partialSuccess = true; skippedLines++; badRecordslogger.addBadRecordsToBilder(record, record.length, e.getMessage(), null); LOGGER.info("Exception while processing the record at line " + (recordCounter + 1) + " in partiton " + tartgetPartition.getUniqueID()); } finally { record = dataInputStream.readNext(); recordCounter++; } } if (skippedLines != 0) { LOGGER.info("No. of bad records skipped: (" + skippedLines + ") in file:" + fileAbsolutePath); } return recordCounter; }
From source file:org.graphwalker.GUI.App.java
@SuppressWarnings("synthetic-access") private void loadModel() { setWaitCursor();// w ww .jav a 2 s.com if (executeMBT != null) { executeMBT.cancel(true); } logger.debug("Loading model"); status.unsetState(Status.stopped); status.setState(Status.paused); statusBar.setMessage("Paused"); try { if (soapButton.isSelected()) { mbt = Util.loadMbtAsWSFromXml(Util.getFile(xmlFile.getAbsolutePath())); mbt.setUseGUI(); soapService.mbt = mbt; } else { mbt = Util.loadMbtFromXml(Util.getFile(xmlFile.getAbsolutePath())); } setTitle(title + " - " + xmlFile.getName()); } catch (ArrayIndexOutOfBoundsException e) { logger.warn(e.getMessage()); JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); reset(); return; } catch (StopConditionException e) { logger.warn(e.getMessage()); JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); reset(); return; } catch (GeneratorException e) { logger.warn(e.getMessage()); JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); reset(); return; } catch (JDOMException e) { logger.warn(e.getMessage()); JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); reset(); return; } catch (FileNotFoundException e) { logger.warn(e.getMessage()); JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); reset(); return; } catch (IOException e) { logger.warn(e.getMessage()); JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); reset(); return; } catch (RuntimeException e) { logger.warn(e.getMessage()); JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); reset(); return; } catch (Exception e) { Util.logStackTraceToError(e); JOptionPane.showMessageDialog(App.getInstance(), e.getMessage()); reset(); return; } mbt.setUseGUI(); centerOnVertex(); updateLayout(); if (!soapButton.isSelected()) { if (executeMBT != null) { executeMBT = null; } (executeMBT = new ExecuteMBT()).execute(); } setButtons(); setDefaultCursor(); }
From source file:org.graphwalker.CLI.java
private void run(String[] args) { if (args.length < 1) { System.err.println("Type 'java -jar graphwalker.jar help' for usage."); return;/*from ww w . j a v a2 s . c om*/ } else { if (args[0].equals("help")) { if (args.length == 1) { printGeneralHelpText(); } else { printHelpText(args[1]); } return; } else if (args[0].equalsIgnoreCase("requirements")) { buildRequirementsCLI(); } else if (args[0].equalsIgnoreCase("online")) { buildOnlineCLI(); } else if (args[0].equalsIgnoreCase("offline")) { buildOfflineCLI(); } else if (args[0].equalsIgnoreCase("methods")) { buildMethodsCLI(); } else if (args[0].equalsIgnoreCase("merge")) { buildMergeCLI(); } else if (args[0].equalsIgnoreCase("source")) { buildSourceCLI(); } else if (args[0].equalsIgnoreCase("manual")) { buildManualCLI(); } else if (args[0].equalsIgnoreCase("xml")) { buildXmlCLI(); } else if (args[0].equalsIgnoreCase("soap")) { buildSoapCLI(); } else if (args[0].equalsIgnoreCase("analyze")) { buildAnalyzeCLI(); } else if (args[0].equals("-v") || args[0].equals("--version")) { printVersionInformation(); return; } else if (args[0].equals("-h") || args[0].equals("--help")) { printGeneralHelpText(); return; } else { System.err.println("Unkown command: " + args[0]); System.err.println("Type 'java -jar graphwalker.jar help' for usage."); return; } } try { timer = new Timer(); CommandLineParser parser = new PosixParser(); CommandLine cl = parser.parse(opt, args); /** * Command: requirements */ if (args[0].equalsIgnoreCase("requirements")) { RunCommandRequirements(cl); } /** * Command: online */ if (args[0].equalsIgnoreCase("online")) { setStatisticsLogger(this); RunCommandOnline(cl); } /** * Command: offline */ else if (args[0].equalsIgnoreCase("offline")) { setStatisticsLogger(this); RunCommandOffline(cl); } /** * Command: methods */ else if (args[0].equalsIgnoreCase("methods")) { RunCommandMethods(cl); } /** * Command: merge */ else if (args[0].equalsIgnoreCase("merge")) { RunCommandMerge(cl); } /** * Command: source */ else if (args[0].equalsIgnoreCase("source")) { RunCommandSource(cl); } /** * Command: xml */ else if (args[0].equalsIgnoreCase("xml")) { setStatisticsLogger(this); RunCommandXml(cl); } /** * Command: soap */ else if (args[0].equalsIgnoreCase("soap")) { setStatisticsLogger(this); RunCommandSoap(cl); } /** * Command: analyze */ else if (args[0].equalsIgnoreCase("analyze")) { RunCommandAnalyze(cl); } /** * Command: manual */ else if (args[0].equalsIgnoreCase("manual")) { setStatisticsLogger(this); RunCommandManual(cl); } } catch (ArrayIndexOutOfBoundsException e) { logger.warn(e.getMessage()); System.err.println("The arguments for either the generator, or the stop-condition, is incorrect."); System.err.println( "Example: java -jar graphwalker.jar offline -f ../demo/model/UC01.graphml -s EDGE_COVERAGE:100 -g A_STAR"); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (MissingOptionException e) { logger.warn(e.getMessage()); System.err.println("Mandatory option(s) are missing."); System.err.println(e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (MissingArgumentException e) { logger.warn(e.getMessage()); System.err.println("Argument is required to the option."); System.err.println(e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (UnrecognizedOptionException e) { logger.warn(e.getMessage()); System.err.println(e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (StopConditionException e) { logger.warn(e.getMessage()); System.err.println(e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (GeneratorException e) { logger.warn(e.getMessage()); System.err.println(e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (JDOMException e) { Util.logStackTraceToError(e); System.err.println("Can not access file: " + e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (FileNotFoundException e) { Util.logStackTraceToError(e); System.err.println("Can not access file: " + e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (IOException e) { Util.logStackTraceToError(e); System.err.println(e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } catch (Exception e) { Util.logStackTraceToError(e); System.err.println(e.getMessage()); System.err.println("Type 'java -jar graphwalker.jar help " + args[0] + "' for help."); } finally { timer.cancel(); } }