_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q170900
ServletUtil.prepareDownload
test
public static void prepareDownload(final HttpServletResponse response, final File file, final String mimeType) { if (!file.exists()) { throw new IllegalArgumentException("File not found: " + file); } if (file.length() > Integer.MAX_VALUE) { throw new IllegalArgumentException("File too big: " + file); } ...
java
{ "resource": "" }
q170901
ServletUtil.prepareResponse
test
public static void prepareResponse(final HttpServletResponse response, final String fileName, String mimeType, final int fileSize) { if ((mimeType == null) && (fileName != null)) { String extension = FileNameUtil.getExtension(fileName); mimeType = MimeTypes.getMimeType(extension); } if (mimeType != null) {...
java
{ "resource": "" }
q170902
ServletUtil.getAllCookies
test
public static Cookie[] getAllCookies(final HttpServletRequest request, final String cookieName) { Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; } ArrayList<Cookie> list = new ArrayList<>(cookies.length); for (Cookie cookie : cookies) { if (cookie.getName().equals(cookieNam...
java
{ "resource": "" }
q170903
ServletUtil.readRequestBodyFromReader
test
public static String readRequestBodyFromReader(final HttpServletRequest request) throws IOException { BufferedReader buff = request.getReader(); StringWriter out = new StringWriter(); StreamUtil.copy(buff, out); return out.toString(); }
java
{ "resource": "" }
q170904
ServletUtil.readRequestBodyFromStream
test
public static String readRequestBodyFromStream(final HttpServletRequest request) throws IOException { String charEncoding = request.getCharacterEncoding(); if (charEncoding == null) { charEncoding = JoddCore.encoding; } CharArrayWriter charArrayWriter = new CharArrayWriter(); BufferedReader bufferedReader ...
java
{ "resource": "" }
q170905
ServletUtil.storeContextPath
test
public static void storeContextPath(final PageContext pageContext, final String contextPathVariableName) { String ctxPath = getContextPath(pageContext); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); request.setAttribute(contextPathVariableName, ctxPath); ServletContext servletCon...
java
{ "resource": "" }
q170906
ServletUtil.storeContextPath
test
public static void storeContextPath(final ServletContext servletContext, final String contextPathVariableName) { String ctxPath = getContextPath(servletContext); servletContext.setAttribute(contextPathVariableName, ctxPath); }
java
{ "resource": "" }
q170907
ServletUtil.isGetParameter
test
public boolean isGetParameter(final HttpServletRequest request, String name) { name = URLCoder.encodeQueryParam(name) + '='; String query = request.getQueryString(); String[] nameValuePairs = StringUtil.splitc(query, '&'); for (String nameValuePair : nameValuePairs) { if (nameValuePair.startsWith(name)) { ...
java
{ "resource": "" }
q170908
ServletUtil.prepareParameters
test
public static String[] prepareParameters( final String[] paramValues, final boolean treatEmptyParamsAsNull, final boolean ignoreEmptyRequestParams) { if (treatEmptyParamsAsNull || ignoreEmptyRequestParams) { int emptyCount = 0; int total = paramValues.length; for (int i = 0; i < paramValues.length; i+...
java
{ "resource": "" }
q170909
ServletUtil.copyParamsToAttributes
test
public static void copyParamsToAttributes( final HttpServletRequest servletRequest, final boolean treatEmptyParamsAsNull, final boolean ignoreEmptyRequestParams) { Enumeration paramNames = servletRequest.getParameterNames(); while (paramNames.hasMoreElements()) { String paramName = (String) paramNames.nex...
java
{ "resource": "" }
q170910
TagUtil.invokeBody
test
public static void invokeBody(final JspFragment body) throws JspException { if (body == null) { return; } try { body.invoke(null); } catch (IOException ioex) { throw new JspException("Tag body failed", ioex); } }
java
{ "resource": "" }
q170911
TagUtil.renderBody
test
public static char[] renderBody(final JspFragment body) throws JspException { FastCharArrayWriter writer = new FastCharArrayWriter(); invokeBody(body, writer); return writer.toCharArray(); }
java
{ "resource": "" }
q170912
TagUtil.renderBodyToString
test
public static String renderBodyToString(final JspFragment body) throws JspException { char[] result = renderBody(body); return new String(result); }
java
{ "resource": "" }
q170913
BeanData.invokeInitMethods
test
public void invokeInitMethods(final InitMethodInvocationStrategy invocationStrategy) { for (final InitMethodPoint initMethod : beanDefinition.initMethodPoints()) { if (invocationStrategy != initMethod.invocationStrategy) { continue; } try { initMethod.method.invoke(bean); } catch (Exception ex) { ...
java
{ "resource": "" }
q170914
BeanData.callDestroyMethods
test
public void callDestroyMethods() { for (final DestroyMethodPoint destroyMethodPoint : beanDefinition.destroyMethodPoints()) { try { destroyMethodPoint.method.invoke(bean); } catch (Exception ex) { throw new PetiteException("Invalid destroy method: " + destroyMethodPoint.method, ex); } } }
java
{ "resource": "" }
q170915
BeanData.newBeanInstance
test
public Object newBeanInstance() { if (beanDefinition.ctor == CtorInjectionPoint.EMPTY) { throw new PetiteException("No constructor (annotated, single or default) founded as injection point for: " + beanDefinition.type.getName()); } int paramNo = beanDefinition.ctor.references.length; Object[] args = new Obj...
java
{ "resource": "" }
q170916
BeanData.injectParams
test
public void injectParams(final ParamManager paramManager, final boolean implicitParamInjection) { if (beanDefinition.name == null) { return; } if (implicitParamInjection) { // implicit final int len = beanDefinition.name.length() + 1; for (final String param : beanDefinition.params) { final Objec...
java
{ "resource": "" }
q170917
ActionPathRewriter.rewrite
test
@SuppressWarnings({"UnusedDeclaration"}) public String rewrite(final HttpServletRequest servletRequest, final String actionPath, final String httpMethod) { return actionPath; }
java
{ "resource": "" }
q170918
HeadersMultiMap.addHeader
test
public void addHeader(final String name, final String value) { List<String> valuesList = super.getAll(name); if (valuesList.isEmpty()) { super.add(name, value); return; } super.remove(name); valuesList.add(value); super.addAll(name, valuesList); }
java
{ "resource": "" }
q170919
PropsData.put
test
protected void put(final String profile, final Map<String, PropsEntry> map, final String key, final String value, final boolean append) { String realValue = value; if (append || appendDuplicateProps) { PropsEntry pv = map.get(key); if (pv != null) { realValue = pv.value + APPEND_SEPARATOR + realValue; ...
java
{ "resource": "" }
q170920
PropsData.putBaseProperty
test
public void putBaseProperty(final String key, final String value, final boolean append) { put(null, baseProperties, key, value, append); }
java
{ "resource": "" }
q170921
PropsData.putProfileProperty
test
public void putProfileProperty(final String key, final String value, final String profile, final boolean append) { Map<String, PropsEntry> map = profileProperties.computeIfAbsent(profile, k -> new HashMap<>()); put(profile, map, key, value, append); }
java
{ "resource": "" }
q170922
PropsData.getProfileProperty
test
public PropsEntry getProfileProperty(final String profile, final String key) { final Map<String, PropsEntry> profileMap = profileProperties.get(profile); if (profileMap == null) { return null; } return profileMap.get(key); }
java
{ "resource": "" }
q170923
PropsData.resolveMacros
test
public String resolveMacros(String value, final String... profiles) { // create string template parser that will be used internally StringTemplateParser stringTemplateParser = new StringTemplateParser(); stringTemplateParser.setResolveEscapes(false); if (!ignoreMissingMacros) { stringTemplateParser.setRepla...
java
{ "resource": "" }
q170924
PropsData.extract
test
public Map extract(Map target, final String[] profiles, final String[] wildcardPatterns, String prefix) { if (target == null) { target = new HashMap(); } // make sure prefix ends with a dot if (prefix != null) { if (!StringUtil.endsWithChar(prefix, '.')) { prefix += StringPool.DOT; } } if (pr...
java
{ "resource": "" }
q170925
BCrypt.streamtoword
test
private static int streamtoword(byte[] data, int[] offp) { int i; int word = 0; int off = offp[0]; for (i = 0; i < 4; i++) { word = (word << 8) | (data[off] & 0xff); off = (off + 1) % data.length; } offp[0] = off; return word; }
java
{ "resource": "" }
q170926
BCrypt.hashpw
test
public static String hashpw(String password, String salt) { BCrypt B; String real_salt; byte[] passwordb, saltb, hashed; char minor = (char) 0; int rounds, off; StringBuffer rs = new StringBuffer(); if (salt.charAt(0) != '$' || salt.charAt(1) != '2') { throw new IllegalArgumentException("Invalid salt ...
java
{ "resource": "" }
q170927
BCrypt.checkpw
test
public static boolean checkpw(String plaintext, String hashed) { byte[] hashed_bytes; byte[] try_bytes; try { String try_pw = hashpw(plaintext, hashed); hashed_bytes = hashed.getBytes("UTF-8"); try_bytes = try_pw.getBytes("UTF-8"); } catch (UnsupportedEncodingException uee) { return false; } i...
java
{ "resource": "" }
q170928
MultipartRequestInputStream.copyAll
test
public int copyAll(final OutputStream out) throws IOException { int count = 0; while (true) { byte b = readByte(); if (isBoundary(b)) { break; } out.write(b); count++; } return count; }
java
{ "resource": "" }
q170929
MultipartRequestInputStream.copyMax
test
public int copyMax(final OutputStream out, final int maxBytes) throws IOException { int count = 0; while (true) { byte b = readByte(); if (isBoundary(b)) { break; } out.write(b); count++; if (count == maxBytes) { return count; } } return count; }
java
{ "resource": "" }
q170930
ActionMethodParser.parse
test
public ActionRuntime parse(final Class<?> actionClass, final Method actionMethod, ActionDefinition actionDefinition) { final ActionAnnotationValues annotationValues = detectActionAnnotationValues(actionMethod); final ActionConfig actionConfig = resolveActionConfig(annotationValues); // interceptors ActionInte...
java
{ "resource": "" }
q170931
ActionMethodParser.resolveActionConfig
test
protected ActionConfig resolveActionConfig(final ActionAnnotationValues annotationValues) { final Class<? extends Annotation> annotationType; if (annotationValues == null) { annotationType = Action.class; } else { annotationType = annotationValues.annotationType(); } return actionConfigManager.lookup...
java
{ "resource": "" }
q170932
ActionMethodParser.detectAndRegisterAlias
test
protected void detectAndRegisterAlias(final ActionAnnotationValues annotationValues, final ActionDefinition actionDefinition) { final String alias = parseMethodAlias(annotationValues); if (alias != null) { String aliasPath = StringUtil.cutToIndexOf(actionDefinition.actionPath(), StringPool.HASH); actionsMana...
java
{ "resource": "" }
q170933
ActionMethodParser.readActionInterceptors
test
protected Class<? extends ActionInterceptor>[] readActionInterceptors(final AnnotatedElement actionClassOrMethod) { Class<? extends ActionInterceptor>[] result = null; InterceptedBy interceptedBy = actionClassOrMethod.getAnnotation(InterceptedBy.class); if (interceptedBy != null) { result = interceptedBy.value...
java
{ "resource": "" }
q170934
ActionMethodParser.readActionFilters
test
protected Class<? extends ActionFilter>[] readActionFilters(final AnnotatedElement actionClassOrMethod) { Class<? extends ActionFilter>[] result = null; FilteredBy filteredBy = actionClassOrMethod.getAnnotation(FilteredBy.class); if (filteredBy != null) { result = filteredBy.value(); if (result.length == 0)...
java
{ "resource": "" }
q170935
ActionMethodParser.readPackageActionPath
test
protected String[] readPackageActionPath(final Class actionClass) { Package actionPackage = actionClass.getPackage(); final String actionPackageName = actionPackage.getName(); // 1 - read annotations first String packageActionPathFromAnnotation; mainloop: while (true) { MadvocAction madvocActionAnnot...
java
{ "resource": "" }
q170936
ActionMethodParser.readMethodActionPath
test
protected String[] readMethodActionPath(final String methodName, final ActionAnnotationValues annotationValues, final ActionConfig actionConfig) { // read annotation String methodActionPath = annotationValues != null ? annotationValues.value() : null; if (methodActionPath == null) { methodActionPath = methodN...
java
{ "resource": "" }
q170937
ActionMethodParser.parseMethodAlias
test
protected String parseMethodAlias(final ActionAnnotationValues annotationValues) { String alias = null; if (annotationValues != null) { alias = annotationValues.alias(); } return alias; }
java
{ "resource": "" }
q170938
ActionMethodParser.createActionRuntime
test
public ActionRuntime createActionRuntime( final ActionHandler actionHandler, final Class actionClass, final Method actionClassMethod, final Class<? extends ActionResult> actionResult, final Class<? extends ActionResult> defaultActionResult, final ActionFilter[] filters, final ActionInterceptor[] intercept...
java
{ "resource": "" }
q170939
DecoraResponseWrapper.preResponseCommit
test
@Override protected void preResponseCommit() { long lastModified = lastModifiedData.getLastModified(); long ifModifiedSince = request.getDateHeader("If-Modified-Since"); if (lastModified > -1 && !response.containsHeader("Last-Modified")) { if (ifModifiedSince < (lastModified / 1000 * 1000)) { response.se...
java
{ "resource": "" }
q170940
DelegateAdviceUtil.applyAdvice
test
public static <T> T applyAdvice(final Class<T> targetClass) { Class adviceClass = cache.get(targetClass); if (adviceClass == null) { // advice not yet created adviceClass = PROXY_PROXETTA.proxy().setTarget(targetClass).define(); cache.put(targetClass, adviceClass); } // create new advice instance a...
java
{ "resource": "" }
q170941
DelegateAdviceUtil.injectTargetIntoProxy
test
public static void injectTargetIntoProxy(final Object proxy, final Object target) { Class proxyClass = proxy.getClass(); try { Field field = proxyClass.getField("$___target$0"); field.set(proxy, target); } catch (Exception ex) { throw new ProxettaException(ex); } }
java
{ "resource": "" }
q170942
FieldVisitor.visitAnnotation
test
public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { if (fv != null) { return fv.visitAnnotation(descriptor, visible); } return null; }
java
{ "resource": "" }
q170943
TypeData.resolveRealName
test
public String resolveRealName(final String jsonName) { if (jsonNames == null) { return jsonName; } int jsonIndex = ArraysUtil.indexOf(jsonNames, jsonName); if (jsonIndex == -1) { return jsonName; } return realNames[jsonIndex]; }
java
{ "resource": "" }
q170944
TypeData.resolveJsonName
test
public String resolveJsonName(final String realName) { if (realNames == null) { return realName; } int realIndex = ArraysUtil.indexOf(realNames, realName); if (realIndex == -1) { return realName; } return jsonNames[realIndex]; }
java
{ "resource": "" }
q170945
JsonAnnotationManager.lookupTypeData
test
public TypeData lookupTypeData(final Class type) { TypeData typeData = typeDataMap.get(type); if (typeData == null) { if (serializationSubclassAware) { typeData = findSubclassTypeData(type); } if (typeData == null) { typeData = scanClassForAnnotations(type); typeDataMap.put(type, typeData); ...
java
{ "resource": "" }
q170946
JsonAnnotationManager._lookupTypeData
test
protected TypeData _lookupTypeData(final Class type) { TypeData typeData = typeDataMap.get(type); if (typeData == null) { typeData = scanClassForAnnotations(type); typeDataMap.put(type, typeData); } return typeData; }
java
{ "resource": "" }
q170947
JsonAnnotationManager.findSubclassTypeData
test
protected TypeData findSubclassTypeData(final Class type) { final Class<? extends Annotation> defaultAnnotation = jsonAnnotation; if (type.getAnnotation(defaultAnnotation) != null) { // current type has annotation, don't find anything, let type data be created return null; } ClassDescriptor cd = ClassIn...
java
{ "resource": "" }
q170948
JsonAnnotationManager.resolveJsonName
test
public String resolveJsonName(final Class type, final String name) { TypeData typeData = lookupTypeData(type); return typeData.resolveJsonName(name); }
java
{ "resource": "" }
q170949
JsonAnnotationManager.resolveRealName
test
public String resolveRealName(final Class type, final String jsonName) { TypeData typeData = lookupTypeData(type); return typeData.resolveRealName(jsonName); }
java
{ "resource": "" }
q170950
AdaptiveFileUpload.getFileContent
test
@Override public byte[] getFileContent() throws IOException { if (data != null) { return data; } if (tempFile != null) { return FileUtil.readBytes(tempFile); } return null; }
java
{ "resource": "" }
q170951
SymbolTable.copyBootstrapMethods
test
private void copyBootstrapMethods(final ClassReader classReader, final char[] charBuffer) { // Find attributOffset of the 'bootstrap_methods' array. byte[] inputBytes = classReader.b; int currentAttributeOffset = classReader.getFirstAttributeOffset(); for (int i = classReader.readUnsignedShort(currentAt...
java
{ "resource": "" }
q170952
SymbolTable.setMajorVersionAndClassName
test
int setMajorVersionAndClassName(final int majorVersion, final String className) { this.majorVersion = majorVersion; this.className = className; return addConstantClass(className).index; }
java
{ "resource": "" }
q170953
SymbolTable.putConstantPool
test
void putConstantPool(final ByteVector output) { output.putShort(constantPoolCount).putByteArray(constantPool.data, 0, constantPool.length); }
java
{ "resource": "" }
q170954
SymbolTable.putBootstrapMethods
test
void putBootstrapMethods(final ByteVector output) { if (bootstrapMethods != null) { output .putShort(addConstantUtf8(Constants.BOOTSTRAP_METHODS)) .putInt(bootstrapMethods.length + 2) .putShort(bootstrapMethodCount) .putByteArray(bootstrapMethods.data, 0, bootstrapMetho...
java
{ "resource": "" }
q170955
SymbolTable.addConstantFieldref
test
Symbol addConstantFieldref(final String owner, final String name, final String descriptor) { return addConstantMemberReference(Symbol.CONSTANT_FIELDREF_TAG, owner, name, descriptor); }
java
{ "resource": "" }
q170956
SymbolTable.addConstantMethodref
test
Symbol addConstantMethodref( final String owner, final String name, final String descriptor, final boolean isInterface) { int tag = isInterface ? Symbol.CONSTANT_INTERFACE_METHODREF_TAG : Symbol.CONSTANT_METHODREF_TAG; return addConstantMemberReference(tag, owner, name, descriptor); }
java
{ "resource": "" }
q170957
SymbolTable.addConstantMemberReference
test
private Entry addConstantMemberReference( final int tag, final String owner, final String name, final String descriptor) { int hashCode = hash(tag, owner, name, descriptor); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == tag && entry.hashCode == hashCode ...
java
{ "resource": "" }
q170958
SymbolTable.addConstantMemberReference
test
private void addConstantMemberReference( final int index, final int tag, final String owner, final String name, final String descriptor) { add(new Entry(index, tag, owner, name, descriptor, 0, hash(tag, owner, name, descriptor))); }
java
{ "resource": "" }
q170959
SymbolTable.addConstantIntegerOrFloat
test
private Symbol addConstantIntegerOrFloat(final int tag, final int value) { int hashCode = hash(tag, value); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == tag && entry.hashCode == hashCode && entry.data == value) { return entry; } entry = entry.next; } ...
java
{ "resource": "" }
q170960
SymbolTable.addConstantIntegerOrFloat
test
private void addConstantIntegerOrFloat(final int index, final int tag, final int value) { add(new Entry(index, tag, value, hash(tag, value))); }
java
{ "resource": "" }
q170961
SymbolTable.addConstantLongOrDouble
test
private Symbol addConstantLongOrDouble(final int tag, final long value) { int hashCode = hash(tag, value); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == tag && entry.hashCode == hashCode && entry.data == value) { return entry; } entry = entry.next; } ...
java
{ "resource": "" }
q170962
SymbolTable.addConstantLongOrDouble
test
private void addConstantLongOrDouble(final int index, final int tag, final long value) { add(new Entry(index, tag, value, hash(tag, value))); }
java
{ "resource": "" }
q170963
SymbolTable.addConstantNameAndType
test
int addConstantNameAndType(final String name, final String descriptor) { final int tag = Symbol.CONSTANT_NAME_AND_TYPE_TAG; int hashCode = hash(tag, name, descriptor); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == tag && entry.hashCode == hashCode && ent...
java
{ "resource": "" }
q170964
SymbolTable.addConstantNameAndType
test
private void addConstantNameAndType(final int index, final String name, final String descriptor) { final int tag = Symbol.CONSTANT_NAME_AND_TYPE_TAG; add(new Entry(index, tag, name, descriptor, hash(tag, name, descriptor))); }
java
{ "resource": "" }
q170965
SymbolTable.addConstantUtf8
test
int addConstantUtf8(final String value) { int hashCode = hash(Symbol.CONSTANT_UTF8_TAG, value); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == Symbol.CONSTANT_UTF8_TAG && entry.hashCode == hashCode && entry.value.equals(value)) { return entry.index; ...
java
{ "resource": "" }
q170966
SymbolTable.addConstantUtf8
test
private void addConstantUtf8(final int index, final String value) { add(new Entry(index, Symbol.CONSTANT_UTF8_TAG, value, hash(Symbol.CONSTANT_UTF8_TAG, value))); }
java
{ "resource": "" }
q170967
SymbolTable.addConstantMethodHandle
test
Symbol addConstantMethodHandle( final int referenceKind, final String owner, final String name, final String descriptor, final boolean isInterface) { final int tag = Symbol.CONSTANT_METHOD_HANDLE_TAG; // Note that we don't need to include isInterface in the hash computation, becaus...
java
{ "resource": "" }
q170968
SymbolTable.addConstantMethodHandle
test
private void addConstantMethodHandle( final int index, final int referenceKind, final String owner, final String name, final String descriptor) { final int tag = Symbol.CONSTANT_METHOD_HANDLE_TAG; int hashCode = hash(tag, owner, name, descriptor, referenceKind); add(new Entry(i...
java
{ "resource": "" }
q170969
SymbolTable.addConstantDynamic
test
Symbol addConstantDynamic( final String name, final String descriptor, final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) { Symbol bootstrapMethod = addBootstrapMethod(bootstrapMethodHandle, bootstrapMethodArguments); return addConstantDynamicOrInvokeDynamicRef...
java
{ "resource": "" }
q170970
SymbolTable.addConstantInvokeDynamic
test
Symbol addConstantInvokeDynamic( final String name, final String descriptor, final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) { Symbol bootstrapMethod = addBootstrapMethod(bootstrapMethodHandle, bootstrapMethodArguments); return addConstantDynamicOrInvokeDyna...
java
{ "resource": "" }
q170971
SymbolTable.addConstantDynamicOrInvokeDynamicReference
test
private Symbol addConstantDynamicOrInvokeDynamicReference( final int tag, final String name, final String descriptor, final int bootstrapMethodIndex) { int hashCode = hash(tag, name, descriptor, bootstrapMethodIndex); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == tag ...
java
{ "resource": "" }
q170972
SymbolTable.addConstantDynamicOrInvokeDynamicReference
test
private void addConstantDynamicOrInvokeDynamicReference( final int tag, final int index, final String name, final String descriptor, final int bootstrapMethodIndex) { int hashCode = hash(tag, name, descriptor, bootstrapMethodIndex); add(new Entry(index, tag, null, name, descriptor,...
java
{ "resource": "" }
q170973
SymbolTable.addConstantUtf8Reference
test
private Symbol addConstantUtf8Reference(final int tag, final String value) { int hashCode = hash(tag, value); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == tag && entry.hashCode == hashCode && entry.value.equals(value)) { return entry; } entry = entry.next; ...
java
{ "resource": "" }
q170974
SymbolTable.addConstantUtf8Reference
test
private void addConstantUtf8Reference(final int index, final int tag, final String value) { add(new Entry(index, tag, value, hash(tag, value))); }
java
{ "resource": "" }
q170975
SymbolTable.addBootstrapMethod
test
Symbol addBootstrapMethod( final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) { ByteVector bootstrapMethodsAttribute = bootstrapMethods; if (bootstrapMethodsAttribute == null) { bootstrapMethodsAttribute = bootstrapMethods = new ByteVector(); } // The bootstrap me...
java
{ "resource": "" }
q170976
SymbolTable.addMergedType
test
int addMergedType(final int typeTableIndex1, final int typeTableIndex2) { // TODO sort the arguments? The merge result should be independent of their order. long data = typeTableIndex1 | (((long) typeTableIndex2) << 32); int hashCode = hash(Symbol.MERGED_TYPE_TAG, typeTableIndex1 + typeTableIndex2); Ent...
java
{ "resource": "" }
q170977
HttpMultiMap.hash
test
private int hash(final String name) { int h = 0; for (int i = name.length() - 1; i >= 0; i--) { char c = name.charAt(i); if (!caseSensitive) { if (c >= 'A' && c <= 'Z') { c += 32; } } h = 31 * h + c; } if (h > 0) { return h; } if (h == Integer.MIN_VALUE) { return Integer.MAX_...
java
{ "resource": "" }
q170978
HttpMultiMap.clear
test
public HttpMultiMap<V> clear() { for (int i = 0; i < entries.length; i++) { entries[i] = null; } head.before = head.after = head; return this; }
java
{ "resource": "" }
q170979
HttpMultiMap.getAll
test
public List<V> getAll(final String name) { LinkedList<V> values = new LinkedList<>(); int h = hash(name); int i = index(h); MapEntry<V> e = entries[i]; while (e != null) { if (e.hash == h && eq(name, e.key)) { values.addFirst(e.getValue()); } e = e.next; } return values; }
java
{ "resource": "" }
q170980
HttpMultiMap.iterator
test
@Override public Iterator<Map.Entry<String, V>> iterator() { final MapEntry[] e = {head.after}; return new Iterator<Map.Entry<String, V>>() { @Override public boolean hasNext() { return e[0] != head; } @Override @SuppressWarnings("unchecked") public Map.Entry<String, V> next() { if (!ha...
java
{ "resource": "" }
q170981
HttpMultiMap.entries
test
public List<Map.Entry<String, V>> entries() { List<Map.Entry<String, V>> all = new LinkedList<>(); MapEntry<V> e = head.after; while (e != head) { all.add(e); e = e.after; } return all; }
java
{ "resource": "" }
q170982
FastCharBuffer.grow
test
private void grow(final int minCapacity) { final int oldCapacity = buffer.length; int newCapacity = oldCapacity << 1; if (newCapacity - minCapacity < 0) { // special case, min capacity is larger then a grow newCapacity = minCapacity + 512; } buffer = Arrays.copyOf(buffer, newCapacity); }
java
{ "resource": "" }
q170983
FastCharBuffer.append
test
@Override public FastCharBuffer append(final CharSequence csq, final int start, final int end) { for (int i = start; i < end; i++) { append(csq.charAt(i)); } return this; }
java
{ "resource": "" }
q170984
ProxettaMethodBuilder.visitAnnotation
test
@Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { AnnotationVisitor destAnn = methodVisitor.visitAnnotation(desc, visible); // [A4] return new AnnotationVisitorAdapter(destAnn); }
java
{ "resource": "" }
q170985
ProxettaMethodBuilder.visitEnd
test
@Override public void visitEnd() { createFirstChainDelegate_Continue(tmd); for (int p = 0; p < tmd.proxyData.length; p++) { tmd.selectCurrentProxy(p); createProxyMethod(tmd); } }
java
{ "resource": "" }
q170986
ProxettaMethodBuilder.createFirstChainDelegate_Start
test
protected void createFirstChainDelegate_Start() { // check invalid access flags int access = msign.getAccessFlags(); if (!wd.allowFinalMethods) { if ((access & AsmUtil.ACC_FINAL) != 0) { // detect final throw new ProxettaException( "Unable to create proxy for final method: " + msign + ". Remove fina...
java
{ "resource": "" }
q170987
ProxettaMethodBuilder.createFirstChainDelegate_Continue
test
protected void createFirstChainDelegate_Continue(final TargetMethodData tmd) { methodVisitor.visitCode(); if (tmd.msign.isStatic) { loadStaticMethodArguments(methodVisitor, tmd.msign); methodVisitor.visitMethodInsn( INVOKESTATIC, wd.thisReference, tmd.firstMethodName(), tmd.msign.getDescripti...
java
{ "resource": "" }
q170988
Path.parse
test
public static Path parse(final String path) { return path == null ? new Path() : new Path(StringUtil.splitc(path, '.')); }
java
{ "resource": "" }
q170989
Path.push
test
public Path push(final CharSequence field) { _push(field); if (altPath != null) { altPath.push(field); } return this; }
java
{ "resource": "" }
q170990
JoyContextListener.configureServletContext
test
private void configureServletContext(final ServletContext servletContext) { servletContext.addListener(jodd.servlet.RequestContextListener.class); if (decoraEnabled) { final FilterRegistration filter = servletContext.addFilter("decora", jodd.decora.DecoraServletFilter.class); filter.addMappingForUrlPatterns(...
java
{ "resource": "" }
q170991
PathrefAdvice.execute
test
public Object execute() { String methodName = targetMethodName(); Class returnType = returnType(); Object next = pathref.continueWith(this, methodName, returnType); return ProxyTarget.returnValue(next); }
java
{ "resource": "" }
q170992
Fields.getAllFieldDescriptors
test
public FieldDescriptor[] getAllFieldDescriptors() { if (allFields == null) { FieldDescriptor[] allFields = new FieldDescriptor[fieldsMap.size()]; int index = 0; for (FieldDescriptor fieldDescriptor : fieldsMap.values()) { allFields[index] = fieldDescriptor; index++; } Arrays.sort(allFields, C...
java
{ "resource": "" }
q170993
ProxettaAwarePetiteContainer.createBeanDefinitionForRegistration
test
@SuppressWarnings("unchecked") @Override protected <T> BeanDefinition<T> createBeanDefinitionForRegistration( final String name, Class<T> type, final Scope scope, final WiringMode wiringMode, final Consumer<T> consumer) { if (proxetta != null) { final Class originalType = type; final Proxetta...
java
{ "resource": "" }
q170994
JtxDbUtil.convertToDbMode
test
public static DbTransactionMode convertToDbMode(final JtxTransactionMode txMode) { final int isolation; switch (txMode.getIsolationLevel()) { case ISOLATION_DEFAULT: isolation = DbTransactionMode.ISOLATION_DEFAULT; break; case ISOLATION_NONE: isolation = DbTransactionMode.ISOLATION_NONE; break; case ISOLAT...
java
{ "resource": "" }
q170995
BeanSerializer.readProperty
test
private Object readProperty(final Object source, final PropertyDescriptor propertyDescriptor) { Getter getter = propertyDescriptor.getGetter(declared); if (getter != null) { try { return getter.invokeGetter(source); } catch (Exception ex) { throw new JsonException(ex); } } return null; }
java
{ "resource": "" }
q170996
IntHashMap.putAll
test
@Override public void putAll(final Map t) { for (Object o : t.entrySet()) { Map.Entry e = (Map.Entry) o; put(e.getKey(), e.getValue()); } }
java
{ "resource": "" }
q170997
Buffer.append
test
public Buffer append(final Buffer buffer) { if (buffer.list.isEmpty()) { // nothing to append return buffer; } list.addAll(buffer.list); last = buffer.last; size += buffer.size; return this; }
java
{ "resource": "" }
q170998
Buffer.writeTo
test
public void writeTo(final Writer writer) throws IOException { for (Object o : list) { if (o instanceof FastByteBuffer) { FastByteBuffer fastByteBuffer = (FastByteBuffer) o; byte[] array = fastByteBuffer.toArray(); writer.write(new String(array, StringPool.ISO_8859_1)); } else if (o instanceof U...
java
{ "resource": "" }
q170999
Buffer.writeTo
test
public void writeTo(final OutputStream out) throws IOException { for (Object o : list) { if (o instanceof FastByteBuffer) { FastByteBuffer fastByteBuffer = (FastByteBuffer) o; out.write(fastByteBuffer.toArray()); } else if (o instanceof Uploadable) { Uploadable uploadable = (Uploadable) o; ...
java
{ "resource": "" }