_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q152200
MapConstraints.constrainedSetMultimap
train
public static <K, V> SetMultimap<K, V> constrainedSetMultimap( SetMultimap<K, V> multimap, MapConstraint<? super K, ? super V> constraint) { return new ConstrainedSetMultimap<K, V>(multimap, constraint); }
java
{ "resource": "" }
q152201
MapConstraints.constrainedSortedSetMultimap
train
public static <K, V> SortedSetMultimap<K, V> constrainedSortedSetMultimap( SortedSetMultimap<K, V> multimap, MapConstraint<? super K, ? super V> constraint) { return new ConstrainedSortedSetMultimap<K, V>(multimap, constraint); }
java
{ "resource": "" }
q152202
MapConstraints.constrainedBiMap
train
public static <K, V> BiMap<K, V> constrainedBiMap( BiMap<K, V> map, MapConstraint<? super K, ? super V> constraint) { return new ConstrainedBiMap<K, V>(map, null, constraint); }
java
{ "resource": "" }
q152203
LocalTransactionProxy.release
train
public void release() { IPhynixxManagedConnection<C> con= this.connection; if (connection != null) { this.connection.removeConnectionListener(this); } this.connection = null; // return con; }
java
{ "resource": "" }
q152204
DocumentBuilderImpl.createXML
train
private static Document createXML(String root, boolean useNamespace) { try { org.w3c.dom.Document doc = getDocumentBuilder(null, useNamespace).newDocument(); doc.appendChild(doc.createElement(root)); return new DocumentImpl(doc); } catch (Exception e) { throw new DomException(e); } }
java
{ "resource": "" }
q152205
DocumentBuilderImpl.parseXML
train
@Override public Document parseXML(String string) { try { return loadXML(new ByteArrayInputStream(string.getBytes("UTF-8"))); } catch (UnsupportedEncodingException e) { throw new BugError("JVM with missing support for UTF-8."); } }
java
{ "resource": "" }
q152206
DocumentBuilderImpl.loadXML
train
private static Document loadXML(InputSource source, boolean useNamespace) { try { org.w3c.dom.Document doc = getDocumentBuilder(null, useNamespace).parse(source); return new DocumentImpl(doc); } catch (Exception e) { throw new DomException(e); } finally { close(source); } }
java
{ "resource": "" }
q152207
DocumentBuilderImpl.loadXML
train
private Document loadXML(URL url, boolean useNamespace) { InputStream stream = null; try { stream = url.openConnection().getInputStream(); InputSource source = new InputSource(stream); return useNamespace ? loadXMLNS(source) : loadXML(source); } catch (Exception e) { throw new DomException(e); ...
java
{ "resource": "" }
q152208
DocumentBuilderImpl.loadHTML
train
@Override public Document loadHTML(Reader reader) { return loadHTML(reader, Charset.defaultCharset().name()); }
java
{ "resource": "" }
q152209
DocumentBuilderImpl.loadHTML
train
private static Document loadHTML(InputSource source, boolean useNamespace) throws SAXException, IOException { DOMParser parser = new DOMParser(); // source http://nekohtml.sourceforge.net/faq.html#hierarchy parser.setFeature(FEAT_NAMESPACES, useNamespace); parser.parse(source); return new DocumentImpl(pa...
java
{ "resource": "" }
q152210
DocumentBuilderImpl.loadHTML
train
private static Document loadHTML(URL url, boolean useNamespace) { InputStream stream = null; try { stream = url.openConnection().getInputStream(); return loadHTML(new InputSource(stream), useNamespace); } catch (Exception e) { throw new DomException(e); } finally { close(stream); } }
java
{ "resource": "" }
q152211
DocumentBuilderImpl.getDocumentBuilder
train
private static javax.xml.parsers.DocumentBuilder getDocumentBuilder(Schema schema, boolean useNamespace) throws ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setIgnoringComments(true); dbf.setIgnoringElementContentWhitespace(true); dbf.setCoalescing(tr...
java
{ "resource": "" }
q152212
SerializableRequestDispatcher.readObject
train
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { // this should set servlet... in.defaultReadObject(); try { init(); } catch(ServletException e) { // This could happen if it is deserialized in // a container where the name or path does not // exist. I ca...
java
{ "resource": "" }
q152213
POSTrainer.loadDataset
train
protected Dataset<Sequence> loadDataset() throws Exception { return Dataset.sequence() .type(DatasetType.InMemory) .source( Corpus.builder() .source(corpus) .format(corpusFormat) ...
java
{ "resource": "" }
q152214
UpperCaseRomanNumbering.format
train
@Override public String format(int index) { StringBuilder sb = new StringBuilder(); final RomanNumeral[] values = RomanNumeral.values(); for(int i = values.length - 1; i >= 0; i--) { while(index >= values[i].weight) { sb.append(values[i]); index -= values[i].weight; ...
java
{ "resource": "" }
q152215
IndentedConfigReaderMapping.reportError
train
private static void reportError(List messages, String fileName, int lineNr, String line, String errorMessage) { messages.add(new Date() + " ERROR in \"" + fileName + "\" at line " + lineNr + ':'); messages.add(errorMessage); }
java
{ "resource": "" }
q152216
ZipArchive.addFile
train
public void addFile(String zipEntry, InputStream input) throws IOException { if(input != null) { stream.putNextEntry(new ZipEntry(zipEntry)); Streams.copy(input, stream); } }
java
{ "resource": "" }
q152217
ZipArchive.addFile
train
public void addFile(String zipEntry, byte[] data) throws IOException { stream.putNextEntry(new ZipEntry(zipEntry)); stream.write(data); }
java
{ "resource": "" }
q152218
ZipArchive.addFile
train
public void addFile(String zipEntry, ByteArrayOutputStream baos) throws IOException { addFile(zipEntry, baos.toByteArray()); }
java
{ "resource": "" }
q152219
ZipArchive.addFile
train
public void addFile(String zipEntry, File file) throws IOException { String zipEntryName = Strings.isValid(zipEntry) ? zipEntry : file.getName(); logger.debug("adding '{}' as '{}'", file.getName(), zipEntryName); try(InputStream input = new FileInputStream(file)) { addFile(zipEntryName, input); } }
java
{ "resource": "" }
q152220
ZipArchive.addFile
train
public void addFile(String zipEntry, String filename) throws IOException { addFile(zipEntry, new File(filename)); }
java
{ "resource": "" }
q152221
Bytes.append
train
public static byte[] append(byte[] a, byte[] b) { byte[] z = new byte[a.length + b.length]; System.arraycopy(a, 0, z, 0, a.length); System.arraycopy(b, 0, z, a.length, b.length); return z; }
java
{ "resource": "" }
q152222
Bytes.toLong
train
public static long toLong(byte[] b) { return ((((long) b[7]) & 0xFF) + ((((long) b[6]) & 0xFF) << 8) + ((((long) b[5]) & 0xFF) << 16) + ((((long) b[4]) & 0xFF) << 24) + ((((long) b[3]) & 0xFF) << 32) + ((((long) b[2]) & 0xFF) << 40)...
java
{ "resource": "" }
q152223
Bytes.areEqual
train
public static boolean areEqual(byte[] a, byte[] b) { int aLength = a.length; if (aLength != b.length) { return false; } for (int i = 0; i < aLength; i++) { if (a[i] != b[i]) { return false; } } return true; }
java
{ "resource": "" }
q152224
BufferUtil.allocateAndReadAll
train
public static ByteBuffer allocateAndReadAll(int size, ReadableByteChannel channel) throws IOException { ByteBuffer buf = ByteBuffer.allocate(size); int justRead; int totalRead = 0; // FIXME, this will be a tight loop if the channel is non-blocking... while(totalRead < size) { logger.debug("reading tota...
java
{ "resource": "" }
q152225
BufferUtil.slice
train
public static ByteBuffer slice(ByteBuffer buf, int off, int len) { ByteBuffer localBuf=buf.duplicate(); // so we don't mess up the position,etc logger.debug("off={} len={}", off, len); localBuf.position(off); localBuf.limit(off+len); logger.debug("pre-slice: localBuf.position()={} localBuf.limit()={}", local...
java
{ "resource": "" }
q152226
MnoPropertiesHelper.readEnvironment
train
public static String readEnvironment(String environmentName) throws MnoConfigurationException { String property = System.getenv(environmentName); if (isNullOrEmpty(property)) { throw new MnoConfigurationException("Could not environment variable: " + environmentName); } return property; }
java
{ "resource": "" }
q152227
MnoPropertiesHelper.readEnvironment
train
public static String readEnvironment(String environmentName, String defaultValue) { String property = System.getenv(environmentName); if (isNullOrEmpty(property)) { return defaultValue; } return property; }
java
{ "resource": "" }
q152228
DaseinSequencer.create
train
private void create(Connection conn) throws SQLException { logger.debug("enter - create()"); try { PreparedStatement stmt = null; ResultSet rs = null; try { stmt = conn.prepareStatement(CREATE_SEQ); stmt.setString(INS_NAME,...
java
{ "resource": "" }
q152229
DaseinSequencer.reseed
train
private void reseed(Connection conn) throws SQLException { logger.debug("enter - reseed()"); try { PreparedStatement stmt = null; ResultSet rs = null; try { // Keep in this loop as long as we encounter concurrency errors do...
java
{ "resource": "" }
q152230
SpringServletContainer.initResourceConfig
train
protected void initResourceConfig(WebConfig webConfig) throws ServletException { try { Field field = ServletContainer.class.getDeclaredField("resourceConfig"); field.setAccessible(true); field.set(this, createResourceConfig(webConfig)); } ...
java
{ "resource": "" }
q152231
SpringServletContainer.createResourceConfig
train
protected ResourceConfig createResourceConfig(WebConfig webConfig) throws BeansException { return WebApplicationContextUtils.getWebApplicationContext(webConfig.getServletContext()) .getBean(webConfig.getServletConfig().getInitParameter(REST_APPLICATION), ResourceConfig.class); }
java
{ "resource": "" }
q152232
DataLoggerRespository.closeLogger
train
public void closeLogger(String loggerName) { if (this.openLoggers.containsKey(loggerName)) { try { this.openLoggers.get(loggerName).close(); } catch (Exception e) { throw new DelegatedRuntimeException(e); } this.openLoggers.remove(l...
java
{ "resource": "" }
q152233
DataLoggerRespository.close
train
public synchronized void close() { Map<String, IDataLogger> copiedLoggers = new HashMap<String, IDataLogger>(this.openLoggers); for (IDataLogger dataLogger : copiedLoggers.values()) { try { dataLogger.close(); } catch (Exception e) { } } this.openLo...
java
{ "resource": "" }
q152234
SmileIOUtil.newPipe
train
public static Pipe newPipe(byte[] data, int offset, int length, boolean numeric) throws IOException { final IOContext context = new IOContext(DEFAULT_SMILE_FACTORY._getBufferRecycler(), data, false); final SmileParser parser = newSmileParser(null, data, offset, offset+length, f...
java
{ "resource": "" }
q152235
RpcClient.invoke
train
@Override public Object invoke(final Invocation invocation) throws Exception { if (invocation == null) throw new NullPointerException("invocation"); MethodDescriptor<?, ?> method = invocation.getMethod(); DataTypeDescriptor<?> resultd = (DataTypeDescriptor<?>) method.getResult(); MessageDescriptor<? extends M...
java
{ "resource": "" }
q152236
ShallowEtagHeaderFilter.generateETagHeaderValue
train
protected String generateETagHeaderValue(byte[] bytes) { StringBuilder builder = new StringBuilder("\"0"); DigestUtils.appendMd5DigestAsHex(bytes, builder); builder.append('"'); return builder.toString(); }
java
{ "resource": "" }
q152237
ModuleModel.getAllClassDependencies
train
public Set<ClassModel> getAllClassDependencies() { HashSet<ClassModel> result = new HashSet<>(); for (ModuleModel module : allModuleDependencies) { for (ClassModel clazz : module.classes) { ClassModel.getAllClassDependencies(result, clazz); } } return result; }
java
{ "resource": "" }
q152238
FilteringIterator.list
train
List<? extends E> list() { List<E> result = new ArrayList<E>(); while (hasNext()) { result.add(next()); } return result; }
java
{ "resource": "" }
q152239
XRemotingProxyFactory.create
train
public Object create(Class<?> iface, ClassLoader proxyLoader) { return create(new Class[]{iface}, proxyLoader); }
java
{ "resource": "" }
q152240
XRemotingProxyFactory.create
train
public Object create(Class<?>[] ifaces, ClassLoader proxyLoader) { return Proxy.newProxyInstance(proxyLoader, ifaces, new XRemotingInvocationHandler(serializer, requester)); }
java
{ "resource": "" }
q152241
RepositoryResolver.determinateLocalIP
train
private String determinateLocalIP() throws IOException { Socket socket = null; try { URL url = new URL(defaultRepositoryUrl); int port = url.getPort() > -1 ? url.getPort() : url.getDefaultPort(); log.debug("Determinating local IP-Adress by connect to {}:{}", defaultRepositoryUrl, port); InetAddress ad...
java
{ "resource": "" }
q152242
RuntimeSchema.resolvePipeSchema
train
@SuppressWarnings("unchecked") static <T> Pipe.Schema<T> resolvePipeSchema(Schema<T> schema, Class<? super T> clazz, boolean throwIfNone) { if(Message.class.isAssignableFrom(clazz)) { try { // use the pipe schema of code-generated mess...
java
{ "resource": "" }
q152243
Multipart.attachFile
train
public static OAuthRequest attachFile(File file, OAuthRequest request) throws IOException { String boundary = generateBoundaryString(); request.addHeader("Content-Type", "multipart/form-data; boundary=" + boundary); request.addBodyParameter("file", file.getName()); StringBuilder boundar...
java
{ "resource": "" }
q152244
ResultSetIterator.next
train
@Override public E next() throws NoSuchElementException { if(!more) throw new NoSuchElementException("No more rows to return"); try { E ret = converter.resultSetIteratorRow2Obj(rs); advance(); return ret; } catch(NoSuchElementException e) { throw e; } catch(SQLException e) { throw ...
java
{ "resource": "" }
q152245
SubmitterSubmissionsFilter.omit
train
public List<ISubmission> omit(List<ISubmission> submissions, ISubmitter submitter){ ArrayList<ISubmission> filteredSubmissions = new ArrayList<ISubmission>(); for (ISubmission submission: submissions){ if (!submission.getSubmitter().equals(submitter)){ filteredSubmissions.add(submission); } } ...
java
{ "resource": "" }
q152246
SubmitterSubmissionsFilter.include
train
public List<ISubmission> include(List<ISubmission> submissions, List<String> submitters){ ArrayList<ISubmission> filteredSubmissions = new ArrayList<ISubmission>(); for (ISubmission submission: submissions){ if (submission.getSubmitter() != null){ if (submitters.contains(submission.getSubmitter().getSubmitte...
java
{ "resource": "" }
q152247
ImmutableSortedMap.of
train
private static <K, V> ImmutableSortedMap<K, V> of(Comparator<? super K> comparator, K k1, V v1) { return new RegularImmutableSortedMap<K, V>( new RegularImmutableSortedSet<K>(ImmutableList.of(k1), checkNotNull(comparator)), ImmutableList.of(v1)); }
java
{ "resource": "" }
q152248
Bag.getString
train
public String getString (String key, Supplier<String> notFound) { Object object = getObject (key); return (object instanceof String) ? (String) object : notFound.get (); }
java
{ "resource": "" }
q152249
Bag.getBagObject
train
public BagObject getBagObject (String key, Supplier<BagObject> notFound) { Object object = getObject (key); return (object instanceof BagObject) ? (BagObject) object : notFound.get (); }
java
{ "resource": "" }
q152250
Bag.getBagArray
train
public BagArray getBagArray (String key, Supplier<BagArray> notFound) { Object object = getObject (key); return (object instanceof BagArray) ? (BagArray) object : notFound.get (); }
java
{ "resource": "" }
q152251
Bag.getBoolean
train
public Boolean getBoolean (String key, Supplier<Boolean> notFound) { return getParsed (key, Boolean::new, notFound); }
java
{ "resource": "" }
q152252
Bag.getLong
train
public Long getLong (String key, Supplier<Long> notFound) { return getParsed (key, Long::new, notFound); }
java
{ "resource": "" }
q152253
Bag.getInteger
train
public Integer getInteger (String key, Supplier<Integer> notFound) { return getParsed (key, Integer::new, notFound); }
java
{ "resource": "" }
q152254
Bag.getDouble
train
public Double getDouble (String key, Supplier<Double> notFound) { return getParsed (key, Double::new, notFound); }
java
{ "resource": "" }
q152255
Bag.getFloat
train
public Float getFloat (String key, Supplier<Float> notFound) { return getParsed (key, Float::new, notFound); }
java
{ "resource": "" }
q152256
HttpWorkerAbstract.execute
train
public void execute() throws HibiscusException { prepare(); httpRequest.addHeader("User-Agent", getClass().getName().toUpperCase()); httpRequest.addHeader("X-Conversation-Id", HashGenerator.getMD5Hash(System.currentTimeMillis() + "." + new Thread().getId())); // Creates a registry for...
java
{ "resource": "" }
q152257
HttpWorkerAbstract.getWorkerStrategy
train
public static HttpWorkerAbstract getWorkerStrategy(final String requestMethod, final HttpClient client) { if (requestMethod.equals(HEAD)) { return new HttpWorkerHead(client); } else if (requestMethod.equals(GET)) { return new HttpWorkerGet(client); } else if (requestMeth...
java
{ "resource": "" }
q152258
FileId.getInstance
train
static public FileId getInstance(String id) throws DaoManagerException { if (id!=null && FileConnector.exists(id)){ return new FileId(id,null); } else { return null; } }
java
{ "resource": "" }
q152259
Invocation.toChain
train
public List<Invocation> toChain() { List<Invocation> chain = parent == null ? new ArrayList<Invocation>() : parent.toChain(); chain.add(this); return chain; }
java
{ "resource": "" }
q152260
Invocation.invoke
train
@SuppressWarnings("unchecked") public Object invoke(Object object) throws Exception { if (object == null) throw new NullPointerException("object"); for (Invocation invocation : toChain()) { MethodDescriptor<Object, Object> unchecked = (MethodDescriptor<Object, Object>) invocation.method; object = unche...
java
{ "resource": "" }
q152261
Request.addQueryParameter
train
public Request addQueryParameter(final String name, final String value) { this.query.put(name, value); return this; }
java
{ "resource": "" }
q152262
Request.writeResource
train
private Response writeResource(final String method, final String body) throws IOException { buildQueryString(); buildHeaders(); connection.setDoOutput(true); connection.setRequestMethod(method); writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(body); writer.close(); return ...
java
{ "resource": "" }
q152263
Request.buildQueryString
train
private void buildQueryString() throws MalformedURLException { StringBuilder builder = new StringBuilder(); // Put the query parameters on the URL before issuing the request if (!query.isEmpty()) { for (Map.Entry<String, String> param : query.entrySet()) { builder.append(param.getKey()); builder.appen...
java
{ "resource": "" }
q152264
Request.buildHeaders
train
private void buildHeaders() { if (!headers.isEmpty()) { for (Map.Entry<String, List<String>> entry : headers.entrySet()) { List<String> values = entry.getValue(); for (String value : values) { connection.addRequestProperty(entry.getKey(), value); } } } }
java
{ "resource": "" }
q152265
SimpleXmlUtils.tagToQName
train
public static QName tagToQName(final String tag, final Map<String, String> nsRegistry) { final String[] split = tag.split("\\:"); if (split.length <= 1) { return new QName(split[0]); } else { final String namespace = nsRegistry.get(split[0]); if (namespace != null) { return new QName(namespace, ...
java
{ "resource": "" }
q152266
HowlLogger.write
train
public long write(short type, byte[][] data) throws InterruptedException, IOException { try { return super.put(type, data, true); } catch (InterruptedException e) { throw e; } catch (IOException e) { throw e; } catch (Throwable e) { ...
java
{ "resource": "" }
q152267
OptionUtil.getThreadNumber
train
public int getThreadNumber() { if (cli.hasOption(THREAD_NUMBER)) { return Integer.valueOf(cli.getOptionValue(THREAD_NUMBER)); } return DEFAULT_THREAD_NUMBER; }
java
{ "resource": "" }
q152268
OptionUtil.getSplitSize
train
public long getSplitSize() { if (cli.hasOption(SPLIT_SIZE)) { return Long.valueOf(cli.getOptionValue(SPLIT_SIZE)); } return DEFAULT_SPLIT_SIZE; }
java
{ "resource": "" }
q152269
PropertyProducer.produceSystemProperty
train
@Produces @Property(value="") public String produceSystemProperty(InjectionPoint ip) { Property annotation = ip.getAnnotated().getAnnotation(Property.class); String propertyKey = annotation.value(); String defaultValue = annotation.defaultValue(); // return empty when the key is null or empty // this ...
java
{ "resource": "" }
q152270
EmailMessage.addBcc
train
public void addBcc(final Address internetAddress) throws MessagingException { super.addRecipient(javax.mail.Message.RecipientType.BCC, internetAddress); }
java
{ "resource": "" }
q152271
EmailMessage.addCc
train
public void addCc(final Address internetAddress) throws MessagingException { super.addRecipient(javax.mail.Message.RecipientType.CC, internetAddress); }
java
{ "resource": "" }
q152272
EmailMessage.addTo
train
public void addTo(final Address internetAddress) throws MessagingException { super.addRecipient(javax.mail.Message.RecipientType.TO, internetAddress); }
java
{ "resource": "" }
q152273
EmailMessage.setContent
train
@Override public void setContent(final Object content, final String type) throws MessagingException { charset = EmailExtensions.getCharsetFromContentType(type); super.setContent(content, type); }
java
{ "resource": "" }
q152274
EmailMessage.setFrom
train
public void setFrom(final String senderEmail) throws AddressException, UnsupportedEncodingException, MessagingException { final Address fromEmail = EmailExtensions.newAddress(senderEmail); super.setFrom(fromEmail); }
java
{ "resource": "" }
q152275
EmailMessage.setUtf8Content
train
public void setUtf8Content(final Object content) throws MessagingException { final String type = EmailConstants.MIMETYPE_TEXT_PLAIN + EmailConstants.CHARSET_PREFIX + EmailConstants.CHARSET_UTF8; setContent(content, type); }
java
{ "resource": "" }
q152276
Display.show
train
public static String show(String s) { StringBuilder builder = new StringBuilder(); if (s != null) { for (char ch : s.toCharArray()) { addCharacter(builder, ch); } } return builder.toString(); }
java
{ "resource": "" }
q152277
Display.displayParts
train
public static String displayParts(Object... parts) { StringBuilder builder = new StringBuilder("["); boolean first = true; for (Object part : parts) { if (first) { first = false; } else { builder.append('|'); } if (p...
java
{ "resource": "" }
q152278
Display.displayWithTypes
train
public static String displayWithTypes(Object object) { StringBuilder builder = new StringBuilder(); displayRecursive(object, builder, new Stack<>(), true); return builder.toString(); }
java
{ "resource": "" }
q152279
Display.display
train
public static String display(Object object) { StringBuilder builder = new StringBuilder(); displayRecursive(object, builder, new Stack<>(), false); return builder.toString(); }
java
{ "resource": "" }
q152280
Display.display
train
public static String display(Object first, Object second, Object... remainder) { Object[] array = new Object[remainder.length + 2]; array[0] = first; array[1] = second; System.arraycopy(remainder, 0, array, 2, remainder.length); return display(array); }
java
{ "resource": "" }
q152281
RDS.authorizeClassicDbSecurityGroup
train
private void authorizeClassicDbSecurityGroup(String groupName, String sourceCidr) throws CloudException, InternalException { Map<String,String> parameters = getProvider().getStandardRdsParameters(getProvider().getContext(), AUTHORIZE_DB_SECURITY_GROUP_INGRESS); parameters.put("DBSecurityGroupName", grou...
java
{ "resource": "" }
q152282
RDS.revokeClassicDbSecurityGroup
train
private void revokeClassicDbSecurityGroup(String groupName, String sourceCidr) throws CloudException, InternalException { Map<String,String> parameters = getProvider().getStandardRdsParameters(getProvider().getContext(), REVOKE_DB_SECURITY_GROUP_INGRESS); parameters.put("CIDRIP", sourceCidr); p...
java
{ "resource": "" }
q152283
PluginProtoCompiler.getFileExtension
train
public static String getFileExtension(String resource) { // E.g uf foo.bar.java.stg, it is the . before "java" int secondToTheLastDot = resource.lastIndexOf('.', resource.length()-5); if(secondToTheLastDot == -1) { throw new IllegalArgumentException("The resource m...
java
{ "resource": "" }
q152284
MessageDigestUtils.createHashes
train
public static int[] createHashes(byte[] data, int hashes) { int[] result = new int[hashes]; int k = 0; byte salt = 0; while (k < hashes) { byte[] digest; synchronized (messageDigest) { messageDigest.update(salt); salt++; ...
java
{ "resource": "" }
q152285
ConfigurableDataSourceFactory.decryptPassword
train
protected Properties decryptPassword(final Properties properties) { String password = properties.getProperty("password"); properties.put("password", AESUtil.decrypt(password, AESUtil.DEFAULT_KEY)); return properties; }
java
{ "resource": "" }
q152286
Arrays2.asList
train
@SuppressWarnings("unchecked") public static <T, I> List<T> asList(I... target) { return (List<T>) Arrays.asList(asArray(target)); }
java
{ "resource": "" }
q152287
Arrays2.unwraps
train
public static <T> Object unwraps(T[] target) { return new StructBehavior<Object>(target) { @Override protected Object booleanIf() { return unwrap((Boolean[]) this.delegate); } @Override protected Object byteIf() { return unwrap((Byte[]) this.delegate); } @Override protected Object characterIf() { return unw...
java
{ "resource": "" }
q152288
Arrays2.add
train
static Object add(Object array, int index, Object element, Class<?> clss) { if (array == null) { if (index != 0) { throw new IndexOutOfBoundsException("Index: " + index + ", Length: 0"); } Object joinedArray = Array.newInstance(clss, 1); Array.set(...
java
{ "resource": "" }
q152289
Arrays2.remove
train
public static Object remove(Object array, int index) { int length = length(array); if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length); } Object result = Array.newInstance(array.getClass().getComponentType(), len...
java
{ "resource": "" }
q152290
JCAResourceMBeanImpl.setConnectionFactoryChild
train
protected JCAConnectionFactoryMBeanImpl setConnectionFactoryChild(String key, JCAConnectionFactoryMBeanImpl cf) { return cfMBeanChildrenList.put(key, cf); }
java
{ "resource": "" }
q152291
ConfigFile.getAppConfigurationEntry
train
AppConfigurationEntry[] getAppConfigurationEntry(String config) { Vector entry = null; if ((_fileMap != null) && (_fileMap.size() != 0)) { entry = (Vector) _fileMap.get(config); } if (entry == null || entry.size() == 0) { return null; } ...
java
{ "resource": "" }
q152292
Collector.validateTags
train
private static void validateTags(String[] tagList, ArrayList<String> validList, ArrayList<String> invalidList) { for (String tag : tagList) { tag = tag.trim(); if (tag.contains("\\") || tag.contains(" ") || tag.contains("\n") || tag.contains("-") || tag.equals("")) { inva...
java
{ "resource": "" }
q152293
Collector.init
train
@Override public void init(CollectorManager collectorManager) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Subscribing to sources " + this, taskMap.keySet()); } try { this.collectorMgr = collectorManager; //Get the sou...
java
{ "resource": "" }
q152294
AbstractJSPExtensionServletWrapper.isAvailable
train
public boolean isAvailable() { boolean available = false; String relativeURL = inputSource.getRelativeURL(); Container container = tcontext.getServletContext().getModuleContainer(); if (container!=null) { if (options.isDisableJspRuntimeCompilation() == false) { ...
java
{ "resource": "" }
q152295
HttpFactoryConfig.parseMsgSize
train
private void parseMsgSize(Map<Object, Object> props) { String value = (String) props.get(HttpConfigConstants.PROPNAME_MSG_SIZE_LIMIT); if (null != value) { try { this.msgSizeLimit = Long.parseLong(value); if (HttpConfigConstants.UNLIMITED > getMessageSize()) {...
java
{ "resource": "" }
q152296
HttpFactoryConfig.parseMsgLargeBuffer
train
private void parseMsgLargeBuffer(Map<Object, Object> props) { if (!areMessagesLimited()) { // if there isn't a standard size limit, ignore this extension to // that config option return; } String value = (String) props.get(HttpConfigConstants.PROPNAME_MSG_SIZE...
java
{ "resource": "" }
q152297
EJBObjectInfo.addFieldInfo
train
void addFieldInfo(String className, List<FieldInfo> fieldInfoList) { if (ivFieldInfoMap == null) { ivFieldInfoMap = new HashMap<String, List<FieldInfo>>(); } ivFieldInfoMap.put(className, fieldInfoList); }
java
{ "resource": "" }
q152298
EmbeddableFailureScopeController.createRecoveryManager
train
@Override public void createRecoveryManager(RecoveryAgent agent, RecoveryLog tranLog, RecoveryLog xaLog, RecoveryLog recoverXaLog, byte[] defaultApplId, int defaultEpoch) { if (tc.isEntryEnabled()) Tr.entry(tc, "createRecoveryManager", new Object[] { this, agent, tranLog, xaLog, recoverXaLog, de...
java
{ "resource": "" }
q152299
AbstractProtoRealization.setToBeDeleted
train
public void setToBeDeleted() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setToBeDeleted"); // Tell the remote code the destination is to be deleted if (_remoteSupport != null) _remoteSupport.setToBeDeleted(); if (TraceComponent.isAnyTracin...
java
{ "resource": "" }