id
stringlengths
7
14
text
stringlengths
1
37.2k
2784782_5
@RequestMapping(value = "/{icon:.+}", method = RequestMethod.GET) public HttpEntity raw(@PathVariable String icon) throws IOException { return raw(null, icon); }
2791813_183
@Override public boolean appliesTo(Character caster, Character target) { if (target.isDead()) { return false; } return true; }
2797978_1
public boolean emit(String tag, Map<String, Object> record) { if (record.containsKey("time")) { return emit0(tag, record); } else { return emit(tag, System.currentTimeMillis() / 1000, record); } }
2803695_0
@Override public boolean isSupported(OptionalFeature optionalFeature) { return false; }
2804383_31
public void parseQuery() throws TTXPathException { // get first token, ignore all white spaces do { mToken = mScanner.nextToken(); } while (mToken.getType() == TokenType.SPACE); // parse the query according to the rules specified in the XPath 2.0 REC parseExpression(); // after the pa...
2818491_3
public void detect() throws IOException { detect(new ClassFileIterator()); }
2845921_1
public void enter(char c) { switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': state.processDigit(c); break; case '.': state.processDot(); break; case '+': case '-': case '/': ...
2851858_9
public static PropertyEditorProvider getProvider() { return PROVIDER; }
2854377_35
@Nonnull @Override public synchronized List<SObject> retrieve(@Nonnull String sObjectType, @Nonnull List<Id> ids, @Nonnull List<String> fieldList) throws ApiException { logger.entry(sObjectType, fieldList, ids); Retrieve retrieveParam = new Retrieve(); retrieveParam.setFieldList(StringUtils.join(fi...
2856208_18
@Override public void printHelp() { PrintWriter writer = new PrintWriter(System.out); printHelp(writer); writer.flush(); }
2858655_84
protected Environment getEnvironment(final Properties properties, String... packagesToSearch) { final Environment environment = new Environment(); if (properties != null) { environment.setProperties(properties); } packagesToSearch = ArrayUtils.add(packagesToSearch, getClass().getPackage()....
2874089_0
public static boolean validate( File f ) { try { SAXParser parser = factory.newSAXParser(); parser.setProperty( Constants.XML_SCHEMA_PROPERTY, Constants.XML_SCHEMA_LANGUAGE ); SimpleErrorHandler errorHandler = new SimpleErrorHandler(); SAXReader reader = new SAXReader( parser.getXMLReader() ); r...
2882681_1
public static Tracking search(String id) throws EncomendaZException { return search(id, null, null, null); }
2885102_12
public JSONValue decode() { char current = reader.current(); if(current == Opener.OBJECT.sign) { return decodeObject(); } else if(current == Opener.STRING.sign) { return decodeString(); } else if(current == Opener.ARRAY.sign) { return decodeArray(); } else if( Ch...
2885902_8
@Override public ElementType getElementType() { return reader.getElementType(); }
2899580_56
@SuppressWarnings("unchecked") @Override protected DomainEventMessage createSnapshot(Class<?> aggregateType, String aggregateIdentifier, DomainEventStream eventStream) { DomainEventMessage firstEvent = eventStream.peek(); Ag...
2907398_1
@Override public void run() { Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); Message message = new MimeMessage(session); try { if (email.getFromPersonal().equals(EmailBuilder.DEFAULT_PERSONAL)) { message.setFrom(new InternetAddress(em...
2916790_3
@Override public ResultSetCursor getOutgoingRelations(int[] instances) throws Exception { final StringBuilder b = new StringBuilder(); for (int i : instances) { b.append('('); b.append(i); b.append(')'); b.append(','); } String sql = "SELECT relations.subject, relations.predicate, relations.object FROM r...
2928039_24
@SuppressWarnings("unchecked") public Object transformRow(Map<String, Object> row, Context context) { VariableResolver resolver = context.getVariableResolver(); for (Map<String, String> fld : context.getAllEntityFields()) { String style = resolver.replaceTokens(fld.get(FORMAT_STYLE)); if (style != null) { ...
2930574_3
Map<Path, Path> populateTrashCommitPaths(Set<FileStatus> trashSet) { // find trash paths Map<Path, Path> trashPaths = new TreeMap<Path, Path>(); Path trash = cluster.getTrashPathWithDateHour(); Iterator<FileStatus> it = trashSet.iterator(); while (it.hasNext()) { FileStatus src = it.next(); Path targe...
2934254_65
public Iterable<String> formatResults(Iterable<Result> results, final Server server) { return from(results).transformAndConcat(new Function<Result, List<String>>() { @Override public List<String> apply(Result input) { return formatResult(input, server); } }).toList(); }
2945916_56
public static AddressListField cc(Address address) { return addressList0(FieldName.CC, Collections.singleton(address)); }
2948043_16
public void inject(Object entity, RESTServiceDiscovery restServiceDiscovery) { Field injectionField = findInjectionField(entity); if (injectionField == null) { return; } RESTServiceDiscovery fieldValue = null; try { injectionField.setAccessible(true); fieldValue = (RESTServi...
2964129_9
public static String encodeJSONMessage(final long messageID, final String endPoint, final String data) { return SocketIOFrameGenerator.encode(FrameType.JSON, messageID, false, endPoint, data, null); }
2974683_0
@Override public synchronized int read(long pos, byte[] b, int start, int len) throws IOException { this.pos = (int)pos; return read(b, start, len); }
2978404_14
public void scan(Object object) { try { scan(object, "", false, new ArrayList<Object>()); } catch (JMSException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
2988101_135
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel target) throws OperationException { resetSchemaProperties(target); if (saveDocument) { target = session.saveDocument(target); if (save) { session.save(); } } return targe...
2988709_13
public void setNamespaces(Map<String, String> namespaces) { this.namespaces = namespaces; }
2988715_4
public List<NavTreeDescriptor> getTreeDescriptors() { return registry.getTreeDescriptors(getDirectoryTreeService()); }
2988721_0
public PackageBuilder() { def = new PackageDefinitionImpl(); platforms = new ArrayList<>(); dependencies = new ArrayList<>(); conflicts = new ArrayList<>(); provides = new ArrayList<>(); entries = new LinkedHashMap<>(); installForms = new ArrayList<>(); validationForms = new ArrayList<>(...
2988725_41
@Override public DocumentModelList getEntries() throws DirectoryException { try { SearchControls scts = directory.getSearchControls(); if (log.isDebugEnabled()) { log.debug(String.format( "LDAPSession.getEntries(): LDAP search base='%s' filter='%s' " ...
2989006_0
@OperationMethod public DocumentModel run() { if (StringUtils.isBlank(path)) { return session.getRootDocument(); } else { return session.getDocument(new PathRef(path)); } }
2990192_10
public void write(int b) throws IOException { if (toSkip > 0) { toSkip--; } else { out.write(b); } }
2992799_3
@Override public String toString() { return "ConditionalAttributeBehavior{" + "expression=" + expression + ", attribute=" + attribute + ", line=" + line + ", col=" + col + '}'; }
2995118_78
public Map<String, String> createAssociationErrorMap(AssociationReport associationReport) { Map<String, String> associationErrorMap = new HashMap<>(); //Create map of errors if (associationReport != null) { if (associationReport.getSnpError() != null && !associationReport.getSnpError().isEmpty()) ...
2997701_136
public int getCount() { return curSize; }
3010630_0
public void complete() throws WrongStateException, SystemException { invoke(Complete.class); }
3016145_9
public LayeredTokenMatcher matcher(LayeredSequence seq) throws SequenceException { String encoded = encodeSequence(seq); Matcher m = encodedPattern.matcher(encoded); return new LayeredTokenMatcher(m); }
3020895_48
public void start() { dataProducingThread = new Thread(this); dataProducingThread.setDaemon(true); dataProducingThread.start(); }
3026246_81
public static void registerProvider() { if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) Security.addProvider(new BouncyCastleProvider()); }
3028163_81
@WriteOperation public TogglzFeature setFeatureState(@Selector String name, boolean enabled) { final Feature feature = featureManager.getFeatures().stream() .filter(f -> f.name().equals(name)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Could not find feature wi...
3040093_3
public static RunHandler getController( final RunHandler.Context context, final RunHandlerConfig config){ final String name = "no.sesat.search.run.handler." + config.getClass().getAnnotation(Controller.class).value(); try{ final SiteClassLoaderFactory.Context ctlContext = ...
3050780_1
public String getPublicationId() { if (this.publicationId == null) { this.publicationId = extractBeforeSlash(this.url); } return this.publicationId; }
3061876_8
public static String maskApiKey(final String key) { int visibleChars = (int) (0.1 * key.length()); int right = visibleChars / 2; int left = visibleChars - right; // left >= right String beginning = key.substring(0, left); String end = key.substring(key.length() - right); return beginning + "..." + end; }
3069429_0
protected Map<String, Integer> tokenize(String text) { Map<String, Integer> tokenMap = newHashMap(); StringTokenizer st = new StringTokenizer(text, "\"{}[]:;|<>?`'.,/~!@#$%^&*()_-+= \t\n\r\f\\"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.length() < MIN_TOKEN_LENG...
3086072_0
@Background public void loadProject() { try { projectUserRelationDao.delete(projectUserRelationDao.queryForAll()); List<Status> statuses = backlogService.getStatuses(); for (Status status : statuses) { statusDao.createOrUpdate(status); Ln.d("put status id:%d", status.id); } List<Priority> prioritie...
3102907_0
protected String createMSCHAPV2Response(String username, byte[] password, byte ident, byte[] ntResponse, byte[] peerChallenge, byte[] authenticator) { byte[] authResponse = Authenticator.GenerateAuthenticatorResponse( password, ntResponse, peerChallenge, authenticator, username....
3110085_1
@Compensatable public void transferMoney(String fromAccount, String toAccount, Double amount) { accountManager.debitAccount(fromAccount, amount); accountManager.creditAccount(toAccount, amount); }
3113319_1
@Override public BigDecimal getPrice(Carrier carrier, Map<Purchasable, Long> items) { BigDecimal price = carrier.getPerShipping() != null ? carrier.getPerShipping() : BigDecimal.ZERO; Long numberOfItems = 0l; for (Long number : items.values()) { numberOfItems += number; } if (numberOfItems ...
3114475_22
public String toString(final boolean removeLeadingZero) { boolean removeZero = removeLeadingZero; final StringBuilder sb = new StringBuilder("0x"); for (int i = 0; i < INT_ARRAY_SIZE; i++) { toHex(val[i], removeZero, sb); if (removeZero && val[i] != 0) { removeZero = false; ...
3116751_0
protected String buildFullMessage(String message, Object... args) { StringBuilder stringBuilder = new StringBuilder(message.length()); int lastIndex = 0; int argIndex = 0; while (true) { int argPos = message.indexOf(ARGS_PATTERN, lastIndex); if (argPos == -1) { break; } stringBuilder.append(message.sub...
3119164_27
public SpeculativeGammaConfiguration newWithLocks() { if (locksDetected) { return this; } return new SpeculativeGammaConfiguration( true, listenersDetected, commuteDetected, nonRefTypeDetected, orelseDetected, true, constructedObjectsDetected, richMansConflictScanRequired, a...
3125904_1
@SuppressWarnings("unchecked") public <Model> void inject(@NotNull Model model) { try { for (Class type = model.getClass(); type != null && type != Object.class && type != Enum.class; type = type.getSuperclass()) { for (Field field : type.getDeclaredFields()) { injectField(model,...
3130403_11
@Override public Selection<T_ITEM> getSelection() { return getSelectionHandler().getSelection(); }
3139136_1
public static Map<String, PropertyDescriptor> getAllProperties(GenericType root) throws IntrospectionException { Map<String, PropertyDescriptor> properties = cPropertiesCache.get(root); if (properties == null) { GenericType rootType = root.getRootType(); if (rootType == null) { ...
3149437_2
@Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { ernamePasswordAuthenticationToken auth = (UsernamePasswordAuthenticationToken) authentication; asSubjectHolder subjectHolder = kerberosClient.login(auth.getName(), auth.getCredentials().toString()); erDetails us...
3149449_52
protected HostConfiguration getHostConfiguration(URI uri, SAMLMessageContext context) throws MessageEncodingException { try { HostConfiguration hc = httpClient.getHostConfiguration(); if (hc != null) { // Clone configuration from the HTTP Client object hc = new HostConfigu...
3165021_51
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) { if (!(handler instanceof HandlerMethod)) { return; } SuccessViews successViews = (SuccessViews) ((HandlerMethod) handler).getMethodAnnotation(SuccessViews.class); Success...
3175956_0
public String hello(String message) { return "Hello " + message; }
3192456_15
public void pushTransforms(Matrix4 modelTransform, ShaderProgram shader, Camera camera) { Matrix3 normalMatrix = new Matrix3(modelTransform).invert().transpose(); //Matrix4 modelViewProjection = modelTransform.multiply(camera.getViewProjectionMatrix()); Matrix4 viewMatrix = camera.getViewMatrix(); Matrix4 modelVie...
3192987_254
@Override public int hashCode() { return Objects.hash(id, name, path); }
3206489_2
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { if (resultCode == Activity.RESULT_CANCELED) { onResultCanceled(requestCode); return; } if (resultCode != Activity.RESULT_OK) { onResultNotOk(requestCode); return; } if (data == null) { onResultNotOk(re...
3216014_3
public static double variance(double[] values) { double[] squared = new double[values.length]; for (int i = 0; i < values.length; i++) { squared[i] = values[i] * values[i]; } double meanVal = mean(values); return mean(squared) - (meanVal * meanVal); }
3224235_1
public Accuracy train(List<LabeledDatum<F,L>> Data) { trainScores = getTrainingResults(Data); int[] GTLabels = makeLabelVector(Data); int[] Predictions = trainScores.columnArgmaxs(); TrainAccuracy = new Accuracy(Predictions, GTLabels, CatSize); return TrainAccuracy; }
3242289_6
@OnClick(R.id.auth_btn_login) public void login() { String username = mTxtUsername.getText().toString(); String password = mTxtPassword.getText().toString(); if (username.isEmpty() || password.isEmpty()) { return; } mProgressDisposable = ProgressDialog.create(R.string.authenticating).show(...
3249257_3
protected String getBulkData(List<SimpleDataEvent> events) { StringBuilder builder = new StringBuilder(); for (SimpleDataEvent event : events) { builder.append(JSONUtils.getElasticSearchBulkHeader(event, this.indexName, this.typeName)); builder.append("\n"); builder.append(JSONUtils.getElasticSearchAddD...
3250009_0
public void addCleanUp(ClassLoaderPreMortemCleanUp classLoaderPreMortemCleanUp) { addConsideringOrder(this.cleanUps, classLoaderPreMortemCleanUp); }
3250434_237
public void remove(String mapId) { mappedObjects.remove(mapId); }
3256677_0
public void createJobConf(JobConf conf, String[] args) throws IOException { log.info("Loading paths..."); String line = null; List<Path> paths = new ArrayList<Path>(); BufferedReader br = new BufferedReader( new FileReader( args[ 0 ] ) ); while( ( line = br.readLine() ) != null ) { paths.add( new Path( line ) );...
3263787_707
public void route(String instanceId) throws Exception { FormSubmission submission = formSubmissionsRepository.findByInstanceId(instanceId); FormSubmissionHandler handler = handlerMap.get(submission.formName()); if (handler == null) { logger.warn("Could not find a handler due to unknown form submissi...
3273720_83
@Override public void validate(final InstallServiceValidationContext validationContext) throws RestErrorException { validateCloudOverridesFileSize(validationContext.getCloudOverridesFile()); }
3283313_0
public int createInstance(String gcmadress) { String vmTemplate = "NAME=vm-4-RoQ\n" + "CONTEXT=[\n" + "FILES=\"/nebuladata/scripts/init-RoQ.sh\",\n" + "GATEWAY=\"192.168.0.1\",\n" + "HOSTNAME=\"RoQ-VM-$VMID\",\n" //+ "IP_PUBLIC=$NIC[IP, NETWORK=\"RoQ\"],\n" + "TARGET=\"vdb\",\n" + "GCM=\"" + gcmadress + "...
3291848_10
public static String buildFormPostContent(final WebContext context) { final String requestedUrl = context.getFullRequestURL(); final Map<String, String[]> parameters = context.getRequestParameters(); final StringBuilder buffer = new StringBuilder(); buffer.append("<html>\n"); buffer.append("<body>\n...
3293934_46
public Flowable<String> messages (String destination) { return messageReceiver.messages(destination).map(incomingMessage -> incomingMessage.message); }
3296177_17
public static boolean nodeAbsent(Object json, String path, Configuration configuration) { return nodeAbsent(json, Path.create(path), configuration); }
3308294_2
public String getParameterSummary(String paramName, Element element) { String comment = elements.getDocComment(element); if (StringUtils.isBlank(comment)) { return null; } comment = comment.trim(); StringBuilder parameterCommentBuilder = new StringBuilder(); boolean insideParameter = f...
3314133_111
public BGPv4Packet decodeUpdatePacket(ByteBuf buffer) { UpdatePacket packet = new UpdatePacket(); ProtocolPacketUtils.verifyPacketSize(buffer, BGPv4Constants.BGP_PACKET_MIN_SIZE_UPDATE, -1); if(buffer.readableBytes() < 2) throw new MalformedAttributeListException(); // handle withdrawn routes int withdrawn...
3315140_46
public static void main(String... args) { loadJDKLoggingConfiguration(); Injector injector = Guice.createInjector(new LoggerModule()); ProvisioningCLI provisioningCLI = injector.getInstance(ProvisioningCLI.class); new ProvisioningCLI().startCLI(args); }
3319591_6
public Geometry parse(String wkt) { if (wkt != null) { tempWkt = wkt; if (skip(org.geomajas.geometry.Geometry.MULTI_POLYGON.toUpperCase())) { return parseMultiPolygon(); } else if (skip(org.geomajas.geometry.Geometry.POLYGON.toUpperCase())) { return parsePolygon(); } else if (skip(org.geomajas.geometry.G...
3328338_6
public boolean verifyResponseEqualsUsername(String duoResponse) { try { String duoVerifiedResponse = DuoWeb.verifyResponse(ikey, skey, akey, duoResponse); boolean usernameMatches = duoVerifiedResponse.equals(username); if (usernameMatches) { log.info(username + " successfully Duo...
3332790_6
public void writeShort(ByteBuf buffer, short s) { buffer.writeByte(SHORT); buffer.writeShort(s); }
3333998_352
@Override public String digestParams(RestInvocation restInvocation) { String invocationUrl = restInvocation.getInvocationUrl(); Mac mac = getMac(); mac.update(invocationUrl.getBytes()); return String.format("%0128x", new BigInteger(1, mac.doFinal())); }
3337772_506
public String performTask(String taskParameters) { EnableStreamingTaskParameters taskParams = EnableStreamingTaskParameters.deserialize(taskParameters); String spaceId = taskParams.getSpaceId(); boolean secure = taskParams.isSecure(); List<String> allowedOrigins = taskParams.getAllowedOrigins()...
3352045_33
public ESMClass setSpecificFeature(GSMSpecificFeature specificFeature) { value = GSMSpecificFeature.compose(value, specificFeature); return this; }
3360581_13
public static String serializeMsgstr(Message message) { if (message.isPlural()) { StringBuilder sb = new StringBuilder(); List<String> plurals = message.getMsgstrPlural(); for (Iterator<String> it=plurals.iterator(); it.hasNext(); ) { String plural = it.next(); sb.app...
3362935_1
static Map<String, String> keyValueMapFor(String logLine) { Map<String, String> keyValueMap = new HashMap<String, String>(); Matcher matcher = KEY_VALUE_HOLDER_PATTERN.matcher(logLine); if (matcher.find()) { for (String keyValuePair : matcher.group(1).split(",")) { int separatorIndex = k...
3370128_31
public static JdbcCallParseInfo modifyJdbcCall(String jdbcSql, boolean stdStrings, int serverVersion, int protocolVersion, EscapeSyntaxCallMode escapeSyntaxCallMode) throws SQLException { // Mini-parser for JDBC function-call syntax (only) // TODO: Merge with escape processing (and parameter parsing?) so we onl...
3375991_0
@Override public Query parseQuery(String expression) { if (expression == null) { return null; } OqlParser parser = newParser(expression); try { parser.oql(); } catch (RecognitionException e) { e.printStackTrace(); } return parser.getQuery(); }
3376848_2
@Override @CheckReturnValue public boolean hasWebDriverStarted() { WebDriver webDriver = threadWebDriver.get(currentThread().getId()); return webDriver != null; }
3382195_492
public static String getQRCode(String issuer, String accountName, String secretKey) throws WriterException, IOException { if(!StringUtils.hasText(issuer) || issuer.contains(":")) { throw new IllegalArgumentException("invalid issuer"); } i...
3398614_3
protected String constructStatusAndHeaders(AtmosphereResponse response, int contentLength) { StringBuffer b = new StringBuffer("HTTP/1.1") .append(" ") .append(response.getStatus()) .append(" ") .append(response.getStatusMessage()) .append(CRLF); Map<...
3407114_33
public static Pair<String, String> parseLspciMachineReadable(String line) { Matcher matcher = LSPCI_MACHINE_READABLE.matcher(line); if (matcher.matches()) { return new Pair<>(matcher.group(1), matcher.group(2)); } return null; }
3407162_17
@Override public boolean matches(final OSCMessageEvent messageEvent) { return logicOperator.matches(selector1.matches(messageEvent), selector2.matches(messageEvent)); }
3409328_0
@JsonIgnore public String getId() { return id; }
3411081_27
@Override public IOException createException(String message) { return new IOException(message); }
3415743_0
public <I> void hear(final TypeLiteral<I> type, final TypeEncounter<I> encounter) { Provider<EventCasterInternal> eventCasterProvider = null; for (final Class<?> interfaceClass : listInterfaces(type.getRawType(), new HashSet<Class<?>>())) { final TypeLiteral<?> interfaceType = type.getSupertype(interfa...
3423262_43
public boolean matches(Class<?> parentEntityType, String propertyName, Object value) { if (value == null) { return _value == null; } else if (_value == null) { return false; } if (_resolvedValueSet) { return value.equals(_resolvedValue); } Class<?> expectedValueType = value.getClass(); Cla...
3424353_158
@Override @Transactional(rollbackFor = Throwable.class) public void delete(Assignment assignment) { getSession().delete(assignment); }
3425475_5
public void clearPendingSubscription(SiriClientRequest request, SubscriptionRequest subscriptionRequest) { _log.info("clear pending subscription: {}", request); _initiateSubscriptionsManager.clearPendingSubscription(request, subscriptionRequest); }
3429525_9
protected String renderOpenQuestion(Question question, ArrayList<String> prompts, String sessionKey) { TwiMLResponse twiml = new TwiMLResponse(); String typeProperty = question.getMediaPropertyValue(MediumType.BROADSOFT, MediaPropertyKey.TYPE); if (typeProperty != null && typeProperty.equalsIgnoreCase("au...