public static Portal getPortal() { if (portal == null) { portal = new Portal(); portal.checkConfiguration = new DetectPortalChange(); SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); portal.checkConfiguration.execute(); int i = siteviewgroup.getSettingAsLong("_fileCheckFrequency", 120) * 1000; if (siteviewgroup.maintenanceScheduler != null) { siteviewgroup.maintenanceScheduler.scheduleRepeatedPeriodicAction( portal.checkConfiguration, i); } } return portal; }
public ArrayList process(HashMap hashmap, Date date, Date date1, HashMap hashmap1) { SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); long l = siteviewgroup.getSettingAsLong("_alertLogReadChunkSize", 0x19000); ArrayList array = new ArrayList(); if (logfile == null || !logfile.exists()) { LogManager.log("Error", "Alert log " + logfile.getAbsolutePath() + " does not exist"); return array; } if (!logfile.canRead()) { LogManager.log("Error", "Alert log " + logfile.getAbsolutePath() + " cannot be read"); return array; } boolean flag = false; String s = logfile.getAbsolutePath(); long l1 = Platform.FILE_NEWLINE.length(); long l2 = logfile.length(); boolean flag1 = false; if (hashmap1 != null) flag1 = !hashmap1.isEmpty(); long l3 = 0L; long l4 = 0x7fffffffffffffffL; if (date != null) l3 = date.getTime(); if (date1 != null) l4 = date1.getTime(); long l5 = 0x7fffffffffffffffL; long l6 = 0L; Braf braf = null; try { do { if (flag) break; long l7 = l2 - l; long l8 = l2; l2 = -1L; if (l7 < 0L) l7 = 0L; long l9 = l7; braf = new Braf(s, l7); HashMap hashmap2 = null; ArrayList array1 = new ArrayList(); String s2 = ""; StringBuffer stringbuffer = new StringBuffer(); label0: do { String s1; do if ((s1 = braf.readLine()) == null) break label0; while (s1.indexOf("<pre>") >= 0); if (isDateLine(s1) && getDateInfo(s1, lineDate)) { if (l2 < 0L) l2 = l9 - 1L; if (hashmap2 != null) { if (s2.length() > 0) { addAlertTag(hashmap2, s2, stringbuffer.toString()); s2 = ""; stringbuffer.setLength(0); } addAlertEntry(hashmap2, array1, hashmap); } Date date2 = getDate(lineDate); long l10 = date2.getTime(); hashmap2 = null; if (l10 >= l3 && l10 <= l4) if (flag1) { if (ScheduleProperty.isEnabled(hashmap1, date2)) { hashmap2 = new HashMap(); hashmap2.put("date", date2); } } else { hashmap2 = new HashMap(); hashmap2.put("date", date2); } if (l10 < l5) l5 = l10; if (l10 > l6) l6 = l10; } else if (hashmap2 != null) if (s1.startsWith(ALERT_LINE_PREFIX)) { if (s2.length() > 0) { addAlertTag(hashmap2, s2, stringbuffer.toString()); s2 = ""; stringbuffer.setLength(0); } int i = s1.indexOf(COLON_SUFFIX); if (i >= 0) { s2 = s1.substring(1, i); stringbuffer.setLength(0); stringbuffer.append(s1.substring(i + COLON_SUFFIX.length())); } } else if (s2.length() > 0) { if (stringbuffer.length() > 0) stringbuffer.append("\n"); stringbuffer.append(s1); } l9 += (long) s1.length() + l1; } while (l9 < l8); if (hashmap2 != null) { if (s2.length() > 0) addAlertTag(hashmap2, s2, stringbuffer.toString()); addAlertEntry(hashmap2, array1, hashmap); } for (int j = 0; j < array.size(); j++) array1.add(array.get(j)); array = array1; if (l7 == 0L) flag = true; braf.close(); braf = null; if (l5 <= l3 && l6 >= l4) flag = true; } while (true); } catch (IOException ioexception) { LogManager.log("Error", "I/O error reading file: " + s); System.out.println("I/O error reading file: " + s); } finally { if (braf != null) try { braf.close(); } catch (IOException ioexception1) { } } return array; }