_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q171600
ArraysUtil.resize
test
public static <T> T[] resize(T[] buffer, int newSize) { Class<T> componentType = (Class<T>) buffer.getClass().getComponentType(); T[] temp = (T[]) Array.newInstance(componentType, newSize); System.arraycopy(buffer, 0, temp, 0, buffer.length >= newSize ? newSize : buffer.length); return temp; }
java
{ "resource": "" }
q171601
ArraysUtil.append
test
public static <T> T[] append(T[] buffer, T newElement) { T[] t = resize(buffer, buffer.length + 1); t[buffer.length] = newElement; return t; }
java
{ "resource": "" }
q171602
ArraysUtil.remove
test
@SuppressWarnings({"unchecked"}) public static <T> T[] remove(T[] buffer, int offset, int length, Class<T> componentType) { int len2 = buffer.length - length; T[] temp = (T[]) Array.newInstance(componentType, len2); System.arraycopy(buffer, 0, temp, 0, offset); System.arraycopy(buffer, offset + length, temp, o...
java
{ "resource": "" }
q171603
ArraysUtil.indexOf
test
public static int indexOf(char[] array, char value) { for (int i = 0; i < array.length; i++) { if (array[i] == value) { return i; } } return -1; }
java
{ "resource": "" }
q171604
ArraysUtil.indexOf
test
public static int indexOf(Object[] array, Object value) { for (int i = 0; i < array.length; i++) { if (array[i].equals(value)) { return i; } } return -1; }
java
{ "resource": "" }
q171605
ArraysUtil.indexOf
test
public static int indexOf(byte[] array, byte[] sub, int startIndex) { return indexOf(array, sub, startIndex, array.length); }
java
{ "resource": "" }
q171606
LagartoDOMBuilder.enableXhtmlMode
test
public LagartoDOMBuilder enableXhtmlMode() { config.ignoreWhitespacesBetweenTags = false; // collect all whitespaces config.setCaseSensitive(true); // XHTML is case sensitive config.setEnableRawTextModes(false); // all tags are parsed in the same way config.enabledVoidTags = true; // list of v...
java
{ "resource": "" }
q171607
LagartoDOMBuilder.parse
test
@Override public Document parse(final char[] content) { LagartoParser lagartoParser = new LagartoParser(content); return doParse(lagartoParser); }
java
{ "resource": "" }
q171608
LagartoDOMBuilder.doParse
test
protected Document doParse(final LagartoParser lagartoParser) { lagartoParser.setConfig(config); LagartoDOMBuilderTagVisitor domBuilderTagVisitor = new LagartoDOMBuilderTagVisitor(this); lagartoParser.parse(domBuilderTagVisitor); return domBuilderTagVisitor.getDocument(); }
java
{ "resource": "" }
q171609
MethodWriter.computeMaxStackAndLocal
test
private void computeMaxStackAndLocal() { // Complete the control flow graph with exception handler blocks. Handler handler = firstHandler; while (handler != null) { Label handlerBlock = handler.handlerPc; Label handlerRangeBlock = handler.startPc; Label handlerRangeEnd = handler.endPc; ...
java
{ "resource": "" }
q171610
MethodWriter.endCurrentBasicBlockWithNoSuccessor
test
private void endCurrentBasicBlockWithNoSuccessor() { if (compute == COMPUTE_ALL_FRAMES) { Label nextBasicBlock = new Label(); nextBasicBlock.frame = new Frame(nextBasicBlock); nextBasicBlock.resolve(code.data, code.length); lastBasicBlock.nextBasicBlock = nextBasicBlock; lastBasicBlock...
java
{ "resource": "" }
q171611
MethodWriter.collectAttributePrototypes
test
final void collectAttributePrototypes(final Attribute.Set attributePrototypes) { attributePrototypes.addAttributes(firstAttribute); attributePrototypes.addAttributes(firstCodeAttribute); }
java
{ "resource": "" }
q171612
ContextInjectorComponent.injectContext
test
public void injectContext(final Object targetObject) { final Class targetType = targetObject.getClass(); final ScopeData scopeData = scopeDataInspector.inspectClassScopesWithCache(targetType); final Targets targets = new Targets(targetObject, scopeData); // inject no context scopeResolver.forEachScope(madv...
java
{ "resource": "" }
q171613
PseudoClassSelector.registerPseudoClass
test
public static void registerPseudoClass(final Class<? extends PseudoClass> pseudoClassType) { PseudoClass pseudoClass; try { pseudoClass = ClassUtil.newInstance(pseudoClassType); } catch (Exception ex) { throw new CSSellyException(ex); } PSEUDO_CLASS_MAP.put(pseudoClass.getPseudoClassName(), pseudoClass)...
java
{ "resource": "" }
q171614
PseudoClassSelector.lookupPseudoClass
test
public static PseudoClass lookupPseudoClass(final String pseudoClassName) { PseudoClass pseudoClass = PSEUDO_CLASS_MAP.get(pseudoClassName); if (pseudoClass == null) { throw new CSSellyException("Unsupported pseudo class: " + pseudoClassName); } return pseudoClass; }
java
{ "resource": "" }
q171615
AsyncActionExecutor.invoke
test
public void invoke(final ActionRequest actionRequest) { if (executorService == null) { throw new MadvocException("No action is marked as async!"); } final HttpServletRequest servletRequest = actionRequest.getHttpServletRequest(); log.debug(() -> "Async call to: " + actionRequest); final AsyncContext asy...
java
{ "resource": "" }
q171616
BeanVisitor.getAllBeanPropertyNames
test
protected String[] getAllBeanPropertyNames(final Class type, final boolean declared) { ClassDescriptor classDescriptor = ClassIntrospector.get().lookup(type); PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors(); ArrayList<String> names = new ArrayList<>(propertyDescriptors.len...
java
{ "resource": "" }
q171617
BeanVisitor.visit
test
public void visit() { String[] properties = resolveProperties(source, declared); for (String name : properties) { if (name == null) { continue; } if (!rules.match(name, blacklist)) { continue; } Object value; String propertyName = name; if (isSourceMap) { propertyName = LEFT_SQ...
java
{ "resource": "" }
q171618
BeanVisitor.accept
test
@Override public boolean accept(final String propertyName, final String rule, final boolean include) { return propertyName.equals(rule); }
java
{ "resource": "" }
q171619
MethodResolver.resolve
test
public MethodInjectionPoint[] resolve(final Class type) { // lookup methods ClassDescriptor cd = ClassIntrospector.get().lookup(type); List<MethodInjectionPoint> list = new ArrayList<>(); MethodDescriptor[] allMethods = cd.getAllMethodDescriptors(); for (MethodDescriptor methodDescriptor : allMethods) { M...
java
{ "resource": "" }
q171620
HtmlStaplerFilter.readFilterConfigParameters
test
protected void readFilterConfigParameters(final FilterConfig filterConfig, final Object target, final String... parameters) { for (String parameter : parameters) { String value = filterConfig.getInitParameter(parameter); if (value != null) { BeanUtil.declared.setProperty(target, parameter, value); } }...
java
{ "resource": "" }
q171621
HtmlStaplerFilter.sendBundleFile
test
protected void sendBundleFile(final HttpServletResponse resp, final File bundleFile) throws IOException { OutputStream out = resp.getOutputStream(); FileInputStream fileInputStream = new FileInputStream(bundleFile); try { StreamUtil.copy(fileInputStream, out); } finally { StreamUtil.close(fileInputStrea...
java
{ "resource": "" }
q171622
HtmlStaplerBundlesManager.lookupBundleFile
test
public File lookupBundleFile(String bundleId) { if ((mirrors != null) && (!mirrors.isEmpty())) { String realBundleId = mirrors.remove(bundleId); if (realBundleId != null) { bundleId = realBundleId; } } return createBundleFile(bundleId); }
java
{ "resource": "" }
q171623
HtmlStaplerBundlesManager.lookupGzipBundleFile
test
public File lookupGzipBundleFile(final File file) throws IOException { String path = file.getPath() + ZipUtil.GZIP_EXT; File gzipFile = new File(path); if (!gzipFile.exists()) { if (log.isDebugEnabled()) { log.debug("gzip bundle to " + path); } ZipUtil.gzip(file); } return gzipFile; }
java
{ "resource": "" }
q171624
HtmlStaplerBundlesManager.registerBundle
test
public synchronized String registerBundle(final String contextPath, final String actionPath, final String tempBundleId, final String bundleContentType, final List<String> sources) { if (tempBundleId == null || sources.isEmpty()) { if (strategy == Strategy.ACTION_MANAGED) { // page does not include any resourc...
java
{ "resource": "" }
q171625
HtmlStaplerBundlesManager.createDigest
test
protected String createDigest(final String source) { final DigestEngine digestEngine = DigestEngine.sha256(); final byte[] bytes = digestEngine.digest(CharUtil.toSimpleByteArray(source)); String digest = Base32.encode(bytes); if (uniqueDigestKey != null) { digest += uniqueDigestKey; } return digest; ...
java
{ "resource": "" }
q171626
HtmlStaplerBundlesManager.createBundle
test
protected void createBundle(final String contextPath, final String actionPath, final String bundleId, final List<String>sources) throws IOException { final File bundleFile = createBundleFile(bundleId); if (bundleFile.exists()) { return; } StringBand sb = new StringBand(sources.size() * 2); for (String src...
java
{ "resource": "" }
q171627
HtmlStaplerBundlesManager.reset
test
public synchronized void reset() { if (strategy == Strategy.ACTION_MANAGED) { actionBundles.clear(); mirrors.clear(); } final FindFile ff = new FindFile(); ff.includeDirs(false); ff.searchPath(new File(bundleFolder, staplerPath)); File f; int count = 0; while ((f = ff.nextFile()) != null) { f...
java
{ "resource": "" }
q171628
HtmlStaplerBundlesManager.fixCssRelativeUrls
test
protected String fixCssRelativeUrls(final String content, final String src) { final String path = FileNameUtil.getPath(src); final Matcher matcher = CSS_URL_PATTERN.matcher(content); final StringBuilder sb = new StringBuilder(content.length()); int start = 0; while (matcher.find()) { sb.append(content,...
java
{ "resource": "" }
q171629
DbEntitySql.updateColumn
test
public DbSqlBuilder updateColumn(final Object entity, final String columnRef) { final Object value = BeanUtil.pojo.getProperty(entity, columnRef); return updateColumn(entity, columnRef, value); }
java
{ "resource": "" }
q171630
DbEntitySql.createTableRefName
test
protected static String createTableRefName(final Object entity) { Class type = entity.getClass(); type = (type == Class.class ? (Class) entity : type); return (type.getSimpleName() + '_'); }
java
{ "resource": "" }
q171631
DbJtxSessionProvider.getDbSession
test
@Override public DbSession getDbSession() { log.debug("Requesting db TX manager session"); final DbJtxTransaction jtx = (DbJtxTransaction) jtxTxManager.getTransaction(); if (jtx == null) { throw new DbSqlException( "No transaction is in progress and DbSession can't be provided. " + "It seems that ...
java
{ "resource": "" }
q171632
ArrayConverter.convertToSingleElementArray
test
protected T[] convertToSingleElementArray(final Object value) { T[] singleElementArray = createArray(1); singleElementArray[0] = convertType(value); return singleElementArray; }
java
{ "resource": "" }
q171633
GenericsReader.parseSignatureForGenerics
test
public Map<String, String> parseSignatureForGenerics(final String signature, final boolean isInterface) { if (signature == null) { return Collections.emptyMap(); } final Map<String, String> genericsMap = new HashMap<>(); SignatureReader sr = new SignatureReader(signature); StringBuilder sb = new StringB...
java
{ "resource": "" }
q171634
SetResolver.resolve
test
public SetInjectionPoint[] resolve(final Class type, final boolean autowire) { ClassDescriptor cd = ClassIntrospector.get().lookup(type); List<SetInjectionPoint> list = new ArrayList<>(); PropertyDescriptor[] allProperties = cd.getAllPropertyDescriptors(); for (PropertyDescriptor propertyDescriptor : allPrope...
java
{ "resource": "" }
q171635
JsonContext.matchIgnoredPropertyTypes
test
public boolean matchIgnoredPropertyTypes(final Class propertyType, final boolean excludeMaps, final boolean include) { if (!include) { return false; } if (propertyType != null) { if (!jsonSerializer.deep) { ClassDescriptor propertyTypeClassDescriptor = ClassIntrospector.get().lookup(propertyType); ...
java
{ "resource": "" }
q171636
DbSession.openConnectionForQuery
test
protected void openConnectionForQuery() { if (connection == null) { connection = connectionProvider.getConnection(); txActive = false; // txAction should already be false try { connection.setAutoCommit(true); } catch (SQLException sex) { throw new DbSqlException("Failed to open non-TX connection",...
java
{ "resource": "" }
q171637
DbSession.openTx
test
protected void openTx() { if (connection == null) { connection = connectionProvider.getConnection(); } txActive = true; try { connection.setAutoCommit(false); if (txMode.getIsolation() != DbTransactionMode.ISOLATION_DEFAULT) { connection.setTransactionIsolation(txMode.getIsolation()); } conne...
java
{ "resource": "" }
q171638
DbSession.closeTx
test
protected void closeTx() { txActive = false; try { connection.setAutoCommit(true); } catch (SQLException sex) { throw new DbSqlException("Close TX failed", sex); } }
java
{ "resource": "" }
q171639
DbSession.commitTransaction
test
public void commitTransaction() { log.debug("Committing transaction"); assertTxIsActive(); try { connection.commit(); } catch (SQLException sex) { throw new DbSqlException("Commit TX failed", sex); } finally { closeTx(); } }
java
{ "resource": "" }
q171640
DbSession.rollbackTransaction
test
public void rollbackTransaction() { log.debug("Rolling-back transaction"); assertTxIsActive(); try { connection.rollback(); } catch (SQLException sex) { throw new DbSqlException("Rollback TX failed", sex); } finally { closeTx(); } }
java
{ "resource": "" }
q171641
PropertiesUtil.createFromFile
test
public static Properties createFromFile(final File file) throws IOException { Properties prop = new Properties(); loadFromFile(prop, file); return prop; }
java
{ "resource": "" }
q171642
PropertiesUtil.createFromString
test
public static Properties createFromString(final String data) throws IOException { Properties p = new Properties(); loadFromString(p, data); return p; }
java
{ "resource": "" }
q171643
PropertiesUtil.loadFromString
test
public static void loadFromString(final Properties p, final String data) throws IOException { try (ByteArrayInputStream is = new ByteArrayInputStream(data.getBytes(StringPool.ISO_8859_1))) { p.load(is); } }
java
{ "resource": "" }
q171644
PropertiesUtil.subset
test
public static Properties subset(final Properties p, String prefix, final boolean stripPrefix) { if (StringUtil.isBlank(prefix)) { return p; } if (!prefix.endsWith(StringPool.DOT)) { prefix += '.'; } Properties result = new Properties(); int baseLen = prefix.length(); for (Object o : p.keySet()) { ...
java
{ "resource": "" }
q171645
PropertiesUtil.createFromClasspath
test
public static Properties createFromClasspath(final String... rootTemplate) { Properties p = new Properties(); return loadFromClasspath(p, rootTemplate); }
java
{ "resource": "" }
q171646
PropertiesUtil.getProperty
test
public static String getProperty(final Map map, final String key, final String defaultValue) { Object val = map.get(key); return (val instanceof String) ? (String) val : defaultValue; }
java
{ "resource": "" }
q171647
PropertiesUtil.resolveAllVariables
test
public static void resolveAllVariables(final Properties prop) { for (Object o : prop.keySet()) { String key = (String) o; String value = resolveProperty(prop, key); prop.setProperty(key, value); } }
java
{ "resource": "" }
q171648
PropertiesUtil.resolveProperty
test
public static String resolveProperty(final Map map, final String key) { String value = getProperty(map, key); if (value == null) { return null; } value = stp.parse(value, macroName -> getProperty(map, macroName)); return value; }
java
{ "resource": "" }
q171649
AnnotationTxAdviceManager.resolveScope
test
public String resolveScope(final Class type, final String methodName) { if (scopePattern == null) { return null; } String ctx = scopePattern; ctx = StringUtil.replace(ctx, JTXCTX_PATTERN_CLASS, type.getName()); ctx = StringUtil.replace(ctx, JTXCTX_PATTERN_METHOD, methodName); return ctx; }
java
{ "resource": "" }
q171650
AnnotationTxAdviceManager.getTxMode
test
public synchronized JtxTransactionMode getTxMode(final Class type, final String methodName, final Class[] methodArgTypes, final String unique) { String signature = type.getName() + '#' + methodName + '%' + unique; JtxTransactionMode txMode = txmap.get(signature); if (txMode == null) { if (!txmap.containsKey(si...
java
{ "resource": "" }
q171651
AnnotationTxAdviceManager.registerAnnotations
test
@SuppressWarnings( {"unchecked"}) public void registerAnnotations(final Class<? extends Annotation>[] annotations) { this.annotations = annotations; this.annotationParsers = new AnnotationParser[annotations.length]; for (int i = 0; i < annotations.length; i++) { annotationParsers[i] = TransactionAnnotationV...
java
{ "resource": "" }
q171652
AnnotationTxAdviceManager.readTransactionAnnotation
test
protected TransactionAnnotationValues readTransactionAnnotation(final Method method) { for (AnnotationParser annotationParser : annotationParsers) { TransactionAnnotationValues tad = TransactionAnnotationValues.of(annotationParser, method); if (tad != null) { return tad; } } return null; }
java
{ "resource": "" }
q171653
CssSelector.accept
test
@Override public boolean accept(final Node node) { // match element name with node name if (!matchElement(node)) { return false; } // match attributes int totalSelectors = selectorsCount(); for (int i = 0; i < totalSelectors; i++) { Selector selector = getSelector(i); // just attr name existence...
java
{ "resource": "" }
q171654
CssSelector.matchElement
test
protected boolean matchElement(final Node node) { if (node.getNodeType() != Node.NodeType.ELEMENT) { return false; } String element = getElement(); String nodeName = node.getNodeName(); return element.equals(StringPool.STAR) || element.equals(nodeName); }
java
{ "resource": "" }
q171655
CssSelector.accept
test
public boolean accept(final List<Node> currentResults, final Node node, final int index) { // match attributes int totalSelectors = selectorsCount(); for (int i = 0; i < totalSelectors; i++) { Selector selector = getSelector(i); // just attr name existence switch (selector.getType()) { case PSEUDO_F...
java
{ "resource": "" }
q171656
CssSelector.unescape
test
protected String unescape(final String value) { if (value.indexOf('\\') == -1) { return value; } return StringUtil.remove(value, '\\'); }
java
{ "resource": "" }
q171657
JavaInfo.buildJrePackages
test
private String[] buildJrePackages(final int javaVersionNumber) { final ArrayList<String> packages = new ArrayList<>(); switch (javaVersionNumber) { case 9: case 8: case 7: case 6: case 5: // in Java1.5, the apache stuff moved packages.add("com.sun.org.apache"); // fall through... case...
java
{ "resource": "" }
q171658
Node.cloneTo
test
protected <T extends Node> T cloneTo(final T dest) { // dest.nodeValue = nodeValue; // already in clone implementations! dest.parentNode = parentNode; if (attributes != null) { dest.attributes = new ArrayList<>(attributes.size()); for (int i = 0, attributesSize = attributes.size(); i < attributesSize; i++...
java
{ "resource": "" }
q171659
Node.detachFromParent
test
public void detachFromParent() { if (parentNode == null) { return; } if (parentNode.childNodes != null) { parentNode.childNodes.remove(siblingIndex); parentNode.reindexChildren(); } parentNode = null; }
java
{ "resource": "" }
q171660
Node.addChild
test
public void addChild(final Node... nodes) { if (nodes.length == 0) { return; // nothing to add } for (Node node : nodes) { node.detachFromParent(); node.parentNode = this; initChildNodes(node); childNodes.add(node); } reindexChildrenOnAdd(nodes.length); }
java
{ "resource": "" }
q171661
Node.insertChild
test
public void insertChild(final Node node, final int index) { node.detachFromParent(); node.parentNode = this; try { initChildNodes(node); childNodes.add(index, node); } catch (IndexOutOfBoundsException ignore) { throw new LagartoDOMException("Invalid node index: " + index); } reindexChildren(); }
java
{ "resource": "" }
q171662
Node.insertBefore
test
public void insertBefore(final Node newChild, final Node refChild) { int siblingIndex = refChild.getSiblingIndex(); refChild.parentNode.insertChild(newChild, siblingIndex); }
java
{ "resource": "" }
q171663
Node.insertBefore
test
public void insertBefore(final Node[] newChilds, final Node refChild) { if (newChilds.length == 0) { return; } int siblingIndex = refChild.getSiblingIndex(); refChild.parentNode.insertChild(newChilds, siblingIndex); }
java
{ "resource": "" }
q171664
Node.insertAfter
test
public void insertAfter(final Node newChild, final Node refChild) { int siblingIndex = refChild.getSiblingIndex() + 1; if (siblingIndex == refChild.parentNode.getChildNodesCount()) { refChild.parentNode.addChild(newChild); } else { refChild.parentNode.insertChild(newChild, siblingIndex); } }
java
{ "resource": "" }
q171665
Node.insertAfter
test
public void insertAfter(final Node[] newChilds, final Node refChild) { if (newChilds.length == 0) { return; } int siblingIndex = refChild.getSiblingIndex() + 1; if (siblingIndex == refChild.parentNode.getChildNodesCount()) { refChild.parentNode.addChild(newChilds); } else { refChild.parentNode.inser...
java
{ "resource": "" }
q171666
Node.removeAllChilds
test
public void removeAllChilds() { List<Node> removedNodes = childNodes; childNodes = null; childElementNodes = null; childElementNodesCount = 0; if (removedNodes != null) { for (int i = 0, removedNodesSize = removedNodes.size(); i < removedNodesSize; i++) { Node removedNode = removedNodes.get(i); re...
java
{ "resource": "" }
q171667
Node.findChildNodeWithName
test
public Node findChildNodeWithName(final String name) { if (childNodes == null) { return null; } for (final Node childNode : childNodes) { if (childNode.getNodeName().equals(name)) { return childNode; } } return null; }
java
{ "resource": "" }
q171668
Node.filterChildNodes
test
public Node[] filterChildNodes(final Predicate<Node> nodePredicate) { if (childNodes == null) { return new Node[0]; } return childNodes.stream() .filter(nodePredicate) .toArray(Node[]::new); }
java
{ "resource": "" }
q171669
Node.check
test
public boolean check() { if (childNodes == null) { return true; } // children int siblingElementIndex = 0; for (int i = 0, childNodesSize = childNodes.size(); i < childNodesSize; i++) { Node childNode = childNodes.get(i); if (childNode.siblingIndex != i) { return false; } if (childNode....
java
{ "resource": "" }
q171670
Node.initChildElementNodes
test
protected void initChildElementNodes() { if (childElementNodes == null) { childElementNodes = new Element[childElementNodesCount]; int childCount = getChildNodesCount(); for (int i = 0; i < childCount; i++) { Node child = getChild(i); if (child.siblingElementIndex >= 0) { childElementNodes[chil...
java
{ "resource": "" }
q171671
Node.initSiblingNames
test
protected void initSiblingNames() { if (siblingNameIndex == -1) { List<Node> siblings = parentNode.childNodes; int index = 0; for (int i = 0, siblingsSize = siblings.size(); i < siblingsSize; i++) { Node sibling = siblings.get(i); if (sibling.siblingNameIndex == -1 && nodeType == NodeType.ELEME...
java
{ "resource": "" }
q171672
Node.initChildNodes
test
protected void initChildNodes(final Node newNode) { if (childNodes == null) { childNodes = new ArrayList<>(); } if (ownerDocument != null) { if (newNode.ownerDocument != ownerDocument) { changeOwnerDocument(newNode, ownerDocument); } } }
java
{ "resource": "" }
q171673
Node.changeOwnerDocument
test
protected void changeOwnerDocument(final Node node, final Document ownerDocument) { node.ownerDocument = ownerDocument; int childCount = node.getChildNodesCount(); for (int i = 0; i < childCount; i++) { Node child = node.getChild(i); changeOwnerDocument(child, ownerDocument); } }
java
{ "resource": "" }
q171674
Node.getPreviousSiblingName
test
public Node getPreviousSiblingName() { if (nodeName == null) { return null; } initSiblingNames(); int index = siblingNameIndex -1; for (int i = siblingIndex; i >= 0; i--) { Node sibling = parentNode.childNodes.get(i); if ((index == sibling.siblingNameIndex) && nodeName.equals(sibling.getNodeName())) ...
java
{ "resource": "" }
q171675
Node.getTextContent
test
public String getTextContent() { StringBuilder sb = new StringBuilder(getChildNodesCount() + 1); appendTextContent(sb); return sb.toString(); }
java
{ "resource": "" }
q171676
Node.getHtml
test
public String getHtml() { LagartoDomBuilderConfig lagartoDomBuilderConfig; if (ownerDocument == null) { lagartoDomBuilderConfig = ((Document) this).getConfig(); } else { lagartoDomBuilderConfig = ownerDocument.getConfig(); } LagartoHtmlRenderer lagartoHtmlRenderer = lagartoDomBuilderConfig.getLagar...
java
{ "resource": "" }
q171677
Node.getInnerHtml
test
public String getInnerHtml() { LagartoDomBuilderConfig lagartoDomBuilderConfig; if (ownerDocument == null) { lagartoDomBuilderConfig = ((Document) this).getConfig(); } else { lagartoDomBuilderConfig = ownerDocument.getConfig(); } LagartoHtmlRenderer lagartoHtmlRenderer = lagartoDomBuilderConfig.get...
java
{ "resource": "" }
q171678
Node.visitChildren
test
protected void visitChildren(final NodeVisitor nodeVisitor) { if (childNodes != null) { for (int i = 0, childNodesSize = childNodes.size(); i < childNodesSize; i++) { Node childNode = childNodes.get(i); childNode.visit(nodeVisitor); } } }
java
{ "resource": "" }
q171679
Node.getCssPath
test
public String getCssPath() { StringBuilder path = new StringBuilder(); Node node = this; while (node != null) { String nodeName = node.getNodeName(); if (nodeName != null) { StringBuilder sb = new StringBuilder(); sb.append(' ').append(nodeName); String id = node.getAttribute("id"); if (id ...
java
{ "resource": "" }
q171680
DecoratorTagVisitor.onDecoraTag
test
protected void onDecoraTag(final Tag tag) { String tagName = tag.getName().toString(); if (tag.getType() == TagType.SELF_CLOSING) { checkNestedDecoraTags(); decoraTagName = tagName.substring(7); decoraTagStart = tag.getTagPosition(); decoraTagEnd = tag.getTagPosition() + tag.getTagLength(); defineDe...
java
{ "resource": "" }
q171681
DecoratorTagVisitor.onIdAttrStart
test
protected void onIdAttrStart(final Tag tag) { String id = tag.getId().toString().substring(7); String tagName; String idName; int dashIndex = id.indexOf('-'); if (dashIndex == -1) { tagName = id; idName = null; } else { tagName = id.substring(0, dashIndex); idName = id.substring(dashIndex + 1);...
java
{ "resource": "" }
q171682
DecoratorTagVisitor.defineDecoraTag
test
protected void defineDecoraTag() { DecoraTag decoraTag = decoraTagDefaultValueStart == 0 ? new DecoraTag(decoraTagName, decoraIdName, decoraTagStart, decoraTagEnd) : new DecoraTag( decoraTagName, decoraIdName, decoraTagStart, decoraTagEnd, decoraTagDefaultValueStart, decoraTagDefaul...
java
{ "resource": "" }
q171683
JoyProxetta.addProxyAspect
test
@Override public JoyProxetta addProxyAspect(final ProxyAspect proxyAspect) { requireNotStarted(proxetta); this.proxyAspects.add(proxyAspect); return this; }
java
{ "resource": "" }
q171684
RootPackages.addRootPackage
test
public void addRootPackage(final String rootPackage, String mapping) { if (packages == null) { packages = new String[0]; } if (mappings == null) { mappings = new String[0]; } // fix mapping if (mapping.length() > 0) { // mapping must start with the slash if (!mapping.startsWith(StringPool.SLASH...
java
{ "resource": "" }
q171685
RootPackages.addRootPackageOf
test
public void addRootPackageOf(final Class actionClass, final String mapping) { addRootPackage(actionClass.getPackage().getName(), mapping); }
java
{ "resource": "" }
q171686
RootPackages.findRootPackageForActionPath
test
public String findRootPackageForActionPath(final String actionPath) { if (mappings == null) { return null; } int ndx = -1; int delta = Integer.MAX_VALUE; for (int i = 0; i < mappings.length; i++) { String mapping = mappings[i]; boolean found = false; if (actionPath.equals(mapping)) { found ...
java
{ "resource": "" }
q171687
VtorUtil.resolveValidationMessage
test
public static String resolveValidationMessage(final HttpServletRequest request, final Violation violation) { ValidationConstraint vc = violation.getConstraint(); String key = vc != null ? vc.getClass().getName() : violation.getName(); String msg = LocalizationUtil.findMessage(request, key); if (msg != null) { ...
java
{ "resource": "" }
q171688
BeanReferences.removeDuplicateNames
test
public BeanReferences removeDuplicateNames() { if (names.length < 2) { return this; } int nullCount = 0; for (int i = 1; i < names.length; i++) { String thisRef = names[i]; if (thisRef == null) { nullCount++; continue; } for (int j = 0; j < i; j++) { if (names[j] == null) { c...
java
{ "resource": "" }
q171689
JoyProps.addPropsFile
test
@Override public JoyProps addPropsFile(final String namePattern) { requireNotStarted(props); this.propsNamePatterns.add(namePattern); return this; }
java
{ "resource": "" }
q171690
Targets.forEachTarget
test
public void forEachTarget(final Consumer<Target> targetConsumer) { for (final Target target : targets) { targetConsumer.accept(target); } }
java
{ "resource": "" }
q171691
Targets.forEachTargetAndIn
test
public void forEachTargetAndIn(final MadvocScope scope, final BiConsumer<Target, InjectionPoint> biConsumer) { for (final Target target : targets) { final ScopeData scopeData = target.scopeData(); if (scopeData.in() == null) { continue; } for (final InjectionPoint in : scopeData.in()) { if (in.sc...
java
{ "resource": "" }
q171692
Targets.forEachTargetAndOut
test
public void forEachTargetAndOut(final MadvocScope scope, final BiConsumer<Target, InjectionPoint> biConsumer) { for (final Target target : targets) { final ScopeData scopeData = target.scopeData(); if (scopeData.out() == null) { continue; } for (final InjectionPoint out : scopeData.out()) { if (o...
java
{ "resource": "" }
q171693
Targets.extractParametersValues
test
public Object[] extractParametersValues() { final Object[] values = new Object[targets.length - 1]; for (int i = 1; i < targets.length; i++) { values[i - 1] = targets[i].value(); } return values; }
java
{ "resource": "" }
q171694
Targets.makeTargets
test
protected Target[] makeTargets(final Target actionTarget, final MethodParam[] methodParams) { if (methodParams == null) { // action does not have method parameters, so there is just one target return new Target[]{actionTarget}; } // action has method arguments, so there is more then one target final Targ...
java
{ "resource": "" }
q171695
Targets.createActionMethodArgument
test
@SuppressWarnings({"unchecked", "NullArgumentToVariableArgMethod"}) protected Object createActionMethodArgument(final Class type, final Object action) { try { if (type.getEnclosingClass() == null || Modifier.isStatic(type.getModifiers())) { // regular or static class return ClassUtil.newInstance(type); ...
java
{ "resource": "" }
q171696
SessionMonitor.sessionCreated
test
@Override public void sessionCreated(final HttpSessionEvent httpSessionEvent) { HttpSession session = httpSessionEvent.getSession(); sessionMap.putIfAbsent(session.getId(), session); for (HttpSessionListener listener : listeners) { listener.sessionCreated(httpSessionEvent); } }
java
{ "resource": "" }
q171697
SessionMonitor.sessionDestroyed
test
@Override public void sessionDestroyed(final HttpSessionEvent httpSessionEvent) { HttpSession session = httpSessionEvent.getSession(); sessionMap.remove(session.getId()); for (HttpSessionListener listener : listeners) { listener.sessionDestroyed(httpSessionEvent); } }
java
{ "resource": "" }
q171698
JsonArray.add
test
public JsonArray add(Object value) { Objects.requireNonNull(value); value = JsonObject.resolveValue(value); list.add(value); return this; }
java
{ "resource": "" }
q171699
JsonArray.addAll
test
public JsonArray addAll(final JsonArray array) { Objects.requireNonNull(array); list.addAll(array.list); return this; }
java
{ "resource": "" }