List of usage examples for org.apache.commons.lang3 StringUtils contains
public static boolean contains(final CharSequence seq, final CharSequence searchSeq)
Checks if CharSequence contains a search CharSequence, handling null .
From source file:com.virus.removal.javafxapplication.FXMLDocumentController.java
/** * @param event/*from w ww . ja v a2s. c om*/ */ @FXML private void pp(final ActionEvent event) { drop.setText("Portuguese"); /* Dashboard */ b2.setText("Painel "); b2.setTooltip(new Tooltip("Painel")); b2.setLayoutX(-10.0); b2.setLayoutY(109.0); d1.setText("Painel"); d2.setText("Verso: Adware & Ferramenta De Remoo da Barra de Ferramentas"); d3.setText("Demonstrao"); statusTextInDash.setText("Estado:"); lastScanTextInDash.setText("ltima anlise:"); buildTextInDash.setText("Construa:"); statusValInDash.setText("Potencialmente Desprotegido"); lastScanValInDash.setText("Por-favor faa uma anlise"); buildValInDash.setText("01.01.193"); scan.setText("Anlise agora"); scan.setTooltip(new Tooltip("Anlise agora")); /* Scan */ // b1.setText(" Anlise "); b1.setText("Anlise"); b1.setTooltip(new Tooltip("Anlise")); b1.setLayoutX(-38.0); b1.setLayoutY(167.0); /* Unprotected after scan is completed */ s1.setText("Potencialmente Desprotegido!"); s2.setText("O seu computador pode estar em risco, por-favor faa uma anlise."); s3.setText("Anlise de vrus"); s4.setText("Limpador do Adware"); s5.setText("Limpador da Barra de Ferramentas"); s6.setText("Demonstrao"); scan1.setText("Desatualizado"); scan2.setText("No verificado"); scan3.setText("No verificado"); /* Protected after scan is completed */ protect1.setText("Potencialmente Protegido!"); protect2.setText("O seu computador foi digitalizado e protegida."); protect3.setText("Anlise de vrus"); protect4.setText("Limpador do Adware"); protect5.setText("Limpador da Barra de Ferramentas"); protect6.setText("Demonstrao"); scan4.setText("Atualizado"); scan5.setText("Verificado"); scan6.setText("Verificado"); u.setText("Comear a anlise"); u.setTooltip(new Tooltip("Comear a anlise")); q.setText("Cancele Anlise"); /* History */ b3.setText("Histrico"); b3.setTooltip(new Tooltip("Histrico")); b3.setLayoutX(-33.0); b3.setLayoutY(228.0); textForLastScanInHistory.setText("ltima anlise: Por-favor faa uma anlise."); textForDemo.setText("Demonstrao"); clearHistory.setText("Histrico limpo"); clearHistory.setTooltip(new Tooltip("Histrico limpo")); if (StringUtils.isNotBlank(textAreaForHistory.getText()) && (StringUtils.contains(textAreaForHistory.getText(), HISTORY_UNAVAILABLE_IN_SPANISH) || StringUtils.contains(textAreaForHistory.getText(), HISTORY_UNAVAILABLE_IN_FRENCH) || StringUtils.contains(textAreaForHistory.getText(), HISTORY_UNAVAILABLE))) { textAreaForHistory.clear(); textAreaForHistory.setStyle("-fx-text-fill: #00AEEF;"); textAreaForHistory.setFont(Font.font("Verdana", FontWeight.EXTRA_BOLD, 12)); textAreaForHistory .appendText("\n\n\n\n\n\n\n\n\n\n\n "); textAreaForHistory.appendText(HISTORY_UNAVAILABLE_IN_PORTUGUESE); clearHistory.setDisable(true); } /* General Settings */ b5.setText(" Configuraes Gerais "); b5.setTooltip(new Tooltip("Configuraes Gerais")); b5.setLayoutX(6.0); b5.setLayoutY(27.0); g1.setText("Configuraes Gerais:"); g2.setText("Verso: Adware & Ferramenta De Remoo da Barra de Ferramentas"); g3.setText("Construa: 01.01.193"); g4.setText("Demonstrao"); w.setText("Aplique"); e.setText("Cancele"); if (StringUtils.isNotBlank(textAreaForGeneralSettings.getText())) { textAreaForGeneralSettings.clear(); } textAreaForGeneralSettings.setStyle("-fx-text-fill: #00AEEF;"); textAreaForGeneralSettings.setFont(Font.font("Verdana", FontWeight.EXTRA_BOLD, 12)); textAreaForGeneralSettings .appendText("\n\n\n\n\n\n\n\n\n\n\n "); textAreaForGeneralSettings.appendText(SETTINGS_UNAVAILABLE_IN_PORTUGUESE); /* Update */ b6.setText("Actualizaoe"); b6.setTooltip(new Tooltip("Actualizaoe")); b6.setLayoutX(-10.0); b6.setLayoutY(82.0); updateFound.setText("Actualizao(es) Encontrada(s):"); updateNow.setText("Actualize agora"); ignore.setText("Ignore"); demoInUpdate.setText("Demonstrao"); textAreaForUpdate.clear(); textAreaForUpdate.appendText("\n\n\n\n\n\n\n\n\n\n\n "); textAreaForUpdate.appendText(UPDATE_UNAVAILABLE_IN_PORTUGUESE); textAreaForUpdate.setFont(Font.font("Verdana", FontWeight.EXTRA_BOLD, 12)); textAreaForUpdate.setStyle("-fx-text-fill: #00AEEF;"); /* About */ b4.setText(" Sobre "); b4.setTooltip(new Tooltip("Sobre")); b4.setLayoutX(4.0); b4.setLayoutY(136.0); a1.setText("Sobre"); a2.setText("Verso: Adware & Ferramenta De Remoo da Barra de Ferramentas"); a3.setText("ID do aparelho: Demonstrao Verso"); a4.setText("Demonstrao"); t.setText("Ajuda"); y.setText("Registe-se"); /* Advanced Settings */ b7.setText("Configuraes Avanadas"); //b7.setTooltip(new Tooltip("Configuraes Avanadas")); b7.setLayoutX(1.0); b7.setLayoutY(292.0); txt.setText( "Um aspecto importante da tecnologia a sua acessibilidade e garantia, alm disso, que as coisas no vo dar errado, como tudo o que tem a ver com a indstria da tecnologia e do ecossistema que construiu, tem crescido fenomenalmente, tem assim a necessidade de uma melhor segurana, as interfaces mais fiveis e um desempenho ideal. Mantendo apenas isso em mente o tempo VirusREM ns viemos acima com o produto perfeito, que serve tanto para o mercado de massa de consumidores e os requisitos de nicho de empresas."); }
From source file:ch.cyberduck.ui.cocoa.InfoController.java
@Action public void filenameInputDidEndEditing(NSNotification sender) { if (this.numberOfFiles() == 1) { final Path current = getSelected(); if (!filenameField.stringValue().equals(current.getName())) { if (StringUtils.contains(filenameField.stringValue(), Path.DELIMITER)) { AppKitFunctionsLibrary.beep(); return; }/*from w w w . jav a 2 s.com*/ if (StringUtils.isBlank(filenameField.stringValue())) { filenameField.setStringValue(current.getName()); } else { final Path renamed = new Path(current.getParent(), filenameField.stringValue(), current.getType()); new MoveController(controller).rename(current, renamed); this.initWebUrl(); } } } }
From source file:com.virus.removal.javafxapplication.FXMLDocumentController.java
/** * @param textAreaForHistory// ww w.java2 s .c om */ public void writeVirusScanHistoryIntoFile(final TextArea textAreaForHistory) { try { final String userWorkingDrive = System.getProperty("user.dir").split(":")[0]; System.out.println(userWorkingDrive); final File file = new File(userWorkingDrive + ":" + File.separator + "VirusScanHistory" + File.separator + virusScanHistoryFile); file.getParentFile().mkdirs(); if (!file.exists()) { file.createNewFile(); } final FileWriter fw = new FileWriter(file.getAbsoluteFile()); final BufferedWriter bw = new BufferedWriter(fw); if (StringUtils.isNotBlank(textAreaForHistory.getText()) && !StringUtils.contains(textAreaForHistory.getText(), HISTORY_UNAVAILABLE) && !StringUtils.contains(textAreaForHistory.getText(), HISTORY_UNAVAILABLE_IN_SPANISH) && !StringUtils.contains(textAreaForHistory.getText(), HISTORY_UNAVAILABLE_IN_FRENCH) && !StringUtils.contains(textAreaForHistory.getText(), HISTORY_UNAVAILABLE_IN_PORTUGUESE)) { bw.write(textAreaForHistory.getText()); } else { bw.write(""); } bw.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:com.virus.removal.javafxapplication.FXMLDocumentController.java
/** * @return//from w w w . j a v a2 s .c o m */ public TextArea readVirusScanHistoryFromFile() { BufferedReader br = null; final TextArea textArea = new TextArea(); try { String currentLine; final String userWorkingDrive = System.getProperty("user.dir").split(":")[0]; System.out.println(userWorkingDrive); final File file = new File(userWorkingDrive + ":" + File.separator + "VirusScanHistory" + File.separator + virusScanHistoryFile); System.out.println(file.getParentFile().getAbsolutePath()); if (file.exists()) { br = new BufferedReader(new FileReader(file.getAbsolutePath())); while ((currentLine = br.readLine()) != null) { if (!currentLine.isEmpty()) { if (StringUtils.contains(currentLine, "PC Name:")) { textArea.appendText(currentLine + "\n\n\n\n"); } else { textArea.appendText(currentLine + "\n\n"); } } System.out.println(currentLine); } System.out.println(textArea.getText()); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null) { br.close(); } } catch (IOException ex) { ex.printStackTrace(); } } return textArea; }
From source file:com.sonicle.webtop.mail.Service.java
private SimpleMessage prepareMessage(JsMessage jsmsg, long msgId, boolean save, boolean isFax) throws Exception { PrivateEnvironment env = environment; UserProfile profile = env.getProfile(); //expand multiple addresses ArrayList<String> aemails = new ArrayList<>(); ArrayList<String> artypes = new ArrayList<>(); for (JsRecipient jsrcpt : jsmsg.recipients) { String emails[] = StringUtils.split(jsrcpt.email, ';'); for (String email : emails) { aemails.add(email);/*from www.j av a2s . co m*/ artypes.add(jsrcpt.rtype); } } String emails[] = new String[aemails.size()]; emails = (String[]) aemails.toArray(emails); String rtypes[] = new String[artypes.size()]; rtypes = (String[]) artypes.toArray(rtypes); //String replyfolder = request.getParameter("replyfolder"); //String inreplyto = request.getParameter("inreplyto"); //String references = request.getParameter("references"); //String forwardedfolder = request.getParameter("forwardedfolder"); //String forwardedfrom = request.getParameter("forwardedfrom"); //String subject = request.getParameter("subject"); //String mime = request.getParameter("mime"); //String sident = request.getParameter("identity"); //String content = request.getParameter("content"); //String msgid = request.getParameter("newmsgid"); //String ssave = request.getParameter("save"); //boolean save = (ssave != null && ssave.equals("true")); //String sreceipt = request.getParameter("receipt"); //boolean receipt = (sreceipt != null && sreceipt.equals("true")); //String spriority = request.getParameter("priority"); //boolean priority = (spriority != null && spriority.equals("true")); //boolean isFax = request.getParameter("fax") != null; String to = null; String cc = null; String bcc = null; for (int i = 0; i < emails.length; ++i) { //String email=decoder.decode(ByteBuffer.wrap(emails[i].getBytes())).toString(); String email = emails[i]; if (email == null || email.trim().length() == 0) { continue; } //Check for list boolean checkemail = true; boolean listdone = false; if (email.indexOf('@') < 0) { if (isFax && StringUtils.isNumeric(email)) { String faxpattern = getEnv().getCoreServiceSettings().getFaxPattern(); String faxemail = faxpattern.replace("{number}", email).replace("{username}", profile.getUserId()); email = faxemail; } } else { //check for list if one email with domain equals one allowed service id InternetAddress ia = null; try { ia = new InternetAddress(email); } catch (AddressException exc) { } if (ia != null) { String iamail = ia.getAddress(); String dom = iamail.substring(iamail.indexOf("@") + 1); CoreManager core = WT.getCoreManager(); if (environment.getSession().isServiceAllowed(dom)) { List<Recipient> rcpts = core.expandVirtualProviderRecipient(iamail); for (Recipient rcpt : rcpts) { String xemail = rcpt.getAddress(); String xpersonal = rcpt.getPersonal(); String xrtype = EnumUtils.toSerializedName(rcpt.getType()); if (xpersonal != null) xemail = xpersonal + " <" + xemail + ">"; try { checkEmail(xemail); InternetAddress.parse(xemail.replace(',', ' '), true); } catch (AddressException exc) { throw new AddressException( lookupResource(MailLocaleKey.ADDRESS_ERROR) + " : " + xemail); } if (rtypes[i].equals("to")) { if (xrtype.equals("to")) { if (to == null) to = xemail; else to += "; " + xemail; } else if (xrtype.equals("cc")) { if (cc == null) cc = xemail; else cc += "; " + xemail; } else if (xrtype.equals("bcc")) { if (bcc == null) bcc = xemail; else bcc += "; " + xemail; } } else if (rtypes[i].equals("cc")) { if (cc == null) cc = xemail; else cc += "; " + xemail; } else if (rtypes[i].equals("bcc")) { if (bcc == null) bcc = xemail; else bcc += "; " + xemail; } listdone = true; checkemail = false; } } } } if (listdone) { continue; } if (checkemail) { try { checkEmail(email); //InternetAddress.parse(email.replace(',', ' '), false); getInternetAddress(email); } catch (AddressException exc) { Service.logger.error("Exception", exc); throw new AddressException(lookupResource(MailLocaleKey.ADDRESS_ERROR) + " : " + email); } } if (rtypes[i].equals("to")) { if (to == null) { to = email; } else { to += "; " + email; } } else if (rtypes[i].equals("cc")) { if (cc == null) { cc = email; } else { cc += "; " + email; } } else if (rtypes[i].equals("bcc")) { if (bcc == null) { bcc = email; } else { bcc += "; " + email; } } } //long id = Long.parseLong(msgid); SimpleMessage msg = new SimpleMessage(msgId); /*int idx = jsmsg.identity - 1; Identity from = null; if (idx >= 0) { from = mprofile.getIdentity(idx); }*/ Identity from = mprofile.getIdentity(jsmsg.identityId); msg.setFrom(from); msg.setTo(to); msg.setCc(cc); msg.setBcc(bcc); msg.setSubject(jsmsg.subject); //TODO: fax coverpage - dismissed /*if (isFax) { String coverpage = request.getParameter("faxcover"); if (coverpage != null) { if (coverpage.equals("none")) { msg.addHeaderLine("X-FAX-AutoCoverPage: No"); } else { msg.addHeaderLine("X-FAX-AutoCoverPage: Yes"); msg.addHeaderLine("X-FAX-Cover-Template: " + coverpage); } } }*/ //TODO: custom headers keys /*String[] headersKeys = request.getParameterValues("headersKeys"); String[] headersValues = request.getParameterValues("headersValues"); if (headersKeys != null && headersValues != null && headersKeys.length == headersValues.length) { for (int i = 0; i < headersKeys.length; i++) { if (!headersKeys[i].equals("")) { msg.addHeaderLine(headersKeys[i] + ": " + headersValues[i]); } } }*/ if (jsmsg.inreplyto != null) { msg.setInReplyTo(jsmsg.inreplyto); } if (jsmsg.references != null) { msg.setReferences(new String[] { jsmsg.references }); } if (jsmsg.replyfolder != null) { msg.setReplyFolder(jsmsg.replyfolder); } if (jsmsg.forwardedfolder != null) { msg.setForwardedFolder(jsmsg.forwardedfolder); } if (jsmsg.forwardedfrom != null) { msg.setForwardedFrom(jsmsg.forwardedfrom); } msg.setReceipt(jsmsg.receipt); msg.setPriority(jsmsg.priority ? 1 : 3); if (jsmsg.format == null || jsmsg.format.equals("plain")) { msg.setContent(jsmsg.content); } else { if (jsmsg.format.equalsIgnoreCase("html")) { //TODO: change this weird matching of cids2urls! //CIDs String content = jsmsg.content; String pattern1 = RegexUtils .escapeRegexSpecialChars("service-request?csrf=" + getEnv().getCSRFToken() + "&service=" + SERVICE_ID + "&action=PreviewAttachment&nowriter=true&uploadId="); String pattern2 = RegexUtils.escapeRegexSpecialChars("&cid="); content = StringUtils.replacePattern(content, pattern1 + ".{39}" + pattern2, "cid:"); pattern1 = RegexUtils.escapeRegexSpecialChars("service-request?csrf=" + getEnv().getCSRFToken() + "&service=" + SERVICE_ID + "&action=PreviewAttachment&nowriter=true&uploadId="); pattern2 = RegexUtils.escapeRegexSpecialChars("&cid="); content = StringUtils.replacePattern(content, pattern1 + ".{39}" + pattern2, "cid:"); //URLs pattern1 = RegexUtils .escapeRegexSpecialChars("service-request?csrf=" + getEnv().getCSRFToken() + "&service=" + SERVICE_ID + "&action=PreviewAttachment&nowriter=true&uploadId="); pattern2 = RegexUtils.escapeRegexSpecialChars("&url="); content = StringUtils.replacePattern(content, pattern1 + ".{39}" + pattern2, ""); pattern1 = RegexUtils.escapeRegexSpecialChars("service-request?csrf=" + getEnv().getCSRFToken() + "&service=" + SERVICE_ID + "&action=PreviewAttachment&nowriter=true&uploadId="); pattern2 = RegexUtils.escapeRegexSpecialChars("&url="); content = StringUtils.replacePattern(content, pattern1 + ".{39}" + pattern2, ""); //My resources as cids? if (ss.isPublicResourceLinksAsInlineAttachments()) { ArrayList<JsAttachment> rescids = new ArrayList<>(); String match = "\"" + URIUtils.concat(getEnv().getCoreServiceSettings().getPublicBaseUrl(), ResourceRequest.URL); while (StringUtils.contains(content, match)) { pattern1 = RegexUtils.escapeRegexSpecialChars(match); Pattern pattern = Pattern.compile(pattern1 + "\\S*"); Matcher matcher = pattern.matcher(content); matcher.find(); String matched = matcher.group(); String url = matched.substring(1, matched.length() - 1); URI uri = new URI(url); // Retrieve macthed URL // and save it locally logger.debug("Downloading resource file as uploaded file from URL [{}]", url); HttpClient httpCli = null; try { httpCli = HttpClientUtils.createBasicHttpClient(HttpClientUtils.configureSSLAcceptAll(), uri); InputStream is = HttpClientUtils.getContent(httpCli, uri); String tag = "" + msgId; String filename = PathUtils.getFileName(uri.getPath()); UploadedFile ufile = addAsUploadedFile(tag, filename, ServletHelper.guessMediaType(filename), is); rescids.add(new JsAttachment(ufile.getUploadId(), filename, ufile.getUploadId(), true, ufile.getSize())); content = matcher.replaceFirst("\"cid:" + ufile.getUploadId() + "\""); } catch (IOException ex) { throw new WTException(ex, "Unable to retrieve webcal [{0}]", uri); } finally { HttpClientUtils.closeQuietly(httpCli); } } //add new resource cids as attachments if (rescids.size() > 0) { if (jsmsg.attachments == null) jsmsg.attachments = new ArrayList<>(); jsmsg.attachments.addAll(rescids); } } String textcontent = MailUtils.HtmlToText_convert(MailUtils.htmlunescapesource(content)); String htmlcontent = MailUtils.htmlescapefixsource(content).trim(); if (htmlcontent.length() < 6 || !htmlcontent.substring(0, 6).toLowerCase().equals("<html>")) { htmlcontent = "<html><header></header><body>" + htmlcontent + "</body></html>"; } msg.setContent(htmlcontent, textcontent, "text/html"); } else { msg.setContent(jsmsg.content, null, "text/" + jsmsg.format); } } return msg; }
From source file:net.zcarioca.jmx.services.impl.MBeanObjectServiceImpl.java
private MBeanServer getPlatformMBeanServer() { synchronized (mbeanServer) { if (mbeanServer == null) { // find the JBoss mbean server, if it exists Collection<MBeanServer> mbeanServers = MBeanServerFactory.findMBeanServer(null); if (mbeanServers != null) { if (mbeanServers.size() == 1) { return mbeanServers.iterator().next(); } else if (mbeanServers.size() > 1) { for (MBeanServer mbeanServer : mbeanServers) { String domain = mbeanServer.getDefaultDomain(); if (StringUtils.contains(domain, "jboss")) { return mbeanServer; }//w w w . j av a2 s . c om } } } mbeanServer = ManagementFactory.getPlatformMBeanServer(); } return mbeanServer; } }
From source file:nl.knaw.huygens.timbuctoo.tools.oaipmh.neww.WWOAIPMHTool.java
private static boolean isProduction(String oaiUrl) { return !StringUtils.contains(oaiUrl, "localhost:9998"); }
From source file:nl.sidn.pcap.decoder.ICMPDecoder.java
private boolean isClientRipeAtlas(byte[] packetData) { //return isClient(packetData,ECHO_CLIENT_ID_RIPE_ATLAS); byte[] echoBytes = ICMPv4Util.extractEchoRequestPayload(packetData); String echoStr = new String(echoBytes); //atlas probes have "http://atlas.ripe.net" in their echo bytes. //some probe type only have a substring of this url in the payload return StringUtils.contains(echoStr, ECHO_CLIENT_ID_RIPE_ATLAS); }
From source file:nl.sidn.pcap.decoder.ICMPDecoder.java
private boolean isClient(byte[] packetData, String id) { byte[] echoBytes = ICMPv4Util.extractEchoRequestPayload(packetData); String echoStr = new String(echoBytes); return StringUtils.contains(echoStr, id); }
From source file:nz.net.orcon.kanban.tools.ComplexDateConverter.java
protected boolean containsSymbol(String formula, String symbol) { return StringUtils.contains(formula, symbol); }