idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,304,900 | public void load(X509CRLEntry[] revokedCerts) {<NEW_LINE>TreeMap<BigInteger, X509CRLEntry> sortedRevokedCerts = new TreeMap<>();<NEW_LINE>for (int i = 0; i < revokedCerts.length; i++) {<NEW_LINE>sortedRevokedCerts.put(revokedCerts[i].getSerialNumber(), revokedCerts[i]);<NEW_LINE>}<NEW_LINE>data = new Object[sortedRevokedCerts.size()][2];<NEW_LINE>int i = 0;<NEW_LINE>for (Iterator<?> itr = sortedRevokedCerts.entrySet().iterator(); itr.hasNext(); i++) {<NEW_LINE>X509CRLEntry x509CrlEntry = (X509CRLEntry) ((Map.Entry<?, ?>) itr.<MASK><NEW_LINE>data[i][0] = x509CrlEntry.getSerialNumber();<NEW_LINE>data[i][1] = x509CrlEntry.getRevocationDate();<NEW_LINE>}<NEW_LINE>fireTableDataChanged();<NEW_LINE>} | next()).getValue(); |
959,252 | public Object parse(InputStream response, HttpEntity entity) throws XMLRPCException {<NEW_LINE>try {<NEW_LINE>XmlPullParser pullParser = XmlPullParserFactory.newInstance().newPullParser();<NEW_LINE>pullParser.setInput(response, "UTF-8");<NEW_LINE>pullParser.nextTag();<NEW_LINE>pullParser.require(XmlPullParser.START_TAG, null, XMLRPCClient.METHOD_RESPONSE);<NEW_LINE>// either TAG_PARAMS (<params>) or TAG_FAULT (<fault>)<NEW_LINE>pullParser.nextTag();<NEW_LINE>String tag = pullParser.getName();<NEW_LINE>if (tag.equals(XMLRPCClient.PARAMS)) {<NEW_LINE>// normal response<NEW_LINE>// TAG_PARAM (<param>)<NEW_LINE>pullParser.nextTag();<NEW_LINE>pullParser.require(XmlPullParser.START_TAG, null, XMLRPCClient.PARAM);<NEW_LINE>// TAG_VALUE (<value>)<NEW_LINE>pullParser.nextTag();<NEW_LINE>// no parser.require() here since its called in XMLRPCSerializer.deserialize() below<NEW_LINE>// deserialize result<NEW_LINE>Object obj = SerializerHandler.deserialize(pullParser);<NEW_LINE>consumeHttpEntity(response, entity);<NEW_LINE>return obj;<NEW_LINE>} else if (tag.equals(XMLRPCClient.FAULT)) {<NEW_LINE>// fault response<NEW_LINE>// TAG_VALUE (<value>)<NEW_LINE>pullParser.nextTag();<NEW_LINE>Map<String, Object> map = (Map<String, Object>) SerializerHandler.deserialize(pullParser);<NEW_LINE>consumeHttpEntity(response, entity);<NEW_LINE>// Check that required tags are in the response<NEW_LINE>if (!map.containsKey(FAULT_STRING) || !map.containsKey(FAULT_CODE)) {<NEW_LINE>throw new XMLRPCException("Bad XMLRPC Fault response received - <faultCode> and/or <faultString> missing!");<NEW_LINE>}<NEW_LINE>throw new XMLRPCServerException((String) map.get(FAULT_STRING), (Integer) map.get(FAULT_CODE));<NEW_LINE>} else {<NEW_LINE>throw new XMLRPCException("Bad tag <" + tag + "> in XMLRPC response - neither <params> nor <fault>");<NEW_LINE>}<NEW_LINE>} catch (XmlPullParserException ex) {<NEW_LINE>consumeHttpEntity(response, entity);<NEW_LINE>throw new XMLRPCException("Error parsing response.", ex);<NEW_LINE>} catch (XMLRPCServerException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>consumeHttpEntity(response, entity);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new XMLRPCException("Error getting result from server.", ex); |
847,095 | private V slowRemove(Object key, int hash, AtomicReferenceArray currentArray) {<NEW_LINE>// noinspection LabeledStatement<NEW_LINE>outer: while (true) {<NEW_LINE>int length = currentArray.length();<NEW_LINE>int index = ConcurrentHashMap.indexFor(hash, length);<NEW_LINE>Object o = currentArray.get(index);<NEW_LINE>if (o == RESIZED || o == RESIZING) {<NEW_LINE>currentArray = this.helpWithResizeWhileCurrentIndex(currentArray, index);<NEW_LINE>} else {<NEW_LINE>Entry<K, V> e = (Entry<K, V>) o;<NEW_LINE>while (e != null) {<NEW_LINE><MASK><NEW_LINE>if (candidate.equals(key)) {<NEW_LINE>Entry<K, V> replacement = this.createReplacementChainForRemoval((Entry<K, V>) o, e);<NEW_LINE>if (currentArray.compareAndSet(index, o, replacement)) {<NEW_LINE>this.addToSize(-1);<NEW_LINE>return e.getValue();<NEW_LINE>}<NEW_LINE>// noinspection ContinueStatementWithLabel<NEW_LINE>continue outer;<NEW_LINE>}<NEW_LINE>e = e.getNext();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Object candidate = e.getKey(); |
1,636,399 | private static CoolingThresholdTemperatureCharacteristic createCoolingThresholdCharacteristic(HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {<NEW_LINE>double minValue = HomekitCharacteristicFactory.convertToCelsius(taggedItem.getConfigurationAsDouble(HomekitTaggedItem.MIN_VALUE, CoolingThresholdTemperatureCharacteristic.DEFAULT_MIN_VALUE));<NEW_LINE>double maxValue = HomekitCharacteristicFactory.convertToCelsius(taggedItem.getConfigurationAsDouble(HomekitTaggedItem.MAX_VALUE, CoolingThresholdTemperatureCharacteristic.DEFAULT_MAX_VALUE));<NEW_LINE>return new CoolingThresholdTemperatureCharacteristic(minValue, maxValue, taggedItem.getConfigurationAsDouble(HomekitTaggedItem.STEP, CoolingThresholdTemperatureCharacteristic.DEFAULT_STEP), getTemperatureSupplier(taggedItem, minValue), setTemperatureConsumer(taggedItem), getSubscriber(taggedItem, COOLING_THRESHOLD_TEMPERATURE, updater), getUnsubscriber<MASK><NEW_LINE>} | (taggedItem, COOLING_THRESHOLD_TEMPERATURE, updater)); |
46,751 | private void handleDestroyTunnelAnswer(Answer ans, long from, long to, long networkId) {<NEW_LINE>if (ans.getResult()) {<NEW_LINE>OvsTunnelNetworkVO lock = _tunnelNetworkDao.acquireInLockTable(Long.valueOf(1));<NEW_LINE>if (lock == null) {<NEW_LINE>s_logger.warn(String.format("failed to lock" + "ovs_tunnel_account, remove record of " + "tunnel(from=%1$s, to=%2$s account=%3$s) failed", from, to, networkId));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>_tunnelNetworkDao.<MASK><NEW_LINE>_tunnelNetworkDao.releaseFromLockTable(lock.getId());<NEW_LINE>s_logger.debug(String.format("Destroy tunnel(account:%1$s," + "from:%2$s, to:%3$s) successful", networkId, from, to));<NEW_LINE>} else {<NEW_LINE>s_logger.debug(String.format("Destroy tunnel(account:%1$s," + "from:%2$s, to:%3$s) failed", networkId, from, to));<NEW_LINE>}<NEW_LINE>} | removeByFromToNetwork(from, to, networkId); |
1,016,962 | public void register(RoutingContext ctx) {<NEW_LINE>try {<NEW_LINE>// might throw runtime exception if there's no json or is bad formed<NEW_LINE>final JsonObject webauthnRegister = ctx.getBodyAsJson();<NEW_LINE>// the register object should match a Webauthn user.<NEW_LINE>// A user has only a required field: name<NEW_LINE>// And optional fields: displayName and icon<NEW_LINE>if (webauthnRegister == null || !containsRequiredString(webauthnRegister, "name")) {<NEW_LINE>ctx.fail(400, new IllegalArgumentException("missing 'name' field from request json"));<NEW_LINE>} else {<NEW_LINE>// input basic validation is OK<NEW_LINE>ManagedContext requestContext = Arc.container().requestContext();<NEW_LINE>requestContext.activate();<NEW_LINE>ContextState contextState = requestContext.getState();<NEW_LINE>security.getWebAuthn().createCredentialsOptions(webauthnRegister, createCredentialsOptions -> {<NEW_LINE>requestContext.destroy(contextState);<NEW_LINE>if (createCredentialsOptions.failed()) {<NEW_LINE>ctx.fail(createCredentialsOptions.cause());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final JsonObject credentialsOptions = createCredentialsOptions.result();<NEW_LINE>// save challenge to the session<NEW_LINE>authMech.getLoginManager().save(credentialsOptions.getString("challenge"), ctx, CHALLENGE_COOKIE, null, ctx.request().isSSL());<NEW_LINE>authMech.getLoginManager().save(webauthnRegister.getString("name"), ctx, USERNAME_COOKIE, null, ctx.request().isSSL());<NEW_LINE>ok(ctx, credentialsOptions);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE><MASK><NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>ctx.fail(e);<NEW_LINE>}<NEW_LINE>} | ctx.fail(400, e); |
177,409 | final BatchDisassociateClientDeviceFromCoreDeviceResult executeBatchDisassociateClientDeviceFromCoreDevice(BatchDisassociateClientDeviceFromCoreDeviceRequest batchDisassociateClientDeviceFromCoreDeviceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchDisassociateClientDeviceFromCoreDeviceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchDisassociateClientDeviceFromCoreDeviceRequest> request = null;<NEW_LINE>Response<BatchDisassociateClientDeviceFromCoreDeviceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new BatchDisassociateClientDeviceFromCoreDeviceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchDisassociateClientDeviceFromCoreDeviceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "GreengrassV2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchDisassociateClientDeviceFromCoreDevice");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchDisassociateClientDeviceFromCoreDeviceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchDisassociateClientDeviceFromCoreDeviceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
214,889 | public TopicRepository createTopicRepository(final Storage storage) throws TopicRepositoryException {<NEW_LINE>try {<NEW_LINE>final KafkaConfiguration kafkaConfiguration = storage.getKafkaConfiguration();<NEW_LINE>final ZooKeeperHolder zooKeeperHolder = new ZooKeeperHolder(kafkaConfiguration.getZookeeperConnection(), zookeeperSettings.getZkSessionTimeoutMs(), zookeeperSettings.getZkConnectionTimeoutMs(), nakadiSettings);<NEW_LINE>final KafkaLocationManager kafkaLocationManager = new KafkaLocationManager(zooKeeperHolder, kafkaSettings);<NEW_LINE>final KafkaFactory kafkaFactory = new KafkaFactory(new KafkaLocationManager<MASK><NEW_LINE>final KafkaZookeeper zk = new KafkaZookeeper(zooKeeperHolder, objectMapper);<NEW_LINE>final KafkaTopicRepository kafkaTopicRepository = new KafkaTopicRepository.Builder().setKafkaZookeeper(zk).setKafkaFactory(kafkaFactory).setNakadiSettings(nakadiSettings).setKafkaSettings(kafkaSettings).setZookeeperSettings(zookeeperSettings).setKafkaTopicConfigFactory(kafkaTopicConfigFactory).setKafkaLocationManager(kafkaLocationManager).setMetricRegistry(metricRegistry).build();<NEW_LINE>// check that it does work<NEW_LINE>kafkaTopicRepository.listTopics();<NEW_LINE>return kafkaTopicRepository;<NEW_LINE>} catch (final Exception e) {<NEW_LINE>throw new TopicRepositoryException("Could not create topic repository", e);<NEW_LINE>}<NEW_LINE>} | (zooKeeperHolder, kafkaSettings), metricRegistry); |
1,803,453 | public static String scrambleString(final String key, final String s) {<NEW_LINE>// we perform several operations<NEW_LINE>// - generate salt<NEW_LINE>// - gzip string<NEW_LINE>// - crypt string with key and salt<NEW_LINE>// - base64-encode result<NEW_LINE>// - attach salt and return<NEW_LINE>final String salt = randomSalt();<NEW_LINE>// System.out.println("Salt=" + salt);<NEW_LINE>final cryptbig c = new cryptbig(key, salt);<NEW_LINE>boolean gzFlag = true;<NEW_LINE>byte[] gz = Gzip.gzipString(s);<NEW_LINE>if (gz.length > s.length()) {<NEW_LINE>// revert compression<NEW_LINE>try {<NEW_LINE>gz = s.getBytes("UTF8");<NEW_LINE>gzFlag = false;<NEW_LINE>} catch (final UnsupportedEncodingException e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// System.out.println("GZIP length=" + gz.length);<NEW_LINE>if (gz == null)<NEW_LINE>return null;<NEW_LINE>final byte[] <MASK><NEW_LINE>if (enc == null)<NEW_LINE>return null;<NEW_LINE>return salt + ((gzFlag) ? "1" : "0") + Base64Order.enhancedCoder.encode(enc);<NEW_LINE>} | enc = c.encryptArray(gz); |
226,158 | public void updateConfig(HttpServletRequest req, HttpServletResponse res) throws JsonProcessingException {<NEW_LINE>Map<String, Object> entity = readEntity(req);<NEW_LINE>if (entity.containsKey("signature") && entity.containsKey("payload") && entity.getOrDefault("event", "").equals("config.update")) {<NEW_LINE>String payload = (String) entity.get("payload");<NEW_LINE>String signature = (String) entity.get("signature");<NEW_LINE>String id = (String) entity.get(Config._ID);<NEW_LINE>boolean <MASK><NEW_LINE>if (StringUtils.equals(signature, Utils.hmacSHA256(payload, CONF.paraSecretKey())) && !alreadyUpdated) {<NEW_LINE>Map<String, Object> configMap = ParaObjectUtils.getJsonReader(Map.class).readValue(payload);<NEW_LINE>configMap.entrySet().forEach((entry) -> {<NEW_LINE>System.setProperty(entry.getKey(), entry.getValue().toString());<NEW_LINE>});<NEW_LINE>CONF.store();<NEW_LINE>lastConfigUpdate = id;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | alreadyUpdated = id.equals(lastConfigUpdate); |
117,468 | private void markSkipped(@NonNull final I_C_Queue_WorkPackage workPackage, @NonNull final IWorkpackageSkipRequest skipRequest) {<NEW_LINE>final Timestamp skippedAt = SystemTime.asTimestamp();<NEW_LINE>final Exception skipException = skipRequest.getException();<NEW_LINE>final int skippedCount = workPackage.getSkipped_Count();<NEW_LINE>final int skipTimeoutMillis = skipRequest.getSkipTimeoutMillis() > 0 ? skipRequest.getSkipTimeoutMillis() : Async_Constants.DEFAULT_RETRY_TIMEOUT_MILLIS;<NEW_LINE>// just in case it was true<NEW_LINE>workPackage.setProcessed(false);<NEW_LINE>// just in case it was true<NEW_LINE>workPackage.setIsError(false);<NEW_LINE>workPackage.<MASK><NEW_LINE>workPackage.setSkippedAt(skippedAt);<NEW_LINE>workPackage.setSkipTimeoutMillis(skipTimeoutMillis);<NEW_LINE>workPackage.setSkipped_Count(skippedCount + 1);<NEW_LINE>if (skippedCount <= 0 || workPackage.getSkipped_First_Time() == null) {<NEW_LINE>workPackage.setSkipped_First_Time(skippedAt);<NEW_LINE>}<NEW_LINE>// update statistics<NEW_LINE>setLastEndTime(workPackage);<NEW_LINE>queueDAO.save(workPackage);<NEW_LINE>final String processorName;<NEW_LINE>final I_C_Queue_PackageProcessor packageProcessor = workPackage.getC_Queue_PackageProcessor();<NEW_LINE>if (packageProcessor == null) {<NEW_LINE>// might happen in unit tests.<NEW_LINE>processorName = "<null>";<NEW_LINE>} else {<NEW_LINE>processorName = CoalesceUtil.coalesce(packageProcessor.getInternalName(), packageProcessor.getClassname());<NEW_LINE>}<NEW_LINE>final String msg = StringUtils.formatMessage("Skipped while processing workpackage by processor {}; workpackage={}", processorName, workPackage);<NEW_LINE>// log error to console (for later audit):<NEW_LINE>Loggables.withLogger(logger, Level.DEBUG).addLog(msg, skipException);<NEW_LINE>createAndFireEventWithStatus(workPackage, SKIPPED);<NEW_LINE>} | setSkipped_Last_Reason(skipRequest.getSkipReason()); |
48,238 | final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTagsForResourceRequest> request = null;<NEW_LINE>Response<ListTagsForResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListTagsForResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagsForResourceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Cloud9");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListTagsForResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsForResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource"); |
184,717 | public RlpxAgent build() {<NEW_LINE>validate();<NEW_LINE>if (connectionEvents == null) {<NEW_LINE>connectionEvents = new PeerConnectionEvents(metricsSystem);<NEW_LINE>}<NEW_LINE>if (connectionInitializer == null) {<NEW_LINE>if (p2pTLSConfiguration.isPresent()) {<NEW_LINE>LOG.debug("TLS Configuration found using NettyTLSConnectionInitializer");<NEW_LINE>connectionInitializer = new NettyTLSConnectionInitializer(nodeKey, config, localNode, connectionEvents, metricsSystem, p2pTLSConfiguration.get());<NEW_LINE>} else {<NEW_LINE>LOG.debug("Using default NettyConnectionInitializer");<NEW_LINE>connectionInitializer = new NettyConnectionInitializer(nodeKey, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>final PeerRlpxPermissions rlpxPermissions = new PeerRlpxPermissions(localNode, peerPermissions);<NEW_LINE>return new RlpxAgent(localNode, connectionEvents, connectionInitializer, rlpxPermissions, peerPrivileges, config.getMaxPeers(), config.getMaxRemotelyInitiatedConnections(), randomPeerPriority, metricsSystem);<NEW_LINE>} | config, localNode, connectionEvents, metricsSystem); |
102,862 | public LogData readFlowLogs(final int execId, final int startByte, final int length) throws ExecutorManagerException {<NEW_LINE>final FlowRunner runner = this.runningFlows.get(execId);<NEW_LINE>if (runner == null) {<NEW_LINE>throw new ExecutorManagerException("Running flow " + execId + " not found.");<NEW_LINE>}<NEW_LINE>final File dir = runner.getExecutionDir();<NEW_LINE>if (dir != null && dir.exists()) {<NEW_LINE>try {<NEW_LINE>synchronized (this.executionDirDeletionSync) {<NEW_LINE>if (!dir.exists()) {<NEW_LINE>throw new ExecutorManagerException("Execution dir file doesn't exist. Probably has been deleted");<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>if (logFile != null && logFile.exists()) {<NEW_LINE>return FileIOUtils.readUtf8File(logFile, startByte, length);<NEW_LINE>} else {<NEW_LINE>throw new ExecutorManagerException("Flow log file doesn't exist.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new ExecutorManagerException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new ExecutorManagerException("Error reading file. Log directory doesn't exist.");<NEW_LINE>} | File logFile = runner.getFlowLogFile(); |
73,305 | public static String add_str(String a, String b, int n) {<NEW_LINE>a = trim(a, n);<NEW_LINE>b = trim(b, n);<NEW_LINE>String val = "";<NEW_LINE>int i, rem = 0;<NEW_LINE>char[] c1 = a.toCharArray();<NEW_LINE>char[<MASK><NEW_LINE>int[] ans = new int[a.length() + 1];<NEW_LINE>for (i = a.length(); i > 0; i--) {<NEW_LINE>ans[i] = (c1[i - 1] - 48 + c2[i - 1] - 48 + rem) % 10;<NEW_LINE>rem = (c1[i - 1] - 48 + c2[i - 1] - 48 + rem) / 10;<NEW_LINE>}<NEW_LINE>ans[0] = rem;<NEW_LINE>for (i = 0; i < ans.length; i++) val = val + ans[i];<NEW_LINE>val = trim(val, a.length() + 1);<NEW_LINE>return val;<NEW_LINE>} | ] c2 = b.toCharArray(); |
441,305 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Spell spell = game.getStack().getSpell(source.getSourceId());<NEW_LINE>if (controller != null && spell != null) {<NEW_LINE>ExileFromGraveCost exileFromGraveCost = (ExileFromGraveCost) source.getCosts().get(0);<NEW_LINE>List<Card> exiledCards = exileFromGraveCost.getExiledCards();<NEW_LINE>if (!exiledCards.isEmpty()) {<NEW_LINE>Cards toDelve = new CardsImpl();<NEW_LINE>for (Card card : exiledCards) {<NEW_LINE>toDelve.add(card);<NEW_LINE>}<NEW_LINE>ManaPool manaPool = controller.getManaPool();<NEW_LINE>manaPool.addMana(Mana.ColorlessMana(toDelve.size()), game, source);<NEW_LINE>manaPool.unlockManaType(ManaType.COLORLESS);<NEW_LINE>String keyString = CardUtil.getCardZoneString("delvedCards", source.getSourceId(), game);<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Cards delvedCards = (Cards) game.getState().getValue(keyString);<NEW_LINE>if (delvedCards == null) {<NEW_LINE>game.getState().setValue(keyString, toDelve);<NEW_LINE>} else {<NEW_LINE>delvedCards.addAll(toDelve);<NEW_LINE>}<NEW_LINE>// can't use mana abilities after that (delve cost must be payed after mana abilities only)<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | spell.setCurrentActivatingManaAbilitiesStep(ActivationManaAbilityStep.AFTER); |
88,519 | public void columnsReordered(List<String> newColumnOrder, List<String> oldColumnOrder) {<NEW_LINE>final String diffStateKey = "columnOrder";<NEW_LINE>ConnectorTracker connectorTracker = getUI().getConnectorTracker();<NEW_LINE>JsonObject diffState = connectorTracker.getDiffState(Grid.this);<NEW_LINE>// discard the change if the columns have been reordered from<NEW_LINE>// the server side, as the server side is always right<NEW_LINE>if (getState(false).columnOrder.equals(oldColumnOrder)) {<NEW_LINE>// Don't mark as dirty since client has the state already<NEW_LINE>getState(false).columnOrder = newColumnOrder;<NEW_LINE>// write changes to diffState so that possible reverting the<NEW_LINE>// column order is sent to client<NEW_LINE>assert <MASK><NEW_LINE>Type type = null;<NEW_LINE>try {<NEW_LINE>type = getState(false).getClass().getField(diffStateKey).getGenericType();<NEW_LINE>} catch (NoSuchFieldException | SecurityException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>EncodeResult encodeResult = JsonCodec.encode(getState(false).columnOrder, diffState, type, connectorTracker);<NEW_LINE>diffState.put(diffStateKey, encodeResult.getEncodedValue());<NEW_LINE>fireColumnReorderEvent(true);<NEW_LINE>} else {<NEW_LINE>// make sure the client is reverted to the order that the<NEW_LINE>// server thinks it is<NEW_LINE>diffState.remove(diffStateKey);<NEW_LINE>markAsDirty();<NEW_LINE>}<NEW_LINE>} | diffState.hasKey(diffStateKey) : "Field name has changed"; |
704,774 | final CreateProvisioningTemplateResult executeCreateProvisioningTemplate(CreateProvisioningTemplateRequest createProvisioningTemplateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createProvisioningTemplateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateProvisioningTemplateRequest> request = null;<NEW_LINE>Response<CreateProvisioningTemplateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateProvisioningTemplateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createProvisioningTemplateRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateProvisioningTemplate");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateProvisioningTemplateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateProvisioningTemplateResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
877,368 | public RegisterInstanceResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>RegisterInstanceResult registerInstanceResult = new RegisterInstanceResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return registerInstanceResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("OperationId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>registerInstanceResult.setOperationId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return registerInstanceResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
551,540 | public IStatus createTag(String tagName, String message, String startPoint) {<NEW_LINE>List<String> args <MASK><NEW_LINE>// $NON-NLS-1$<NEW_LINE>args.add("tag");<NEW_LINE>// $NON-NLS-1$<NEW_LINE>args.add("-a");<NEW_LINE>args.add(tagName);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>args.add("-m");<NEW_LINE>args.add(message);<NEW_LINE>// Default is HEAD<NEW_LINE>if (!StringUtil.isEmpty(startPoint)) {<NEW_LINE>args.add(startPoint);<NEW_LINE>}<NEW_LINE>IStatus result = execute(GitRepository.ReadWrite.WRITE, args.toArray(new String[args.size()]));<NEW_LINE>if (result != null && result.isOK()) {<NEW_LINE>// Add tag to list in model!<NEW_LINE>addBranch(new GitRevSpecifier(GitRef.refFromString(GitRef.REFS_TAGS + tagName)));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | = new ArrayList<String>(); |
188,746 | protected void processJarClassNames(ClassResource classResource, Set<String> classes) {<NEW_LINE>URL resource = classResource.getResource();<NEW_LINE>String packageName = classResource.getPackageName();<NEW_LINE>String relativePath = getPackageRelativePath(packageName);<NEW_LINE>String jarPath = getJarPath(resource);<NEW_LINE>JarFile jarFile;<NEW_LINE>try {<NEW_LINE>jarFile = new JarFile(jarPath);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.debug("IOException reading JAR '" + jarPath + ". Reason: " + e, e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Enumeration<JarEntry<MASK><NEW_LINE>while (entries.hasMoreElements()) {<NEW_LINE>JarEntry entry = entries.nextElement();<NEW_LINE>String entryName = entry.getName();<NEW_LINE>if (entryName.endsWith(".class") && entryName.startsWith(relativePath) && entryName.length() > (relativePath.length() + 1)) {<NEW_LINE>String className = entryName.replace('/', '.').replace('\\', '.').replace(".class", "");<NEW_LINE>classes.add(className);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// let's not leak resources<NEW_LINE>try {<NEW_LINE>jarFile.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.debug("IOException closing JAR '" + jarPath + "'. Reason: " + e, e);<NEW_LINE>}<NEW_LINE>} | > entries = jarFile.entries(); |
749,259 | protected void onCreate(Bundle state, boolean ready) {<NEW_LINE>super.onCreate(state, ready);<NEW_LINE>DcEventCenter eventCenter = DcHelper.getEventCenter(WebxdcActivity.this.getApplicationContext());<NEW_LINE>eventCenter.addObserver(DcContext.DC_EVENT_WEBXDC_STATUS_UPDATE, this);<NEW_LINE>Bundle b = getIntent().getExtras();<NEW_LINE>int appMessageId = b.getInt("appMessageId");<NEW_LINE>this.dcContext = DcHelper.getContext(getApplicationContext());<NEW_LINE>this.dcAppMsg = this.dcContext.getMsg(appMessageId);<NEW_LINE>WebSettings webSettings = webView.getSettings();<NEW_LINE>webSettings.setJavaScriptEnabled(true);<NEW_LINE>webSettings.setAllowFileAccess(false);<NEW_LINE>webSettings.setBlockNetworkLoads(true);<NEW_LINE>webSettings.setAllowContentAccess(false);<NEW_LINE>webSettings.setGeolocationEnabled(false);<NEW_LINE>webSettings.setAllowFileAccessFromFileURLs(false);<NEW_LINE>webSettings.setAllowUniversalAccessFromFileURLs(false);<NEW_LINE>webSettings.setDatabaseEnabled(true);<NEW_LINE>webSettings.setDomStorageEnabled(true);<NEW_LINE>webView.addJavascriptInterface(new InternalJSApi(), "InternalJSApi");<NEW_LINE>// `msg_id` in the subdomain makes sure, different apps using same files do not share the same cache entry<NEW_LINE>// (WebView may use a global cache shared across objects).<NEW_LINE>// (a random-id would also work, but would need maintenance and does not add benefits as we regard the file-part interceptRequest() only,<NEW_LINE>// also a random-id is not that useful for debugging)<NEW_LINE>webView.loadUrl("https://acc" + dcContext.getAccountId() + "-msg" + appMessageId + ".localhost/index.html");<NEW_LINE>Util.runOnAnyBackgroundThread(() -> {<NEW_LINE>JSONObject info <MASK><NEW_LINE>Util.runOnMain(() -> {<NEW_LINE>try {<NEW_LINE>getSupportActionBar().setTitle(info.getString("name"));<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>});<NEW_LINE>} | = this.dcAppMsg.getWebxdcInfo(); |
224,915 | protected void removeByC_T(String companyId, String type) throws SystemException {<NEW_LINE>Session session = null;<NEW_LINE>try {<NEW_LINE>session = openSession();<NEW_LINE>StringBuffer query = new StringBuffer();<NEW_LINE>query.append("FROM AdminConfig IN CLASS com.liferay.portlet.admin.ejb.AdminConfigHBM WHERE ");<NEW_LINE>query.append("companyId = ?");<NEW_LINE>query.append(" AND ");<NEW_LINE>query.append("type_ = ?");<NEW_LINE>query.append(" ");<NEW_LINE>Query q = session.createQuery(query.toString());<NEW_LINE>int queryPos = 0;<NEW_LINE>q.setString(queryPos++, companyId);<NEW_LINE>q<MASK><NEW_LINE>Iterator itr = q.list().iterator();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>AdminConfigHBM adminConfigHBM = (AdminConfigHBM) itr.next();<NEW_LINE>AdminConfigPool.remove((String) adminConfigHBM.getPrimaryKey());<NEW_LINE>session.delete(adminConfigHBM);<NEW_LINE>}<NEW_LINE>session.flush();<NEW_LINE>} catch (HibernateException he) {<NEW_LINE>throw new SystemException(he);<NEW_LINE>} finally {<NEW_LINE>HibernateUtil.closeSession(session);<NEW_LINE>}<NEW_LINE>} | .setString(queryPos++, type); |
1,241,556 | public PartitionGetResult partitionGet(PartitionGetParam partParam) {<NEW_LINE>PartSampleNeighborWithTypeParam sampleParam = (PartSampleNeighborWithTypeParam) partParam;<NEW_LINE>ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, partParam);<NEW_LINE>ILongKeyPartOp split = (ILongKeyPartOp) sampleParam.getIndicesPart();<NEW_LINE>long[<MASK><NEW_LINE>SampleType sampleType = sampleParam.getSampleType();<NEW_LINE>switch(sampleType) {<NEW_LINE>case NODE:<NEW_LINE>case EDGE:<NEW_LINE>{<NEW_LINE>Tuple2<Long2ObjectOpenHashMap<long[]>, Long2ObjectOpenHashMap<int[]>> nodeId2SampleNeighbors = SampleUtils.sampleWithType(row, sampleParam.getCount(), nodeIds, sampleType, System.currentTimeMillis());<NEW_LINE>return new PartSampleNeighborResultWithType(sampleParam.getPartKey().getPartitionId(), nodeId2SampleNeighbors._1, nodeId2SampleNeighbors._2, sampleType);<NEW_LINE>}<NEW_LINE>case NODE_AND_EDGE:<NEW_LINE>{<NEW_LINE>Tuple3<Long2ObjectOpenHashMap<long[]>, Long2ObjectOpenHashMap<int[]>, Long2ObjectOpenHashMap<int[]>> nodeId2SampleNeighbors = SampleUtils.sampleWithBothType(row, sampleParam.getCount(), nodeIds, System.currentTimeMillis());<NEW_LINE>return new PartSampleNeighborResultWithType(sampleParam.getPartKey().getPartitionId(), nodeId2SampleNeighbors._1(), nodeId2SampleNeighbors._2(), nodeId2SampleNeighbors._3());<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>throw new UnsupportedOperationException("Not support sample type " + sampleType + " now");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] nodeIds = split.getKeys(); |
869,550 | static OIdentifiable securityFilterOnRead(OIndex idx, OIdentifiable item) {<NEW_LINE>if (idx.getDefinition() == null) {<NEW_LINE>return item;<NEW_LINE>}<NEW_LINE>String indexClass = idx.getDefinition().getClassName();<NEW_LINE>if (indexClass == null) {<NEW_LINE>return item;<NEW_LINE>}<NEW_LINE>ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.instance().getIfDefined();<NEW_LINE>if (db == null) {<NEW_LINE>return item;<NEW_LINE>}<NEW_LINE>OSecurityInternal security = db<MASK><NEW_LINE>if (isReadRestrictedBySecurityPolicy(indexClass, db, security)) {<NEW_LINE>item = item.getRecord();<NEW_LINE>}<NEW_LINE>if (item == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (idx.getDefinition().getFields().size() == 1) {<NEW_LINE>String indexProp = idx.getDefinition().getFields().get(0);<NEW_LINE>if (isLabelSecurityDefined(db, security, indexClass, indexProp)) {<NEW_LINE>item = item.getRecord();<NEW_LINE>if (item == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!(item instanceof ODocument)) {<NEW_LINE>return item;<NEW_LINE>}<NEW_LINE>OPropertyAccess access = ODocumentInternal.getPropertyAccess((ODocument) item);<NEW_LINE>if (access != null && !access.isReadable(indexProp)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return item;<NEW_LINE>} | .getSharedContext().getSecurity(); |
273,049 | public ApiResponse<FileShare> fileSharesPutWithHttpInfo(String id, UpdateShareRequest updateFileShareRequest) throws ApiException {<NEW_LINE>Object localVarPostBody = updateFileShareRequest;<NEW_LINE>// verify the required parameter 'id' is set<NEW_LINE>if (id == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// verify the required parameter 'updateFileShareRequest' is set<NEW_LINE>if (updateFileShareRequest == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'updateFileShareRequest' when calling fileSharesPut");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/fileshares/{id}".replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "text/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = { "application/json", "text/json" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>GenericType<FileShare> localVarReturnType = new GenericType<FileShare>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | throw new ApiException(400, "Missing the required parameter 'id' when calling fileSharesPut"); |
955,578 | private Runnable createFinishCommitInEDTRunnable(@Nonnull final CommitTask task, final boolean synchronously, @Nonnull List<? extends BooleanRunnable> finishProcessors, @Nonnull List<? extends BooleanRunnable> reparseInjectedProcessors) {<NEW_LINE>return () -> {<NEW_LINE>ApplicationManager<MASK><NEW_LINE>Document document = task.getDocument();<NEW_LINE>Project project = task.project;<NEW_LINE>PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase) PsiDocumentManager.getInstance(project);<NEW_LINE>boolean committed = project.isDisposed() || documentManager.isCommitted(document);<NEW_LINE>synchronized (lock) {<NEW_LINE>documentsToApplyInEDT.remove(task);<NEW_LINE>if (committed) {<NEW_LINE>log(project, "Marked as already committed in EDT apply queue, return", task);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean changeStillValid = task.isStillValid();<NEW_LINE>boolean success = changeStillValid && documentManager.finishCommit(document, finishProcessors, reparseInjectedProcessors, synchronously, task.reason);<NEW_LINE>if (synchronously) {<NEW_LINE>assert success;<NEW_LINE>}<NEW_LINE>if (!changeStillValid) {<NEW_LINE>log(project, "document changed; ignore", task);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (synchronously || success) {<NEW_LINE>assert !documentManager.isInUncommittedSet(document);<NEW_LINE>}<NEW_LINE>if (success) {<NEW_LINE>log(project, "Commit finished", task);<NEW_LINE>} else {<NEW_LINE>// add document back to the queue<NEW_LINE>commitAsynchronously(project, document, "Re-added back", task.myCreationContext);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | .getApplication().assertIsDispatchThread(); |
573,478 | private void save(ServerLongLongRow row, PSMatrixSaveContext saveContext, MatrixPartitionMeta meta, DataOutputStream out) throws IOException {<NEW_LINE>long startCol = meta.getStartCol();<NEW_LINE>if (ServerRowUtils.getVector(row) instanceof IntLongVector) {<NEW_LINE>IntLongVector vector = (IntLongVector) ServerRowUtils.getVector(row);<NEW_LINE>if (vector.isDense()) {<NEW_LINE>long[] data = vector.getStorage().getValues();<NEW_LINE>for (int i = 0; i < data.length; i++) {<NEW_LINE>out.writeLong(data[i]);<NEW_LINE>}<NEW_LINE>} else if (vector.isSorted()) {<NEW_LINE>int[] indices = vector.getStorage().getIndices();<NEW_LINE>long[] values = vector.getStorage().getValues();<NEW_LINE>for (int i = 0; i < indices.length; i++) {<NEW_LINE>out.writeLong(indices[i] + startCol);<NEW_LINE>out<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ObjectIterator<Int2LongMap.Entry> iter = vector.getStorage().entryIterator();<NEW_LINE>Int2LongMap.Entry entry;<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>entry = iter.next();<NEW_LINE>out.writeLong(entry.getIntKey() + startCol);<NEW_LINE>out.writeLong(entry.getLongValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LongLongVector vector = (LongLongVector) ServerRowUtils.getVector(row);<NEW_LINE>if (vector.isSorted()) {<NEW_LINE>long[] indices = vector.getStorage().getIndices();<NEW_LINE>long[] values = vector.getStorage().getValues();<NEW_LINE>for (int i = 0; i < indices.length; i++) {<NEW_LINE>out.writeLong(indices[i] + startCol);<NEW_LINE>out.writeLong(values[i]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ObjectIterator<Long2LongMap.Entry> iter = vector.getStorage().entryIterator();<NEW_LINE>Long2LongMap.Entry entry;<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>entry = iter.next();<NEW_LINE>out.writeLong(entry.getLongKey() + startCol);<NEW_LINE>out.writeLong(entry.getLongValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .writeLong(values[i]); |
783,457 | final ListSizeConstraintSetsResult executeListSizeConstraintSets(ListSizeConstraintSetsRequest listSizeConstraintSetsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listSizeConstraintSetsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListSizeConstraintSetsRequest> request = null;<NEW_LINE>Response<ListSizeConstraintSetsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListSizeConstraintSetsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listSizeConstraintSetsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "WAF");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSizeConstraintSets");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListSizeConstraintSetsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListSizeConstraintSetsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
313,616 | private Pane openPane(boolean reuse) {<NEW_LINE>Pane ce = null;<NEW_LINE>boolean displayMsgOpened = false;<NEW_LINE>synchronized (getLock()) {<NEW_LINE>ce = getAnyEditor();<NEW_LINE>if (ce == null) {<NEW_LINE>// no opened editor<NEW_LINE>String msg = messageOpening();<NEW_LINE>if (msg != null) {<NEW_LINE>StatusDisplayer.getDefault().setStatusText(msg);<NEW_LINE>}<NEW_LINE>// initializes the document if not initialized<NEW_LINE>prepareDocument();<NEW_LINE>ce = createPane();<NEW_LINE>ce.getComponent().putClientProperty(PROP_PANE, ce);<NEW_LINE>ce.<MASK><NEW_LINE>// signal opened msg should be displayed after subsequent open finishes<NEW_LINE>displayMsgOpened = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// #36601 - open moved outside getLock() synchronization<NEW_LINE>CloneableTopComponent ctc = ce.getComponent();<NEW_LINE>if (reuse && displayMsgOpened) {<NEW_LINE>CloneableTopComponent last = lastReusable.get();<NEW_LINE>if (last != null) {<NEW_LINE>replaceTc(last, ctc);<NEW_LINE>} else {<NEW_LINE>ctc.open();<NEW_LINE>}<NEW_LINE>lastReusable = new WeakReference<CloneableTopComponent>(ctc);<NEW_LINE>} else {<NEW_LINE>ctc.open();<NEW_LINE>}<NEW_LINE>if (displayMsgOpened) {<NEW_LINE>String msg = messageOpened();<NEW_LINE>if (msg == null) {<NEW_LINE>// NOI18N<NEW_LINE>msg = "";<NEW_LINE>}<NEW_LINE>StatusDisplayer.getDefault().setStatusText(msg);<NEW_LINE>}<NEW_LINE>return ce;<NEW_LINE>} | getComponent().setReference(allEditors); |
1,416,516 | protected CompletableFuture<?> processMessage(Gadp.RootMessage msg) {<NEW_LINE>switch(msg.getMsgCase()) {<NEW_LINE>case CONNECT_REQUEST:<NEW_LINE>return processConnect(msg.getSequence(), msg.getConnectRequest());<NEW_LINE>case PING_REQUEST:<NEW_LINE>return processPing(msg.getSequence(), msg.getPingRequest());<NEW_LINE>case ATTACH_REQUEST:<NEW_LINE>return processAttach(msg.getSequence(), msg.getAttachRequest());<NEW_LINE>case BREAK_CREATE_REQUEST:<NEW_LINE>return processBreakCreate(msg.getSequence(), msg.getBreakCreateRequest());<NEW_LINE>case BREAK_TOGGLE_REQUEST:<NEW_LINE>return processBreakToggle(msg.getSequence(), msg.getBreakToggleRequest());<NEW_LINE>case CACHE_INVALIDATE_REQUEST:<NEW_LINE>return processCacheInvalidate(msg.getSequence(<MASK><NEW_LINE>case CONFIGURE_REQUEST:<NEW_LINE>return processConfigure(msg.getSequence(), msg.getConfigureRequest());<NEW_LINE>case DELETE_REQUEST:<NEW_LINE>return processDelete(msg.getSequence(), msg.getDeleteRequest());<NEW_LINE>case DETACH_REQUEST:<NEW_LINE>return processDetach(msg.getSequence(), msg.getDetachRequest());<NEW_LINE>case EXECUTE_REQUEST:<NEW_LINE>return processExecute(msg.getSequence(), msg.getExecuteRequest());<NEW_LINE>case FOCUS_REQUEST:<NEW_LINE>return processFocus(msg.getSequence(), msg.getFocusRequest());<NEW_LINE>case INTERRUPT_REQUEST:<NEW_LINE>return processInterrupt(msg.getSequence(), msg.getInterruptRequest());<NEW_LINE>case INVOKE_REQUEST:<NEW_LINE>return processInvoke(msg.getSequence(), msg.getInvokeRequest());<NEW_LINE>case KILL_REQUEST:<NEW_LINE>return processKill(msg.getSequence(), msg.getKillRequest());<NEW_LINE>case LAUNCH_REQUEST:<NEW_LINE>return processLaunch(msg.getSequence(), msg.getLaunchRequest());<NEW_LINE>case MEMORY_READ_REQUEST:<NEW_LINE>return processMemoryRead(msg.getSequence(), msg.getMemoryReadRequest());<NEW_LINE>case MEMORY_WRITE_REQUEST:<NEW_LINE>return processMemoryWrite(msg.getSequence(), msg.getMemoryWriteRequest());<NEW_LINE>case REGISTER_READ_REQUEST:<NEW_LINE>return processRegisterRead(msg.getSequence(), msg.getRegisterReadRequest());<NEW_LINE>case REGISTER_WRITE_REQUEST:<NEW_LINE>return processRegisterWrite(msg.getSequence(), msg.getRegisterWriteRequest());<NEW_LINE>case RESYNC_REQUEST:<NEW_LINE>return processResync(msg.getSequence(), msg.getResyncRequest());<NEW_LINE>case RESUME_REQUEST:<NEW_LINE>return processResume(msg.getSequence(), msg.getResumeRequest());<NEW_LINE>case STEP_REQUEST:<NEW_LINE>return processStep(msg.getSequence(), msg.getStepRequest());<NEW_LINE>case ACTIVATION_REQUEST:<NEW_LINE>return processActivation(msg.getSequence(), msg.getActivationRequest());<NEW_LINE>default:<NEW_LINE>throw new GadpErrorException(Gadp.ErrorCode.EC_BAD_REQUEST, "Unrecognized request: " + msg.getMsgCase());<NEW_LINE>}<NEW_LINE>} | ), msg.getCacheInvalidateRequest()); |
979,163 | protected void onCreate(@Nullable Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_home);<NEW_LINE>folioReader = FolioReader.get().setOnHighlightListener(this).setReadLocatorListener(this).setOnClosedListener(this);<NEW_LINE>getHighlightsAndSave();<NEW_LINE>findViewById(R.id.btn_raw).setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>Config config = AppUtil.getSavedConfig(getApplicationContext());<NEW_LINE>if (config == null)<NEW_LINE>config = new Config();<NEW_LINE>config.setAllowedDirection(Config.AllowedDirection.VERTICAL_AND_HORIZONTAL);<NEW_LINE>folioReader.setConfig(config, true).<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>findViewById(R.id.btn_assest).setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>ReadLocator readLocator = getLastReadLocator();<NEW_LINE>Config config = AppUtil.getSavedConfig(getApplicationContext());<NEW_LINE>if (config == null)<NEW_LINE>config = new Config();<NEW_LINE>config.setAllowedDirection(Config.AllowedDirection.VERTICAL_AND_HORIZONTAL);<NEW_LINE>folioReader.setReadLocator(readLocator);<NEW_LINE>folioReader.setConfig(config, true).openBook("file:///android_asset/TheSilverChair.epub");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | openBook(R.raw.accessible_epub_3); |
1,445,550 | public GenericTrigger createTableTriggerImpl(@NotNull JDBCSession session, @NotNull GenericStructContainer container, @NotNull GenericTableBase parent, String triggerName, @NotNull JDBCResultSet dbResult) throws DBException {<NEW_LINE>if (CommonUtils.isEmpty(triggerName)) {<NEW_LINE>triggerName = JDBCUtils.safeGetStringTrimmed(dbResult, "RDB$TRIGGER_NAME");<NEW_LINE>}<NEW_LINE>if (triggerName == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>int sequence = JDBCUtils.safeGetInt(dbResult, "RDB$TRIGGER_SEQUENCE");<NEW_LINE>int type = JDBCUtils.safeGetInt(dbResult, "RDB$TRIGGER_TYPE");<NEW_LINE>String description = JDBCUtils.safeGetStringTrimmed(dbResult, "RDB$DESCRIPTION");<NEW_LINE>int systemFlag = <MASK><NEW_LINE>// System flag value 0 - if user-defined and 1 or more if system<NEW_LINE>boolean isSystem = systemFlag > 0;<NEW_LINE>return new FireBirdTableTrigger(parent, triggerName, description, FireBirdTriggerType.getByType(type), sequence, isSystem);<NEW_LINE>} | JDBCUtils.safeGetInt(dbResult, "RDB$SYSTEM_FLAG"); |
608,902 | public static Spanned parseSimpleHtml(final Context c, String source, final TextView textView) {<NEW_LINE>source = source.replaceAll("<li>", "\t\u0095 ");<NEW_LINE>source = source.replaceAll("</li>", "<br>");<NEW_LINE>Spanned html = Html.fromHtml(source, Html.FROM_HTML_MODE_COMPACT, source1 -> {<NEW_LINE>LevelListDrawable d = new LevelListDrawable();<NEW_LINE>Drawable empty = c.getResources().getDrawable(R.drawable.ic_no_image, null);<NEW_LINE>d.addLevel(0, 0, empty);<NEW_LINE>assert empty != null;<NEW_LINE>d.setBounds(0, 0, empty.getIntrinsicWidth(), empty.getIntrinsicHeight());<NEW_LINE>new ImageGetterAsyncTask(c, source1, d).execute(textView);<NEW_LINE>return d;<NEW_LINE>}, null);<NEW_LINE>// trim trailing newlines<NEW_LINE><MASK><NEW_LINE>int end = len;<NEW_LINE>for (int i = len - 1; i >= 0; i--) {<NEW_LINE>if (html.charAt(i) != '\n')<NEW_LINE>break;<NEW_LINE>end = i;<NEW_LINE>}<NEW_LINE>if (end == len)<NEW_LINE>return html;<NEW_LINE>else<NEW_LINE>return new SpannableStringBuilder(html, 0, end);<NEW_LINE>} | int len = html.length(); |
219,223 | public okhttp3.Call readNamespacedEventCall(String name, String namespace, String pretty, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}".replaceAll("\\{" + "name" + "\\}", localVarApiClient.escapeString(name.toString())).replaceAll("\\{" + "namespace" + "\\}", localVarApiClient.escapeString(namespace.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (pretty != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("pretty", pretty));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" };<NEW_LINE>final String <MASK><NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "BearerToken" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); |
1,025,714 | protected InputStream openFile(String path) throws IOException {<NEW_LINE>if ("pack.mcmeta".equals(path)) {<NEW_LINE>return new ByteArrayInputStream("{\"pack\": {\"description\": \"ReplayMod language files\", \"pack_format\": 4}}".getBytes(StandardCharsets.UTF_8));<NEW_LINE>}<NEW_LINE>Path langPath = langPath(path);<NEW_LINE>if (langPath == null)<NEW_LINE>throw new ResourceNotFoundException(this.base, path);<NEW_LINE>List<String> langFile;<NEW_LINE>try (InputStream in = Files.newInputStream(langPath)) {<NEW_LINE>langFile = IOUtils.<MASK><NEW_LINE>}<NEW_LINE>Map<String, String> properties = new HashMap<>();<NEW_LINE>for (String line : langFile) {<NEW_LINE>if (line.trim().isEmpty() || line.trim().startsWith("#"))<NEW_LINE>continue;<NEW_LINE>int i = line.indexOf('=');<NEW_LINE>String key = line.substring(0, i);<NEW_LINE>String value = line.substring(i + 1);<NEW_LINE>value = convertValue(value);<NEW_LINE>// #if MC>=11400<NEW_LINE>if (key.startsWith(LEGACY_KEY_PREFIX)) {<NEW_LINE>// Duplicating instead of just remapping as some other part of the UI may still rely on the old key<NEW_LINE>properties.put(key, value);<NEW_LINE>key = String.format(FABRIC_KEY_FORMAT, key.substring(LEGACY_KEY_PREFIX.length()));<NEW_LINE>}<NEW_LINE>// #endif<NEW_LINE>properties.put(key, value);<NEW_LINE>}<NEW_LINE>return new ByteArrayInputStream(GSON.toJson(properties).getBytes(StandardCharsets.UTF_8));<NEW_LINE>} | readLines(in, StandardCharsets.UTF_8); |
1,659,117 | public void initSubDevices() {<NEW_LINE>ModelFactory factory = ModelFactory.eINSTANCE;<NEW_LINE>IndustrialDualAnalogInChannel channel0 = factory.createIndustrialDualAnalogInChannel();<NEW_LINE>channel0.setChannelNum((short) 0);<NEW_LINE>channel0.setUid(getUid());<NEW_LINE>String subIdChannel0 = "channel0";<NEW_LINE>logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdChannel0);<NEW_LINE>channel0.setSubId(subIdChannel0);<NEW_LINE>channel0.init();<NEW_LINE>channel0.setMbrick(this);<NEW_LINE>IndustrialDualAnalogInChannel channel1 = factory.createIndustrialDualAnalogInChannel();<NEW_LINE>channel1<MASK><NEW_LINE>channel1.setUid(getUid());<NEW_LINE>String subIdChannel1 = "channel1";<NEW_LINE>logger.debug("{} addSubDevice {}", LoggerConstants.TFINIT, subIdChannel1);<NEW_LINE>channel1.setSubId(subIdChannel1);<NEW_LINE>channel1.init();<NEW_LINE>channel1.setMbrick(this);<NEW_LINE>} | .setChannelNum((short) 1); |
176,164 | public void refineReprojection(List<DMatrixRMaj> cameras1, List<Point4D_F64> scene1, List<Point4D_F64> scene2, DMatrixRMaj H) {<NEW_LINE>if (H.numCols != 4 || H.numRows != 4)<NEW_LINE>throw new IllegalArgumentException("Expected 4x4 matrix for H");<NEW_LINE>if (scene1.size() != scene2.size() || scene1.size() <= 0)<NEW_LINE>throw new IllegalArgumentException("Lists must have equal size and be not empty");<NEW_LINE>if (cameras1.isEmpty())<NEW_LINE>throw new IllegalArgumentException("Camera must not be empty");<NEW_LINE>distanceRepojection.cameras1 = cameras1;<NEW_LINE>distanceRepojection.scene1 = scene1;<NEW_LINE>distanceRepojection.scene2 = scene2;<NEW_LINE>lm.setFunction(distanceRepojection, null);<NEW_LINE>lm.initialize(H.data, <MASK><NEW_LINE>UtilOptimize.process(lm, configConverge.maxIterations);<NEW_LINE>System.arraycopy(lm.getParameters(), 0, H.data, 0, 16);<NEW_LINE>} | configConverge.ftol, configConverge.gtol); |
1,140,667 | private VmDataCommand generateVmDataCommand(String vmPrivateIpAddress, String userData, String serviceOffering, String zoneName, String guestIpAddress, String vmName, String vmInstanceName, long vmId, String vmUuid, String publicKey, String hostname) {<NEW_LINE>VmDataCommand cmd = new VmDataCommand(vmPrivateIpAddress, vmName, _networkMgr.getExecuteInSeqNtwkElmtCmd());<NEW_LINE>// if you add new metadata files, also edit systemvm/patches/debian/config/var/www/html/latest/.htaccess<NEW_LINE>cmd.addVmData("userdata", "user-data", userData);<NEW_LINE>cmd.addVmData("metadata", "service-offering", serviceOffering);<NEW_LINE>cmd.addVmData("metadata", "availability-zone", zoneName);<NEW_LINE>cmd.<MASK><NEW_LINE>cmd.addVmData("metadata", "local-hostname", vmName);<NEW_LINE>cmd.addVmData("metadata", "public-ipv4", guestIpAddress);<NEW_LINE>cmd.addVmData("metadata", "public-hostname", guestIpAddress);<NEW_LINE>if (vmUuid == null) {<NEW_LINE>setVmInstanceId(vmInstanceName, vmId, cmd);<NEW_LINE>} else {<NEW_LINE>setVmInstanceId(vmUuid, cmd);<NEW_LINE>}<NEW_LINE>cmd.addVmData("metadata", "public-keys", publicKey);<NEW_LINE>cmd.addVmData("metadata", "hypervisor-host-name", hostname);<NEW_LINE>return cmd;<NEW_LINE>} | addVmData("metadata", "local-ipv4", guestIpAddress); |
1,212,038 | final ImportHypervisorConfigurationResult executeImportHypervisorConfiguration(ImportHypervisorConfigurationRequest importHypervisorConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(importHypervisorConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ImportHypervisorConfigurationRequest> request = null;<NEW_LINE>Response<ImportHypervisorConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ImportHypervisorConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(importHypervisorConfigurationRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Backup Gateway");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ImportHypervisorConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ImportHypervisorConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ImportHypervisorConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,487,079 | public void load() {<NEW_LINE>ExUtil.asyncRun(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>MapPack out = null;<NEW_LINE>final List<HeapHistoData> datas = new ArrayList<HeapHistoData>();<NEW_LINE>TcpProxy <MASK><NEW_LINE>try {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE>param.put("objHash", objHash);<NEW_LINE>out = (MapPack) tcp.getSingle(RequestCmd.OBJECT_HEAPHISTO, param);<NEW_LINE>if (out == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String error = out.getText("error");<NEW_LINE>if (error != null) {<NEW_LINE>ConsoleProxy.errorSafe(error);<NEW_LINE>}<NEW_LINE>ListValue lv = out.getList("heaphisto");<NEW_LINE>if (lv == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < lv.size(); i++) {<NEW_LINE>HeapHistoData data = new HeapHistoData();<NEW_LINE>String[] tokens = StringUtil.tokenizer(lv.getString(i), " ");<NEW_LINE>if (tokens == null || tokens.length < 4) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String index = removeNotDigit(tokens[0]);<NEW_LINE>data.no = CastUtil.cint(index);<NEW_LINE>data.count = CastUtil.cint(tokens[1]);<NEW_LINE>data.size = CastUtil.clong(tokens[2]);<NEW_LINE>data.name = getCanonicalName(tokens[3]);<NEW_LINE>datas.add(data);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>ConsoleProxy.errorSafe(e.toString());<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(tcp);<NEW_LINE>}<NEW_LINE>ExUtil.exec(viewer.getTable(), new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>viewer.setInput(datas);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | tcp = TcpProxy.getTcpProxy(serverId); |
1,271,271 | private List<Path> normalizePathsInCommandLineProperties(final String propertyName, final boolean multi) {<NEW_LINE>if (!this.commandLineProperties.containsKey(propertyName)) {<NEW_LINE>return Collections.unmodifiableList(new ArrayList<Path>());<NEW_LINE>}<NEW_LINE>final String property = <MASK><NEW_LINE>if (property == null || property.isEmpty()) {<NEW_LINE>return Collections.unmodifiableList(new ArrayList<Path>());<NEW_LINE>}<NEW_LINE>final List<String> pathStrings = splitPathStrings(property, multi);<NEW_LINE>final ArrayList<Path> paths = new ArrayList<>();<NEW_LINE>for (final String pathString : pathStrings) {<NEW_LINE>if (pathString.isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final Path path;<NEW_LINE>try {<NEW_LINE>path = Paths.get(pathString);<NEW_LINE>} catch (final InvalidPathException ex) {<NEW_LINE>logger.error("Embulk system property \"" + propertyName + "\" in command-line is invalid: \"" + pathString + "\"", ex);<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>final Path absolute;<NEW_LINE>if (path.isAbsolute()) {<NEW_LINE>absolute = path;<NEW_LINE>} else {<NEW_LINE>absolute = path.toAbsolutePath();<NEW_LINE>}<NEW_LINE>final Path normalized = absolute.normalize();<NEW_LINE>if (!normalized.equals(path)) {<NEW_LINE>logger.warn("Embulk system property \"" + propertyName + "\" in command-line is not normalized: " + "\"" + pathString + "\", " + "then resolved to: \"" + normalized.toString() + "\"");<NEW_LINE>}<NEW_LINE>// Symbolic links are intentionally NOT resolved with Path#toRealPath.<NEW_LINE>paths.add(normalized);<NEW_LINE>}<NEW_LINE>return Collections.unmodifiableList(paths);<NEW_LINE>} | this.commandLineProperties.getProperty(propertyName); |
1,118,687 | private void addPlasticBlocks() {<NEW_LINE>addToTags(AdditionsTags.Items.PLASTIC_BLOCKS_PLASTIC, AdditionsTags.Blocks.PLASTIC_BLOCKS_PLASTIC, AdditionsBlocks.PLASTIC_BLOCKS);<NEW_LINE>addToTags(AdditionsTags.Items.PLASTIC_BLOCKS_SLICK, AdditionsTags.Blocks.PLASTIC_BLOCKS_SLICK, AdditionsBlocks.SLICK_PLASTIC_BLOCKS);<NEW_LINE>addToTags(AdditionsTags.Items.PLASTIC_BLOCKS_GLOW, AdditionsTags.Blocks.PLASTIC_BLOCKS_GLOW, AdditionsBlocks.PLASTIC_GLOW_BLOCKS);<NEW_LINE>addToTags(AdditionsTags.Items.PLASTIC_BLOCKS_ROAD, AdditionsTags.Blocks.PLASTIC_BLOCKS_ROAD, AdditionsBlocks.PLASTIC_ROADS);<NEW_LINE>addToTags(AdditionsTags.Items.PLASTIC_BLOCKS_REINFORCED, AdditionsTags.Blocks.PLASTIC_BLOCKS_REINFORCED, AdditionsBlocks.REINFORCED_PLASTIC_BLOCKS);<NEW_LINE>addToTags(AdditionsTags.Items.PLASTIC_BLOCKS_TRANSPARENT, AdditionsTags.Blocks.PLASTIC_BLOCKS_TRANSPARENT, AdditionsBlocks.TRANSPARENT_PLASTIC_BLOCKS);<NEW_LINE>getItemBuilder(AdditionsTags.Items.PLASTIC_BLOCKS).add(AdditionsTags.Items.PLASTIC_BLOCKS_GLOW, AdditionsTags.Items.PLASTIC_BLOCKS_PLASTIC, AdditionsTags.Items.PLASTIC_BLOCKS_REINFORCED, AdditionsTags.Items.PLASTIC_BLOCKS_ROAD, AdditionsTags.Items.PLASTIC_BLOCKS_SLICK, AdditionsTags.Items.PLASTIC_BLOCKS_TRANSPARENT);<NEW_LINE>getBlockBuilder(AdditionsTags.Blocks.PLASTIC_BLOCKS).add(AdditionsTags.Blocks.PLASTIC_BLOCKS_GLOW, AdditionsTags.Blocks.PLASTIC_BLOCKS_PLASTIC, AdditionsTags.Blocks.PLASTIC_BLOCKS_REINFORCED, AdditionsTags.Blocks.PLASTIC_BLOCKS_ROAD, AdditionsTags.Blocks.<MASK><NEW_LINE>} | PLASTIC_BLOCKS_SLICK, AdditionsTags.Blocks.PLASTIC_BLOCKS_TRANSPARENT); |
1,564,715 | final CreateReceiptRuleSetResult executeCreateReceiptRuleSet(CreateReceiptRuleSetRequest createReceiptRuleSetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createReceiptRuleSetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateReceiptRuleSetRequest> request = null;<NEW_LINE>Response<CreateReceiptRuleSetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateReceiptRuleSetRequestMarshaller().marshall(super.beforeMarshalling(createReceiptRuleSetRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SES");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateReceiptRuleSet");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<CreateReceiptRuleSetResult> responseHandler = new StaxResponseHandler<CreateReceiptRuleSetResult>(new CreateReceiptRuleSetResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
968,762 | public void loadSamples(SampleLoader sampleLoader) {<NEW_LINE>LOG.info("Starting loading samples.");<NEW_LINE>long startMs = System.currentTimeMillis();<NEW_LINE>AtomicLong numPartitionMetricSamples = new AtomicLong(0L);<NEW_LINE>AtomicLong numBrokerMetricSamples = new AtomicLong(0L);<NEW_LINE>AtomicLong totalSamples = new AtomicLong(0L);<NEW_LINE>AtomicLong numLoadedSamples = new AtomicLong(0L);<NEW_LINE>try {<NEW_LINE>prepareConsumers();<NEW_LINE>for (Consumer<byte[], byte[]> consumer : _consumers) {<NEW_LINE>_metricProcessorExecutor.submit(new MetricLoader(consumer, sampleLoader, numLoadedSamples, numPartitionMetricSamples, numBrokerMetricSamples, totalSamples));<NEW_LINE>}<NEW_LINE>// Blocking waiting for the metric loading to finish.<NEW_LINE>_metricProcessorExecutor.shutdown();<NEW_LINE>_metricProcessorExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>} finally {<NEW_LINE>_consumers.forEach(Consumer::close);<NEW_LINE>try {<NEW_LINE>_metricProcessorExecutor.awaitTermination(30000, TimeUnit.MILLISECONDS);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>LOG.warn("Interrupted during waiting for metrics processor to shutdown.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long endMs = System.currentTimeMillis();<NEW_LINE>long addedPartitionSampleCount = sampleLoader.partitionSampleCount();<NEW_LINE>long addedBrokerSampleCount = sampleLoader.brokerSampleCount();<NEW_LINE>long discardedPartitionMetricSamples = numPartitionMetricSamples.get() - addedPartitionSampleCount;<NEW_LINE>long discardedBrokerMetricSamples = numBrokerMetricSamples.get() - addedBrokerSampleCount;<NEW_LINE>LOG.info("Sample loading finished. Loaded {}{} partition metrics samples and {}{} broker metric samples in {} ms.", addedPartitionSampleCount, discardedPartitionMetricSamples > 0 ? String.format("(%d discarded)", discardedPartitionMetricSamples) : "", sampleLoader.brokerSampleCount(), discardedBrokerMetricSamples > 0 ? String.format("(%d discarded)", discardedBrokerMetricSamples) : "", endMs - startMs);<NEW_LINE>} | LOG.error("Received exception when loading samples", e); |
419,001 | final ListCuratedEnvironmentImagesResult executeListCuratedEnvironmentImages(ListCuratedEnvironmentImagesRequest listCuratedEnvironmentImagesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listCuratedEnvironmentImagesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListCuratedEnvironmentImagesRequest> request = null;<NEW_LINE>Response<ListCuratedEnvironmentImagesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListCuratedEnvironmentImagesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listCuratedEnvironmentImagesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeBuild");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListCuratedEnvironmentImages");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListCuratedEnvironmentImagesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListCuratedEnvironmentImagesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,764,082 | private // @param verifyChecksum if true the actual element data will be read + checksumed and compared to written checksum<NEW_LINE>void readNextElement(long expectedSeqNum, boolean verifyChecksum) throws MmapPageIOV2.PageIOInvalidElementException {<NEW_LINE>// if there is no room for the seqNum and length bytes stop here<NEW_LINE>if (this.head + MmapPageIOV2.SEQNUM_SIZE + MmapPageIOV2.LENGTH_SIZE > capacity) {<NEW_LINE>throw new MmapPageIOV2.PageIOInvalidElementException("cannot read seqNum and length bytes past buffer capacity");<NEW_LINE>}<NEW_LINE>int elementOffset = this.head;<NEW_LINE>int newHead = this.head;<NEW_LINE>long seqNum = buffer.getLong();<NEW_LINE>newHead += MmapPageIOV2.SEQNUM_SIZE;<NEW_LINE>if (seqNum != expectedSeqNum) {<NEW_LINE>throw new MmapPageIOV2.PageIOInvalidElementException(String.format("Element seqNum %d is expected to be %d", seqNum, expectedSeqNum));<NEW_LINE>}<NEW_LINE>int length = buffer.getInt();<NEW_LINE>newHead += MmapPageIOV2.LENGTH_SIZE;<NEW_LINE>// length must be > 0<NEW_LINE>if (length <= 0) {<NEW_LINE>throw new MmapPageIOV2.PageIOInvalidElementException("Element invalid length");<NEW_LINE>}<NEW_LINE>// if there is no room for the proposed data length and checksum just stop here<NEW_LINE>if (newHead + length + MmapPageIOV2.CHECKSUM_SIZE > capacity) {<NEW_LINE>throw new MmapPageIOV2.PageIOInvalidElementException("cannot read element payload and checksum past buffer capacity");<NEW_LINE>}<NEW_LINE>if (verifyChecksum) {<NEW_LINE>// read data and compute checksum;<NEW_LINE>this.checkSummer.reset();<NEW_LINE>final int prevLimit = buffer.limit();<NEW_LINE>buffer.limit(<MASK><NEW_LINE>this.checkSummer.update(buffer);<NEW_LINE>buffer.limit(prevLimit);<NEW_LINE>int checksum = buffer.getInt();<NEW_LINE>int computedChecksum = (int) this.checkSummer.getValue();<NEW_LINE>if (computedChecksum != checksum) {<NEW_LINE>throw new MmapPageIOV2.PageIOInvalidElementException("Element invalid checksum");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// at this point we recovered a valid element<NEW_LINE>this.offsetMap.add(elementOffset);<NEW_LINE>this.head = newHead + length + MmapPageIOV2.CHECKSUM_SIZE;<NEW_LINE>buffer.position(this.head);<NEW_LINE>} | buffer.position() + length); |
746,509 | protected Failable<ImmutableList<RequestMapping>> compute() {<NEW_LINE>Set<String<MASK><NEW_LINE>if (targets != null && !targets.isEmpty()) {<NEW_LINE>if (targets.size() == 1) {<NEW_LINE>String target = targets.iterator().next();<NEW_LINE>ActuatorClient client = JMXActuatorClient.forUrl(getTypeLookup(), () -> target);<NEW_LINE>List<RequestMapping> list = client.getRequestMappings();<NEW_LINE>if (list != null) {<NEW_LINE>return Failable.of(ImmutableList.copyOf(client.getRequestMappings()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return Failable.error(buffer -> buffer.p("More than one child can provide live data. Please select one."));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Failable.error(getBootDashModel().getRunTarget().getType().getMissingLiveInfoMessages().getMissingInfoMessage(getStyledName(null).getString(), "mappings"));<NEW_LINE>} | > targets = actuatorUrls.getValue(); |
1,620,017 | public void handleInboundPubrec(@NotNull final ChannelHandlerContext ctx, @NotNull final PUBREC pubrec) {<NEW_LINE>final Channel channel = ctx.channel();<NEW_LINE>final ClientConnection clientConnection = channel.attr(<MASK><NEW_LINE>final String clientId = clientConnection.getClientId();<NEW_LINE>if (clientId == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ClientContextImpl clientContext = clientConnection.getExtensionClientContext();<NEW_LINE>if (clientContext == null) {<NEW_LINE>ctx.fireChannelRead(pubrec);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final List<PubrecInboundInterceptor> interceptors = clientContext.getPubrecInboundInterceptors();<NEW_LINE>if (interceptors.isEmpty()) {<NEW_LINE>ctx.fireChannelRead(pubrec);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ClientInformation clientInfo = ExtensionInformationUtil.getAndSetClientInformation(channel, clientId);<NEW_LINE>final ConnectionInformation connectionInfo = ExtensionInformationUtil.getAndSetConnectionInformation(channel);<NEW_LINE>final PubrecPacketImpl packet = new PubrecPacketImpl(pubrec);<NEW_LINE>final PubrecInboundInputImpl input = new PubrecInboundInputImpl(clientInfo, connectionInfo, packet);<NEW_LINE>final ExtensionParameterHolder<PubrecInboundInputImpl> inputHolder = new ExtensionParameterHolder<>(input);<NEW_LINE>final ModifiablePubrecPacketImpl modifiablePacket = new ModifiablePubrecPacketImpl(packet, configurationService);<NEW_LINE>final PubrecInboundOutputImpl output = new PubrecInboundOutputImpl(asyncer, modifiablePacket);<NEW_LINE>final ExtensionParameterHolder<PubrecInboundOutputImpl> outputHolder = new ExtensionParameterHolder<>(output);<NEW_LINE>final PubrecInboundInterceptorContext context = new PubrecInboundInterceptorContext(clientId, interceptors.size(), ctx, inputHolder, outputHolder);<NEW_LINE>for (final PubrecInboundInterceptor interceptor : interceptors) {<NEW_LINE>final HiveMQExtension extension = hiveMQExtensions.getExtensionForClassloader(interceptor.getClass().getClassLoader());<NEW_LINE>if (extension == null) {<NEW_LINE>// disabled extension would be null<NEW_LINE>context.finishInterceptor();<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final PubrecInboundInterceptorTask task = new PubrecInboundInterceptorTask(interceptor, extension.getId());<NEW_LINE>executorService.handlePluginInOutTaskExecution(context, inputHolder, outputHolder, task);<NEW_LINE>}<NEW_LINE>} | ChannelAttributes.CLIENT_CONNECTION).get(); |
1,402,099 | private Mono<Response<ServerAutomaticTuningInner>> updateWithResponseAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (serverName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String apiVersion = "2017-03-01-preview";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.update(this.client.getEndpoint(), resourceGroupName, serverName, this.client.getSubscriptionId(), apiVersion, parameters, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); |
1,589,674 | public static void demoPaint(final RasterPlotter m) {<NEW_LINE>m.setColor(GREY);<NEW_LINE>m.line(0, 70, 100, 70, 100);<NEW_LINE>PrintTool.print(m, 0, 65, 0, "Grey", -1, false, 100);<NEW_LINE>m.line(65, 0, 65, 300, 100);<NEW_LINE>m.setColor(RED);<NEW_LINE>m.line(0, 90, 100, 90, 100);<NEW_LINE>PrintTool.print(m, 0, 85, 0, "Red", -1, false, 100);<NEW_LINE>m.line(70, 0, 70, 300, 100);<NEW_LINE>m.setColor(GREEN);<NEW_LINE>m.line(0, 110, 100, 110, 100);<NEW_LINE>PrintTool.print(m, 0, 105, 0, "Green"<MASK><NEW_LINE>m.line(75, 0, 75, 300, 100);<NEW_LINE>m.setColor(BLUE);<NEW_LINE>m.line(0, 130, 100, 130, 100);<NEW_LINE>PrintTool.print(m, 0, 125, 0, "Blue", -1, false, 100);<NEW_LINE>m.line(80, 0, 80, 300, 100);<NEW_LINE>} | , -1, false, 100); |
822,378 | protected <T extends Block> BlockEntry<?> createEntry(AbstractRegistrate<?> registrate, Variant<T> variant, WeatherState state, boolean waxed) {<NEW_LINE>String name = "";<NEW_LINE>if (waxed) {<NEW_LINE>name += "waxed_";<NEW_LINE>}<NEW_LINE>name += getWeatherStatePrefix(state);<NEW_LINE>name += this.name;<NEW_LINE>String suffix = variant.getSuffix();<NEW_LINE>if (!suffix.equals(""))<NEW_LINE>name = Lang.nonPluralId(name);<NEW_LINE>name += suffix;<NEW_LINE>Supplier<Block> baseBlock = BASE_BLOCKS.get(state);<NEW_LINE>BlockBuilder<T, ?> builder = registrate.block(name, variant.getFactory(this, state, waxed)).initialProperties(() -> baseBlock.get()).loot((lt, block) -> variant.generateLootTable(lt, block, this, state, waxed)).blockstate((ctx, prov) -> variant.generateBlockState(ctx, prov, this, state, waxed)).recipe((c, p) -> variant.generateRecipes(entries.get(BlockVariant.INSTANCE)[state.ordinal()], c, p)).transform(AllTags.pickaxeOnly()).tag(BlockTags.NEEDS_STONE_TOOL).simpleItem();<NEW_LINE>if (variant == BlockVariant.INSTANCE && state == WeatherState.UNAFFECTED)<NEW_LINE>builder.recipe((c, p) -> mainBlockRecipe<MASK><NEW_LINE>if (waxed) {<NEW_LINE>builder.recipe((ctx, prov) -> {<NEW_LINE>Block unwaxed = get(variant, state, false).get();<NEW_LINE>ShapelessRecipeBuilder.shapeless(ctx.get()).requires(unwaxed).requires(Items.HONEYCOMB).unlockedBy("has_unwaxed", RegistrateRecipeProvider.has(unwaxed)).save(prov, new ResourceLocation(ctx.getId().getNamespace(), "crafting/" + generalDirectory + ctx.getName() + "_from_honeycomb"));<NEW_LINE>});<NEW_LINE>}<NEW_LINE>return builder.register();<NEW_LINE>} | .accept(c, p)); |
200,351 | public NameForms typeAbstract() {<NEW_LINE>if (protoclass().kind().isConstructor()) {<NEW_LINE>return typeValue();<NEW_LINE>}<NEW_LINE>List<String> classSegments = Lists.newArrayListWithExpectedSize(2);<NEW_LINE>Element e = SourceNames.collectClassSegments(protoclass().sourceElement(), classSegments);<NEW_LINE>verify(e instanceof PackageElement);<NEW_LINE>String packageOf = ((PackageElement) e)<MASK><NEW_LINE>String relative = DOT_JOINER.join(classSegments);<NEW_LINE>boolean relativeAlreadyQualified = false;<NEW_LINE>if (!implementationPackage().equals(packageOf)) {<NEW_LINE>relative = DOT_JOINER.join(packageOf, relative);<NEW_LINE>relativeAlreadyQualified = true;<NEW_LINE>}<NEW_LINE>return ImmutableConstitution.NameForms.builder().simple(names().typeAbstract).relativeRaw(relative).packageOf(packageOf).genericArgs(generics().args()).relativeAlreadyQualified(relativeAlreadyQualified).visibility(protoclass().visibility()).build();<NEW_LINE>} | .getQualifiedName().toString(); |
1,628,859 | public void beforeMountItem(final ExtensionState<IncrementalMountExtensionState> extensionState, final RenderTreeNode renderTreeNode, final int index) {<NEW_LINE>final boolean isTracing = RenderCoreSystrace.isEnabled();<NEW_LINE>if (IncrementalMountExtensionConfigs.isDebugLoggingEnabled) {<NEW_LINE>Log.d(DEBUG_TAG, "beforeMountItem [id=" + renderTreeNode.getRenderUnit(<MASK><NEW_LINE>}<NEW_LINE>if (isTracing) {<NEW_LINE>RenderCoreSystrace.beginSection("IncrementalMountExtension.beforeMountItem");<NEW_LINE>}<NEW_LINE>final long id = renderTreeNode.getRenderUnit().getId();<NEW_LINE>final IncrementalMountExtensionState state = extensionState.getState();<NEW_LINE>if (state.mInput == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final IncrementalMountOutput output = state.mInput.getIncrementalMountOutputForId(id);<NEW_LINE>if (output == null) {<NEW_LINE>throw new IllegalArgumentException("Output with id=" + id + " not found.");<NEW_LINE>}<NEW_LINE>maybeAcquireReference(extensionState, state.mPreviousLocalVisibleRect, output, false);<NEW_LINE>if (isTracing) {<NEW_LINE>RenderCoreSystrace.endSection();<NEW_LINE>}<NEW_LINE>} | ).getId() + "]"); |
1,322,699 | public static void signedMul(final long offset, final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions, final OperandSize firstOperandSize, final String firstOperand, final OperandSize secondOperandSize, final String secondOperand, final OperandSize resultOperandSize, final String resultOperand) {<NEW_LINE>final String xoredResult = environment.getNextVariableString();<NEW_LINE>final String multResult = environment.getNextVariableString();<NEW_LINE>final String toggleMask = environment.getNextVariableString();<NEW_LINE>final String xoredSigns = environment.getNextVariableString();<NEW_LINE>long baseOffset = offset;<NEW_LINE>// get the absolute Value of the operands<NEW_LINE>final Pair<String, String> abs1 = generateAbs(environment, <MASK><NEW_LINE>baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);<NEW_LINE>final Pair<String, String> abs2 = generateAbs(environment, baseOffset, secondOperand, secondOperandSize, instructions);<NEW_LINE>baseOffset = ReilHelpers.nextReilAddress(instruction, instructions);<NEW_LINE>final String firstAbs = abs1.second();<NEW_LINE>final String secondAbs = abs2.second();<NEW_LINE>// compute the multiplication<NEW_LINE>instructions.add(ReilHelpers.createMul(baseOffset++, firstOperandSize, firstAbs, secondOperandSize, secondAbs, resultOperandSize, multResult));<NEW_LINE>// Find out if the two operands had different signs and adjust the result accordingly<NEW_LINE>instructions.add(ReilHelpers.createXor(baseOffset++, firstOperandSize, abs1.first(), secondOperandSize, abs2.first(), firstOperandSize, xoredSigns));<NEW_LINE>instructions.add(ReilHelpers.createSub(baseOffset++, firstOperandSize, "0", firstOperandSize, xoredSigns, resultOperandSize, toggleMask));<NEW_LINE>instructions.add(ReilHelpers.createXor(baseOffset++, resultOperandSize, toggleMask, resultOperandSize, multResult, resultOperandSize, xoredResult));<NEW_LINE>instructions.add(ReilHelpers.createAdd(baseOffset++, resultOperandSize, xoredResult, firstOperandSize, xoredSigns, resultOperandSize, resultOperand));<NEW_LINE>} | baseOffset, firstOperand, firstOperandSize, instructions); |
188,292 | protected void handlePost(RoutingContext event, MultiMap form) throws Exception {<NEW_LINE>String datasource = form.get("datasource");<NEW_LINE>String operation = form.get("operation");<NEW_LINE>Collection<FlywayContainer> flywayContainers = new FlywayContainersSupplier().get();<NEW_LINE>for (FlywayContainer flywayContainer : flywayContainers) {<NEW_LINE>if (flywayContainer.getDataSourceName().equals(datasource)) {<NEW_LINE>Flyway flyway = flywayContainer.getFlyway();<NEW_LINE>if ("clean".equals(operation)) {<NEW_LINE>flyway.clean();<NEW_LINE>flashMessage(event, "Database cleaned");<NEW_LINE>return;<NEW_LINE>} else if ("migrate".equals(operation)) {<NEW_LINE>flyway.migrate();<NEW_LINE>flashMessage(event, "Database migrated");<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>flashMessage(event, "Invalid operation: " + operation, FlashMessageStatus.ERROR);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>flashMessage(event, <MASK><NEW_LINE>} | "Datasource not found: " + datasource, FlashMessageStatus.ERROR); |
305,218 | final NotifyAppValidationOutputResult executeNotifyAppValidationOutput(NotifyAppValidationOutputRequest notifyAppValidationOutputRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(notifyAppValidationOutputRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<NotifyAppValidationOutputRequest> request = null;<NEW_LINE>Response<NotifyAppValidationOutputResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new NotifyAppValidationOutputRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(notifyAppValidationOutputRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SMS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "NotifyAppValidationOutput");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<NotifyAppValidationOutputResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new NotifyAppValidationOutputResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
167,124 | public static <A, B, C, D, E> Promise<F.E5<A, B, C, D, E>> waitEither(Promise<A> tA, Promise<B> tB, Promise<C> tC, Promise<D> tD, Promise<E> tE) {<NEW_LINE>final Promise<F.E5<A, B, C, D, E>> result = new Promise<>();<NEW_LINE>Promise<F.Tuple<Integer, Promise<Object>>> t = waitEitherInternal(tA, tB, tC, tD, tE);<NEW_LINE>t.onRedeem(completed -> {<NEW_LINE>Tuple<Integer, Promise<Object>> value = completed.getOrNull();<NEW_LINE>switch(value._1) {<NEW_LINE>case 1:<NEW_LINE>result.invoke(E5.<A, B, C, D, E>_1((A) value._2.getOrNull()));<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>result.invoke(E5.<A, B, C, D, E>_2((B) value._2.getOrNull()));<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>result.invoke(E5.<A, B, C, D, E>_3((C) value._2.getOrNull()));<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>result.invoke(E5.<A, B, C, D, E>_4((D) value._2.getOrNull()));<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>result.invoke(E5.<A, B, C, D, E>_5((E) value<MASK><NEW_LINE>break;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return result;<NEW_LINE>} | ._2.getOrNull())); |
1,199,676 | public Settings upgradeSettings(final Settings settings) {<NEW_LINE>final Settings.Builder builder = Settings.builder();<NEW_LINE>// track if any settings were upgraded<NEW_LINE>boolean changed = false;<NEW_LINE>for (final String key : settings.keySet()) {<NEW_LINE>final Setting<?> setting = getRaw(key);<NEW_LINE>final SettingUpgrader<?> upgrader = settingUpgraders.get(setting);<NEW_LINE>if (upgrader == null) {<NEW_LINE>// the setting does not have an upgrader, copy the setting<NEW_LINE>builder.copy(key, settings);<NEW_LINE>} else {<NEW_LINE>// the setting has an upgrader, so mark that we have changed a setting and apply the upgrade logic<NEW_LINE>changed = true;<NEW_LINE>// noinspection ConstantConditions<NEW_LINE>if (setting.getConcreteSetting(key).isListSetting()) {<NEW_LINE>final List<String> value = settings.getAsList(key);<NEW_LINE>final String upgradedKey = upgrader.getKey(key);<NEW_LINE>final List<String> upgradedValue = upgrader.getListValue(value);<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>final String value = settings.get(key);<NEW_LINE>final String upgradedKey = upgrader.getKey(key);<NEW_LINE>final String upgradedValue = upgrader.getValue(value);<NEW_LINE>builder.put(upgradedKey, upgradedValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// we only return a new instance if there was an upgrade<NEW_LINE>return changed ? builder.build() : settings;<NEW_LINE>} | builder.putList(upgradedKey, upgradedValue); |
60,625 | void dump(Collection<BugPatternInstance> patterns, Writer w, Target target, Set<String> enabledChecks) throws IOException {<NEW_LINE>// (Default, Severity) -> [Pattern...]<NEW_LINE>SortedSetMultimap<IndexEntry, MiniDescription> sorted = TreeMultimap.create(comparing(IndexEntry::onByDefault, trueFirst()).thenComparing(IndexEntry::severity), Comparator.comparing(MiniDescription::name));<NEW_LINE>for (BugPatternInstance pattern : patterns) {<NEW_LINE>sorted.put(IndexEntry.create(enabledChecks.contains(pattern.name), pattern.severity), MiniDescription.create(pattern));<NEW_LINE>}<NEW_LINE>Map<String, Object> templateData = new HashMap<>();<NEW_LINE>ImmutableList<Map<String, Object>> bugpatternData = Multimaps.asMap(sorted).entrySet().stream().map(e -> ImmutableMap.of("category", e.getKey().asCategoryHeader(), "checks", e.getValue())).collect(toImmutableList());<NEW_LINE>templateData.put("bugpatterns", bugpatternData);<NEW_LINE>if (target == Target.EXTERNAL) {<NEW_LINE>ImmutableMap<String, String> frontmatterData = ImmutableMap.<String, String>builder().put("title", "Bug Patterns").put(<MASK><NEW_LINE>DumperOptions options = new DumperOptions();<NEW_LINE>options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);<NEW_LINE>Yaml yaml = new Yaml(options);<NEW_LINE>Writer yamlWriter = new StringWriter();<NEW_LINE>yamlWriter.write("---\n");<NEW_LINE>yaml.dump(frontmatterData, yamlWriter);<NEW_LINE>yamlWriter.write("---\n");<NEW_LINE>templateData.put("frontmatter", yamlWriter.toString());<NEW_LINE>MustacheFactory mf = new DefaultMustacheFactory();<NEW_LINE>Mustache mustache = mf.compile("com/google/errorprone/resources/bugpatterns_external.mustache");<NEW_LINE>mustache.execute(w, templateData);<NEW_LINE>} else {<NEW_LINE>MustacheFactory mf = new DefaultMustacheFactory();<NEW_LINE>Mustache mustache = mf.compile("com/google/errorprone/resources/bugpatterns_internal.mustache");<NEW_LINE>mustache.execute(w, templateData);<NEW_LINE>}<NEW_LINE>} | "layout", "bugpatterns").buildOrThrow(); |
247,992 | final DBCluster executeRestoreDBClusterFromSnapshot(RestoreDBClusterFromSnapshotRequest restoreDBClusterFromSnapshotRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(restoreDBClusterFromSnapshotRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RestoreDBClusterFromSnapshotRequest> request = null;<NEW_LINE>Response<DBCluster> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RestoreDBClusterFromSnapshotRequestMarshaller().marshall(super.beforeMarshalling(restoreDBClusterFromSnapshotRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Neptune");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RestoreDBClusterFromSnapshot");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DBCluster> responseHandler = new StaxResponseHandler<<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | DBCluster>(new DBClusterStaxUnmarshaller()); |
128,630 | public List<ValidateError> validate(Map<String, String> values) {<NEW_LINE>List<ValidateError> errors = new ArrayList<>();<NEW_LINE>Validator validator;<NEW_LINE>ValidateError error;<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.REQUIRED);<NEW_LINE>error = validator.validate(values.get("knowledgeId"), convLabelName("Knowledge Id"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.REQUIRED);<NEW_LINE>error = validator.validate(values.get("tagId"), convLabelName("Tag Id"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(values.get(<MASK><NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(values.get("insertUser"), convLabelName("Insert User"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(values.get("updateUser"), convLabelName("Update User"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(values.get("deleteFlag"), convLabelName("Delete Flag"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>return errors;<NEW_LINE>} | "tagId"), convLabelName("Tag Id")); |
854,373 | private void saveToCloudDrive() {<NEW_LINE>MegaNode parentNode = megaApi.getRootNode();<NEW_LINE>String myEmail = megaApi.getMyUser().getEmail();<NEW_LINE>File qrFile = buildQrFile(getActivity(), myEmail + QR_IMAGE_FILE_NAME);<NEW_LINE>if (isFileAvailable(qrFile)) {<NEW_LINE>if (MegaApplication.getInstance().getStorageState() == STORAGE_STATE_PAYWALL) {<NEW_LINE>showOverDiskQuotaPaywallWarning();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ShareInfo info = ShareInfo.infoFromFile(qrFile);<NEW_LINE>Intent intent = new Intent(getActivity().getApplicationContext(), UploadService.class);<NEW_LINE>intent.putExtra(UploadService.EXTRA_FILEPATH, info.getFileAbsolutePath());<NEW_LINE>intent.putExtra(UploadService.EXTRA_NAME, info.getTitle());<NEW_LINE>intent.putExtra(UploadService.EXTRA_PARENT_HASH, parentNode.getHandle());<NEW_LINE>intent.putExtra(UploadService.EXTRA_SIZE, info.getSize());<NEW_LINE>intent.putExtra("qrfile", true);<NEW_LINE>getActivity().startService(intent);<NEW_LINE>((QRCodeActivity) getActivity()).showSnackbar(null, getString(R.string.save_qr_cloud_drive, qrFile.getName()));<NEW_LINE>} else {<NEW_LINE>((QRCodeActivity) getActivity()).showSnackbar(null, getString<MASK><NEW_LINE>}<NEW_LINE>} | (R.string.error_upload_qr)); |
674,265 | protected RequestBody finalizeData() {<NEW_LINE>DataObject frame = DataObject.empty().put("name", getChannel().getName());<NEW_LINE>if (shouldUpdate(NAME))<NEW_LINE>frame.put("name", name);<NEW_LINE>if (shouldUpdate(TYPE))<NEW_LINE>frame.put("type", type);<NEW_LINE>if (shouldUpdate(POSITION))<NEW_LINE>frame.put("position", position);<NEW_LINE>if (shouldUpdate(TOPIC))<NEW_LINE>frame.put("topic", topic);<NEW_LINE>if (shouldUpdate(NSFW))<NEW_LINE>frame.put("nsfw", nsfw);<NEW_LINE>if (shouldUpdate(SLOWMODE))<NEW_LINE>frame.put("rate_limit_per_user", slowmode);<NEW_LINE>if (shouldUpdate(USERLIMIT))<NEW_LINE>frame.put("user_limit", userlimit);<NEW_LINE>if (shouldUpdate(BITRATE))<NEW_LINE>frame.put("bitrate", bitrate);<NEW_LINE>if (shouldUpdate(PARENT))<NEW_LINE>frame.put("parent_id", parent);<NEW_LINE>if (shouldUpdate(REGION))<NEW_LINE>frame.put("rtc_region", region);<NEW_LINE>if (shouldUpdate(AUTO_ARCHIVE_DURATION))<NEW_LINE>frame.put("auto_archive_duration", autoArchiveDuration.getMinutes());<NEW_LINE>if (shouldUpdate(ARCHIVED))<NEW_LINE><MASK><NEW_LINE>if (shouldUpdate(LOCKED))<NEW_LINE>frame.put("locked", locked);<NEW_LINE>if (shouldUpdate(INVITEABLE))<NEW_LINE>frame.put("invitable", invitable);<NEW_LINE>withLock(lock, (lock) -> {<NEW_LINE>if (shouldUpdate(PERMISSION))<NEW_LINE>frame.put("permission_overwrites", getOverrides());<NEW_LINE>});<NEW_LINE>reset();<NEW_LINE>return getRequestBody(frame);<NEW_LINE>} | frame.put("archived", archived); |
977,044 | public ApiResponse<ExtendedUser> usersPostInviteWithHttpInfo(InviteUserRequest inviteUserRequest) throws ApiException {<NEW_LINE>Object localVarPostBody = inviteUserRequest;<NEW_LINE>// verify the required parameter 'inviteUserRequest' is set<NEW_LINE>if (inviteUserRequest == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'inviteUserRequest' when calling usersPostInvite");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/users/invite";<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "text/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[<MASK><NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>GenericType<ExtendedUser> localVarReturnType = new GenericType<ExtendedUser>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | ] localVarContentTypes = { "application/json", "text/json" }; |
314,436 | public int compareTo(alerts_by_trigger_and_time_args other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.getClass().getName());<NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetMid()).compareTo(other.isSetMid());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetMid()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mid, other.mid);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetTriggerId()).compareTo(other.isSetTriggerId());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetTriggerId()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.trigger_id, other.trigger_id);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetBegMs()).compareTo(other.isSetBegMs());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetBegMs()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.beg_ms, other.beg_ms);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetEndMs()).compareTo(other.isSetEndMs());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetEndMs()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | this.end_ms, other.end_ms); |
1,761,180 | protected void handlePost(final HttpServletRequest req, final HttpServletResponse resp, final Session session) throws ServletException, IOException {<NEW_LINE>if (hasParam(req, "ajax")) {<NEW_LINE>handleAJAXAction(req, resp, session);<NEW_LINE>} else {<NEW_LINE>final HashMap<String, Object> ret = new HashMap<>();<NEW_LINE>if (hasParam(req, "action")) {<NEW_LINE>final String <MASK><NEW_LINE>if (API_SCHEDULE_FLOW.equals(action)) {<NEW_LINE>ajaxScheduleFlow(req, ret, session.getUser());<NEW_LINE>} else if (API_SCHEDULE_CRON_FLOW.equals(action)) {<NEW_LINE>ajaxScheduleCronFlow(req, ret, session.getUser());<NEW_LINE>} else if (API_REMOVE_SCHED.equals(action)) {<NEW_LINE>ajaxRemoveSched(req, ret, session.getUser());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ret.get(PARAM_STATUS) == (STATUS_SUCCESS)) {<NEW_LINE>setSuccessMessageInCookie(resp, (String) ret.get(PARAM_MESSAGE));<NEW_LINE>} else {<NEW_LINE>setErrorMessageInCookie(resp, (String) ret.get(PARAM_MESSAGE));<NEW_LINE>}<NEW_LINE>this.writeJSON(resp, ret);<NEW_LINE>}<NEW_LINE>} | action = getParam(req, "action"); |
19,793 | public void init(FilterConfig config) throws ServletException {<NEW_LINE>mappings = WebSocketMappings.<MASK><NEW_LINE>String max = config.getInitParameter("idleTimeout");<NEW_LINE>if (max == null) {<NEW_LINE>max = config.getInitParameter("maxIdleTime");<NEW_LINE>if (max != null)<NEW_LINE>LOG.warn("'maxIdleTime' init param is deprecated, use 'idleTimeout' instead");<NEW_LINE>}<NEW_LINE>if (max != null)<NEW_LINE>defaultCustomizer.setIdleTimeout(Duration.ofMillis(Long.parseLong(max)));<NEW_LINE>max = config.getInitParameter("maxTextMessageSize");<NEW_LINE>if (max != null)<NEW_LINE>defaultCustomizer.setMaxTextMessageSize(Integer.parseInt(max));<NEW_LINE>max = config.getInitParameter("maxBinaryMessageSize");<NEW_LINE>if (max != null)<NEW_LINE>defaultCustomizer.setMaxBinaryMessageSize(Integer.parseInt(max));<NEW_LINE>max = config.getInitParameter("inputBufferSize");<NEW_LINE>if (max != null)<NEW_LINE>defaultCustomizer.setInputBufferSize(Integer.parseInt(max));<NEW_LINE>max = config.getInitParameter("outputBufferSize");<NEW_LINE>if (max != null)<NEW_LINE>defaultCustomizer.setOutputBufferSize(Integer.parseInt(max));<NEW_LINE>max = config.getInitParameter("maxFrameSize");<NEW_LINE>if (max == null)<NEW_LINE>max = config.getInitParameter("maxAllowedFrameSize");<NEW_LINE>if (max != null)<NEW_LINE>defaultCustomizer.setMaxFrameSize(Long.parseLong(max));<NEW_LINE>String autoFragment = config.getInitParameter("autoFragment");<NEW_LINE>if (autoFragment != null)<NEW_LINE>defaultCustomizer.setAutoFragment(Boolean.parseBoolean(autoFragment));<NEW_LINE>} | ensureMappings(config.getServletContext()); |
166,958 | public void addInternalTriggers(Collection<ITriggerInternal> result, IStatementContainer container) {<NEW_LINE>Pipe<?> pipe = null;<NEW_LINE><MASK><NEW_LINE>if (tile instanceof TileGenericPipe) {<NEW_LINE>pipe = ((TileGenericPipe) tile).pipe;<NEW_LINE>}<NEW_LINE>if (pipe == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>switch(((TileGenericPipe) tile).getPipeType()) {<NEW_LINE>case ITEM:<NEW_LINE>result.add(TriggerPipeContents.PipeContents.empty.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.containsItems.trigger);<NEW_LINE>break;<NEW_LINE>case FLUID:<NEW_LINE>result.add(TriggerPipeContents.PipeContents.empty.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.containsFluids.trigger);<NEW_LINE>break;<NEW_LINE>case POWER:<NEW_LINE>result.add(TriggerPipeContents.PipeContents.empty.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.containsEnergy.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.tooMuchEnergy.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.requestsEnergy.trigger);<NEW_LINE>break;<NEW_LINE>case STRUCTURE:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (container instanceof Gate) {<NEW_LINE>((Gate) container).addTriggers(result);<NEW_LINE>}<NEW_LINE>} | TileEntity tile = container.getTile(); |
150,677 | public void init() throws SQLException {<NEW_LINE>//<NEW_LINE>InformationStorage informationStorage = this.appContext.getInstance(InformationStorage.class);<NEW_LINE>JdbcTemplate jdbcTemplate = null;<NEW_LINE>if (informationStorage != null) {<NEW_LINE>jdbcTemplate = new JdbcTemplate(Objects.requireNonNull(informationStorage.getDataSource(), "informationStorage dataSource is null."));<NEW_LINE>} else {<NEW_LINE>jdbcTemplate = this.appContext.getInstance(JdbcTemplate.class);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>if (jdbcTemplate == null) {<NEW_LINE>throw new IllegalStateException("jdbcTemplate is not init.");<NEW_LINE>}<NEW_LINE>//<NEW_LINE>Settings settings = this.appContext.getInstance(Settings.class);<NEW_LINE>String dbType = settings.getString("hasor.dataway.settings.dal_db_type");<NEW_LINE>if (StringUtils.isBlank(dbType)) {<NEW_LINE>dbType = jdbcTemplate.execute((ConnectionCallback<String>) con -> {<NEW_LINE>String jdbcUrl = con<MASK><NEW_LINE>String jdbcDriverName = con.getMetaData().getDriverName();<NEW_LINE>return JdbcUtils.getDbType(jdbcUrl, jdbcDriverName);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>if (dbType == null) {<NEW_LINE>logger.warn("dataway dbType unknown.");<NEW_LINE>}<NEW_LINE>//<NEW_LINE>String tablePrefix = settings.getString("hasor.dataway.settings.dal_db_table_prefix");<NEW_LINE>tablePrefix = StringUtils.isBlank(tablePrefix) ? "" : tablePrefix;<NEW_LINE>this.infoDal = new InterfaceInfoDal(jdbcTemplate, dbType, tablePrefix + "interface_info");<NEW_LINE>this.releaseDal = new InterfaceReleaseDal(jdbcTemplate, dbType, tablePrefix + "interface_release");<NEW_LINE>//<NEW_LINE>logger.info("dataway dbType is {} ,table names = {}, {}", dbType, this.infoDal.getTableName(), this.releaseDal.getTableName());<NEW_LINE>} | .getMetaData().getURL(); |
730,346 | public void consume(TransactionCapsule trx, TransactionTrace trace) throws ContractValidateException, AccountResourceInsufficientException, TooBigTransactionResultException {<NEW_LINE>List<Contract> contracts = trx.getInstance().getRawData().getContractList();<NEW_LINE>if (trx.getResultSerializedSize() > Constant.MAX_RESULT_SIZE_IN_TX * contracts.size()) {<NEW_LINE>throw new TooBigTransactionResultException();<NEW_LINE>}<NEW_LINE>long bytesSize;<NEW_LINE>if (chainBaseManager.getDynamicPropertiesStore().supportVM()) {<NEW_LINE>bytesSize = trx.getInstance().toBuilder().clearRet().build().getSerializedSize();<NEW_LINE>} else {<NEW_LINE>bytesSize = trx.getSerializedSize();<NEW_LINE>}<NEW_LINE>for (Contract contract : contracts) {<NEW_LINE>if (contract.getType() == ShieldedTransferContract) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (chainBaseManager.getDynamicPropertiesStore().supportVM()) {<NEW_LINE>bytesSize += Constant.MAX_RESULT_SIZE_IN_TX;<NEW_LINE>}<NEW_LINE>logger.debug("trxId {}, bandwidth cost: {}", trx.getTransactionId(), bytesSize);<NEW_LINE>trace.setNetBill(bytesSize, 0);<NEW_LINE>byte[] address = TransactionCapsule.getOwner(contract);<NEW_LINE>AccountCapsule accountCapsule = chainBaseManager.getAccountStore().get(address);<NEW_LINE>if (accountCapsule == null) {<NEW_LINE>throw new ContractValidateException("account does not exist");<NEW_LINE>}<NEW_LINE>long now = chainBaseManager.getHeadSlot();<NEW_LINE>if (contractCreateNewAccount(contract)) {<NEW_LINE>consumeForCreateNewAccount(accountCapsule, bytesSize, now, trace);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (contract.getType() == TransferAssetContract && useAssetAccountNet(contract, accountCapsule, now, bytesSize)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (useAccountNet(accountCapsule, bytesSize, now)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (useFreeNet(accountCapsule, bytesSize, now)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (useTransactionFee(accountCapsule, bytesSize, trace)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>long fee = chainBaseManager.getDynamicPropertiesStore().getTransactionFee() * bytesSize;<NEW_LINE>throw new AccountResourceInsufficientException("Account has insufficient bandwidth[" + <MASK><NEW_LINE>}<NEW_LINE>} | bytesSize + "] and balance[" + fee + "] to create new account"); |
1,705,975 | private void markupIMTConflictTables(Program program, TaskMonitor monitor) throws Exception {<NEW_LINE>if (get_kSectionIMTConflictTables() == UNSUPPORTED_SECTION) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ArtImageSection section = sectionList.get(get_kSectionIMTConflictTables());<NEW_LINE>monitor.setMessage("ART - markup IMT conflict tables...");<NEW_LINE>monitor.setProgress(0);<NEW_LINE>monitor.setMaximum(section.getSize());<NEW_LINE><MASK><NEW_LINE>if (section.getSize() > 0) {<NEW_LINE>Address address = program.getMinAddress().getNewAddress(header.getImageBegin() + section.getOffset());<NEW_LINE>if (!program.getMemory().contains(address)) {<NEW_LINE>// outside of ART file<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Address endAddress = address.add(section.getSize());<NEW_LINE>while (address.compareTo(endAddress) < 0) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>monitor.incrementProgress(pointerSize);<NEW_LINE>createDataAt(program, address, pointerSize);<NEW_LINE>address = address.add(pointerSize);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int pointerSize = header.getPointerSize(); |
1,266,724 | private void received(Listener listener, String tools, String message) throws ParseException {<NEW_LINE>// System.out.println("RECEIVED: tools: '"+tools+"', message: '"+message+"'");<NEW_LINE>fireReceived(message);<NEW_LINE>LOG.log(Level.FINE, "RECEIVED: {0}, {1}", new Object[] { tools, message });<NEW_LINE>if (message.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>JSONParser parser = new JSONParser();<NEW_LINE>JSONObject obj = (JSONObject) parser.parse(message, containerFactory);<NEW_LINE>// V8Packet packet = V8Packet.get(obj);<NEW_LINE>V8Type type = JSONReader.getType(obj);<NEW_LINE>switch(type) {<NEW_LINE>case event:<NEW_LINE>V8Event event = JSONReader.getEvent(obj);<NEW_LINE>// System.out.println("event: "+event);<NEW_LINE>listener.event(event);<NEW_LINE>break;<NEW_LINE>case response:<NEW_LINE>V8Response <MASK><NEW_LINE>// System.out.println("response: "+response);<NEW_LINE>listener.response(response);<NEW_LINE>if (V8Command.Disconnect.equals(response.getCommand())) {<NEW_LINE>try {<NEW_LINE>close();<NEW_LINE>} catch (IOException ioex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("Wrong type: " + type);<NEW_LINE>}<NEW_LINE>} | response = JSONReader.getResponse(obj); |
654,908 | //<NEW_LINE>public static void handle(String stmt, ServerConnection c, int offset) {<NEW_LINE>String table = stmt.substring(offset).trim();<NEW_LINE>// int sqlType = ServerParse.parse(stmt) & 0xff;<NEW_LINE>String db = c.getSchema();<NEW_LINE>if (db == null) {<NEW_LINE>db = SchemaUtil.detectDefaultDb(stmt, ServerParse.COMMAND);<NEW_LINE>if (db == null) {<NEW_LINE>c.writeErrMessage(ErrorCode.ER_NO_DB_ERROR, "No database selected");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SchemaConfig schema = MycatServer.getInstance().getConfig().getSchemas().get(db);<NEW_LINE>if (schema == null) {<NEW_LINE>c.writeErrMessage(ErrorCode.ER_BAD_DB_ERROR, "Unknown database '" + db + "'");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SystemConfig system = MycatServer.getInstance().getConfig().getSystem();<NEW_LINE>RouteResultset rrs = null;<NEW_LINE>try {<NEW_LINE>rrs = MycatServer.getInstance().getRouterservice().route(system, schema, ServerParse.COMMAND, stmt, c.getCharset(), c);<NEW_LINE>if (rrs == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (SQLNonTransientException e) {<NEW_LINE>logger.warn("", e);<NEW_LINE>c.writeErrMessage(ErrorCode.<MASK><NEW_LINE>}<NEW_LINE>//<NEW_LINE>CommandExecResultHandler handler = new CommandExecResultHandler(rrs, c.getSession2(), table);<NEW_LINE>try {<NEW_LINE>handler.execute();<NEW_LINE>} catch (Exception e1) {<NEW_LINE>logger.warn("", e1);<NEW_LINE>c.writeErrMessage(ErrorCode.ERR_HANDLE_DATA, e1.toString());<NEW_LINE>}<NEW_LINE>} | ERR_HANDLE_DATA, e.toString()); |
1,552,058 | public void writeTo(StreamOutput out) throws IOException {<NEW_LINE>out.writeOptionalString(name);<NEW_LINE>out.writeBoolean(ignoreUnmapped);<NEW_LINE>out.writeVInt(from);<NEW_LINE>out.writeVInt(size);<NEW_LINE>out.writeBoolean(explain);<NEW_LINE>out.writeBoolean(version);<NEW_LINE>out.writeBoolean(seqNoAndPrimaryTerm);<NEW_LINE>out.writeBoolean(trackScores);<NEW_LINE>out.writeOptionalWriteable(storedFieldsContext);<NEW_LINE>out.writeBoolean(docValueFields != null);<NEW_LINE>if (docValueFields != null) {<NEW_LINE>out.writeList(docValueFields);<NEW_LINE>}<NEW_LINE>boolean hasScriptFields = scriptFields != null;<NEW_LINE>out.writeBoolean(hasScriptFields);<NEW_LINE>if (hasScriptFields) {<NEW_LINE>out.writeVInt(scriptFields.size());<NEW_LINE>Iterator<ScriptField> iterator = scriptFields.stream().sorted(Comparator.comparing(ScriptField::fieldName)).iterator();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>iterator.next().writeTo(out);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.writeOptionalWriteable(fetchSourceContext);<NEW_LINE>boolean hasSorts = sorts != null;<NEW_LINE>out.writeBoolean(hasSorts);<NEW_LINE>if (hasSorts) {<NEW_LINE>out.<MASK><NEW_LINE>for (SortBuilder<?> sort : sorts) {<NEW_LINE>out.writeNamedWriteable(sort);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.writeOptionalWriteable(highlightBuilder);<NEW_LINE>out.writeOptionalWriteable(innerCollapseBuilder);<NEW_LINE>if (out.getVersion().onOrAfter(Version.V_7_10_0)) {<NEW_LINE>out.writeBoolean(fetchFields != null);<NEW_LINE>if (fetchFields != null) {<NEW_LINE>out.writeList(fetchFields);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | writeVInt(sorts.size()); |
663,538 | public io.kubernetes.client.proto.V1.EnvVarSource buildPartial() {<NEW_LINE>io.kubernetes.client.proto.V1.EnvVarSource result = new io.kubernetes.client.proto.V1.EnvVarSource(this);<NEW_LINE>int from_bitField0_ = bitField0_;<NEW_LINE>int to_bitField0_ = 0;<NEW_LINE>if (((from_bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>to_bitField0_ |= 0x00000001;<NEW_LINE>}<NEW_LINE>if (fieldRefBuilder_ == null) {<NEW_LINE>result.fieldRef_ = fieldRef_;<NEW_LINE>} else {<NEW_LINE>result.fieldRef_ = fieldRefBuilder_.build();<NEW_LINE>}<NEW_LINE>if (((from_bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>to_bitField0_ |= 0x00000002;<NEW_LINE>}<NEW_LINE>if (resourceFieldRefBuilder_ == null) {<NEW_LINE>result.resourceFieldRef_ = resourceFieldRef_;<NEW_LINE>} else {<NEW_LINE>result.resourceFieldRef_ = resourceFieldRefBuilder_.build();<NEW_LINE>}<NEW_LINE>if (((from_bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>to_bitField0_ |= 0x00000004;<NEW_LINE>}<NEW_LINE>if (configMapKeyRefBuilder_ == null) {<NEW_LINE>result.configMapKeyRef_ = configMapKeyRef_;<NEW_LINE>} else {<NEW_LINE>result.configMapKeyRef_ = configMapKeyRefBuilder_.build();<NEW_LINE>}<NEW_LINE>if (((from_bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>to_bitField0_ |= 0x00000008;<NEW_LINE>}<NEW_LINE>if (secretKeyRefBuilder_ == null) {<NEW_LINE>result.secretKeyRef_ = secretKeyRef_;<NEW_LINE>} else {<NEW_LINE>result<MASK><NEW_LINE>}<NEW_LINE>result.bitField0_ = to_bitField0_;<NEW_LINE>onBuilt();<NEW_LINE>return result;<NEW_LINE>} | .secretKeyRef_ = secretKeyRefBuilder_.build(); |
1,301,995 | public String nearestPalindromic(String n) {<NEW_LINE>if (n.length() >= 2 && allNine(n)) {<NEW_LINE>String s = "1";<NEW_LINE>for (int i = 0; i < n.length() - 1; i++) {<NEW_LINE>s += "0";<NEW_LINE>}<NEW_LINE>s += "1";<NEW_LINE>return s;<NEW_LINE>}<NEW_LINE>boolean isOdd = (n.length() % 2 != 0);<NEW_LINE>String left = n.substring(0, (n.length() + 1) / 2);<NEW_LINE>long[] increment = { <MASK><NEW_LINE>String ret = n;<NEW_LINE>long minDiff = Long.MAX_VALUE;<NEW_LINE>for (long i : increment) {<NEW_LINE>String s = getPalindrom(Long.toString(Long.parseLong(left) + i), isOdd);<NEW_LINE>if (n.length() >= 2 && (s.length() != n.length() || Long.parseLong(s) == 0)) {<NEW_LINE>s = "";<NEW_LINE>for (int j = 0; j < n.length() - 1; j++) {<NEW_LINE>s += "9";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long diff = s.equals(n) ? Long.MAX_VALUE : Math.abs(Long.parseLong(s) - Long.parseLong(n));<NEW_LINE>if (diff < minDiff) {<NEW_LINE>minDiff = diff;<NEW_LINE>ret = s;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | -1, 0, +1 }; |
1,602,987 | protected Specification<COMMENT> buildSpecByQuery(@NonNull CommentQuery commentQuery) {<NEW_LINE>Assert.notNull(commentQuery, "Comment query must not be null");<NEW_LINE>return (root, query, criteriaBuilder) -> {<NEW_LINE>List<Predicate> predicates = new LinkedList<>();<NEW_LINE>if (commentQuery.getStatus() != null) {<NEW_LINE>predicates.add(criteriaBuilder.equal(root.get("status"), commentQuery.getStatus()));<NEW_LINE>}<NEW_LINE>if (commentQuery.getKeyword() != null) {<NEW_LINE>String likeCondition = String.format("%%%s%%", StringUtils.strip(commentQuery.getKeyword()));<NEW_LINE>Predicate authorLike = criteriaBuilder.like(root<MASK><NEW_LINE>Predicate contentLike = criteriaBuilder.like(root.get("content"), likeCondition);<NEW_LINE>Predicate emailLike = criteriaBuilder.like(root.get("email"), likeCondition);<NEW_LINE>predicates.add(criteriaBuilder.or(authorLike, contentLike, emailLike));<NEW_LINE>}<NEW_LINE>return query.where(predicates.toArray(new Predicate[0])).getRestriction();<NEW_LINE>};<NEW_LINE>} | .get("author"), likeCondition); |
1,292,600 | private AnAction createAction(String message, String optionName, Image icon, Image hoveredIcon, Image selectedIcon, AtomicBoolean state, Producer<Boolean> enableStateProvider) {<NEW_LINE>return new DumbAwareToggleAction(FindBundle.message(message), null, icon) {<NEW_LINE><NEW_LINE>{<NEW_LINE>getTemplatePresentation().setHoveredIcon(hoveredIcon);<NEW_LINE>getTemplatePresentation().setSelectedIcon(selectedIcon);<NEW_LINE>int mnemonic = KeyEvent.getExtendedKeyCodeForChar(TextWithMnemonic.parse(getTemplatePresentation().getTextWithMnemonic()).getMnemonic());<NEW_LINE>if (mnemonic != KeyEvent.VK_UNDEFINED) {<NEW_LINE>setShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(mnemonic, SystemInfo.isMac ? <MASK><NEW_LINE>registerCustomShortcutSet(getShortcutSet(), FindPopupPanel.this);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isSelected(@Nonnull AnActionEvent e) {<NEW_LINE>return state.get();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void update(@Nonnull AnActionEvent e) {<NEW_LINE>e.getPresentation().setEnabled(enableStateProvider.produce());<NEW_LINE>Toggleable.setSelected(e.getPresentation(), state.get());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void setSelected(@Nonnull AnActionEvent e, boolean selected) {<NEW_LINE>// FUCounterUsageLogger.getInstance().logEvent("find", "check.box.toggled", new FeatureUsageData().<NEW_LINE>// addData("type", FIND_TYPE).<NEW_LINE>// addData("option_name", optionName).<NEW_LINE>// addData("option_value", selected));<NEW_LINE>state.set(selected);<NEW_LINE>scheduleResultsUpdate();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | ALT_DOWN_MASK | CTRL_DOWN_MASK : ALT_DOWN_MASK))); |
1,111,906 | public void connect() throws IOException {<NEW_LINE>String str = url.toExternalForm();<NEW_LINE>int pos = str.indexOf("body=");<NEW_LINE>if (pos >= 0) {<NEW_LINE>str = str.substring(pos + 5);<NEW_LINE>byte[] bytes = str.getBytes(Constants.BYTE_ENCODING_CHARSET);<NEW_LINE>VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile(bytes);<NEW_LINE>if (vf == null) {<NEW_LINE>throw (new IOException("Invalid biglybt url"));<NEW_LINE>}<NEW_LINE>input_stream = new ByteArrayInputStream(bytes);<NEW_LINE>} else {<NEW_LINE>String host = url.getHost();<NEW_LINE>String httpsURL;<NEW_LINE>if (host.equalsIgnoreCase("install-plugin") && url.getPath().length() > 1) {<NEW_LINE>String plugin_id = url.getPath().substring(1);<NEW_LINE>httpsURL = Constants.PLUGINS_WEB_SITE + "getplugin.php?plugin=" + plugin_id + "&" + SFPluginDetailsLoaderImpl.getBaseUrlParams();<NEW_LINE>} else if (host.contains(".")) {<NEW_LINE>httpsURL = "https" + str.substring("biglybt".length());<NEW_LINE>} else {<NEW_LINE>throw (new IOException("Invalid biglybt url"));<NEW_LINE>}<NEW_LINE>ResourceDownloader rd = StaticUtilities.getResourceDownloaderFactory().create(new URL(httpsURL));<NEW_LINE>try {<NEW_LINE>if (ONLY_VUZE_FILE) {<NEW_LINE>VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile(rd.download());<NEW_LINE>if (vf == null) {<NEW_LINE>throw (new IOException("Invalid biglybt url"));<NEW_LINE>}<NEW_LINE>boolean hasPlugin = false;<NEW_LINE>VuzeFileComponent[<MASK><NEW_LINE>for (VuzeFileComponent component : components) {<NEW_LINE>if (component.getType() == VuzeFileComponent.COMP_TYPE_PLUGIN) {<NEW_LINE>hasPlugin = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!hasPlugin) {<NEW_LINE>throw (new IOException("Biglybt url does not contain plugin"));<NEW_LINE>}<NEW_LINE>input_stream = new ByteArrayInputStream(vf.exportToBytes());<NEW_LINE>} else {<NEW_LINE>input_stream = rd.download();<NEW_LINE>}<NEW_LINE>} catch (ResourceDownloaderException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] components = vf.getComponents(); |
79,540 | /*<NEW_LINE>* Perform a For Comprehension over a State, accepting 3 generating function.<NEW_LINE>* This results in a four level nested internal iteration over the provided States.<NEW_LINE>*<NEW_LINE>* <pre><NEW_LINE>* {@code<NEW_LINE>*<NEW_LINE>* import static com.oath.cyclops.reactor.States.forEach4;<NEW_LINE>*<NEW_LINE>forEach4(State.just(1),<NEW_LINE>a-> State.just(a+1),<NEW_LINE>(a,b) -> State.<Integer>just(a+b),<NEW_LINE>a (a,b,c) -> State.<Integer>just(a+b+c),<NEW_LINE>Tuple::tuple)<NEW_LINE>*<NEW_LINE>* }<NEW_LINE>* </pre><NEW_LINE>*<NEW_LINE>* @param value1 top level State<NEW_LINE>* @param value2 Nested State<NEW_LINE>* @param value3 Nested State<NEW_LINE>* @param value4 Nested State<NEW_LINE>* @param yieldingFunction Generates a result per combination<NEW_LINE>* @return State with a combined value generated by the yielding function<NEW_LINE>*/<NEW_LINE>public <R1, R2, R3, R4> State<S, R4> forEach4(Function<? super T, ? extends State<S, R1>> value2, BiFunction<? super T, ? super R1, ? extends State<S, R2>> value3, Function3<? super T, ? super R1, ? super R2, ? extends State<S, R3>> value4, Function4<? super T, ? super R1, ? super R2, ? super R3, ? extends R4> yieldingFunction) {<NEW_LINE>return this.flatMap(in -> {<NEW_LINE>State<S, R1> a = value2.apply(in);<NEW_LINE>return a.flatMap(ina -> {<NEW_LINE>State<S, R2> b = <MASK><NEW_LINE>return b.flatMap(inb -> {<NEW_LINE>State<S, R3> c = value4.apply(in, ina, inb);<NEW_LINE>return c.map(in2 -> {<NEW_LINE>return yieldingFunction.apply(in, ina, inb, in2);<NEW_LINE>});<NEW_LINE>});<NEW_LINE>});<NEW_LINE>});<NEW_LINE>} | value3.apply(in, ina); |
1,624,687 | private void queueEvents(TrackEntry entry, float animationTime) {<NEW_LINE>float animationStart = entry.animationStart, animationEnd = entry.animationEnd;<NEW_LINE>float duration = animationEnd - animationStart;<NEW_LINE>float trackLastWrapped = entry.trackLast % duration;<NEW_LINE>// Queue events before complete.<NEW_LINE>Object[] events = this.events.items;<NEW_LINE>int i = 0<MASK><NEW_LINE>for (; i < n; i++) {<NEW_LINE>Event event = (Event) events[i];<NEW_LINE>if (event.time < trackLastWrapped)<NEW_LINE>break;<NEW_LINE>// Discard events outside animation start/end.<NEW_LINE>if (event.time > animationEnd)<NEW_LINE>continue;<NEW_LINE>queue.event(entry, event);<NEW_LINE>}<NEW_LINE>// Queue complete if completed a loop iteration or the animation.<NEW_LINE>boolean complete;<NEW_LINE>if (entry.loop)<NEW_LINE>complete = duration == 0 || trackLastWrapped > entry.trackTime % duration;<NEW_LINE>else<NEW_LINE>complete = animationTime >= animationEnd && entry.animationLast < animationEnd;<NEW_LINE>if (complete)<NEW_LINE>queue.complete(entry);<NEW_LINE>// Queue events after complete.<NEW_LINE>for (; i < n; i++) {<NEW_LINE>Event event = (Event) events[i];<NEW_LINE>// Discard events outside animation start/end.<NEW_LINE>if (event.time < animationStart)<NEW_LINE>continue;<NEW_LINE>queue.event(entry, event);<NEW_LINE>}<NEW_LINE>} | , n = this.events.size; |
890,960 | public GetDatabaseResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetDatabaseResult getDatabaseResult = new GetDatabaseResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getDatabaseResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Database", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDatabaseResult.setDatabase(DatabaseJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getDatabaseResult;<NEW_LINE>} | ().unmarshall(context)); |
1,511,644 | protected void handleReadResultForFenceRead(final ByteBuf entryBody, final ReadResponse.Builder readResponseBuilder, final long entryId, final Stopwatch startTimeSw) {<NEW_LINE>// reset last phase start time to measure fence result waiting time<NEW_LINE>lastPhaseStartTime.reset().start();<NEW_LINE>if (null != fenceThreadPool) {<NEW_LINE>fenceResult.whenCompleteAsync(new FutureEventListener<Boolean>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(Boolean result) {<NEW_LINE>sendFenceResponse(readResponseBuilder, entryBody, result, startTimeSw);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(Throwable t) {<NEW_LINE>LOG.error("Fence request for ledgerId {} entryId {} encountered exception", ledgerId, entryId, t);<NEW_LINE>sendFenceResponse(readResponseBuilder, entryBody, false, startTimeSw);<NEW_LINE>}<NEW_LINE>}, fenceThreadPool);<NEW_LINE>} else {<NEW_LINE>boolean success = false;<NEW_LINE>try {<NEW_LINE>success = fenceResult.get(1000, TimeUnit.MILLISECONDS);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>LOG.error("Fence request for ledgerId {} entryId {} encountered exception : ", readRequest.getLedgerId(), <MASK><NEW_LINE>}<NEW_LINE>sendFenceResponse(readResponseBuilder, entryBody, success, startTimeSw);<NEW_LINE>}<NEW_LINE>} | readRequest.getEntryId(), t); |
218,585 | public Response.ResponseBuilder evaluatePreconditions(final Date lastModified, final EntityTag eTag) {<NEW_LINE>if (lastModified == null) {<NEW_LINE>throw new IllegalArgumentException(METHOD_PARAMETER_CANNOT_BE_NULL_LAST_MODIFIED);<NEW_LINE>}<NEW_LINE>if (eTag == null) {<NEW_LINE>throw new IllegalArgumentException(METHOD_PARAMETER_CANNOT_BE_NULL_ETAG);<NEW_LINE>}<NEW_LINE>Response.ResponseBuilder r = evaluateIfMatch(eTag);<NEW_LINE>if (r != null) {<NEW_LINE>return r;<NEW_LINE>}<NEW_LINE>final long lastModifiedTime = lastModified.getTime();<NEW_LINE>r = evaluateIfUnmodifiedSince(lastModifiedTime);<NEW_LINE>if (r != null) {<NEW_LINE>return r;<NEW_LINE>}<NEW_LINE>final boolean isGetOrHead = "GET".equals(getMethod()) || "HEAD".equals(getMethod());<NEW_LINE>final Set<MatchingEntityTag> matchingTags = getIfNoneMatch();<NEW_LINE>if (matchingTags != null) {<NEW_LINE>r = evaluateIfNoneMatch(eTag, matchingTags, isGetOrHead);<NEW_LINE>// If the If-None-Match header is present and there is no<NEW_LINE>// match then the If-Modified-Since header must be ignored<NEW_LINE>if (r == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Otherwise if the If-None-Match header is present and there<NEW_LINE>// is a match then the If-Modified-Since header must be checked<NEW_LINE>// for consistency<NEW_LINE>}<NEW_LINE>final String <MASK><NEW_LINE>if (ifModifiedSinceHeader != null && !ifModifiedSinceHeader.isEmpty() && isGetOrHead) {<NEW_LINE>r = evaluateIfModifiedSince(lastModifiedTime, ifModifiedSinceHeader);<NEW_LINE>if (r != null) {<NEW_LINE>r.tag(eTag);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return r;<NEW_LINE>} | ifModifiedSinceHeader = getHeaderString(HttpHeaders.IF_MODIFIED_SINCE); |
211,397 | public void marshall(CreateLocationSmbRequest createLocationSmbRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createLocationSmbRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createLocationSmbRequest.getSubdirectory(), SUBDIRECTORY_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLocationSmbRequest.getServerHostname(), SERVERHOSTNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createLocationSmbRequest.getDomain(), DOMAIN_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLocationSmbRequest.getPassword(), PASSWORD_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLocationSmbRequest.getAgentArns(), AGENTARNS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLocationSmbRequest.getMountOptions(), MOUNTOPTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLocationSmbRequest.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createLocationSmbRequest.getUser(), USER_BINDING); |
1,651,978 | private JPanel buildRepositoryInfoPanel() {<NEW_LINE>String serverName = "";<NEW_LINE>ServerInfo info = null;<NEW_LINE>String repositoryName = "";<NEW_LINE>String portNumberStr = "";<NEW_LINE>boolean isConnected = false;<NEW_LINE>if (repository != null) {<NEW_LINE>info = repository.getServerInfo();<NEW_LINE>serverName = info.getServerName();<NEW_LINE>repositoryName = repository.getName();<NEW_LINE>portNumberStr = Integer.toString(info.getPortNumber());<NEW_LINE>isConnected = repository.isConnected();<NEW_LINE>}<NEW_LINE>JPanel outerPanel = new JPanel(new BorderLayout());<NEW_LINE>outerPanel.setBorder(BorderFactory.createTitledBorder("Repository Info"));<NEW_LINE>JPanel panel = new JPanel(<MASK><NEW_LINE>panel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));<NEW_LINE>JLabel sLabel = new GDLabel("Server Name:", SwingConstants.RIGHT);<NEW_LINE>panel.add(sLabel);<NEW_LINE>serverLabel = new GDLabel(serverName);<NEW_LINE>serverLabel.setName("Server Name");<NEW_LINE>panel.add(serverLabel);<NEW_LINE>JLabel pLabel = new GDLabel("Port Number:", SwingConstants.RIGHT);<NEW_LINE>panel.add(pLabel);<NEW_LINE>portLabel = new GDLabel(portNumberStr);<NEW_LINE>portLabel.setName("Port Number");<NEW_LINE>panel.add(portLabel);<NEW_LINE>JLabel repLabel = new GDLabel("Repository Name:", SwingConstants.RIGHT);<NEW_LINE>panel.add(repLabel);<NEW_LINE>repNameLabel = new GDLabel(repositoryName);<NEW_LINE>repNameLabel.setName("Repository Name");<NEW_LINE>panel.add(repNameLabel);<NEW_LINE>JLabel connectLabel = new GDLabel("Connection Status:", SwingConstants.RIGHT);<NEW_LINE>panel.add(connectLabel);<NEW_LINE>connectionButton = new JButton(isConnected ? FrontEndPlugin.CONNECTED_ICON : FrontEndPlugin.DISCONNECTED_ICON);<NEW_LINE>connectionButton.addActionListener(e -> connect());<NEW_LINE>connectionButton.setName("Connect Button");<NEW_LINE>connectionButton.setContentAreaFilled(false);<NEW_LINE>connectionButton.setSelected(isConnected);<NEW_LINE>connectionButton.setBorder(isConnected ? BorderFactory.createBevelBorder(BevelBorder.LOWERED) : BorderFactory.createBevelBorder(BevelBorder.RAISED));<NEW_LINE>updateConnectButtonToolTip();<NEW_LINE>HelpService help = Help.getHelpService();<NEW_LINE>help.registerHelp(connectionButton, new HelpLocation(GenericHelpTopics.FRONT_END, "ConnectToServer"));<NEW_LINE>JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));<NEW_LINE>buttonPanel.setBorder(BorderFactory.createEmptyBorder());<NEW_LINE>buttonPanel.add(connectionButton);<NEW_LINE>panel.add(buttonPanel);<NEW_LINE>JLabel userLabel = new GDLabel("User Access Level:", SwingConstants.RIGHT);<NEW_LINE>userLabel.setToolTipText("Indicates your privileges in the shared repository");<NEW_LINE>panel.add(userLabel);<NEW_LINE>User user = null;<NEW_LINE>if (isConnected) {<NEW_LINE>try {<NEW_LINE>user = repository.getUser();<NEW_LINE>} catch (IOException e) {<NEW_LINE>Msg.error(this, "Unable to get the current user", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>userAccessLabel = new GDLabel(getAccessString(user));<NEW_LINE>userAccessLabel.setName("User Access Level");<NEW_LINE>panel.add(userLabel);<NEW_LINE>panel.add(userAccessLabel);<NEW_LINE>outerPanel.add(panel);<NEW_LINE>if (repository == null) {<NEW_LINE>sLabel.setEnabled(false);<NEW_LINE>pLabel.setEnabled(false);<NEW_LINE>repLabel.setEnabled(false);<NEW_LINE>connectLabel.setEnabled(false);<NEW_LINE>connectionButton.setEnabled(false);<NEW_LINE>userLabel.setEnabled(false);<NEW_LINE>}<NEW_LINE>return outerPanel;<NEW_LINE>} | new PairLayout(5, 10)); |
1,676,325 | public String[] findRelativeRanks(int[] nums) {<NEW_LINE>int[] tmp = new int[nums.length];<NEW_LINE>for (int i = 0; i < nums.length; i++) {<NEW_LINE>tmp[i] = nums[i];<NEW_LINE>}<NEW_LINE>Arrays.sort(tmp);<NEW_LINE>Map<Integer, String> rankMap = new HashMap();<NEW_LINE>int len = nums.length;<NEW_LINE>for (int i = len - 1; i >= 0; i--) {<NEW_LINE>if (i == len - 1) {<NEW_LINE>rankMap.put(tmp[i], "Gold Medal");<NEW_LINE>} else if (i == len - 2) {<NEW_LINE>rankMap.put(tmp[i], "Silver Medal");<NEW_LINE>} else if (i == len - 3) {<NEW_LINE>rankMap.put(tmp[i], "Bronze Medal");<NEW_LINE>} else {<NEW_LINE>rankMap.put(tmp[i], String.valueOf(len - i));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String[] result = new String[len];<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>result[i] = rankMap<MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | .get(nums[i]); |
1,585,799 | protected boolean matchesAnnotation(Annotation annotation, LiveConditional liveConditional) {<NEW_LINE>// First check that the annotation matches the live conditional annotation<NEW_LINE>String annotationName = annotation.resolveTypeBinding().getName();<NEW_LINE>if (!liveConditional.getMessage().contains(annotationName)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Check that Java type in annotation in editor matches Java information in the live Conditional<NEW_LINE>ASTNode parent = annotation.getParent();<NEW_LINE>String typeInfo = liveConditional.getTypeInfo();<NEW_LINE>if (parent instanceof MethodDeclaration) {<NEW_LINE>MethodDeclaration methodDec = (MethodDeclaration) parent;<NEW_LINE>IMethodBinding binding = methodDec.resolveBinding();<NEW_LINE>String annotationDeclaringClassName = binding.getDeclaringClass().getName();<NEW_LINE>String annotationMethodName = binding.getName();<NEW_LINE>return typeInfo.contains(annotationDeclaringClassName) && typeInfo.contains(annotationMethodName);<NEW_LINE>} else if (parent instanceof TypeDeclaration) {<NEW_LINE>TypeDeclaration typeDec = (TypeDeclaration) parent;<NEW_LINE>String annotationDeclaringClassName = typeDec<MASK><NEW_LINE>return typeInfo.contains(annotationDeclaringClassName);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | .resolveBinding().getName(); |
1,094,764 | final DescribeReservedCacheNodesResult executeDescribeReservedCacheNodes(DescribeReservedCacheNodesRequest describeReservedCacheNodesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeReservedCacheNodesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeReservedCacheNodesRequest> request = null;<NEW_LINE>Response<DescribeReservedCacheNodesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeReservedCacheNodesRequestMarshaller().marshall(super.beforeMarshalling(describeReservedCacheNodesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ElastiCache");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeReservedCacheNodes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeReservedCacheNodesResult> responseHandler = new StaxResponseHandler<<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | DescribeReservedCacheNodesResult>(new DescribeReservedCacheNodesResultStaxUnmarshaller()); |
108,160 | public static void addModule(VirtualFile appRoot, String name, File path) {<NEW_LINE>VirtualFile root = VirtualFile.open(path);<NEW_LINE>modules.put(name, root);<NEW_LINE>if (root.child("app").exists()) {<NEW_LINE>javaPath.add(root.child("app"));<NEW_LINE>}<NEW_LINE>if (root.child("app/views").exists() || (usePrecompiled && appRoot.child("precompiled/templates/from_module_" + name + "/app/views").exists())) {<NEW_LINE>templatesPath.add(root.child("app/views"));<NEW_LINE>}<NEW_LINE>if (root.child("conf/routes").exists() || (usePrecompiled && appRoot.child("precompiled/templates/from_module_" + name + "/conf/routes").exists())) {<NEW_LINE>modulesRoutes.put(name<MASK><NEW_LINE>}<NEW_LINE>roots.add(root);<NEW_LINE>if (!name.startsWith("_")) {<NEW_LINE>Logger.info("Module %s is available (%s)", name, path.getAbsolutePath());<NEW_LINE>}<NEW_LINE>} | , root.child("conf/routes")); |
1,368,646 | public void readEntries(long ledgerID, long firstEntryID, long lastEntryID, BiConsumer<Integer, ArrayList<byte[]>> cb) {<NEW_LINE>client.asyncOpenLedgerNoRecovery(ledgerID, BookKeeper.DigestType.CRC32, new byte[0], (rc, lh, ctx) -> {<NEW_LINE>if (rc != 0) {<NEW_LINE>cb.accept(rc, null);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>System.out.format("Got handle for read %d -> %d on ledger %d%n", firstEntryID, lastEntryID, ledgerID);<NEW_LINE>lh.asyncReadEntries(firstEntryID, lastEntryID, (rc1, lh1, seq, ctx1) -> {<NEW_LINE>System.out.format(<MASK><NEW_LINE>ArrayList<byte[]> results = new ArrayList<>();<NEW_LINE>if (rc1 == 0) {<NEW_LINE>while (seq.hasMoreElements()) {<NEW_LINE>results.add(seq.nextElement().getEntry());<NEW_LINE>}<NEW_LINE>System.out.format("About to close handle for read %d -> %d on ledger %d%n", firstEntryID, lastEntryID, ledgerID);<NEW_LINE>}<NEW_LINE>lh.asyncClose((rc2, lh2, ctx2) -> {<NEW_LINE>System.out.format("Closed handle for read %d -> %d on ledger %d result %d%n", firstEntryID, lastEntryID, ledgerID, rc2);<NEW_LINE>cb.accept(rc1 == 0 ? rc2 : rc1, results);<NEW_LINE>}, null);<NEW_LINE>}, null);<NEW_LINE>}, null);<NEW_LINE>} | "Read cb %d -> %d on ledger %d%n", firstEntryID, lastEntryID, ledgerID); |
1,163,573 | private ResultPoint correctTopRight(ResultPoint[] points) {<NEW_LINE>// A..D<NEW_LINE>// | :<NEW_LINE>// B--C<NEW_LINE>ResultPoint pointA = points[0];<NEW_LINE>ResultPoint pointB = points[1];<NEW_LINE>ResultPoint pointC = points[2];<NEW_LINE>ResultPoint pointD = points[3];<NEW_LINE>// shift points for safe transition detection.<NEW_LINE>int trTop = transitionsBetween(pointA, pointD);<NEW_LINE>int trRight = transitionsBetween(pointB, pointD);<NEW_LINE>ResultPoint pointAs = shiftPoint(pointA, pointB, <MASK><NEW_LINE>ResultPoint pointCs = shiftPoint(pointC, pointB, (trTop + 1) * 4);<NEW_LINE>trTop = transitionsBetween(pointAs, pointD);<NEW_LINE>trRight = transitionsBetween(pointCs, pointD);<NEW_LINE>ResultPoint candidate1 = new ResultPoint(pointD.getX() + (pointC.getX() - pointB.getX()) / (trTop + 1), pointD.getY() + (pointC.getY() - pointB.getY()) / (trTop + 1));<NEW_LINE>ResultPoint candidate2 = new ResultPoint(pointD.getX() + (pointA.getX() - pointB.getX()) / (trRight + 1), pointD.getY() + (pointA.getY() - pointB.getY()) / (trRight + 1));<NEW_LINE>if (!isValid(candidate1)) {<NEW_LINE>if (isValid(candidate2)) {<NEW_LINE>return candidate2;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!isValid(candidate2)) {<NEW_LINE>return candidate1;<NEW_LINE>}<NEW_LINE>int sumc1 = transitionsBetween(pointAs, candidate1) + transitionsBetween(pointCs, candidate1);<NEW_LINE>int sumc2 = transitionsBetween(pointAs, candidate2) + transitionsBetween(pointCs, candidate2);<NEW_LINE>if (sumc1 > sumc2) {<NEW_LINE>return candidate1;<NEW_LINE>} else {<NEW_LINE>return candidate2;<NEW_LINE>}<NEW_LINE>} | (trRight + 1) * 4); |
270,505 | public static void main1(String[] args) throws IOException {<NEW_LINE>Cmd cmd = MainUtils.parseArguments(args, ALL_FLAGS);<NEW_LINE>if (cmd.args.length < 3) {<NEW_LINE>System.out.println("A utility to tweak MPEG TS timestamps.");<NEW_LINE>MainUtils.printHelp(ALL_FLAGS, Arrays.asList("command"<MASK><NEW_LINE>System.out.println("Where command is:\n" + "\t" + COMMAND_SHIFT + "\tShift timestamps of selected stream by arg." + "\n" + "\t" + COMMAND_SCALE + "\tScale timestams of selected stream by arg [num:den]." + "\n" + "\t" + COMMAND_ROUND + "\tRound timestamps of selected stream to multiples of arg.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File src = new File(cmd.getArg(2));<NEW_LINE>if (cmd.argsLength() > 3) {<NEW_LINE>File dst = new File(cmd.getArg(3));<NEW_LINE>IOUtils.copyFile(src, dst);<NEW_LINE>src = dst;<NEW_LINE>}<NEW_LINE>String command = cmd.getArg(0);<NEW_LINE>String stream = cmd.getStringFlagD(FLAG_STREAM, STREAM_ALL);<NEW_LINE>if (COMMAND_SHIFT.equalsIgnoreCase(command)) {<NEW_LINE>final long shift = Long.parseLong(cmd.getArg(1));<NEW_LINE>new BaseCommand(stream) {<NEW_LINE><NEW_LINE>protected long withTimestamp(long pts, boolean isPts) {<NEW_LINE>return Math.max(pts + shift, 0);<NEW_LINE>}<NEW_LINE>}.fix(src);<NEW_LINE>} else if (COMMAND_SCALE.equalsIgnoreCase(command)) {<NEW_LINE>final RationalLarge scale = RationalLarge.parse(cmd.getArg(1));<NEW_LINE>new BaseCommand(stream) {<NEW_LINE><NEW_LINE>protected long withTimestamp(long pts, boolean isPts) {<NEW_LINE>return scale.multiplyS(pts);<NEW_LINE>}<NEW_LINE>}.fix(src);<NEW_LINE>} else if (COMMAND_ROUND.equalsIgnoreCase(command)) {<NEW_LINE>final int precision = Integer.parseInt(cmd.getArg(1));<NEW_LINE>new BaseCommand(stream) {<NEW_LINE><NEW_LINE>protected long withTimestamp(long pts, boolean isPts) {<NEW_LINE>return Math.round((double) pts / precision) * precision;<NEW_LINE>}<NEW_LINE>}.fix(src);<NEW_LINE>}<NEW_LINE>} | , "arg", "in name", "?out file")); |
838,101 | public void lower(NewInstanceNode newInstanceNode, HotSpotRegistersProvider registers, LoweringTool tool) {<NEW_LINE>StructuredGraph graph = newInstanceNode.graph();<NEW_LINE>HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) newInstanceNode.instanceClass();<NEW_LINE>assert !type.isArray();<NEW_LINE>ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), type.klass(), providers.getMetaAccess(), graph);<NEW_LINE>int size = instanceSize(type);<NEW_LINE>OptionValues localOptions = graph.getOptions();<NEW_LINE>SnippetInfo snippet = GeneratePIC.getValue(localOptions) ? allocateInstancePIC : allocateInstance;<NEW_LINE>Arguments args = new Arguments(snippet, graph.getGuardsStage(), tool.getLoweringStage());<NEW_LINE>args.addConst("size", size);<NEW_LINE>args.add("hub", hub);<NEW_LINE>args.add("prototypeMarkWord", type.prototypeMarkWord());<NEW_LINE>args.addConst("fillContents", newInstanceNode.fillContents());<NEW_LINE>args.addConst("threadRegister", registers.getThreadRegister());<NEW_LINE>args.addConst("constantSize", true);<NEW_LINE>args.addConst("typeContext", ProfileAllocations.getValue(localOptions) ? type.toJavaName(false) : "");<NEW_LINE>args.addConst("options", localOptions);<NEW_LINE>args.addConst("counters", counters);<NEW_LINE>SnippetTemplate template = template(newInstanceNode, args);<NEW_LINE>graph.getDebug().log("Lowering allocateInstance in %s: node=%s, template=%s, arguments=%s", <MASK><NEW_LINE>template.instantiate(providers.getMetaAccess(), newInstanceNode, DEFAULT_REPLACER, args);<NEW_LINE>} | graph, newInstanceNode, template, args); |
791,144 | private final boolean isSeenState(final TLCState curState, final TLCState succState, final Action action, final Worker worker, final SetOfStates liveNextStates) throws IOException {<NEW_LINE>final <MASK><NEW_LINE>final boolean seen = this.theFPSet.put(fp);<NEW_LINE>// Write out succState when needed:<NEW_LINE>this.allStateWriter.writeState(curState, succState, !seen, action);<NEW_LINE>if (!seen) {<NEW_LINE>// Write succState to trace only if it satisfies the<NEW_LINE>// model constraints. Do not enqueue it yet, but wait<NEW_LINE>// for implied actions and invariants to be checked.<NEW_LINE>// Those checks - if violated - will cause model checking<NEW_LINE>// to terminate. Thus we cannot let concurrent workers start<NEW_LINE>// exploring this new state. Conversely, the state has to<NEW_LINE>// be in the trace in case either invariant or implied action<NEW_LINE>// checks want to print the trace.<NEW_LINE>worker.writeState(curState, fp, succState);<NEW_LINE>if (coverage) {<NEW_LINE>action.cm.incSecondary();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// For liveness checking:<NEW_LINE>if (this.checkLiveness) {<NEW_LINE>liveNextStates.put(fp, succState);<NEW_LINE>}<NEW_LINE>return seen;<NEW_LINE>} | long fp = succState.fingerPrint(); |
1,087,254 | private boolean isValidSysTopicConf(TopicDeployEntity deployEntity, StringBuilder strBuff, ProcessResult result) {<NEW_LINE>if (!TServerConstants.OFFSET_HISTORY_NAME.equals(deployEntity.getTopicName())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (deployEntity.getNumTopicStores() != TServerConstants.OFFSET_HISTORY_NUMSTORES) {<NEW_LINE>result.setFailResult(DataOpErrCode.DERR_ILLEGAL_VALUE.getCode(), strBuff.append("For system topic").append(TServerConstants.OFFSET_HISTORY_NAME).append(", the TopicStores value(").append(TServerConstants.OFFSET_HISTORY_NUMSTORES).append<MASK><NEW_LINE>strBuff.delete(0, strBuff.length());<NEW_LINE>return result.isSuccess();<NEW_LINE>}<NEW_LINE>if (deployEntity.getNumPartitions() != TServerConstants.OFFSET_HISTORY_NUMPARTS) {<NEW_LINE>result.setFailResult(DataOpErrCode.DERR_ILLEGAL_VALUE.getCode(), strBuff.append("For system topic").append(TServerConstants.OFFSET_HISTORY_NAME).append(", the Partition value(").append(TServerConstants.OFFSET_HISTORY_NUMPARTS).append(") cannot be changed!").toString());<NEW_LINE>strBuff.delete(0, strBuff.length());<NEW_LINE>return result.isSuccess();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | (") cannot be changed!").toString()); |
980,105 | public List<ConfigChangeAction> validate(VespaModel model, ValidationParameters validationParameters, DeployState deployState) {<NEW_LINE>if (validationParameters.checkRouting()) {<NEW_LINE>new RoutingValidator().validate(model, deployState);<NEW_LINE>new RoutingSelectorValidator().validate(model, deployState);<NEW_LINE>}<NEW_LINE>new SchemasDirValidator().validate(model, deployState);<NEW_LINE>new BundleValidator().validate(model, deployState);<NEW_LINE>new SearchDataTypeValidator().validate(model, deployState);<NEW_LINE>new ComplexAttributeFieldsValidator().validate(model, deployState);<NEW_LINE>new StreamingValidator().validate(model, deployState);<NEW_LINE>new RankSetupValidator(validationParameters.ignoreValidationErrors()).validate(model, deployState);<NEW_LINE>new NoPrefixForIndexes().validate(model, deployState);<NEW_LINE>new DeploymentSpecValidator().validate(model, deployState);<NEW_LINE>new ValidationOverridesValidator().validate(model, deployState);<NEW_LINE>new RankingConstantsValidator().validate(model, deployState);<NEW_LINE>new SecretStoreValidator(<MASK><NEW_LINE>new EndpointCertificateSecretsValidator().validate(model, deployState);<NEW_LINE>new AccessControlFilterValidator().validate(model, deployState);<NEW_LINE>new CloudWatchValidator().validate(model, deployState);<NEW_LINE>new QuotaValidator().validate(model, deployState);<NEW_LINE>new UriBindingsValidator().validate(model, deployState);<NEW_LINE>additionalValidators.forEach(v -> v.validate(model, deployState));<NEW_LINE>List<ConfigChangeAction> result = Collections.emptyList();<NEW_LINE>if (deployState.getProperties().isFirstTimeDeployment()) {<NEW_LINE>validateFirstTimeDeployment(model, deployState);<NEW_LINE>} else {<NEW_LINE>Optional<Model> currentActiveModel = deployState.getPreviousModel();<NEW_LINE>if (currentActiveModel.isPresent() && (currentActiveModel.get() instanceof VespaModel)) {<NEW_LINE>result = validateChanges((VespaModel) currentActiveModel.get(), model, deployState.validationOverrides(), deployState.getDeployLogger(), deployState.now());<NEW_LINE>deferConfigChangesForClustersToBeRestarted(result, model);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ).validate(model, deployState); |
449,659 | public void show() {<NEW_LINE>if (headLine == null)<NEW_LINE>headLine = Res.get("setXMRTxKeyWindow.headline");<NEW_LINE>width = 868;<NEW_LINE>createGridPane();<NEW_LINE>addHeadLine();<NEW_LINE>addContent();<NEW_LINE>addButtons();<NEW_LINE>regexValidator = new RegexValidator();<NEW_LINE>regexValidator.setPattern("[a-fA-F0-9]{64}|^$");<NEW_LINE>regexValidator.setErrorMessage(Res.get("portfolio.pending.step2_buyer.confirmStart.proof.invalidInput"));<NEW_LINE>txHashInputTextField.setValidator(regexValidator);<NEW_LINE>txKeyInputTextField.setValidator(regexValidator);<NEW_LINE>if (isDevMode()) {<NEW_LINE>// pre-populate the fields with test data when in dev mode<NEW_LINE>txHashInputTextField.setText(XmrTxProofModel.DEV_TX_HASH);<NEW_LINE>txKeyInputTextField.setText(XmrTxProofModel.DEV_TX_KEY);<NEW_LINE>}<NEW_LINE>actionButton.disableProperty().bind(createBooleanBinding(() -> {<NEW_LINE>String txHash = txHashInputTextField.getText();<NEW_LINE><MASK><NEW_LINE>// If a field is empty we allow to continue. We do not enforce that users send the data.<NEW_LINE>if (txHash.isEmpty() || txKey.isEmpty()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Otherwise we require that input is valid<NEW_LINE>return !txHashInputTextField.getValidator().validate(txHash).isValid || !txKeyInputTextField.getValidator().validate(txKey).isValid;<NEW_LINE>}, txHashInputTextField.textProperty(), txKeyInputTextField.textProperty()));<NEW_LINE>applyStyles();<NEW_LINE>display();<NEW_LINE>} | String txKey = txKeyInputTextField.getText(); |
571,278 | private static Properties loadProfiles() {<NEW_LINE>Properties systemDefaults;<NEW_LINE>try {<NEW_LINE>systemDefaults = SystemUtil.loadProperties(ColorSpaces.class, "com/twelvemonkeys/imageio/color/icc_profiles_" + Platform.<MASK><NEW_LINE>} catch (@SuppressWarnings("CatchMayIgnoreException") SecurityException | IOException ignore) {<NEW_LINE>System.err.printf("Warning: Could not load system default ICC profile locations from %s, will use bundled fallback profiles.\n", ignore.getMessage());<NEW_LINE>if (DEBUG) {<NEW_LINE>ignore.printStackTrace();<NEW_LINE>}<NEW_LINE>systemDefaults = null;<NEW_LINE>}<NEW_LINE>// Create map with defaults and add user overrides if any<NEW_LINE>Properties profiles = new Properties(systemDefaults);<NEW_LINE>try {<NEW_LINE>Properties userOverrides = SystemUtil.loadProperties(ColorSpaces.class, "com/twelvemonkeys/imageio/color/icc_profiles");<NEW_LINE>profiles.putAll(userOverrides);<NEW_LINE>} catch (SecurityException | IOException ignore) {<NEW_LINE>// Most likely, this file won't be there<NEW_LINE>}<NEW_LINE>if (DEBUG) {<NEW_LINE>System.out.println("User ICC profiles: " + profiles);<NEW_LINE>System.out.println("System ICC profiles : " + systemDefaults);<NEW_LINE>}<NEW_LINE>return profiles;<NEW_LINE>} | os().id()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.