_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q19100
Account.setPatterns
train
@SuppressWarnings("UnusedDeclaration") public void setPatterns(Iterable<AccountPatternData> patterns) { this.patterns.clear(); for (AccountPatternData data : patterns) { this.patterns.add(new AccountPatternData(data)); } }
java
{ "resource": "" }
q19101
FileReport.close
train
public void close() throws DiffException { try { if(writer != null) { writer.flush(); writer.close(); } } catch (IOException e) { throw new DiffException("Failed to close report file", e); } }
java
{ "resource": "" }
q19102
Database.swapAccounts
train
public void swapAccounts(Database other) { Account otherRoot = other.rootAccount; other.rootAccount = rootAccount; rootAccount = otherRoot; boolean otherDirty = other.dirty; other.dirty = dirty; dirty = otherDirty; HashMap<String, String> otherGlobalSettings = other.globalSettings; other.globalSettings = globalSettings; globalSettings = otherGlobalSettings; }
java
{ "resource": "" }
q19103
Database.addAccount
train
public void addAccount(Account parent, Account child) throws Exception { // Check to see if the account physically already exists - there is something funny with // some Firefox RDF exports where an RDF:li node gets duplicated multiple times. for (Account dup : parent.getChildren()) { if (dup == child) { logger.warning("Duplicate RDF:li=" + child.getId() + " detected. Dropping duplicate"); return; } } int iterationCount = 0; final int maxIteration = 0x100000; // if we can't find a hash in 1 million iterations, something is wrong while (findAccountById(child.getId()) != null && (iterationCount++ < maxIteration)) { logger.warning("ID collision detected on '" + child.getId() + "', attempting to regenerate ID. iteration=" + iterationCount); child.setId(Account.createId(child)); } if (iterationCount >= maxIteration) { throw new Exception("Could not genererate a unique ID in " + iterationCount + " iterations, this is really rare. I know it's lame, but change the description and try again."); } // add to new parent parent.getChildren().add(child); sendAccountAdded(parent, child); setDirty(true); }
java
{ "resource": "" }
q19104
Database.removeAccount
train
public void removeAccount(Account accountToDelete) { // Thou shalt not delete root if (accountToDelete.getId().equals(rootAccount.getId())) return; Account parent = findParent(accountToDelete); if (parent != null) { removeAccount(parent, accountToDelete); setDirty(true); } }
java
{ "resource": "" }
q19105
Database.removeAccount
train
private void removeAccount(Account parent, Account child) { parent.getChildren().remove(child); sendAccountRemoved(parent, child); }
java
{ "resource": "" }
q19106
Database.setGlobalSetting
train
public void setGlobalSetting(String name, String value) { String oldValue; // Avoid redundant setting if (globalSettings.containsKey(name)) { oldValue = globalSettings.get(name); if (value.compareTo(oldValue) == 0) return; } globalSettings.put(name, value); setDirty(true); }
java
{ "resource": "" }
q19107
Database.getGlobalSetting
train
public String getGlobalSetting(GlobalSettingKey key) { if (globalSettings.containsKey(key.toString())) return globalSettings.get(key.toString()); return key.getDefault(); }
java
{ "resource": "" }
q19108
Database.printDatabase
train
private void printDatabase(Account acc, int level, PrintStream stream) { String buf = ""; for (int i = 0; i < level; i++) buf += " "; buf += "+"; buf += acc.getName() + "[" + acc.getUrl() + "] (" + acc.getPatterns().size() + " patterns)"; stream.println(buf); for (Account account : acc.getChildren()) printDatabase(account, level + 2, stream); } public List<Account> findPathToAccountById(String id) { LinkedList<Account> result = getRootInLinkedList(); findAccountById(result, id); // reverse the list, so that its,<root> -> parent -> ... -> Found Account List<Account> retValue = new ArrayList<Account>(result.size()); Iterator<Account> iter = result.descendingIterator(); while (iter.hasNext()) retValue.add(iter.next()); return retValue; } public List<Account> getAllAccounts() { Set<Account> acc = new HashSet<Account>(); getAllAccounts(getRootAccount(), acc); List<Account> sorted = new ArrayList<Account>(acc); Collections.sort(sorted, new Comparator<Account>() { @Override public int compare(Account o1, Account o2) { return o1.getName().compareToIgnoreCase(o2.getName()); } }); return sorted; } private void getAllAccounts(Account base, Collection<Account> into) { for (Account c : base.getChildren()) { if ( c.hasChildren() ) { getAllAccounts(c, into); } else { into.add(c); } } } /** * Locates an account, given an id. * * @param id The account id (unique hash). * @return The account if found, else null. */ public Account findAccountById(String id) { return findAccountById(getRootInLinkedList(), id); } /** * Internal function to recurse through accounts looking for an id. * * @param stack The path to the current parent * @param id The id to look for. * @return The Account if found, else null. */ private Account findAccountById(LinkedList<Account> stack, String id) { final Account parent = stack.peek(); if (parent == null) { if ( ! stack.isEmpty() ) stack.pop(); return null; } for (Account child : parent.getChildren()) { if (child.getId().equals(id)) { stack.push(child); return child; } if (child.getChildren().size() > 0) { stack.push(child); Account foundAccount = findAccountById(stack, id); if (foundAccount != null) return foundAccount; } } stack.pop(); return null; } private LinkedList<Account> getRootInLinkedList() { LinkedList<Account> stack = new LinkedList<Account>(); stack.add(rootAccount); return stack; } /** * Searches the database for any account with a matching URL. * * @param url The regex to search with. * @return The account if found, else null. */ public Account findAccountByUrl(String url) { return findAccountByUrl(rootAccount, url); } /** * Internal function to aid in searching. This will find the first account in the tree starting at parent * that matches the url given. * * @param parent - The parent to start searching with. * @param url - Url to search for * @return the matching account (maybe the parent), or Null if no matching account was found. */ private Account findAccountByUrl(Account parent, String url) { // First search the parent if (AccountPatternMatcher.matchUrl(parent, url) && !parent.isRoot()) return parent; for (Account child : parent.getChildren()) { Account foundAccount = findAccountByUrl(child, url); if (foundAccount != null) return foundAccount; } return null; }
java
{ "resource": "" }
q19109
JCurand.checkResult
train
private static int checkResult(int result) { if (exceptionsEnabled && result != curandStatus.CURAND_STATUS_SUCCESS) { throw new CudaException(curandStatus.stringFor(result)); } return result; }
java
{ "resource": "" }
q19110
MethodCompiler.nameArgument
train
public final void nameArgument(String name, int index) { VariableElement lv = getLocalVariable(index); if (lv instanceof UpdateableElement) { UpdateableElement ue = (UpdateableElement) lv; ue.setSimpleName(El.getName(name)); } else { throw new IllegalArgumentException("local variable at index "+index+" cannot be named"); } }
java
{ "resource": "" }
q19111
MethodCompiler.getLocalVariable
train
public VariableElement getLocalVariable(int index) { int idx = 0; for (VariableElement lv : localVariables) { if (idx == index) { return lv; } if (Typ.isCategory2(lv.asType())) { idx += 2; } else { idx++; } } throw new IllegalArgumentException("local variable at index "+index+" not found"); }
java
{ "resource": "" }
q19112
MethodCompiler.getLocalName
train
public String getLocalName(int index) { VariableElement lv = getLocalVariable(index); return lv.getSimpleName().toString(); }
java
{ "resource": "" }
q19113
MethodCompiler.getLocalType
train
public TypeMirror getLocalType(String name) { VariableElement lv = getLocalVariable(name); return lv.asType(); }
java
{ "resource": "" }
q19114
MethodCompiler.getLocalDescription
train
public String getLocalDescription(int index) { StringWriter sw = new StringWriter(); El.printElements(sw, getLocalVariable(index)); return sw.toString(); }
java
{ "resource": "" }
q19115
MethodCompiler.loadDefault
train
public void loadDefault(TypeMirror type) throws IOException { if (type.getKind() != TypeKind.VOID) { if (Typ.isPrimitive(type)) { tconst(type, 0); } else { aconst_null(); } } }
java
{ "resource": "" }
q19116
MethodCompiler.startSubroutine
train
public void startSubroutine(String target) throws IOException { if (subroutine != null) { throw new IllegalStateException("subroutine "+subroutine+" not ended when "+target+ "started"); } subroutine = target; if (!hasLocalVariable(SUBROUTINERETURNADDRESSNAME)) { addVariable(SUBROUTINERETURNADDRESSNAME, Typ.ReturnAddress); } fixAddress(target); tstore(SUBROUTINERETURNADDRESSNAME); }
java
{ "resource": "" }
q19117
MethodCompiler.typeForCount
train
public TypeMirror typeForCount(int count) { if (count <= Byte.MAX_VALUE) { return Typ.Byte; } if (count <= Short.MAX_VALUE) { return Typ.Short; } if (count <= Integer.MAX_VALUE) { return Typ.Int; } return Typ.Long; }
java
{ "resource": "" }
q19118
MethodCompiler.fixAddress
train
@Override public void fixAddress(String name) throws IOException { super.fixAddress(name); if (debugMethod != null) { int position = position(); tload("this"); ldc(position); ldc(name); invokevirtual(debugMethod); } }
java
{ "resource": "" }
q19119
RouteFactory.matchRoute
train
public Route matchRoute(String url) { if (hashRoute.containsKey(url)) { return new Route(hashRoute.get(url).get(0), null); } for (RegexRoute route : regexRoute) { Matcher matcher = route.getPattern().matcher(url); if (matcher.matches()) { return new Route(route, matcher); } } return null; }
java
{ "resource": "" }
q19120
Element.addAttributes
train
public void addAttributes(List<Attribute> attributes) { for(Attribute attribute : attributes) { addAttribute(attribute.getName(), attribute.getValue()); } }
java
{ "resource": "" }
q19121
Element.addAttribute
train
public void addAttribute(String attributeName, String attributeValue) throws XmlModelException { String name = attributeName.trim(); String value = attributeValue.trim(); if(attributesMap.containsKey(name)) { throw new XmlModelException("Duplicate attribute: " + name); } attributeNames.add(name); attributesMap.put(name, new Attribute(name, value)); }
java
{ "resource": "" }
q19122
ModuleDependencyRefset.tc
train
private static void tc(Map<M, Set<M>> index) { final Map<String, Object[]> warnings = new HashMap<>(); for (Entry<M, Set<M>> entry: index.entrySet()) { final M src = entry.getKey(); final Set<M> dependents = entry.getValue(); final Queue<M> queue = new LinkedList<M>(dependents); while (!queue.isEmpty()) { final M key = queue.poll(); if (!index.containsKey(key)) { continue; } for (M addition: index.get(key)) { if (!dependents.contains(addition)) { dependents.add(addition); queue.add(addition); warnings.put(src + "|" + addition + "|" + key, new Object[] {src, addition, key}); } } } } for (final Object[] args: warnings.values()) { StructuredLog.ImpliedTransitiveDependency.warn(log, args); } }
java
{ "resource": "" }
q19123
AbstractMethodTypeListener.hear
train
private <I> void hear( Class<? super I> type, TypeEncounter<I> encounter ) { if ( type == null || type.getPackage().getName().startsWith( JAVA_PACKAGE ) ) { return; } for ( Method method : type.getDeclaredMethods() ) { if ( method.isAnnotationPresent( annotationType ) ) { if ( method.getParameterTypes().length != 0 ) { encounter.addError( "Annotated methods with @%s must not accept any argument, found %s", annotationType.getName(), method ); } hear( method, encounter ); } } hear( type.getSuperclass(), encounter ); }
java
{ "resource": "" }
q19124
ResultSetStreamer.require
train
public ResultSetStreamer require(String column, Assertion assertion) { if (_requires == Collections.EMPTY_MAP) _requires = new HashMap<String, Assertion>(); _requires.put(column, assertion); return this; }
java
{ "resource": "" }
q19125
ResultSetStreamer.exclude
train
public ResultSetStreamer exclude(String column, Assertion assertion) { if (_excludes == Collections.EMPTY_MAP) _excludes = new HashMap<String, Assertion>(); _excludes.put(column, assertion); return this; }
java
{ "resource": "" }
q19126
ExecutablePredicates.executableIsSynthetic
train
public static <T extends Executable> Predicate<T> executableIsSynthetic() { return candidate -> candidate != null && candidate.isSynthetic(); }
java
{ "resource": "" }
q19127
ExecutablePredicates.executableBelongsToClass
train
public static <T extends Executable> Predicate<T> executableBelongsToClass(Class<?> reference) { return candidate -> candidate != null && reference.equals(candidate.getDeclaringClass()); }
java
{ "resource": "" }
q19128
ExecutablePredicates.executableBelongsToClassAssignableTo
train
public static <T extends Executable> Predicate<T> executableBelongsToClassAssignableTo(Class<?> reference) { return candidate -> candidate != null && reference.isAssignableFrom(candidate.getDeclaringClass()); }
java
{ "resource": "" }
q19129
ExecutablePredicates.executableIsEquivalentTo
train
public static <T extends Executable> Predicate<T> executableIsEquivalentTo(T reference) { Predicate<T> predicate = candidate -> candidate != null && candidate.getName().equals(reference.getName()) && executableHasSameParameterTypesAs(reference).test(candidate); if (reference instanceof Method) { predicate.and(candidate -> candidate instanceof Method && ((Method) candidate).getReturnType() .equals(((Method) reference).getReturnType())); } return predicate; }
java
{ "resource": "" }
q19130
ExecutablePredicates.executableHasSameParameterTypesAs
train
public static <T extends Executable> Predicate<T> executableHasSameParameterTypesAs(T reference) { return candidate -> { if (candidate == null) { return false; } Class<?>[] candidateParameterTypes = candidate.getParameterTypes(); Class<?>[] referenceParameterTypes = reference.getParameterTypes(); if (candidateParameterTypes.length != referenceParameterTypes.length) { return false; } for (int i = 0; i < candidateParameterTypes.length; i++) { if (!candidateParameterTypes[i].equals(referenceParameterTypes[i])) { return false; } } return true; }; }
java
{ "resource": "" }
q19131
Robot.run
train
@Override public void run() { try { try { turnsControl.waitTurns(1, "Robot starting"); // block at the beginning so that all // robots start at the // same time } catch (BankInterruptedException exc) { log.trace("[run] Interrupted before starting"); } assert getData().isEnabled() : "Robot is disabled"; mainLoop(); log.debug("[run] Robot terminated gracefully"); } catch (Exception | Error all) { log.error("[run] Problem running robot " + this, all); die("Execution Error -- " + all); } }
java
{ "resource": "" }
q19132
Robot.die
train
@Override public void die(String reason) { log.info("[die] Robot {} died with reason: {}", serialNumber, reason); if (alive) { // if not alive it means it was killed at creation alive = false; interrupted = true; // to speed up death world.remove(Robot.this); } }
java
{ "resource": "" }
q19133
SmileInputFormat.listStatus
train
protected List<FileStatus> listStatus(JobContext job) throws IOException { List<FileStatus> result = new ArrayList<FileStatus>(); Path[] dirs = getInputPaths(job); if (dirs.length == 0) { throw new IOException("No input paths specified in job"); } // Get tokens for all the required FileSystems.. TokenCache.obtainTokensForNamenodes(job.getCredentials(), dirs, job.getConfiguration()); List<IOException> errors = new ArrayList<IOException>(); for (Path p : dirs) { FileSystem fs = p.getFileSystem(job.getConfiguration()); final SmilePathFilter filter = new SmilePathFilter(); FileStatus[] matches = fs.globStatus(p, filter); if (matches == null) { errors.add(new IOException("Input path does not exist: " + p)); } else if (matches.length == 0) { errors.add(new IOException("Input Pattern " + p + " matches 0 files")); } else { for (FileStatus globStat : matches) { if (globStat.isDir()) { Collections.addAll(result, fs.listStatus(globStat.getPath(), filter)); } else { result.add(globStat); } } } } if (!errors.isEmpty()) { throw new InvalidInputException(errors); } return result; }
java
{ "resource": "" }
q19134
AttachmentAdvisorAbstract.checkInputClass
train
protected void checkInputClass(final Object domainObject) { final Class<?> actualInputType = domainObject.getClass(); if(!(expectedInputType.isAssignableFrom(actualInputType))) { throw new IllegalArgumentException("The input document is required to be of type: " + expectedInputType.getName()); } }
java
{ "resource": "" }
q19135
AbstractCachedConnection.setTimeout
train
public void setTimeout(long timeout, TimeUnit unit) { this.timeout = TimeUnit.MILLISECONDS.convert(timeout, unit); }
java
{ "resource": "" }
q19136
ClientSocketAdapter.sendObjectToSocket
train
public final void sendObjectToSocket(Object o) { Session sess = this.getSession(); if (sess != null) { String json; try { json = this.mapper.writeValueAsString(o); } catch (JsonProcessingException e) { ClientSocketAdapter.LOGGER.error("Failed to serialize object", e); return; } sess.getRemote().sendString(json, new WriteCallback() { @Override public void writeSuccess() { ClientSocketAdapter.LOGGER.info("Send data to socket"); } @Override public void writeFailed(Throwable x) { ClientSocketAdapter.LOGGER.error("Error sending message to socket", x); } }); } }
java
{ "resource": "" }
q19137
ClientSocketAdapter.readMessage
train
protected final <T> T readMessage(String message, Class<T> clazz) { if ((message == null) || message.isEmpty()) { ClientSocketAdapter.LOGGER.info("Got empty session data"); return null; } try { return this.mapper.readValue(message, clazz); } catch (IOException e1) { ClientSocketAdapter.LOGGER.info("Got invalid session data", e1); return null; } }
java
{ "resource": "" }
q19138
BaseFileManager.makeByteBuffer
train
public ByteBuffer makeByteBuffer(InputStream in) throws IOException { int limit = in.available(); if (limit < 1024) limit = 1024; ByteBuffer result = byteBufferCache.get(limit); int position = 0; while (in.available() != 0) { if (position >= limit) // expand buffer result = ByteBuffer. allocate(limit <<= 1). put((ByteBuffer)result.flip()); int count = in.read(result.array(), position, limit - position); if (count < 0) break; result.position(position += count); } return (ByteBuffer)result.flip(); }
java
{ "resource": "" }
q19139
BrowserApplicationCache.add
train
public void add(Collection<BrowserApplication> browserApplications) { for(BrowserApplication browserApplication : browserApplications) this.browserApplications.put(browserApplication.getId(), browserApplication); }
java
{ "resource": "" }
q19140
Objects.getProperty
train
public static Object getProperty(Object object, String name) throws NoSuchFieldException { try { Matcher matcher = ARRAY_INDEX.matcher(name); if (matcher.matches()) { object = getProperty(object, matcher.group(1)); if (object.getClass().isArray()) { return Array.get(object, Integer.parseInt(matcher.group(2))); } else { return ((List)object).get(Integer.parseInt(matcher.group(2))); } } else { int dot = name.lastIndexOf('.'); if (dot > 0) { object = getProperty(object, name.substring(0, dot)); name = name.substring(dot + 1); } return Beans.getKnownField(object.getClass(), name).get(object); } } catch (NoSuchFieldException x) { throw x; } catch (Exception x) { throw new IllegalArgumentException(x.getMessage() + ": " + name, x); } }
java
{ "resource": "" }
q19141
Objects.setProperty
train
@SuppressWarnings("unchecked") public static void setProperty(Object object, String name, String text) throws NoSuchFieldException { try { // need to get to the field for any typeinfo annotation, so here we go ... int length = name.lastIndexOf('.'); if (length > 0) { object = getProperty(object, name.substring(0, length)); name = name.substring(length + 1); } length = name.length(); Matcher matcher = ARRAY_INDEX.matcher(name); for (Matcher m = matcher; m.matches(); m = ARRAY_INDEX.matcher(name)) { name = m.group(1); } Field field = Beans.getKnownField(object.getClass(), name); if (name.length() != length) { int index = Integer.parseInt(matcher.group(2)); object = getProperty(object, matcher.group(1)); if (object.getClass().isArray()) { Array.set(object, index, new ValueOf(object.getClass().getComponentType(), field.getAnnotation(typeinfo.class)).invoke(text)); } else { ((List)object).set(index, new ValueOf(field.getAnnotation(typeinfo.class).value()[0]).invoke(text)); } } else { field.set(object, new ValueOf(field.getType(), field.getAnnotation(typeinfo.class)).invoke(text)); } } catch (NoSuchFieldException x) { throw x; } catch (Exception x) { throw new IllegalArgumentException(x.getMessage() + ": " + name, x); } }
java
{ "resource": "" }
q19142
Objects.concat
train
@SafeVarargs public static <T> T[] concat(T[] first, T[]... rest) { int length = first.length; for (T[] array : rest) { length += array.length; } T[] result = Arrays.copyOf(first, length); int offset = first.length; for (T[] array : rest) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result; }
java
{ "resource": "" }
q19143
GeneratedDi18nDaoImpl.queryByBaseBundle
train
public Iterable<Di18n> queryByBaseBundle(java.lang.String baseBundle) { return queryByField(null, Di18nMapper.Field.BASEBUNDLE.getFieldName(), baseBundle); }
java
{ "resource": "" }
q19144
GeneratedDi18nDaoImpl.queryByKey
train
public Iterable<Di18n> queryByKey(java.lang.String key) { return queryByField(null, Di18nMapper.Field.KEY.getFieldName(), key); }
java
{ "resource": "" }
q19145
GeneratedDi18nDaoImpl.queryByLocale
train
public Iterable<Di18n> queryByLocale(java.lang.String locale) { return queryByField(null, Di18nMapper.Field.LOCALE.getFieldName(), locale); }
java
{ "resource": "" }
q19146
GeneratedDi18nDaoImpl.queryByLocalizedMessage
train
public Iterable<Di18n> queryByLocalizedMessage(java.lang.String localizedMessage) { return queryByField(null, Di18nMapper.Field.LOCALIZEDMESSAGE.getFieldName(), localizedMessage); }
java
{ "resource": "" }
q19147
MoreStringUtils.maskExcept
train
public static String maskExcept(final String s, final int unmaskedLength, final char maskChar) { if (s == null) { return null; } final boolean maskLeading = unmaskedLength > 0; final int length = s.length(); final int maskedLength = Math.max(0, length - Math.abs(unmaskedLength)); if (maskedLength > 0) { final String mask = StringUtils.repeat(maskChar, maskedLength); if (maskLeading) { return StringUtils.overlay(s, mask, 0, maskedLength); } return StringUtils.overlay(s, mask, length - maskedLength, length); } return s; }
java
{ "resource": "" }
q19148
MoreStringUtils.replaceNonPrintableControlCharacters
train
public static String replaceNonPrintableControlCharacters(final String value) { if (value == null || value.length() == 0) { return value; } boolean changing = false; for (int i = 0, length = value.length(); i < length; i++) { final char ch = value.charAt(i); if (ch < 32 && ch != '\n' && ch != '\r' && ch != '\t') { changing = true; break; } } if (!changing) { return value; } final StringBuilder buf = new StringBuilder(value); for (int i = 0, length = buf.length(); i < length; i++) { final char ch = buf.charAt(i); if (ch < 32 && ch != '\n' && ch != '\r' && ch != '\t') { buf.setCharAt(i, ' '); } } // return cleaned string return buf.toString(); }
java
{ "resource": "" }
q19149
MoreStringUtils.shortUuid
train
public static String shortUuid() { // source: java.util.UUID.randomUUID() final byte[] randomBytes = new byte[16]; UUID_GENERATOR.nextBytes(randomBytes); randomBytes[6] = (byte) (randomBytes[6] & 0x0f); // clear version randomBytes[6] = (byte) (randomBytes[6] | 0x40); // set to version 4 randomBytes[8] = (byte) (randomBytes[8] & 0x3f); // clear variant randomBytes[8] = (byte) (randomBytes[8] | 0x80); // set to IETF variant // all base 64 encoding schemes use A-Z, a-z, and 0-9 for the first 62 characters. for the // last 2 characters, we use hyphen and underscore, which are URL safe return BaseEncoding.base64Url().omitPadding().encode(randomBytes); }
java
{ "resource": "" }
q19150
MoreStringUtils.splitToList
train
public static List<String> splitToList(final String value) { if (!StringUtils.isEmpty(value)) { return COMMA_SPLITTER.splitToList(value); } return Collections.<String> emptyList(); }
java
{ "resource": "" }
q19151
MoreStringUtils.trimWhitespace
train
public static String trimWhitespace(final String s) { if (s == null || s.length() == 0) { return s; } final int length = s.length(); int end = length; int start = 0; while (start < end && Character.isWhitespace(s.charAt(start))) { start++; } while (start < end && Character.isWhitespace(s.charAt(end - 1))) { end--; } return start > 0 || end < length ? s.substring(start, end) : s; }
java
{ "resource": "" }
q19152
MoreStringUtils.trimWhitespaceToNull
train
public static String trimWhitespaceToNull(final String s) { final String result = trimWhitespace(s); return StringUtils.isEmpty(result) ? null : s; }
java
{ "resource": "" }
q19153
ComponentBindingsProviderCache.getReferences
train
public List<ServiceReference> getReferences(String resourceType) { List<ServiceReference> references = new ArrayList<ServiceReference>(); if (containsKey(resourceType)) { references.addAll(get(resourceType)); Collections.sort(references, new Comparator<ServiceReference>() { @Override public int compare(ServiceReference r0, ServiceReference r1) { Integer p0 = OsgiUtil.toInteger( r0.getProperty(ComponentBindingsProvider.PRIORITY), 0); Integer p1 = OsgiUtil.toInteger( r1.getProperty(ComponentBindingsProvider.PRIORITY), 0); return -1 * p0.compareTo(p1); } }); } return references; }
java
{ "resource": "" }
q19154
ComponentBindingsProviderCache.registerComponentBindingsProvider
train
public void registerComponentBindingsProvider(ServiceReference reference) { log.info("registerComponentBindingsProvider"); log.info("Registering Component Bindings Provider {} - {}", new Object[] { reference.getProperty(Constants.SERVICE_ID), reference.getProperty(Constants.SERVICE_PID) }); String[] resourceTypes = OsgiUtil.toStringArray(reference .getProperty(ComponentBindingsProvider.RESOURCE_TYPE_PROP), new String[0]); for (String resourceType : resourceTypes) { if (!this.containsKey(resourceType)) { put(resourceType, new HashSet<ServiceReference>()); } log.debug("Adding to resource type {}", resourceType); get(resourceType).add(reference); } }
java
{ "resource": "" }
q19155
ComponentBindingsProviderCache.unregisterComponentBindingsProvider
train
public void unregisterComponentBindingsProvider(ServiceReference reference) { log.info("unregisterComponentBindingsProvider"); String[] resourceTypes = OsgiUtil.toStringArray(reference .getProperty(ComponentBindingsProvider.RESOURCE_TYPE_PROP), new String[0]); for (String resourceType : resourceTypes) { if (!this.containsKey(resourceType)) { continue; } get(resourceType).remove(reference); } }
java
{ "resource": "" }
q19156
ComponentFactory.toCreate
train
public ComponentFactory<T, E> toCreate(BiFunction<Constructor, Object[], Object> createFunction) { return new ComponentFactory<>(this.annotationType, this.classElement, this.contextConsumer, createFunction); }
java
{ "resource": "" }
q19157
ComponentFactory.toConfigure
train
public ComponentFactory<T, E> toConfigure(BiConsumer<Context, Annotation> consumer) { return new ComponentFactory<>(this.annotationType, this.classElement, consumer, this.createFunction); }
java
{ "resource": "" }
q19158
ComponentFactory.createAll
train
public List<E> createAll(AnnotatedElement element) { List<E> result = new ArrayList<>(); for (Annotation annotation : element.getAnnotations()) { create(annotation).ifPresent(result::add); } return result; }
java
{ "resource": "" }
q19159
VersionHelper.getVersion
train
public static String getVersion() { String version = null; // try to load from maven properties first try { Properties p = new Properties(); InputStream is = VersionHelper.class.getResourceAsStream("/META-INF/maven/io.redlink/redlink-sdk-java/pom.properties"); if (is != null) { p.load(is); version = p.getProperty("version", ""); } } catch (Exception e) { // ignore } // fallback to using Java API if (version == null) { Package aPackage = VersionHelper.class.getPackage(); if (aPackage != null) { version = aPackage.getImplementationVersion(); if (version == null) { version = aPackage.getSpecificationVersion(); } } } // fallback to read pom.xml on testing if (version == null) { final MavenXpp3Reader reader = new MavenXpp3Reader(); try { Model model = reader.read(new FileReader(new File("pom.xml"))); version = model.getVersion(); } catch (IOException | XmlPullParserException e) { // ignore } } return version; }
java
{ "resource": "" }
q19160
VersionHelper.formatApiVersion
train
protected static String formatApiVersion(String version) { if (StringUtils.isBlank(version)) { return VERSION; } else { final Matcher matcher = VERSION_PATTERN.matcher(version); if (matcher.matches()) { return String.format("%s.%s", matcher.group(1), matcher.group(2)); } else { return VERSION; } } }
java
{ "resource": "" }
q19161
XlsWorkbook.numSheets
train
@Override public int numSheets() { int ret = -1; if(workbook != null) ret = workbook.getNumberOfSheets(); else if(writableWorkbook != null) ret = writableWorkbook.getNumberOfSheets(); return ret; }
java
{ "resource": "" }
q19162
XlsWorkbook.getSheetNames
train
@Override public String[] getSheetNames() { String[] ret = null; if(workbook != null) ret = workbook.getSheetNames(); else if(writableWorkbook != null) ret = writableWorkbook.getSheetNames(); return ret; }
java
{ "resource": "" }
q19163
XlsWorkbook.getSheet
train
@Override public XlsWorksheet getSheet(String name) { XlsWorksheet ret = null; if(workbook != null) { Sheet sheet = workbook.getSheet(name); if(sheet != null) ret = new XlsWorksheet(sheet); } else if(writableWorkbook != null) { Sheet sheet = writableWorkbook.getSheet(name); if(sheet != null) ret = new XlsWorksheet(sheet); } return ret; }
java
{ "resource": "" }
q19164
XlsWorkbook.createSheet
train
@Override public XlsWorksheet createSheet(FileColumn[] columns, List<String[]> lines, String sheetName) throws IOException { // Create the worksheet and add the cells WritableSheet sheet = writableWorkbook.createSheet(sheetName, 9999); // Append sheet try { appendRows(sheet, columns, lines, sheetName); } catch(WriteException e) { throw new IOException(e); } // Set the column to autosize int numColumns = sheet.getColumns(); for(int i = 0; i < numColumns; i++) { CellView column = sheet.getColumnView(i); column.setAutosize(true); if(columns != null && i < columns.length) { CellFormat format = columns[i].getCellFormat(); if(format != null) column.setFormat(format); } sheet.setColumnView(i, column); } return new XlsWorksheet(sheet); }
java
{ "resource": "" }
q19165
XlsWorkbook.appendToSheet
train
@Override public void appendToSheet(FileColumn[] columns, List<String[]> lines, String sheetName) throws IOException { try { XlsWorksheet sheet = getSheet(sheetName); if(sheet != null) appendRows((WritableSheet)sheet.getSheet(), columns, lines, sheetName); } catch(WriteException e) { throw new IOException(e); } }
java
{ "resource": "" }
q19166
XlsWorkbook.appendRows
train
private void appendRows(WritableSheet sheet, FileColumn[] columns, List<String[]> lines, String sheetName) throws WriteException { WritableFont headerFont = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD); WritableCellFormat headerFormat = new WritableCellFormat(headerFont); WritableCellFeatures features = new WritableCellFeatures(); features.removeDataValidation(); int size = sheet.getRows(); for(int i = 0; i < lines.size(); i++) { String[] line = lines.get(i); if((i+size) > MAX_ROWS) { logger.severe("the worksheet '"+sheetName +"' has exceeded the maximum rows and will be truncated"); break; } for(int j = 0; j < line.length; j++) { WritableCell cell = null; String data = line[j]; if(data == null) data = ""; // Get a cell with the correct formatting if(columns != null && j < columns.length) { cell = getCell(columns[j], j, i+size, data); } else // Try to figure out the type of the column { try { double num = Double.parseDouble(data); cell = new Number(j, i+size, num); } catch(NumberFormatException e) { cell = new Label(j, i+size, data); } } if(cell != null) { if((i+size) == 0 && hasHeaders()) cell.setCellFormat(headerFormat); else cell.setCellFeatures(features); sheet.addCell(cell); } } } }
java
{ "resource": "" }
q19167
XlsWorkbook.setCellFormatAttributes
train
public void setCellFormatAttributes(WritableCellFormat cellFormat, FileColumn column) { try { if(cellFormat != null && column != null) { Alignment a = Alignment.GENERAL; short align = column.getAlign(); if(align == FileColumn.ALIGN_CENTRE) a = Alignment.CENTRE; else if(align == FileColumn.ALIGN_LEFT) a = Alignment.LEFT; else if(align == FileColumn.ALIGN_RIGHT) a = Alignment.RIGHT; else if(align == FileColumn.ALIGN_JUSTIFY) a = Alignment.JUSTIFY; else if(align == FileColumn.ALIGN_FILL) a = Alignment.FILL; cellFormat.setAlignment(a); cellFormat.setWrap(column.getWrap()); } } catch(WriteException e) { logger.severe(StringUtilities.serialize(e)); } }
java
{ "resource": "" }
q19168
XlsWorkbook.close
train
@Override public void close() { if(workbook != null) workbook.close(); try { if(writableWorkbook != null) writableWorkbook.close(); } catch(IOException e) { } catch(WriteException e) { } }
java
{ "resource": "" }
q19169
RangeUtils.getDateRanges
train
public static List<Range<Date>> getDateRanges(Date from, Date to, final Period periodGranulation) throws InvalidRangeException { if (from.after(to)) { throw buildInvalidRangeException(from, to); } if (periodGranulation == Period.SINGLE) { @SuppressWarnings("unchecked") ArrayList<Range<Date>> list = newArrayList(Range.getInstance(from, to)); return list; } to = formatToStartOfDay(to); from = formatToStartOfDay(from); List<Range<Date>> dateRanges = Lists.newArrayList(); Calendar calendar = buildCalendar(from); Date currentProcessDate = calendar.getTime(); for (Date processEndDate = getDatePeriod(to, periodGranulation).getUpperBound(); !processEndDate .before(currentProcessDate); currentProcessDate = calendar.getTime()) { Date dateInRange = calendar.getTime(); Range<Date> dateRange = getDatePeriod(dateInRange, periodGranulation); dateRanges.add(dateRange); calendar.add(periodGranulation.value, 1); } calendarCache.add(calendar); Range<Date> firstRange = dateRanges.get(0); if (firstRange.getLowerBound().before(from)) { dateRanges.set(0, Range.getInstance(from, firstRange.getUpperBound())); } int indexOfLastDateRange = dateRanges.size() - 1; Range<Date> lastRange = dateRanges.get(indexOfLastDateRange); if (lastRange.getUpperBound().after(to)) { dateRanges.set(indexOfLastDateRange, Range.getInstance(lastRange.getLowerBound(), to)); } return dateRanges; }
java
{ "resource": "" }
q19170
RangeUtils.getDatePeriod
train
public static Range<Date> getDatePeriod(final Date date, final Period period) { Calendar calendar = buildCalendar(date); Range<Date> dateRange = null; Date startDate = calendar.getTime(); Date endDate = calendar.getTime(); if (period != Period.DAY) { for (; period.getValue(date) == period.getValue(calendar.getTime()); calendar .add(DAY_OF_MONTH, 1)) { endDate = calendar.getTime(); } calendar.setTime(date); for (; period.getValue(date) == period.getValue(calendar.getTime()); calendar .add(DAY_OF_MONTH, -1)) { startDate = calendar.getTime(); } } calendarCache.add(calendar); dateRange = Range.getInstance(startDate, endDate); return dateRange; }
java
{ "resource": "" }
q19171
RangeUtils.buildCalendar
train
private static Calendar buildCalendar(final Date date) { Calendar calendar = buildCalendar(); calendar.setTime(date); return calendar; }
java
{ "resource": "" }
q19172
RetryingExecutor.execute
train
public synchronized void execute(Runnable command) { if (active.get()) { stop(); this.command = command; start(); } else { this.command = command; } }
java
{ "resource": "" }
q19173
Name.startsWith
train
public boolean startsWith(Name prefix) { byte[] thisBytes = this.getByteArray(); int thisOffset = this.getByteOffset(); int thisLength = this.getByteLength(); byte[] prefixBytes = prefix.getByteArray(); int prefixOffset = prefix.getByteOffset(); int prefixLength = prefix.getByteLength(); int i = 0; while (i < prefixLength && i < thisLength && thisBytes[thisOffset + i] == prefixBytes[prefixOffset + i]) i++; return i == prefixLength; }
java
{ "resource": "" }
q19174
DocumentTemplateRepository.createBlob
train
@Programmatic public DocumentTemplate createBlob( final DocumentType type, final LocalDate date, final String atPath, final String fileSuffix, final boolean previewOnly, final Blob blob, final RenderingStrategy contentRenderingStrategy, final String subjectText, final RenderingStrategy subjectRenderingStrategy) { final DocumentTemplate document = new DocumentTemplate( type, date, atPath, fileSuffix, previewOnly, blob, contentRenderingStrategy, subjectText, subjectRenderingStrategy); repositoryService.persistAndFlush(document); return document; }
java
{ "resource": "" }
q19175
DocumentTemplateRepository.findByType
train
@Programmatic public List<DocumentTemplate> findByType(final DocumentType documentType) { return repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByType", "type", documentType)); }
java
{ "resource": "" }
q19176
DocumentTemplateRepository.findByApplicableToAtPathAndCurrent
train
@Programmatic public List<DocumentTemplate> findByApplicableToAtPathAndCurrent(final String atPath) { final LocalDate now = clockService.now(); return repositoryService.allMatches( new QueryDefault<>(DocumentTemplate.class, "findByApplicableToAtPathAndCurrent", "atPath", atPath, "now", now)); }
java
{ "resource": "" }
q19177
DocumentTemplateRepository.validateApplicationTenancyAndDate
train
@Programmatic public TranslatableString validateApplicationTenancyAndDate( final DocumentType proposedType, final String proposedAtPath, final LocalDate proposedDate, final DocumentTemplate ignore) { final List<DocumentTemplate> existingTemplates = findByTypeAndAtPath(proposedType, proposedAtPath); for (DocumentTemplate existingTemplate : existingTemplates) { if(existingTemplate == ignore) { continue; } if(java.util.Objects.equals(existingTemplate.getDate(), proposedDate)) { return TranslatableString.tr("A template already exists for this date"); } if (proposedDate == null && existingTemplate.getDate() != null) { return TranslatableString.tr( "Must provide a date (there are existing templates that already have a date specified)"); } } return null; }
java
{ "resource": "" }
q19178
CompilerThread.numActiveSubTasks
train
public synchronized int numActiveSubTasks() { int c = 0; for (Future<?> f : subTasks) { if (!f.isDone() && !f.isCancelled()) { c++; } } return c; }
java
{ "resource": "" }
q19179
CompilerThread.use
train
public synchronized void use() { assert(!inUse); inUse = true; compiler = com.sun.tools.javac.api.JavacTool.create(); fileManager = compiler.getStandardFileManager(null, null, null); fileManagerBase = (BaseFileManager)fileManager; smartFileManager = new SmartFileManager(fileManager); context = new Context(); context.put(JavaFileManager.class, smartFileManager); ResolveWithDeps.preRegister(context); JavaCompilerWithDeps.preRegister(context, this); subTasks = new ArrayList<Future<?>>(); }
java
{ "resource": "" }
q19180
CompilerThread.unuse
train
public synchronized void unuse() { assert(inUse); inUse = false; compiler = null; fileManager = null; fileManagerBase = null; smartFileManager = null; context = null; subTasks = null; }
java
{ "resource": "" }
q19181
CompilerThread.expect
train
private static boolean expect(BufferedReader in, String key) throws IOException { String s = in.readLine(); if (s != null && s.equals(key)) { return true; } return false; }
java
{ "resource": "" }
q19182
ParametricStatement.set
train
public ParametricStatement set(String sql) throws IllegalArgumentException { if (_env != null) { try { sql = Macro.expand(sql, _env.call()); } catch (Exception x) { throw new IllegalArgumentException(x.getMessage(), x); } } if (_params != null) { int count = 0; int qmark = sql.indexOf('?'); while (qmark > 0) { ++count; qmark = sql.indexOf('?', qmark+1); } if (_params.length == count) { _sql = sql; } else { throw new IllegalArgumentException("Wrong number of parameters in '" + sql +'\''); } } else { List<Param> params = new ArrayList<Param>(); _sql = transformer.invoke(new StringBuilder(), params, sql).toString(); _params = params.toArray(new Param[params.size()]); } return this; }
java
{ "resource": "" }
q19183
ParametricStatement.executeUpdate
train
public int executeUpdate(Connection conn, DataObject object) throws SQLException { PreparedStatement statement = conn.prepareStatement(_sql); try { load(statement, object); return statement.executeUpdate(); } finally { statement.close(); } }
java
{ "resource": "" }
q19184
ParametricStatement.executeUpdate
train
public int executeUpdate(Connection conn, DataObject[] objects) throws SQLException { PreparedStatement statement = conn.prepareStatement(_sql); try { for (DataObject object: objects) { load(statement, object); statement.addBatch(); } int count = getAffectedRowCount(statement.executeBatch()); return count; } finally { statement.close(); } }
java
{ "resource": "" }
q19185
ParametricStatement.executeInsert
train
public long[] executeInsert(Connection conn, DataObject object, boolean generatedKeys) throws SQLException { PreparedStatement statement = conn.prepareStatement(_sql, generatedKeys ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS); try { load(statement, object); long[] keys = new long[statement.executeUpdate()]; if (generatedKeys) { ResultSet rs = statement.getGeneratedKeys(); for (int i = 0; rs.next(); ++i) { keys[i] = rs.getLong(1); } rs.close(); } return keys; } finally { statement.close(); } }
java
{ "resource": "" }
q19186
ParametricStatement.executeProcedure
train
public int executeProcedure(Connection conn, DataObject object) throws SQLException { CallableStatement statement = conn.prepareCall(_sql); try { for (int i = 0; i < _params.length; ++i) { if ((_params[i].direction & Param.OUT) == 0) continue; statement.registerOutParameter(i+1, _params[i].type); } load(statement, object); statement.execute(); int result = statement.getUpdateCount(); if (object != null) { Class<? extends DataObject> type = object.getClass(); for (int i = 0; i < _params.length; ++i) { if ((_params[i].direction & Param.OUT) == 0) continue; try { Beans.setValue(object, Beans.getKnownField(type, _params[i].name), statement.getObject(i+1)); } catch (NoSuchFieldException x) { // ignore } catch (Exception x) { throw new SQLException("Exception in storage of '" + _params[i].name + "' into DataObject (" + type.getName() + ')', x); } } } return result; } finally { statement.close(); } }
java
{ "resource": "" }
q19187
CloseableFutureGroup.add
train
public void add(T closeable, Future<?> future) { _pairs.add(new Pair<T, Future<?>>(closeable, future)); }
java
{ "resource": "" }
q19188
CloseableFutureGroup.isDone
train
public boolean isDone() { int count = 0; for (Pair<T, Future<?>> pair: _pairs) { if (pair.second.isDone()) ++count; } return count == _pairs.size(); }
java
{ "resource": "" }
q19189
CloseableFutureGroup.close
train
@Override public void close() { // waiting phase int count = 0, last = 0; do { last = count; try { Thread.sleep(500); } catch (Exception x) {} count = 0; for (Pair<T, Future<?>> pair: _pairs) { if (pair.second.isDone()) ++count; } } while ((_waiting == null || _waiting.invoke(count, count - last)) && count < _pairs.size()); if (_waiting != null) _waiting.invoke(count, -1); // closing phase for (Pair<T, Future<?>> pair: _pairs) { if (!pair.second.isDone()) { try { if (_closing != null) _closing.invoke(pair.first, null); pair.second.cancel(true); pair.first.close(); } catch (Exception x) { if (_closing != null) _closing.invoke(pair.first, x); } } } }
java
{ "resource": "" }
q19190
Contract.load
train
public static Contract load(File idlJson) throws IOException { FileInputStream fis = new FileInputStream(idlJson); Contract c = load(fis); fis.close(); return c; }
java
{ "resource": "" }
q19191
Contract.load
train
@SuppressWarnings("unchecked") public static Contract load(InputStream idlJson, Serializer ser) throws IOException { return new Contract(ser.readList(idlJson)); }
java
{ "resource": "" }
q19192
Contract.getFunction
train
public Function getFunction(String iface, String func) throws RpcException { Interface i = interfaces.get(iface); if (i == null) { String msg = "Interface '" + iface + "' not found"; throw RpcException.Error.METHOD_NOT_FOUND.exc(msg); } Function f = i.getFunction(func); if (f == null) { String msg = "Function '" + iface + "." + func + "' not found"; throw RpcException.Error.METHOD_NOT_FOUND.exc(msg); } return f; }
java
{ "resource": "" }
q19193
FreezeHandler.getName
train
private String getName(String s1, String s2) { if (s1 == null || "".equals(s1)) return s2; else return s1; }
java
{ "resource": "" }
q19194
FreezeHandler.write
train
private void write(String s) throws SAXException { try { out.write(s); out.flush(); } catch (IOException ioException) { throw new SAXParseException("I/O error", documentLocator, ioException); } }
java
{ "resource": "" }
q19195
FreezeHandler.printSaxException
train
void printSaxException(String message, SAXException e) { System.err.println(); System.err.println("*** SAX Exception -- " + message); System.err.println(" SystemId = \"" + documentLocator.getSystemId() + "\""); e.printStackTrace(System.err); }
java
{ "resource": "" }
q19196
FreezeHandler.printSaxParseException
train
void printSaxParseException(String message, SAXParseException e) { System.err.println(); System.err.println("*** SAX Parse Exception -- " + message); System.err.println(" SystemId = \"" + e.getSystemId() + "\""); System.err.println(" PublicId = \"" + e.getPublicId() + "\""); System.err.println(" line number " + e.getLineNumber()); e.printStackTrace(System.err); }
java
{ "resource": "" }
q19197
CriticalService.call
train
public void call(final T request, final Functor<String, RemoteService.Response> process, final Functor<Void, RemoteService.Response> confirm) { try { String message = process.invoke(RemoteService.call(location, endpoint, true, request)); if (message != null) { // clean failure throw new RuntimeException(message); } } catch (RuntimeException x) { if (confirm == null) { executor.execute(new VitalTask<Reporting, Void>(reporting) { protected Void execute() throws Exception { if (getAge() > DEFAULT_RETRY_LIMIT) { try { process.invoke(null); } catch (Exception x) {} } else { process.invoke(RemoteService.call(location, recovery, repacker.invoke(request))); } return null; } }); // positive! } else { executor.execute(new VitalTask<Reporting, Void>(reporting) { protected Void execute() throws Exception { if (getAge() > DEFAULT_RETRY_LIMIT) { return null; } else { confirm.invoke(RemoteService.call(location, recovery, repacker.invoke(request))); } return null; } }); // negative! throw x; } } }
java
{ "resource": "" }
q19198
PreverifyMojo.execute
train
public void execute() throws MojoExecutionException, MojoFailureException { if(preverifyPath == null) { getLog().debug("skip native preverification"); return; } getLog().debug("start native preverification"); final File preverifyCmd= getAbsolutePreverifyCommand(); StreamConsumer stdoutLogger= new LogWriter(false); StreamConsumer stderrLogger= new LogWriter(true); String classPath = getClassPath(getProject()); AbstractConfiguration[] configurations= (AbstractConfiguration[]) getPluginContext().get(ConfiguratorMojo.GENERATED_CONFIGURATIONS_KEY); for(AbstractConfiguration configuration : configurations) { if(!(configuration instanceof NodeConfiguration)) { continue; } String classifier= configuration.className.substring(configuration.className.lastIndexOf('.') + 1); File oldJar= checkJarFile(classifier); if(keepJars) { try { FileUtils.copyFile(oldJar, getJarFile(classifier + "-before_preverify")); } catch (IOException ioe) { getLog().warn("could not keep old jar '" + oldJar.getAbsolutePath() + "'", ioe); } } getLog().info("Preverifying jar: " + FileNameUtil.getAbsolutPath(oldJar)); Commandline commandLine= new Commandline(preverifyCmd.getPath() + " -classpath " + classPath + " -d " + FileNameUtil.getAbsolutPath(oldJar.getParentFile()) + " " + FileNameUtil.getAbsolutPath(oldJar)); getLog().debug(commandLine.toString()); try { if(CommandLineUtils.executeCommandLine(commandLine, stdoutLogger, stderrLogger) != 0) { throw new MojoExecutionException("Preverification failed. Please read the log for details."); } } catch (CommandLineException cle) { throw new MojoExecutionException("could not execute preverify command", cle); } } getLog().debug("finished preverification"); }
java
{ "resource": "" }
q19199
Beans.isDisplayable
train
public static boolean isDisplayable(Class<?> type) { return Enum.class.isAssignableFrom(type) || type == java.net.URL.class || type == java.io.File.class || java.math.BigInteger.class.isAssignableFrom(type) || java.math.BigDecimal.class.isAssignableFrom(type) || java.util.Date.class.isAssignableFrom(type) || java.sql.Date.class.isAssignableFrom(type) || java.sql.Time.class.isAssignableFrom(type) || java.sql.Timestamp.class.isAssignableFrom(type); }
java
{ "resource": "" }