_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q171700 | JsonArray.remove | test | public Object remove(final int pos) {
Object removed = list.remove(pos);
if (removed instanceof Map) {
return new JsonObject((Map) removed);
}
if (removed instanceof ArrayList) {
return new JsonArray((List) removed);
}
return removed;
} | java | {
"resource": ""
} |
q171701 | AbstractTemplateViewActionResult.resolveTarget | test | protected String resolveTarget(final ActionRequest actionRequest, final String resultValue) {
String resultBasePath = actionRequest.getActionRuntime().getResultBasePath();
ResultPath resultPath = resultMapper.resolveResultPath(resultBasePath, resultValue);
String actionPath = resultPath.path();
String path = actionPath;
String value = resultPath.value();
if (StringUtil.isEmpty(value)) {
value = null;
}
String target;
while (true) {
// variant #1: with value
if (value != null) {
if (path == null) {
// only value remains
int lastSlashNdx = actionPath.lastIndexOf('/');
if (lastSlashNdx != -1) {
target = actionPath.substring(0, lastSlashNdx + 1) + value;
} else {
target = '/' + value;
}
} else {
target = path + '.' + value;
}
target = locateTarget(actionRequest, target);
if (target != null) {
break;
}
}
if (path != null) {
// variant #2: without value
target = locateTarget(actionRequest, path);
if (target != null) {
break;
}
}
// continue
if (path == null) {
// path not found
return null;
}
int dotNdx = MadvocUtil.lastIndexOfDotAfterSlash(path);
if (dotNdx == -1) {
path = null;
} else {
path = path.substring(0, dotNdx);
}
}
return target;
} | java | {
"resource": ""
} |
q171702 | AbstractTemplateViewActionResult.targetNotFound | test | protected void targetNotFound(final ActionRequest actionRequest, final String actionAndResultPath) throws IOException {
final HttpServletResponse response = actionRequest.getHttpServletResponse();
if (!response.isCommitted()) {
response.sendError(SC_NOT_FOUND, "Result not found: " + actionAndResultPath);
}
} | java | {
"resource": ""
} |
q171703 | FormProcessorVisitor.valueToString | test | protected String valueToString(final String name, final Object valueObject) {
if (!valueObject.getClass().isArray()) {
return valueObject.toString();
}
// array
String[] array = (String[]) valueObject;
if (valueNameIndexes == null) {
valueNameIndexes = new HashMap<>();
}
MutableInteger index = valueNameIndexes.get(name);
if (index == null) {
index = new MutableInteger(0);
valueNameIndexes.put(name, index);
}
if (index.value >= array.length) {
return null;
}
String result = array[index.value];
index.value++;
return result;
} | java | {
"resource": ""
} |
q171704 | MadvocRouter.filter | test | @SuppressWarnings("unchecked")
public <T extends ActionFilter> MadvocRouter filter(final Class<T> actionFilterClass) {
filtersManager.resolve(actionFilterClass);
return this;
} | java | {
"resource": ""
} |
q171705 | PseudoFunction.getPseudoFunctionName | test | public String getPseudoFunctionName() {
String name = getClass().getSimpleName().toLowerCase();
name = name.replace('_', '-');
return name;
} | java | {
"resource": ""
} |
q171706 | PropertyResolver.resolve | test | public PropertyInjectionPoint[] resolve(Class type, final boolean autowire) {
final List<PropertyInjectionPoint> list = new ArrayList<>();
final Set<String> usedPropertyNames = new HashSet<>();
// lookup fields
while (type != Object.class) {
final ClassDescriptor cd = ClassIntrospector.get().lookup(type);
final PropertyDescriptor[] allPropertyDescriptors = cd.getAllPropertyDescriptors();
for (PropertyDescriptor propertyDescriptor : allPropertyDescriptors) {
if (propertyDescriptor.isGetterOnly()) {
continue;
}
if (usedPropertyNames.contains(propertyDescriptor.getName())) {
continue;
}
Class propertyType = propertyDescriptor.getType();
if (ClassUtil.isTypeOf(propertyType, Collection.class)) {
continue;
}
BeanReferences reference = referencesResolver.readReferenceFromAnnotation(propertyDescriptor);
if (reference == null) {
if (!autowire) {
continue;
} else {
reference = referencesResolver.buildDefaultReference(propertyDescriptor);
}
}
list.add(new PropertyInjectionPoint(propertyDescriptor, reference));
usedPropertyNames.add(propertyDescriptor.getName());
}
// go to the supertype
type = type.getSuperclass();
}
final PropertyInjectionPoint[] fields;
if (list.isEmpty()) {
fields = PropertyInjectionPoint.EMPTY;
} else {
fields = list.toArray(new PropertyInjectionPoint[0]);
}
return fields;
} | java | {
"resource": ""
} |
q171707 | Socks4ProxySocketFactory.createSocks4ProxySocket | test | private Socket createSocks4ProxySocket(final String host, final int port) {
Socket socket = null;
final String proxyHost = proxy.getProxyAddress();
final int proxyPort = proxy.getProxyPort();
final String user = proxy.getProxyUsername();
try {
socket = Sockets.connect(proxyHost, proxyPort, connectionTimeout);
final InputStream in = socket.getInputStream();
final OutputStream out = socket.getOutputStream();
socket.setTcpNoDelay(true);
byte[] buf = new byte[1024];
// 1) CONNECT
int index = 0;
buf[index++] = 4;
buf[index++] = 1;
buf[index++] = (byte) (port >>> 8);
buf[index++] = (byte) (port & 0xff);
InetAddress addr = InetAddress.getByName(host);
byte[] byteAddress = addr.getAddress();
for (byte byteAddres : byteAddress) {
buf[index++] = byteAddres;
}
if (user != null) {
System.arraycopy(user.getBytes(), 0, buf, index, user.length());
index += user.length();
}
buf[index++] = 0;
out.write(buf, 0, index);
// 2) RESPONSE
int len = 6;
int s = 0;
while (s < len) {
int i = in.read(buf, s, len - s);
if (i <= 0) {
throw new HttpException(ProxyInfo.ProxyType.SOCKS4, "stream is closed");
}
s += i;
}
if (buf[0] != 0) {
throw new HttpException(ProxyInfo.ProxyType.SOCKS4, "proxy returned VN " + buf[0]);
}
if (buf[1] != 90) {
try {
socket.close();
} catch (Exception ignore) {
}
throw new HttpException(ProxyInfo.ProxyType.SOCKS4, "proxy returned CD " + buf[1]);
}
byte[] temp = new byte[2];
in.read(temp, 0, 2);
return socket;
} catch (RuntimeException rtex) {
closeSocket(socket);
throw rtex;
} catch (Exception ex) {
closeSocket(socket);
throw new HttpException(ProxyInfo.ProxyType.SOCKS4, ex.toString(), ex);
}
} | java | {
"resource": ""
} |
q171708 | Attribute.getAttributeCount | test | final int getAttributeCount() {
int count = 0;
Attribute attribute = this;
while (attribute != null) {
count += 1;
attribute = attribute.nextAttribute;
}
return count;
} | java | {
"resource": ""
} |
q171709 | ResultsManager.getAllActionResults | test | public Set<ActionResult> getAllActionResults() {
final Set<ActionResult> set = new HashSet<>(allResults.size());
allResults.forEachValue(set::add);
return set;
} | java | {
"resource": ""
} |
q171710 | CharSequenceUtil.equalsOne | test | public static boolean equalsOne(final char c, final CharSequence match) {
for (int i = 0; i < match.length(); i++) {
char aMatch = match.charAt(i);
if (c == aMatch) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q171711 | CharSequenceUtil.findFirstEqual | test | public static int findFirstEqual(final CharSequence source, final int index, final CharSequence match) {
for (int i = index; i < source.length(); i++) {
if (equalsOne(source.charAt(i), match)) {
return i;
}
}
return -1;
} | java | {
"resource": ""
} |
q171712 | CharSequenceUtil.findFirstEqual | test | public static int findFirstEqual(final char[] source, final int index, final char match) {
for (int i = index; i < source.length; i++) {
if (source[i] == match) {
return i;
}
}
return -1;
} | java | {
"resource": ""
} |
q171713 | CommandLine.args | test | public CommandLine args(final String... arguments) {
if (arguments != null && arguments.length > 0) {
Collections.addAll(cmdLine, arguments);
}
return this;
} | java | {
"resource": ""
} |
q171714 | CommandLine.env | test | public CommandLine env(final String key, final String value) {
if (env == null) {
env = new HashMap<>();
}
env.put(key, value);
return this;
} | java | {
"resource": ""
} |
q171715 | CommandLine.run | test | public ProcessRunner.ProcessResult run() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
out = err = baos;
try {
baos.write(StringUtil.join(cmdLine, ' ').getBytes());
baos.write(StringPool.BYTES_NEW_LINE);
}
catch (IOException ignore) {
}
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(cmdLine);
if (cleanEnvironment) {
processBuilder.environment().clear();
}
if (env != null) {
processBuilder.environment().putAll(env);
}
processBuilder.directory(workingDirectory);
Process process = null;
try {
process = processBuilder.start();
}
catch (IOException ioex) {
return writeException(baos, ioex);
}
StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), out, outPrefix);
StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), err, errPrefix);
outputGobbler.start();
errorGobbler.start();
int result;
try {
result = process.waitFor();
}
catch (InterruptedException iex) {
return writeException(baos, iex);
}
outputGobbler.waitFor();
errorGobbler.waitFor();
return new ProcessRunner.ProcessResult(result, baos.toString());
} | java | {
"resource": ""
} |
q171716 | MadvocComponentLifecycle.invoke | test | public static void invoke(final Object listener, final Class listenerType) {
if (listenerType == Init.class) {
((Init) listener).init();
return;
}
if (listenerType == Start.class) {
((Start) listener).start();
return;
}
if (listenerType == Ready.class) {
((Ready) listener).ready();
return;
}
if (listenerType == Stop.class) {
((Stop) listener).stop();
return;
}
throw new MadvocException("Invalid listener");
} | java | {
"resource": ""
} |
q171717 | Frame.copyFrom | test | final void copyFrom(final Frame frame) {
inputLocals = frame.inputLocals;
inputStack = frame.inputStack;
outputStackStart = 0;
outputLocals = frame.outputLocals;
outputStack = frame.outputStack;
outputStackTop = frame.outputStackTop;
initializationCount = frame.initializationCount;
initializations = frame.initializations;
} | java | {
"resource": ""
} |
q171718 | Frame.getAbstractTypeFromApiFormat | test | static int getAbstractTypeFromApiFormat(final SymbolTable symbolTable, final Object type) {
if (type instanceof Integer) {
return CONSTANT_KIND | ((Integer) type).intValue();
} else if (type instanceof String) {
String descriptor = Type.getObjectType((String) type).getDescriptor();
return getAbstractTypeFromDescriptor(symbolTable, descriptor, 0);
} else {
return UNINITIALIZED_KIND
| symbolTable.addUninitializedType("", ((Label) type).bytecodeOffset);
}
} | java | {
"resource": ""
} |
q171719 | Frame.getAbstractTypeFromDescriptor | test | private static int getAbstractTypeFromDescriptor(
final SymbolTable symbolTable, final String buffer, final int offset) {
String internalName;
switch (buffer.charAt(offset)) {
case 'V':
return 0;
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
return INTEGER;
case 'F':
return FLOAT;
case 'J':
return LONG;
case 'D':
return DOUBLE;
case 'L':
internalName = buffer.substring(offset + 1, buffer.length() - 1);
return REFERENCE_KIND | symbolTable.addType(internalName);
case '[':
int elementDescriptorOffset = offset + 1;
while (buffer.charAt(elementDescriptorOffset) == '[') {
++elementDescriptorOffset;
}
int typeValue;
switch (buffer.charAt(elementDescriptorOffset)) {
case 'Z':
typeValue = BOOLEAN;
break;
case 'C':
typeValue = CHAR;
break;
case 'B':
typeValue = BYTE;
break;
case 'S':
typeValue = SHORT;
break;
case 'I':
typeValue = INTEGER;
break;
case 'F':
typeValue = FLOAT;
break;
case 'J':
typeValue = LONG;
break;
case 'D':
typeValue = DOUBLE;
break;
case 'L':
internalName = buffer.substring(elementDescriptorOffset + 1, buffer.length() - 1);
typeValue = REFERENCE_KIND | symbolTable.addType(internalName);
break;
default:
throw new IllegalArgumentException();
}
return ((elementDescriptorOffset - offset) << DIM_SHIFT) | typeValue;
default:
throw new IllegalArgumentException();
}
} | java | {
"resource": ""
} |
q171720 | Frame.setInputFrameFromApiFormat | test | final void setInputFrameFromApiFormat(
final SymbolTable symbolTable,
final int numLocal,
final Object[] local,
final int numStack,
final Object[] stack) {
int inputLocalIndex = 0;
for (int i = 0; i < numLocal; ++i) {
inputLocals[inputLocalIndex++] = getAbstractTypeFromApiFormat(symbolTable, local[i]);
if (local[i] == Opcodes.LONG || local[i] == Opcodes.DOUBLE) {
inputLocals[inputLocalIndex++] = TOP;
}
}
while (inputLocalIndex < inputLocals.length) {
inputLocals[inputLocalIndex++] = TOP;
}
int numStackTop = 0;
for (int i = 0; i < numStack; ++i) {
if (stack[i] == Opcodes.LONG || stack[i] == Opcodes.DOUBLE) {
++numStackTop;
}
}
inputStack = new int[numStack + numStackTop];
int inputStackIndex = 0;
for (int i = 0; i < numStack; ++i) {
inputStack[inputStackIndex++] = getAbstractTypeFromApiFormat(symbolTable, stack[i]);
if (stack[i] == Opcodes.LONG || stack[i] == Opcodes.DOUBLE) {
inputStack[inputStackIndex++] = TOP;
}
}
outputStackTop = 0;
initializationCount = 0;
} | java | {
"resource": ""
} |
q171721 | Frame.getLocal | test | private int getLocal(final int localIndex) {
if (outputLocals == null || localIndex >= outputLocals.length) {
// If this local has never been assigned in this basic block, it is still equal to its value
// in the input frame.
return LOCAL_KIND | localIndex;
} else {
int abstractType = outputLocals[localIndex];
if (abstractType == 0) {
// If this local has never been assigned in this basic block, so it is still equal to its
// value in the input frame.
abstractType = outputLocals[localIndex] = LOCAL_KIND | localIndex;
}
return abstractType;
}
} | java | {
"resource": ""
} |
q171722 | Frame.setLocal | test | private void setLocal(final int localIndex, final int abstractType) {
// Create and/or resize the output local variables array if necessary.
if (outputLocals == null) {
outputLocals = new int[10];
}
int outputLocalsLength = outputLocals.length;
if (localIndex >= outputLocalsLength) {
int[] newOutputLocals = new int[Math.max(localIndex + 1, 2 * outputLocalsLength)];
System.arraycopy(outputLocals, 0, newOutputLocals, 0, outputLocalsLength);
outputLocals = newOutputLocals;
}
// Set the local variable.
outputLocals[localIndex] = abstractType;
} | java | {
"resource": ""
} |
q171723 | Frame.push | test | private void push(final int abstractType) {
// Create and/or resize the output stack array if necessary.
if (outputStack == null) {
outputStack = new int[10];
}
int outputStackLength = outputStack.length;
if (outputStackTop >= outputStackLength) {
int[] newOutputStack = new int[Math.max(outputStackTop + 1, 2 * outputStackLength)];
System.arraycopy(outputStack, 0, newOutputStack, 0, outputStackLength);
outputStack = newOutputStack;
}
// Pushes the abstract type on the output stack.
outputStack[outputStackTop++] = abstractType;
// Updates the maximum size reached by the output stack, if needed (note that this size is
// relative to the input stack size, which is not known yet).
short outputStackSize = (short) (outputStackStart + outputStackTop);
if (outputStackSize > owner.outputStackMax) {
owner.outputStackMax = outputStackSize;
}
} | java | {
"resource": ""
} |
q171724 | Frame.push | test | private void push(final SymbolTable symbolTable, final String descriptor) {
int typeDescriptorOffset = descriptor.charAt(0) == '(' ? descriptor.indexOf(')') + 1 : 0;
int abstractType = getAbstractTypeFromDescriptor(symbolTable, descriptor, typeDescriptorOffset);
if (abstractType != 0) {
push(abstractType);
if (abstractType == LONG || abstractType == DOUBLE) {
push(TOP);
}
}
} | java | {
"resource": ""
} |
q171725 | Frame.pop | test | private void pop(final int elements) {
if (outputStackTop >= elements) {
outputStackTop -= elements;
} else {
// If the number of elements to be popped is greater than the number of elements in the output
// stack, clear it, and pop the remaining elements from the input stack.
outputStackStart -= elements - outputStackTop;
outputStackTop = 0;
}
} | java | {
"resource": ""
} |
q171726 | Frame.pop | test | private void pop(final String descriptor) {
char firstDescriptorChar = descriptor.charAt(0);
if (firstDescriptorChar == '(') {
pop((Type.getArgumentsAndReturnSizes(descriptor) >> 2) - 1);
} else if (firstDescriptorChar == 'J' || firstDescriptorChar == 'D') {
pop(2);
} else {
pop(1);
}
} | java | {
"resource": ""
} |
q171727 | Frame.addInitializedType | test | private void addInitializedType(final int abstractType) {
// Create and/or resize the initializations array if necessary.
if (initializations == null) {
initializations = new int[2];
}
int initializationsLength = initializations.length;
if (initializationCount >= initializationsLength) {
int[] newInitializations =
new int[Math.max(initializationCount + 1, 2 * initializationsLength)];
System.arraycopy(initializations, 0, newInitializations, 0, initializationsLength);
initializations = newInitializations;
}
// Store the abstract type.
initializations[initializationCount++] = abstractType;
} | java | {
"resource": ""
} |
q171728 | Frame.getInitializedType | test | private int getInitializedType(final SymbolTable symbolTable, final int abstractType) {
if (abstractType == UNINITIALIZED_THIS
|| (abstractType & (DIM_MASK | KIND_MASK)) == UNINITIALIZED_KIND) {
for (int i = 0; i < initializationCount; ++i) {
int initializedType = initializations[i];
int dim = initializedType & DIM_MASK;
int kind = initializedType & KIND_MASK;
int value = initializedType & VALUE_MASK;
if (kind == LOCAL_KIND) {
initializedType = dim + inputLocals[value];
} else if (kind == STACK_KIND) {
initializedType = dim + inputStack[inputStack.length - value];
}
if (abstractType == initializedType) {
if (abstractType == UNINITIALIZED_THIS) {
return REFERENCE_KIND | symbolTable.addType(symbolTable.getClassName());
} else {
return REFERENCE_KIND
| symbolTable.addType(symbolTable.getType(abstractType & VALUE_MASK).value);
}
}
}
}
return abstractType;
} | java | {
"resource": ""
} |
q171729 | Frame.putAbstractType | test | static void putAbstractType(
final SymbolTable symbolTable, final int abstractType, final ByteVector output) {
int arrayDimensions = (abstractType & Frame.DIM_MASK) >> DIM_SHIFT;
if (arrayDimensions == 0) {
int typeValue = abstractType & VALUE_MASK;
switch (abstractType & KIND_MASK) {
case CONSTANT_KIND:
output.putByte(typeValue);
break;
case REFERENCE_KIND:
output
.putByte(ITEM_OBJECT)
.putShort(symbolTable.addConstantClass(symbolTable.getType(typeValue).value).index);
break;
case UNINITIALIZED_KIND:
output.putByte(ITEM_UNINITIALIZED).putShort((int) symbolTable.getType(typeValue).data);
break;
default:
throw new AssertionError();
}
} else {
// Case of an array type, we need to build its descriptor first.
StringBuilder typeDescriptor = new StringBuilder();
while (arrayDimensions-- > 0) {
typeDescriptor.append('[');
}
if ((abstractType & KIND_MASK) == REFERENCE_KIND) {
typeDescriptor
.append('L')
.append(symbolTable.getType(abstractType & VALUE_MASK).value)
.append(';');
} else {
switch (abstractType & VALUE_MASK) {
case Frame.ITEM_ASM_BOOLEAN:
typeDescriptor.append('Z');
break;
case Frame.ITEM_ASM_BYTE:
typeDescriptor.append('B');
break;
case Frame.ITEM_ASM_CHAR:
typeDescriptor.append('C');
break;
case Frame.ITEM_ASM_SHORT:
typeDescriptor.append('S');
break;
case Frame.ITEM_INTEGER:
typeDescriptor.append('I');
break;
case Frame.ITEM_FLOAT:
typeDescriptor.append('F');
break;
case Frame.ITEM_LONG:
typeDescriptor.append('J');
break;
case Frame.ITEM_DOUBLE:
typeDescriptor.append('D');
break;
default:
throw new AssertionError();
}
}
output
.putByte(ITEM_OBJECT)
.putShort(symbolTable.addConstantClass(typeDescriptor.toString()).index);
}
} | java | {
"resource": ""
} |
q171730 | TimedCache.pruneCache | test | @Override
protected int pruneCache() {
int count = 0;
Iterator<CacheObject<K,V>> values = cacheMap.values().iterator();
while (values.hasNext()) {
CacheObject co = values.next();
if (co.isExpired()) {
values.remove();
count++;
}
}
return count;
} | java | {
"resource": ""
} |
q171731 | TimedCache.schedulePrune | test | public void schedulePrune(final long delay) {
if (pruneTimer != null) {
pruneTimer.cancel();
}
pruneTimer = new Timer();
pruneTimer.schedule(
new TimerTask() {
@Override
public void run() {
prune();
}
}, delay, delay
);
} | java | {
"resource": ""
} |
q171732 | ClassVisitor.visitModule | test | public ModuleVisitor visitModule(final String name, final int access, final String version) {
if (api < Opcodes.ASM6) {
throw new UnsupportedOperationException("This feature requires ASM6");
}
if (cv != null) {
return cv.visitModule(name, access, version);
}
return null;
} | java | {
"resource": ""
} |
q171733 | ClassVisitor.visitNestHost | test | public void visitNestHost(final String nestHost) {
if (api < Opcodes.ASM7) {
throw new UnsupportedOperationException("This feature requires ASM7");
}
if (cv != null) {
cv.visitNestHost(nestHost);
}
} | java | {
"resource": ""
} |
q171734 | ClassVisitor.visitOuterClass | test | public void visitOuterClass(final String owner, final String name, final String descriptor) {
if (cv != null) {
cv.visitOuterClass(owner, name, descriptor);
}
} | java | {
"resource": ""
} |
q171735 | ClassVisitor.visitAnnotation | test | public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
if (cv != null) {
return cv.visitAnnotation(descriptor, visible);
}
return null;
} | java | {
"resource": ""
} |
q171736 | ClassVisitor.visitNestMember | test | public void visitNestMember(final String nestMember) {
if (api < Opcodes.ASM7) {
throw new UnsupportedOperationException("This feature requires ASM7");
}
if (cv != null) {
cv.visitNestMember(nestMember);
}
} | java | {
"resource": ""
} |
q171737 | ClassVisitor.visitInnerClass | test | public void visitInnerClass(
final String name, final String outerName, final String innerName, final int access) {
if (cv != null) {
cv.visitInnerClass(name, outerName, innerName, access);
}
} | java | {
"resource": ""
} |
q171738 | ClassVisitor.visitField | test | public FieldVisitor visitField(
final int access,
final String name,
final String descriptor,
final String signature,
final Object value) {
if (cv != null) {
return cv.visitField(access, name, descriptor, signature, value);
}
return null;
} | java | {
"resource": ""
} |
q171739 | DbThreadSession.getThreadSession | test | public static DbThreadSession getThreadSession() {
DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get();
if (session == null) {
session = new DbThreadSession();
}
return session;
} | java | {
"resource": ""
} |
q171740 | DbThreadSession.closeThreadSession | test | public static void closeThreadSession() {
DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get();
if (session != null) {
session.closeSession();
}
} | java | {
"resource": ""
} |
q171741 | ActionRequest.createExecutionArray | test | protected ActionWrapper[] createExecutionArray() {
int totalInterceptors = (this.actionRuntime.getInterceptors() != null ? this.actionRuntime.getInterceptors().length : 0);
int totalFilters = (this.actionRuntime.getFilters() != null ? this.actionRuntime.getFilters().length : 0);
ActionWrapper[] executionArray = new ActionWrapper[totalFilters + 1 + totalInterceptors + 1];
// filters
int index = 0;
if (totalFilters > 0) {
System.arraycopy(actionRuntime.getFilters(), 0, executionArray, index, totalFilters);
index += totalFilters;
}
// result is executed AFTER the action AND interceptors
executionArray[index++] = actionRequest -> {
Object actionResult = actionRequest.invoke();
ActionRequest.this.madvocController.render(ActionRequest.this, actionResult);
return actionResult;
};
// interceptors
if (totalInterceptors > 0) {
System.arraycopy(actionRuntime.getInterceptors(), 0, executionArray, index, totalInterceptors);
index += totalInterceptors;
}
// action
executionArray[index] = actionRequest -> {
actionResult = invokeActionMethod();
return actionResult;
};
return executionArray;
} | java | {
"resource": ""
} |
q171742 | ActionRequest.invokeActionMethod | test | protected Object invokeActionMethod() throws Exception {
if (actionRuntime.isActionHandlerDefined()) {
actionRuntime.getActionHandler().handle(this);
return null;
}
final Object[] params = targets.extractParametersValues();
try {
return actionRuntime.getActionClassMethod().invoke(action, params);
} catch(InvocationTargetException itex) {
throw wrapToException(unwrapThrowable(itex));
}
} | java | {
"resource": ""
} |
q171743 | ActionRequest.readRequestBody | test | public String readRequestBody() {
if (requestBody == null) {
try {
requestBody = ServletUtil.readRequestBodyFromStream(getHttpServletRequest());
} catch (IOException ioex) {
requestBody = StringPool.EMPTY;
}
}
return requestBody;
} | java | {
"resource": ""
} |
q171744 | PageData.calcFirstItemIndexOfPage | test | public static int calcFirstItemIndexOfPage(int page, final int pageSize, final int total) {
if (total == 0) {
return 0;
}
if (page < 1) {
page = 1;
}
int first = (page - 1) * pageSize;
if (first >= total) {
first = ((total - 1) / pageSize) * pageSize; // first item on the last page
}
return first;
} | java | {
"resource": ""
} |
q171745 | PageData.calcFirstItemIndexOfPage | test | public static int calcFirstItemIndexOfPage(final PageRequest pageRequest, final int total) {
return calcFirstItemIndexOfPage(pageRequest.getPage(), pageRequest.getSize(), total);
} | java | {
"resource": ""
} |
q171746 | PseudoFunctionExpression.match | test | public boolean match(final int value) {
if (a == 0) {
return value == b;
}
if (a > 0) {
if (value < b) {
return false;
}
return (value - b) % a == 0;
}
if (value > b) {
return false;
}
return (b - value) % (-a) == 0;
} | java | {
"resource": ""
} |
q171747 | CharUtil.toRawByteArray | test | public static byte[] toRawByteArray(final char[] carr) {
byte[] barr = new byte[carr.length << 1];
for (int i = 0, bpos = 0; i < carr.length; i++) {
char c = carr[i];
barr[bpos++] = (byte) ((c & 0xFF00) >> 8);
barr[bpos++] = (byte) (c & 0x00FF);
}
return barr;
} | java | {
"resource": ""
} |
q171748 | CharUtil.findFirstDiff | test | public static int findFirstDiff(final char[] source, final int index, final char[] match) {
for (int i = index; i < source.length; i++) {
if (!equalsOne(source[i], match)) {
return i;
}
}
return -1;
} | java | {
"resource": ""
} |
q171749 | LagartoHtmlRendererNodeVisitor.resolveNodeName | test | protected String resolveNodeName(final Node node) {
switch (tagCase) {
case DEFAULT: return node.getNodeName();
case RAW: return node.getNodeRawName();
case LOWERCASE: return node.getNodeRawName().toLowerCase();
case UPPERCASE: return node.getNodeRawName().toUpperCase();
}
return null;
} | java | {
"resource": ""
} |
q171750 | LagartoHtmlRendererNodeVisitor.resolveAttributeName | test | protected String resolveAttributeName(final Node node, final Attribute attribute) {
switch (attributeCase) {
case DEFAULT: return attribute.getName();
case RAW: return attribute.getRawName();
case LOWERCASE: return attribute.getRawName().toLowerCase();
case UPPERCASE: return attribute.getRawName().toUpperCase();
}
return null;
} | java | {
"resource": ""
} |
q171751 | LagartoHtmlRendererNodeVisitor.renderAttribute | test | protected void renderAttribute(final Node node, final Attribute attribute, final Appendable appendable) throws IOException {
String name = resolveAttributeName(node, attribute);
String value = attribute.getValue();
appendable.append(name);
if (value != null) {
appendable.append('=');
appendable.append('\"');
appendable.append(HtmlEncoder.attributeDoubleQuoted(value));
appendable.append('\"');
}
} | java | {
"resource": ""
} |
q171752 | Props.load | test | public Props load(final File file) throws IOException {
final String extension = FileNameUtil.getExtension(file.getAbsolutePath());
final String data;
if (extension.equalsIgnoreCase("properties")) {
data = FileUtil.readString(file, StringPool.ISO_8859_1);
} else {
data = FileUtil.readString(file);
}
parse(data);
return this;
} | java | {
"resource": ""
} |
q171753 | Props.load | test | public Props load(final File file, final String encoding) throws IOException {
parse(FileUtil.readString(file, encoding));
return this;
} | java | {
"resource": ""
} |
q171754 | Props.load | test | public Props load(final InputStream in) throws IOException {
final Writer out = new FastCharArrayWriter();
StreamUtil.copy(in, out);
parse(out.toString());
return this;
} | java | {
"resource": ""
} |
q171755 | Props.load | test | public Props load(final Map<?, ?> p) {
for (final Map.Entry<?, ?> entry : p.entrySet()) {
final String name = entry.getKey().toString();
final Object value = entry.getValue();
if (value == null) {
continue;
}
data.putBaseProperty(name, value.toString(), false);
}
return this;
} | java | {
"resource": ""
} |
q171756 | Props.load | test | @SuppressWarnings("unchecked")
public Props load(final Map<?, ?> map, final String prefix) {
String realPrefix = prefix;
realPrefix += '.';
for (final Map.Entry entry : map.entrySet()) {
final String name = entry.getKey().toString();
final Object value = entry.getValue();
if (value == null) {
continue;
}
data.putBaseProperty(realPrefix + name, value.toString(), false);
}
return this;
} | java | {
"resource": ""
} |
q171757 | Props.loadFromClasspath | test | public Props loadFromClasspath(final String... patterns) {
ClassScanner.create()
.registerEntryConsumer(entryData -> {
String usedEncoding = JoddCore.encoding;
if (StringUtil.endsWithIgnoreCase(entryData.name(), ".properties")) {
usedEncoding = StringPool.ISO_8859_1;
}
final String encoding = usedEncoding;
UncheckedException.runAndWrapException(() -> load(entryData.openInputStream(), encoding));
})
.includeResources(true)
.ignoreException(true)
.excludeCommonJars()
.excludeAllEntries(true)
.includeEntries(patterns)
.scanDefaultClasspath()
.start();
return this;
} | java | {
"resource": ""
} |
q171758 | Props.getValueOrDefault | test | public String getValueOrDefault(final String key, final String defaultValue) {
initialize();
final String value = data.lookupValue(key, activeProfiles);
if (value == null) {
return defaultValue;
}
return value;
} | java | {
"resource": ""
} |
q171759 | Props.setValue | test | public void setValue(final String key, final String value, final String profile) {
if (profile == null) {
data.putBaseProperty(key, value, false);
} else {
data.putProfileProperty(key, value, profile, false);
}
initialized = false;
} | java | {
"resource": ""
} |
q171760 | Props.extractProps | test | public void extractProps(final Map target) {
initialize();
data.extract(target, activeProfiles, null, null);
} | java | {
"resource": ""
} |
q171761 | Props.extractProps | test | public void extractProps(final Map target, final String... profiles) {
initialize();
data.extract(target, profiles, null, null);
} | java | {
"resource": ""
} |
q171762 | Props.extractSubProps | test | public void extractSubProps(final Map target, final String... wildcardPatterns) {
initialize();
data.extract(target, activeProfiles, wildcardPatterns, null);
} | java | {
"resource": ""
} |
q171763 | Props.innerMap | test | @SuppressWarnings("unchecked")
public Map<String, Object> innerMap(final String prefix) {
initialize();
return data.extract(null, activeProfiles, null, prefix);
} | java | {
"resource": ""
} |
q171764 | Props.addInnerMap | test | public void addInnerMap(String prefix, final Map<?, ?> map, final String profile) {
if (!StringUtil.endsWithChar(prefix, '.')) {
prefix += StringPool.DOT;
}
for (Map.Entry<?, ?> entry : map.entrySet()) {
String key = entry.getKey().toString();
key = prefix + key;
setValue(key, entry.getValue().toString(), profile);
}
} | java | {
"resource": ""
} |
q171765 | Props.resolveActiveProfiles | test | protected void resolveActiveProfiles() {
if (activeProfilesProp == null) {
activeProfiles = null;
return;
}
final PropsEntry pv = data.getBaseProperty(activeProfilesProp);
if (pv == null) {
// no active profile set as the property, exit
return;
}
final String value = pv.getValue();
if (StringUtil.isBlank(value)) {
activeProfiles = null;
return;
}
activeProfiles = StringUtil.splitc(value, ',');
StringUtil.trimAll(activeProfiles);
} | java | {
"resource": ""
} |
q171766 | Props.getAllProfiles | test | public String[] getAllProfiles() {
String[] profiles = new String[data.profileProperties.size()];
int index = 0;
for (String profileName : data.profileProperties.keySet()) {
profiles[index] = profileName;
index++;
}
return profiles;
} | java | {
"resource": ""
} |
q171767 | Props.getProfilesFor | test | public String[] getProfilesFor(final String propKeyNameWildcard) {
HashSet<String> profiles = new HashSet<>();
profile:
for (Map.Entry<String, Map<String, PropsEntry>> entries : data.profileProperties.entrySet()) {
String profileName = entries.getKey();
Map<String, PropsEntry> value = entries.getValue();
for (String propKeyName : value.keySet()) {
if (Wildcard.equalsOrMatch(propKeyName, propKeyNameWildcard)) {
profiles.add(profileName);
continue profile;
}
}
}
return profiles.toArray(new String[0]);
} | java | {
"resource": ""
} |
q171768 | BeanDefinition.addPropertyInjectionPoint | test | protected void addPropertyInjectionPoint(final PropertyInjectionPoint pip) {
if (properties == null) {
properties = new PropertyInjectionPoint[1];
properties[0] = pip;
} else {
properties = ArraysUtil.append(properties, pip);
}
} | java | {
"resource": ""
} |
q171769 | BeanDefinition.addSetInjectionPoint | test | protected void addSetInjectionPoint(final SetInjectionPoint sip) {
if (sets == null) {
sets = new SetInjectionPoint[1];
sets[0] = sip;
} else {
sets = ArraysUtil.append(sets, sip);
}
} | java | {
"resource": ""
} |
q171770 | BeanDefinition.addMethodInjectionPoint | test | protected void addMethodInjectionPoint(final MethodInjectionPoint mip) {
if (methods == null) {
methods = new MethodInjectionPoint[1];
methods[0] = mip;
} else {
methods = ArraysUtil.append(methods, mip);
}
} | java | {
"resource": ""
} |
q171771 | BeanDefinition.addInitMethodPoints | test | protected void addInitMethodPoints(final InitMethodPoint[] methods) {
if (initMethods == null) {
initMethods = methods;
} else {
initMethods = ArraysUtil.join(initMethods, methods);
}
} | java | {
"resource": ""
} |
q171772 | BeanDefinition.addDestroyMethodPoints | test | protected void addDestroyMethodPoints(final DestroyMethodPoint[] methods) {
if (destroyMethods == null) {
destroyMethods = methods;
} else {
destroyMethods = ArraysUtil.join(destroyMethods, methods);
}
} | java | {
"resource": ""
} |
q171773 | ProxettaUtil.resolveTargetClass | test | public static Class resolveTargetClass(final Class proxy) {
final String name = proxy.getName();
if (name.endsWith(ProxettaNames.proxyClassNameSuffix)) {
return proxy.getSuperclass();
}
if (name.endsWith(ProxettaNames.wrapperClassNameSuffix)) {
return getTargetWrapperType(proxy);
}
return proxy;
} | java | {
"resource": ""
} |
q171774 | ProxettaUtil.injectTargetIntoWrapper | test | public static void injectTargetIntoWrapper(final Object target, final Object wrapper) {
injectTargetIntoWrapper(target, wrapper, ProxettaNames.wrapperTargetFieldName);
} | java | {
"resource": ""
} |
q171775 | ProxettaUtil.getTargetWrapperType | test | public static Class getTargetWrapperType(final Class wrapperClass) {
try {
final Field field = wrapperClass.getDeclaredField(ProxettaNames.wrapperTargetFieldName);
return field.getType();
} catch (NoSuchFieldException nsfex) {
throw new ProxettaException(nsfex);
}
} | java | {
"resource": ""
} |
q171776 | PropertyDescriptor.findField | test | protected FieldDescriptor findField(final String fieldName) {
FieldDescriptor fieldDescriptor = classDescriptor.getFieldDescriptor(fieldName, true);
if (fieldDescriptor != null) {
return fieldDescriptor;
}
// field descriptor not found in this class
// try to locate it in the superclasses
Class[] superclasses = classDescriptor.getAllSuperclasses();
for (Class superclass : superclasses) {
ClassDescriptor classDescriptor = ClassIntrospector.get().lookup(superclass);
fieldDescriptor = classDescriptor.getFieldDescriptor(fieldName, true);
if (fieldDescriptor != null) {
return fieldDescriptor;
}
}
// nothing found
return null;
} | java | {
"resource": ""
} |
q171777 | PropertyDescriptor.getType | test | public Class getType() {
if (type == null) {
if (fieldDescriptor != null) {
type = fieldDescriptor.getRawType();
}
else if (readMethodDescriptor != null) {
type = getGetter(true).getGetterRawType();
//type = readMethodDescriptor.getGetterRawType();
}
else if (writeMethodDescriptor != null) {
type = getSetter(true).getSetterRawType();
//type = writeMethodDescriptor.getSetterRawType();
}
}
return type;
} | java | {
"resource": ""
} |
q171778 | PropertyDescriptor.resolveKeyType | test | public Class resolveKeyType(final boolean declared) {
Class keyType = null;
Getter getter = getGetter(declared);
if (getter != null) {
keyType = getter.getGetterRawKeyComponentType();
}
if (keyType == null) {
FieldDescriptor fieldDescriptor = getFieldDescriptor();
if (fieldDescriptor != null) {
keyType = fieldDescriptor.getRawKeyComponentType();
}
}
return keyType;
} | java | {
"resource": ""
} |
q171779 | PropertyDescriptor.resolveComponentType | test | public Class resolveComponentType(final boolean declared) {
Class componentType = null;
Getter getter = getGetter(declared);
if (getter != null) {
componentType = getter.getGetterRawComponentType();
}
if (componentType == null) {
FieldDescriptor fieldDescriptor = getFieldDescriptor();
if (fieldDescriptor != null) {
componentType = fieldDescriptor.getRawComponentType();
}
}
return componentType;
} | java | {
"resource": ""
} |
q171780 | JsonResult.of | test | public static JsonResult of(final Object object) {
final String json = JsonSerializer.create().deep(true).serialize(object);
return new JsonResult(json);
} | java | {
"resource": ""
} |
q171781 | JsonResult.of | test | public static JsonResult of(final Exception exception) {
final HashMap<String, Object> errorMap = new HashMap<>();
errorMap.put("message", ExceptionUtil.message(exception));
errorMap.put("error", exception.getClass().getName());
errorMap.put("cause", exception.getCause() != null ? exception.getCause().getClass().getName() : null);
final ArrayList<String> details = new ArrayList<>();
final StackTraceElement[] ste = ExceptionUtil.getStackTrace(exception, null, null);
for (StackTraceElement stackTraceElement : ste) {
details.add(stackTraceElement.toString());
}
errorMap.put("details", details);
final String json = JsonSerializer.create().deep(true).serialize(errorMap);
return new JsonResult(json).status(HttpStatus.error500().internalError());
} | java | {
"resource": ""
} |
q171782 | RestActionNamingStrategy.resolveHttpMethodFromMethodName | test | protected String resolveHttpMethodFromMethodName(final String methodName) {
int i = 0;
while (i < methodName.length()) {
if (CharUtil.isUppercaseAlpha(methodName.charAt(i))) {
break;
}
i++;
}
final String name = methodName.substring(0, i).toUpperCase();
for (final HttpMethod httpMethod : HttpMethod.values()) {
if (httpMethod.equalsName(name)) {
return httpMethod.name();
}
}
return null;
} | java | {
"resource": ""
} |
q171783 | Wildcard.match | test | private static boolean match(final CharSequence string, final CharSequence pattern, int sNdx, int pNdx) {
int pLen = pattern.length();
if (pLen == 1) {
if (pattern.charAt(0) == '*') { // speed-up
return true;
}
}
int sLen = string.length();
boolean nextIsNotWildcard = false;
while (true) {
// check if end of string and/or pattern occurred
if ((sNdx >= sLen)) { // end of string still may have pending '*' in pattern
while ((pNdx < pLen) && (pattern.charAt(pNdx) == '*')) {
pNdx++;
}
return pNdx >= pLen;
}
if (pNdx >= pLen) { // end of pattern, but not end of the string
return false;
}
char p = pattern.charAt(pNdx); // pattern char
// perform logic
if (!nextIsNotWildcard) {
if (p == '\\') {
pNdx++;
nextIsNotWildcard = true;
continue;
}
if (p == '?') {
sNdx++; pNdx++;
continue;
}
if (p == '*') {
char pNext = 0; // next pattern char
if (pNdx + 1 < pLen) {
pNext = pattern.charAt(pNdx + 1);
}
if (pNext == '*') { // double '*' have the same effect as one '*'
pNdx++;
continue;
}
int i;
pNdx++;
// find recursively if there is any substring from the end of the
// line that matches the rest of the pattern !!!
for (i = string.length(); i >= sNdx; i--) {
if (match(string, pattern, i, pNdx)) {
return true;
}
}
return false;
}
} else {
nextIsNotWildcard = false;
}
// check if pattern char and string char are equals
if (p != string.charAt(sNdx)) {
return false;
}
// everything matches for now, continue
sNdx++; pNdx++;
}
} | java | {
"resource": ""
} |
q171784 | ExtendedURLClassLoader.resolveLoading | test | protected Loading resolveLoading(final boolean parentFirstStrategy, final String className) {
boolean withParent = true;
boolean withLoader = true;
if (parentFirstStrategy) {
if (isMatchingRules(className, loaderOnlyRules)) {
withParent = false;
}
else if (isMatchingRules(className, parentOnlyRules)) {
withLoader = false;
}
}
else {
if (isMatchingRules(className, parentOnlyRules)) {
withLoader = false;
}
else if (isMatchingRules(className, loaderOnlyRules)) {
withParent = false;
}
}
return new Loading(withParent, withLoader);
} | java | {
"resource": ""
} |
q171785 | ExtendedURLClassLoader.resolveResourceLoading | test | protected Loading resolveResourceLoading(final boolean parentFirstStrategy, String resourceName) {
if (matchResourcesAsPackages) {
resourceName = StringUtil.replaceChar(resourceName, '/', '.');
}
return resolveLoading(parentFirstStrategy, resourceName);
} | java | {
"resource": ""
} |
q171786 | ExtendedURLClassLoader.loadClass | test | @Override
protected synchronized Class<?> loadClass(final String className, final boolean resolve) throws ClassNotFoundException {
// check first if the class has already been loaded
Class<?> c = findLoadedClass(className);
if (c != null) {
if (resolve) {
resolveClass(c);
}
return c;
}
// class not loaded yet
Loading loading = resolveLoading(parentFirst, className);
if (parentFirst) {
// PARENT FIRST
if (loading.withParent) {
try {
c = parentClassLoader.loadClass(className);
}
catch (ClassNotFoundException ignore) {
}
}
if (c == null) {
if (loading.withLoader) {
c = this.findClass(className);
}
else {
throw new ClassNotFoundException("Class not found: " + className);
}
}
} else {
// THIS FIRST
if (loading.withLoader) {
try {
c = this.findClass(className);
}
catch (ClassNotFoundException ignore) {
}
}
if (c == null) {
if (loading.withParent) {
c = parentClassLoader.loadClass(className);
}
else {
throw new ClassNotFoundException("Class not found: " + className);
}
}
}
if (resolve) {
resolveClass(c);
}
return c;
} | java | {
"resource": ""
} |
q171787 | ExtendedURLClassLoader.getResource | test | @Override
public URL getResource(final String resourceName) {
URL url = null;
Loading loading = resolveResourceLoading(parentFirst, resourceName);
if (parentFirst) {
// PARENT FIRST
if (loading.withParent) {
url = parentClassLoader.getResource(resourceName);
}
if (url == null) {
if (loading.withLoader) {
url = this.findResource(resourceName);
}
}
} else {
// THIS FIRST
if (loading.withLoader) {
url = this.findResource(resourceName);
}
if (url == null) {
if (loading.withParent) {
url = parentClassLoader.getResource(resourceName);
}
}
}
return url;
} | java | {
"resource": ""
} |
q171788 | StreamGobbler.waitFor | test | public void waitFor() {
try {
synchronized (lock) {
if (!end) {
lock.wait();
}
}
}
catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
} | java | {
"resource": ""
} |
q171789 | ScopeDataInspector.detectAnnotationType | test | public Class<? extends Annotation> detectAnnotationType(final Annotation[] annotations) {
for (final Annotation annotation : annotations) {
if (annotation instanceof In) {
return annotation.annotationType();
}
else if (annotation instanceof Out) {
return annotation.annotationType();
}
}
return null;
} | java | {
"resource": ""
} |
q171790 | ScopeDataInspector.buildInjectionPoint | test | protected InjectionPoint buildInjectionPoint(
final String annotationValue,
final String propertyName,
final Class propertyType,
final Class<? extends MadvocScope> scope) {
final String value = annotationValue.trim();
final String name, targetName;
if (StringUtil.isNotBlank(value)) {
name = value;
targetName = propertyName;
}
else {
name = propertyName;
targetName = null;
}
return new InjectionPoint(propertyType, name, targetName, scopeResolver.defaultOrScopeType(scope));
} | java | {
"resource": ""
} |
q171791 | TypeJsonVisitor.visit | test | public void visit() {
ClassDescriptor classDescriptor = ClassIntrospector.get().lookup(type);
if (classMetadataName != null) {
// process first 'meta' fields 'class'
onProperty(classMetadataName, null, false);
}
PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors();
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
Getter getter = propertyDescriptor.getGetter(declared);
if (getter != null) {
String propertyName = propertyDescriptor.getName();
boolean isTransient = false;
// check for transient flag
FieldDescriptor fieldDescriptor = propertyDescriptor.getFieldDescriptor();
if (fieldDescriptor != null) {
isTransient = Modifier.isTransient(fieldDescriptor.getField().getModifiers());
}
onProperty(propertyName, propertyDescriptor, isTransient);
}
}
} | java | {
"resource": ""
} |
q171792 | ClassPathURLs.of | test | public static URL[] of(ClassLoader classLoader, Class clazz) {
if (clazz == null) {
clazz = ClassPathURLs.class;
}
if (classLoader == null) {
classLoader = clazz.getClassLoader();
}
final Set<URL> urls = new LinkedHashSet<>();
while (classLoader != null) {
if (classLoader instanceof URLClassLoader) {
final URLClassLoader urlClassLoader = (URLClassLoader) classLoader;
return urlClassLoader.getURLs();
}
final URL url = classModuleUrl(classLoader, clazz);
if (url != null) {
urls.add(url);
}
classLoader = classLoader.getParent();
}
return urls.toArray(new URL[0]);
} | java | {
"resource": ""
} |
q171793 | BeanProperty.setBean | test | private void setBean(final Object bean) {
this.bean = bean;
this.cd = (bean == null ? null : introspector.lookup(bean.getClass()));
this.first = false;
this.updateProperty = true;
} | java | {
"resource": ""
} |
q171794 | BeanProperty.updateBean | test | public void updateBean(final Object bean) {
this.setBean(bean);
if (this.cd != null && this.cd.isSupplier()) {
final Object newBean = ((Supplier)this.bean).get();
setBean(newBean);
}
} | java | {
"resource": ""
} |
q171795 | BeanProperty.loadPropertyDescriptor | test | private void loadPropertyDescriptor() {
if (updateProperty) {
if (cd == null) {
propertyDescriptor = null;
} else {
propertyDescriptor = cd.getPropertyDescriptor(name, true);
}
updateProperty = false;
}
} | java | {
"resource": ""
} |
q171796 | BeanProperty.getGetter | test | public Getter getGetter(final boolean declared) {
loadPropertyDescriptor();
return propertyDescriptor != null ? propertyDescriptor.getGetter(declared) : null;
} | java | {
"resource": ""
} |
q171797 | BeanProperty.getSetter | test | public Setter getSetter(final boolean declared) {
loadPropertyDescriptor();
return propertyDescriptor != null ? propertyDescriptor.getSetter(declared) : null;
} | java | {
"resource": ""
} |
q171798 | DbOom.connect | test | public DbOom connect() {
connectionProvider.init();
final DbDetector dbDetector = new DbDetector();
dbDetector.detectDatabaseAndConfigureDbOom(connectionProvider, dbOomConfig);
return this;
} | java | {
"resource": ""
} |
q171799 | CompositeIterator.add | test | public void add(final Iterator<T> iterator) {
if (allIterators.contains(iterator)) {
throw new IllegalArgumentException("Duplicate iterator");
}
allIterators.add(iterator);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.