id
stringlengths
7
14
text
stringlengths
1
37.2k
13899_11
public static String readString(InputStream in, String charset) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); int c; while ((c = in.read()) > 0) { out.write(c); } return new String(out.toByteArray(), charset); }
32578_0
public List<LabelValue> getAllRoles() { List<Role> roles = dao.getRoles(); List<LabelValue> list = new ArrayList<LabelValue>(); for (Role role1 : roles) { list.add(new LabelValue(role1.getName(), role1.getName())); } return list; }
56670_0
protected String getPackage() { return pkg; }
56904_58
public List<U> get() { if (this.loaded == null) { if (this.parent.isNew() || UnitTesting.isEnabled()) { // parent is brand new, so don't bother hitting the database this.loaded = new ArrayList<U>(); } else { if (!UoW.isOpen()) { throw new DisconnectedException(); } if (!EagerLoading.isEnabled()) { // fetch only the children for this parent from the db Select<U> q = Select.from(this.childAlias); q.where(this.childForeignKeyToParentColumn.eq(this.parent)); q.orderBy(this.childAlias.getIdColumn().asc()); q.limit(UoW.getIdentityMap().getCurrentSizeLimit()); this.loaded = q.list(); } else { // preemptively fetch all children for all parents from the db MapToList<Long, U> byParentId = UoW.getEagerCache().get(this.childForeignKeyToParentColumn); if (!byParentId.containsKey(this.parent.getId())) { Collection<Long> idsToLoad = UoW.getEagerCache().getIdsToLoad(this.parent, this.childForeignKeyToParentColumn); if (!idsToLoad.contains(this.parent.getId())) { throw new IllegalStateException("Instance has been disconnected from the UoW: " + this.parent); } this.eagerlyLoad(byParentId, idsToLoad); } this.loaded = new ArrayList<U>(); this.loaded.addAll(byParentId.get(this.parent.getId())); } } if (this.addedBeforeLoaded.size() > 0 || this.removedBeforeLoaded.size() > 0) { // apply back any adds/removes that we'd been holding off on this.loaded.addAll(this.addedBeforeLoaded); this.loaded.removeAll(this.removedBeforeLoaded); this.loaded = Copy.unique(this.loaded); } this.proxy = new ListProxy<U>(this.loaded, this.listDelegate); } return this.proxy; }
74217_5
public List<Class<?>> scan(List<String> packages) { List<Class<?>> classes = new ArrayList<Class<?>>(); for (String packageName : packages) { for (Class clazz : findClassesInPackage(packageName)) { if (hasRecordAnnoation(clazz)) classes.add(clazz); } } return classes; }
88960_47
public String format(JSLintResult result) { StringBuilder sb = new StringBuilder(); for (Issue issue : result.getIssues()) { sb.append(outputOneIssue(issue)); } return sb.toString(); }
97620_0
public String get() { return this.fullClassNameWithGenerics; }
103035_6
public static boolean unregisterMBean(ObjectName oName) { boolean unregistered = false; if (null != oName) { try { if (mbs.isRegistered(oName)) { log.debug("Mbean is registered"); mbs.unregisterMBean(oName); //set flag based on registration status unregistered = !mbs.isRegistered(oName); } else { log.debug("Mbean is not currently registered"); } } catch (Exception e) { log.warn("Exception unregistering mbean {}", e); } } log.debug("leaving unregisterMBean..."); return unregistered; }
116547_7
@Override public void load_code_file(String classFile) throws Throwable { Class<?> clazz = loadClass(classFile); addClass(clazz); }
121672_32
public Fields appendSelector( Fields fields ) { return appendInternal( fields, true ); }
123235_12
public static KeyPair recoverKeyPair(byte[] encoded) throws NoSuchAlgorithmException, InvalidKeySpecException { final String algo = getAlgorithmForOid(getOidFromPkcs8Encoded(encoded)); final KeySpec privKeySpec = new PKCS8EncodedKeySpec(encoded); final KeyFactory kf = KeyFactory.getInstance(algo); final PrivateKey priv = kf.generatePrivate(privKeySpec); return new KeyPair(recoverPublicKey(kf, priv), priv); }
135867_7
@SuppressWarnings("unchecked") public ModelAndView logIn(HttpServletRequest request, HttpServletResponse response, LoginCommand login, BindException errors) throws Exception { // Checking whether logged in ApplicationState state = getApplicationState(request); LOG.debug("logIn() state=" + state); if (state.getCurrentUser() != null) { return redirectAfterLogin(request, response); } if (!errors.hasErrors()) { User user = authenticate(login.getUsername(), login.getPassword(), errors); if (user != null) { state.setCurrentUser(user); if (login.isAutoLogin()) { // set autoLogin setAutoLoginCookie(response, user.getToken()); } setSingleLoginCookie(response, user.getToken()); String prevAction = state.getPreviousAction(); LOG.debug("logIn() prevAction=" + prevAction); if (prevAction == null) { return redirectAfterLogin(request, response); } else { state.setPreviousAction(null); return new ModelAndView(new RedirectView(prevAction)); } } } Map model = errors.getModel(); model.put("login", login); BPMS_DESCRIPTOR_PARSER.addBpmsBuildVersionsPropertiesToMap(model); return new ModelAndView(Constants.LOGIN_VIEW, model); }
149511_10
public boolean isUnderRevisionControl() { return true; }
152134_28
public User findByUsername(String username) { Query query = em.createNamedQuery("findUserByUsername"); query.setParameter("username", username); return (User) query.getSingleResult(); }
152812_18
@Nonnull public static MemcachedNodesManager createFor(final String memcachedNodes, final String failoverNodes, final StorageKeyFormat storageKeyFormat, final StorageClientCallback storageClientCallback) { if ( memcachedNodes == null || memcachedNodes.trim().isEmpty() ) { throw new IllegalArgumentException("null or empty memcachedNodes not allowed."); } // Support a Redis URL in the form "redis://hostname:port" or "rediss://" (for SSL connections) like the client "Lettuce" does if (memcachedNodes.startsWith("redis://") || memcachedNodes.startsWith("rediss://")) { // Redis configuration return new MemcachedNodesManager(memcachedNodes, new NodeIdList(), new ArrayList<String>(), new LinkedHashMap<InetSocketAddress, String>(), storageKeyFormat, storageClientCallback); } if ( !NODES_PATTERN.matcher( memcachedNodes ).matches() && !SINGLE_NODE_PATTERN.matcher(memcachedNodes).matches() && !COUCHBASE_BUCKET_NODES_PATTERN.matcher(memcachedNodes).matches()) { throw new IllegalArgumentException( "Configured memcachedNodes attribute has wrong format, must match " + NODES_REGEX ); } final Matcher singleNodeMatcher = SINGLE_NODE_PATTERN.matcher(memcachedNodes); // we have a linked hashmap to have insertion order for addresses final LinkedHashMap<InetSocketAddress, String> address2Ids = new LinkedHashMap<InetSocketAddress, String>(1); /** * If mutliple nodes are configured */ if (singleNodeMatcher.matches()) { // for single address2Ids.put(getSingleShortNodeDefinition(singleNodeMatcher), null); } else if (COUCHBASE_BUCKET_NODES_PATTERN.matcher(memcachedNodes).matches()) { // for couchbase final Matcher matcher = COUCHBASE_BUCKET_NODE_PATTERN.matcher(memcachedNodes); while (matcher.find()) { final String hostname = matcher.group( 1 ); final int port = Integer.parseInt( matcher.group( 2 ) ); address2Ids.put(new InetSocketAddress( hostname, port ), null); } if (address2Ids.isEmpty()) { throw new IllegalArgumentException("All nodes are also configured as failover nodes," + " this is a configuration failure. In this case, you probably want to leave out the failoverNodes."); } } else { // If mutliple nodes are configured final Matcher matcher = NODE_PATTERN.matcher( memcachedNodes); while (matcher.find()) { final Pair<String, InetSocketAddress> nodeInfo = getRegularNodeDefinition(matcher); address2Ids.put(nodeInfo.getSecond(), nodeInfo.getFirst()); } if (address2Ids.isEmpty()) { throw new IllegalArgumentException("All nodes are also configured as failover nodes," + " this is a configuration failure. In this case, you probably want to leave out the failoverNodes."); } } final List<String> failoverNodeIds = initFailoverNodes(failoverNodes, address2Ids.values()); // validate that for a single node there's no failover node specified as this does not make sense. if(address2Ids.size() == 1 && failoverNodeIds.size() >= 1) { throw new IllegalArgumentException("For a single memcached node there should/must no failoverNodes be specified."); } final NodeIdList primaryNodeIds = new NodeIdList(); for(final Map.Entry<InetSocketAddress, String> address2Id : address2Ids.entrySet()) { final String nodeId = address2Id.getValue(); if (nodeId != null && !failoverNodeIds.contains(nodeId) ) { primaryNodeIds.add(nodeId); } } return new MemcachedNodesManager(memcachedNodes, primaryNodeIds, failoverNodeIds, address2Ids, storageKeyFormat, storageClientCallback); }
160996_95
public void transportMessage( Who recipient, Message msg ) throws Exception { if (msg.getMessageId() != null) throw new IllegalStateException( "message has already been sent" ); msg.setMessageId( idGen.next() ); //Log.report( "MailboxManager.send", "msg", msg ); transport.transportMessage( recipient, msg ); }
160999_86
public File create(String path) { File file = new File(path); return validate(file); }
161005_337
public String toString() { return "(\"" + this.getClass().getName() + "\",\"" + m_wiki + "\",\"" + getActions() + "\")"; }
161180_0
public static final byte[] toBytes(int i){ if(i < INT_N_65535 || i > INT_P_65535) { return Integer.toString(i).getBytes(); } final int absi = Math.abs(i); final byte[] cachedData = i2b_65535[absi]; final byte[] data; if(cachedData == null) { data = Integer.toString(absi).getBytes(); i2b_65535[absi] = data; } else { data = cachedData; } return i >= 0 ? data : getNegativeNumberBytes(data); }
168535_2
public Entry getPrevious() { Entry previous = null; for (Entry entry : entryDao.readAll()) { if (entry.getId().equals(current.getId()) && previous != null) { return previous; } previous = entry; } return null; }
169928_3
public int sizeOfToDoList() { return toDoList.size(); }
175376_3
Expr parseYieldExpr() { return new Expr.Yield(parseOptionalTestList()); }
184604_0
public static int count(String text) { return text.length(); }
200121_6
@Override public InputStream getInputStream() { try { URL url = new URL(path); return url.openStream(); } catch (MalformedURLException ex) { throw new ConstrettoException("Could not load URL. Path tried: [" + path + "]", ex); } catch (IOException e) { throw new ConstrettoException("Woot", e); } }
206318_8
protected static void writeChunksToStream(byte[] data, byte[] dataHeader, int lengthOffset, int maxChunkLength, OutputStream os) throws IOException { int dataLength = data.length; int numFullChunks = dataLength / maxChunkLength; int lastChunkLength = dataLength % maxChunkLength; int headerLen = dataHeader.length - lengthOffset; // length field is just before data so do not include in data length if (headerLen == 2) { headerLen = 0; } byte[] len; int off = 0; if (numFullChunks > 0) { // write out full data chunks len = BinaryUtils.convert(headerLen + maxChunkLength, 2); dataHeader[lengthOffset] = len[0]; // Length byte 1 dataHeader[lengthOffset + 1] = len[1]; // Length byte 2 for (int i = 0; i < numFullChunks; i++, off += maxChunkLength) { os.write(dataHeader); os.write(data, off, maxChunkLength); } } if (lastChunkLength > 0) { // write last data chunk len = BinaryUtils.convert(headerLen + lastChunkLength, 2); dataHeader[lengthOffset] = len[0]; // Length byte 1 dataHeader[lengthOffset + 1] = len[1]; // Length byte 2 os.write(dataHeader); os.write(data, off, lastChunkLength); } }
206320_1
public RemoveScmResult remove( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { return (RemoveScmResult) execute( repository, fileSet, parameters ); }
206322_31
@Nullable public static String getLineEndingCharacters( @Nullable String lineEnding ) throws AssemblyFormattingException { String value = lineEnding; if ( lineEnding != null ) { try { value = LineEndings.valueOf( lineEnding ).getLineEndingCharacters(); } catch ( IllegalArgumentException e ) { throw new AssemblyFormattingException( "Illegal lineEnding specified: '" + lineEnding + "'", e ); } } return value; }
206350_846
public LifecycleEvent getCallbackType() { return callbackType; }
206364_39
public String toSnakeCase(final String name) { final StringBuilder out = new StringBuilder(name.length() + 3); final boolean isDelimited = name.startsWith(getLeadingDelimiter()) && name.endsWith(getTrailingDelimiter()); final String toConvert; if (isDelimited) { toConvert = name.substring(2, name.length() - 1); out.append(name.substring(0, 2).toLowerCase(ROOT)); } else { toConvert = name.substring(1); out.append(Character.toLowerCase(name.charAt(0))); } for (final char c : toConvert.toCharArray()) { if (!Character.isLetter(c)) { // delimiter out.append(c); } else if (Character.isUpperCase(c)) { out.append('_').append(Character.toLowerCase(c)); } else { out.append(c); } } if (toConvert.length() != name.length() - 1) { out.append(name.charAt(name.length() - 1)); } return out.toString(); }
206402_426
public boolean isResponseCacheable(final String httpMethod, final HttpResponse response) { boolean cacheable = false; if (!HeaderConstants.GET_METHOD.equals(httpMethod) && !HeaderConstants.HEAD_METHOD.equals(httpMethod)) { if (LOG.isDebugEnabled()) { LOG.debug("{} method response is not cacheable", httpMethod); } return false; } final int status = response.getCode(); if (CACHEABLE_STATUS_CODES.contains(status)) { // these response codes MAY be cached cacheable = true; } else if (uncacheableStatusCodes.contains(status)) { if (LOG.isDebugEnabled()) { LOG.debug("{} response is not cacheable", status); } return false; } else if (unknownStatusCode(status)) { // a response with an unknown status code MUST NOT be // cached if (LOG.isDebugEnabled()) { LOG.debug("{} response is unknown", status); } return false; } final Header contentLength = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH); if (contentLength != null) { final long contentLengthValue = Long.parseLong(contentLength.getValue()); if (contentLengthValue > this.maxObjectSizeBytes) { if (LOG.isDebugEnabled()) { LOG.debug("Response content length exceeds {}", this.maxObjectSizeBytes); } return false; } } if (response.countHeaders(HeaderConstants.AGE) > 1) { LOG.debug("Multiple Age headers"); return false; } if (response.countHeaders(HeaderConstants.EXPIRES) > 1) { LOG.debug("Multiple Expires headers"); return false; } if (response.countHeaders(HttpHeaders.DATE) > 1) { LOG.debug("Multiple Date headers"); return false; } final Date date = DateUtils.parseDate(response, HttpHeaders.DATE); if (date == null) { LOG.debug("Invalid / missing Date header"); return false; } final Iterator<HeaderElement> it = MessageSupport.iterate(response, HeaderConstants.VARY); while (it.hasNext()) { final HeaderElement elem = it.next(); if ("*".equals(elem.getName())) { if (LOG.isDebugEnabled()) { LOG.debug("Vary * found"); } return false; } } if (isExplicitlyNonCacheable(response)) { LOG.debug("Response is explicitly non-cacheable"); return false; } return cacheable || isExplicitlyCacheable(response); }
206403_0
void write(Node node, int maxLevels) throws RepositoryException, IOException { write(node, 0, maxLevels); }
206418_92
public void checkoutProject( int projectId, String projectName, File workingDirectory, String scmRootUrl, String scmUsername, String scmPassword, BuildDefinition defaultBuildDefinition, List<Project> subProjects ) throws BuildManagerException { try { if ( isInQueue( projectId, CHECKOUT_QUEUE, -1 ) ) { log.warn( "Project already in checkout queue." ); return; } } catch ( TaskQueueException e ) { throw new BuildManagerException( "Error occurred while checking if the project is already in queue: " + e.getMessage() ); } OverallBuildQueue overallBuildQueue = getOverallBuildQueue( CHECKOUT_QUEUE, defaultBuildDefinition.getSchedule().getBuildQueues() ); CheckOutTask checkoutTask = new CheckOutTask( projectId, workingDirectory, projectName, scmUsername, scmPassword, scmRootUrl, subProjects ); try { if ( overallBuildQueue != null ) { log.info( "Project '" + projectName + "' added to overall build queue '" + overallBuildQueue.getName() + "'." ); overallBuildQueue.addToCheckoutQueue( checkoutTask ); } else { throw new BuildManagerException( "Unable to add project to checkout queue. No overall build queue configured." ); } } catch ( TaskQueueException e ) { throw new BuildManagerException( "Error occurred while adding project to checkout queue: " + e.getMessage() ); } }
206437_62
public byte[] decrypt( EncryptionKey key, EncryptedData data, KeyUsage usage ) throws KerberosException { LOG_KRB.debug( "Decrypting data using key {} and usage {}", key.getKeyType(), usage ); EncryptionEngine engine = getEngine( key ); return engine.getDecryptedData( key, data, usage ); }
206444_108
@Override public void run() { TxnStore.MutexAPI.LockHandle handle = null; try { handle = txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.TxnCleaner.name()); long start = System.currentTimeMillis(); txnHandler.cleanEmptyAbortedAndCommittedTxns(); LOG.debug("Txn cleaner service took: {} seconds.", elapsedSince(start)); } catch (Throwable t) { LOG.error("Unexpected error in thread: {}, message: {}", Thread.currentThread().getName(), t.getMessage(), t); } finally { if (handle != null) { handle.releaseLocks(); } } }
206451_6
@SuppressWarnings("unchecked") public List evaluate(OExpression cexp, EvaluationContext ctx) throws FaultException, EvaluationException { List result; Object someRes = null; try { someRes = evaluate(cexp, ctx, XPathConstants.NODESET); } catch (Exception e) { someRes = evaluate(cexp, ctx, XPathConstants.STRING); } if (someRes instanceof List) { result = (List) someRes; if (__log.isDebugEnabled()) { __log.debug("Returned list of size " + result.size()); } if ((result.size() == 1) && !(result.get(0) instanceof Node)) { // Dealing with a Java class Object simpleType = result.get(0); // Dates get a separate treatment as we don't want to call toString on them String textVal; if (simpleType instanceof Date) { textVal = ISO8601DateParser.format((Date) simpleType); } else if (simpleType instanceof DurationValue) { textVal = ((DurationValue)simpleType).getStringValue(); } else { textVal = simpleType.toString(); } // Wrapping in a document Document document = DOMUtils.newDocument(); // Giving our node a parent just in case it's an LValue expression Element wrapper = document.createElement("wrapper"); Text text = document.createTextNode(textVal); wrapper.appendChild(text); document.appendChild(wrapper); result = Collections.singletonList(text); } } else if (someRes instanceof NodeList) { NodeList retVal = (NodeList) someRes; if (__log.isDebugEnabled()) { __log.debug("Returned node list of size " + retVal.getLength()); } result = new ArrayList(retVal.getLength()); for(int m = 0; m < retVal.getLength(); ++m) { Node val = retVal.item(m); if (val.getNodeType() == Node.DOCUMENT_NODE) { val = ((Document)val).getDocumentElement(); } result.add(val); } } else if (someRes instanceof String) { // Wrapping in a document Document document = DOMUtils.newDocument(); Element wrapper = document.createElement("wrapper"); Text text = document.createTextNode((String) someRes); wrapper.appendChild(text); document.appendChild(wrapper); result = Collections.singletonList(text); } else { result = null; } return result; }
206452_15
public static String cleanTextKey(String s) { if (s == null || s.isEmpty()) { return s; } // escape HTML return StringEscapeUtils.escapeHtml4(cleanExpressions(s)); }
206459_27
@Override public int readEnum() throws IOException { return readInt(); }
206478_75
@Override public void definedTerm() { // nop }
206483_66
protected void mergeContributor_Roles( Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context ) { target.setRoles( merge( target.getRoles(), source.getRoles(), sourceDominant, e -> e ) ); }
206633_1000
public Object createFilteredBean(Object data, Set<String> fields) { return createFilteredBean(data, fields, ""); }
206635_4
public Set<MojoDescriptor> parseMojoDescriptors( File metadataFile ) throws PluginMetadataParseException { Set<MojoDescriptor> descriptors = new HashSet<>(); try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) ) { PluginMetadataXpp3Reader metadataReader = new PluginMetadataXpp3Reader(); PluginMetadata pluginMetadata = metadataReader.read( reader ); List<Mojo> mojos = pluginMetadata.getMojos(); if ( mojos != null ) { for ( Mojo mojo : mojos ) { MojoDescriptor descriptor = asDescriptor( metadataFile, mojo ); descriptors.add( descriptor ); } } } catch ( IOException | XmlPullParserException e ) { throw new PluginMetadataParseException( metadataFile, "Cannot parse plugin metadata from file.", e ); } return descriptors; }
209853_134
@Override public String geraCodigoDeBarrasPara(Boleto boleto) { Beneficiario beneficiario = boleto.getBeneficiario(); String numeroConvenio = beneficiario.getNumeroConvenio(); if (numeroConvenio == null || numeroConvenio.isEmpty() ) { throw new IllegalArgumentException("O número do convênio não pode ser nulo!"); } int numeroPosicoesConvenio = numeroConvenio.length(); Modalidade modalidade = beneficiario.getModalidade(); StringBuilder campoLivre = new StringBuilder(); if (numeroPosicoesConvenio == 7 && modalidade.equals(Modalidade.COM_REGISTRO)) { campoLivre.append("000000"); campoLivre.append(beneficiario.getNossoNumero()); } if ((numeroPosicoesConvenio == 4 || numeroPosicoesConvenio == 6) && modalidade.equals(Modalidade.COM_REGISTRO)) { campoLivre.append(beneficiario.getNossoNumero()); campoLivre.append(beneficiario.getAgenciaFormatada()); campoLivre.append(beneficiario.getCodigoBeneficiario()); } if (numeroPosicoesConvenio == 6 && modalidade.equals(Modalidade.SEM_REGISTRO)) { campoLivre.append(beneficiario.getNossoNumero()); } campoLivre.append(boleto.getBanco().getCarteiraFormatado(beneficiario)); if (campoLivre.length() != 25) { String msg = String.format("Tamanho do campo livre inválido. Deveria ter 25, mas tem %s caracteres.", campoLivre.toString()); throw new IllegalArgumentException(msg); } return new CodigoDeBarrasBuilder(boleto).comCampoLivre(campoLivre); }
213337_470
;
219850_20
public void setUseCanonicalFormat(boolean useCanonicalFormat) { this.useCanonicalFormat = useCanonicalFormat; }
223355_338
public InputStream locate(final String uri) throws IOException { notNull(uri, "uri cannot be NULL!"); if (getWildcardStreamLocator().hasWildcard(uri)) { final String fullPath = FilenameUtils.getFullPath(uri); final URL url = new URL(fullPath); return getWildcardStreamLocator().locateStream(uri, new File(URLDecoder.decode(url.getFile(), "UTF-8"))); } final URL url = new URL(uri); final URLConnection connection = url.openConnection(); // avoid jar file locking on Windows. connection.setUseCaches(false); // setting these timeouts ensures the client does not deadlock indefinitely // when the server has problems. connection.setConnectTimeout(timeout); connection.setReadTimeout(timeout); return new BufferedInputStream(connection.getInputStream()); }
225207_7
public void handleMessage(NMRMessage message) throws Fault { message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500)); NSStack nsStack = new NSStack(); nsStack.push(); try { XMLStreamWriter writer = getWriter(message); Fault fault = getFault(message); NMRFault jbiFault = NMRFault.createFault(fault); nsStack.add(NMRConstants.NS_NMR_BINDING); String prefix = nsStack.getPrefix(NMRConstants.NS_NMR_BINDING); StaxUtils.writeStartElement(writer, prefix, NMRFault.NMR_FAULT_ROOT, NMRConstants.NS_NMR_BINDING); if (!jbiFault.hasDetails()) { writer.writeEmptyElement("fault"); } else { Element detail = jbiFault.getDetail(); NodeList details = detail.getChildNodes(); for (int i = 0; i < details.getLength(); i++) { if (details.item(i) instanceof Element) { StaxUtils.writeNode(details.item(i), writer, true); break; } } } writer.writeEndElement(); writer.flush(); } catch (XMLStreamException xe) { throw new Fault(new Message("XML_WRITE_EXC", BUNDLE), xe); } }
225211_0
public static <T> Class<? extends T> locate(Class<T> factoryId) { return locate(factoryId, factoryId.getName()); }
229738_123
@CheckReturnValue @Nonnull public static DummyException throwAnyway(Throwable t) { if (t instanceof Error) { throw (Error) t; } if (t instanceof RuntimeException) { throw (RuntimeException) t; } if (t instanceof IOException) { throw new UncheckedIOException((IOException) t); } if (t instanceof InterruptedException) { Thread.currentThread().interrupt(); } if (t instanceof InvocationTargetException) { throw throwAnyway(t.getCause()); } throwEvadingChecks(t); // never reached return null; }
231990_1
public static List<String> parseTrack(String track) { Pattern pattern = Pattern.compile("(.+)(\\((F|f)eat(\\. |\\.| |uring )(.+))\\)"); Matcher matcher = pattern.matcher(track); boolean matches = matcher.matches(); if (matches) { String title = matcher.group(1).trim(); String featuring = matcher.group(5).trim(); return createContributorList(title, featuring); } pattern = Pattern.compile("(.+)(\\((W|w)ith(.+))\\)"); matcher = pattern.matcher(track); matches = matcher.matches(); if (matches) { String title = matcher.group(1).trim(); String featuring = matcher.group(4).trim(); return createContributorList(title, featuring); } return singletonList(track); }
235076_9
@Override public String getAsString() throws TemplateModelException { if (resource.getURI() == null) { return INVALID_URL; // b-nodes return null and their ids are useless } else { return resource.getURI(); } }
237920_1
public void setProjects(Projects projects) { this.projects = projects; }
240464_2
public String getMessage() { if (causeException == null) return super.getMessage(); StringBuilder sb = new StringBuilder(); if (super.getMessage() != null) { sb.append(super.getMessage()); sb.append("; "); } sb.append("nested exception is: "); sb.append(causeException.toString()); return sb.toString(); }
240466_0
public static boolean canConvert(final String type, final ClassLoader classLoader) { if (type == null) { throw new NullPointerException("type is null"); } if (classLoader == null) { throw new NullPointerException("classLoader is null"); } try { return REGISTRY.findConverter(Class.forName(type, true, classLoader)) != null; } catch (ClassNotFoundException e) { throw new PropertyEditorException("Type class could not be found: " + type); } }
247823_30
public String toString(NewCookie cookie) { if (cookie == null) { throw new IllegalArgumentException(Messages.getMessage("cookieIsNull")); //$NON-NLS-1$ } return buildCookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie .getDomain(), cookie.getVersion(), cookie.getComment(), cookie.getMaxAge(), cookie .isSecure()); }
249855_17
public List<BlobDetails> listContainerObjectDetails() { return listContainerObjectDetails(getDefaultContainerName()); }
279216_19
public Result send(Connection connection) throws DespotifyException { /* Create channel callback */ ChannelCallback callback = new ChannelCallback(); byte[] utf8Bytes = query.getBytes(Charset.forName("UTF8")); /* Create channel and buffer. */ Channel channel = new Channel("Search-Channel", Channel.Type.TYPE_SEARCH, callback); ByteBuffer buffer = ByteBuffer.allocate(2 + 4 + 4 + 2 + 1 + utf8Bytes.length); /* Check offset and limit. */ if (offset < 0) { throw new IllegalArgumentException("Offset needs to be >= 0"); } else if ((maxResults < 0 && maxResults != -1) || maxResults == 0) { throw new IllegalArgumentException("Limit needs to be either -1 for no limit or > 0"); } /* Append channel id, some values, query length and query. */ buffer.putShort((short) channel.getId()); buffer.putInt(offset); /* Result offset. */ buffer.putInt(maxResults); /* Reply limit. */ buffer.putShort((short) 0x0000); buffer.put((byte) utf8Bytes.length); buffer.put(utf8Bytes); buffer.flip(); /* Register channel. */ Channel.register(channel); /* Send packet. */ connection.getProtocol().sendPacket(PacketType.search, buffer, "search"); /* Get data and inflate it. */ byte[] data = GZIP.inflate(callback.getData("gzipped search response")); if (log.isInfoEnabled()) { log.info("received search response packet, " + data.length + " uncompressed bytes:\n" + Hex.log(data, log)); } /* Cut off that last 0xFF byte... */ data = Arrays.copyOfRange(data, 0, data.length - 1); String xml = new String(data, Charset.forName("UTF-8")); if (log.isDebugEnabled()) { log.debug(xml); } XMLElement root = XML.load(xml); /* Create result from XML. */ return Result.fromXMLElement(root, store); }
283187_21
public static void install() { LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler()); }
283325_37
public String abbreviate(String fqClassName) { StringBuilder buf = new StringBuilder(targetLength); if (fqClassName == null) { throw new IllegalArgumentException("Class name may not be null"); } int inLen = fqClassName.length(); if (inLen < targetLength) { return fqClassName; } int[] dotIndexesArray = new int[ClassicConstants.MAX_DOTS]; // a.b.c contains 2 dots but 2+1 parts. // see also http://jira.qos.ch/browse/LBCLASSIC-110 int[] lengthArray = new int[ClassicConstants.MAX_DOTS + 1]; int dotCount = computeDotIndexes(fqClassName, dotIndexesArray); // System.out.println(); // System.out.println("Dot count for [" + className + "] is " + dotCount); // if there are not dots than abbreviation is not possible if (dotCount == 0) { return fqClassName; } // printArray("dotArray: ", dotArray); computeLengthArray(fqClassName, dotIndexesArray, lengthArray, dotCount); // printArray("lengthArray: ", lengthArray); for (int i = 0; i <= dotCount; i++) { if (i == 0) { buf.append(fqClassName.substring(0, lengthArray[i] - 1)); } else { buf.append(fqClassName.substring(dotIndexesArray[i - 1], dotIndexesArray[i - 1] + lengthArray[i])); } // System.out.println("i=" + i + ", buf=" + buf); } return buf.toString(); }
291242_13
public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { Class<? extends Enum<?>> declaringClass = key.getDeclaringClass(); String declaringClassName = declaringClass.getName(); CAL10NBundle rb = cache.get(declaringClassName); if (rb == null || rb.hasChanged()) { rb = lookupResourceBundleByEnumClassAndLocale(declaringClass); cache.put(declaringClassName, rb); } String keyAsStr = key.toString(); String value = rb.getString(keyAsStr); if (value == null) { return "No key found for " + keyAsStr; } else { if (args == null || args.length == 0) { return value; } else { return MessageFormat.format(value, args); } } }
291570_20
public final AuthenticationInfo authenticate(AuthenticationToken token) throws AuthenticationException { if (token == null) { throw new IllegalArgumentException("Method argument (authentication token) cannot be null."); } log.trace("Authentication attempt received for token [{}]", token); AuthenticationInfo info; try { info = doAuthenticate(token); if (info == null) { String msg = "No account information found for authentication token [" + token + "] by this " + "Authenticator instance. Please check that it is configured correctly."; throw new AuthenticationException(msg); } } catch (Throwable t) { AuthenticationException ae = null; if (t instanceof AuthenticationException) { ae = (AuthenticationException) t; } if (ae == null) { //Exception thrown was not an expected AuthenticationException. Therefore it is probably a little more //severe or unexpected. So, wrap in an AuthenticationException, log to warn, and propagate: String msg = "Authentication failed for token submission [" + token + "]. Possible unexpected " + "error? (Typical or expected login exceptions should extend from AuthenticationException)."; ae = new AuthenticationException(msg, t); if (log.isWarnEnabled()) log.warn(msg, t); } try { notifyFailure(token, ae); } catch (Throwable t2) { if (log.isWarnEnabled()) { String msg = "Unable to send notification for failed authentication attempt - listener error?. " + "Please check your AuthenticationListener implementation(s). Logging sending exception " + "and propagating original AuthenticationException instead..."; log.warn(msg, t2); } } throw ae; } log.debug("Authentication successful for token [{}]. Returned account [{}]", token, info); notifySuccess(token, info); return info; }
293812_0
@Override public void close() { out.close(); }
298328_9
public static String render(final String input) throws IllegalArgumentException { try { return render(input, new StringBuilder(input.length())).toString(); } catch (IOException e) { // Cannot happen because StringBuilder does not throw IOException throw new IllegalArgumentException(e); } }
309964_37
public void add(Link content) { _contents.add(content); }
314299_10
public ExtensionModel getExtensionModel( String extension ) { return extensionModels.get( extension ); }
315033_36
public Object invoke(MethodInvocation invocation) throws Throwable { final Method method = invocation.getMethod(); if(method == null) { return null; } Transactional txa = method.getAnnotation(Transactional.class); if (txa == null) { return invocation.proceed(); } Transaction tx = manager.getCurrentTransaction(); final boolean transactionStarted; if (tx == null || !txa.propagationRequired()) { tx = manager.beginTransaction(txa.isolated()); transactionStarted = true; } else { transactionStarted = false; } try { Object obj = invocation.proceed(); if (transactionStarted) { tx.commit(); } return obj; } catch (Exception ex) { if (transactionStarted) { tx.rollback(); } throw ex; } }
320367_0
public static int times(int x, int y) { return new HelloWorldJNI().timesHello(x, y); }
320690_7
@Override public SourceProperty getSourceProperty( String expression ) { if ( isIdentifier( expression ) ) { return new ReflectionSourceProperty( expression ); } else { return null; } }
324985_0
public boolean hasAssociatedFailures(Description d) { List<Failure> failureList = result.getFailures(); for (Failure f : failureList) { if (f.getDescription().equals(d)) { return true; } if (description.isTest()) { return false; } List<Description> descriptionList = d.getChildren(); for (Description child : descriptionList) { if (hasAssociatedFailures(child)) { return true; } } } return false; }
327391_1
@SuppressWarnings({"unchecked"}) public ArrayBuilder<T> add(T... elements) { if (elements == null) return this; if (array == null) { array = elements; return this; } T[] newArray = (T[]) Array.newInstance(array.getClass().getComponentType(), array.length + elements.length); System.arraycopy(array, 0, newArray, 0, array.length); System.arraycopy(elements, 0, newArray, array.length, elements.length); array = newArray; return this; }
327472_155
@Override public boolean accept(final ConsoleState state) { Assertions.checkNotNull("state", state); if (state.getActiveCommand() == null && state.getInput().trim().startsWith("save ")) { return true; } return false; }
331792_7
@Nullable public NodePath parent() { int i = path.lastIndexOf(Node.SEPARATOR); if (i == 0) { return this; } else if (i == -1) { return null; } else { return new NodePath(path.substring(0, i)); } }
335218_30
public static Satz getSatz(final int satzart) { return getSatz(new SatzTyp(satzart)); }
336330_27
@Override public Matrix viewPart(int[] offset, int[] size) { if (offset[ROW] < ROW) { throw new IndexException(offset[ROW], ROW); } if (offset[ROW] + size[ROW] > rowSize()) { throw new IndexException(offset[ROW] + size[ROW], rowSize()); } if (offset[COL] < ROW) { throw new IndexException(offset[COL], ROW); } if (offset[COL] + size[COL] > columnSize()) { throw new IndexException(offset[COL] + size[COL], columnSize()); } int[] origin = offset.clone(); origin[ROW] += offset[ROW]; origin[COL] += offset[COL]; return new MatrixView(matrix, origin, size); }
338815_32
protected boolean isCurrentRevisionSelected() { return myRightRevisionIndex == 0; }
339284_3
public Model load() throws Exception { if (name == null) { throw new MissingPropertyException("name"); } String value = System.getProperty(name); if (value == null) { log.trace("Unable to load; property not set: {}", name); return null; } URL url = null; try { url = new URL(value); } catch (MalformedURLException e) { File file = new File(value); if (file.exists()) { url = file.toURI().toURL(); } } if (url == null) { throw new ConfigurationException("Unable to load; unable to resolve target: " + value); } return load(url); }
339856_0
@Splitter public List<TripNotification> generateTripNotificationsFrom(FlightNotification flightNotification, @Header("affectedTrips") List<Trip> affectedTrips) { List<TripNotification> notifications = new ArrayList<TripNotification>(affectedTrips.size()); for (Trip trip : affectedTrips) { notifications.add(new TripNotification(trip, flightNotification.getMessage())); } return notifications; }
342505_0
public AttributeCollection() { this.map = Collections.synchronizedMap(new HashMap<AttributeIdentifier, Map<EntityAttributes, Attribute<?>>>()); }
343996_8
public ImmutableList<String> extractNames(ImmutableList<NamePart> nameParts) { nameParts.size() < 3) { throw new IllegalArgumentException("There should be 3 NameParts : a Country, a first-order administrative division, and a name"); urn ImmutableList.of( untryName(nameParts), m1Name(nameParts), atureName(nameParts)); }
357827_0
public static Long getString2Duration(String time) throws ParseException { String[] timeArray = time.split(":"); if (timeArray.length != C_THREE) { throw new ParseException("", 0); } try { long millis; millis = Integer.parseInt(timeArray[0]) * C_THREETHOUSANDSIXHUNDRET; millis += Integer.parseInt(timeArray[1]) * C_SIXTY; millis += Integer.parseInt(timeArray[2]); millis *= C_THOUSAND; return millis; } catch (NumberFormatException e) { throw new ParseException("", 1); } }
358370_14
@Override @SuppressWarnings({"PMD.AvoidInstantiatingObjectsInLoops", "PMD.CloseResource"}) public Long call() throws Exception { if(!inputFile.isFile()) { throw new IllegalArgumentException("'" + inputFile.getAbsolutePath() + "' is not a file!"); } if(!inputFile.canRead()) { throw new IllegalArgumentException("'" + inputFile.getAbsolutePath() + "' is not a readable!"); } long fileSize = inputFile.length(); setNumberOfSteps(fileSize); InputStream fis = Files.newInputStream(inputFile.toPath()); CountingInputStream cis = new CountingInputStream(fis); String fileName=inputFile.getName().toLowerCase(Locale.US); XMLStreamReader xmlStreamReader; Reader reader; if(fileName.endsWith(".gz")) { reader = new InputStreamReader(new GZIPInputStream(cis), StandardCharsets.UTF_8); } else { reader = new InputStreamReader(cis, StandardCharsets.UTF_8); } xmlStreamReader = XML_INPUT_FACTORY.createXMLStreamReader(new ReplaceInvalidXmlCharacterReader(reader)); for(;;) { try { LoggingEvent event = loggingEventReader.read(xmlStreamReader); setCurrentStep(cis.getByteCount()); if(event == null) { break; } result++; EventWrapper<LoggingEvent> wrapper = new EventWrapper<>(); wrapper.setEvent(event); SourceIdentifier sourceIdentifier = new SourceIdentifier(inputFile.getAbsolutePath()); EventIdentifier eventId = new EventIdentifier(sourceIdentifier, result); wrapper.setEventIdentifier(eventId); buffer.add(wrapper); } catch(XMLStreamException ex) { if(logger.isWarnEnabled()) logger.warn("Exception while importing...", ex); } } return result; }
358381_11
public Map<String, Object> getLocalResourceMap(final String bundleBaseName, final Locale locale) { if(object != null) { return ResourceMaps.getLocalResourceMap(clazz, bundleBaseName, resolveLocale(locale)); } return ResourceMaps.getLocalResourceMap(clazz, bundleBaseName, locale); }
363849_3
public static HttpParameters decodeForm(String form) { HttpParameters params = new HttpParameters(); if (isEmpty(form)) { return params; } for (String nvp : form.split("\\&")) { int equals = nvp.indexOf('='); String name; String value; if (equals < 0) { name = percentDecode(nvp); value = null; } else { name = percentDecode(nvp.substring(0, equals)); value = percentDecode(nvp.substring(equals + 1)); } params.put(name, value); } return params; }
369176_0
public URI getLocation() { try { String location = getHeaders().getFirst("Location"); if(location == null || location.equals("")) return getRequest().getURI(); else return new URI(location); } catch (URISyntaxException e) { throw new RestfulieException("Invalid URI received as a response", e); } }
376975_19
public static boolean isEmpty(Collection<?> collection) { return collection == null || collection.isEmpty(); }
394387_0
public Collection getBaseCollection() throws XMLDBException { baseCollection = DatabaseManager.getCollection(baseCollectionURI); return baseCollection; }
403568_5
@Override protected void add(Geometry geometry) { if (result == null) { result = geometry; } else { if (geometry != null) { result = result.union(geometry); } } }
446195_3
public static boolean isBetween(long reading, long floor, long ceiling) { return reading < ceiling && reading > floor; }
457158_6
public void search(Set<String> keywords) { for (AuctionHouse auctionHouse : auctionHouses) { search(auctionHouse, keywords); } consumer.auctionSearchFinished(); }
459348_101
public void setHeaders(final Message message, final Map<String, String> msgMap, final DataType dataType, final String address, final @NonNull PersonRecord contact, final Date sentDate, final int status) throws MessagingException { // Threading by contact ID, not by thread ID. I think this value is more stable. message.setHeader(Headers.REFERENCES, String.format(REFERENCE_UID_TEMPLATE, reference, contact.getId())); message.setHeader(Headers.MESSAGE_ID, createMessageId(sentDate, address, status)); message.setHeader(Headers.ADDRESS, sanitize(address)); message.setHeader(Headers.DATATYPE, dataType.toString()); message.setHeader(Headers.BACKUP_TIME, toGMTString(new Date())); message.setHeader(Headers.VERSION, version); message.setSentDate(sentDate, false); message.setInternalDate(sentDate); switch (dataType) { case SMS: setSmsHeaders(message, msgMap); break; case MMS: setMmsHeaders(message, msgMap); break; case CALLLOG: setCallLogHeaders(message, msgMap); break; } }
466802_0
public String getBiography() { return biography; }
473362_6
@Override public void reduce(GramKey key, Iterator<Gram> values, OutputCollector<Gram,Gram> output, Reporter reporter) throws IOException { Gram.Type keyType = key.getType(); if (keyType == Gram.Type.UNIGRAM) { // sum frequencies for unigrams. processUnigram(key, values, output, reporter); } else if (keyType == Gram.Type.HEAD || keyType == Gram.Type.TAIL) { // sum frequencies for subgrams, ngram and collect for each ngram. processSubgram(key, values, output, reporter); } else { reporter.incrCounter(Skipped.MALFORMED_TYPES, 1); } }
474905_0
public void setName(String name) { this.name = name; }
478661_36
public String[] parseLine(String nextLine) throws IOException { return parseLine(nextLine, false); }
489859_415
@Override public GeneratedHttpRequest apply(Invocation invocation) { checkNotNull(invocation, "invocation"); inputParamValidator.validateMethodParametersOrThrow(invocation); Optional<URI> endpoint = Optional.absent(); HttpRequest r = findOrNull(invocation.getArgs(), HttpRequest.class); if (r != null) { endpoint = Optional.fromNullable(r.getEndpoint()); if (endpoint.isPresent()) logger.trace("using endpoint %s from invocation.getArgs() for %s", endpoint, invocation); } else if (caller != null) { endpoint = getEndpointFor(caller); if (endpoint.isPresent()) logger.trace("using endpoint %s from caller %s for %s", endpoint, caller, invocation); else endpoint = findEndpoint(invocation); } else { endpoint = findEndpoint(invocation); } if (!endpoint.isPresent()) throw new NoSuchElementException(format("no endpoint found for %s", invocation)); GeneratedHttpRequest.Builder requestBuilder = GeneratedHttpRequest.builder().invocation(invocation) .caller(caller); String requestMethod = null; if (r != null) { requestMethod = r.getMethod(); requestBuilder.fromHttpRequest(r); } else { requestMethod = tryFindHttpMethod(invocation.getInvokable()).get(); requestBuilder.method(requestMethod); } requestBuilder.filters(getFiltersIfAnnotated(invocation)); Multimap<String, Object> tokenValues = LinkedHashMultimap.create(); tokenValues.put(Constants.PROPERTY_API_VERSION, apiVersion); tokenValues.put(Constants.PROPERTY_BUILD_VERSION, buildVersion); // URI template in rfc6570 form UriBuilder uriBuilder = uriBuilder(endpoint.get().toString()); overridePathEncoding(uriBuilder, invocation); if (caller != null) tokenValues.putAll(addPathAndGetTokens(caller, uriBuilder)); tokenValues.putAll(addPathAndGetTokens(invocation, uriBuilder)); Multimap<String, Object> formParams; if (caller != null) { formParams = addFormParams(tokenValues, caller); formParams.putAll(addFormParams(tokenValues, invocation)); } else { formParams = addFormParams(tokenValues, invocation); } Multimap<String, Object> queryParams = addQueryParams(tokenValues, invocation); Multimap<String, String> headers = buildHeaders(tokenValues, invocation); if (r != null) headers.putAll(r.getHeaders()); if (shouldAddHostHeader(invocation)) { StringBuilder hostHeader = new StringBuilder(endpoint.get().getHost()); if (endpoint.get().getPort() != -1) hostHeader.append(":").append(endpoint.get().getPort()); headers.put(HOST, hostHeader.toString()); } Payload payload = null; for (HttpRequestOptions options : findOptionsIn(invocation)) { injector.injectMembers(options);// TODO test case for (Entry<String, String> header : options.buildRequestHeaders().entries()) { headers.put(header.getKey(), replaceTokens(header.getValue(), tokenValues)); } for (Entry<String, String> query : options.buildQueryParameters().entries()) { queryParams.put(query.getKey(), replaceTokens(query.getValue(), tokenValues)); } for (Entry<String, String> form : options.buildFormParameters().entries()) { formParams.put(form.getKey(), replaceTokens(form.getValue(), tokenValues)); } String pathSuffix = options.buildPathSuffix(); if (pathSuffix != null) { uriBuilder.appendPath(pathSuffix); } String stringPayload = options.buildStringPayload(); if (stringPayload != null) payload = Payloads.newStringPayload(stringPayload); } if (queryParams.size() > 0) { uriBuilder.query(queryParams); } requestBuilder.headers(filterOutContentHeaders(headers)); requestBuilder.endpoint(uriBuilder.build(convertUnsafe(tokenValues))); if (payload == null) { PayloadEnclosing payloadEnclosing = findOrNull(invocation.getArgs(), PayloadEnclosing.class); payload = (payloadEnclosing != null) ? payloadEnclosing.getPayload() : findOrNull(invocation.getArgs(), Payload.class); } List<? extends Part> parts = getParts(invocation, ImmutableMultimap.<String, Object> builder() .putAll(tokenValues).putAll(formParams).build()); if (parts.size() > 0) { if (formParams.size() > 0) { parts = newLinkedList(concat(transform(formParams.entries(), ENTRY_TO_PART), parts)); } payload = new MultipartForm(MultipartForm.BOUNDARY, parts); } else if (formParams.size() > 0) { payload = Payloads.newUrlEncodedFormPayload(transformValues(formParams, NullableToStringFunction.INSTANCE)); } else if (headers.containsKey(CONTENT_TYPE) && !HttpRequest.NON_PAYLOAD_METHODS.contains(requestMethod)) { if (payload == null) payload = Payloads.newByteArrayPayload(new byte[] {}); payload.getContentMetadata().setContentType(get(headers.get(CONTENT_TYPE), 0)); } if (payload != null) { requestBuilder.payload(payload); } GeneratedHttpRequest request = requestBuilder.build(); org.jclouds.rest.MapBinder mapBinder = getMapPayloadBinderOrNull(invocation); if (mapBinder != null) { Map<String, Object> mapParams; if (caller != null) { mapParams = buildPayloadParams(caller); mapParams.putAll(buildPayloadParams(invocation)); } else { mapParams = buildPayloadParams(invocation); } if (invocation.getInvokable().isAnnotationPresent(PayloadParams.class)) { PayloadParams params = invocation.getInvokable().getAnnotation(PayloadParams.class); addMapPayload(mapParams, params, headers); } request = mapBinder.bindToRequest(request, mapParams); } else { request = decorateRequest(request); } if (request.getPayload() != null) { contentMetadataCodec.fromHeaders(request.getPayload().getContentMetadata(), headers); } utils.checkRequestHasRequiredProperties(request); return request; }
500697_95
public boolean getDefined() { return d_isDefined; }
500806_607
@Override protected Endpoint createEndpoint(String resourcePath, Map<String, String> parameters, TestContext context) { JmsEndpoint endpoint; if (resourcePath.startsWith("sync:")) { endpoint = new JmsSyncEndpoint(); } else { endpoint = new JmsEndpoint(); } if (resourcePath.contains("topic:")) { endpoint.getEndpointConfiguration().setPubSubDomain(true); } // set destination name if (resourcePath.indexOf(':') > 0) { endpoint.getEndpointConfiguration().setDestinationName(resourcePath.substring(resourcePath.lastIndexOf(':') + 1)); } else { endpoint.getEndpointConfiguration().setDestinationName(resourcePath); } // set default jms connection factory if (context.getReferenceResolver() != null && context.getReferenceResolver().isResolvable("connectionFactory")) { endpoint.getEndpointConfiguration().setConnectionFactory(context.getReferenceResolver().resolve("connectionFactory", ConnectionFactory.class)); } enrichEndpointConfiguration(endpoint.getEndpointConfiguration(), parameters, context); return endpoint; }
502000_35
public TaskQueue createTaskQueue() { if (isShutdown) { throw new IllegalStateException("Scheduler is shutdown"); } return new TaskQueueImpl(); }
505113_0
public void setUseLevelAsKey(final boolean useLevelAsKey) { this.useLevelAsKey = useLevelAsKey; }
508590_3
void setFirstClassEdges(final boolean firstClassEdges) { this.firstClassEdges = firstClassEdges; }
511297_48
public CassandraHost[] buildCassandraHosts() { if (this.hosts == null) { throw new IllegalArgumentException("Need to define at least one host in order to apply configuration."); } String[] hostVals = hosts.split(","); CassandraHost[] cassandraHosts = new CassandraHost[hostVals.length]; for (int x=0; x<hostVals.length; x++) { CassandraHost cassandraHost = this.port == CassandraHost.DEFAULT_PORT ? new CassandraHost(hostVals[x].trim()) : new CassandraHost(hostVals[x], this.port); applyConfig(cassandraHost); cassandraHosts[x] = cassandraHost; } return cassandraHosts; }