method2testcases
stringlengths
118
6.63k
### Question: POP3Store extends Store { @Override public synchronized boolean isConnected() { if (!super.isConnected()) return false; try { if (port == null) port = getPort(null); else if (!port.noop()) throw new IOException("NOOP failed"); return true; } catch (IOException ioex) { try { super.close(); } catch (Messagi...
### Question: 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, ...
### Question: SeverityComparator implements Comparator<LogRecord>, Serializable { @Override public boolean equals(final Object o) { return o == null ? false : o.getClass() == getClass(); } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throw...
### Question: SeverityComparator implements Comparator<LogRecord>, Serializable { @Override public int hashCode() { return 31 * getClass().hashCode(); } Throwable apply(final Throwable chain); final int applyThenCompare(Throwable tc1, Throwable tc2); int compareThrowable(final Throwable t1, final Throwable t2); @Suppr...
### Question: CompactFormatter extends java.util.logging.Formatter { @Override public String formatMessage(final LogRecord record) { String msg = super.formatMessage(record); msg = replaceClassName(msg, record.getThrown()); msg = replaceClassName(msg, record.getParameters()); return msg; } CompactFormatter(); CompactF...
### Question: PropUtil { @Deprecated public static boolean getBooleanSessionProperty(Session session, String name, boolean def) { return getBoolean(getProp(session.getProperties(), name), def); } private PropUtil(); static int getIntProperty(Properties props, String name, int def); static boolean getBooleanProperty(Pr...
### Question: CompactFormatter extends java.util.logging.Formatter { public String formatLevel(final LogRecord record) { return record.getLevel().getLocalizedName(); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRec...
### Question: CompactFormatter extends java.util.logging.Formatter { public String formatLoggerName(final LogRecord record) { return simpleClassName(record.getLoggerName()); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(fina...
### Question: CompactFormatter extends java.util.logging.Formatter { public String formatSource(final LogRecord record) { String source = record.getSourceClassName(); if (source != null) { if (record.getSourceMethodName() != null) { source = simpleClassName(source) + " " + record.getSourceMethodName(); } else { source ...
### Question: CompactFormatter extends java.util.logging.Formatter { public String formatThrown(final LogRecord record) { String msg; final Throwable t = record.getThrown(); if (t != null) { String site = formatBackTrace(record); msg = formatMessage(t) + (isNullOrSpaces(site) ? "" : ' ' + site); } else { msg = ""; } re...
### Question: CompactFormatter extends java.util.logging.Formatter { public Number formatThreadID(final LogRecord record) { return (((long) record.getThreadID()) & 0xffffffffL); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(...
### Question: CompactFormatter extends java.util.logging.Formatter { public String formatError(final LogRecord record) { return formatMessage(record.getThrown()); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRecord...
### Question: PropUtil { public static boolean getBooleanSystemProperty(String name, boolean def) { try { return getBoolean(getProp(System.getProperties(), name), def); } catch (SecurityException sex) { } try { String value = System.getProperty(name); if (value == null) return def; if (def) return !value.equalsIgnoreCa...
### Question: CompactFormatter extends java.util.logging.Formatter { protected Throwable apply(final Throwable t) { return SeverityComparator.getInstance().apply(t); } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRec...
### Question: 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); @Depr...
### Question: CompactFormatter extends java.util.logging.Formatter { protected String toAlternate(final String s) { return s != null ? s.replaceAll("[\\x00-\\x1F\\x7F]+", "") : null; } CompactFormatter(); CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMes...
### Question: CollectorFormatter extends Formatter { @Override public String toString() { String result; try { result = formatRecord((Handler) null, false); } catch (final RuntimeException ignore) { result = super.toString(); } return result; } CollectorFormatter(); CollectorFormatter(String format); CollectorFormatt...
### Question: LogManagerProperties extends Properties { static void checkLogManagerAccess() { boolean checked = false; final Object m = LOG_MANAGER; if (m != null) { try { if (m instanceof LogManager) { checked = true; ((LogManager) m).checkAccess(); } } catch (final SecurityException notAllowed) { if (checked) { throw...
### Question: CollectorFormatter extends Formatter { @Override public String format(final LogRecord record) { if (record == null) { throw new NullPointerException(); } boolean accepted; do { final LogRecord peek = peek(); LogRecord update = apply(peek != null ? peek : record, record); if (peek != update) { update.getSo...
### Question: CollectorFormatter extends Formatter { @Override public String getTail(final Handler h) { super.getTail(h); return formatRecord(h, true); } CollectorFormatter(); CollectorFormatter(String format); CollectorFormatter(String format, Formatter f, Comparator<? super LogRecord> c); @Override Stri...
### Question: LogManagerProperties extends Properties { @Override @SuppressWarnings("CloneDoesntCallSuperClone") public synchronized Object clone() { return exportCopy(defaults); } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized O...
### Question: DurationFilter implements Filter { @Override public String toString() { boolean idle; boolean loggable; synchronized (this) { final long millis = System.currentTimeMillis(); idle = test(0L, millis); loggable = test(records, millis); } return getClass().getName() + "{records=" + records + ", duration=" + d...
### Question: LogManagerProperties extends Properties { static boolean isReflectionClass(String name) throws Exception { String[] names = REFLECT_NAMES; if (names == null) { REFLECT_NAMES = names = reflectionClassNames(); } for (String rf : names) { if (name.equals(rf)) { return true; } } findClass(name); return false;...
### Question: DurationFilter implements Filter { @Override protected DurationFilter clone() throws CloneNotSupportedException { final DurationFilter clone = (DurationFilter) super.clone(); clone.count = 0L; clone.peak = 0L; clone.start = 0L; return clone; } DurationFilter(); DurationFilter(final long records, final lo...
### Question: DurationFilter implements Filter { @SuppressWarnings("override") public boolean isLoggable(final LogRecord record) { return accept(record.getMillis()); } DurationFilter(); DurationFilter(final long records, final long duration); @Override boolean equals(final Object obj); boolean isIdle(); @Override int ...
### Question: DurationFilter implements Filter { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final DurationFilter other = (DurationFilter) obj; if (this.records != other.records) { return false; } if (this.durat...
### Question: DurationFilter implements Filter { @Override public int hashCode() { int hash = 3; hash = 89 * hash + (int) (this.records ^ (this.records >>> 32)); hash = 89 * hash + (int) (this.duration ^ (this.duration >>> 32)); return hash; } DurationFilter(); DurationFilter(final long records, final long duration); ...
### Question: LineInputStream extends FilterInputStream { @SuppressWarnings("deprecation") public String readLine() throws IOException { byte[] buf = lineBuffer; if (buf == null) buf = lineBuffer = new byte[128]; int c1; int room = buf.length; int offset = 0; while ((c1 = in.read()) != -1) { if (c1 == '\n') break; else...
### Question: WriteTimeoutSocket extends Socket { @Override public String toString() { return socket.toString(); } WriteTimeoutSocket(Socket socket, int timeout); WriteTimeoutSocket(int timeout); WriteTimeoutSocket(InetAddress address, int port, int timeout); WriteTimeoutSocket(InetAddress address, int port, Inet...
### Question: Response { public String readAtom() { return readDelimString(ATOM_CHAR_DELIM); } Response(String s); Response(String s, boolean supportsUtf8); Response(Protocol p); Response(Response r); static Response byeResponse(Exception ex); boolean supportsUtf8(); void skipSpaces(); boolean isNextNonSpace(char c)...
### Question: Response { public String readAtomString() { return (String)parseString(true, true); } Response(String s); Response(String s, boolean supportsUtf8); Response(Protocol p); Response(Response r); static Response byeResponse(Exception ex); boolean supportsUtf8(); void skipSpaces(); boolean isNextNonSpace(ch...
### Question: Response { public String[] readAtomStringList() { return readStringList(true); } Response(String s); Response(String s, boolean supportsUtf8); Response(Protocol p); Response(Response r); static Response byeResponse(Exception ex); boolean supportsUtf8(); void skipSpaces(); boolean isNextNonSpace(char c)...
### Question: 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 NoSuchMeth...
### Question: Response { public String[] readStringList() { return readStringList(false); } Response(String s); Response(String s, boolean supportsUtf8); Response(Protocol p); Response(Response r); static Response byeResponse(Exception ex); boolean supportsUtf8(); void skipSpaces(); boolean isNextNonSpace(char c); v...
### Question: Protocol { public String writeCommand(String command, Argument args) throws IOException, ProtocolException { String tag = tagPrefix + Integer.toString(tagCounter++); output.writeBytes(tag + " " + command); if (args != null) { output.write(' '); args.write(this); } output.write(CRLF); output.flush(); retur...
### Question: ResponseInputStream { public ByteArray readResponse() throws IOException { return readResponse(null); } ResponseInputStream(InputStream in); ByteArray readResponse(); ByteArray readResponse(ByteArray ba); int available(); }### Answer: @Test public void testEofWhileReadingLiteral() throws Exception { Byte...
### Question: IMAPStore extends Store implements QuotaAwareStore, ResponseHandler { @Override public Folder[] getSharedNamespaces() throws MessagingException { Namespaces ns = getNamespaces(); if (ns == null || ns.shared == null) return super.getSharedNamespaces(); return namespaceToFolders(ns.shared, null); } IMAPStor...
### Question: IMAPStore extends Store implements QuotaAwareStore, ResponseHandler { @Override public synchronized Folder getFolder(String name) throws MessagingException { checkConnected(); return newIMAPFolder(name, IMAPFolder.UNKNOWN_SEPARATOR); } IMAPStore(Session session, URLName url); protected IMAPStore(Session ...
### Question: IMAPMessage extends MimeMessage implements ReadableMime { @Override public int getSize() throws MessagingException { checkExpunged(); if (size == -1) loadEnvelope(); if (size > Integer.MAX_VALUE) return Integer.MAX_VALUE; else return (int)size; } protected IMAPMessage(IMAPFolder folder, int msgnum); prot...
### Question: ContentType { public boolean match(ContentType cType) { if (!((primaryType == null && cType.getPrimaryType() == null) || (primaryType != null && primaryType.equalsIgnoreCase(cType.getPrimaryType())))) return false; String sType = cType.getSubType(); if ((subType != null && subType.startsWith("*")) || (sTy...
### Question: MimeBodyPart extends BodyPart implements MimePart { @Override public void setDataHandler(DataHandler dh) throws MessagingException { this.dh = dh; cachedContent = null; MimeBodyPart.invalidateContentHeaders(this); } MimeBodyPart(); MimeBodyPart(InputStream is); MimeBodyPart(InternetHeaders headers, byte...
### Question: MimeBodyPart extends BodyPart implements MimePart { @Override public boolean isMimeType(String mimeType) throws MessagingException { return isMimeType(this, mimeType); } MimeBodyPart(); MimeBodyPart(InputStream is); MimeBodyPart(InternetHeaders headers, byte[] content); @Override int getSize(); @Overrid...
### Question: MailDateFormat extends SimpleDateFormat { @Override public StringBuffer format(Date date, StringBuffer dateStrBuf, FieldPosition fieldPosition) { return super.format(date, dateStrBuf, fieldPosition); } MailDateFormat(); @Override MailDateFormat clone(); @Override StringBuffer format(Date date, StringBuffe...
### Question: 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...
### Question: 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 dateStrB...
### Question: 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, Strin...
### Question: 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, ...
### Question: 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 ...
### Question: 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(...
### Question: 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 getAddressHead...
### Question: 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 fold...
### Question: 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); M...
### Question: 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 ...
### Question: 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 nam...
### Question: 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 g...
### Question: 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.isSt...
### Question: 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)) { v...
### Question: 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(fina...
### Question: 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 @SuppressWarning...
### Question: 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 sup...
### Question: 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 synch...
### Question: 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.get...
### Question: 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("Clone...
### Question: 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"); ...
### Question: 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 c...
### Question: 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 ...
### Question: 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(); @...
### Question: 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_...
### Question: 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)) { setMatche...
### Question: 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(); @...
### Question: 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 postConstruc...
### Question: 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 { releas...
### Question: 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, boo...
### Question: 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(); vo...
### Question: 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 postCon...
### Question: 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.leng...
### Question: 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 GLASSFIS...
### Question: 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 Runti...
### Question: 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....
### Question: 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...
### Question: 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(cau...
### Question: 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....
### Question: 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 c...
### Question: 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 ...
### Question: 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.isAssig...
### Question: 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...
### Question: 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(i...
### Question: 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 MimeHead...
### Question: 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 copy...
### Question: MimeHeaders { public Iterable<String> trailerValues(final String name) { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new ValuesIterator(MimeHeaders.this, name, true); } }; } MimeHeaders(); void mark(); void recycle(); void clear(); @Override String toString(); voi...
### Question: ApacheLogFormat implements AccessLogFormat { public String getFormat() { final StringBuilder builder = new StringBuilder(); for (Field field: fields) builder.append(field.toString()); return builder.toString(); } ApacheLogFormat(String format); ApacheLogFormat(TimeZone timeZone, String format); @Override...
### Question: CompressionEncodingFilter implements EncodingFilter { @Override public boolean applyDecoding(final HttpHeader httpPacket) { if(! httpPacket.isRequest()) { return false; } assert httpPacket instanceof HttpRequestPacket; return canDecompressHttpRequest((HttpRequestPacket) httpPacket, compressionConfig, alia...
### Question: CompositeBuffer implements Buffer { public abstract int bulk(BulkOperation operation); static CompositeBuffer newBuffer(); static CompositeBuffer newBuffer(final MemoryManager memoryManager); static CompositeBuffer newBuffer(final MemoryManager memoryManager, final Buffer... buffers); static ...
### Question: PooledMemoryManager implements MemoryManager<Buffer>, WrapperAware { Pool[] getPools() { return Arrays.copyOf(pools, pools.length); } PooledMemoryManager(); @SuppressWarnings("unused") PooledMemoryManager(final boolean isDirect); PooledMemoryManager( final int baseBufferSize, fin...
### Question: FileTransfer implements WritableMessage { @Override public int remaining() { return ((len > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) len); } FileTransfer(final File f); FileTransfer(final File f, final long pos, final long len); long writeTo(final WritableByteChannel c); @Override boolean hasRemain...
### Question: AbstractSupplier implements Observer, Supplier<T> { @Override public void onResume() { this.logger().log(Level.INFO, "On Resume"); dataManager().addObserver(this); this.logger().log(Level.INFO, "Syncstatus: " + this.dataManager().getSyncStatus()); switch (dataManager().getSyncStatus()) { case NOT_SYNCED: ...
### Question: OneDayFilter implements Filter<Transaction> { @Override public boolean shouldBeRemoved(Transaction t) { return getZeroTimeDate(t.booking().getDate()).compareTo(this.day) != 0; } OneDayFilter(Date day); @Override boolean shouldBeRemoved(Transaction t); }### Answer: @Test public void teste_filter_withNotMa...
### Question: ItemCheckedMap implements Filter<Transaction> { public boolean hasItemsChecked() { Boolean ret = false; Iterator iterator = this.map.entrySet().iterator(); while (iterator.hasNext() && !ret) { Map.Entry entry = (Map.Entry) iterator.next(); ret = (Boolean) entry.getValue(); } return ret; } ItemCheckedMap(H...
### Question: ItemCheckedMap implements Filter<Transaction> { public boolean shouldBePresented(String bankAccountID) { return this.map.containsKey(bankAccountID) && this.map.get(bankAccountID).booleanValue(); } ItemCheckedMap(HashMap<String, Boolean> map); boolean hasItemsChecked(); boolean shouldBePresented(String ban...
### Question: ItemCheckedMap implements Filter<Transaction> { @Override public boolean shouldBeRemoved(Transaction t) { if (this.map.isEmpty()) { return false; } boolean shouldStay = shouldBePresented(t.bankAccountID()); return !shouldStay; } ItemCheckedMap(HashMap<String, Boolean> map); boolean hasItemsChecked(); bool...