Advertisement
Guest User

Untitled

a guest
Aug 31st, 2017
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.65 KB | None | 0 0
  1. package main.java.beans;
  2.  
  3. import main.java.tools.SessionUtils;
  4.  
  5. import javax.annotation.PostConstruct;
  6. import javax.faces.application.FacesMessage;
  7. import javax.faces.bean.ManagedBean;
  8. import javax.faces.bean.SessionScoped;
  9. import javax.faces.context.FacesContext;
  10. import javax.servlet.http.HttpSession;
  11. import java.io.Serializable;
  12.  
  13. @ManagedBean(name = "Login", eager = true)
  14. @SessionScoped
  15. public class LoginBean implements Serializable {
  16.  
  17. private static final long serialVersionUID = 1094801825228386363L;
  18.  
  19. private String pwd;
  20. private String msg;
  21. private String user;
  22.  
  23. @PostConstruct
  24. public synchronized void init() {
  25. System.out.println("LoginBean INIT....");
  26. ConfigBean configBean = new ConfigBean();
  27. configBean.loadConfigFromFile(configBean.configFile);
  28. }
  29.  
  30.  
  31.  
  32. /**
  33. *
  34. * @param user the user
  35. * @param pwd the pw
  36. * @return bool
  37. */
  38. private synchronized boolean validateHardcoded(String user, String pwd) {
  39. ConfigBean configBean = new ConfigBean();
  40. return user.matches(configBean.getUser()) && pwd.matches(configBean.getPassword());
  41. }
  42.  
  43. //validate login
  44. public synchronized String validateUsernamePassword() {
  45. boolean valid = validateHardcoded(user, pwd);
  46.  
  47. if (valid) {
  48. HttpSession session = SessionUtils.getSession();
  49. session.setAttribute("username", user);
  50. return "gui";
  51. } else {
  52. FacesContext.getCurrentInstance().addMessage(
  53. null,
  54. new FacesMessage(FacesMessage.SEVERITY_WARN,
  55. "Incorrect Username and Passowrd",
  56. "Please enter correct username and Password"));
  57. return "index";
  58. }
  59. }
  60.  
  61. //logout event, invalidate session
  62. public String logout() {
  63. HttpSession session = SessionUtils.getSession();
  64. session.invalidate();
  65. return "index";
  66. }
  67.  
  68. public String getPwd() {
  69. return pwd;
  70. }
  71.  
  72. public void setPwd(String pwd) {
  73. this.pwd = pwd;
  74. }
  75.  
  76. public String getMsg() {
  77. return msg;
  78. }
  79.  
  80. public void setMsg(String msg) {
  81. this.msg = msg;
  82. }
  83.  
  84. public String getUser() {
  85. return user;
  86. }
  87.  
  88. public void setUser(String user) {
  89. this.user = user;
  90. }
  91. }
  92.  
  93. package main.java.beans;
  94.  
  95. import main.java.jobs.ApplicationRunnable;
  96. import main.java.model.Feed;
  97. import main.java.tools.Emailer;
  98. import org.primefaces.push.annotation.Singleton;
  99. import org.quartz.*;
  100. import org.quartz.impl.StdSchedulerFactory;
  101.  
  102. import javax.annotation.PostConstruct;
  103. import javax.annotation.PreDestroy;
  104. import javax.faces.bean.ApplicationScoped;
  105. import javax.faces.bean.ManagedBean;
  106. import java.io.*;
  107. import java.util.*;
  108.  
  109. @Singleton
  110. @ManagedBean(name = "ConfigBean") //, eager = true
  111. @ApplicationScoped
  112. public class ConfigBean {
  113.  
  114. public volatile long allXSeconds = 60; /* aggregates / searches / sends out all x seconds */
  115.  
  116. /* email Config */
  117. public volatile String smtpHost;
  118. public volatile String smtpUser;
  119. public volatile String smtpPw;
  120. public volatile int smtpPort;
  121. public volatile String senderMail;
  122.  
  123. public String serializationFile = "C:\\Users\JARE\Desktop\anderesZeug\feedLog.txt";
  124. public volatile String configFile = "C:\\Users\JARE\Desktop\anderesZeug\config.properties";
  125.  
  126. /* login config */
  127. public volatile String user;
  128. public volatile String password;
  129.  
  130. /* runtime fields */
  131. public volatile boolean runOnce = false;
  132. public volatile boolean running = true;
  133.  
  134. public final List<Feed> sentNotifications = new ArrayList<>();
  135. public final List<String> emails = new ArrayList<>();
  136. public final List<String> words = new LinkedList<>();
  137. public final List<String> feeds = new LinkedList<>();
  138.  
  139. /* fields to add to emails, words, feeds from gui.xhtml */
  140. private volatile String currentEmail;
  141. private volatile String currentFeed;
  142. private volatile String currentWord;
  143.  
  144. Scheduler scheduler;
  145.  
  146. @PostConstruct
  147. public synchronized void init() {
  148.  
  149. loadConfigFromFile(configFile);
  150.  
  151. try {
  152. sentNotifications.addAll(readFeedsFromFile(serializationFile));
  153. System.out.println("SENT SIZE: " + sentNotifications.size());
  154. } catch (IOException e) {
  155. e.printStackTrace();
  156. }
  157.  
  158. System.out.println("Scheduling.... ");
  159.  
  160. /* QUARTZ job scheduling */
  161. JobDetail job = JobBuilder.newJob(ApplicationRunnable.class)
  162. .withIdentity("ParseJob", "ServerJobs").build();
  163.  
  164. // Trigger the job to run on the next round minute
  165. Trigger trigger = TriggerBuilder
  166. .newTrigger()
  167. .withIdentity("ParseJobTrigger", "ServerJobs")
  168. .withSchedule(
  169. SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds((int) allXSeconds).repeatForever()
  170. ).build();
  171.  
  172. try {
  173. scheduler = new StdSchedulerFactory().getScheduler();
  174. scheduler.start();
  175. scheduler.scheduleJob(job, trigger);
  176. } catch (SchedulerException e) {
  177. e.printStackTrace();
  178. }
  179.  
  180. }
  181.  
  182. @PreDestroy
  183. public synchronized void destroy() {
  184. saveConfigToFile(configFile); //TODO
  185.  
  186. try {
  187. scheduler.shutdown();
  188. } catch (SchedulerException e) {
  189. e.printStackTrace();
  190. }
  191. }
  192.  
  193. /* Facelet methods */
  194. public synchronized void sendOldFeeds() {
  195. sendOldFeeds(currentEmail);
  196. }
  197.  
  198. public synchronized void addEmail() {
  199. emails.add(currentEmail);
  200. }
  201.  
  202. public synchronized void rmEmail(String email) {
  203. emails.remove(email);
  204. }
  205.  
  206. public synchronized void addWord() {
  207. words.add(currentWord);
  208. }
  209.  
  210. public synchronized void rmWord(String word) {
  211. words.remove(word);
  212. }
  213.  
  214. public synchronized void addFeed() {
  215. feeds.add(currentFeed);
  216. }
  217.  
  218. public synchronized void rmFeed(String feed) {
  219. feeds.remove(feed);
  220. }
  221.  
  222. public synchronized void runItOnce() {
  223. runOnce = true;
  224. }
  225.  
  226. public synchronized void startStop() {
  227. running = !running;
  228. }
  229.  
  230. public synchronized void updateFreq() {
  231. }
  232.  
  233. /* logic methods */
  234.  
  235. /**
  236. * Load the Config from the config.properties File
  237. *
  238. * @param path ... path to the config-file
  239. */
  240. public synchronized void loadConfigFromFile(String path) {
  241. System.out.println("Loading Config....: ");
  242.  
  243. Properties prop = new Properties();
  244. InputStream input = null;
  245.  
  246. try {
  247.  
  248. //input = new FileInputStream("config.properties");
  249. input = new FileInputStream(path);
  250.  
  251. // load a properties file
  252. prop.load(input);
  253.  
  254. // .... saved like this:
  255. // emails: abc@test.com, bbc@aab.com, .....
  256. String wordsS = prop.getProperty("keywords");
  257. String emailS = prop.getProperty("emails");
  258. String feedS = prop.getProperty("feeds");
  259.  
  260. emails.addAll(Arrays.asList(emailS.split(",")));
  261. words.addAll(Arrays.asList(wordsS.split(",")));
  262. feeds.addAll(Arrays.asList(feedS.split(",")));
  263. allXSeconds = Long.valueOf(prop.getProperty("frequency"));
  264. serializationFile = prop.getProperty("serializationFile");
  265. configFile = prop.getProperty("configFile");
  266. smtpHost = prop.getProperty("smtpHost");
  267. smtpUser = prop.getProperty("smtpUser");
  268. smtpPw = prop.getProperty("smtpPw");
  269. smtpPort = Integer.valueOf(prop.getProperty("smtpPort"));
  270. senderMail = prop.getProperty("senderMail");
  271. user = prop.getProperty("loginUser");
  272. password = prop.getProperty("loginPw");
  273.  
  274. System.out.println("config..:" + emails);
  275. System.out.println("config..:" + words);
  276. System.out.println("config..:" + feeds);
  277. System.out.println("config..:" + allXSeconds);
  278. System.out.println("config..:" + serializationFile);
  279. System.out.println("config..:" + configFile);
  280. System.out.println("config..:" + smtpHost);
  281. System.out.println("config..:" + smtpUser);
  282. System.out.println("config..:" + smtpPw);
  283. System.out.println("config..:" + senderMail);
  284.  
  285. } catch (IOException ex) {
  286. ex.printStackTrace();
  287. } finally {
  288. if (input != null) {
  289. try {
  290. input.close();
  291. } catch (IOException e) {
  292. e.printStackTrace();
  293. }
  294. }
  295. }
  296. }
  297.  
  298. /**
  299. * Save the config (emails, words, feeds, frequency) to a properties file
  300. *
  301. * @param path ... path to configfile
  302. */
  303. public synchronized void saveConfigToFile(String path) {
  304. System.out.println("Saving Config.... ");
  305.  
  306. Properties prop = new Properties();
  307. OutputStream output = null;
  308.  
  309. try {
  310.  
  311. //output = new FileOutputStream("config.properties");
  312. output = new FileOutputStream(path);
  313.  
  314. String feedsS = feeds.toString();
  315. String emailsS = emails.toString();
  316. String wordS = words.toString();
  317.  
  318. // set the properties value
  319. List<Object> allConfs = new LinkedList<>();
  320. allConfs.add(emailsS);
  321. allConfs.add(feedsS);
  322. allConfs.add(wordS);
  323. allConfs.add(allXSeconds);
  324. allConfs.add(serializationFile);
  325. allConfs.add(configFile);
  326. allConfs.add(smtpHost);
  327. allConfs.add(smtpPw);
  328. allConfs.add(smtpUser);
  329. allConfs.add(smtpPort);
  330. allConfs.add(senderMail);
  331. allConfs.add(user);
  332. allConfs.add(password);
  333.  
  334. if (!isNull(allConfs)) {
  335. prop.setProperty("emails", emailsS.substring(1, emailsS.length() - 1));
  336. prop.setProperty("keywords", wordS.substring(1, wordS.length() - 1));
  337. prop.setProperty("feeds", feedsS.substring(1, feedsS.length() - 1));
  338. prop.setProperty("frequency", String.valueOf(getAllXSeconds()));
  339. prop.setProperty("serializationFile", serializationFile);
  340. prop.setProperty("configFile", configFile);
  341. prop.setProperty("smtpHost", smtpHost);
  342. prop.setProperty("smtpUser", smtpUser);
  343. prop.setProperty("smtpPw", smtpPw);
  344. prop.setProperty("smtpPort", String.valueOf(smtpPort));
  345. prop.setProperty("senderMail", senderMail);
  346. prop.setProperty("user", user);
  347. prop.setProperty("password", password);
  348.  
  349. // save properties to project root folder
  350. prop.store(output, null);
  351. } else {
  352. System.out.println("Config.properties wasn't serialized because something was null");
  353. }
  354.  
  355. } catch (IOException io) {
  356. io.printStackTrace();
  357. } finally {
  358. if (output != null) {
  359. try {
  360. output.close();
  361. } catch (IOException e) {
  362. e.printStackTrace();
  363. }
  364. }
  365.  
  366. }
  367. }
  368.  
  369. /**
  370. * writes/serializes the feeds in sentNotifications into file
  371. *
  372. * @param feeds ...LinkedList<Feed> the linked list of feeds to be serialized
  373. * @param filePath ... path to the file used for storage
  374. * @throws IOException ... e.g. file not found or corrupted or whatever
  375. */
  376. public synchronized void writeFeedsIntoFile(List<Feed> feeds, String filePath) throws IOException {
  377.  
  378. System.out.println("Writing feeds to file.... ");
  379.  
  380. ObjectOutputStream oos = null;
  381. FileOutputStream fout;
  382. try {
  383. fout = new FileOutputStream(filePath, true);
  384. oos = new ObjectOutputStream(fout);
  385. oos.writeObject(feeds);
  386. oos.write(null); //TODO i hope this solves the EOF Exception..?
  387. } catch (EOFException ex) {
  388. ex.printStackTrace();
  389. System.out.println("Configbean: writeFeedsIntoFile threw a Exception");
  390. } finally {
  391. if (oos != null) {
  392. oos.close();
  393. }
  394. }
  395. }
  396.  
  397. /**
  398. * Reads the feeds which have been sent from a file, parses them into Feeds
  399. *
  400. * @param filePath ... path to the storage file
  401. * @throws IOException ... e.g. file not found or corrupted or whatever
  402. */
  403. public synchronized List<Feed> readFeedsFromFile(String filePath) throws IOException {
  404. System.out.println("Reading feeds from file.... ");
  405. List<Feed> res = new ArrayList<>();
  406.  
  407. ObjectInputStream oiS = null;
  408.  
  409. try {
  410. List<Feed> readCase = null;
  411.  
  412. FileInputStream streamIn = new FileInputStream(filePath);
  413. oiS = new ObjectInputStream(streamIn);
  414.  
  415. readCase = (List<Feed>) oiS.readObject();
  416.  
  417. if (readCase != null)
  418. res.addAll(readCase);
  419.  
  420. } catch (StreamCorruptedException | EOFException | ClassNotFoundException e) {
  421. e.printStackTrace();
  422. } finally {
  423. if (oiS != null) {
  424. oiS.close();
  425. }
  426. }
  427. return res;
  428.  
  429. }
  430.  
  431. /**
  432. * Send an Email containing all previously sent Notifications
  433. *
  434. * @param toEmail .. the receipients email
  435. */
  436. public synchronized void sendOldFeeds(String toEmail) {
  437. System.out.println("Sending old feeds.... ");
  438. Emailer emailer = new Emailer();
  439. List<Feed> feeds = null;
  440.  
  441. try {
  442.  
  443. feeds = readFeedsFromFile(serializationFile);
  444.  
  445. } catch (IOException e) {
  446. e.printStackTrace();
  447. }
  448.  
  449. if (feeds != null) {
  450. feeds.forEach(f -> emailer.sendMail(senderMail,
  451. toEmail,
  452. "Security Feed | " + f.getSubject(),
  453. f.getDescription() + "n" + f.getLink() + "n" + f.getDate(),
  454. smtpHost,
  455. smtpPort,
  456. smtpUser,
  457. smtpPw));
  458. }
  459.  
  460. }
  461.  
  462. /* STUPID UTILITY FUNCTIONS */
  463. public boolean isNull(List<Object> someObs) {
  464. return someObs.stream().anyMatch(Objects::isNull);
  465. }
  466.  
  467. /* GETTER AND SETTER */
  468.  
  469. public long getAllXSeconds() {
  470. return allXSeconds;
  471. }
  472.  
  473. public void setAllXSeconds(long allXSeconds) {
  474. this.allXSeconds = allXSeconds;
  475. }
  476.  
  477. public boolean isRunOnce() {
  478. return runOnce;
  479. }
  480.  
  481. public void setRunOnce(boolean runOnce) {
  482. this.runOnce = runOnce;
  483. }
  484.  
  485. public boolean isRunning() {
  486. return running;
  487. }
  488.  
  489. public void setRunning(boolean running) {
  490. this.running = running;
  491. }
  492.  
  493. public String getSerializationFile() {
  494. return serializationFile;
  495. }
  496.  
  497. public void setSerializationFile(String serializationFile) {
  498. this.serializationFile = serializationFile;
  499. }
  500.  
  501. public String getConfigFile() {
  502. return configFile;
  503. }
  504.  
  505. public void setConfigFile(String configFile) {
  506. this.configFile = configFile;
  507. }
  508.  
  509. public List<Feed> getSentNotifications() {
  510. return sentNotifications;
  511. }
  512.  
  513. public List<String> getEmails() {
  514. return emails;
  515. }
  516.  
  517. public List<String> getWords() {
  518. return words;
  519. }
  520.  
  521. public List<String> getFeeds() {
  522. return feeds;
  523. }
  524.  
  525. public String getCurrentEmail() {
  526. return currentEmail;
  527. }
  528.  
  529. public void setCurrentEmail(String currentEmail) {
  530. this.currentEmail = currentEmail;
  531. }
  532.  
  533. public String getCurrentFeed() {
  534. return currentFeed;
  535. }
  536.  
  537. public void setCurrentFeed(String currentFeed) {
  538. this.currentFeed = currentFeed;
  539. }
  540.  
  541. public String getCurrentWord() {
  542. return currentWord;
  543. }
  544.  
  545. public void setCurrentWord(String currentWord) {
  546. this.currentWord = currentWord;
  547. }
  548.  
  549. public String getSmtpHost() {
  550. return smtpHost;
  551. }
  552.  
  553. public void setSmtpHost(String smtpHost) {
  554. this.smtpHost = smtpHost;
  555. }
  556.  
  557. public String getSmtpUser() {
  558. return smtpUser;
  559. }
  560.  
  561. public void setSmtpUser(String smtpUser) {
  562. this.smtpUser = smtpUser;
  563. }
  564.  
  565. public String getSmtpPw() {
  566. return smtpPw;
  567. }
  568.  
  569. public void setSmtpPw(String smtpPw) {
  570. this.smtpPw = smtpPw;
  571. }
  572.  
  573. public int getSmtpPort() {
  574. return smtpPort;
  575. }
  576.  
  577. public void setSmtpPort(int smtpPort) {
  578. this.smtpPort = smtpPort;
  579. }
  580.  
  581. public String getSenderMail() {
  582. return senderMail;
  583. }
  584.  
  585. public void setSenderMail(String senderMail) {
  586. this.senderMail = senderMail;
  587. }
  588.  
  589. public String getUser() {
  590. return user;
  591. }
  592.  
  593. public void setUser(String user) {
  594. this.user = user;
  595. }
  596.  
  597. public String getPassword() {
  598. return password;
  599. }
  600.  
  601. public void setPassword(String password) {
  602. this.password = password;
  603. }
  604. }
  605.  
  606. <?xml version="1.0" encoding="UTF-8"?>
  607. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  608. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  609. <html
  610. xmlns:ui="http://java.sun.com/jsf/facelets"
  611. xmlns:h="http://java.sun.com/jsf/html"
  612. xmlns:f="http://java.sun.com/jsf/core"
  613. >
  614.  
  615. <h:body>
  616.  
  617. <div style="text-align: center;"><h1> Security RSS-To-Email Feeder</h1></div>
  618.  
  619. <h:form>
  620. <p>IsRunning: #{ConfigBean.running}</p>
  621. <h:commandButton action="#{ConfigBean.startStop}" value="Start Or Stop"></h:commandButton>
  622. <h:commandButton action="#{ConfigBean.runItOnce}" value="Run Once Now"></h:commandButton>
  623. </h:form>
  624.  
  625. <h:form>
  626. <p>Welcome #{Login.user}</p>
  627. <h:commandButton action="#{Login.logout}" value="Logout"></h:commandButton>
  628. </h:form>
  629.  
  630. <!-- FREQUENCY -->
  631. <h3>Configured RSS Readfrequency in Seconds</h3>
  632. <p>get and parse RSS-Feeds all #{ConfigBean.allXSeconds} Seconds</p>
  633. <h:form>
  634. <h:inputText value="#{ConfigBean.allXSeconds}" var="freq"/>
  635. <h:commandButton value="Set Frequency" action="#{ConfigBean.updateFreq}"/>
  636. </h:form>
  637.  
  638. <!-- EMAILS -->
  639. <h3>Configured Emails</h3>
  640. <h:form>
  641. <h:inputText value="#{ConfigBean.currentEmail}" var="email"/>
  642. <h:commandButton value="Add Email" action="#{ConfigBean.addEmail}"/>
  643. </h:form>
  644. <h:form>
  645. <ui:repeat var="email" value="#{ConfigBean.emails}">
  646. <tr>
  647. <td>#{email}</td>
  648.  
  649. <td>
  650. <f:facet name="header">Action</f:facet>
  651. <h:commandLink value="Delete" action="#{ConfigBean.rmEmail(email)}"/>
  652. </td>
  653. </tr>
  654. <br></br>
  655. </ui:repeat>
  656. </h:form>
  657.  
  658. <br></br>
  659.  
  660. <!-- FEEDS -->
  661. <h3>Configured Feeds</h3>
  662. <h:form>
  663. <h:inputText value="#{ConfigBean.currentFeed}" var="feed"/>
  664. <h:commandButton value="Add Feed" action="#{ConfigBean.addFeed}"/>
  665. </h:form>
  666. <h:form>
  667. <ui:repeat var="feed" value="#{ConfigBean.feeds}">
  668. <tr>
  669. <td>#{feed}</td>
  670.  
  671. <td>
  672. <f:facet name="header">Action</f:facet>
  673. <h:commandLink value="Delete" action="#{ConfigBean.rmFeed(feed)}"/>
  674. </td>
  675. </tr>
  676. <br></br>
  677. </ui:repeat>
  678. </h:form>
  679.  
  680. <br></br>
  681.  
  682. <!-- KEYWORDS -->
  683. <h3>Configured Keywords</h3>
  684. <h:form>
  685. <h:inputText value="#{ConfigBean.currentWord}" var="word"/>
  686. <h:commandButton value="Add Keyword" action="#{ConfigBean.addWord}"/>
  687. </h:form>
  688. <h:form>
  689. <ui:repeat var="word" value="#{ConfigBean.words}">
  690. <tr>
  691. <td>#{word}</td>
  692.  
  693. <td>
  694. <f:facet name="header">Action</f:facet>
  695. <h:commandLink value="Delete" action="#{ConfigBean.rmWord(word)}"/>
  696. </td>
  697. </tr>
  698. <br></br>
  699. </ui:repeat>
  700. </h:form>
  701.  
  702. <br></br>
  703.  
  704. <!-- SEND OLD FEEDS -->
  705. <h3>Send old matching feeds to email</h3>
  706. <h:form>
  707. <h:inputText value="#{ConfigBean.currentEmail}" var="email"/>
  708. <h:commandButton value="Send Feeds" action="#{ConfigBean.sendOldFeeds}"/>
  709. </h:form>
  710.  
  711. <!-- CURRENT CONFIG -->
  712. <h3>Current Configuration</h3>
  713. Frequency: #{ConfigBean.allXSeconds} <br></br>
  714. Properties-Config: #{ConfigBean.configFile} <br></br>
  715. Serialisation-File: #{ConfigBean.serializationFile} <br></br>
  716.  
  717. <!-- LATEST SENT -->
  718. <h3>Latest sent Feeds</h3>
  719.  
  720. <!-- ALL SENT -->
  721. <h3>All sent Feeds</h3>
  722. <ui:repeat var="feed" value="#{ConfigBean.sentNotifications}">
  723. <tr>
  724. <td>#{feed.date}</td>
  725. <td>#{feed.subject}</td>
  726. <td>#{feed.description}</td>
  727. <td>#{feed.link}</td>
  728. </tr>
  729. <br></br>
  730. </ui:repeat>
  731.  
  732. </h:body>
  733.  
  734. </html>
  735.  
  736. #Wed Aug 30 14:52:04 CEST 2017
  737. feeds=http://www.kb.cert.org/vulfeed, https://ics-cert.us-cert.gov/advisories/advisories.xml, https://ics-cert.us-cert.gov/alerts/alerts.xml
  738. serializationFile=C:\\Users\JARE\Desktop\feedLog.txt
  739. keywords= vuln, b,a
  740. frequency=100
  741. configFile=C:\\Users\JARE\Desktop\anderesZeug\config.properties
  742. emails=testemail@test.com
  743. smtpPort=25
  744. smtpHost=testsmtp.testsmtp.com
  745. smtpUser=svc-securityfeed
  746. smtpPw=svc-securityfeedPW
  747. senderMail=securityfeed@test.com
  748. loginUser=TEST
  749. loginPw=TESTTEST
  750.  
  751. [2017-08-31T10:28:46.561+0200] [glassfish 5.0] [WARNING] [] [javax.enterprise.resource.webcontainer.jsf.lifecycle] [tid: _ThreadID=29 _ThreadName=http-listener-1(3)] [timeMillis: 1504168126561] [levelValue: 900] [[
  752. #{Login.validateUsernamePassword}: java.lang.NullPointerException
  753. javax.faces.FacesException: #{Login.validateUsernamePassword}: java.lang.NullPointerException
  754. at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:119)
  755. at javax.faces.component.UICommand.broadcast(UICommand.java:330)
  756. at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:870)
  757. at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1418)
  758. at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
  759. at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
  760. at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
  761. at javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
  762. at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1580)
  763. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:338)
  764. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  765. at main.java.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:36)
  766. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
  767. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  768. at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
  769. at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
  770. at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:652)
  771. at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
  772. at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
  773. at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
  774. at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
  775. at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
  776. at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
  777. at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
  778. at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
  779. at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
  780. at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
  781. at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
  782. at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
  783. at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
  784. at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
  785. at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
  786. at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
  787. at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
  788. at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
  789. at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
  790. at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
  791. at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
  792. at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
  793. at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
  794. at java.lang.Thread.run(Thread.java:745)
  795. Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
  796. at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
  797. at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
  798. ... 40 more
  799. Caused by: java.lang.NullPointerException
  800. at java.util.regex.Pattern.<init>(Pattern.java:1350)
  801. at java.util.regex.Pattern.compile(Pattern.java:1028)
  802. at java.util.regex.Pattern.matches(Pattern.java:1133)
  803. at java.lang.String.matches(String.java:2121)
  804. at main.java.beans.LoginBean.validateHardcoded(LoginBean.java:41)
  805. at main.java.beans.LoginBean.validateUsernamePassword(LoginBean.java:46)
  806. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  807. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  808. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  809. at java.lang.reflect.Method.invoke(Method.java:498)
  810. at com.sun.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:181)
  811. at com.sun.el.parser.AstValue.invoke(AstValue.java:289)
  812. at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
  813. at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:107)
  814. at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
  815. ... 41 more
  816. ]]
  817.  
  818. [2017-08-31T10:28:46.579+0200] [glassfish 5.0] [FATAL] [jsf.context.exception.handler.log] [javax.enterprise.resource.webcontainer.jsf.context] [tid: _ThreadID=29 _ThreadName=http-listener-1(3)] [timeMillis: 1504168126579] [levelValue: 1100] [[
  819. JSF1073: javax.faces.FacesException erfasst während Verarbeitung von INVOKE_APPLICATION 5 : UIComponent-ClientId=, Message=#{Login.validateUsernamePassword}: java.lang.NullPointerException]]
  820.  
  821. [2017-08-31T10:28:46.579+0200] [glassfish 5.0] [FATAL] [] [javax.enterprise.resource.webcontainer.jsf.context] [tid: _ThreadID=29 _ThreadName=http-listener-1(3)] [timeMillis: 1504168126579] [levelValue: 1100] [[
  822. #{Login.validateUsernamePassword}: java.lang.NullPointerException
  823. javax.faces.FacesException: #{Login.validateUsernamePassword}: java.lang.NullPointerException
  824. at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:90)
  825. at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
  826. at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201)
  827. at javax.faces.webapp.FacesServlet.service(FacesServlet.java:670)
  828. at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1580)
  829. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:338)
  830. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  831. at main.java.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:36)
  832. at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
  833. at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
  834. at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
  835. at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
  836. at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:652)
  837. at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
  838. at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
  839. at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
  840. at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
  841. at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
  842. at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
  843. at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
  844. at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
  845. at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
  846. at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
  847. at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
  848. at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
  849. at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
  850. at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
  851. at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
  852. at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
  853. at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
  854. at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
  855. at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
  856. at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
  857. at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
  858. at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
  859. at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
  860. at java.lang.Thread.run(Thread.java:745)
  861. Caused by: javax.faces.FacesException: #{Login.validateUsernamePassword}: java.lang.NullPointerException
  862. at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:119)
  863. at javax.faces.component.UICommand.broadcast(UICommand.java:330)
  864. at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:870)
  865. at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1418)
  866. at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
  867. ... 36 more
  868. Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
  869. at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
  870. at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
  871. ... 40 more
  872. Caused by: java.lang.NullPointerException
  873. at java.util.regex.Pattern.<init>(Pattern.java:1350)
  874. at java.util.regex.Pattern.compile(Pattern.java:1028)
  875. at java.util.regex.Pattern.matches(Pattern.java:1133)
  876. at java.lang.String.matches(String.java:2121)
  877. at main.java.beans.LoginBean.validateHardcoded(LoginBean.java:41)
  878. at main.java.beans.LoginBean.validateUsernamePassword(LoginBean.java:46)
  879. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  880. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  881. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  882. at java.lang.reflect.Method.invoke(Method.java:498)
  883. at com.sun.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:181)
  884. at com.sun.el.parser.AstValue.invoke(AstValue.java:289)
  885. at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
  886. at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:107)
  887. at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
  888. ... 41 more
  889. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement