target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void mustFailOrSkipCfws() { String input = "(3 Jan 2015 00:00 +0000) 1 Jan 2015 00:00 +0000"; try { Date date = getStrict().parse(input); assertThatDate(date, "Thu, 1 Jan 2015 00:00:00 +0000 (UTC)"); } catch (ParseException ignored) { assertTrue("Not supporting CFWS is allowed", true); } } | @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse() : new Rfc2822StrictParser(text, pos).pars... | MailDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse()... | MailDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse()... | MailDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse()... | MailDateFormat extends SimpleDateFormat { @Override public Date parse(String text, ParsePosition pos) { if (text == null || pos == null) { throw new NullPointerException(); } else if (0 > pos.getIndex() || pos.getIndex() >= text.length()) { return null; } return isLenient() ? new Rfc2822LenientParser(text, pos).parse()... |
@Test(expected = UnsupportedOperationException.class) public void mustProhibitSetCalendar() { getDefault().setCalendar(Calendar.getInstance()); } | @Override public void setCalendar(Calendar newCalendar) { throw new UnsupportedOperationException("Method " + "setCalendar() shouldn't be called"); } | MailDateFormat extends SimpleDateFormat { @Override public void setCalendar(Calendar newCalendar) { throw new UnsupportedOperationException("Method " + "setCalendar() shouldn't be called"); } } | MailDateFormat extends SimpleDateFormat { @Override public void setCalendar(Calendar newCalendar) { throw new UnsupportedOperationException("Method " + "setCalendar() shouldn't be called"); } MailDateFormat(); } | MailDateFormat extends SimpleDateFormat { @Override public void setCalendar(Calendar newCalendar) { throw new UnsupportedOperationException("Method " + "setCalendar() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffer dateStrBuf,
... | MailDateFormat extends SimpleDateFormat { @Override public void setCalendar(Calendar newCalendar) { throw new UnsupportedOperationException("Method " + "setCalendar() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffer dateStrBuf,
... |
@Test public void testGetLocalHostSecure() throws Exception { Session session = Session.getInstance(new Properties()); Service svc = new NotAllowedService(session); try { LogManagerProperties.getLocalHost(svc); } catch (SecurityException allowed) { } catch (InvocationTargetException expect) { Assert.assertTrue(expect.g... | static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.toString()); } } catch (final ExceptionInI... | LogManagerProperties extends Properties { static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.... | LogManagerProperties extends Properties { static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.... | LogManagerProperties extends Properties { static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.... | LogManagerProperties extends Properties { static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.... |
@Test(expected = UnsupportedOperationException.class) public void mustProhibitSetNumberFormat() { getDefault().setNumberFormat(NumberFormat.getInstance()); } | @Override public void setNumberFormat(NumberFormat newNumberFormat) { throw new UnsupportedOperationException("Method " + "setNumberFormat() shouldn't be called"); } | MailDateFormat extends SimpleDateFormat { @Override public void setNumberFormat(NumberFormat newNumberFormat) { throw new UnsupportedOperationException("Method " + "setNumberFormat() shouldn't be called"); } } | MailDateFormat extends SimpleDateFormat { @Override public void setNumberFormat(NumberFormat newNumberFormat) { throw new UnsupportedOperationException("Method " + "setNumberFormat() shouldn't be called"); } MailDateFormat(); } | MailDateFormat extends SimpleDateFormat { @Override public void setNumberFormat(NumberFormat newNumberFormat) { throw new UnsupportedOperationException("Method " + "setNumberFormat() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffer dateSt... | MailDateFormat extends SimpleDateFormat { @Override public void setNumberFormat(NumberFormat newNumberFormat) { throw new UnsupportedOperationException("Method " + "setNumberFormat() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffer dateSt... |
@Test(expected = UnsupportedOperationException.class) public void mustProhibitGet2DigitYearStart() { getDefault().get2DigitYearStart(); } | @Override public Date get2DigitYearStart() { throw new UnsupportedOperationException("Method " + "get2DigitYearStart() shouldn't be called"); } | MailDateFormat extends SimpleDateFormat { @Override public Date get2DigitYearStart() { throw new UnsupportedOperationException("Method " + "get2DigitYearStart() shouldn't be called"); } } | MailDateFormat extends SimpleDateFormat { @Override public Date get2DigitYearStart() { throw new UnsupportedOperationException("Method " + "get2DigitYearStart() shouldn't be called"); } MailDateFormat(); } | MailDateFormat extends SimpleDateFormat { @Override public Date get2DigitYearStart() { throw new UnsupportedOperationException("Method " + "get2DigitYearStart() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffer dateStrBuf,
Fiel... | MailDateFormat extends SimpleDateFormat { @Override public Date get2DigitYearStart() { throw new UnsupportedOperationException("Method " + "get2DigitYearStart() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffer dateStrBuf,
Fiel... |
@Test(expected = UnsupportedOperationException.class) public void mustProhibitSet2DigitYearStart() { getDefault().set2DigitYearStart(new Date()); } | @Override public void set2DigitYearStart(Date startDate) { throw new UnsupportedOperationException("Method " + "set2DigitYearStart() shouldn't be called"); } | MailDateFormat extends SimpleDateFormat { @Override public void set2DigitYearStart(Date startDate) { throw new UnsupportedOperationException("Method " + "set2DigitYearStart() shouldn't be called"); } } | MailDateFormat extends SimpleDateFormat { @Override public void set2DigitYearStart(Date startDate) { throw new UnsupportedOperationException("Method " + "set2DigitYearStart() shouldn't be called"); } MailDateFormat(); } | MailDateFormat extends SimpleDateFormat { @Override public void set2DigitYearStart(Date startDate) { throw new UnsupportedOperationException("Method " + "set2DigitYearStart() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffer dateStrBuf,
... | MailDateFormat extends SimpleDateFormat { @Override public void set2DigitYearStart(Date startDate) { throw new UnsupportedOperationException("Method " + "set2DigitYearStart() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffer dateStrBuf,
... |
@Test(expected = UnsupportedOperationException.class) public void mustProhibitSetDateFormatSymbols() { SimpleDateFormat fmt = getStrict(); fmt.setDateFormatSymbols(new DateFormatSymbols(Locale.FRENCH)); Date date = mustPass(fmt, "1 Jan 2015 00:00:00 +0000"); assertThatDate(date, "jeu., 1 janv. 2015 00:00:00 +0000 (UTC)... | @Override public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { throw new UnsupportedOperationException("Method " + "setDateFormatSymbols() shouldn't be called"); } | MailDateFormat extends SimpleDateFormat { @Override public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { throw new UnsupportedOperationException("Method " + "setDateFormatSymbols() shouldn't be called"); } } | MailDateFormat extends SimpleDateFormat { @Override public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { throw new UnsupportedOperationException("Method " + "setDateFormatSymbols() shouldn't be called"); } MailDateFormat(); } | MailDateFormat extends SimpleDateFormat { @Override public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { throw new UnsupportedOperationException("Method " + "setDateFormatSymbols() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, Str... | MailDateFormat extends SimpleDateFormat { @Override public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) { throw new UnsupportedOperationException("Method " + "setDateFormatSymbols() shouldn't be called"); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, Str... |
@Test public void testSetRecipientStringNull() throws Exception { String addr = "joe@example.com"; MimeMessage m = new MimeMessage(s); m.setRecipient(TO, new InternetAddress(addr)); assertEquals("To: is set", addr, m.getRecipients(TO)[0].toString()); m.setRecipient(TO, (Address)null); assertArrayEquals("To: is removed"... | @Override public Address[] getRecipients(Message.RecipientType type) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { String s = getHeader("Newsgroups", ","); return (s == null) ? null : NewsAddress.parse(s); } else return getAddressHeader(getHeaderName(type)); } | MimeMessage extends Message implements MimePart { @Override public Address[] getRecipients(Message.RecipientType type) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { String s = getHeader("Newsgroups", ","); return (s == null) ? null : NewsAddress.parse(s); } else return getAddressHeader(getHeaderNa... | MimeMessage extends Message implements MimePart { @Override public Address[] getRecipients(Message.RecipientType type) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { String s = getHeader("Newsgroups", ","); return (s == null) ? null : NewsAddress.parse(s); } else return getAddressHeader(getHeaderNa... | MimeMessage extends Message implements MimePart { @Override public Address[] getRecipients(Message.RecipientType type) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { String s = getHeader("Newsgroups", ","); return (s == null) ? null : NewsAddress.parse(s); } else return getAddressHeader(getHeaderNa... | MimeMessage extends Message implements MimePart { @Override public Address[] getRecipients(Message.RecipientType type) throws MessagingException { if (type == RecipientType.NEWSGROUPS) { String s = getHeader("Newsgroups", ","); return (s == null) ? null : NewsAddress.parse(s); } else return getAddressHeader(getHeaderNa... |
@Test public void testSetNewsgroupWhitespace() throws Exception { NewsAddress addr = new NewsAddress("alt.\r\nbad"); MimeMessage m = new MimeMessage(s); m.setRecipient(NEWSGROUPS, addr); assertEquals("alt.bad", m.getHeader("Newsgroups", null)); } | @Override public String[] getHeader(String name) throws MessagingException { return headers.getHeader(name); } | MimeMessage extends Message implements MimePart { @Override public String[] getHeader(String name) throws MessagingException { return headers.getHeader(name); } } | MimeMessage extends Message implements MimePart { @Override public String[] getHeader(String name) throws MessagingException { return headers.getHeader(name); } MimeMessage(Session session); MimeMessage(Session session, InputStream is); MimeMessage(MimeMessage source); protected MimeMessage(Folder folder, int msgnum... | MimeMessage extends Message implements MimePart { @Override public String[] getHeader(String name) throws MessagingException { return headers.getHeader(name); } MimeMessage(Session session); MimeMessage(Session session, InputStream is); MimeMessage(MimeMessage source); protected MimeMessage(Folder folder, int msgnum... | MimeMessage extends Message implements MimePart { @Override public String[] getHeader(String name) throws MessagingException { return headers.getHeader(name); } MimeMessage(Session session); MimeMessage(Session session, InputStream is); MimeMessage(MimeMessage source); protected MimeMessage(Folder folder, int msgnum... |
@Test public void testSetDataHandler() throws Exception { Session s = Session.getInstance(new Properties()); MimeMessage orig = createMessage(s); final DataHandler odh = orig.getDataHandler(); MimeMessage msg = new MimeMessage(s) { { dh = odh; } }; msg = new MimeMessage(msg); assertEquals("text/x-test", msg.getContentT... | @Override public synchronized void setDataHandler(DataHandler dh) throws MessagingException { this.dh = dh; cachedContent = null; MimeBodyPart.invalidateContentHeaders(this); } | MimeMessage extends Message implements MimePart { @Override public synchronized void setDataHandler(DataHandler dh) throws MessagingException { this.dh = dh; cachedContent = null; MimeBodyPart.invalidateContentHeaders(this); } } | MimeMessage extends Message implements MimePart { @Override public synchronized void setDataHandler(DataHandler dh) throws MessagingException { this.dh = dh; cachedContent = null; MimeBodyPart.invalidateContentHeaders(this); } MimeMessage(Session session); MimeMessage(Session session, InputStream is); MimeMessage(Mim... | MimeMessage extends Message implements MimePart { @Override public synchronized void setDataHandler(DataHandler dh) throws MessagingException { this.dh = dh; cachedContent = null; MimeBodyPart.invalidateContentHeaders(this); } MimeMessage(Session session); MimeMessage(Session session, InputStream is); MimeMessage(Mim... | MimeMessage extends Message implements MimePart { @Override public synchronized void setDataHandler(DataHandler dh) throws MessagingException { this.dh = dh; cachedContent = null; MimeBodyPart.invalidateContentHeaders(this); } MimeMessage(Session session); MimeMessage(Session session, InputStream is); MimeMessage(Mim... |
@Test public void testContinuationLine() throws Exception { String header = "Subject: a\r\n b\r\n\r\n"; InternetHeaders ih = new InternetHeaders( new AsciiStringInputStream(header)); assertEquals(1, ih.getHeader("Subject").length); assertEquals("a\r\n b", ih.getHeader("Subject")[0]); } | public String[] getHeader(String name) { Iterator<InternetHeader> e = headers.iterator(); List<String> v = new ArrayList<>(); while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); String r[] = new String[... | InternetHeaders { public String[] getHeader(String name) { Iterator<InternetHeader> e = headers.iterator(); List<String> v = new ArrayList<>(); while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); String... | InternetHeaders { public String[] getHeader(String name) { Iterator<InternetHeader> e = headers.iterator(); List<String> v = new ArrayList<>(); while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); String... | InternetHeaders { public String[] getHeader(String name) { Iterator<InternetHeader> e = headers.iterator(); List<String> v = new ArrayList<>(); while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); String... | InternetHeaders { public String[] getHeader(String name) { Iterator<InternetHeader> e = headers.iterator(); List<String> v = new ArrayList<>(); while (e.hasNext()) { InternetHeader h = e.next(); if (name.equalsIgnoreCase(h.getName()) && h.line != null) { v.add(h.getValue()); } } if (v.size() == 0) return (null); String... |
@Test public void testInitialWhitespaceLineLoad() throws Exception { InternetHeaders ih = new InternetHeaders(); ih.load(new AsciiStringInputStream(initialWhitespaceHeader)); testInitialWhitespaceLine(ih); } | public void load(InputStream is) throws MessagingException { load(is, false); } | InternetHeaders { public void load(InputStream is) throws MessagingException { load(is, false); } } | InternetHeaders { public void load(InputStream is) throws MessagingException { load(is, false); } InternetHeaders(); InternetHeaders(InputStream is); InternetHeaders(InputStream is, boolean allowutf8); } | InternetHeaders { public void load(InputStream is) throws MessagingException { load(is, false); } InternetHeaders(); InternetHeaders(InputStream is); InternetHeaders(InputStream is, boolean allowutf8); void load(InputStream is); void load(InputStream is, boolean allowutf8); String[] getHeader(String name); String get... | InternetHeaders { public void load(InputStream is) throws MessagingException { load(is, false); } InternetHeaders(); InternetHeaders(InputStream is); InternetHeaders(InputStream is, boolean allowutf8); void load(InputStream is); void load(InputStream is, boolean allowutf8); String[] getHeader(String name); String get... |
@Test public void testInitialContinuationLineLoad() throws Exception { InternetHeaders ih = new InternetHeaders(); ih.load(new AsciiStringInputStream(initialContinuationHeader)); testInitialContinuationLine(ih); } | public void load(InputStream is) throws MessagingException { load(is, false); } | InternetHeaders { public void load(InputStream is) throws MessagingException { load(is, false); } } | InternetHeaders { public void load(InputStream is) throws MessagingException { load(is, false); } InternetHeaders(); InternetHeaders(InputStream is); InternetHeaders(InputStream is, boolean allowutf8); } | InternetHeaders { public void load(InputStream is) throws MessagingException { load(is, false); } InternetHeaders(); InternetHeaders(InputStream is); InternetHeaders(InputStream is, boolean allowutf8); void load(InputStream is); void load(InputStream is, boolean allowutf8); String[] getHeader(String name); String get... | InternetHeaders { public void load(InputStream is) throws MessagingException { load(is, false); } InternetHeaders(); InternetHeaders(InputStream is); InternetHeaders(InputStream is, boolean allowutf8); void load(InputStream is); void load(InputStream is, boolean allowutf8); String[] getHeader(String name); String get... |
@Test public void testGetLocalHostNull() throws Exception { boolean fail = true; try { LogManagerProperties.getLocalHost((Service) null); } catch (NullPointerException expected) { fail = false; } Assert.assertFalse(fail); } | static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.toString()); } } catch (final ExceptionInI... | LogManagerProperties extends Properties { static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.... | LogManagerProperties extends Properties { static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.... | LogManagerProperties extends Properties { static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.... | LogManagerProperties extends Properties { static String getLocalHost(final Object s) throws Exception { try { final Method m = s.getClass().getMethod("getLocalHost"); if (!Modifier.isStatic(m.getModifiers()) && m.getReturnType() == String.class) { return (String) m.invoke(s); } else { throw new NoSuchMethodException(m.... |
@Test public void testBadChineseCharsets() throws Exception { String badgb2312 = "=?gb2312?B?xbfUqqLjIChFVVIpttK7u4EwhDYgKENOWSk=?="; String badgbk = "=?gbk?B?xbfUqqLjIChFVVIpttK7u4EwhDYgKENOWSk=?="; String badms936 = "=?ms936?B?xbfUqqLjIChFVVIpttK7u4EwhDYgKENOWSk=?="; String badcp936 = "=?cp936?B?xbfUqqLjIChFVVIpttK7u... | public static String decodeWord(String eword) throws ParseException, UnsupportedEncodingException { if (!eword.startsWith("=?")) throw new ParseException( "encoded word does not start with \"=?\": " + eword); int start = 2; int pos; if ((pos = eword.indexOf('?', start)) == -1) throw new ParseException( "encoded word do... | MimeUtility { public static String decodeWord(String eword) throws ParseException, UnsupportedEncodingException { if (!eword.startsWith("=?")) throw new ParseException( "encoded word does not start with \"=?\": " + eword); int start = 2; int pos; if ((pos = eword.indexOf('?', start)) == -1) throw new ParseException( "e... | MimeUtility { public static String decodeWord(String eword) throws ParseException, UnsupportedEncodingException { if (!eword.startsWith("=?")) throw new ParseException( "encoded word does not start with \"=?\": " + eword); int start = 2; int pos; if ((pos = eword.indexOf('?', start)) == -1) throw new ParseException( "e... | MimeUtility { public static String decodeWord(String eword) throws ParseException, UnsupportedEncodingException { if (!eword.startsWith("=?")) throw new ParseException( "encoded word does not start with \"=?\": " + eword); int start = 2; int pos; if ((pos = eword.indexOf('?', start)) == -1) throw new ParseException( "e... | MimeUtility { public static String decodeWord(String eword) throws ParseException, UnsupportedEncodingException { if (!eword.startsWith("=?")) throw new ParseException( "encoded word does not start with \"=?\": " + eword); int start = 2; int pos; if ((pos = eword.indexOf('?', start)) == -1) throw new ParseException( "e... |
@Test public void testFile() throws Exception { URLName u = new URLName("http: assertEquals("file", u.getFile()); u = new URLName("http: assertEquals("file", u.getFile()); u = new URLName("http: assertEquals("", u.getFile()); u = new URLName("http: assertEquals(null, u.getFile()); u = new URLName("http: assertEquals(nu... | public String getFile() { return file; } | URLName { public String getFile() { return file; } } | URLName { public String getFile() { return file; } URLName(
String protocol,
String host,
int port,
String file,
String username,
String password
); URLName(URL url); URLName(String url); } | URLName { public String getFile() { return file; } URLName(
String protocol,
String host,
int port,
String file,
String username,
String password
); URLName(URL url); URLName(String url); @Override String toString(); int getPort(); String getProtocol(); String getFile(); String getRef(); String getHost(); Stri... | URLName { public String getFile() { return file; } URLName(
String protocol,
String host,
int port,
String file,
String username,
String password
); URLName(URL url); URLName(String url); @Override String toString(); int getPort(); String getProtocol(); String getFile(); String getRef(); String getHost(); Stri... |
@Test public void testParseDurationMs() throws Exception { try { long ms = LogManagerProperties.parseDurationToMillis("PT0.345S"); assertEquals(345L, ms); } catch (ClassNotFoundException | NoClassDefFoundError ignore) { assertFalse(ignore.toString(), hasJavaTimeModule()); } } | static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.getModifiers())) { throw new NoSuchMethodExce... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... |
@Test public void testParseDurationSec() throws Exception { try { long ms = LogManagerProperties.parseDurationToMillis("PT20.345S"); assertEquals((20L * 1000L) + 345L, ms); } catch (ClassNotFoundException | NoClassDefFoundError ignore) { assertFalse(ignore.toString(), hasJavaTimeModule()); } } | static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.getModifiers())) { throw new NoSuchMethodExce... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... |
@Test public void testIntDef() throws Exception { Properties props = new Properties(); assertEquals(PropUtil.getIntProperty(props, "test", 1), 1); } | public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @Deprecated static ... | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @Deprecated static ... |
@Test public void testParseDurationMin() throws Exception { try { long ms = LogManagerProperties.parseDurationToMillis("PT15M"); assertEquals(15L * 60L * 1000L, ms); } catch (ClassNotFoundException | NoClassDefFoundError ignore) { assertFalse(ignore.toString(), hasJavaTimeModule()); } } | static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.getModifiers())) { throw new NoSuchMethodExce... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... |
@Test public void testParseDurationHour() throws Exception { try { long ms = LogManagerProperties.parseDurationToMillis("PT10H"); assertEquals(10L * 60L * 60L * 1000L, ms); } catch (ClassNotFoundException | NoClassDefFoundError ignore) { assertFalse(ignore.toString(), hasJavaTimeModule()); } } | static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.getModifiers())) { throw new NoSuchMethodExce... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... |
@Test public void testParseDurationDay() throws Exception { try { long ms = LogManagerProperties.parseDurationToMillis("P2D"); assertEquals(2L * 24L * 60L * 60L * 1000L, ms); } catch (ClassNotFoundException | NoClassDefFoundError ignore) { assertFalse(ignore.toString(), hasJavaTimeModule()); } } | static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.getModifiers())) { throw new NoSuchMethodExce... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... |
@Test public void testParseDurationAll() throws Exception { try { long ms = LogManagerProperties .parseDurationToMillis("P2DT3H4M20.345S"); assertEquals((2L * 24L * 60L * 60L * 1000L) + (3L * 60L * 60L * 1000L) + (4L * 60L * 1000L) + ((20L * 1000L) + 345), ms); } catch (ClassNotFoundException | NoClassDefFoundError ign... | static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.getModifiers())) { throw new NoSuchMethodExce... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... | LogManagerProperties extends Properties { static long parseDurationToMillis(final CharSequence value) throws Exception { try { final Class<?> k = findClass("java.time.Duration"); final Method parse = k.getMethod("parse", CharSequence.class); if (!k.isAssignableFrom(parse.getReturnType()) || !Modifier.isStatic(parse.get... |
@Test public void testGet() throws Exception { String prefix = LogManagerPropertiesTest.class.getName(); LogManager manager = LogManager.getLogManager(); try { String key = prefix.concat(".dummy"); Properties parent = new Properties(); parent.put(key, "value"); parent.put("", "empty"); read(manager, parent); parent = n... | @Override public synchronized Object get(final Object key) { Object value; if (key instanceof String) { value = getProperty((String) key); } else { value = null; } if (value == null) { value = defaults.get(key); if (value == null && !defaults.containsKey(key)) { value = super.get(key); } } return value; } | LogManagerProperties extends Properties { @Override public synchronized Object get(final Object key) { Object value; if (key instanceof String) { value = getProperty((String) key); } else { value = null; } if (value == null) { value = defaults.get(key); if (value == null && !defaults.containsKey(key)) { value = super.g... | LogManagerProperties extends Properties { @Override public synchronized Object get(final Object key) { Object value; if (key instanceof String) { value = getProperty((String) key); } else { value = null; } if (value == null) { value = defaults.get(key); if (value == null && !defaults.containsKey(key)) { value = super.g... | LogManagerProperties extends Properties { @Override public synchronized Object get(final Object key) { Object value; if (key instanceof String) { value = getProperty((String) key); } else { value = null; } if (value == null) { value = defaults.get(key); if (value == null && !defaults.containsKey(key)) { value = super.g... | LogManagerProperties extends Properties { @Override public synchronized Object get(final Object key) { Object value; if (key instanceof String) { value = getProperty((String) key); } else { value = null; } if (value == null) { value = defaults.get(key); if (value == null && !defaults.containsKey(key)) { value = super.g... |
@Test public void testContainsKey() throws Exception { String prefix = LogManagerPropertiesTest.class.getName(); LogManager manager = LogManager.getLogManager(); try { String key = prefix.concat(".dummy"); Properties parent = new Properties(); parent.put(key, "value"); parent.put("", "empty"); read(manager, parent); pa... | @Override public synchronized boolean containsKey(final Object key) { boolean found = key instanceof String && getProperty((String) key) != null; if (!found) { found = defaults.containsKey(key) || super.containsKey(key); } return found; } | LogManagerProperties extends Properties { @Override public synchronized boolean containsKey(final Object key) { boolean found = key instanceof String && getProperty((String) key) != null; if (!found) { found = defaults.containsKey(key) || super.containsKey(key); } return found; } } | LogManagerProperties extends Properties { @Override public synchronized boolean containsKey(final Object key) { boolean found = key instanceof String && getProperty((String) key) != null; if (!found) { found = defaults.containsKey(key) || super.containsKey(key); } return found; } LogManagerProperties(final Properties p... | LogManagerProperties extends Properties { @Override public synchronized boolean containsKey(final Object key) { boolean found = key instanceof String && getProperty((String) key) != null; if (!found) { found = defaults.containsKey(key) || super.containsKey(key); } return found; } LogManagerProperties(final Properties p... | LogManagerProperties extends Properties { @Override public synchronized boolean containsKey(final Object key) { boolean found = key instanceof String && getProperty((String) key) != null; if (!found) { found = defaults.containsKey(key) || super.containsKey(key); } return found; } LogManagerProperties(final Properties p... |
@Test public void testRemove() throws Exception { String prefix = LogManagerPropertiesTest.class.getName(); LogManager manager = LogManager.getLogManager(); try { String key = prefix.concat(".dummy"); Properties parent = new Properties(); parent.put(key, "value"); parent.put("", "empty"); read(manager, parent); parent ... | @Override public synchronized Object remove(final Object key) { final Object def = preWrite(key); final Object man = super.remove(key); return man == null ? def : man; } | LogManagerProperties extends Properties { @Override public synchronized Object remove(final Object key) { final Object def = preWrite(key); final Object man = super.remove(key); return man == null ? def : man; } } | LogManagerProperties extends Properties { @Override public synchronized Object remove(final Object key) { final Object def = preWrite(key); final Object man = super.remove(key); return man == null ? def : man; } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { @Override public synchronized Object remove(final Object key) { final Object def = preWrite(key); final Object man = super.remove(key); return man == null ? def : man; } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesnt... | LogManagerProperties extends Properties { @Override public synchronized Object remove(final Object key) { final Object def = preWrite(key); final Object man = super.remove(key); return man == null ? def : man; } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesnt... |
@Test public void testPut() throws Exception { String prefix = LogManagerPropertiesTest.class.getName(); LogManager manager = LogManager.getLogManager(); try { String key = prefix.concat(".dummy"); Properties parent = new Properties(); parent.put(key, "value"); parent.put("", "empty"); read(manager, parent); parent = n... | @Override public synchronized Object put(final Object key, final Object value) { if (key instanceof String && value instanceof String) { final Object def = preWrite(key); final Object man = super.put(key, value); return man == null ? def : man; } else { return super.put(key, value); } } | LogManagerProperties extends Properties { @Override public synchronized Object put(final Object key, final Object value) { if (key instanceof String && value instanceof String) { final Object def = preWrite(key); final Object man = super.put(key, value); return man == null ? def : man; } else { return super.put(key, va... | LogManagerProperties extends Properties { @Override public synchronized Object put(final Object key, final Object value) { if (key instanceof String && value instanceof String) { final Object def = preWrite(key); final Object man = super.put(key, value); return man == null ? def : man; } else { return super.put(key, va... | LogManagerProperties extends Properties { @Override public synchronized Object put(final Object key, final Object value) { if (key instanceof String && value instanceof String) { final Object def = preWrite(key); final Object man = super.put(key, value); return man == null ? def : man; } else { return super.put(key, va... | LogManagerProperties extends Properties { @Override public synchronized Object put(final Object key, final Object value) { if (key instanceof String && value instanceof String) { final Object def = preWrite(key); final Object man = super.put(key, value); return man == null ? def : man; } else { return super.put(key, va... |
@Test public void testSetProperty() throws Exception { String prefix = LogManagerPropertiesTest.class.getName(); LogManager manager = LogManager.getLogManager(); try { String key = prefix.concat(".dummy"); Properties parent = new Properties(); parent.put(key, "value"); parent.put("", "empty"); read(manager, parent); pa... | @Override public Object setProperty(String key, String value) { return this.put(key, value); } | LogManagerProperties extends Properties { @Override public Object setProperty(String key, String value) { return this.put(key, value); } } | LogManagerProperties extends Properties { @Override public Object setProperty(String key, String value) { return this.put(key, value); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { @Override public Object setProperty(String key, String value) { return this.put(key, value); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synchronized String... | LogManagerProperties extends Properties { @Override public Object setProperty(String key, String value) { return this.put(key, value); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synchronized String... |
@Test public void testToLanguageTag() throws Exception { assertEquals("en-US", LogManagerProperties.toLanguageTag(Locale.US)); assertEquals("en", LogManagerProperties.toLanguageTag(Locale.ENGLISH)); assertEquals("", LogManagerProperties.toLanguageTag(new Locale("", "", ""))); Locale l = new Locale("en", "US", "slang");... | static String toLanguageTag(final Locale locale) { final String l = locale.getLanguage(); final String c = locale.getCountry(); final String v = locale.getVariant(); final char[] b = new char[l.length() + c.length() + v.length() + 2]; int count = l.length(); l.getChars(0, count, b, 0); if (c.length() != 0 || (l.length(... | LogManagerProperties extends Properties { static String toLanguageTag(final Locale locale) { final String l = locale.getLanguage(); final String c = locale.getCountry(); final String v = locale.getVariant(); final char[] b = new char[l.length() + c.length() + v.length() + 2]; int count = l.length(); l.getChars(0, count... | LogManagerProperties extends Properties { static String toLanguageTag(final Locale locale) { final String l = locale.getLanguage(); final String c = locale.getCountry(); final String v = locale.getVariant(); final char[] b = new char[l.length() + c.length() + v.length() + 2]; int count = l.length(); l.getChars(0, count... | LogManagerProperties extends Properties { static String toLanguageTag(final Locale locale) { final String l = locale.getLanguage(); final String c = locale.getCountry(); final String v = locale.getVariant(); final char[] b = new char[l.length() + c.length() + v.length() + 2]; int count = l.length(); l.getChars(0, count... | LogManagerProperties extends Properties { static String toLanguageTag(final Locale locale) { final String l = locale.getLanguage(); final String c = locale.getCountry(); final String v = locale.getVariant(); final char[] b = new char[l.length() + c.length() + v.length() + 2]; int count = l.length(); l.getChars(0, count... |
@Test public void testIntDefProp() throws Exception { Properties defprops = new Properties(); defprops.setProperty("test", "2"); Properties props = new Properties(defprops); assertEquals(PropUtil.getIntProperty(props, "test", 1), 2); } | public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @Deprecated static ... | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @Deprecated static ... |
@Test public void testNewObjectFrom() throws Exception { try { LogManagerProperties.newObjectFrom((String) null, Object.class); fail("Null name was allowed."); } catch (NullPointerException expect) { } try { LogManagerProperties.newObjectFrom(Object.class.getName(), (Class<Object>) null); fail("Null class was allowed."... | static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetException ITE) { throw paramOrError(ITE); } } else... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... |
@Test public void testNewAuthenticator() throws Exception { Authenticator a = LogManagerProperties.newObjectFrom( EmptyAuthenticator.class.getName(), Authenticator.class); assertEquals(EmptyAuthenticator.class, a.getClass()); final Class<?> type = ErrorAuthenticator.class; a = LogManagerProperties.newObjectFrom( type.g... | static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetException ITE) { throw paramOrError(ITE); } } else... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... |
@Test public void testNewComparator() throws Exception { try { LogManagerProperties.newComparator(null); fail("Null was allowed."); } catch (NullPointerException expect) { } try { LogManagerProperties.newComparator(""); fail("Empty class was allowed."); } catch (ClassNotFoundException expect) { } try { LogManagerProper... | @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } | LogManagerProperties extends Properties { @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } } | LogManagerProperties extends Properties { @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSupe... | LogManagerProperties extends Properties { @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSupe... |
@Test public void testReverseOrder() throws Exception { try { LogManagerProperties.reverseOrder(null); fail("Null was allowed."); } catch (NullPointerException expect) { } Comparator<LogRecord> c = new ErrorComparator(); Comparator<LogRecord> r = LogManagerProperties.reverseOrder(c); assertTrue(c.getClass() != r.getCla... | @SuppressWarnings({"unchecked", "ThrowableResultIgnored"}) static <T> Comparator<T> reverseOrder(final Comparator<T> c) { if (c == null) { throw new NullPointerException(); } Comparator<T> reverse = null; try { final Method m = c.getClass().getMethod("reversed"); if (!Modifier.isStatic(m.getModifiers()) && Comparator.c... | LogManagerProperties extends Properties { @SuppressWarnings({"unchecked", "ThrowableResultIgnored"}) static <T> Comparator<T> reverseOrder(final Comparator<T> c) { if (c == null) { throw new NullPointerException(); } Comparator<T> reverse = null; try { final Method m = c.getClass().getMethod("reversed"); if (!Modifier.... | LogManagerProperties extends Properties { @SuppressWarnings({"unchecked", "ThrowableResultIgnored"}) static <T> Comparator<T> reverseOrder(final Comparator<T> c) { if (c == null) { throw new NullPointerException(); } Comparator<T> reverse = null; try { final Method m = c.getClass().getMethod("reversed"); if (!Modifier.... | LogManagerProperties extends Properties { @SuppressWarnings({"unchecked", "ThrowableResultIgnored"}) static <T> Comparator<T> reverseOrder(final Comparator<T> c) { if (c == null) { throw new NullPointerException(); } Comparator<T> reverse = null; try { final Method m = c.getClass().getMethod("reversed"); if (!Modifier.... | LogManagerProperties extends Properties { @SuppressWarnings({"unchecked", "ThrowableResultIgnored"}) static <T> Comparator<T> reverseOrder(final Comparator<T> c) { if (c == null) { throw new NullPointerException(); } Comparator<T> reverse = null; try { final Method m = c.getClass().getMethod("reversed"); if (!Modifier.... |
@Test public void testNewErrorManager() throws Exception { try { LogManagerProperties.newErrorManager(null); fail("Null was allowed."); } catch (NullPointerException expect) { } try { LogManagerProperties.newErrorManager(""); fail("Empty class was allowed."); } catch (ClassNotFoundException expect) { } try { LogManager... | static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } | LogManagerProperties extends Properties { static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } } | LogManagerProperties extends Properties { static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Overr... | LogManagerProperties extends Properties { static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Overr... |
@Test public void testNewFilter() throws Exception { try { LogManagerProperties.newFilter(null); fail("Null was allowed."); } catch (NullPointerException expect) { } try { LogManagerProperties.newFilter(""); fail("Empty class was allowed."); } catch (ClassNotFoundException expect) { } try { LogManagerProperties.newFilt... | static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } | LogManagerProperties extends Properties { static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } } | LogManagerProperties extends Properties { static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synchronized S... | LogManagerProperties extends Properties { static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synchronized S... |
@Test public void testNewFormatter() throws Exception { try { LogManagerProperties.newFormatter(null); fail("Null was allowed."); } catch (NullPointerException expect) { } try { LogManagerProperties.newFormatter(""); fail("Empty class was allowed."); } catch (ClassNotFoundException expect) { } try { LogManagerPropertie... | static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } | LogManagerProperties extends Properties { static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } } | LogManagerProperties extends Properties { static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synch... | LogManagerProperties extends Properties { static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synch... |
@Test public void testEscapingAuthenticator() throws Exception { try { Class<?> k = ErrorAuthenticator.class; javax.mail.Authenticator a; a = LogManagerProperties.newObjectFrom(k.getName(), Authenticator.class); assertEquals(k, a.getClass()); setPending(new ThreadDeath()); try { a = LogManagerProperties.newObjectFrom(k... | static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetException ITE) { throw paramOrError(ITE); } } else... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... | LogManagerProperties extends Properties { static <T> T newObjectFrom(String name, Class<T> type) throws Exception { try { final Class<?> clazz = LogManagerProperties.findClass(name); if (type.isAssignableFrom(clazz)) { try { return type.cast(clazz.getConstructor().newInstance()); } catch (final InvocationTargetExceptio... |
@Test public void testEscapingComparator() throws Exception { try { Class<?> k = ErrorComparator.class; Comparator<? super LogRecord> c; c = LogManagerProperties.newComparator(k.getName()); assertEquals(k, c.getClass()); setPending(new ThreadDeath()); try { c = LogManagerProperties.newComparator(k.getName()); fail(Stri... | @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } | LogManagerProperties extends Properties { @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } } | LogManagerProperties extends Properties { @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSupe... | LogManagerProperties extends Properties { @SuppressWarnings("unchecked") static Comparator<? super LogRecord> newComparator(String name) throws Exception { return newObjectFrom(name, Comparator.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSupe... |
@Test public void testEscapingErrorErrorManager() throws Exception { try { Class<?> k = ErrorErrorManager.class; ErrorManager f; f = LogManagerProperties.newErrorManager(k.getName()); assertEquals(k, f.getClass()); setPending(new ThreadDeath()); try { f = LogManagerProperties.newErrorManager(k.getName()); fail(String.v... | static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } | LogManagerProperties extends Properties { static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } } | LogManagerProperties extends Properties { static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Overr... | LogManagerProperties extends Properties { static ErrorManager newErrorManager(String name) throws Exception { return newObjectFrom(name, ErrorManager.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Overr... |
@Test public void testInteger() throws Exception { Properties props = new Properties(); props.put("test", 2); assertEquals(PropUtil.getIntProperty(props, "test", 1), 2); } | public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); } | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @Deprecated static ... | PropUtil { public static int getIntProperty(Properties props, String name, int def) { return getInt(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @Deprecated static ... |
@Test public void testEscapingFilter() throws Exception { try { Class<?> k = ErrorFilter.class; Filter f; f = LogManagerProperties.newFilter(k.getName()); assertEquals(k, f.getClass()); setPending(new ThreadDeath()); try { f = LogManagerProperties.newFilter(k.getName()); fail(String.valueOf(f)); } catch (ThreadDeath ex... | static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } | LogManagerProperties extends Properties { static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } } | LogManagerProperties extends Properties { static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synchronized S... | LogManagerProperties extends Properties { static Filter newFilter(String name) throws Exception { return newObjectFrom(name, Filter.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synchronized S... |
@Test public void testEscapingFormatter() throws Exception { try { Class<?> k = ErrorFormatter.class; Formatter f; f = LogManagerProperties.newFormatter(k.getName()); assertEquals(k, f.getClass()); setPending(new ThreadDeath()); try { f = LogManagerProperties.newFormatter(k.getName()); fail(String.valueOf(f)); } catch ... | static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } | LogManagerProperties extends Properties { static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } } | LogManagerProperties extends Properties { static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } LogManagerProperties(final Properties parent, final String prefix); } | LogManagerProperties extends Properties { static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synch... | LogManagerProperties extends Properties { static Formatter newFormatter(String name) throws Exception { return newObjectFrom(name, Formatter.class); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synch... |
@Test @SuppressWarnings("unchecked") public void testGetZonedDateTime() throws Exception { LogRecord r1 = new LogRecord(Level.SEVERE, ""); LogRecord r2 = new LogRecord(Level.SEVERE, ""); try { final Class<?> k = Class.forName("java.time.ZonedDateTime"); setEpochSecond(r1, 100, 1); setEpochSecond(r2, 100, 1); Comparable... | @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke(record), ZI_SYSTEM_DEFAULT.invoke((Object... | LogManagerProperties extends Properties { @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke... | LogManagerProperties extends Properties { @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke... | LogManagerProperties extends Properties { @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke... | LogManagerProperties extends Properties { @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke... |
@Test(expected=NullPointerException.class) public void testGetZonedDateTimeNull() throws Exception { LogManagerProperties.getZonedDateTime((LogRecord) null); } | @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke(record), ZI_SYSTEM_DEFAULT.invoke((Object... | LogManagerProperties extends Properties { @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke... | LogManagerProperties extends Properties { @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke... | LogManagerProperties extends Properties { @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke... | LogManagerProperties extends Properties { @SuppressWarnings("UseSpecificCatch") static Comparable<?> getZonedDateTime(LogRecord record) { if (record == null) { throw new NullPointerException(); } final Method m = ZDT_OF_INSTANT; if (m != null) { try { return (Comparable<?>) m.invoke((Object) null, LR_GET_INSTANT.invoke... |
@Test public void testIsLoggable() { final Level[] lvls = getAllLevels(); if (lvls.length > 0) { LogRecord record = new LogRecord(Level.INFO, ""); for (Level lvl : lvls) { testLoggable(lvl, null); testLoggable(lvl, record); } } else { fail("No predefined levels."); } } | @Override public boolean isLoggable(final LogRecord record) { int levelValue = getLevel().intValue(); if (record.getLevel().intValue() < levelValue || levelValue == offValue) { return false; } Filter body = getFilter(); if (body == null || body.isLoggable(record)) { setMatchedPart(-1); return true; } return isAttachmen... | MailHandler extends Handler { @Override public boolean isLoggable(final LogRecord record) { int levelValue = getLevel().intValue(); if (record.getLevel().intValue() < levelValue || levelValue == offValue) { return false; } Filter body = getFilter(); if (body == null || body.isLoggable(record)) { setMatchedPart(-1); ret... | MailHandler extends Handler { @Override public boolean isLoggable(final LogRecord record) { int levelValue = getLevel().intValue(); if (record.getLevel().intValue() < levelValue || levelValue == offValue) { return false; } Filter body = getFilter(); if (body == null || body.isLoggable(record)) { setMatchedPart(-1); ret... | MailHandler extends Handler { @Override public boolean isLoggable(final LogRecord record) { int levelValue = getLevel().intValue(); if (record.getLevel().intValue() < levelValue || levelValue == offValue) { return false; } Filter body = getFilter(); if (body == null || body.isLoggable(record)) { setMatchedPart(-1); ret... | MailHandler extends Handler { @Override public boolean isLoggable(final LogRecord record) { int levelValue = getLevel().intValue(); if (record.getLevel().intValue() < levelValue || levelValue == offValue) { return false; } Filter body = getFilter(); if (body == null || body.isLoggable(record)) { setMatchedPart(-1); ret... |
@Test public void testPostConstruct() { MailHandler instance = new MailHandler(createInitProperties("")); InternalErrorManager em = new InternalErrorManager(); instance.setErrorManager(em); instance.postConstruct(); assertEquals(true, em.exceptions.isEmpty()); instance.close(); } | public void postConstruct() { } | MailHandler extends Handler { public void postConstruct() { } } | MailHandler extends Handler { public void postConstruct() { } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { public void postConstruct() { } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); @Override void publish(final LogRecord record); void postConstruct(); void preDestroy(); void push(); @Override void ... | MailHandler extends Handler { public void postConstruct() { } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); @Override void publish(final LogRecord record); void postConstruct(); void preDestroy(); void push(); @Override void ... |
@Test public void testPreDestroy() { MailHandler instance = new MailHandler(createInitProperties("")); InternalErrorManager em = new InternalErrorManager(); instance.setErrorManager(em); instance.preDestroy(); assertEquals(true, em.exceptions.isEmpty()); instance.close(); instance = createHandlerWithRecords(); em = int... | public void preDestroy() { push(false, ErrorManager.CLOSE_FAILURE); } | MailHandler extends Handler { public void preDestroy() { push(false, ErrorManager.CLOSE_FAILURE); } } | MailHandler extends Handler { public void preDestroy() { push(false, ErrorManager.CLOSE_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { public void preDestroy() { push(false, ErrorManager.CLOSE_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); @Override void publish(final LogRecord record); void postConstruct(); void preD... | MailHandler extends Handler { public void preDestroy() { push(false, ErrorManager.CLOSE_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); @Override void publish(final LogRecord record); void postConstruct(); void preD... |
@Test public void testPublish() { MailHandler instance = createHandlerWithRecords(); InternalErrorManager em = internalErrorManagerFrom(instance); assertEquals(em.exceptions.isEmpty(), true); instance.close(); assertEquals(true, em.exceptions.get(0) instanceof MessagingException); assertEquals(1, em.exceptions.size());... | @Override public void publish(final LogRecord record) { if (tryMutex()) { try { if (isLoggable(record)) { record.getSourceMethodName(); publish0(record); } } catch (final LinkageError JDK8152515) { reportLinkageError(JDK8152515, ErrorManager.WRITE_FAILURE); } finally { releaseMutex(); } } else { reportUnPublishedError(... | MailHandler extends Handler { @Override public void publish(final LogRecord record) { if (tryMutex()) { try { if (isLoggable(record)) { record.getSourceMethodName(); publish0(record); } } catch (final LinkageError JDK8152515) { reportLinkageError(JDK8152515, ErrorManager.WRITE_FAILURE); } finally { releaseMutex(); } } ... | MailHandler extends Handler { @Override public void publish(final LogRecord record) { if (tryMutex()) { try { if (isLoggable(record)) { record.getSourceMethodName(); publish0(record); } } catch (final LinkageError JDK8152515) { reportLinkageError(JDK8152515, ErrorManager.WRITE_FAILURE); } finally { releaseMutex(); } } ... | MailHandler extends Handler { @Override public void publish(final LogRecord record) { if (tryMutex()) { try { if (isLoggable(record)) { record.getSourceMethodName(); publish0(record); } } catch (final LinkageError JDK8152515) { reportLinkageError(JDK8152515, ErrorManager.WRITE_FAILURE); } finally { releaseMutex(); } } ... | MailHandler extends Handler { @Override public void publish(final LogRecord record) { if (tryMutex()) { try { if (isLoggable(record)) { record.getSourceMethodName(); publish0(record); } } catch (final LinkageError JDK8152515) { reportLinkageError(JDK8152515, ErrorManager.WRITE_FAILURE); } finally { releaseMutex(); } } ... |
@Test public void testAlignEmptyFilter() throws Exception { String p = MailHandler.class.getName(); Properties props = createInitProperties(p); props.put(p.concat(".attachment.formatters"), SimpleFormatter.class.getName()); props.put(p.concat(".attachment.names"), "att.txt"); final LogManager manager = LogManager.getLo... | private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... |
@Test public void testAlignEmptyNames() throws Exception { String p = MailHandler.class.getName(); Properties props = createInitProperties(p); props.put(p.concat(".attachment.formatters"), SimpleFormatter.class.getName()); props.put(p.concat(".attachment.filters"), ErrorFilter.class.getName()); final LogManager manager... | private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... |
@Test public void testBool() throws Exception { Properties props = new Properties(); props.setProperty("test", "true"); assertTrue(PropUtil.getBooleanProperty(props, "test", false)); } | public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @De... | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @De... |
@Test public void testAlignEmptyFilterAndNames() throws Exception { String p = MailHandler.class.getName(); Properties props = createInitProperties(p); props.put(p.concat(".attachment.formatters"), SimpleFormatter.class.getName()); final LogManager manager = LogManager.getLogManager(); try { read(manager, props); testA... | private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... |
@Test public void testAlignErrorFilter() throws Exception { String p = MailHandler.class.getName(); Properties props = createInitProperties(p); props.put(p.concat(".attachment.formatters"), SimpleFormatter.class.getName() + ", " + SimpleFormatter.class.getName()); props.put(p.concat(".attachment.filters"), ErrorFilter.... | private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... |
@Test public void testAlignErrorNames() throws Exception { String p = MailHandler.class.getName(); Properties props = createInitProperties(p); props.put(p.concat(".attachment.formatters"), SimpleFormatter.class.getName()); props.put(p.concat(".attachment.names"), "att.txt, extra.txt"); final LogManager manager = LogMan... | private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... |
@Test public void testAlignErrorFilterAndNames() throws Exception { String p = MailHandler.class.getName(); Properties props = createInitProperties(p); props.put(p.concat(".attachment.formatters"), SimpleFormatter.class.getName() + ", " + SimpleFormatter.class.getName()); props.put(p.concat(".attachment.filters"), Erro... | private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... |
@Test public void testPush() { MailHandler instance = new MailHandler(createInitProperties("")); InternalErrorManager em = new InternalErrorManager(); instance.setErrorManager(em); instance.push(); assertEquals(true, em.exceptions.isEmpty()); instance.close(); instance = createHandlerWithRecords(); em = internalErrorMa... | public void push() { push(true, ErrorManager.FLUSH_FAILURE); } | MailHandler extends Handler { public void push() { push(true, ErrorManager.FLUSH_FAILURE); } } | MailHandler extends Handler { public void push() { push(true, ErrorManager.FLUSH_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { public void push() { push(true, ErrorManager.FLUSH_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); @Override void publish(final LogRecord record); void postConstruct(); void preDestroy(... | MailHandler extends Handler { public void push() { push(true, ErrorManager.FLUSH_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); @Override void publish(final LogRecord record); void postConstruct(); void preDestroy(... |
@Test public void testFlush() { MailHandler instance = new MailHandler(createInitProperties("")); InternalErrorManager em = new InternalErrorManager(); instance.setErrorManager(em); instance.flush(); assertEquals(true, em.exceptions.isEmpty()); instance.close(); instance = createHandlerWithRecords(); em = internalError... | @Override public void flush() { push(false, ErrorManager.FLUSH_FAILURE); } | MailHandler extends Handler { @Override public void flush() { push(false, ErrorManager.FLUSH_FAILURE); } } | MailHandler extends Handler { @Override public void flush() { push(false, ErrorManager.FLUSH_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { @Override public void flush() { push(false, ErrorManager.FLUSH_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); @Override void publish(final LogRecord record); void postConstruct(); void... | MailHandler extends Handler { @Override public void flush() { push(false, ErrorManager.FLUSH_FAILURE); } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); @Override void publish(final LogRecord record); void postConstruct(); void... |
@Test public void testClose() { LogRecord record = new LogRecord(Level.INFO, ""); MailHandler instance = new MailHandler(createInitProperties("")); InternalErrorManager em = new InternalErrorManager(); instance.setErrorManager(em); int capacity = instance.getCapacity(); assertNotNull(instance.getLevel()); instance.setL... | @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { this.data = new LogRecord[1]; thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... |
@Test public void testContentTypeOf() throws IOException { MailHandler instance = new MailHandler(createInitProperties("")); InternalErrorManager em = new InternalErrorManager(); instance.setErrorManager(em); instance.setEncoding((String) null); String head = instance.contentTypeOf(new XMLFormatter().getHead(instance))... | final String contentTypeOf(CharSequence chunk) { if (!isEmpty(chunk)) { final int MAX_CHARS = 25; if (chunk.length() > MAX_CHARS) { chunk = chunk.subSequence(0, MAX_CHARS); } try { final String charset = getEncodingName(); final byte[] b = chunk.toString().getBytes(charset); final ByteArrayInputStream in = new ByteArra... | MailHandler extends Handler { final String contentTypeOf(CharSequence chunk) { if (!isEmpty(chunk)) { final int MAX_CHARS = 25; if (chunk.length() > MAX_CHARS) { chunk = chunk.subSequence(0, MAX_CHARS); } try { final String charset = getEncodingName(); final byte[] b = chunk.toString().getBytes(charset); final ByteArra... | MailHandler extends Handler { final String contentTypeOf(CharSequence chunk) { if (!isEmpty(chunk)) { final int MAX_CHARS = 25; if (chunk.length() > MAX_CHARS) { chunk = chunk.subSequence(0, MAX_CHARS); } try { final String charset = getEncodingName(); final byte[] b = chunk.toString().getBytes(charset); final ByteArra... | MailHandler extends Handler { final String contentTypeOf(CharSequence chunk) { if (!isEmpty(chunk)) { final int MAX_CHARS = 25; if (chunk.length() > MAX_CHARS) { chunk = chunk.subSequence(0, MAX_CHARS); } try { final String charset = getEncodingName(); final byte[] b = chunk.toString().getBytes(charset); final ByteArra... | MailHandler extends Handler { final String contentTypeOf(CharSequence chunk) { if (!isEmpty(chunk)) { final int MAX_CHARS = 25; if (chunk.length() > MAX_CHARS) { chunk = chunk.subSequence(0, MAX_CHARS); } try { final String charset = getEncodingName(); final byte[] b = chunk.toString().getBytes(charset); final ByteArra... |
@Test public void testMailDebugLowCap() throws Exception { MailHandler instance = new MailHandler(1); try { testMailDebug(instance, 2); } finally { instance.close(); } } | @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { this.data = new LogRecord[1]; thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... |
@Test public void testMailDebugPush() throws Exception { MailHandler instance = new MailHandler(4); try { testMailDebug(instance, -3); } finally { instance.close(); } } | @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { this.data = new LogRecord[1]; thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... |
@Test public void testBoolDef() throws Exception { Properties props = new Properties(); assertTrue(PropUtil.getBooleanProperty(props, "test", true)); } | public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @De... | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @De... |
@Test public void testMailDebugFlush() throws Exception { MailHandler instance = new MailHandler(3); try { testMailDebug(instance, -2); } finally { instance.close(); } } | @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { this.data = new LogRecord[1]; thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... |
@Test public void testMailDebugClose() throws Exception { MailHandler instance = new MailHandler(1000); try { testMailDebug(instance, -1); } finally { instance.close(); } } | @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { this.data = new LogRecord[1]; thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... | MailHandler extends Handler { @Override public void close() { try { checkAccess(); Message msg = null; synchronized (this) { try { msg = writeLogRecords(ErrorManager.CLOSE_FAILURE); } finally { this.logLevel = Level.OFF; if (this.capacity > 0) { this.capacity = -this.capacity; } if (size == 0 && data.length != 1) { thi... |
@Test public void testReportError() { MailHandler instance = new MailHandler(createInitProperties("")); instance.setErrorManager(new ErrorManager() { @Override public void error(String msg, Exception ex, int code) { assertNull(msg); } }); instance.reportError(null, null, ErrorManager.GENERIC_FAILURE); instance.setError... | @Override protected void reportError(String msg, Exception ex, int code) { try { if (msg != null) { errorManager.error(Level.SEVERE.getName() .concat(": ").concat(msg), ex, code); } else { errorManager.error(null, ex, code); } } catch (RuntimeException | LinkageError GLASSFISH_21258) { reportLinkageError(GLASSFISH_2125... | MailHandler extends Handler { @Override protected void reportError(String msg, Exception ex, int code) { try { if (msg != null) { errorManager.error(Level.SEVERE.getName() .concat(": ").concat(msg), ex, code); } else { errorManager.error(null, ex, code); } } catch (RuntimeException | LinkageError GLASSFISH_21258) { rep... | MailHandler extends Handler { @Override protected void reportError(String msg, Exception ex, int code) { try { if (msg != null) { errorManager.error(Level.SEVERE.getName() .concat(": ").concat(msg), ex, code); } else { errorManager.error(null, ex, code); } } catch (RuntimeException | LinkageError GLASSFISH_21258) { rep... | MailHandler extends Handler { @Override protected void reportError(String msg, Exception ex, int code) { try { if (msg != null) { errorManager.error(Level.SEVERE.getName() .concat(": ").concat(msg), ex, code); } else { errorManager.error(null, ex, code); } } catch (RuntimeException | LinkageError GLASSFISH_21258) { rep... | MailHandler extends Handler { @Override protected void reportError(String msg, Exception ex, int code) { try { if (msg != null) { errorManager.error(Level.SEVERE.getName() .concat(": ").concat(msg), ex, code); } else { errorManager.error(null, ex, code); } } catch (RuntimeException | LinkageError GLASSFISH_21258) { rep... |
@Test public void testIsMissingContent() throws Exception { Properties props = createInitProperties(""); MailHandler target = new MailHandler(props); Session session = Session.getInstance(props); MimeMessage msg = new MimeMessage(session); Address[] from = InternetAddress.parse("me@localhost", false); msg.addFrom(from)... | @SuppressWarnings({"UseSpecificCatch", "ThrowableResultIgnored"}) final boolean isMissingContent(Message msg, Throwable t) { final Object ccl = getAndSetContextClassLoader(MAILHANDLER_LOADER); try { msg.writeTo(new ByteArrayOutputStream(MIN_HEADER_SIZE)); } catch (final RuntimeException RE) { throw RE; } catch (final E... | MailHandler extends Handler { @SuppressWarnings({"UseSpecificCatch", "ThrowableResultIgnored"}) final boolean isMissingContent(Message msg, Throwable t) { final Object ccl = getAndSetContextClassLoader(MAILHANDLER_LOADER); try { msg.writeTo(new ByteArrayOutputStream(MIN_HEADER_SIZE)); } catch (final RuntimeException RE... | MailHandler extends Handler { @SuppressWarnings({"UseSpecificCatch", "ThrowableResultIgnored"}) final boolean isMissingContent(Message msg, Throwable t) { final Object ccl = getAndSetContextClassLoader(MAILHANDLER_LOADER); try { msg.writeTo(new ByteArrayOutputStream(MIN_HEADER_SIZE)); } catch (final RuntimeException RE... | MailHandler extends Handler { @SuppressWarnings({"UseSpecificCatch", "ThrowableResultIgnored"}) final boolean isMissingContent(Message msg, Throwable t) { final Object ccl = getAndSetContextClassLoader(MAILHANDLER_LOADER); try { msg.writeTo(new ByteArrayOutputStream(MIN_HEADER_SIZE)); } catch (final RuntimeException RE... | MailHandler extends Handler { @SuppressWarnings({"UseSpecificCatch", "ThrowableResultIgnored"}) final boolean isMissingContent(Message msg, Throwable t) { final Object ccl = getAndSetContextClassLoader(MAILHANDLER_LOADER); try { msg.writeTo(new ByteArrayOutputStream(MIN_HEADER_SIZE)); } catch (final RuntimeException RE... |
@Test public void testIntern() throws Exception { assertNull(System.getSecurityManager()); final String p = MailHandler.class.getName(); Properties props = createInitProperties(p); props.put(p.concat(".errorManager"), InternFilterErrorManager.class.getName()); props.put(p.concat(".comparator"), InternFilterFormatterCom... | private void intern() { assert Thread.holdsLock(this); try { Object canidate; Object result; final Map<Object, Object> seen = new HashMap<>(); try { intern(seen, this.errorManager); } catch (final SecurityException se) { reportError(se.getMessage(), se, ErrorManager.OPEN_FAILURE); } try { canidate = this.filter; result... | MailHandler extends Handler { private void intern() { assert Thread.holdsLock(this); try { Object canidate; Object result; final Map<Object, Object> seen = new HashMap<>(); try { intern(seen, this.errorManager); } catch (final SecurityException se) { reportError(se.getMessage(), se, ErrorManager.OPEN_FAILURE); } try { ... | MailHandler extends Handler { private void intern() { assert Thread.holdsLock(this); try { Object canidate; Object result; final Map<Object, Object> seen = new HashMap<>(); try { intern(seen, this.errorManager); } catch (final SecurityException se) { reportError(se.getMessage(), se, ErrorManager.OPEN_FAILURE); } try { ... | MailHandler extends Handler { private void intern() { assert Thread.holdsLock(this); try { Object canidate; Object result; final Map<Object, Object> seen = new HashMap<>(); try { intern(seen, this.errorManager); } catch (final SecurityException se) { reportError(se.getMessage(), se, ErrorManager.OPEN_FAILURE); } try { ... | MailHandler extends Handler { private void intern() { assert Thread.holdsLock(this); try { Object canidate; Object result; final Map<Object, Object> seen = new HashMap<>(); try { intern(seen, this.errorManager); } catch (final SecurityException se) { reportError(se.getMessage(), se, ErrorManager.OPEN_FAILURE); } try { ... |
@Test public void testVerifyProperties() throws Exception { Properties props = createInitProperties(""); props.put("subject", "test"); props.put("verify", "limited"); InternalErrorManager em = new InternalErrorManager(); MailHandler instance = new MailHandler(); try { instance.setErrorManager(em); instance.setMailPrope... | private static void verifyProperties(Session session, String protocol) { session.getProperty("mail.from"); session.getProperty("mail." + protocol + ".from"); session.getProperty("mail.dsn.ret"); session.getProperty("mail." + protocol + ".dsn.ret"); session.getProperty("mail.dsn.notify"); session.getProperty("mail." + p... | MailHandler extends Handler { private static void verifyProperties(Session session, String protocol) { session.getProperty("mail.from"); session.getProperty("mail." + protocol + ".from"); session.getProperty("mail.dsn.ret"); session.getProperty("mail." + protocol + ".dsn.ret"); session.getProperty("mail.dsn.notify"); s... | MailHandler extends Handler { private static void verifyProperties(Session session, String protocol) { session.getProperty("mail.from"); session.getProperty("mail." + protocol + ".from"); session.getProperty("mail.dsn.ret"); session.getProperty("mail." + protocol + ".dsn.ret"); session.getProperty("mail.dsn.notify"); s... | MailHandler extends Handler { private static void verifyProperties(Session session, String protocol) { session.getProperty("mail.from"); session.getProperty("mail." + protocol + ".from"); session.getProperty("mail.dsn.ret"); session.getProperty("mail." + protocol + ".dsn.ret"); session.getProperty("mail.dsn.notify"); s... | MailHandler extends Handler { private static void verifyProperties(Session session, String protocol) { session.getProperty("mail.from"); session.getProperty("mail." + protocol + ".from"); session.getProperty("mail.dsn.ret"); session.getProperty("mail." + protocol + ".dsn.ret"); session.getProperty("mail.dsn.notify"); s... |
@Test public void testInitSubject() throws Exception { InternalErrorManager em; MailHandler target; final String p = MailHandler.class.getName(); final LogManager manager = LogManager.getLogManager(); Properties props = createInitProperties(p); props.put(p.concat(".errorManager"), InternalErrorManager.class.getName());... | private void initSubject(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".subject")); if (name == null) { name = "com.sun.mail.util.logging.CollectorFormatter"; } if (hasValue(name)) { try { this.subjectFormatter = LogManagerProperties.newFormatter(name); } catch (final SecurityE... | MailHandler extends Handler { private void initSubject(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".subject")); if (name == null) { name = "com.sun.mail.util.logging.CollectorFormatter"; } if (hasValue(name)) { try { this.subjectFormatter = LogManagerProperties.newFormatter(n... | MailHandler extends Handler { private void initSubject(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".subject")); if (name == null) { name = "com.sun.mail.util.logging.CollectorFormatter"; } if (hasValue(name)) { try { this.subjectFormatter = LogManagerProperties.newFormatter(n... | MailHandler extends Handler { private void initSubject(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".subject")); if (name == null) { name = "com.sun.mail.util.logging.CollectorFormatter"; } if (hasValue(name)) { try { this.subjectFormatter = LogManagerProperties.newFormatter(n... | MailHandler extends Handler { private void initSubject(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".subject")); if (name == null) { name = "com.sun.mail.util.logging.CollectorFormatter"; } if (hasValue(name)) { try { this.subjectFormatter = LogManagerProperties.newFormatter(n... |
@Test public void testInitAuthenticator() throws Exception { testInitAuthenticator("user", null); testInitAuthenticator("user", "null"); testInitAuthenticator("user", "NULL"); testInitAuthenticator("user", "Null"); testInitAuthenticator("user", ""); testInitAuthenticator("user", "somepassword"); } | private void initAuthenticator(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".authenticator")); if (name != null && !"null".equalsIgnoreCase(name)) { if (name.length() != 0) { try { this.auth = LogManagerProperties .newObjectFrom(name, Authenticator.class); } catch (final Secur... | MailHandler extends Handler { private void initAuthenticator(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".authenticator")); if (name != null && !"null".equalsIgnoreCase(name)) { if (name.length() != 0) { try { this.auth = LogManagerProperties .newObjectFrom(name, Authenticato... | MailHandler extends Handler { private void initAuthenticator(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".authenticator")); if (name != null && !"null".equalsIgnoreCase(name)) { if (name.length() != 0) { try { this.auth = LogManagerProperties .newObjectFrom(name, Authenticato... | MailHandler extends Handler { private void initAuthenticator(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".authenticator")); if (name != null && !"null".equalsIgnoreCase(name)) { if (name.length() != 0) { try { this.auth = LogManagerProperties .newObjectFrom(name, Authenticato... | MailHandler extends Handler { private void initAuthenticator(final String p) { assert Thread.holdsLock(this); String name = fromLogManager(p.concat(".authenticator")); if (name != null && !"null".equalsIgnoreCase(name)) { if (name.length() != 0) { try { this.auth = LogManagerProperties .newObjectFrom(name, Authenticato... |
@Test public void testInitAttachmentFilters() throws Exception { InternalErrorManager em; MailHandler target; final String p = MailHandler.class.getName(); final LogManager manager = LogManager.getLogManager(); final Properties props = createInitProperties(p); props.put(p.concat(".errorManager"), InternalErrorManager.c... | private void initAttachmentFilters(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.filters")); if (!isEmpty(list)) { final String[] names = list.split(","); Filter[] a = new Filter[names.length]; for (int i = 0; i < a.le... | MailHandler extends Handler { private void initAttachmentFilters(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.filters")); if (!isEmpty(list)) { final String[] names = list.split(","); Filter[] a = new Filter[names.len... | MailHandler extends Handler { private void initAttachmentFilters(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.filters")); if (!isEmpty(list)) { final String[] names = list.split(","); Filter[] a = new Filter[names.len... | MailHandler extends Handler { private void initAttachmentFilters(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.filters")); if (!isEmpty(list)) { final String[] names = list.split(","); Filter[] a = new Filter[names.len... | MailHandler extends Handler { private void initAttachmentFilters(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.filters")); if (!isEmpty(list)) { final String[] names = list.split(","); Filter[] a = new Filter[names.len... |
@Test public void testInitAttachmentNames() throws Exception { InternalErrorManager em; MailHandler target; final String p = MailHandler.class.getName(); final LogManager manager = LogManager.getLogManager(); Properties props = createInitProperties(p); props.put(p.concat(".errorManager"), InternalErrorManager.class.get... | private void initAttachmentNames(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.names")); if (!isEmpty(list)) { final String[] names = list.split(","); final Formatter[] a = new Formatter[names.length]; for (int i = 0; ... | MailHandler extends Handler { private void initAttachmentNames(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.names")); if (!isEmpty(list)) { final String[] names = list.split(","); final Formatter[] a = new Formatter[n... | MailHandler extends Handler { private void initAttachmentNames(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.names")); if (!isEmpty(list)) { final String[] names = list.split(","); final Formatter[] a = new Formatter[n... | MailHandler extends Handler { private void initAttachmentNames(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.names")); if (!isEmpty(list)) { final String[] names = list.split(","); final Formatter[] a = new Formatter[n... | MailHandler extends Handler { private void initAttachmentNames(final String p) { assert Thread.holdsLock(this); assert this.attachmentFormatters != null; final String list = fromLogManager(p.concat(".attachment.names")); if (!isEmpty(list)) { final String[] names = list.split(","); final Formatter[] a = new Formatter[n... |
@Test public void testBoolDefProp() throws Exception { Properties defprops = new Properties(); defprops.setProperty("test", "true"); Properties props = new Properties(defprops); assertTrue(PropUtil.getBooleanProperty(props, "test", false)); } | public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @De... | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @De... |
@Test public void testInitFromLogManager() throws Exception { final LogManager manager = LogManager.getLogManager(); synchronized (manager) { try { initGoodTest(MailHandler.class, new Class<?>[0], new Object[0]); initBadTest(MailHandler.class, new Class<?>[0], new Object[0]); initGoodTest(MailHandler.class, new Class<?... | private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); } | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... | MailHandler extends Handler { private void reset() { assert Thread.holdsLock(this); if (size < data.length) { Arrays.fill(data, 0, size, null); } else { Arrays.fill(data, null); } this.size = 0; } MailHandler(); MailHandler(final int capacity); MailHandler(final Properties props); @Override boolean isLoggable(final L... |
@Test public void testDeclaredClasses() throws Exception { Class<?>[] declared = SeverityComparator.class.getDeclaredClasses(); assertEquals(Arrays.toString(declared), 0, declared.length); } | private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2);... | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2);... |
@Test public void testApplyNull() { SeverityComparator a = new SeverityComparator(); assertNull(a.apply(null)); } | public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal = cause; } if (normal == null && cause instanceof Error) { high = ca... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... |
@Test public void testApplyErrorByNormal() { SeverityComparator a = new SeverityComparator(); Throwable next = this.headIeChain(new AssertionError()); next = new Error(next); next = new NoClassDefFoundError().initCause(next); Throwable reduced = a.apply(next); assertEquals(Error.class, reduced.getClass()); } | public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal = cause; } if (normal == null && cause instanceof Error) { high = ca... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... |
@Test(timeout = 30000) public void testApplyEvil() { SeverityComparator a = new SeverityComparator(); final int len = 7; final Class<? extends Throwable> type = Exception.class; Throwable l = a.apply(createEvilThrowable(type, len)); assertEquals(type, l.getClass()); } | public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal = cause; } if (normal == null && cause instanceof Error) { high = ca... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... |
@Test public void testApplyProxyNormal() { SeverityComparator a = new SeverityComparator(); Throwable next = this.headIeChain(new AssertionError()); next = new UndeclaredThrowableException(next); Throwable reduced = a.apply(next); assertEquals(InterruptedException.class, reduced.getClass()); } | public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal = cause; } if (normal == null && cause instanceof Error) { high = ca... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... |
@Test public void testApplyReflectNormal() { SeverityComparator a = new SeverityComparator(); Throwable next = this.headIeChain(new AssertionError()); next = new InvocationTargetException(next); Throwable reduced = a.apply(next); assertEquals(InterruptedException.class, reduced.getClass()); } | public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal = cause; } if (normal == null && cause instanceof Error) { high = ca... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... |
@Test public void testApplyNormalByNormal() { SeverityComparator a = new SeverityComparator(); Throwable next = this.headIeChain(new AssertionError()); next = new Error(next); next = this.headIioeChain(next); next = new ExecutionException(next); Throwable reduced = a.apply(next); assertEquals(InterruptedException.class... | public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal = cause; } if (normal == null && cause instanceof Error) { high = ca... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... |
@Test public void testApplyFindsRootCause() { SeverityComparator a = new SeverityComparator(); final Throwable root = new Exception(); Throwable next = root; for (int i = 0; i < 7; i++) { next = new RuntimeException(next); } Throwable reduced = a.apply(next); assertEquals(root, reduced); } | public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal = cause; } if (normal == null && cause instanceof Error) { high = ca... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public Throwable apply(final Throwable chain) { int limit = 0; Throwable root = chain; Throwable high = null; Throwable normal = null; for (Throwable cause = chain; cause != null; cause = cause.getCause()) { root = cause; if (isNormal(cause)) { normal ... |
@Test public void testCompareThrownDoesNotApply() { SeverityComparator a = new SeverityComparator(); Throwable tc1 = new Error(new Exception()); Throwable tc2 = new Exception(new Exception()); assertTrue(a.compareThrowable(tc1, tc2) > 0); assertTrue(a.compareThrowable(tc2, tc1) < 0); tc1 = new RuntimeException(tc1); as... | public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { return 0; } if (isNormal(t1)) { return isNormal(t2) ? 0 : -1; } else... | SeverityComparator implements Comparator<LogRecord>, Serializable { public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { ... |
@Test public void testBoolean() throws Exception { Properties props = new Properties(); props.put("test", true); assertTrue(PropUtil.getBooleanProperty(props, "test", false)); } | public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); } | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @De... | PropUtil { public static boolean getBooleanProperty(Properties props, String name, boolean def) { return getBoolean(getProp(props, name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String name, boolean def); @De... |
@Test public void testCompareThrownNull() { SeverityComparator a = new SeverityComparator(); assertEquals(0, a.compareThrowable((Throwable) null, (Throwable) null)); assertTrue(a.compareThrowable(new Throwable(), (Throwable) null) > 0); assertTrue(a.compareThrowable((Throwable) null, new Throwable()) < 0); } | public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { return 0; } if (isNormal(t1)) { return isNormal(t2) ? 0 : -1; } else... | SeverityComparator implements Comparator<LogRecord>, Serializable { public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public int compareThrowable(final Throwable t1, final Throwable t2) { if (t1 == t2) { return 0; } else { if (t1 == null) { return isNormal(t2) ? 1 : -1; } else { if (t2 == null) { return isNormal(t1) ? -1 : 1; } } if (t1.getClass() == t2.getClass()) { ... |
@Test public void testApplyThenCompareNull() { SeverityComparator a = new SeverityComparator(); assertEquals(0, a.applyThenCompare((Throwable) null, (Throwable) null)); } | public final int applyThenCompare(Throwable tc1, Throwable tc2) { return tc1 == tc2 ? 0 : compareThrowable(apply(tc1), apply(tc2)); } | SeverityComparator implements Comparator<LogRecord>, Serializable { public final int applyThenCompare(Throwable tc1, Throwable tc2) { return tc1 == tc2 ? 0 : compareThrowable(apply(tc1), apply(tc2)); } } | SeverityComparator implements Comparator<LogRecord>, Serializable { public final int applyThenCompare(Throwable tc1, Throwable tc2) { return tc1 == tc2 ? 0 : compareThrowable(apply(tc1), apply(tc2)); } } | SeverityComparator implements Comparator<LogRecord>, Serializable { public final int applyThenCompare(Throwable tc1, Throwable tc2) { return tc1 == tc2 ? 0 : compareThrowable(apply(tc1), apply(tc2)); } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowabl... | SeverityComparator implements Comparator<LogRecord>, Serializable { public final int applyThenCompare(Throwable tc1, Throwable tc2) { return tc1 == tc2 ? 0 : compareThrowable(apply(tc1), apply(tc2)); } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowabl... |
@Test public void testGetInstance() { SeverityComparator a = new SeverityComparator(); assertEquals(a, SeverityComparator.getInstance()); assertEquals(a.getClass(), SeverityComparator.getInstance().getClass()); assertEquals(a.hashCode(), SeverityComparator.getInstance().hashCode()); } | static SeverityComparator getInstance() { return (SeverityComparator) INSTANCE; } | SeverityComparator implements Comparator<LogRecord>, Serializable { static SeverityComparator getInstance() { return (SeverityComparator) INSTANCE; } } | SeverityComparator implements Comparator<LogRecord>, Serializable { static SeverityComparator getInstance() { return (SeverityComparator) INSTANCE; } } | SeverityComparator implements Comparator<LogRecord>, Serializable { static SeverityComparator getInstance() { return (SeverityComparator) INSTANCE; } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2); @Suppress... | SeverityComparator implements Comparator<LogRecord>, Serializable { static SeverityComparator getInstance() { return (SeverityComparator) INSTANCE; } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2); @Suppress... |
@Test public void testIsNormal() { SeverityComparator a = new SeverityComparator(); assertTrue(a.isNormal(this.headIeChain(null))); assertTrue(a.isNormal(this.headIioeChain(null))); assertTrue(a.isNormal(this.headCbieChain(null))); assertTrue(a.isNormal(this.headFlieChain(null))); assertTrue(a.isNormal(this.headSubIeCh... | public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) { if (c.getName().equals("java.lang.ThreadDeath")) { return true; } ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... |
@Test public void testIsNormalEvil() { SeverityComparator a = new SeverityComparator(); assertFalse(a.isNormal(createEvilThrowable(Exception.class, 7))); } | public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) { if (c.getName().equals("java.lang.ThreadDeath")) { return true; } ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... |
@Test public void testIsNormalDoesNotUseApply() { SeverityComparator a = new SeverityComparator(); Throwable next = this.headIeChain(new AssertionError()); next = new Error(next); next = this.headIioeChain(next); next = new ExecutionException(next); assertFalse(a.isNormal(next)); } | public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) { if (c.getName().equals("java.lang.ThreadDeath")) { return true; } ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... |
@Test public void testIsNormalNull() { SeverityComparator a = new SeverityComparator(); assertFalse(a.isNormal((Throwable) null)); } | public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) { if (c.getName().equals("java.lang.ThreadDeath")) { return true; } ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... | SeverityComparator implements Comparator<LogRecord>, Serializable { public boolean isNormal(final Throwable t) { if (t == null) { return false; } final Class<?> root = Throwable.class; final Class<?> error = Error.class; for (Class<?> c = t.getClass(); c != root; c = c.getSuperclass()) { if (error.isAssignableFrom(c)) ... |
@Test(expected = NullPointerException.class) public void testCompareNullAndNull() { SeverityComparator a = new SeverityComparator(); a.compare((LogRecord) null, (LogRecord) null); } | @SuppressWarnings("override") public int compare(final LogRecord o1, final LogRecord o2) { if (o1 == null || o2 == null) { throw new NullPointerException(toString(o1, o2)); } if (o1 == o2) { return 0; } int cmp = compare(o1.getLevel(), o2.getLevel()); if (cmp == 0) { cmp = applyThenCompare(o1.getThrown(), o2.getThrown(... | SeverityComparator implements Comparator<LogRecord>, Serializable { @SuppressWarnings("override") public int compare(final LogRecord o1, final LogRecord o2) { if (o1 == null || o2 == null) { throw new NullPointerException(toString(o1, o2)); } if (o1 == o2) { return 0; } int cmp = compare(o1.getLevel(), o2.getLevel()); ... | SeverityComparator implements Comparator<LogRecord>, Serializable { @SuppressWarnings("override") public int compare(final LogRecord o1, final LogRecord o2) { if (o1 == null || o2 == null) { throw new NullPointerException(toString(o1, o2)); } if (o1 == o2) { return 0; } int cmp = compare(o1.getLevel(), o2.getLevel()); ... | SeverityComparator implements Comparator<LogRecord>, Serializable { @SuppressWarnings("override") public int compare(final LogRecord o1, final LogRecord o2) { if (o1 == null || o2 == null) { throw new NullPointerException(toString(o1, o2)); } if (o1 == o2) { return 0; } int cmp = compare(o1.getLevel(), o2.getLevel()); ... | SeverityComparator implements Comparator<LogRecord>, Serializable { @SuppressWarnings("override") public int compare(final LogRecord o1, final LogRecord o2) { if (o1 == null || o2 == null) { throw new NullPointerException(toString(o1, o2)); } if (o1 == o2) { return 0; } int cmp = compare(o1.getLevel(), o2.getLevel()); ... |
@Test public void testLeadingErrorAndInterrupted() { LogRecord r1 = new LogRecord(Level.INFO, Level.INFO.toString()); LogRecord r2 = new LogRecord(Level.INFO, Level.INFO.toString()); swapSeq(r1, r2); assertEquals(r1.getLevel(), r2.getLevel()); assertTrue(r1.getSequenceNumber() > r2.getSequenceNumber()); r1.setThrown(he... | private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2);... | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2);... |
@Test public void testByLevel() { LogRecord r1 = new LogRecord(Level.INFO, Level.INFO.toString()); LogRecord r2 = new LogRecord(Level.WARNING, Level.WARNING.toString()); assertTrue(r1.getSequenceNumber() < r2.getSequenceNumber()); assertRecordLessThan(r1, r2); r1.setThrown(new Error()); r2.setThrown(null); assertRecord... | private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } } | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2);... | SeverityComparator implements Comparator<LogRecord>, Serializable { private static String toString(final Object o1, final Object o2) { return o1 + ", " + o2; } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2);... |
@Test @SuppressWarnings("deprecation") public void testSessionInt() throws Exception { Properties props = new Properties(); props.setProperty("test", "2"); Session sess = Session.getInstance(props, null); assertEquals(PropUtil.getIntSessionProperty(sess, "test", 1), 2); } | @Deprecated public static int getIntSessionProperty(Session session, String name, int def) { return getInt(getProp(session.getProperties(), name), def); } | PropUtil { @Deprecated public static int getIntSessionProperty(Session session, String name, int def) { return getInt(getProp(session.getProperties(), name), def); } } | PropUtil { @Deprecated public static int getIntSessionProperty(Session session, String name, int def) { return getInt(getProp(session.getProperties(), name), def); } private PropUtil(); } | PropUtil { @Deprecated public static int getIntSessionProperty(Session session, String name, int def) { return getInt(getProp(session.getProperties(), name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String nam... | PropUtil { @Deprecated public static int getIntSessionProperty(Session session, String name, int def) { return getInt(getProp(session.getProperties(), name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Properties props,
String nam... |
@Test public void testSplitWithMark() { final CompositeBuffer composite = CompositeBuffer.newBuffer( mm, Buffers.wrap(mm, "hello"), Buffers.wrap(mm, " world")); composite.position(4); composite.mark(); Buffer otherHalf = composite.split(6); assertMarkExceptionThrown(otherHalf); composite.reset(); otherHalf = composite.... | public static CompositeBuffer newBuffer() { return BuffersBuffer.create(); } | CompositeBuffer implements Buffer { public static CompositeBuffer newBuffer() { return BuffersBuffer.create(); } } | CompositeBuffer implements Buffer { public static CompositeBuffer newBuffer() { return BuffersBuffer.create(); } } | CompositeBuffer implements Buffer { public static CompositeBuffer newBuffer() { return BuffersBuffer.create(); } static CompositeBuffer newBuffer(); static CompositeBuffer newBuffer(final MemoryManager memoryManager); static CompositeBuffer newBuffer(final MemoryManager memoryManager,
final Buffer... buffe... | CompositeBuffer implements Buffer { public static CompositeBuffer newBuffer() { return BuffersBuffer.create(); } static CompositeBuffer newBuffer(); static CompositeBuffer newBuffer(final MemoryManager memoryManager); static CompositeBuffer newBuffer(final MemoryManager memoryManager,
final Buffer... buffe... |
@Test public void testNames() throws Exception { final String[] expectedNames = { "custom-before", "custom-before-2", "custom-after", "custom-after-2" }; Iterable<String> result = mimeHeaders.names(); List<String> list = new ArrayList<>(); for (String s : result) { list.add(s); } Assert.assertArrayEquals(expectedNames,... | public Iterable<String> names() { return namesIterable; } | MimeHeaders { public Iterable<String> names() { return namesIterable; } } | MimeHeaders { public Iterable<String> names() { return namesIterable; } MimeHeaders(); } | MimeHeaders { public Iterable<String> names() { return namesIterable; } MimeHeaders(); void mark(); void recycle(); void clear(); @Override String toString(); void copyFrom(final MimeHeaders source); int size(); int trailerSize(); DataChunk getName(int n); DataChunk getValue(int n); boolean isSerialized(int n); boolean... | MimeHeaders { public Iterable<String> names() { return namesIterable; } MimeHeaders(); void mark(); void recycle(); void clear(); @Override String toString(); void copyFrom(final MimeHeaders source); int size(); int trailerSize(); DataChunk getName(int n); DataChunk getValue(int n); boolean isSerialized(int n); boolean... |
@Test public void testTrailerNames() throws Exception { final String[] expectedNames = { "custom-after", "custom-after-2" }; Iterable<String> result = mimeHeaders.trailerNames(); List<String> list = new ArrayList<>(); for (String s : result) { list.add(s); } Assert.assertArrayEquals(expectedNames, list.toArray(new Stri... | public Iterable<String> trailerNames() { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new NamesIterator(MimeHeaders.this, true); } }; } | MimeHeaders { public Iterable<String> trailerNames() { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new NamesIterator(MimeHeaders.this, true); } }; } } | MimeHeaders { public Iterable<String> trailerNames() { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new NamesIterator(MimeHeaders.this, true); } }; } MimeHeaders(); } | MimeHeaders { public Iterable<String> trailerNames() { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new NamesIterator(MimeHeaders.this, true); } }; } MimeHeaders(); void mark(); void recycle(); void clear(); @Override String toString(); void copyFrom(final MimeHeaders source); i... | MimeHeaders { public Iterable<String> trailerNames() { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new NamesIterator(MimeHeaders.this, true); } }; } MimeHeaders(); void mark(); void recycle(); void clear(); @Override String toString(); void copyFrom(final MimeHeaders source); i... |
@Test public void testValues() throws Exception { final String[] expectedValuesSet1 = { "one", "two", "three" }; final String[] expectedValuesSet2 = { "one" }; Iterable<String> result = mimeHeaders.values("custom-before"); List<String> list = new ArrayList<>(); for (String s : result) { list.add(s); } Assert.assertArra... | public Iterable<String> values(final String name) { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new ValuesIterator(MimeHeaders.this, name, false); } }; } | MimeHeaders { public Iterable<String> values(final String name) { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new ValuesIterator(MimeHeaders.this, name, false); } }; } } | MimeHeaders { public Iterable<String> values(final String name) { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new ValuesIterator(MimeHeaders.this, name, false); } }; } MimeHeaders(); } | MimeHeaders { public Iterable<String> values(final String name) { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new ValuesIterator(MimeHeaders.this, name, false); } }; } MimeHeaders(); void mark(); void recycle(); void clear(); @Override String toString(); void copyFrom(final Mim... | MimeHeaders { public Iterable<String> values(final String name) { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new ValuesIterator(MimeHeaders.this, name, false); } }; } MimeHeaders(); void mark(); void recycle(); void clear(); @Override String toString(); void copyFrom(final Mim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.