_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q171000
Buffer.writeTo
test
public void writeTo(final OutputStream out, final HttpProgressListener progressListener) throws IOException { // start final int size = size(); final int callbackSize = progressListener.callbackSize(size); int count = 0; // total count int step = 0; // step is offset in current chunk progressListener.t...
java
{ "resource": "" }
q171001
JsonObject.getString
test
public String getString(final String key) { CharSequence cs = (CharSequence) map.get(key); return cs == null ? null : cs.toString(); }
java
{ "resource": "" }
q171002
JsonObject.getInteger
test
public Integer getInteger(final String key) { Number number = (Number) map.get(key); if (number == null) { return null; } if (number instanceof Integer) { return (Integer) number; } return number.intValue(); }
java
{ "resource": "" }
q171003
JsonObject.getLong
test
public Long getLong(final String key) { Number number = (Number) map.get(key); if (number == null) { return null; } if (number instanceof Long) { return (Long) number; } return number.longValue(); }
java
{ "resource": "" }
q171004
JsonObject.getDouble
test
public Double getDouble(final String key) { Number number = (Number) map.get(key); if (number == null) { return null; } if (number instanceof Double) { return (Double) number; } return number.doubleValue(); }
java
{ "resource": "" }
q171005
JsonObject.getFloat
test
public Float getFloat(final String key) { Number number = (Number) map.get(key); if (number == null) { return null; } if (number instanceof Float) { return (Float) number; } return number.floatValue(); }
java
{ "resource": "" }
q171006
JsonObject.getValue
test
@SuppressWarnings("unchecked") public <T> T getValue(final String key) { T val = (T) map.get(key); if (val instanceof Map) { return (T) new JsonObject((Map) val); } if (val instanceof List) { return (T) new JsonArray((List) val); } return val; }
java
{ "resource": "" }
q171007
JsonObject.put
test
public JsonObject put(final String key, final String value) { Objects.requireNonNull(key); map.put(key, value); return this; }
java
{ "resource": "" }
q171008
ReceiveMailSession.useFolder
test
public void useFolder(final String folderName) { closeFolderIfOpened(folder); try { this.folderName = folderName; this.folder = getService().getFolder(folderName); try { folder.open(Folder.READ_WRITE); } catch (final MailException ignore) { folder.open(Folder.READ_ONLY); } } catch (final M...
java
{ "resource": "" }
q171009
ReceiveMailSession.receiveMessages
test
ReceivedEmail[] receiveMessages( final EmailFilter filter, final Flags flagsToSet, final Flags flagsToUnset, final boolean envelope, final Consumer<Message[]> processedMessageConsumer) { useAndOpenFolderIfNotSet(); final Message[] messages; try { if (filter == null) { messages = folder.get...
java
{ "resource": "" }
q171010
ReceiveMailSession.updateEmailFlags
test
public void updateEmailFlags(final ReceivedEmail receivedEmail) { useAndOpenFolderIfNotSet(); try { folder.setFlags(new int[] {receivedEmail.messageNumber()}, receivedEmail.flags(),true); } catch (MessagingException mex) { throw new MailException("Failed to fetch messages", mex); } }
java
{ "resource": "" }
q171011
ReceiveMailSession.closeFolderIfOpened
test
protected void closeFolderIfOpened(final Folder folder) { if (folder != null) { try { folder.close(true); } catch (final MessagingException ignore) { } } }
java
{ "resource": "" }
q171012
DbQueryParser.lookupNamedParameter
test
DbQueryNamedParameter lookupNamedParameter(final String name) { DbQueryNamedParameter p = rootNP; while (p != null) { if (p.equalsName(name)) { return p; } p = p.next; } return null; }
java
{ "resource": "" }
q171013
AppAction.alias
test
protected String alias(final String target) { return StringPool.LEFT_CHEV.concat(target).concat(StringPool.RIGHT_CHEV); }
java
{ "resource": "" }
q171014
AppAction.validateAction
test
protected boolean validateAction(final String... profiles) { prepareValidator(); vtor.useProfiles(profiles); vtor.validate(this); vtor.resetProfiles(); List<Violation> violations = vtor.getViolations(); return violations == null; }
java
{ "resource": "" }
q171015
AppAction.addViolation
test
protected void addViolation(final String name, final Object invalidValue) { prepareValidator(); vtor.addViolation(new Violation(name, this, invalidValue)); }
java
{ "resource": "" }
q171016
RawData.as
test
public RawData as(final String mimeOrExtension) { if (mimeOrExtension.contains(StringPool.SLASH)) { this.mimeType = mimeOrExtension; } else { this.mimeType = MimeTypes.getMimeType(mimeOrExtension); } return this; }
java
{ "resource": "" }
q171017
RawData.downloadableAs
test
public RawData downloadableAs(final String downloadFileName) { this.downloadFileName = downloadFileName; this.mimeType = MimeTypes.getMimeType(FileNameUtil.getExtension(downloadFileName)); return this; }
java
{ "resource": "" }
q171018
ProxettaFactory.setTarget
test
protected T setTarget(final InputStream target) { assertTargetIsNotDefined(); targetInputStream = target; targetClass = null; targetClassName = null; return _this(); }
java
{ "resource": "" }
q171019
ProxettaFactory.setTarget
test
protected T setTarget(final String targetName) { assertTargetIsNotDefined(); try { targetInputStream = ClassLoaderUtil.getClassAsStream(targetName); if (targetInputStream == null) { throw new ProxettaException("Target class not found: " + targetName); } targetClassName = targetName; targetClass ...
java
{ "resource": "" }
q171020
ProxettaFactory.setTarget
test
public T setTarget(final Class target) { assertTargetIsNotDefined(); try { targetInputStream = ClassLoaderUtil.getClassAsStream(target); if (targetInputStream == null) { throw new ProxettaException("Target class not found: " + target.getName()); } targetClass = target; targetClassName = target.g...
java
{ "resource": "" }
q171021
ProxettaFactory.process
test
protected void process() { if (targetInputStream == null) { throw new ProxettaException("Target missing: " + targetClassName); } // create class reader final ClassReader classReader; try { classReader = new ClassReader(targetInputStream); } catch (IOException ioex) { throw new ProxettaException("Er...
java
{ "resource": "" }
q171022
ProxettaFactory.create
test
public byte[] create() { process(); byte[] result = toByteArray(); dumpClassInDebugFolder(result); if ((!proxetta.isForced()) && (!isProxyApplied())) { if (log.isDebugEnabled()) { log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName)); } return null; } if (log.isDebugEn...
java
{ "resource": "" }
q171023
ProxettaFactory.define
test
public Class define() { process(); if ((!proxetta.isForced()) && (!isProxyApplied())) { if (log.isDebugEnabled()) { log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName)); } if (targetClass != null) { return targetClass; } if (targetClassName != null) { try { ...
java
{ "resource": "" }
q171024
ProxettaFactory.newInstance
test
public Object newInstance() { Class type = define(); try { return ClassUtil.newInstance(type); } catch (Exception ex) { throw new ProxettaException("Invalid Proxetta class", ex); } }
java
{ "resource": "" }
q171025
ProxettaFactory.dumpClassInDebugFolder
test
protected void dumpClassInDebugFolder(final byte[] bytes) { File debugFolder = proxetta.getDebugFolder(); if (debugFolder == null) { return; } if (!debugFolder.exists() || !debugFolder.isDirectory()) { log.warn("Invalid debug folder: " + debugFolder); } String fileName = proxyClassName; if (fileNa...
java
{ "resource": "" }
q171026
CommonEmail.from
test
public T from(final String personalName, final String from) { return from(new EmailAddress(personalName, from)); }
java
{ "resource": "" }
q171027
CommonEmail.to
test
public T to(final EmailAddress to) { this.to = ArraysUtil.append(this.to, to); return _this(); }
java
{ "resource": "" }
q171028
CommonEmail.to
test
public T to(final String personalName, final String to) { return to(new EmailAddress(personalName, to)); }
java
{ "resource": "" }
q171029
CommonEmail.replyTo
test
public T replyTo(final EmailAddress... replyTo) { this.replyTo = ArraysUtil.join(this.replyTo, valueOrEmptyArray(replyTo)); return _this(); }
java
{ "resource": "" }
q171030
CommonEmail.cc
test
public T cc(final EmailAddress... ccs) { this.cc = ArraysUtil.join(this.cc, valueOrEmptyArray(ccs)); return _this(); }
java
{ "resource": "" }
q171031
CommonEmail.textMessage
test
public T textMessage(final String text, final String encoding) { return message(new EmailMessage(text, MimeTypes.MIME_TEXT_PLAIN, encoding)); }
java
{ "resource": "" }
q171032
CommonEmail.htmlMessage
test
public T htmlMessage(final String html, final String encoding) { return message(new EmailMessage(html, MimeTypes.MIME_TEXT_HTML, encoding)); }
java
{ "resource": "" }
q171033
CommonEmail.header
test
public T header(final String name, final String value) { headers.put(name, value); return _this(); }
java
{ "resource": "" }
q171034
SystemUtil.get
test
public static String get(final String name, final String defaultValue) { Objects.requireNonNull(name); String value = null; try { if (System.getSecurityManager() == null) { value = System.getProperty(name); } else { value = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getPr...
java
{ "resource": "" }
q171035
SystemUtil.getBoolean
test
public static boolean getBoolean(final String name, final boolean defaultValue) { String value = get(name); if (value == null) { return defaultValue; } value = value.trim().toLowerCase(); switch (value) { case "true" : case "yes" : case "1" : case "on" : return true; case "false"...
java
{ "resource": "" }
q171036
SystemUtil.getInt
test
public static long getInt(final String name, final int defaultValue) { String value = get(name); if (value == null) { return defaultValue; } value = value.trim().toLowerCase(); try { return Integer.parseInt(value); } catch (NumberFormatException nfex) { return defaultValue; } }
java
{ "resource": "" }
q171037
SystemUtil.getLong
test
public static long getLong(final String name, final long defaultValue) { String value = get(name); if (value == null) { return defaultValue; } value = value.trim().toLowerCase(); try { return Long.parseLong(value); } catch (NumberFormatException nfex) { return defaultValue; } }
java
{ "resource": "" }
q171038
MethodFinder.getResolvedParameters
test
MethodParameter[] getResolvedParameters() { if (paramExtractor == null) { return MethodParameter.EMPTY_ARRAY; } if (!paramExtractor.debugInfoPresent) { throw new ParamoException("Parameter names not available for method: " + declaringClass.getName() + '#' + methodName); } return paramExtractor.getM...
java
{ "resource": "" }
q171039
KeyValueJsonSerializer.serializeKeyValue
test
protected int serializeKeyValue(final JsonContext jsonContext, final Path currentPath, final Object key, final Object value, int count) { if ((value == null) && jsonContext.isExcludeNulls()) { return count; } if (key != null) { currentPath.push(key.toString()); } else { currentPath.push(StringPool.NUL...
java
{ "resource": "" }
q171040
ResultMapper.lookupAlias
test
protected String lookupAlias(final String alias) { String value = actionsManager.lookupPathAlias(alias); if (value == null) { ActionRuntime cfg = actionsManager.lookup(alias); if (cfg != null) { value = cfg.getActionPath(); } } return value; }
java
{ "resource": "" }
q171041
ResultMapper.resolveAlias
test
protected String resolveAlias(final String value) { final StringBuilder result = new StringBuilder(value.length()); int i = 0; int len = value.length(); while (i < len) { int ndx = value.indexOf('<', i); if (ndx == -1) { // alias markers not found if (i == 0) { // try whole string as an alias...
java
{ "resource": "" }
q171042
ResultMapper.resolveResultPath
test
public ResultPath resolveResultPath(String path, String value) { boolean absolutePath = false; if (value != null) { // [*] resolve alias in value value = resolveAlias(value); // [*] absolute paths if (StringUtil.startsWithChar(value, '/')) { absolutePath = true; int dotNdx = value.indexOf(".....
java
{ "resource": "" }
q171043
ResultMapper.resolveResultPathString
test
public String resolveResultPathString(final String path, final String value) { final ResultPath resultPath = resolveResultPath(path, value); final String result = resultPath.pathValue(); return resolveAlias(result); }
java
{ "resource": "" }
q171044
MadvocUtil.lastIndexOfSlashDot
test
public static int lastIndexOfSlashDot(final String str) { int slashNdx = str.lastIndexOf('/'); int dotNdx = StringUtil.lastIndexOf(str, '.', str.length(), slashNdx); if (dotNdx == -1) { if (slashNdx == -1) { return -1; } slashNdx++; if (slashNdx < str.length() - 1) { dotNdx = slashNdx; } el...
java
{ "resource": "" }
q171045
MadvocUtil.lastIndexOfDotAfterSlash
test
public static int lastIndexOfDotAfterSlash(final String str) { int slashNdx = str.lastIndexOf('/'); slashNdx++; return StringUtil.lastIndexOf(str, '.', str.length(), slashNdx); }
java
{ "resource": "" }
q171046
MadvocUtil.indexOfDotAfterSlash
test
public static int indexOfDotAfterSlash(final String str) { int slashNdx = str.lastIndexOf('/'); if (slashNdx == -1) { slashNdx = 0; } return str.indexOf('.', slashNdx); }
java
{ "resource": "" }
q171047
MadvocUtil.stripLastCamelWord
test
public static String stripLastCamelWord(String name) { int ndx = name.length() - 1; while (ndx >= 0) { if (CharUtil.isUppercaseAlpha(name.charAt(ndx))) { break; } ndx--; } if (ndx >= 0) { name = name.substring(0, ndx); } return name; }
java
{ "resource": "" }
q171048
DbMetaUtil.resolveSchemaName
test
public static String resolveSchemaName(final Class<?> type, final String defaultSchemaName) { String schemaName = null; final DbTable dbTable = type.getAnnotation(DbTable.class); if (dbTable != null) { schemaName = dbTable.schema().trim(); } if ((schemaName == null) || (schemaName.length() == 0)) { sche...
java
{ "resource": "" }
q171049
DbMetaUtil.resolveColumnDescriptors
test
public static DbEntityColumnDescriptor resolveColumnDescriptors( final DbEntityDescriptor dbEntityDescriptor, final PropertyDescriptor property, final boolean isAnnotated, final ColumnNamingStrategy columnNamingStrategy) { String columnName = null; boolean isId = false; Class<? extends SqlType> sqlTypeCl...
java
{ "resource": "" }
q171050
Threefish.init
test
public void init(final long[] key, final long[] tweak) { final int newNw = key.length; // only create new arrays if the value of N{w} changes (different key size) if (nw != newNw) { nw = newNw; switch (nw) { case WORDS_4: pi = PI4; rpi = RPI4; r = R4; break; case WORDS_8: ...
java
{ "resource": "" }
q171051
Threefish.mix
test
private void mix(final int j, final int d) { y[0] = x[0] + x[1]; final long rotl = r[d % DEPTH_OF_D_IN_R][j]; // java left rotation for a long y[1] = (x[1] << rotl) | (x[1] >>> (Long.SIZE - rotl)); y[1] ^= y[0]; }
java
{ "resource": "" }
q171052
Threefish.demix
test
private void demix(final int j, final int d) { y[1] ^= y[0]; final long rotr = r[d % DEPTH_OF_D_IN_R][j]; // NOTE performance: darn, creation on stack! // right shift x[1] = (y[1] << (Long.SIZE - rotr)) | (y[1] >>> rotr); x[0] = y[0] - x[1]; }
java
{ "resource": "" }
q171053
Threefish.keySchedule
test
private void keySchedule(final int s) { for (int i = 0; i < nw; i++) { // just put in the main key first ksd[i] = k[(s + i) % (nw + 1)]; // don't add anything for i = 0,...,Nw - 4 if (i == nw - 3) { // second to last ksd[i] += t[s % TWEAK_VALUES]; } else if (i == nw - 2) { // first to last ksd...
java
{ "resource": "" }
q171054
Threefish.init
test
public void init(final String keyMessage, final long tweak1, final long tweak2) { long[] tweak = new long[] {tweak1, tweak2}; byte[] key = new byte[blockSize / Byte.SIZE]; byte[] keyData = StringUtil.getBytes(keyMessage); System.arraycopy(keyData, 0, key, 0, key.length < keyData.length ? key.length : keyData.le...
java
{ "resource": "" }
q171055
Threefish.encryptBlock
test
@Override public byte[] encryptBlock(final byte[] content, final int offset) { long[] contentBlock = bytesToLongs(content, offset, blockSizeInBytes); long[] encryptedBlock = new long[blockSize / Long.SIZE]; blockEncrypt(contentBlock, encryptedBlock); return longsToBytes(encryptedBlock); }
java
{ "resource": "" }
q171056
Threefish.bytesToLongs
test
protected static long[] bytesToLongs(final byte[] ba, final int offset, final int size) { long[] result = new long[size >> 3]; int i8 = offset; for (int i = 0; i < result.length; i++) { result[i] = Bits.getLong(ba, i8); i8 += 8; } return result; }
java
{ "resource": "" }
q171057
RFC2822AddressParser.removeAnyBounding
test
private static String removeAnyBounding(final char s, final char e, final String str) { if (str == null || str.length() < 2) { return str; } if (str.startsWith(String.valueOf(s)) && str.endsWith(String.valueOf(e))) { return str.substring(1, str.length() - 1); } return str; }
java
{ "resource": "" }
q171058
PathResult.path
test
public String path() { if (methref != null) { final String methodName = methref.ref(); return target.getName() + '#' + methodName; } return path; }
java
{ "resource": "" }
q171059
ZipUtil.zlib
test
public static File zlib(final File file) throws IOException { if (file.isDirectory()) { throw new IOException("Can't zlib folder"); } FileInputStream fis = new FileInputStream(file); Deflater deflater = new Deflater(Deflater.BEST_COMPRESSION); String zlibFileName = file.getAbsolutePath() + ZLIB_EXT; De...
java
{ "resource": "" }
q171060
ZipUtil.gzip
test
public static File gzip(final File file) throws IOException { if (file.isDirectory()) { throw new IOException("Can't gzip folder"); } FileInputStream fis = new FileInputStream(file); String gzipName = file.getAbsolutePath() + GZIP_EXT; GZIPOutputStream gzos = new GZIPOutputStream(new FileOutputStream(gzi...
java
{ "resource": "" }
q171061
ZipUtil.ungzip
test
public static File ungzip(final File file) throws IOException { String outFileName = FileNameUtil.removeExtension(file.getAbsolutePath()); File out = new File(outFileName); out.createNewFile(); FileOutputStream fos = new FileOutputStream(out); GZIPInputStream gzis = new GZIPInputStream(new FileInputStream(fi...
java
{ "resource": "" }
q171062
ZipUtil.listZip
test
public static List<String> listZip(final File zipFile) throws IOException { List<String> entries = new ArrayList<>(); ZipFile zip = new ZipFile(zipFile); Enumeration zipEntries = zip.entries(); while (zipEntries.hasMoreElements()) { ZipEntry entry = (ZipEntry) zipEntries.nextElement(); String entryName ...
java
{ "resource": "" }
q171063
ZipUtil.unzip
test
public static void unzip(final String zipFile, final String destDir, final String... patterns) throws IOException { unzip(new File(zipFile), new File(destDir), patterns); }
java
{ "resource": "" }
q171064
ZipUtil.addToZip
test
public static void addToZip(final ZipOutputStream zos, final File file, String path, final String comment, final boolean recursive) throws IOException { if (!file.exists()) { throw new FileNotFoundException(file.toString()); } if (path == null) { path = file.getName(); } while (path.length() != 0 && p...
java
{ "resource": "" }
q171065
ZipUtil.addToZip
test
public static void addToZip(final ZipOutputStream zos, final byte[] content, String path, final String comment) throws IOException { while (path.length() != 0 && path.charAt(0) == '/') { path = path.substring(1); } if (StringUtil.endsWithChar(path, '/')) { path = path.substring(0, path.length() - 1); } ...
java
{ "resource": "" }
q171066
ClassDescriptor.getFieldDescriptor
test
public FieldDescriptor getFieldDescriptor(final String name, final boolean declared) { final FieldDescriptor fieldDescriptor = getFields().getFieldDescriptor(name); if (fieldDescriptor != null) { if (!fieldDescriptor.matchDeclared(declared)) { return null; } } return fieldDescriptor; }
java
{ "resource": "" }
q171067
ClassDescriptor.getPropertyDescriptor
test
public PropertyDescriptor getPropertyDescriptor(final String name, final boolean declared) { PropertyDescriptor propertyDescriptor = getProperties().getPropertyDescriptor(name); if ((propertyDescriptor != null) && propertyDescriptor.matchDeclared(declared)) { return propertyDescriptor; } return null; }
java
{ "resource": "" }
q171068
LocalizationUtil.setRequestBundleName
test
public static void setRequestBundleName(final ServletRequest request, final String bundleName) { if (log.isDebugEnabled()) { log.debug("Bundle name for this request: " + bundleName); } request.setAttribute(REQUEST_BUNDLE_NAME_ATTR, bundleName); }
java
{ "resource": "" }
q171069
LocalizationUtil.setSessionLocale
test
public static void setSessionLocale(final HttpSession session, final String localeCode) { if (log.isDebugEnabled()) { log.debug("Locale stored to session: " + localeCode); } Locale locale = Locale.forLanguageTag(localeCode); session.setAttribute(SESSION_LOCALE_ATTR, locale); }
java
{ "resource": "" }
q171070
LocalizationUtil.getSessionLocale
test
public static Locale getSessionLocale(final HttpSession session) { Locale locale = (Locale) session.getAttribute(SESSION_LOCALE_ATTR); return locale == null ? MESSAGE_RESOLVER.getFallbackLocale() : locale; }
java
{ "resource": "" }
q171071
ParamManager.filterParametersForBeanName
test
public String[] filterParametersForBeanName(String beanName, final boolean resolveReferenceParams) { beanName = beanName + '.'; List<String> list = new ArrayList<>(); for (Map.Entry<String, Object> entry : params.entrySet()) { String key = entry.getKey(); if (!key.startsWith(beanName)) { continue; }...
java
{ "resource": "" }
q171072
PropsEntries.profile
test
public PropsEntries profile(final String... profiles) { if (profiles == null) { return this; } for (String profile : profiles) { addProfiles(profile); } return this; }
java
{ "resource": "" }
q171073
MurmurHash3.getLongLittleEndian
test
public static long getLongLittleEndian(final byte[] buf, final int offset) { return ((long) buf[offset + 7] << 56) // no mask needed | ((buf[offset + 6] & 0xffL) << 48) | ((buf[offset + 5] & 0xffL) << 40) | ((buf[offset + 4] & 0xffL) << 32) | ((buf[offset + 3] & 0xffL) << 24) | ((buf[offset + 2] & 0x...
java
{ "resource": "" }
q171074
ClassReader.readStream
test
private static byte[] readStream(final InputStream inputStream, final boolean close) throws IOException { if (inputStream == null) { throw new IOException("Class not found"); } try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] data = new byte[INPUT_STREAM...
java
{ "resource": "" }
q171075
ClassReader.readLabel
test
protected Label readLabel(final int bytecodeOffset, final Label[] labels) { if (labels[bytecodeOffset] == null) { labels[bytecodeOffset] = new Label(); } return labels[bytecodeOffset]; }
java
{ "resource": "" }
q171076
ClassReader.getTypeAnnotationBytecodeOffset
test
private int getTypeAnnotationBytecodeOffset( final int[] typeAnnotationOffsets, final int typeAnnotationIndex) { if (typeAnnotationOffsets == null || typeAnnotationIndex >= typeAnnotationOffsets.length || readByte(typeAnnotationOffsets[typeAnnotationIndex]) < TypeReference.INSTANCEOF) { ...
java
{ "resource": "" }
q171077
ClassReader.readElementValues
test
private int readElementValues( final AnnotationVisitor annotationVisitor, final int annotationOffset, final boolean named, final char[] charBuffer) { int currentOffset = annotationOffset; // Read the num_element_value_pairs field (or num_values field for an array_value). int numEleme...
java
{ "resource": "" }
q171078
ClassReader.readVerificationTypeInfo
test
private int readVerificationTypeInfo( final int verificationTypeInfoOffset, final Object[] frame, final int index, final char[] charBuffer, final Label[] labels) { int currentOffset = verificationTypeInfoOffset; int tag = b[currentOffset++] & 0xFF; switch (tag) { case Fra...
java
{ "resource": "" }
q171079
ClassReader.readBootstrapMethodsAttribute
test
private int[] readBootstrapMethodsAttribute(final int maxStringLength) { char[] charBuffer = new char[maxStringLength]; int currentAttributeOffset = getFirstAttributeOffset(); int[] currentBootstrapMethodOffsets = null; for (int i = readUnsignedShort(currentAttributeOffset - 2); i > 0; --i) { // R...
java
{ "resource": "" }
q171080
Ctors.inspectConstructors
test
protected CtorDescriptor[] inspectConstructors() { Class type = classDescriptor.getType(); Constructor[] ctors = type.getDeclaredConstructors(); CtorDescriptor[] allCtors = new CtorDescriptor[ctors.length]; for (int i = 0; i < ctors.length; i++) { Constructor ctor = ctors[i]; CtorDescriptor ctorDescrip...
java
{ "resource": "" }
q171081
Ctors.getCtorDescriptor
test
public CtorDescriptor getCtorDescriptor(final Class... args) { ctors: for (CtorDescriptor ctorDescriptor : allCtors) { Class[] arg = ctorDescriptor.getParameters(); if (arg.length != args.length) { continue; } for (int j = 0; j < arg.length; j++) { if (arg[j] != args[j]) { continue ctors;...
java
{ "resource": "" }
q171082
RequestScope.getRequestMap
test
@SuppressWarnings("unchecked") protected Map<String, TransientBeanData> getRequestMap(final HttpServletRequest servletRequest) { return (Map<String, TransientBeanData>) servletRequest.getAttribute(ATTR_NAME); }
java
{ "resource": "" }
q171083
RequestScope.createRequestMap
test
protected Map<String, TransientBeanData> createRequestMap(final HttpServletRequest servletRequest) { Map<String, TransientBeanData> map = new HashMap<>(); servletRequest.setAttribute(ATTR_NAME, map); return map; }
java
{ "resource": "" }
q171084
LongArrayConverter.convertArrayToArray
test
protected long[] convertArrayToArray(final Object value) { final Class valueComponentType = value.getClass().getComponentType(); final long[] result; if (valueComponentType.isPrimitive()) { result = convertPrimitiveArrayToArray(value, valueComponentType); } else { // convert object array to target array...
java
{ "resource": "" }
q171085
DecoraServletFilter.init
test
@Override public void init(final FilterConfig filterConfig) throws ServletException { // final String decoraManagerClass = filterConfig.getInitParameter(PARAM_DECORA_MANAGER); if (decoraManagerClass != null) { try { final Class decoraManagerType = ClassLoaderUtil.loadClass(decoraManagerClass); deco...
java
{ "resource": "" }
q171086
FindFile.onFile
test
public FindFile onFile(final Consumer<File> fileConsumer) { if (consumers == null) { consumers = Consumers.of(fileConsumer); } else { consumers.add(fileConsumer); } return this; }
java
{ "resource": "" }
q171087
FindFile.searchPath
test
public FindFile searchPath(final URI searchPath) { File file; try { file = new File(searchPath); } catch (Exception ex) { throw new FindFileException("URI error: " + searchPath, ex); } addPath(file); return this; }
java
{ "resource": "" }
q171088
FindFile.searchPath
test
public FindFile searchPath(final URL searchPath) { File file = FileUtil.toContainerFile(searchPath); if (file == null) { throw new FindFileException("URL error: " + searchPath); } addPath(file); return this; }
java
{ "resource": "" }
q171089
FindFile.include
test
public FindFile include(final String... patterns) { for (String pattern : patterns) { rules.include(pattern); } return this; }
java
{ "resource": "" }
q171090
FindFile.exclude
test
public FindFile exclude(final String... patterns) { for (String pattern : patterns) { rules.exclude(pattern); } return this; }
java
{ "resource": "" }
q171091
FindFile.addPath
test
protected void addPath(final File path) { if (!path.exists()) { return; } if (pathList == null) { pathList = new LinkedList<>(); } pathList.add(path); }
java
{ "resource": "" }
q171092
FindFile.findAll
test
public List<File> findAll() { List<File> allFiles = new ArrayList<>(); File file; while ((file = nextFile()) != null) { allFiles.add(file); } return allFiles; }
java
{ "resource": "" }
q171093
FindFile.init
test
protected void init() { rules.detectMode(); todoFiles = new LinkedList<>(); todoFolders = new LinkedList<>(); if (pathList == null) { pathList = new LinkedList<>(); return; } if (pathListOriginal == null) { pathListOriginal = (LinkedList<File>) pathList.clone(); } String[] files = new String...
java
{ "resource": "" }
q171094
FindFile.iterator
test
@Override public Iterator<File> iterator() { return new Iterator<File>() { private File nextFile; @Override public boolean hasNext() { nextFile = nextFile(); return nextFile != null; } @Override public File next() { if (nextFile == null) { throw new NoSuchElementException(); ...
java
{ "resource": "" }
q171095
AnnotationResolver.resolveBeanWiringMode
test
public WiringMode resolveBeanWiringMode(final Class type) { PetiteBean petiteBean = ((Class<?>) type).getAnnotation(PetiteBean.class); return petiteBean != null ? petiteBean.wiring() : WiringMode.DEFAULT; }
java
{ "resource": "" }
q171096
AnnotationResolver.resolveBeanName
test
public String resolveBeanName(final Class type, final boolean useLongTypeName) { PetiteBean petiteBean = ((Class<?>)type).getAnnotation(PetiteBean.class); String name = null; if (petiteBean != null) { name = petiteBean.value().trim(); } if ((name == null) || (name.length() == 0)) { if (useLongTypeName) ...
java
{ "resource": "" }
q171097
Buffer.getWriter
test
public PrintWriter getWriter() { if (outWriter == null) { if (outStream != null) { throw new IllegalStateException("Can't call getWriter() after getOutputStream()"); } bufferedWriter = new FastCharArrayWriter(); outWriter = new PrintWriter(bufferedWriter) { @Override public void close() { ...
java
{ "resource": "" }
q171098
Buffer.getOutputStream
test
public ServletOutputStream getOutputStream() { if (outStream == null) { if (outWriter != null) { throw new IllegalStateException("Can't call getOutputStream() after getWriter()"); } bufferOutputStream = new FastByteArrayServletOutputStream(); outStream = bufferOutputStream; } return outStream; }
java
{ "resource": "" }
q171099
Type.getClassName
test
public String getClassName() { switch (sort) { case VOID: return "void"; case BOOLEAN: return "boolean"; case CHAR: return "char"; case BYTE: return "byte"; case SHORT: return "short"; case INT: return "int"; case FLOAT: ...
java
{ "resource": "" }