idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,058,145 | public void testWeldSessionAttributes(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>String <MASK><NEW_LINE>String key0 = sessionId + ".WELD_S#0";<NEW_LINE>String key1 = sessionId + ".WELD_S#1";<NEW_LINE>Cache<String, byte[]> cache = SessionCacheTestServlet.getAttrCache();<NEW_LINE>byte[] value0 = cache.get(key0);<NEW_LINE>byte[] value1 = cache.get(key1);<NEW_LINE>String strValue0 = Arrays.toString(value0);<NEW_LINE>String strValue1 = Arrays.toString(value1);<NEW_LINE>System.out.println("bytes for " + key0 + ": " + strValue0);<NEW_LINE>System.out.println("bytes for " + key1 + ": " + strValue1);<NEW_LINE>PrintWriter responseWriter = response.getWriter();<NEW_LINE>responseWriter.write("bytes for WELD_S#0: " + strValue0);<NEW_LINE>responseWriter.write("bytes for WELD_S#1: " + strValue1);<NEW_LINE>} | sessionId = request.getParameter("sessionId"); |
498,003 | final DBClusterSnapshotAttributesResult executeModifyDBClusterSnapshotAttribute(ModifyDBClusterSnapshotAttributeRequest modifyDBClusterSnapshotAttributeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyDBClusterSnapshotAttributeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyDBClusterSnapshotAttributeRequest> request = null;<NEW_LINE>Response<DBClusterSnapshotAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyDBClusterSnapshotAttributeRequestMarshaller().marshall(super.beforeMarshalling(modifyDBClusterSnapshotAttributeRequest));<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, "DocDB");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ModifyDBClusterSnapshotAttribute");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>StaxResponseHandler<DBClusterSnapshotAttributesResult> responseHandler = new StaxResponseHandler<DBClusterSnapshotAttributesResult>(new DBClusterSnapshotAttributesResultStaxUnmarshaller());<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.endEvent(Field.RequestMarshallTime); |
1,022,749 | public boolean updateConfig(String group, String serviceId, String config) throws Exception {<NEW_LINE>String appId = environment.getProperty(ApolloConstant.APOLLO_PLUGIN_APP_ID);<NEW_LINE>if (StringUtils.isEmpty(appId)) {<NEW_LINE>throw new DiscoveryException(ApolloConstant.APOLLO_PLUGIN_APP_ID + " can't be null or empty");<NEW_LINE>}<NEW_LINE>String env = environment.getProperty(ApolloConstant.APOLLO_PLUGIN_ENV);<NEW_LINE>if (StringUtils.isEmpty(env)) {<NEW_LINE>throw new DiscoveryException(ApolloConstant.APOLLO_PLUGIN_ENV + " can't be null or empty");<NEW_LINE>}<NEW_LINE>String operator = environment.getProperty(ApolloConstant.APOLLO_OPERATOR);<NEW_LINE>if (StringUtils.isEmpty(operator)) {<NEW_LINE>throw new DiscoveryException(ApolloConstant.APOLLO_OPERATOR + " can't be null or empty");<NEW_LINE>}<NEW_LINE>String cluster = environment.getProperty(ApolloConstant.APOLLO_PLUGIN_CLUSTER, String.class, ApolloConstant.APOLLO_DEFAULT_CLUSTER);<NEW_LINE>String namespace = environment.getProperty(ApolloConstant.APOLLO_PLUGIN_NAMESPACE, <MASK><NEW_LINE>Date now = new Date();<NEW_LINE>OpenItemDTO openItemDTO = new OpenItemDTO();<NEW_LINE>openItemDTO.setKey(group + "-" + serviceId);<NEW_LINE>openItemDTO.setValue(config);<NEW_LINE>openItemDTO.setComment("Operated by Nepxion Discovery Console");<NEW_LINE>openItemDTO.setDataChangeCreatedBy(operator);<NEW_LINE>openItemDTO.setDataChangeLastModifiedBy(operator);<NEW_LINE>openItemDTO.setDataChangeCreatedTime(now);<NEW_LINE>openItemDTO.setDataChangeLastModifiedTime(now);<NEW_LINE>apolloOpenApiClient.createOrUpdateItem(appId, env, cluster, namespace, openItemDTO);<NEW_LINE>NamespaceReleaseDTO namespaceReleaseDTO = new NamespaceReleaseDTO();<NEW_LINE>namespaceReleaseDTO.setReleaseTitle(new SimpleDateFormat("yyyyMMddHHmmss").format(now) + "-release");<NEW_LINE>namespaceReleaseDTO.setReleasedBy(operator);<NEW_LINE>namespaceReleaseDTO.setReleaseComment("Released by Nepxion Discovery Console");<NEW_LINE>namespaceReleaseDTO.setEmergencyPublish(true);<NEW_LINE>apolloOpenApiClient.publishNamespace(appId, env, cluster, namespace, namespaceReleaseDTO);<NEW_LINE>return true;<NEW_LINE>} | String.class, ApolloConstant.APOLLO_DEFAULT_NAMESPACE); |
1,113,578 | public StopContinuousExportResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>StopContinuousExportResult stopContinuousExportResult = new StopContinuousExportResult();<NEW_LINE><MASK><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 stopContinuousExportResult;<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("startTime", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>stopContinuousExportResult.setStartTime(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("stopTime", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>stopContinuousExportResult.setStopTime(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").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 stopContinuousExportResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
26,138 | private Coin payToFederation(Constants constants, boolean isRskip85Enabled, Block processingBlock, BlockHeader processingBlockHeader, Coin syntheticReward) {<NEW_LINE>RemascFederationProvider federationProvider = new RemascFederationProvider(activationConfig, constants.<MASK><NEW_LINE>Coin federationReward = syntheticReward.divide(BigInteger.valueOf(remascConstants.getFederationDivisor()));<NEW_LINE>Coin payToFederation = provider.getFederationBalance().add(federationReward);<NEW_LINE>byte[] processingBlockHash = processingBlockHeader.getHash().getBytes();<NEW_LINE>int nfederators = federationProvider.getFederationSize();<NEW_LINE>Coin[] payAndRemainderToFederator = payToFederation.divideAndRemainder(BigInteger.valueOf(nfederators));<NEW_LINE>Coin payToFederator = payAndRemainderToFederator[0];<NEW_LINE>Coin restToLastFederator = payAndRemainderToFederator[1];<NEW_LINE>if (isRskip85Enabled) {<NEW_LINE>BigInteger minimumFederatorPayableGas = constants.getFederatorMinimumPayableGas();<NEW_LINE>Coin minPayableFederatorFees = executionBlock.getMinimumGasPrice().multiply(minimumFederatorPayableGas);<NEW_LINE>if (payToFederator.compareTo(minPayableFederatorFees) < 0) {<NEW_LINE>provider.setFederationBalance(payToFederation);<NEW_LINE>return federationReward;<NEW_LINE>} else {<NEW_LINE>// balance goes to zero because all federation balance will be distributed<NEW_LINE>provider.setFederationBalance(Coin.ZERO);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int k = 0; k < nfederators; k++) {<NEW_LINE>RskAddress federatorAddress = federationProvider.getFederatorAddress(k);<NEW_LINE>if (k == nfederators - 1 && restToLastFederator.compareTo(Coin.ZERO) > 0) {<NEW_LINE>feesPayer.payMiningFees(processingBlockHash, payToFederator.add(restToLastFederator), federatorAddress, logs);<NEW_LINE>} else {<NEW_LINE>feesPayer.payMiningFees(processingBlockHash, payToFederator, federatorAddress, logs);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return federationReward;<NEW_LINE>} | getBridgeConstants(), repository, processingBlock); |
1,057,739 | public CellStyle createCellStyle(WriteCellStyle writeCellStyle, CellStyle originCellStyle) {<NEW_LINE>if (writeCellStyle == null) {<NEW_LINE>return originCellStyle;<NEW_LINE>}<NEW_LINE>short styleIndex = -1;<NEW_LINE>Font originFont = null;<NEW_LINE>boolean useCache = true;<NEW_LINE>if (originCellStyle != null) {<NEW_LINE>styleIndex = originCellStyle.getIndex();<NEW_LINE>if (originCellStyle instanceof XSSFCellStyle) {<NEW_LINE>originFont = ((XSSFCellStyle) originCellStyle).getFont();<NEW_LINE>} else if (originCellStyle instanceof HSSFCellStyle) {<NEW_LINE>originFont = ((HSSFCellStyle) originCellStyle).getFont(workbook);<NEW_LINE>}<NEW_LINE>useCache = false;<NEW_LINE>}<NEW_LINE>Map<WriteCellStyle, CellStyle> cellStyleMap = cellStyleIndexMap.computeIfAbsent(styleIndex, key -> MapUtils.newHashMap());<NEW_LINE>CellStyle cellStyle = cellStyleMap.get(writeCellStyle);<NEW_LINE>if (cellStyle != null) {<NEW_LINE>return cellStyle;<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.info("create new style:{},{}", writeCellStyle, originCellStyle);<NEW_LINE>}<NEW_LINE>WriteCellStyle tempWriteCellStyle = new WriteCellStyle();<NEW_LINE>WriteCellStyle.merge(writeCellStyle, tempWriteCellStyle);<NEW_LINE>cellStyle = StyleUtil.buildCellStyle(workbook, originCellStyle, tempWriteCellStyle);<NEW_LINE>Short dataFormat = createDataFormat(tempWriteCellStyle.getDataFormatData(), useCache);<NEW_LINE>if (dataFormat != null) {<NEW_LINE>cellStyle.setDataFormat(dataFormat);<NEW_LINE>}<NEW_LINE>Font font = createFont(tempWriteCellStyle.getWriteFont(), originFont, useCache);<NEW_LINE>if (font != null) {<NEW_LINE>cellStyle.setFont(font);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>return cellStyle;<NEW_LINE>} | cellStyleMap.put(tempWriteCellStyle, cellStyle); |
1,774,945 | public void resumeSelectAttackers(Game game) {<NEW_LINE>Map<UUID, Set<MageObjectReference>> morSetMap = new HashMap<>();<NEW_LINE>for (CombatGroup group : groups) {<NEW_LINE>for (UUID attacker : group.getAttackers()) {<NEW_LINE>if (attackersTappedByAttack.contains(attacker)) {<NEW_LINE>Permanent attackingPermanent = game.getPermanent(attacker);<NEW_LINE>if (attackingPermanent != null) {<NEW_LINE>attackingPermanent.setTapped(false);<NEW_LINE>// to tap with event finally here is needed to prevent abusing of Vampire Envoy like cards<NEW_LINE>attackingPermanent.tap(true, null, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>handleBanding(attacker, game);<NEW_LINE>// This can only be used to modify the event, the attack can't be replaced here<NEW_LINE>game.replaceEvent(new AttackerDeclaredEvent(group<MASK><NEW_LINE>game.addSimultaneousEvent(new AttackerDeclaredEvent(group.defenderId, attacker, attackingPlayerId));<NEW_LINE>morSetMap.computeIfAbsent(group.defenderId, x -> new HashSet<>()).add(new MageObjectReference(attacker, game));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>attackersTappedByAttack.clear();<NEW_LINE>DefenderAttackedEvent.makeAddEvents(morSetMap, attackingPlayerId, game);<NEW_LINE>game.addSimultaneousEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_ATTACKERS, attackingPlayerId, attackingPlayerId));<NEW_LINE>if (!game.isSimulation()) {<NEW_LINE>Player player = game.getPlayer(attackingPlayerId);<NEW_LINE>if (player != null) {<NEW_LINE>if (groups.size() > 0) {<NEW_LINE>game.informPlayers(player.getLogName() + " attacks with " + groups.size() + (groups.size() == 1 ? " creature" : " creatures"));<NEW_LINE>} else {<NEW_LINE>game.informPlayers(player.getLogName() + " skip attack");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .defenderId, attacker, attackingPlayerId)); |
1,469,933 | private // active config model which is changed on activate<NEW_LINE>List<Node> prepareNodes(ApplicationId application, ClusterSpec cluster, NodeSpec requestedNodes, int wantedGroups, boolean reuseIndexes) {<NEW_LINE>NodesAndHosts<LockedNodeList> allNodesAndHosts = groupPreparer.createNodesAndHostUnlocked();<NEW_LINE>NodeList appNodes = allNodesAndHosts.nodes().owner(application);<NEW_LINE>List<Node> surplusNodes = findNodesInRemovableGroups(appNodes, cluster, wantedGroups);<NEW_LINE>List<Integer> usedIndices = appNodes.cluster(cluster.id()).mapToList(node -> node.allocation().get().membership().index());<NEW_LINE>NodeIndices indices = new NodeIndices(usedIndices, reuseIndexes || !cluster.type().isContent());<NEW_LINE>List<Node> acceptedNodes = new ArrayList<>();<NEW_LINE>for (int groupIndex = 0; groupIndex < wantedGroups; groupIndex++) {<NEW_LINE>ClusterSpec clusterGroup = cluster.with(Optional.of(ClusterSpec.Group.from(groupIndex)));<NEW_LINE>GroupPreparer.PrepareResult result = groupPreparer.prepare(application, clusterGroup, requestedNodes.fraction(wantedGroups), surplusNodes, indices, wantedGroups, allNodesAndHosts);<NEW_LINE>// Might have changed<NEW_LINE>allNodesAndHosts = result.allNodesAndHosts;<NEW_LINE>List<MASK><NEW_LINE>if (requestedNodes.rejectNonActiveParent()) {<NEW_LINE>NodeList activeHosts = allNodesAndHosts.nodes().state(Node.State.active).parents().nodeType(requestedNodes.type().hostType());<NEW_LINE>accepted = accepted.stream().filter(node -> node.parentHostname().isEmpty() || activeHosts.parentOf(node).isPresent()).collect(Collectors.toList());<NEW_LINE>}<NEW_LINE>replace(acceptedNodes, accepted);<NEW_LINE>}<NEW_LINE>moveToActiveGroup(surplusNodes, wantedGroups, cluster.group());<NEW_LINE>acceptedNodes.removeAll(surplusNodes);<NEW_LINE>return acceptedNodes;<NEW_LINE>} | <Node> accepted = result.prepared; |
1,836,476 | public static ProjectProblemsProvider createPlatformVersionProblemProvider(@NonNull final AntProjectHelper projectHelper, @NonNull final PropertyEvaluator evaluator, @NullAllowed final PlatformUpdatedCallBack postPlatformSetHook, @NonNull final String platformType, @NonNull final SpecificationVersion minimalVersion, @NonNull final String platformProperty, @NonNull final String... versionProperties) {<NEW_LINE>// NOI18N<NEW_LINE>Parameters.notNull("projectHelper", projectHelper);<NEW_LINE>// NOI18N<NEW_LINE><MASK><NEW_LINE>// NOI18N<NEW_LINE>Parameters.notNull("platformType", platformType);<NEW_LINE>// NOI18N<NEW_LINE>Parameters.notNull("minimalVersion", minimalVersion);<NEW_LINE>// NOI18N<NEW_LINE>Parameters.notNull("platformProperty", platformProperty);<NEW_LINE>// NOI18N<NEW_LINE>Parameters.notNull("versionProperties", versionProperties);<NEW_LINE>return ProjectProblemsProviders.createPlatformVersionProblemProvider(projectHelper, evaluator, postPlatformSetHook, platformType, minimalVersion, platformProperty, versionProperties);<NEW_LINE>} | Parameters.notNull("evaluator", evaluator); |
1,197,340 | private int newCorrelationTypeKnownId(CorrelationAttributeInstance.Type newType) throws CentralRepoException {<NEW_LINE>Connection conn = connect();<NEW_LINE>PreparedStatement preparedStatement = null;<NEW_LINE>PreparedStatement preparedStatementQuery = null;<NEW_LINE>ResultSet resultSet = null;<NEW_LINE>int typeId = 0;<NEW_LINE>String insertSql;<NEW_LINE>String querySql;<NEW_LINE>// if we have a known ID, use it, if not (is -1) let the db assign it.<NEW_LINE>insertSql = "INSERT INTO correlation_types(id, display_name, db_table_name, supported, enabled) VALUES (?, ?, ?, ?, ?) " + getConflictClause();<NEW_LINE>querySql = "SELECT * FROM correlation_types WHERE display_name=? AND db_table_name=?";<NEW_LINE>try {<NEW_LINE>preparedStatement = conn.prepareStatement(insertSql);<NEW_LINE>preparedStatement.setInt(1, newType.getId());<NEW_LINE>preparedStatement.setString(2, newType.getDisplayName());<NEW_LINE>preparedStatement.setString(3, newType.getDbTableName());<NEW_LINE>preparedStatement.setInt(4, newType.isSupported() ? 1 : 0);<NEW_LINE>preparedStatement.setInt(5, newType.isEnabled() ? 1 : 0);<NEW_LINE>preparedStatement.executeUpdate();<NEW_LINE>preparedStatementQuery = conn.prepareStatement(querySql);<NEW_LINE>preparedStatementQuery.setString(1, newType.getDisplayName());<NEW_LINE>preparedStatementQuery.setString(2, newType.getDbTableName());<NEW_LINE>resultSet = preparedStatementQuery.executeQuery();<NEW_LINE>if (resultSet.next()) {<NEW_LINE>CorrelationAttributeInstance.Type correlationType = getCorrelationTypeFromResultSet(resultSet);<NEW_LINE>typeId = correlationType.getId();<NEW_LINE>}<NEW_LINE>} catch (SQLException ex) {<NEW_LINE>// NON-NLS<NEW_LINE><MASK><NEW_LINE>} finally {<NEW_LINE>CentralRepoDbUtil.closeResultSet(resultSet);<NEW_LINE>CentralRepoDbUtil.closeStatement(preparedStatement);<NEW_LINE>CentralRepoDbUtil.closeStatement(preparedStatementQuery);<NEW_LINE>CentralRepoDbUtil.closeConnection(conn);<NEW_LINE>}<NEW_LINE>return typeId;<NEW_LINE>} | throw new CentralRepoException("Error inserting new correlation type.", ex); |
1,148,970 | public Status resetLearners(final String groupId, final Configuration conf, final List<PeerId> learners) {<NEW_LINE>checkLearnersOpParams(groupId, conf, learners);<NEW_LINE><MASK><NEW_LINE>final Status st = getLeader(groupId, conf, leaderId);<NEW_LINE>if (!st.isOk()) {<NEW_LINE>return st;<NEW_LINE>}<NEW_LINE>if (!this.cliClientService.connect(leaderId.getEndpoint())) {<NEW_LINE>return new Status(-1, "Fail to init channel to leader %s", leaderId);<NEW_LINE>}<NEW_LINE>final //<NEW_LINE>ResetLearnersRequest.Builder //<NEW_LINE>rb = //<NEW_LINE>ResetLearnersRequest.newBuilder().//<NEW_LINE>setGroupId(groupId).setLeaderId(leaderId.toString());<NEW_LINE>for (final PeerId peer : learners) {<NEW_LINE>rb.addLearners(peer.toString());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final Message result = this.cliClientService.resetLearners(leaderId.getEndpoint(), rb.build(), null).get();<NEW_LINE>return processLearnersOpResponse(groupId, result, "resetting learners: %s", learners);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>return new Status(-1, e.getMessage());<NEW_LINE>}<NEW_LINE>} | final PeerId leaderId = new PeerId(); |
540,044 | public static DescribeInstanceResponse unmarshall(DescribeInstanceResponse describeInstanceResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeInstanceResponse.setRequestId(_ctx.stringValue("DescribeInstanceResponse.RequestId"));<NEW_LINE>describeInstanceResponse.setInstanceId(_ctx.stringValue("DescribeInstanceResponse.InstanceId"));<NEW_LINE>describeInstanceResponse.setName(_ctx.stringValue("DescribeInstanceResponse.Name"));<NEW_LINE>describeInstanceResponse.setDescription(_ctx.stringValue("DescribeInstanceResponse.Description"));<NEW_LINE>describeInstanceResponse.setStatus(_ctx.stringValue("DescribeInstanceResponse.Status"));<NEW_LINE>describeInstanceResponse.setConcurrency(_ctx.longValue("DescribeInstanceResponse.Concurrency"));<NEW_LINE>describeInstanceResponse.setModifyTime(_ctx.longValue("DescribeInstanceResponse.ModifyTime"));<NEW_LINE>describeInstanceResponse.setModifyUserName(_ctx.stringValue("DescribeInstanceResponse.ModifyUserName"));<NEW_LINE>describeInstanceResponse.setNluServiceType(_ctx.stringValue("DescribeInstanceResponse.NluServiceType"));<NEW_LINE>List<String> applicableOperations = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeInstanceResponse.ApplicableOperations.Length"); i++) {<NEW_LINE>applicableOperations.add(_ctx.stringValue<MASK><NEW_LINE>}<NEW_LINE>describeInstanceResponse.setApplicableOperations(applicableOperations);<NEW_LINE>return describeInstanceResponse;<NEW_LINE>} | ("DescribeInstanceResponse.ApplicableOperations[" + i + "]")); |
1,578,692 | private void mergeOsAccounts(OsAccount sourceAccount, OsAccount destAccount, CaseDbTransaction trans) throws TskCoreException {<NEW_LINE>String query = "";<NEW_LINE>try (Statement s = trans.getConnection().createStatement()) {<NEW_LINE>// Update all references<NEW_LINE>query = <MASK><NEW_LINE>s.executeUpdate(query);<NEW_LINE>// tsk_os_account_instances has a unique constraint on os_account_obj_id, data_source_obj_id, and instance_type,<NEW_LINE>// so delete any rows that would be duplicates.<NEW_LINE>query = "DELETE FROM tsk_os_account_instances " + "WHERE id IN ( " + "SELECT " + " sourceAccountInstance.id " + "FROM " + " tsk_os_account_instances destAccountInstance " + "INNER JOIN tsk_os_account_instances sourceAccountInstance ON destAccountInstance.data_source_obj_id = sourceAccountInstance.data_source_obj_id " + "WHERE destAccountInstance.os_account_obj_id = " + destAccount.getId() + " AND sourceAccountInstance.os_account_obj_id = " + sourceAccount.getId() + " AND sourceAccountInstance.instance_type = destAccountInstance.instance_type" + ")";<NEW_LINE>s.executeUpdate(query);<NEW_LINE>query = makeOsAccountUpdateQuery("tsk_os_account_instances", sourceAccount, destAccount);<NEW_LINE>s.executeUpdate(query);<NEW_LINE>synchronized (osAcctInstancesCacheLock) {<NEW_LINE>osAccountInstanceCache.clear();<NEW_LINE>}<NEW_LINE>query = makeOsAccountUpdateQuery("tsk_files", sourceAccount, destAccount);<NEW_LINE>s.executeUpdate(query);<NEW_LINE>query = makeOsAccountUpdateQuery("tsk_data_artifacts", sourceAccount, destAccount);<NEW_LINE>s.executeUpdate(query);<NEW_LINE>// Update the source account. Make a dummy signature to prevent problems with the unique constraint.<NEW_LINE>String mergedSignature = makeMergedOsAccountSignature();<NEW_LINE>query = "UPDATE tsk_os_accounts SET merged_into = " + destAccount.getId() + ", db_status = " + OsAccount.OsAccountDbStatus.MERGED.getId() + ", signature = '" + mergedSignature + "' " + " WHERE os_account_obj_id = " + sourceAccount.getId();<NEW_LINE>s.executeUpdate(query);<NEW_LINE>trans.registerDeletedOsAccount(sourceAccount.getId());<NEW_LINE>// Merge and update the destination account. Note that this must be done after updating<NEW_LINE>// the source account to prevent conflicts when merging two accounts in the<NEW_LINE>// same realm.<NEW_LINE>mergeOsAccountObjectsAndUpdateDestAccount(sourceAccount, destAccount, trans);<NEW_LINE>} catch (SQLException ex) {<NEW_LINE>throw new TskCoreException("Error executing SQL update: " + query, ex);<NEW_LINE>}<NEW_LINE>} | makeOsAccountUpdateQuery("tsk_os_account_attributes", sourceAccount, destAccount); |
1,747,751 | public Optional<GameProfile> card_findByName(String name) {<NEW_LINE>Optional<GameProfile> optional2 = null;<NEW_LINE>String string = name.toLowerCase(Locale.ROOT);<NEW_LINE>Entry entry = this.byName.get(string);<NEW_LINE>boolean bl = false;<NEW_LINE>if (entry != null && new Date().getTime() >= entry.getExpirationDate().getTime()) {<NEW_LINE>this.byUuid.remove(entry.getProfile().getId());<NEW_LINE>this.byName.remove(entry.getProfile().getName().toLowerCase(Locale.ROOT));<NEW_LINE>bl = true;<NEW_LINE>entry = null;<NEW_LINE>}<NEW_LINE>if (entry != null) {<NEW_LINE>entry.setLastAccessed(this.incrementAndGetAccessCount());<NEW_LINE>optional2 = Optional.of(entry.getProfile());<NEW_LINE>} else {<NEW_LINE>optional2 = card_findProfileByName(this.profileRepository, string);<NEW_LINE>if (optional2.isPresent()) {<NEW_LINE>server.getUserCache().<MASK><NEW_LINE>bl = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (bl)<NEW_LINE>server.getUserCache().save();<NEW_LINE>return optional2;<NEW_LINE>} | add(optional2.get()); |
1,040,014 | final ListSatellitesResult executeListSatellites(ListSatellitesRequest listSatellitesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listSatellitesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListSatellitesRequest> request = null;<NEW_LINE>Response<ListSatellitesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListSatellitesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listSatellitesRequest));<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, "GroundStation");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSatellites");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListSatellitesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListSatellitesResultJsonUnmarshaller());<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); |
1,423,964 | private static List<ClipperTrip> computeBalances(long balance, @NonNull List<ClipperTrip> trips, @NonNull List<ClipperRefill> refills) {<NEW_LINE>List<ClipperTrip> tripsWithBalance = new ArrayList<>(Collections.nCopies(trips.size(), (ClipperTrip) null));<NEW_LINE>int tripIdx = 0;<NEW_LINE>int refillIdx = 0;<NEW_LINE>while (tripIdx < trips.size()) {<NEW_LINE>while (refillIdx < refills.size() && refills.get(refillIdx).getTimestamp() > trips.get(tripIdx).getTimestamp()) {<NEW_LINE>balance -= refills.get(refillIdx).getAmount();<NEW_LINE>refillIdx++;<NEW_LINE>}<NEW_LINE>tripsWithBalance.set(tripIdx, trips.get(tripIdx).toBuilder().balance(balance).build());<NEW_LINE>balance += trips.<MASK><NEW_LINE>tripIdx++;<NEW_LINE>}<NEW_LINE>return tripsWithBalance;<NEW_LINE>} | get(tripIdx).getFare(); |
1,682,644 | private OrderedCollection<PortChangeEvent> handlePortStatusDelete(OFPortDesc delPort) {<NEW_LINE>OrderedCollection<PortChangeEvent> events = new LinkedHashSetWrapper<>();<NEW_LINE>lock.writeLock().lock();<NEW_LINE>try {<NEW_LINE>Map<OFPort, OFPortDesc> newPortByNumber = new HashMap<>(portsByNumber);<NEW_LINE>OFPortDesc prevPort = portsByNumber.get(delPort.getPortNo());<NEW_LINE>if (prevPort == null) {<NEW_LINE>// so such port. Do we have a port with the name?<NEW_LINE>prevPort = portsByName.get(delPort.getName());<NEW_LINE>if (prevPort != null) {<NEW_LINE>newPortByNumber.remove(prevPort.getPortNo());<NEW_LINE>events.add(new PortChangeEvent(prevPort, PortChangeType.DELETE));<NEW_LINE>}<NEW_LINE>} else if (prevPort.getName().equals(delPort.getName())) {<NEW_LINE>// port exists with consistent name-number mapping<NEW_LINE>newPortByNumber.remove(delPort.getPortNo());<NEW_LINE>events.add(new PortChangeEvent(delPort, PortChangeType.DELETE));<NEW_LINE>} else {<NEW_LINE>// port with same number exists but its name differs. This<NEW_LINE>// is weird. The best we can do is to delete the existing<NEW_LINE>// port(s) that have delPort's name and number.<NEW_LINE>newPortByNumber.remove(delPort.getPortNo());<NEW_LINE>events.add(new PortChangeEvent<MASK><NEW_LINE>// is there another port that has delPort's name?<NEW_LINE>prevPort = portsByName.get(delPort.getName().toLowerCase());<NEW_LINE>if (prevPort != null) {<NEW_LINE>newPortByNumber.remove(prevPort.getPortNo());<NEW_LINE>events.add(new PortChangeEvent(prevPort, PortChangeType.DELETE));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>updatePortsWithNewPortsByNumber(newPortByNumber);<NEW_LINE>return events;<NEW_LINE>} finally {<NEW_LINE>lock.writeLock().unlock();<NEW_LINE>}<NEW_LINE>} | (prevPort, PortChangeType.DELETE)); |
625,569 | // Parses the specified source into a compilation unit with type bindings.<NEW_LINE>private CompilationUnit compileSource(String source, String sourceFilePath, String unitName, StringBuilder errors) throws Exception {<NEW_LINE>if (!unitName.endsWith(".java")) {<NEW_LINE>// The AST compiler is surprisingly insistent about this.<NEW_LINE>unitName += ".java";<NEW_LINE>}<NEW_LINE>final File sourceFile = new File(sourceFilePath);<NEW_LINE>final String directoryPath = sourceFile.getAbsoluteFile().getParent();<NEW_LINE>Utils.logVerbose("compiling source for: " + directoryPath);<NEW_LINE>final String[] sources = _contextManager.getSourceLocator().getSourceSearchPaths();<NEW_LINE>final String[] classpath = _contextManager.getSourceLocator().getBinaryJarPaths();<NEW_LINE>final ASTParser parser = ASTParser.newParser(AST.JLS8);<NEW_LINE>final Map<String, String> options = JavaCore.getOptions();<NEW_LINE>JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);<NEW_LINE>parser.setCompilerOptions(options);<NEW_LINE>parser.setUnitName(unitName);<NEW_LINE>parser.setResolveBindings(true);<NEW_LINE>parser.setStatementsRecovery(true);<NEW_LINE>parser.setBindingsRecovery(true);<NEW_LINE>parser.setEnvironment(<MASK><NEW_LINE>parser.setSource(source.toCharArray());<NEW_LINE>CompilationUnit unit = (CompilationUnit) parser.createAST(null);<NEW_LINE>String errorMsg = checkUnitForProblems(unit);<NEW_LINE>if (errorMsg != null) {<NEW_LINE>errors.append(errorMsg);<NEW_LINE>}<NEW_LINE>return unit;<NEW_LINE>} | classpath, sources, null, true); |
30,581 | public void createAndFireStockCountEvents(@NonNull final I_Fresh_QtyOnHand qtyOnHand, @NonNull final ModelChangeType timing) {<NEW_LINE>final boolean createDeletedEvent = timing.isDelete() || ModelChangeUtil.isJustDeactivatedOrUnProcessed(qtyOnHand);<NEW_LINE>final List<AbstractStockEstimateEvent> events = new ArrayList<>();<NEW_LINE>final List<I_Fresh_QtyOnHand_Line> lines = freshQtyOnHandDAO.retrieveLines(qtyOnHand);<NEW_LINE>for (final I_Fresh_QtyOnHand_Line line : lines) {<NEW_LINE>final ProductDescriptor productDescriptor = productDescriptorFactory.createProductDescriptor(line);<NEW_LINE>final MaterialDescriptor materialDescriptor = MaterialDescriptor.builder().productDescriptor(productDescriptor).warehouseId(WarehouseId.ofRepoId(line.getM_Warehouse_ID())).quantity(line.getQtyCount()).date(TimeUtil.asInstant(line.getDateDoc())).build();<NEW_LINE>final AbstractStockEstimateEvent event;<NEW_LINE>if (createDeletedEvent) {<NEW_LINE>event = <MASK><NEW_LINE>} else {<NEW_LINE>event = Fresh_QtyOnHand_Line.buildCreatedEvent(line, materialDescriptor);<NEW_LINE>}<NEW_LINE>events.add(event);<NEW_LINE>}<NEW_LINE>events.forEach(materialEventService::postEventAfterNextCommit);<NEW_LINE>} | Fresh_QtyOnHand_Line.buildDeletedEvent(line, materialDescriptor); |
271,076 | protected void calculateLayout(View view, boolean initLayout) {<NEW_LINE>menuTitleHeight = view.findViewById(R.id.route_menu_top_shadow_all).getHeight() + view.findViewById(R.id.control_buttons).getHeight() - view.findViewById(R.<MASK><NEW_LINE>LinearLayout cardsContainer = getCardsContainer();<NEW_LINE>if (menu != null && cardsContainer != null && cardsContainer.getChildCount() > 0 && menu.isRouteSelected()) {<NEW_LINE>View topRouteCard = cardsContainer.getChildAt(0);<NEW_LINE>View badgesView = topRouteCard.findViewById(R.id.routes_badges);<NEW_LINE>View badgesPaddingView = topRouteCard.findViewById(R.id.badges_padding);<NEW_LINE>int paddingHeight = badgesPaddingView != null ? badgesPaddingView.getHeight() : 0;<NEW_LINE>menuTitleHeight += badgesView != null ? badgesView.getBottom() + paddingHeight : 0;<NEW_LINE>}<NEW_LINE>super.calculateLayout(view, initLayout);<NEW_LINE>} | id.buttons_shadow).getHeight(); |
117,962 | private void addAsClassDefItem(SootClass c) {<NEW_LINE>// add source file tag if any<NEW_LINE>SourceFileTag sft = (SourceFileTag) c.getTag(SourceFileTag.NAME);<NEW_LINE>String sourceFile = sft == null ? null : sft.getSourceFile();<NEW_LINE>String classType = SootToDexUtils.getDexTypeDescriptor(c.getType());<NEW_LINE>int accessFlags = c.getModifiers();<NEW_LINE>String superClass = c.hasSuperclass() ? SootToDexUtils.getDexTypeDescriptor(c.getSuperclass().getType()) : null;<NEW_LINE>List<String> interfaces = null;<NEW_LINE>if (!c.getInterfaces().isEmpty()) {<NEW_LINE>interfaces = new ArrayList<String>();<NEW_LINE>for (SootClass ifc : c.getInterfaces()) {<NEW_LINE>interfaces.add(SootToDexUtils.getDexTypeDescriptor(ifc.getType()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<Field> fields = null;<NEW_LINE>if (!c.getFields().isEmpty()) {<NEW_LINE>fields = new ArrayList<Field>();<NEW_LINE>for (SootField f : c.getFields()) {<NEW_LINE>// We do not want to write out phantom fields<NEW_LINE>if (isIgnored(f)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Look for a static initializer<NEW_LINE>EncodedValue staticInit = null;<NEW_LINE>for (Tag t : f.getTags()) {<NEW_LINE>if (t instanceof ConstantValueTag) {<NEW_LINE>if (staticInit != null) {<NEW_LINE>LOGGER.<MASK><NEW_LINE>} else {<NEW_LINE>staticInit = makeConstantItem(f, t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (staticInit == null) {<NEW_LINE>staticInit = BuilderEncodedValues.defaultValueForType(SootToDexUtils.getDexTypeDescriptor(f.getType()));<NEW_LINE>}<NEW_LINE>// Build field annotations<NEW_LINE>Set<Annotation> fieldAnnotations = buildFieldAnnotations(f);<NEW_LINE>ImmutableField field = new ImmutableField(classType, f.getName(), SootToDexUtils.getDexTypeDescriptor(f.getType()), f.getModifiers(), staticInit, fieldAnnotations, null);<NEW_LINE>fields.add(field);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Collection<Method> methods = toMethods(c);<NEW_LINE>ClassDef classDef = new ImmutableClassDef(classType, accessFlags, superClass, interfaces, sourceFile, buildClassAnnotations(c), fields, methods);<NEW_LINE>dexBuilder.internClass(classDef);<NEW_LINE>} | warn("More than one constant tag for field \"{}\": \"{}\"", f, t); |
1,507,682 | public void markup(OatHeader oatHeader, Program program, TaskMonitor monitor, MessageLog log) throws Exception {<NEW_LINE>Symbol oatDataSymbol = OatUtilities.getOatDataSymbol(program);<NEW_LINE>Address address = oatDataSymbol.getAddress();<NEW_LINE>Address <MASK><NEW_LINE>program.getListing().setComment(dataAddress, CodeUnit.PLATE_COMMENT, getDexFileLocation());<NEW_LINE>program.getListing().clearCodeUnits(dataAddress, dataAddress, false, monitor);<NEW_LINE>Data data = program.getListing().createData(dataAddress, toDataType());<NEW_LINE>for (int i = 0; i < data.getNumComponents(); ++i) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>Data componentI = data.getComponent(i);<NEW_LINE>if (componentI.getFieldName().startsWith("lookup_table_data_") || componentI.getFieldName().startsWith("oat_class_offsets_pointer_") || componentI.getFieldName().startsWith("lookup_table_data_") || componentI.getFieldName().startsWith("method_bss_mapping_") || componentI.getFieldName().startsWith("type_bss_mapping_") || componentI.getFieldName().startsWith("public_type_bss_mapping_") || componentI.getFieldName().startsWith("package_type_bss_mapping_") || componentI.getFieldName().startsWith("string_bss_mapping_") || componentI.getFieldName().startsWith("oat_class_offsets_pointer_") || componentI.getFieldName().startsWith("lookup_table_") || componentI.getFieldName().startsWith("dex_layout_sections_")) {<NEW_LINE>Scalar scalar = componentI.getScalar(0);<NEW_LINE>if (scalar.getUnsignedValue() == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Address destinationAddress = address.add(scalar.getUnsignedValue());<NEW_LINE>program.getReferenceManager().addMemoryReference(componentI.getMinAddress(), destinationAddress, RefType.DATA, SourceType.ANALYSIS, 0);<NEW_LINE>program.getSymbolTable().createLabel(destinationAddress, componentI.getFieldName(), SourceType.ANALYSIS);<NEW_LINE>if (componentI.getFieldName().startsWith("lookup_table_data_")) {<NEW_LINE>OatDexFileUtilities.markupLookupTableData(this.getClass(), destinationAddress, dexHeader, oatHeader, program, monitor, log);<NEW_LINE>} else if (componentI.getFieldName().startsWith("lookup_table_")) {<NEW_LINE>if (typeLookupTable != null) {<NEW_LINE>DataType dataType = typeLookupTable.toDataType();<NEW_LINE>program.getListing().createData(destinationAddress, dataType);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | dataAddress = address.add(_offset); |
214,006 | public boolean handleJob(final JobService jobService, final JobParameters params) {<NEW_LINE>PersistableBundle extras = params.getExtras();<NEW_LINE>// persistable bundle extras param name is appId for legacy reasons<NEW_LINE>String appScopeKey = extras.getString("appId");<NEW_LINE>String taskName = extras.getString("taskName");<NEW_LINE>TaskConsumerInterface consumer = getTaskConsumer(taskName, appScopeKey);<NEW_LINE>if (consumer == null) {<NEW_LINE><MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Log.i(TAG, "Handling job with task name '" + taskName + "' for app with scoping identifier '" + appScopeKey + "'.");<NEW_LINE>// executes task<NEW_LINE>boolean isAsyncJob = consumer.didExecuteJob(jobService, params);<NEW_LINE>if (isAsyncJob) {<NEW_LINE>// Make sure the task doesn't take more than 15 seconds<NEW_LINE>finishJobAfterTimeout(jobService, params, MAX_TASK_EXECUTION_TIME_MS);<NEW_LINE>}<NEW_LINE>return isAsyncJob;<NEW_LINE>} | Log.w(TAG, "Task or consumer not found."); |
102,205 | public synchronized int waitFor() throws InterruptedException {<NEW_LINE>if (exitValue == null) {<NEW_LINE>int[] stat_loc = { 0 };<NEW_LINE>Ruby runtime = this.runtime;<NEW_LINE><MASK><NEW_LINE>context.blockingThreadPoll();<NEW_LINE>retry: while (true) {<NEW_LINE>stat_loc[0] = 0;<NEW_LINE>// TODO: investigate WNOHANG<NEW_LINE>int result = runtime.getPosix().waitpid((int) finalPid, stat_loc, 0);<NEW_LINE>if (result == -1) {<NEW_LINE>Errno errno = Errno.valueOf(runtime.getPosix().errno());<NEW_LINE>switch(errno) {<NEW_LINE>case EINTR:<NEW_LINE>context.pollThreadEvents();<NEW_LINE>continue retry;<NEW_LINE>case ECHILD:<NEW_LINE>return -1;<NEW_LINE>default:<NEW_LINE>throw new RuntimeException("unexpected waitpid errno: " + Errno.valueOf(runtime.getPosix().errno()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// FIXME: Is this different across platforms? Got it all from Darwin's wait.h<NEW_LINE>status = stat_loc[0];<NEW_LINE>if (PosixShim.WAIT_MACROS.WIFEXITED((long) status)) {<NEW_LINE>exitValue = PosixShim.WAIT_MACROS.WEXITSTATUS((long) status);<NEW_LINE>} else if (PosixShim.WAIT_MACROS.WIFSIGNALED((long) status)) {<NEW_LINE>exitValue = PosixShim.WAIT_MACROS.WTERMSIG((long) status);<NEW_LINE>} else if (PosixShim.WAIT_MACROS.WIFSTOPPED((long) status)) {<NEW_LINE>exitValue = PosixShim.WAIT_MACROS.WSTOPSIG((long) status);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return exitValue;<NEW_LINE>} | ThreadContext context = runtime.getCurrentContext(); |
339,791 | public boolean handleChange(final ChangeEvent event) {<NEW_LINE>if (event.getState() == State.DELETED) {<NEW_LINE>UIHelper.runUISync(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>final Model model = event.getModel();<NEW_LINE>// getViewer().remove(...) internally (see<NEW_LINE>// org.eclipse.jface.viewers.StructuredViewer.findItems(Object)) tries to find<NEW_LINE>// the TreeItem corresponding to Spec (not TLCSpec). TLCSpec just wraps Spec but<NEW_LINE>// does not exist in the SpecExplorers content tree. With TLCSpec setSelection<NEW_LINE>// and remove are actually (silent) no-ops.<NEW_LINE>final Spec parent = model.getSpec().toSpec();<NEW_LINE>// The CommonViewer is stupid in that it accesses an element (model) even<NEW_LINE>// after it has been removed in order to update the viewer's current selection.<NEW_LINE>// Since we have to prevent this access to avoid a null pointer, we explicitly<NEW_LINE>// reset the selection.<NEW_LINE>getViewer().setSelection(new StructuredSelection(parent));<NEW_LINE>// ...still remove the element from the tree.<NEW_LINE>getViewer().remove(parent, <MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else if (event.getState() == State.REMOTE_NOT_RUNNING) {<NEW_LINE>UIHelper.runUISync(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>getViewer().refresh(event.getModel(), true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | new Object[] { model }); |
754,108 | protected AssemblyResolvedPatterns combineLessBackfill(AssemblyResolvedPatterns that, AssemblyResolvedBackfill bf) {<NEW_LINE>AssemblyPatternBlock newIns = this.ins.combine(that.ins);<NEW_LINE>if (newIns == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>AssemblyPatternBlock newCtx = this.ctx.combine(that.ctx);<NEW_LINE>if (newCtx == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Set<AssemblyResolvedBackfill> newBackfills = new HashSet<>(this.backfills);<NEW_LINE>newBackfills.addAll(that.backfills);<NEW_LINE>if (bf != null) {<NEW_LINE>newBackfills.remove(bf);<NEW_LINE>}<NEW_LINE>Set<AssemblyResolvedPatterns> newForbids = new HashSet<>(this.forbids);<NEW_LINE><MASK><NEW_LINE>return new AssemblyResolvedPatterns(description, cons, children, right, newIns, newCtx, Collections.unmodifiableSet(newBackfills), Collections.unmodifiableSet(newForbids));<NEW_LINE>} | newForbids.addAll(that.forbids); |
759,867 | private void changeOnOffline(String subject, String consumerGroup, boolean isOnline, StatusSource src) {<NEW_LINE>synchronized (getConsumerLockKey(subject, consumerGroup, "onOffline")) {<NEW_LINE>final String realSubject = RetrySubjectUtils.getRealSubject(subject);<NEW_LINE>final String retrySubject = RetrySubjectUtils.buildRetrySubject(realSubject, consumerGroup);<NEW_LINE>final String key = MapKeyBuilder.buildSubscribeKey(realSubject, consumerGroup);<NEW_LINE>final PullEntry pullEntry = pullEntryMap.get(key);<NEW_LINE>changeOnOffline(pullEntry, isOnline, src);<NEW_LINE>final PullEntry retryPullEntry = pullEntryMap.get(MapKeyBuilder<MASK><NEW_LINE>changeOnOffline(retryPullEntry, isOnline, src);<NEW_LINE>final DefaultPullConsumer pullConsumer = pullConsumerMap.get(key);<NEW_LINE>if (pullConsumer == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isOnline) {<NEW_LINE>pullConsumer.online(src);<NEW_LINE>} else {<NEW_LINE>pullConsumer.offline(src);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .buildSubscribeKey(retrySubject, consumerGroup)); |
888,747 | void doRequest(CollectorRegistry registry, String job, Map<String, String> groupingKey, String method) throws IOException {<NEW_LINE>String url = gatewayBaseURL;<NEW_LINE>if (job.contains("/")) {<NEW_LINE>url += "job@base64/" + base64url(job);<NEW_LINE>} else {<NEW_LINE>url += "job/" + <MASK><NEW_LINE>}<NEW_LINE>if (groupingKey != null) {<NEW_LINE>for (Map.Entry<String, String> entry : groupingKey.entrySet()) {<NEW_LINE>if (entry.getValue().isEmpty()) {<NEW_LINE>url += "/" + entry.getKey() + "@base64/=";<NEW_LINE>} else if (entry.getValue().contains("/")) {<NEW_LINE>url += "/" + entry.getKey() + "@base64/" + base64url(entry.getValue());<NEW_LINE>} else {<NEW_LINE>url += "/" + entry.getKey() + "/" + URLEncoder.encode(entry.getValue(), "UTF-8");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>HttpURLConnection connection = connectionFactory.create(url);<NEW_LINE>connection.setRequestProperty("Content-Type", TextFormat.CONTENT_TYPE_004);<NEW_LINE>if (!method.equals("DELETE")) {<NEW_LINE>connection.setDoOutput(true);<NEW_LINE>}<NEW_LINE>connection.setRequestMethod(method);<NEW_LINE>connection.setConnectTimeout(10 * MILLISECONDS_PER_SECOND);<NEW_LINE>connection.setReadTimeout(10 * MILLISECONDS_PER_SECOND);<NEW_LINE>connection.connect();<NEW_LINE>try {<NEW_LINE>if (!method.equals("DELETE")) {<NEW_LINE>BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF-8"));<NEW_LINE>TextFormat.write004(writer, registry.metricFamilySamples());<NEW_LINE>writer.flush();<NEW_LINE>writer.close();<NEW_LINE>}<NEW_LINE>int response = connection.getResponseCode();<NEW_LINE>if (response / 100 != 2) {<NEW_LINE>String errorMessage;<NEW_LINE>InputStream errorStream = connection.getErrorStream();<NEW_LINE>if (errorStream != null) {<NEW_LINE>String errBody = readFromStream(errorStream);<NEW_LINE>errorMessage = "Response code from " + url + " was " + response + ", response body: " + errBody;<NEW_LINE>} else {<NEW_LINE>errorMessage = "Response code from " + url + " was " + response;<NEW_LINE>}<NEW_LINE>throw new IOException(errorMessage);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>connection.disconnect();<NEW_LINE>}<NEW_LINE>} | URLEncoder.encode(job, "UTF-8"); |
1,828,608 | public void marshall(BurninDestinationSettings burninDestinationSettings, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (burninDestinationSettings == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getAlignment(), ALIGNMENT_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getApplyFontColor(), APPLYFONTCOLOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getBackgroundColor(), BACKGROUNDCOLOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getFallbackFont(), FALLBACKFONT_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getFontColor(), FONTCOLOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getFontOpacity(), FONTOPACITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getFontResolution(), FONTRESOLUTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getFontScript(), FONTSCRIPT_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getFontSize(), FONTSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getHexFontColor(), HEXFONTCOLOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getOutlineColor(), OUTLINECOLOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getOutlineSize(), OUTLINESIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getShadowColor(), SHADOWCOLOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getShadowOpacity(), SHADOWOPACITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getShadowXOffset(), SHADOWXOFFSET_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getShadowYOffset(), SHADOWYOFFSET_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getStylePassthrough(), STYLEPASSTHROUGH_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getTeletextSpacing(), TELETEXTSPACING_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getXPosition(), XPOSITION_BINDING);<NEW_LINE>protocolMarshaller.marshall(burninDestinationSettings.getYPosition(), YPOSITION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | burninDestinationSettings.getBackgroundOpacity(), BACKGROUNDOPACITY_BINDING); |
1,234,767 | public boolean execute() throws Exception {<NEW_LINE>if (_action.equalsIgnoreCase("extractFilterColumns")) {<NEW_LINE>Set<String> filterColumns = PinotDataAndQueryAnonymizer.FilterColumnExtractor.extractColumnsUsedInFilter(_queryDir, _originalQueryFile);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("Columns participating in filter: ");<NEW_LINE>for (String column : filterColumns) {<NEW_LINE>sb.append(column).append(" ");<NEW_LINE>}<NEW_LINE>System.out.println(sb.toString());<NEW_LINE>// if the user has asked for extracting filter columns from a query file, then<NEW_LINE>// we should simply return after doing that since the tool will be run subsequently<NEW_LINE>// based on the set of filter columns it returns to the user<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>Set<String> columnsToRetainDataFor = new HashSet<>();<NEW_LINE>if (_columnsToRetainDataFor != null) {<NEW_LINE>columnsToRetainDataFor.addAll(Lists.newArrayList(_columnsToRetainDataFor));<NEW_LINE>}<NEW_LINE>Set<String> <MASK><NEW_LINE>Map<String, Integer> filterColumnCardinalityMap = new HashMap<>();<NEW_LINE>if (_columnsParticipatingInFilter != null) {<NEW_LINE>for (int i = 0; i < _columnsParticipatingInFilter.length; i++) {<NEW_LINE>String columnInfo = _columnsParticipatingInFilter[i];<NEW_LINE>String[] columnAndCardinality = columnInfo.split(":");<NEW_LINE>int cardinality = Integer.valueOf(columnAndCardinality[1]);<NEW_LINE>filterColumnCardinalityMap.put(columnAndCardinality[0], cardinality);<NEW_LINE>filterColumns.add(columnAndCardinality[0]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (_action.equalsIgnoreCase("generateData")) {<NEW_LINE>// generate data<NEW_LINE>PinotDataAndQueryAnonymizer pinotDataGenerator = new PinotDataAndQueryAnonymizer(_inputSegmentsDir, _outputDir, _avroFileNamePrefix, filterColumnCardinalityMap, columnsToRetainDataFor, _mapBasedGlobalDictionaries);<NEW_LINE>// first build global dictionaries<NEW_LINE>pinotDataGenerator.buildGlobalDictionaries();<NEW_LINE>// use global dictionaries to generate Avro files<NEW_LINE>pinotDataGenerator.generateAvroFiles();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (_action.equalsIgnoreCase("generateQueries")) {<NEW_LINE>// generate queries from prebuilt global dictionaries<NEW_LINE>PinotDataAndQueryAnonymizer.QueryGenerator queryGenerator = new PinotDataAndQueryAnonymizer.QueryGenerator(_outputDir, _queryDir, _originalQueryFile, _tableName, filterColumns, columnsToRetainDataFor);<NEW_LINE>queryGenerator.generateQueries();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>throw new RuntimeException("-action should be either extractFilterColumns or generateData or generateQueries. Please use the -help " + "option to see usage examples");<NEW_LINE>} | filterColumns = new HashSet<>(); |
7,731 | public void close() throws IOException {<NEW_LINE>dataStream.close();<NEW_LINE>eiGen.close();<NEW_LINE>Map parameters;<NEW_LINE>if (digestCalculator != null) {<NEW_LINE>parameters = Collections.unmodifiableMap(getBaseParameters(contentType, digestCalculator.getAlgorithmIdentifier(), macCalculator.getAlgorithmIdentifier(), digestCalculator.getDigest()));<NEW_LINE>if (authGen == null) {<NEW_LINE>authGen = new DefaultAuthenticatedAttributeTableGenerator();<NEW_LINE>}<NEW_LINE>ASN1Set authed = new DERSet(authGen.getAttributes(parameters).toASN1EncodableVector());<NEW_LINE><MASK><NEW_LINE>mOut.write(authed.getEncoded(ASN1Encoding.DER));<NEW_LINE>mOut.close();<NEW_LINE>envGen.addObject(new DERTaggedObject(false, 2, authed));<NEW_LINE>} else {<NEW_LINE>parameters = Collections.EMPTY_MAP;<NEW_LINE>}<NEW_LINE>envGen.addObject(new DEROctetString(macCalculator.getMac()));<NEW_LINE>if (unauthGen != null) {<NEW_LINE>envGen.addObject(new DERTaggedObject(false, 3, new BERSet(unauthGen.getAttributes(parameters).toASN1EncodableVector())));<NEW_LINE>}<NEW_LINE>envGen.close();<NEW_LINE>cGen.close();<NEW_LINE>} | OutputStream mOut = macCalculator.getOutputStream(); |
1,690,427 | private void sendScreenNotification(String message, String detail) {<NEW_LINE>Context context = mContext;<NEW_LINE>if (context == null) {<NEW_LINE>LogManager.e(TAG, "congtext is unexpectedly null");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>initializeWithContext(context);<NEW_LINE>if (this.mNotificationsEnabled) {<NEW_LINE>if (!this.mNotificationChannelCreated) {<NEW_LINE>createNotificationChannel(context, "err");<NEW_LINE>}<NEW_LINE>NotificationCompat.Builder builder = (new NotificationCompat.Builder(context, "err")).setContentTitle("BluetoothMedic: " + message).setSmallIcon(mNotificationIcon).setVibrate(new long[] { 200L, 100L, <MASK><NEW_LINE>TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);<NEW_LINE>stackBuilder.addNextIntent(new Intent("NoOperation"));<NEW_LINE>PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);<NEW_LINE>builder.setContentIntent(resultPendingIntent);<NEW_LINE>NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);<NEW_LINE>if (notificationManager != null) {<NEW_LINE>notificationManager.notify(1, builder.build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | 200L }).setContentText(detail); |
1,507,808 | public ArrayList<ListBlobsIncludeItem> toList() {<NEW_LINE>ArrayList<ListBlobsIncludeItem> details = new ArrayList<>();<NEW_LINE>if (this.retrieveCopy) {<NEW_LINE>details.add(ListBlobsIncludeItem.COPY);<NEW_LINE>}<NEW_LINE>if (this.retrieveDeletedBlobs) {<NEW_LINE>details.add(ListBlobsIncludeItem.DELETED);<NEW_LINE>}<NEW_LINE>if (this.retrieveMetadata) {<NEW_LINE>details.add(ListBlobsIncludeItem.METADATA);<NEW_LINE>}<NEW_LINE>if (this.retrieveTags) {<NEW_LINE>details.add(ListBlobsIncludeItem.TAGS);<NEW_LINE>}<NEW_LINE>if (this.retrieveSnapshots) {<NEW_LINE>details.add(ListBlobsIncludeItem.SNAPSHOTS);<NEW_LINE>}<NEW_LINE>if (this.retrieveUncommittedBlobs) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (this.retrieveVersions) {<NEW_LINE>details.add(ListBlobsIncludeItem.VERSIONS);<NEW_LINE>}<NEW_LINE>if (this.retrieveDeletedWithVersions) {<NEW_LINE>details.add(ListBlobsIncludeItem.DELETED_WITH_VERSIONS);<NEW_LINE>}<NEW_LINE>if (this.retrieveImmutabilityPolicy) {<NEW_LINE>details.add(ListBlobsIncludeItem.IMMUTABILITY_POLICY);<NEW_LINE>}<NEW_LINE>if (this.retrieveLegalHold) {<NEW_LINE>details.add(ListBlobsIncludeItem.LEGAL_HOLD);<NEW_LINE>}<NEW_LINE>return details;<NEW_LINE>} | details.add(ListBlobsIncludeItem.UNCOMMITTEDBLOBS); |
1,214,213 | private void buildOnce() {<NEW_LINE>fireBuildStarted();<NEW_LINE>reportProgress(0);<NEW_LINE>DebugInformationBuilder debugInformationBuilder = new DebugInformationBuilder(referenceCache);<NEW_LINE>ClassLoader classLoader = initClassLoader();<NEW_LINE>ClasspathResourceReader reader = new ClasspathResourceReader(classLoader);<NEW_LINE>ResourceClassHolderMapper rawMapper = new ResourceClassHolderMapper(reader, referenceCache);<NEW_LINE>Function<String, ClassHolder> classPathMapper = new ClasspathResourceMapper(classLoader, referenceCache, rawMapper);<NEW_LINE>classSource.setProvider(name -> PreOptimizingClassHolderSource.optimize(classPathMapper, name));<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>JavaScriptTarget jsTarget = new JavaScriptTarget();<NEW_LINE>TeaVM vm = new TeaVMBuilder(jsTarget).setReferenceCache(referenceCache).setClassLoader(classLoader).setClassSource(classSource).setDependencyAnalyzerFactory(FastDependencyAnalyzer::new).setClassSourcePacker(this::packClasses).setStrict(true).<MASK><NEW_LINE>jsTarget.setStackTraceIncluded(true);<NEW_LINE>jsTarget.setObfuscated(false);<NEW_LINE>jsTarget.setAstCache(astCache);<NEW_LINE>jsTarget.setDebugEmitter(debugInformationBuilder);<NEW_LINE>jsTarget.setTopLevelNameLimit(2000);<NEW_LINE>jsTarget.setStrict(true);<NEW_LINE>vm.setOptimizationLevel(TeaVMOptimizationLevel.SIMPLE);<NEW_LINE>vm.setCacheStatus(classSource);<NEW_LINE>vm.addVirtualMethods(m -> true);<NEW_LINE>vm.setProgressListener(progressListener);<NEW_LINE>vm.setProgramCache(programCache);<NEW_LINE>vm.installPlugins();<NEW_LINE>vm.setLastKnownClasses(lastReachedClasses);<NEW_LINE>vm.entryPoint(mainClass);<NEW_LINE>log.info("Starting build");<NEW_LINE>progressListener.last = 0;<NEW_LINE>progressListener.lastTime = System.currentTimeMillis();<NEW_LINE>vm.build(buildTarget, fileName);<NEW_LINE>addIndicator();<NEW_LINE>generateDebug(debugInformationBuilder);<NEW_LINE>postBuild(vm, startTime);<NEW_LINE>} | setObfuscated(false).build(); |
1,126,567 | private String reportBulkErrors(JsonNode items) {<NEW_LINE><MASK><NEW_LINE>for (JsonNode item : items) {<NEW_LINE>JsonNode action = item.get("index");<NEW_LINE>if (action == null) {<NEW_LINE>action = item.get("create");<NEW_LINE>}<NEW_LINE>if (action != null) {<NEW_LINE>final JsonNode error = action.get("error");<NEW_LINE>if (error != null) {<NEW_LINE>sb.append("\n - ");<NEW_LINE>final JsonNode reason = error.get("reason");<NEW_LINE>if (reason != null) {<NEW_LINE>sb.append(reason.asText());<NEW_LINE>final String errorType = error.get("type").asText();<NEW_LINE>if (errorType.equals("version_conflict_engine_exception")) {<NEW_LINE>sb.append(": Probably you updated a dashboard in Kibana. ").append("Please don't override the stagemonitor dashboards. ").append("If you want to customize a dashboard, save it under a different name. ").append("Stagemonitor will not override your changes, but that also means that you won't ").append("be able to use the latest dashboard enhancements :(. ").append("To resolve this issue, save the updated one under a different name, delete it ").append("and restart stagemonitor so that the dashboard can be recreated.");<NEW_LINE>} else if ("es_rejected_execution_exception".equals(errorType)) {<NEW_LINE>sb.append(": Consider increasing threadpool.bulk.queue_size. See also stagemonitor's " + "documentation for the Elasticsearch data base.");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>sb.append(error.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>sb.append(' ');<NEW_LINE>final String error = item.toString();<NEW_LINE>if (error.length() > MAX_BULK_ERROR_LOG_SIZE) {<NEW_LINE>sb.append(error.substring(0, MAX_BULK_ERROR_LOG_SIZE)).append("...");<NEW_LINE>} else {<NEW_LINE>sb.append(error);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | final StringBuilder sb = new StringBuilder(); |
1,761,841 | protected int next(final int bits) {<NEW_LINE>int y;<NEW_LINE>if (mti >= N) {<NEW_LINE>int kk;<NEW_LINE>for (kk = 0; kk < N - M; kk++) {<NEW_LINE>y = (stateVector[kk] & UPPER_MASK) | (stateVector[kk + 1] & LOWER_MASK);<NEW_LINE>stateVector[kk] = stateVector[kk + M] ^ (y >>> 1) ^ mag01[y & 0x1];<NEW_LINE>}<NEW_LINE>for (; kk < N - 1; kk++) {<NEW_LINE>y = (stateVector[kk] & UPPER_MASK) | (stateVector[kk + 1] & LOWER_MASK);<NEW_LINE>stateVector[kk] = stateVector[kk + (M - N)] ^ (y >>> 1) ^ mag01[y & 0x1];<NEW_LINE>}<NEW_LINE>y = (stateVector[N - 1] & UPPER_MASK) | (stateVector[0] & LOWER_MASK);<NEW_LINE>stateVector[N - 1] = stateVector[M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];<NEW_LINE>mti = 0;<NEW_LINE>}<NEW_LINE>y = stateVector[mti++];<NEW_LINE>y ^= y >>> 11;<NEW_LINE>y <MASK><NEW_LINE>y ^= (y << 15) & TEMPERING_MASK_C;<NEW_LINE>y ^= (y >>> 18);<NEW_LINE>return y >>> (32 - bits);<NEW_LINE>} | ^= (y << 7) & TEMPERING_MASK_B; |
165,052 | public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {<NEW_LINE>String localHost = null;<NEW_LINE>int localPort = 0;<NEW_LINE>IRubyObject maybeOpts;<NEW_LINE>RubyHash opts = null;<NEW_LINE>switch(args.length) {<NEW_LINE>case 2:<NEW_LINE>return initialize(context, args[0], args[1]);<NEW_LINE>case 3:<NEW_LINE>return initialize(context, args[0], args[1], args[2]);<NEW_LINE>}<NEW_LINE>// cut switch in half to evaluate early args first<NEW_LINE>IRubyObject host = args[0];<NEW_LINE>IRubyObject port = args[1];<NEW_LINE>final String remoteHost = host.isNil() ? "localhost" : host.convertToString().toString();<NEW_LINE>final int remotePort = <MASK><NEW_LINE>switch(args.length) {<NEW_LINE>case 4:<NEW_LINE>if (!args[2].isNil())<NEW_LINE>localHost = args[2].convertToString().toString();<NEW_LINE>maybeOpts = ArgsUtil.getOptionsArg(context.runtime, args[3]);<NEW_LINE>if (!maybeOpts.isNil()) {<NEW_LINE>opts = (RubyHash) maybeOpts;<NEW_LINE>} else if (!args[3].isNil()) {<NEW_LINE>localPort = SocketUtils.getPortFrom(context, args[3]);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>if (!args[4].isNil())<NEW_LINE>opts = (RubyHash) ArgsUtil.getOptionsArg(context.runtime, args[4], true);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw context.runtime.newArgumentError(args.length, 2, 4);<NEW_LINE>}<NEW_LINE>return initialize(context, remoteHost, remotePort, localHost, localPort, opts);<NEW_LINE>} | SocketUtils.getPortFrom(context, port); |
19,441 | // scopes ///////////////////////////////////////////////////////////////////<NEW_LINE>@Override<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>public void initialize() {<NEW_LINE>LOGGER.debug("initializing {}", this);<NEW_LINE>ScopeImpl scope = getScopeObject();<NEW_LINE>ensureParentInitialized();<NEW_LINE>// initialize the lists of referenced objects (prevents db queries)<NEW_LINE>variableInstances = new HashMap<>();<NEW_LINE>eventSubscriptions = new ArrayList<>();<NEW_LINE>// Cached entity-state initialized to null, all bits are zero, indicating NO entities present<NEW_LINE>cachedEntityState = 0;<NEW_LINE>List<TimerDeclarationImpl> timerDeclarations = (List<TimerDeclarationImpl>) scope.getProperty(BpmnParse.PROPERTYNAME_TIMER_DECLARATION);<NEW_LINE>if (timerDeclarations != null) {<NEW_LINE>for (TimerDeclarationImpl timerDeclaration : timerDeclarations) {<NEW_LINE>TimerJobEntity timer = timerDeclaration.prepareTimerEntity(this);<NEW_LINE>if (timer != null) {<NEW_LINE>callJobProcessors(JobProcessorContext.Phase.BEFORE_CREATE, timer, Context.getProcessEngineConfiguration());<NEW_LINE>Context.getCommandContext().getJobEntityManager().schedule(timer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// create event subscriptions for the current scope<NEW_LINE>List<EventSubscriptionDeclaration> eventSubscriptionDeclarations = (List<EventSubscriptionDeclaration>) <MASK><NEW_LINE>if (eventSubscriptionDeclarations != null) {<NEW_LINE>for (EventSubscriptionDeclaration eventSubscriptionDeclaration : eventSubscriptionDeclarations) {<NEW_LINE>if (!eventSubscriptionDeclaration.isStartEvent()) {<NEW_LINE>EventSubscriptionEntity eventSubscriptionEntity = eventSubscriptionDeclaration.prepareEventSubscriptionEntity(this);<NEW_LINE>if (getTenantId() != null) {<NEW_LINE>eventSubscriptionEntity.setTenantId(getTenantId());<NEW_LINE>}<NEW_LINE>eventSubscriptionEntity.insert();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | scope.getProperty(BpmnParse.PROPERTYNAME_EVENT_SUBSCRIPTION_DECLARATION); |
1,661,355 | private void rebuildFileRootsCache() {<NEW_LINE>shortcutsRootsPanel.clear();<NEW_LINE>File[] roots = File.listRoots();<NEW_LINE>driveCheckerListeners.clear();<NEW_LINE>for (final File root : roots) {<NEW_LINE>DriveCheckerListener listener = new DriveCheckerListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void rootMode(File root, RootMode mode) {<NEW_LINE>if (driveCheckerListeners.removeValue(this, true) == false)<NEW_LINE>return;<NEW_LINE>String initialName = root.toString();<NEW_LINE>if (initialName.equals("/"))<NEW_LINE>initialName = COMPUTER.get();<NEW_LINE>final ShortcutItem item = new ShortcutItem(<MASK><NEW_LINE>if (OsUtils.isWindows())<NEW_LINE>chooserWinService.addListener(root, item);<NEW_LINE>shortcutsRootsPanel.addActor(item);<NEW_LINE>shortcutsRootsPanel.getChildren().sort(SHORTCUTS_COMPARATOR);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>driveCheckerListeners.add(listener);<NEW_LINE>driveCheckerService.addListener(root, mode == Mode.OPEN ? RootMode.READABLE : RootMode.WRITABLE, listener);<NEW_LINE>}<NEW_LINE>} | root, initialName, style.iconDrive); |
468,684 | public void testAuthenticateMethodFL_ProtectedServlet2() throws Exception {<NEW_LINE>METHODS = "testMethod=login,logout_once,authenticate";<NEW_LINE>String url = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/formlogin/ProgrammaticAPIServlet?" + METHODS + "&user=" + managerUser + "&password=" + managerPassword;<NEW_LINE>HttpClient client = new DefaultHttpClient();<NEW_LINE>String response = authenticateWithValidAuthDataFLTwice(client, validUser, validPassword, url);<NEW_LINE>// Get servlet output to verify each test<NEW_LINE>String test1 = response.substring(response.indexOf("STARTTEST1"), response.indexOf("ENDTEST1"));<NEW_LINE>// Skip test 2 because logout_once will not run logout on the 2nd pass<NEW_LINE>String test3 = response.substring(response.indexOf("STARTTEST3"), response.indexOf("ENDTEST3"));<NEW_LINE>// TEST1 - check values after login<NEW_LINE>assertTrue("Failed to find after login: ServletException", test1.contains("ServletException"));<NEW_LINE>// Skip test 2 because logout_once will not run logout on the 2nd pass<NEW_LINE>// TEST3 - check values after authenticate<NEW_LINE>testHelper.verifyProgrammaticAPIValues(authTypeForm, <MASK><NEW_LINE>} | validUser, test3, NOT_MANAGER_ROLE, IS_EMPLOYEE_ROLE); |
418,975 | /* This is just a light syntactic check of the language tag.<NEW_LINE>* See JENA-827.<NEW_LINE>* Jena, when parsing RDF/XML, used to check the syntax and against (an encoded copy of) the IANA registry.<NEW_LINE>* Elsewhere, Turtle et al and SPARQL, Jena has always only performed this syntax check.<NEW_LINE>*/<NEW_LINE>private void checkXMLLang(XMLHandler arp, Taint taintMe, String newLang) throws SAXParseException {<NEW_LINE>if (newLang.equals(""))<NEW_LINE>return;<NEW_LINE>if (newLang.equalsIgnoreCase("und"))<NEW_LINE>arp.warning(taintMe, <MASK><NEW_LINE>if (!langPattern.matcher(newLang).matches())<NEW_LINE>arp.warning(taintMe, WARN_BAD_XMLLANG, "Bad language tag: " + newLang);<NEW_LINE>} | WARN_BAD_XMLLANG, "Bad language tag: " + newLang + " (not allowed)"); |
1,489,969 | protected void encodeDropDown(FacesContext context, AutoComplete ac) throws IOException {<NEW_LINE>ResponseWriter writer = context.getResponseWriter();<NEW_LINE>String dropdownClass = AutoComplete.DROPDOWN_CLASS;<NEW_LINE>boolean disabled = ac.isDisabled<MASK><NEW_LINE>if (disabled) {<NEW_LINE>dropdownClass += " ui-state-disabled";<NEW_LINE>}<NEW_LINE>writer.startElement("button", ac);<NEW_LINE>writer.writeAttribute("class", dropdownClass, null);<NEW_LINE>writer.writeAttribute("type", "button", null);<NEW_LINE>if (LangUtils.isNotBlank(ac.getDropdownAriaLabel())) {<NEW_LINE>writer.writeAttribute(HTML.ARIA_LABEL, ac.getDropdownAriaLabel(), null);<NEW_LINE>}<NEW_LINE>if (disabled) {<NEW_LINE>writer.writeAttribute("disabled", "disabled", null);<NEW_LINE>}<NEW_LINE>if (ac.getDropdownTabindex() != null) {<NEW_LINE>writer.writeAttribute("tabindex", ac.getDropdownTabindex(), null);<NEW_LINE>} else if (ac.getTabindex() != null) {<NEW_LINE>writer.writeAttribute("tabindex", ac.getTabindex(), null);<NEW_LINE>}<NEW_LINE>writer.startElement("span", null);<NEW_LINE>writer.writeAttribute("class", "ui-button-icon-primary ui-icon ui-icon-triangle-1-s", null);<NEW_LINE>writer.endElement("span");<NEW_LINE>writer.startElement("span", null);<NEW_LINE>writer.writeAttribute("class", "ui-button-text", null);<NEW_LINE>writer.write(" ");<NEW_LINE>writer.endElement("span");<NEW_LINE>writer.endElement("button");<NEW_LINE>} | () || ac.isReadonly(); |
861,552 | public static void horizontal3(Kernel1D_S32 kernel, GrayU16 image, GrayI16 dest) {<NEW_LINE>final short[] dataSrc = image.data;<NEW_LINE>final short[] dataDst = dest.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int <MASK><NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int width = image.getWidth();<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, image.height, i -> {<NEW_LINE>for (int i = 0; i < image.height; i++) {<NEW_LINE>int indexDst = dest.startIndex + i * dest.stride + radius;<NEW_LINE>int j = image.startIndex + i * image.stride - radius;<NEW_LINE>final int jEnd = j + width - radius;<NEW_LINE>for (j += radius; j < jEnd; j++) {<NEW_LINE>int indexSrc = j;<NEW_LINE>int total = (dataSrc[indexSrc++] & 0xFFFF) * k1;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFFFF) * k2;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFFFF) * k3;<NEW_LINE>dataDst[indexDst++] = (short) total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | k3 = kernel.data[2]; |
132,572 | public void onStateTransition(CommandContext commandContext, DelegatePlanItemInstance planItemInstance, String transition) {<NEW_LINE>// Remove event subscription when moving to a terminal state<NEW_LINE>CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);<NEW_LINE>if (PlanItemTransition.TERMINATE.equals(transition) || PlanItemTransition.EXIT.equals(transition) || PlanItemTransition.DISMISS.equals(transition)) {<NEW_LINE>EventSubscriptionService eventSubscriptionService = cmmnEngineConfiguration.getEventSubscriptionServiceConfiguration().getEventSubscriptionService();<NEW_LINE>List<EventSubscriptionEntity> eventSubscriptions = eventSubscriptionService.findEventSubscriptionsBySubScopeId(planItemInstance.getId());<NEW_LINE>for (EventSubscriptionEntity eventSubscription : eventSubscriptions) {<NEW_LINE>eventSubscriptionService.deleteEventSubscription(eventSubscription);<NEW_LINE>}<NEW_LINE>} else if (PlanItemTransition.CREATE.equals(transition)) {<NEW_LINE>String signalName = null;<NEW_LINE>if (StringUtils.isNotEmpty(signalRef)) {<NEW_LINE>Expression signalExpression = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getExpressionManager().createExpression(signalRef);<NEW_LINE>signalName = signalExpression.getValue(planItemInstance).toString();<NEW_LINE>}<NEW_LINE>cmmnEngineConfiguration.getEventSubscriptionServiceConfiguration().getEventSubscriptionService().createEventSubscriptionBuilder().eventType(SignalEventSubscriptionEntity.EVENT_TYPE).eventName(signalName).subScopeId(planItemInstance.getId()).scopeId(planItemInstance.getCaseInstanceId()).scopeDefinitionId(planItemInstance.getCaseDefinitionId()).scopeType(ScopeTypes.CMMN).tenantId(planItemInstance.<MASK><NEW_LINE>}<NEW_LINE>} | getTenantId()).create(); |
545,833 | public static void initialize(Core core) {<NEW_LINE>ConfigurationManager config = ConfigurationManager.getInstance();<NEW_LINE>if ("az2".equalsIgnoreCase(config.getStringParameter("ui", "az3"))) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int userMode = COConfigurationManager.getIntParameter("User Mode");<NEW_LINE>boolean startAdvanced = userMode > 1;<NEW_LINE>boolean configNeedsSave = false;<NEW_LINE>final ConfigurationDefaults defaults = ConfigurationDefaults.getInstance();<NEW_LINE><MASK><NEW_LINE>defaults.addParameter("Auto Upload Speed Enabled", true);<NEW_LINE>defaults.addParameter(ConfigurationDefaults.CFG_TORRENTADD_OPENOPTIONS, startAdvanced ? ConfigurationDefaults.CFG_TORRENTADD_OPENOPTIONS_ALWAYS : ConfigurationDefaults.CFG_TORRENTADD_OPENOPTIONS_MANY);<NEW_LINE>// defaults.addParameter("Add URL Silently", true); not used 11/30/2015 - see "Activate Window On External Download"<NEW_LINE>// defaults.addParameter("add_torrents_silently", true); not used 11/30/2015<NEW_LINE>defaults.addParameter("Popup Download Finished", false);<NEW_LINE>defaults.addParameter("Popup Download Added", false);<NEW_LINE>defaults.addParameter("Status Area Show SR", false);<NEW_LINE>defaults.addParameter("Status Area Show NAT", false);<NEW_LINE>defaults.addParameter("Status Area Show IPF", false);<NEW_LINE>defaults.addParameter("Status Area Show RIP", true);<NEW_LINE>defaults.addParameter("Message Popup Autoclose in Seconds", 10);<NEW_LINE>defaults.addParameter("window.maximized", true);<NEW_LINE>defaults.addParameter("update.autodownload", true);<NEW_LINE>// defaults.addParameter("suppress_file_download_dialog", true);<NEW_LINE>defaults.addParameter("auto_remove_inactive_items", false);<NEW_LINE>defaults.addParameter("show_torrents_menu", false);<NEW_LINE>config.removeParameter("v3.home-tab.starttab");<NEW_LINE>defaults.addParameter("MyTorrentsView.table.style", 0);<NEW_LINE>defaults.addParameter("v3.Show Welcome", true);<NEW_LINE>defaults.addParameter("Library.viewmode", startAdvanced ? 1 : 0);<NEW_LINE>defaults.addParameter("LibraryDL.viewmode", startAdvanced ? 1 : 0);<NEW_LINE>defaults.addParameter("LibraryDL.UseDefaultIndicatorColor", false);<NEW_LINE>defaults.addParameter("LibraryUnopened.viewmode", startAdvanced ? 1 : 0);<NEW_LINE>defaults.addParameter("LibraryCD.viewmode", startAdvanced ? 1 : 0);<NEW_LINE>defaults.addParameter("Library.EnableSimpleView", 1);<NEW_LINE>defaults.addParameter("Library.CatInSideBar", startAdvanced ? 1 : 0);<NEW_LINE>defaults.addParameter("Library.TagInSideBar", 1);<NEW_LINE>defaults.addParameter("Library.TagGroupsInSideBar", true);<NEW_LINE>defaults.addParameter("Library.ShowTabsInTorrentView", 1);<NEW_LINE>defaults.addParameter("list.dm.dblclick", "0");<NEW_LINE>// === defaults used by MainWindow<NEW_LINE>defaults.addParameter("vista.adminquit", false);<NEW_LINE>defaults.addParameter("Start Minimized", false);<NEW_LINE>defaults.addParameter("Password enabled", false);<NEW_LINE>defaults.addParameter("ToolBar.showText", true);<NEW_LINE>defaults.addParameter("Table.extendedErase", !Constants.isWindowsXP);<NEW_LINE>defaults.addParameter("Table.useTree", true);<NEW_LINE>// by default, turn off some slidey warning<NEW_LINE>// Since they are plugin configs, we need to set the default after the<NEW_LINE>// plugin sets the default<NEW_LINE>core.addLifecycleListener(new CoreLifecycleAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void started(Core core) {<NEW_LINE>defaults.addParameter("Plugin.DHT.dht.warn.user", false);<NEW_LINE>defaults.addParameter("Plugin.UPnP.upnp.alertothermappings", false);<NEW_LINE>defaults.addParameter("Plugin.UPnP.upnp.alertdeviceproblems", false);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (configNeedsSave) {<NEW_LINE>config.save();<NEW_LINE>}<NEW_LINE>} | defaults.addParameter("ui", "az3"); |
576,806 | protected void updateShadowCams(Camera viewCam) {<NEW_LINE>if (light == null) {<NEW_LINE>logger.warning("The light can't be null for a " + getClass().getName());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// bottom<NEW_LINE>shadowCams[0].setAxes(Vector3f.UNIT_X.mult(-1f), Vector3f.UNIT_Z.mult(-1f), Vector3f.UNIT_Y.mult(-1f));<NEW_LINE>// top<NEW_LINE>shadowCams[1].setAxes(Vector3f.UNIT_X.mult(-1f), Vector3f.UNIT_Z, Vector3f.UNIT_Y);<NEW_LINE>// forward<NEW_LINE>shadowCams[2].setAxes(Vector3f.UNIT_X.mult(-1f), Vector3f.UNIT_Y, Vector3f.UNIT_Z.mult(-1f));<NEW_LINE>// backward<NEW_LINE>shadowCams[3].setAxes(Vector3f.UNIT_X, Vector3f.UNIT_Y, Vector3f.UNIT_Z);<NEW_LINE>// left<NEW_LINE>shadowCams[4].setAxes(Vector3f.UNIT_Z, Vector3f.UNIT_Y, Vector3f.UNIT_X.mult(-1f));<NEW_LINE>// right<NEW_LINE>shadowCams[5].setAxes(Vector3f.UNIT_Z.mult(-1f), Vector3f.UNIT_Y, Vector3f.UNIT_X);<NEW_LINE>for (int i = 0; i < CAM_NUMBER; i++) {<NEW_LINE>shadowCams[i].setFrustumPerspective(90f, 1f, <MASK><NEW_LINE>shadowCams[i].setLocation(light.getPosition());<NEW_LINE>shadowCams[i].update();<NEW_LINE>shadowCams[i].updateViewProjection();<NEW_LINE>}<NEW_LINE>} | 0.1f, light.getRadius()); |
779,664 | public void paintComponent(Graphics g) {<NEW_LINE>super.paintComponent(g);<NEW_LINE>int multiplier = getZoomMultiplier();<NEW_LINE>double binPixelWidth = getBinPixelWidth(multiplier);<NEW_LINE>int offset = (int) (getPixelOffset(multiplier) - binPixelWidth);<NEW_LINE>g.drawImage(mWaterfallImage, offset, 0, (getWidth() * multiplier) + (<MASK><NEW_LINE>Graphics2D graphics = (Graphics2D) g;<NEW_LINE>graphics.setColor(mColorSpectrumCursor);<NEW_LINE>if (mCursorVisible) {<NEW_LINE>graphics.draw(new Line2D.Float(mCursorLocation.x, 0, mCursorLocation.x, (float) (getSize().getHeight())));<NEW_LINE>String frequency = CURSOR_FORMAT.format(mCursorFrequency / 1000000.0D);<NEW_LINE>graphics.drawString(frequency, mCursorLocation.x + 5, mCursorLocation.y);<NEW_LINE>}<NEW_LINE>if (mDisabled) {<NEW_LINE>graphics.drawString(DISABLED, 20, 20);<NEW_LINE>} else if (mPaused) {<NEW_LINE>graphics.drawString(PAUSED, 20, 20);<NEW_LINE>}<NEW_LINE>paintZoomIndicator(graphics);<NEW_LINE>graphics.dispose();<NEW_LINE>} | int) binPixelWidth, mImageHeight, this); |
1,026,459 | public Void execute(CommandContext commandContext) {<NEW_LINE>// Finally, Throw the exception to indicate the ExecuteAsyncJobCmd failed<NEW_LINE>String message = "Job " + job.getId() + " failed";<NEW_LINE>LOGGER.error(message, exception);<NEW_LINE>if (job instanceof AbstractRuntimeJobEntity) {<NEW_LINE>AbstractRuntimeJobEntity runtimeJob = (AbstractRuntimeJobEntity) job;<NEW_LINE>InternalJobCompatibilityManager internalJobCompatibilityManager = jobServiceConfiguration.getInternalJobCompatibilityManager();<NEW_LINE>if (internalJobCompatibilityManager != null && internalJobCompatibilityManager.isFlowable5Job(runtimeJob)) {<NEW_LINE>internalJobCompatibilityManager.handleFailedV5Job(runtimeJob, exception);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CommandConfig commandConfig = jobServiceConfiguration.getCommandExecutor().getDefaultConfig().transactionRequiresNew();<NEW_LINE>FailedJobCommandFactory failedJobCommandFactory = jobServiceConfiguration.getFailedJobCommandFactory();<NEW_LINE>Command<Object> cmd = failedJobCommandFactory.getCommand(job.getId(), exception);<NEW_LINE>LOGGER.trace("Using FailedJobCommandFactory '{}' and command of type '{}'", failedJobCommandFactory.getClass(<MASK><NEW_LINE>jobServiceConfiguration.getCommandExecutor().execute(commandConfig, cmd);<NEW_LINE>// Dispatch an event, indicating job execution failed in a<NEW_LINE>// try-catch block, to prevent the original exception to be swallowed<NEW_LINE>FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();<NEW_LINE>if (eventDispatcher != null && eventDispatcher.isEnabled()) {<NEW_LINE>try {<NEW_LINE>eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityExceptionEvent(FlowableEngineEventType.JOB_EXECUTION_FAILURE, job, exception), jobServiceConfiguration.getEngineName());<NEW_LINE>} catch (Throwable ignore) {<NEW_LINE>LOGGER.warn("Exception occurred while dispatching job failure event, ignoring.", ignore);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ), cmd.getClass()); |
432,128 | private static Set<String> transitiveDeps(Set<String> cnbs) {<NEW_LINE>HashSet<String> all = new HashSet<String>();<NEW_LINE>all.addAll(cnbs);<NEW_LINE>for (; ; ) {<NEW_LINE>int prev = all.size();<NEW_LINE>for (ModuleInfo mi : Lookup.getDefault().lookupAll(ModuleInfo.class)) {<NEW_LINE>if (all.contains(mi.getCodeNameBase())) {<NEW_LINE>for (Dependency d : mi.getDependencies()) {<NEW_LINE>if (d.getType() != Dependency.TYPE_MODULE) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String moduleName = d.getName();<NEW_LINE>int <MASK><NEW_LINE>if (slash != -1) {<NEW_LINE>moduleName = moduleName.substring(0, slash);<NEW_LINE>}<NEW_LINE>all.add(moduleName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (prev == all.size()) {<NEW_LINE>Set<String> test = null;<NEW_LINE>assert (test = new HashSet<String>(all)) != null;<NEW_LINE>if (test != null) {<NEW_LINE>for (ModuleInfo mi : Lookup.getDefault().lookupAll(ModuleInfo.class)) {<NEW_LINE>test.remove(mi.getCodeNameBase());<NEW_LINE>}<NEW_LINE>assert test.isEmpty() : "Only CNBs are in the set: " + test;<NEW_LINE>}<NEW_LINE>return all;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | slash = moduleName.indexOf('/'); |
60,817 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String sqlServerInstanceName) {<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 (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 (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (sqlServerInstanceName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter sqlServerInstanceName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, sqlServerInstanceName, this.client.getApiVersion(), accept, context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext(<MASK><NEW_LINE>} | )).readOnly())); |
1,674,639 | private void addRolePlayers(TypeDB.Transaction transaction) throws IOException {<NEW_LINE>try (InputStream inputStream = new BufferedInputStream(Files.newInputStream(dataFile))) {<NEW_LINE>DataProto.Item item;<NEW_LINE>while ((item = ITEM_PARSER.parseDelimitedFrom(inputStream)) != null) {<NEW_LINE>if (item.getItemCase() == DataProto.Item.ItemCase.RELATION && conceptTracker.isIncomplete(item.getRelation().getId())) {<NEW_LINE>Relation relation = transaction.concepts().getThing(conceptTracker.getMapped(item.getRelation().getId())).asRelation();<NEW_LINE>RelationType relationType = relation.getType();<NEW_LINE>item.getRelation().getRoleList().forEach(roleMsg -> {<NEW_LINE>RoleType <MASK><NEW_LINE>for (DataProto.Item.Relation.Role.Player playerMessage : roleMsg.getPlayerList()) {<NEW_LINE>Thing player = transaction.concepts().getThing(conceptTracker.getMapped(playerMessage.getId()));<NEW_LINE>if (player == null)<NEW_LINE>throw TypeDBException.of(PLAYER_NOT_FOUND, relationType.getLabel());<NEW_LINE>else if (!relation.asRelation().getPlayers(roleType).findFirst(player).isPresent()) {<NEW_LINE>relation.addPlayer(roleType, player);<NEW_LINE>status.roleCount.incrementAndGet();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>conceptTracker.deleteIncomplete(item.getRelation().getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | roleType = getRoleType(relationType, roleMsg); |
261,861 | public void populate(final InputStream inputStream) throws PwmUnrecoverableException {<NEW_LINE>if (status() != STATUS.OPEN) {<NEW_LINE>throw new PwmUnrecoverableException(<MASK><NEW_LINE>}<NEW_LINE>cancelBackgroundAndRunImmediate(() -> {<NEW_LINE>setActivity(Activity.Importing);<NEW_LINE>getLogger().debug(getSessionLabel(), () -> "beginning direct user-supplied wordlist import");<NEW_LINE>setAutoImportError(null);<NEW_LINE>final WordlistZipReader wordlistZipReader = new WordlistZipReader(inputStream);<NEW_LINE>final WordlistImporter wordlistImporter = new WordlistImporter(null, wordlistZipReader, WordlistSourceType.User, AbstractWordlist.this, makeProcessCancelSupplier());<NEW_LINE>wordlistImporter.run();<NEW_LINE>getLogger().debug(getSessionLabel(), () -> "completed direct user-supplied wordlist import");<NEW_LINE>});<NEW_LINE>setActivity(Activity.Idle);<NEW_LINE>executorService.execute(new InspectorJob());<NEW_LINE>} | PwmError.ERROR_SERVICE_NOT_AVAILABLE.toInfo()); |
1,350,448 | private static Shape[] uncantedShapesBack(FinSet finset, Transformation transformation) {<NEW_LINE>double thickness = finset.getThickness();<NEW_LINE><MASK><NEW_LINE>double tabHeight = finset.getTabHeight();<NEW_LINE>// Generate base coordinates for a single fin<NEW_LINE>Coordinate[] c = new Coordinate[4];<NEW_LINE>c[0] = new Coordinate(0, 0, -thickness / 2);<NEW_LINE>c[1] = new Coordinate(0, 0, thickness / 2);<NEW_LINE>c[2] = new Coordinate(0, height, thickness / 2);<NEW_LINE>c[3] = new Coordinate(0, height, -thickness / 2);<NEW_LINE>// Generate base coordinates for a single fin tab<NEW_LINE>Coordinate[] cTab = new Coordinate[4];<NEW_LINE>cTab[0] = new Coordinate(0, 0, -thickness / 2);<NEW_LINE>cTab[1] = new Coordinate(0, 0, thickness / 2);<NEW_LINE>cTab[2] = new Coordinate(0, -tabHeight, thickness / 2);<NEW_LINE>cTab[3] = new Coordinate(0, -tabHeight, -thickness / 2);<NEW_LINE>// Apply base rotation<NEW_LINE>c = transformation.transform(c);<NEW_LINE>cTab = transformation.transform(cTab);<NEW_LINE>// Make polygon<NEW_LINE>Path2D.Double p = createUncantedPolygon(c);<NEW_LINE>if (tabHeight != 0 && finset.getTabLength() != 0) {<NEW_LINE>Path2D.Double pTab = createUncantedPolygon(cTab);<NEW_LINE>return new Shape[] { p, pTab };<NEW_LINE>} else {<NEW_LINE>return new Shape[] { p };<NEW_LINE>}<NEW_LINE>} | double height = finset.getSpan(); |
1,410,219 | public static void main(String[] args) {<NEW_LINE>Adempiere.startupEnvironment(true);<NEW_LINE>CLogMgt.setLevel(Level.INFO);<NEW_LINE>Properties ctx = Env.getCtx();<NEW_LINE>// HARDCODED<NEW_LINE>int AD_Process_ID = 53156;<NEW_LINE>MPInstance pinstance = new MPInstance(ctx, AD_Process_ID, -1);<NEW_LINE>pinstance.saveEx();<NEW_LINE>ProcessInfo pi = new ProcessInfo("", AD_Process_ID, 0, 0);<NEW_LINE>pi.setAD_Client_ID(Env.getAD_Client_ID(ctx));<NEW_LINE>pi.setAD_User_ID(Env.getAD_User_ID(ctx));<NEW_LINE>pi.setAD_PInstance_ID(pinstance.getAD_PInstance_ID());<NEW_LINE>//<NEW_LINE>EnableNativeSequence proc = new EnableNativeSequence();<NEW_LINE>proc.<MASK><NEW_LINE>if (pi.isError()) {<NEW_LINE>throw new AdempiereException(pi.getSummary());<NEW_LINE>}<NEW_LINE>} | startProcess(ctx, pi, null); |
1,454,847 | // Using the example in the book<NEW_LINE>public static void main(String[] args) {<NEW_LINE>List<String> students = new ArrayList<>();<NEW_LINE>students.add("Alice");<NEW_LINE>students.add("Bob");<NEW_LINE>students.add("Carol");<NEW_LINE>students.add("Dave");<NEW_LINE>students.add("Eliza");<NEW_LINE>students.add("Frank");<NEW_LINE>List<String> <MASK><NEW_LINE>companies.add("Adobe");<NEW_LINE>companies.add("Amazon");<NEW_LINE>companies.add("Facebook");<NEW_LINE>companies.add("Google");<NEW_LINE>companies.add("IBM");<NEW_LINE>companies.add("Yahoo");<NEW_LINE>SeparateChainingHashST<String, List<String>> preferences = new SeparateChainingHashST<>();<NEW_LINE>List<String> alicePreferences = new ArrayList<>();<NEW_LINE>alicePreferences.add("Adobe");<NEW_LINE>alicePreferences.add("Amazon");<NEW_LINE>alicePreferences.add("Facebook");<NEW_LINE>preferences.put("Alice", alicePreferences);<NEW_LINE>List<String> bobPreferences = new ArrayList<>();<NEW_LINE>bobPreferences.add("Adobe");<NEW_LINE>bobPreferences.add("Amazon");<NEW_LINE>bobPreferences.add("Yahoo");<NEW_LINE>preferences.put("Bob", bobPreferences);<NEW_LINE>List<String> carolPreferences = new ArrayList<>();<NEW_LINE>carolPreferences.add("Facebook");<NEW_LINE>carolPreferences.add("Google");<NEW_LINE>carolPreferences.add("IBM");<NEW_LINE>preferences.put("Carol", carolPreferences);<NEW_LINE>List<String> davePreferences = new ArrayList<>();<NEW_LINE>davePreferences.add("Adobe");<NEW_LINE>davePreferences.add("Amazon");<NEW_LINE>preferences.put("Dave", davePreferences);<NEW_LINE>List<String> elizaPreferences = new ArrayList<>();<NEW_LINE>elizaPreferences.add("Google");<NEW_LINE>elizaPreferences.add("IBM");<NEW_LINE>elizaPreferences.add("Yahoo");<NEW_LINE>preferences.put("Eliza", elizaPreferences);<NEW_LINE>List<String> frankPreferences = new ArrayList<>();<NEW_LINE>frankPreferences.add("IBM");<NEW_LINE>frankPreferences.add("Yahoo");<NEW_LINE>preferences.put("Frank", frankPreferences);<NEW_LINE>new Exercise45_JobPlacement().solveJobPlacement(students, companies, preferences);<NEW_LINE>} | companies = new ArrayList<>(); |
218,945 | private static void generateApi(ApiDefinition apiDefinition, ObjectNode data, ApiOutput... outputs) throws Exception {<NEW_LINE>PathElementDefinition definition = apiDefinition.getPathDefinition();<NEW_LINE>OpenApi3 api = new OpenApi3();<NEW_LINE>api.setOpenapi(OPENAPI_VERSION);<NEW_LINE>//<NEW_LINE>//<NEW_LINE>api.setInfo(apiDefinition.getInfo()).//<NEW_LINE>addServer(new Server().setUrl(SERVER + apiDefinition.getPathPrefix()));<NEW_LINE>//<NEW_LINE>api.//<NEW_LINE>setComponents(new Components().setSchemas(apiDefinition.getSchemas().stream().collect(toMap(NamedSchema::name, NamedSchema::schema))));<NEW_LINE>api.setPaths(definition.getPaths());<NEW_LINE>api = OpenApi3Support.connectRefs(api);<NEW_LINE>for (ApiOutput output : outputs) {<NEW_LINE>output.writeApiDescription(apiDefinition.getPathPrefix(), api);<NEW_LINE>definition.generateContent(output, <MASK><NEW_LINE>output.finish();<NEW_LINE>}<NEW_LINE>} | apiDefinition.getPathPrefix(), data); |
260,666 | public void markup(MachHeader header, FlatProgramAPI api, Address baseAddress, boolean isBinary, ProgramModule parentModule, TaskMonitor monitor, MessageLog log) {<NEW_LINE>updateMonitor(monitor);<NEW_LINE>try {<NEW_LINE>if (isBinary) {<NEW_LINE>super.markup(header, api, baseAddress, isBinary, parentModule, monitor, log);<NEW_LINE>List<Address> addrs = api.getCurrentProgram().getMemory(<MASK><NEW_LINE>if (addrs.size() <= 0) {<NEW_LINE>throw new Exception("Chain Header does not exist in program");<NEW_LINE>}<NEW_LINE>Address dyldChainedHeader = addrs.get(0);<NEW_LINE>markupChainedFixupHeader(header, api, dyldChainedHeader, parentModule, monitor);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.appendMsg("Unable to create " + getCommandName());<NEW_LINE>log.appendException(e);<NEW_LINE>}<NEW_LINE>} | ).locateAddressesForFileOffset(getDataOffset()); |
1,111,010 | private void drawDynamic(final Canvas canvas) {<NEW_LINE>final int viewWidth = getWidth() - getPaddingLeft() - getPaddingRight();<NEW_LINE>final int viewHalfWidth = getPaddingLeft() + viewWidth / 2;<NEW_LINE>final int viewBottom = getHeight();<NEW_LINE>final float density = getResources().getDisplayMetrics().density;<NEW_LINE>final float spacing = 32 * density;<NEW_LINE>path.reset();<NEW_LINE>path.moveTo(viewHalfWidth, viewBottom - 5 * density);<NEW_LINE>path.lineTo(viewHalfWidth + 5 * density, viewBottom);<NEW_LINE>path.lineTo(viewHalfWidth - 5 * density, viewBottom);<NEW_LINE>path.close();<NEW_LINE>paint.setColor(indicatorColor);<NEW_LINE>canvas.drawPath(path, paint);<NEW_LINE>paint.setTypeface(Typeface.DEFAULT_BOLD);<NEW_LINE>final float y = getPaddingTop() + -paint.getFontMetrics().top;<NEW_LINE>for (int i = 0; i < labels.size(); i++) {<NEW_LINE>final String label = labels.get(i);<NEW_LINE>paint.setTypeface(i == pagePosition ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);<NEW_LINE>paint.setColor(i == pagePosition ? selectedTextColor : textColor);<NEW_LINE>final float x = viewHalfWidth + (maxWidth + spacing) * (i - pageOffset);<NEW_LINE>final float labelWidth = paint.measureText(label);<NEW_LINE>final float labelHalfWidth = labelWidth / 2;<NEW_LINE>final float labelLeft = x - labelHalfWidth;<NEW_LINE>final float labelVisibleLeft = labelLeft >= 0 ? 1f : 1f - (-labelLeft / labelWidth);<NEW_LINE>final float labelRight = x + labelHalfWidth;<NEW_LINE>final float labelVisibleRight = labelRight < viewWidth ? 1f : 1f - ((labelRight - viewWidth) / labelWidth);<NEW_LINE>final float labelVisible = Math.min(labelVisibleLeft, labelVisibleRight);<NEW_LINE>paint.setAlpha((int) (labelVisible * 255));<NEW_LINE>canvas.drawText(<MASK><NEW_LINE>}<NEW_LINE>} | label, labelLeft, y, paint); |
761,880 | private void unzip(TaskMonitor monitor) throws ZipException, IOException, FileNotFoundException, CancelledException {<NEW_LINE>FileSystemService fsService = FileSystemService.getInstance();<NEW_LINE>try (GFileSystem fs = fsService.openFileSystemContainer(jarFile, monitor)) {<NEW_LINE>List<GFile> files = FSUtilities.listFileSystem(fs, null, null, monitor);<NEW_LINE>monitor.<MASK><NEW_LINE>for (GFile file : files) {<NEW_LINE>if (monitor.isCancelled()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>File outputFile = new File(outputDirectory.getAbsolutePath(), file.getPath());<NEW_LINE>if (!FileUtilities.isPathContainedWithin(outputDirectory, outputFile)) {<NEW_LINE>throw new IOException("Extracted file " + outputFile.getPath() + " would be outside of root destination directory: " + outputDirectory);<NEW_LINE>}<NEW_LINE>FileUtilities.checkedMkdirs(outputFile.getParentFile());<NEW_LINE>if (!file.isDirectory()) {<NEW_LINE>monitor.setMessage("Unzipping jar file... ");<NEW_LINE>monitor.incrementProgress(1);<NEW_LINE>try (ByteProvider fileBP = fs.getByteProvider(file, monitor)) {<NEW_LINE>FSUtilities.copyByteProviderToFile(fileBP, outputFile, monitor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | initialize(files.size()); |
448,187 | private boolean checkIfCompileTime(String name) {<NEW_LINE>String packageName = name;<NEW_LINE>while (true) {<NEW_LINE>int index = packageName.lastIndexOf('.');<NEW_LINE>if (index < 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>packageName = packageName.substring(0, index);<NEW_LINE>if (isCompileTimePackage(packageName)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String outerName = name;<NEW_LINE>while (true) {<NEW_LINE>int index = outerName.lastIndexOf('$');<NEW_LINE>if (index < 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>outerName = <MASK><NEW_LINE>if (isCompileTimeClass(outerName)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CompileTimeClassVisitor visitor = new CompileTimeClassVisitor();<NEW_LINE>try (InputStream input = getResourceAsStream(name.replace('.', '/') + ".class")) {<NEW_LINE>if (input == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>new ClassReader(new BufferedInputStream(input)).accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG);<NEW_LINE>} catch (IOException e) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (visitor.compileTime) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (visitor.parent != null && !visitor.parent.equals(name)) {<NEW_LINE>return isCompileTimeClass(visitor.parent);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | outerName.substring(0, index); |
124,382 | Map<String, String> kafkaPodAnnotations(int brokerId, boolean storageAnnotation) {<NEW_LINE>Map<String, String> podAnnotations <MASK><NEW_LINE>podAnnotations.put(Ca.ANNO_STRIMZI_IO_CLUSTER_CA_CERT_GENERATION, String.valueOf(ModelUtils.caCertGeneration(this.clusterCa)));<NEW_LINE>podAnnotations.put(Ca.ANNO_STRIMZI_IO_CLIENTS_CA_CERT_GENERATION, String.valueOf(ModelUtils.caCertGeneration(this.clientsCa)));<NEW_LINE>podAnnotations.put(Annotations.ANNO_STRIMZI_LOGGING_APPENDERS_HASH, kafkaLoggingAppendersHash);<NEW_LINE>podAnnotations.put(KafkaCluster.ANNO_STRIMZI_BROKER_CONFIGURATION_HASH, kafkaBrokerConfigurationHash.get(brokerId));<NEW_LINE>podAnnotations.put(ANNO_STRIMZI_IO_KAFKA_VERSION, kafkaCluster.getKafkaVersion().version());<NEW_LINE>podAnnotations.put(KafkaCluster.ANNO_STRIMZI_IO_LOG_MESSAGE_FORMAT_VERSION, kafkaCluster.getLogMessageFormatVersion());<NEW_LINE>podAnnotations.put(KafkaCluster.ANNO_STRIMZI_IO_INTER_BROKER_PROTOCOL_VERSION, kafkaCluster.getInterBrokerProtocolVersion());<NEW_LINE>// Annotations with custom cert thumbprints to help with rolling updates when they change<NEW_LINE>if (!customListenerCertificateThumbprints.isEmpty()) {<NEW_LINE>podAnnotations.put(KafkaCluster.ANNO_STRIMZI_CUSTOM_LISTENER_CERT_THUMBPRINTS, customListenerCertificateThumbprints.toString());<NEW_LINE>}<NEW_LINE>// Storage annotation on Pods is used only for StatefulSets<NEW_LINE>if (storageAnnotation) {<NEW_LINE>podAnnotations.put(ANNO_STRIMZI_IO_STORAGE, ModelUtils.encodeStorageToJson(kafkaCluster.getStorage()));<NEW_LINE>}<NEW_LINE>return podAnnotations;<NEW_LINE>} | = new LinkedHashMap<>(9); |
1,336,649 | public void reverseTrxLines(final List<I_M_HU_Trx_Line> trxLines) {<NEW_LINE><MASK><NEW_LINE>if (trxLines.isEmpty()) {<NEW_LINE>// nothing to do<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Build ID to M_HU_Trx_Line map<NEW_LINE>final Map<Integer, I_M_HU_Trx_Line> id2trxLine = new HashMap<>(trxLines.size());<NEW_LINE>for (final I_M_HU_Trx_Line trxLine : trxLines) {<NEW_LINE>final int trxLineId = trxLine.getM_HU_Trx_Line_ID();<NEW_LINE>id2trxLine.put(trxLineId, trxLine);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Create Reversal Trx Header<NEW_LINE>final LazyInitializer<I_M_HU_Trx_Hdr> reversalTrxHdrRef = createTrxHeaderReference();<NEW_LINE>//<NEW_LINE>// Iterate trxLines and it's counterpart until we reversed everything<NEW_LINE>final List<I_M_HU_Trx_Line> reversalTrxLines = new ArrayList<>(trxLines.size());<NEW_LINE>while (!id2trxLine.isEmpty()) {<NEW_LINE>final int trxLineId = id2trxLine.keySet().iterator().next();<NEW_LINE>final I_M_HU_Trx_Line trxLine = id2trxLine.remove(trxLineId);<NEW_LINE>Check.assumeNotNull(trxLine, "Trx line for ID={} shall exist in {}", trxLineId, id2trxLine);<NEW_LINE>final int counterpartTrxLineId = trxLine.getParent_HU_Trx_Line_ID();<NEW_LINE>final I_M_HU_Trx_Line counterpartTrxLine = id2trxLine.remove(counterpartTrxLineId);<NEW_LINE>Check.assumeNotNull(counterpartTrxLine, "Counterpart trx line with ID={} for trx line {} not found in {}", counterpartTrxLineId, trxLine, id2trxLine);<NEW_LINE>final I_M_HU_Trx_Line reversalTrxLine = createTrxLineReversal(reversalTrxHdrRef, trxLine);<NEW_LINE>final I_M_HU_Trx_Line reversalCounterpartTrxLine = createTrxLineReversal(reversalTrxHdrRef, counterpartTrxLine);<NEW_LINE>// Link reversals<NEW_LINE>linkTrxLines(reversalTrxLine, reversalCounterpartTrxLine);<NEW_LINE>// Add to reversals list to be processed<NEW_LINE>reversalTrxLines.add(reversalTrxLine);<NEW_LINE>reversalTrxLines.add(reversalCounterpartTrxLine);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Process reversal<NEW_LINE>processTrx(reversalTrxHdrRef, reversalTrxLines);<NEW_LINE>markProcessed(reversalTrxHdrRef);<NEW_LINE>} | Check.assumeNotNull(trxLines, "trxLines not null"); |
353,384 | public boolean isSigned(int param) throws VirtuosoException {<NEW_LINE>int dtp = ((Number) getPd(param).elementAt(3)).intValue();<NEW_LINE>return (dtp == VirtuosoTypes.DV_SHORT_CONT_STRING || dtp == VirtuosoTypes.DV_SHORT_STRING_SERIAL || dtp == VirtuosoTypes.DV_STRICT_STRING || dtp == VirtuosoTypes.DV_LONG_CONT_STRING || dtp == VirtuosoTypes.DV_STRING || dtp == VirtuosoTypes.DV_C_STRING || dtp == VirtuosoTypes.DV_WIDE || dtp == VirtuosoTypes.DV_LONG_WIDE || dtp == VirtuosoTypes.DV_C_SHORT || dtp == VirtuosoTypes.DV_SHORT_INT || dtp == VirtuosoTypes.DV_LONG_INT || dtp == VirtuosoTypes.DV_C_INT || dtp == VirtuosoTypes.DV_SINGLE_FLOAT || dtp == VirtuosoTypes.DV_DOUBLE_FLOAT || dtp == VirtuosoTypes.<MASK><NEW_LINE>} | DV_CHARACTER || dtp == VirtuosoTypes.DV_NUMERIC); |
662,110 | public void onFocusChange(View view, boolean hasFocus) {<NEW_LINE>// Force show soft keyboard if TerminalView or toolbar text input view has<NEW_LINE>// focus and close it if they don't<NEW_LINE>boolean textInputViewHasFocus = false;<NEW_LINE>final EditText textInputView = mActivity.findViewById(R.id.terminal_toolbar_text_input);<NEW_LINE>if (textInputView != null)<NEW_LINE>textInputViewHasFocus = textInputView.hasFocus();<NEW_LINE>if (hasFocus || textInputViewHasFocus) {<NEW_LINE>if (mShowSoftKeyboardIgnoreOnce) {<NEW_LINE>mShowSoftKeyboardIgnoreOnce = false;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Logger.logVerbose(LOG_TAG, "Showing soft keyboard on focus change");<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>KeyboardUtils.setSoftKeyboardVisibility(getShowSoftKeyboardRunnable(), mActivity, mActivity.getTerminalView(), hasFocus || textInputViewHasFocus);<NEW_LINE>} | Logger.logVerbose(LOG_TAG, "Hiding soft keyboard on focus change"); |
510,978 | /* (non-Javadoc)<NEW_LINE>* @see org.archive.modules.extractor.ContentExtractor#shouldExtract(org.archive.modules.CrawlURI)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>protected boolean shouldExtract(CrawlURI uri) {<NEW_LINE>// If declared as such:<NEW_LINE>if (uri.getAnnotations().contains(ExtractorRobotsTxt.ANNOTATION_IS_SITEMAP)) {<NEW_LINE>if (uri.is2XXSuccess()) {<NEW_LINE>LOGGER.fine("This url (" + uri + ") is declared to be a sitemap (via robots.txt) and is a HTTP 200.");<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>LOGGER.fine("This url (" + uri + ") is declared to be a sitemap (via robots.txt) but is a HTTP " + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (urlPattern != null && uri.getURI().matches(urlPattern)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Via content type:<NEW_LINE>String mimeType = uri.getContentType();<NEW_LINE>if (mimeType != null) {<NEW_LINE>// Looks like XML:<NEW_LINE>if (mimeType.toLowerCase().startsWith("text/xml") || mimeType.toLowerCase().startsWith("application/xml")) {<NEW_LINE>// check if content starts with xml preamble "<?xml" and does<NEW_LINE>// contain "<urlset " or "<sitemapindex" early in the content<NEW_LINE>String contentStartingChunk = uri.getRecorder().getContentReplayPrefixString(400);<NEW_LINE>if (contentStartingChunk.matches("(?is)[\\ufeff]?<\\?xml\\s.*") && contentStartingChunk.matches("(?is).*(?:<urlset|<sitemapindex[>\\s]).*")) {<NEW_LINE>LOGGER.info("Based on content sniffing, this is a sitemap: " + uri);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Otherwise, not<NEW_LINE>return false;<NEW_LINE>} | uri.getFetchStatus() + "."); |
463,897 | public void build(Task<Void> task) throws CompileExceptionError, IOException {<NEW_LINE>IResource input = task.getInputs().get(0);<NEW_LINE>PrototypeDesc.Builder protoBuilder = loadPrototype(input);<NEW_LINE>for (ComponentDesc c : protoBuilder.getComponentsList()) {<NEW_LINE>String component = c.getComponent();<NEW_LINE>BuilderUtil.checkResource(this.project, input, "component", component);<NEW_LINE>}<NEW_LINE>for (EmbeddedComponentDesc ec : protoBuilder.getEmbeddedComponentsList()) {<NEW_LINE>if (ec.getId().length() == 0) {<NEW_LINE>throw new CompileExceptionError(input, 0, "missing required field 'id'");<NEW_LINE>}<NEW_LINE>byte[] data = ec.getData().getBytes();<NEW_LINE>long hash = MurmurHash.hash64(data, data.length);<NEW_LINE>IResource genResource = project.getGeneratedResource(hash, ec.getType());<NEW_LINE>// TODO: We have to set content again here as distclean might have removed everything at this point (according to CollectionBuilder.java)<NEW_LINE>genResource.setContent(data);<NEW_LINE>int buildDirLen = project.getBuildDirectory().length();<NEW_LINE>String path = genResource.getPath().substring(buildDirLen);<NEW_LINE>ComponentDesc c = ComponentDesc.newBuilder().setId(ec.getId()).setPosition(ec.getPosition()).setRotation(ec.getRotation()).<MASK><NEW_LINE>protoBuilder.addComponents(c);<NEW_LINE>}<NEW_LINE>protoBuilder = transformGo(input, protoBuilder);<NEW_LINE>protoBuilder.clearEmbeddedComponents();<NEW_LINE>ByteArrayOutputStream out = new ByteArrayOutputStream(4 * 1024);<NEW_LINE>PrototypeDesc proto = protoBuilder.build();<NEW_LINE>proto.writeTo(out);<NEW_LINE>out.close();<NEW_LINE>task.output(0).setContent(out.toByteArray());<NEW_LINE>} | setComponent(path).build(); |
1,354,297 | private static Future<Void> postUserTask(final Source src, final UserTask task, final AtomicReference<Throwable> status) {<NEW_LINE>boolean retry = false;<NEW_LINE>Boolean b = retryGuard.get();<NEW_LINE>boolean mode = b <MASK><NEW_LINE>try {<NEW_LINE>retryGuard.set(mode);<NEW_LINE>ParserManager.parse(Collections.singleton(src), task);<NEW_LINE>} catch (ParseException ex) {<NEW_LINE>status.set(ex);<NEW_LINE>} catch (RetryWhenScanFinished e) {<NEW_LINE>// expected, will retry in runWhenParseFinished<NEW_LINE>retry = true;<NEW_LINE>} finally {<NEW_LINE>if (b == null) {<NEW_LINE>retryGuard.remove();<NEW_LINE>} else {<NEW_LINE>retryGuard.set(b);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!retry) {<NEW_LINE>return new FinishedFuture();<NEW_LINE>}<NEW_LINE>final TaskWrapper wrapper;<NEW_LINE>Future<Void> handle;<NEW_LINE>wrapper = new TaskWrapper(task, status, mode);<NEW_LINE>try {<NEW_LINE>handle = ParserManager.parseWhenScanFinished(Collections.singletonList(src), wrapper);<NEW_LINE>} catch (ParseException ex) {<NEW_LINE>status.set(ex);<NEW_LINE>handle = new FinishedFuture();<NEW_LINE>}<NEW_LINE>return handle;<NEW_LINE>} | == null || b.booleanValue(); |
1,666,349 | private void doDeleteRowRPC(TDSCommand command) throws SQLServerException {<NEW_LINE>assert 0 != serverCursorId;<NEW_LINE>TDSWriter tdsWriter = command.startRequest(TDS.PKT_RPC);<NEW_LINE>// procedure name length -> use ProcIDs<NEW_LINE>tdsWriter.writeShort((short) 0xFFFF);<NEW_LINE>tdsWriter.writeShort(TDS.PROCID_SP_CURSOR);<NEW_LINE>// RPC procedure option 1<NEW_LINE>tdsWriter<MASK><NEW_LINE>// RPC procedure option 2<NEW_LINE>tdsWriter.writeByte((byte) 0);<NEW_LINE>tdsWriter.sendEnclavePackage(null, null);<NEW_LINE>tdsWriter.writeRPCInt(null, serverCursorId, false);<NEW_LINE>tdsWriter.writeRPCInt(null, TDS.SP_CURSOR_OP_DELETE | TDS.SP_CURSOR_OP_SETPOSITION, false);<NEW_LINE>tdsWriter.writeRPCInt(null, fetchBufferGetRow(), false);<NEW_LINE>tdsWriter.writeRPCStringUnicode("");<NEW_LINE>TDSParser.parse(command.startResponse(), command.getLogContext());<NEW_LINE>} | .writeByte((byte) 0); |
743,254 | public void fit(ArrayList<double[]> init, double[] data, double[] cResidual, int ifIntercept) {<NEW_LINE>double[] arCoef = init.get(0);<NEW_LINE>double[] <MASK><NEW_LINE>double intercept = init.get(2)[0];<NEW_LINE>double variance = init.get(3)[0];<NEW_LINE>this.p = arCoef.length;<NEW_LINE>this.q = maCoef.length;<NEW_LINE>this.data = data;<NEW_LINE>this.cResidual = cResidual;<NEW_LINE>this.type = 1;<NEW_LINE>double[][] a = new double[data.length][1];<NEW_LINE>for (int q = 0; q < data.length; q++) {<NEW_LINE>a[q][0] = data[q];<NEW_LINE>}<NEW_LINE>super.setX(new DenseMatrix(a));<NEW_LINE>double[][] m;<NEW_LINE>this.ifIntercept = ifIntercept;<NEW_LINE>if (ifIntercept == 0) {<NEW_LINE>m = new double[arCoef.length + maCoef.length + 1][1];<NEW_LINE>m[m.length - 1][0] = variance;<NEW_LINE>} else {<NEW_LINE>m = new double[arCoef.length + maCoef.length + 2][1];<NEW_LINE>m[m.length - 1][0] = variance;<NEW_LINE>m[m.length - 2][0] = intercept;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < arCoef.length; i++) {<NEW_LINE>m[i][0] = arCoef[i];<NEW_LINE>}<NEW_LINE>for (int i = 0; i < maCoef.length; i++) {<NEW_LINE>m[i + arCoef.length][0] = maCoef[i];<NEW_LINE>}<NEW_LINE>if (m.length == 0) {<NEW_LINE>super.initCoef = DenseMatrix.zeros(0, 0);<NEW_LINE>} else {<NEW_LINE>super.initCoef = new DenseMatrix(m);<NEW_LINE>}<NEW_LINE>} | maCoef = init.get(1); |
1,568,953 | private void externalLoad(final Cache concreteCache, final long currentTime) throws Throwable {<NEW_LINE>byte[] newKey = ((AbstractExternalCache) concreteCache).buildKey(key);<NEW_LINE>byte[] lockKey = combine(newKey, "_#RL#".getBytes());<NEW_LINE>long loadTimeOut = RefreshCache.this.config.getRefreshPolicy().getRefreshLockTimeoutMillis();<NEW_LINE>long refreshMillis = config<MASK><NEW_LINE>byte[] timestampKey = combine(newKey, "_#TS#".getBytes());<NEW_LINE>// AbstractExternalCache buildKey method will not convert byte[]<NEW_LINE>CacheGetResult refreshTimeResult = concreteCache.GET(timestampKey);<NEW_LINE>boolean shouldLoad = false;<NEW_LINE>if (refreshTimeResult.isSuccess()) {<NEW_LINE>shouldLoad = currentTime >= Long.parseLong(refreshTimeResult.getValue().toString()) + refreshMillis;<NEW_LINE>} else if (refreshTimeResult.getResultCode() == CacheResultCode.NOT_EXISTS) {<NEW_LINE>shouldLoad = true;<NEW_LINE>}<NEW_LINE>if (!shouldLoad) {<NEW_LINE>if (multiLevelCache) {<NEW_LINE>refreshUpperCaches(key);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Runnable r = () -> {<NEW_LINE>try {<NEW_LINE>load();<NEW_LINE>// AbstractExternalCache buildKey method will not convert byte[]<NEW_LINE>concreteCache.put(timestampKey, String.valueOf(System.currentTimeMillis()));<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw new CacheException("refresh error", e);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// AbstractExternalCache buildKey method will not convert byte[]<NEW_LINE>boolean lockSuccess = concreteCache.tryLockAndRun(lockKey, loadTimeOut, TimeUnit.MILLISECONDS, r);<NEW_LINE>if (!lockSuccess && multiLevelCache) {<NEW_LINE>JetCacheExecutor.heavyIOExecutor().schedule(() -> refreshUpperCaches(key), (long) (0.2 * refreshMillis), TimeUnit.MILLISECONDS);<NEW_LINE>}<NEW_LINE>} | .getRefreshPolicy().getRefreshMillis(); |
1,525,508 | protected void removeUnusedRedises() {<NEW_LINE>Set<Endpoint> currentStoredRedises = sessions.keySet();<NEW_LINE>if (currentStoredRedises.isEmpty())<NEW_LINE>return;<NEW_LINE>Set<HostPort> redisInUse = getInUseRedises();<NEW_LINE>if (redisInUse == null || redisInUse.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Endpoint> <MASK><NEW_LINE>for (Endpoint endpoint : currentStoredRedises) {<NEW_LINE>if (!redisInUse.contains(new HostPort(endpoint.getHost(), endpoint.getPort()))) {<NEW_LINE>unusedRedises.add(endpoint);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (unusedRedises.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>unusedRedises.forEach(endpoint -> {<NEW_LINE>RedisSession redisSession = sessions.getOrDefault(endpoint, null);<NEW_LINE>if (redisSession != null) {<NEW_LINE>logger.info("[removeUnusedRedises]Redis: {} not in use, remove from session manager", endpoint);<NEW_LINE>// add try logic to continue working on others<NEW_LINE>try {<NEW_LINE>redisSession.closeConnection();<NEW_LINE>} catch (Exception ignore) {<NEW_LINE>}<NEW_LINE>sessions.remove(endpoint);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | unusedRedises = new LinkedList<>(); |
1,695,833 | public VersionStatus unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>VersionStatus versionStatus = new VersionStatus();<NEW_LINE><MASK><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 null;<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("Options", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>versionStatus.setOptions(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Status", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>versionStatus.setStatus(OptionStatusJsonUnmarshaller.getInstance().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 versionStatus;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
420,083 | public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {<NEW_LINE>try (final PrintFile printFile = getOutputFile(cl)) {<NEW_LINE>final String tableName = OptUtil.getTableOpt(cl, shellState);<NEW_LINE>final Class<? extends Formatter> formatter = getFormatter(cl, tableName, shellState);<NEW_LINE>final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);<NEW_LINE>String classLoaderContext = null;<NEW_LINE>if (cl.hasOption(contextOpt.getOpt())) {<NEW_LINE>classLoaderContext = cl.getOptionValue(contextOpt.getOpt());<NEW_LINE>}<NEW_LINE>// handle first argument, if present, the authorizations list to<NEW_LINE>// scan with<NEW_LINE>final Authorizations auths = getAuths(cl, shellState);<NEW_LINE>final Scanner scanner = shellState.getAccumuloClient().createScanner(tableName, auths);<NEW_LINE>if (classLoaderContext != null) {<NEW_LINE>scanner.setClassLoaderContext(classLoaderContext);<NEW_LINE>}<NEW_LINE>// handle session-specific scan iterators<NEW_LINE>addScanIterators(shellState, cl, scanner, tableName);<NEW_LINE>// handle remaining optional arguments<NEW_LINE>scanner.setRange(getRange(cl, interpeter));<NEW_LINE>// handle columns<NEW_LINE>fetchColumns(cl, scanner, interpeter);<NEW_LINE>fetchColumsWithCFAndCQ(cl, scanner, interpeter);<NEW_LINE>// set timeout<NEW_LINE>scanner.setTimeout(getTimeout(cl), TimeUnit.MILLISECONDS);<NEW_LINE>setupSampling(<MASK><NEW_LINE>scanner.setExecutionHints(ShellUtil.parseMapOpt(cl, executionHintsOpt));<NEW_LINE>// output the records<NEW_LINE>final FormatterConfig config = new FormatterConfig();<NEW_LINE>config.setPrintTimestamps(cl.hasOption(timestampOpt.getOpt()));<NEW_LINE>if (cl.hasOption(showFewOpt.getOpt())) {<NEW_LINE>final String showLength = cl.getOptionValue(showFewOpt.getOpt());<NEW_LINE>try {<NEW_LINE>final int length = Integer.parseInt(showLength);<NEW_LINE>config.setShownLength(length);<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>Shell.log.error("Arg must be an integer.", nfe);<NEW_LINE>} catch (IllegalArgumentException iae) {<NEW_LINE>Shell.log.error("Arg must be greater than one.", iae);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>printRecords(cl, shellState, config, scanner, formatter, printFile);<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | tableName, cl, shellState, scanner); |
731,926 | public BigInteger[] generateSignature(byte[] digest) {<NEW_LINE>if (!this.forSigning) {<NEW_LINE>throw new IllegalStateException("not initialised for signing");<NEW_LINE>}<NEW_LINE>BigInteger n = getOrder();<NEW_LINE>BigInteger e = new BigInteger(1, digest);<NEW_LINE>ECPrivateKeyParameters privKey = (ECPrivateKeyParameters) key;<NEW_LINE>if (e.compareTo(n) >= 0) {<NEW_LINE>throw new DataLengthException("input too large for ECNR key");<NEW_LINE>}<NEW_LINE>BigInteger r = null;<NEW_LINE>BigInteger s = null;<NEW_LINE>AsymmetricCipherKeyPair tempPair;<NEW_LINE>do // generate r<NEW_LINE>{<NEW_LINE>// generate another, but very temporary, key pair using<NEW_LINE>// the same EC parameters<NEW_LINE>ECKeyPairGenerator keyGen = new ECKeyPairGenerator();<NEW_LINE>keyGen.init(new ECKeyGenerationParameters(privKey.getParameters(), this.random));<NEW_LINE>tempPair = keyGen.generateKeyPair();<NEW_LINE>// BigInteger Vx = tempPair.getPublic().getW().getAffineX();<NEW_LINE>// get temp's public key<NEW_LINE>ECPublicKeyParameters V = (ECPublicKeyParameters) tempPair.getPublic();<NEW_LINE>// get the point's x coordinate<NEW_LINE>BigInteger Vx = V.getQ().getAffineXCoord().toBigInteger();<NEW_LINE>r = Vx.add(e).mod(n);<NEW_LINE>} while (r<MASK><NEW_LINE>// generate s<NEW_LINE>// private key value<NEW_LINE>BigInteger x = privKey.getD();<NEW_LINE>// temp's private key value<NEW_LINE>BigInteger u = ((ECPrivateKeyParameters) tempPair.getPrivate()).getD();<NEW_LINE>s = u.subtract(r.multiply(x)).mod(n);<NEW_LINE>BigInteger[] res = new BigInteger[2];<NEW_LINE>res[0] = r;<NEW_LINE>res[1] = s;<NEW_LINE>return res;<NEW_LINE>} | .equals(ECConstants.ZERO)); |
1,550,621 | private static URI initializeNamespace(ServerConfiguration bkServerConf, URI dlogUri) throws IOException {<NEW_LINE>BKDLConfig dlConfig = new BKDLConfig(ZKMetadataDriverBase.resolveZkServers(bkServerConf), ZKMetadataDriverBase.resolveZkLedgersRootPath(bkServerConf));<NEW_LINE>DLMetadata dlMetadata = DLMetadata.create(dlConfig);<NEW_LINE>try {<NEW_LINE>log.info("Initializing dlog namespace at {}", dlogUri);<NEW_LINE>dlMetadata.create(dlogUri);<NEW_LINE>log.info("Initialized dlog namespace at {}", dlogUri);<NEW_LINE>} catch (ZKException e) {<NEW_LINE>if (e.getKeeperExceptionCode() == Code.NODEEXISTS) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Dlog uri is already bound at {}", dlogUri);<NEW_LINE>}<NEW_LINE>return dlogUri;<NEW_LINE>}<NEW_LINE>log.<MASK><NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>return dlogUri;<NEW_LINE>} | error("Failed to initialize dlog namespace at {}", dlogUri, e); |
993,165 | private void verifyDynamicEditorModel(HighFunction hf, FunctionEditorModel model) {<NEW_LINE>FunctionPrototype functionPrototype = hf.getFunctionPrototype();<NEW_LINE>int decompParamCnt = functionPrototype.getNumParams();<NEW_LINE>List<ParamInfo<MASK><NEW_LINE>int modelParamCnt = parameters.size();<NEW_LINE>// growth accounts for auto param injection<NEW_LINE>int autoParamCnt = modelParamCnt - decompParamCnt;<NEW_LINE>// make sure decomp params account for injected auto params<NEW_LINE>boolean useCustom = (decompParamCnt < autoParamCnt);<NEW_LINE>for (int i = 0; i < autoParamCnt && !useCustom; i++) {<NEW_LINE>if (i >= decompParamCnt) {<NEW_LINE>useCustom = true;<NEW_LINE>} else {<NEW_LINE>VariableStorage modelParamStorage = parameters.get(i).getStorage();<NEW_LINE>VariableStorage decompParamStorage = functionPrototype.getParam(i).getStorage();<NEW_LINE>if (!modelParamStorage.equals(decompParamStorage)) {<NEW_LINE>useCustom = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!useCustom) {<NEW_LINE>// remove original params which replicate auto params<NEW_LINE>for (int i = 0; i < autoParamCnt; i++) {<NEW_LINE>// be sure to select beyond auto-params. First auto-param is on row 1<NEW_LINE>model.setSelectedParameterRow(new int[] { autoParamCnt + 1 });<NEW_LINE>model.removeParameters();<NEW_LINE>}<NEW_LINE>// verify remaining parameter storage<NEW_LINE>for (int i = autoParamCnt; i < decompParamCnt; i++) {<NEW_LINE>VariableStorage modelParamStorage = parameters.get(i).getStorage();<NEW_LINE>VariableStorage decompParamStorage = functionPrototype.getParam(i).getStorage();<NEW_LINE>if (!modelParamStorage.equals(decompParamStorage)) {<NEW_LINE>useCustom = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO: return storage not currently returned from Decompiler<NEW_LINE>if (useCustom) {<NEW_LINE>// Force custom storage<NEW_LINE>model.setUseCustomizeStorage(true);<NEW_LINE>model.setFunctionData(buildSignature(hf));<NEW_LINE>model.setReturnStorage(functionPrototype.getReturnStorage());<NEW_LINE>parameters = model.getParameters();<NEW_LINE>for (int i = 0; i < decompParamCnt; i++) {<NEW_LINE>model.setParameterStorage(parameters.get(i), functionPrototype.getParam(i).getStorage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > parameters = model.getParameters(); |
1,618,463 | public ReplicaGlobalSecondaryIndexSettingsUpdate unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ReplicaGlobalSecondaryIndexSettingsUpdate replicaGlobalSecondaryIndexSettingsUpdate = new ReplicaGlobalSecondaryIndexSettingsUpdate();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><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 null;<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("IndexName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>replicaGlobalSecondaryIndexSettingsUpdate.setIndexName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ProvisionedReadCapacityUnits", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>replicaGlobalSecondaryIndexSettingsUpdate.setProvisionedReadCapacityUnits(context.getUnmarshaller(Long.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ProvisionedReadCapacityAutoScalingSettingsUpdate", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>replicaGlobalSecondaryIndexSettingsUpdate.setProvisionedReadCapacityAutoScalingSettingsUpdate(AutoScalingSettingsUpdateJsonUnmarshaller.getInstance().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 replicaGlobalSecondaryIndexSettingsUpdate;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,408,897 | public StorageRuleType unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>StorageRuleType storageRuleType = new StorageRuleType();<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 null;<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("StorageAllocatedInBytes", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>storageRuleType.setStorageAllocatedInBytes(context.getUnmarshaller(Long.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("StorageType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>storageRuleType.setStorageType(context.getUnmarshaller(String.<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 storageRuleType;<NEW_LINE>} | class).unmarshall(context)); |
1,743,593 | private TextLine[] calculateTextLines() {<NEW_LINE>int startOffset = 0;<NEW_LINE>List<TextLine> textLines = new ArrayList<>();<NEW_LINE>StringBuilder lineBuilder = new StringBuilder();<NEW_LINE>int index = 0;<NEW_LINE>int line = 0;<NEW_LINE>int textLength = text.length();<NEW_LINE>int lengthOfNewLineChars;<NEW_LINE>while (index < textLength) {<NEW_LINE>char c = text.charAt(index);<NEW_LINE>if (c == '\r' || c == '\n') {<NEW_LINE>int nextCharIndex = index + 1;<NEW_LINE>if (c == '\r' && textLength != nextCharIndex && text.charAt(nextCharIndex) == '\n') {<NEW_LINE>lengthOfNewLineChars = 2;<NEW_LINE>} else {<NEW_LINE>lengthOfNewLineChars = 1;<NEW_LINE>}<NEW_LINE>String strLine = lineBuilder.toString();<NEW_LINE>int endOffset = startOffset + strLine.length();<NEW_LINE>textLines.add(new TextLine(line++, strLine<MASK><NEW_LINE>startOffset = endOffset + lengthOfNewLineChars;<NEW_LINE>lineBuilder = new StringBuilder();<NEW_LINE>index += lengthOfNewLineChars;<NEW_LINE>} else {<NEW_LINE>lineBuilder.append(c);<NEW_LINE>index++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String strLine = lineBuilder.toString();<NEW_LINE>textLines.add(new TextLine(line, strLine, startOffset, startOffset + strLine.length(), 0));<NEW_LINE>return textLines.toArray(new TextLine[0]);<NEW_LINE>} | , startOffset, endOffset, lengthOfNewLineChars)); |
858,292 | public void provideCodegen(CodegenMethod method, SAIFFInitializeSymbol symbols, CodegenClassScope classScope) {<NEW_LINE>CodegenExpressionRef spec = ref("spec");<NEW_LINE>method.getBlock().declareVarNewInstance(OutputProcessViewConditionSpec.EPTYPE, spec.getRef()).exprDotMethod(spec, "setConditionType", enumValue(ResultSetProcessorOutputConditionType.class, conditionType.name())).exprDotMethod(spec, "setOutputConditionFactory", outputConditionFactoryForge.make(method, symbols, classScope)).exprDotMethod(spec, "setStreamCount", constant(streamCount)).exprDotMethod(spec, "setTerminable", constant(terminable)).exprDotMethod(spec, "setSelectClauseStreamSelector", enumValue(SelectClauseStreamSelectorEnum.class, selectClauseStreamSelector.name())).exprDotMethod(spec, "setPostProcessFactory", outputStrategyPostProcessForge == null ? constantNull() : outputStrategyPostProcessForge.make(method, symbols, classScope)).exprDotMethod(spec, "setHasAfter", constant(hasAfter)).exprDotMethod(spec, "setDistinct", constant(isDistinct)).exprDotMethod(spec, "setDistinctKeyGetter", MultiKeyCodegen.codegenGetterEventDistinct(isDistinct, resultEventType, distinctMultiKey, method, classScope)).exprDotMethod(spec, "setResultEventType", EventTypeUtility.resolveTypeCodegen(resultEventType, symbols.getAddInitSvc(method))).exprDotMethod(spec, "setAfterTimePeriod", afterTimePeriodExpr == null ? constantNull() : afterTimePeriodExpr.getTimePeriodComputeForge().makeEvaluator(method, classScope)).exprDotMethod(spec, "setAfterConditionNumberOfEvents", constant(afterNumberOfEvents)).exprDotMethod(spec, "setUnaggregatedUngrouped", constant(unaggregatedUngrouped)).exprDotMethod(spec, "setEventTypes", EventTypeUtility.resolveTypeArrayCodegen(eventTypes, EPStatementInitServices.REF)).exprDotMethod(spec, "setChangeSetStateMgmtSettings", changeSetStateMgmtSettings.toExpression()).exprDotMethod(spec, "setOutputFirstStateMgmtSettings", outputFirstStateMgmtSettings.toExpression()).methodReturn(newInstance<MASK><NEW_LINE>} | (OutputProcessViewConditionFactory.EPTYPE, spec)); |
601,977 | // Create and init manager including all listeners etc<NEW_LINE>public static InfinispanNotificationsManager create(KeycloakSession session, Cache<String, Serializable> workCache, String myAddress, String mySite, Set<RemoteStore> remoteStores) {<NEW_LINE>RemoteCache workRemoteCache = null;<NEW_LINE>if (!remoteStores.isEmpty()) {<NEW_LINE>RemoteStore remoteStore = remoteStores.iterator().next();<NEW_LINE>workRemoteCache = remoteStore.getRemoteCache();<NEW_LINE>if (mySite == null) {<NEW_LINE>throw new IllegalStateException("Multiple datacenters available, but site name is not configured! Check your configuration");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ExecutorService listenersExecutor = workRemoteCache == null ? null : session.getProvider(ExecutorsProvider.class).getExecutor("work-cache-event-listener");<NEW_LINE>InfinispanNotificationsManager manager = new InfinispanNotificationsManager(workCache, workRemoteCache, myAddress, mySite, listenersExecutor);<NEW_LINE>// We need CacheEntryListener for communication within current DC<NEW_LINE>workCache.addListener(manager.new CacheEntryListener());<NEW_LINE>logger.debugf("Added listener for infinispan cache: %s", workCache.getName());<NEW_LINE>// Added listener for remoteCache to notify other DCs<NEW_LINE>if (workRemoteCache != null) {<NEW_LINE>workRemoteCache.addClientListener(<MASK><NEW_LINE>logger.debugf("Added listener for HotRod remoteStore cache: %s", workRemoteCache.getName());<NEW_LINE>}<NEW_LINE>return manager;<NEW_LINE>} | manager.new HotRodListener(workRemoteCache)); |
1,561,340 | private static DiskStats queryReadWriteStats(String index) {<NEW_LINE>// Create object to hold and return results<NEW_LINE>DiskStats stats = new DiskStats();<NEW_LINE>Pair<List<String>, Map<PhysicalDiskProperty, List<Long>>> instanceValuePair = PhysicalDisk.queryDiskCounters();<NEW_LINE>List<String> instances = instanceValuePair.getA();<NEW_LINE>Map<PhysicalDiskProperty, List<Long>> valueMap = instanceValuePair.getB();<NEW_LINE>stats.timeStamp = System.currentTimeMillis();<NEW_LINE>List<Long> readList = valueMap.get(PhysicalDiskProperty.DISKREADSPERSEC);<NEW_LINE>List<Long> readByteList = valueMap.get(PhysicalDiskProperty.DISKREADBYTESPERSEC);<NEW_LINE>List<Long> writeList = valueMap.get(PhysicalDiskProperty.DISKWRITESPERSEC);<NEW_LINE>List<Long> writeByteList = valueMap.get(PhysicalDiskProperty.DISKWRITEBYTESPERSEC);<NEW_LINE>List<Long> queueLengthList = valueMap.get(PhysicalDiskProperty.CURRENTDISKQUEUELENGTH);<NEW_LINE>List<Long> diskTimeList = valueMap.get(PhysicalDiskProperty.PERCENTDISKTIME);<NEW_LINE>if (instances.isEmpty() || readList == null || readByteList == null || writeList == null || writeByteList == null || queueLengthList == null || diskTimeList == null) {<NEW_LINE>return stats;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < instances.size(); i++) {<NEW_LINE>String name = getIndexFromName(instances.get(i));<NEW_LINE>// If index arg passed, only update passed arg<NEW_LINE>if (index != null && !index.equals(name)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>stats.readMap.put(name, readList.get(i));<NEW_LINE>stats.readByteMap.put(name, readByteList.get(i));<NEW_LINE>stats.writeMap.put(name, writeList.get(i));<NEW_LINE>stats.writeByteMap.put(name, writeByteList.get(i));<NEW_LINE>stats.queueLengthMap.put(name<MASK><NEW_LINE>stats.diskTimeMap.put(name, diskTimeList.get(i) / 10_000L);<NEW_LINE>}<NEW_LINE>return stats;<NEW_LINE>} | , queueLengthList.get(i)); |
1,317,108 | private static void generateEnumDecoder(final StringBuilder sb, final int level, final Token fieldToken, final Token typeToken, final String name) throws IOException {<NEW_LINE>final String referencedName = typeToken.referencedName();<NEW_LINE>final String enumType = formatStructName(referencedName == null ? typeToken.name() : referencedName);<NEW_LINE>if (fieldToken.isConstantEncoding()) {<NEW_LINE>indent(sb, level, "/// CONSTANT enum\n");<NEW_LINE>final Encoding encoding = fieldToken.encoding();<NEW_LINE>final String rawConstValueName = encoding.constValue().toString();<NEW_LINE>final int indexOfDot = rawConstValueName.indexOf('.');<NEW_LINE>final String constValueName = -1 == indexOfDot ? rawConstValueName : rawConstValueName.substring(indexOfDot + 1);<NEW_LINE>final String constantRustExpression = enumType + "::" + constValueName;<NEW_LINE>appendConstAccessor(sb, name, enumType, constantRustExpression, level);<NEW_LINE>} else {<NEW_LINE>final Encoding encoding = typeToken.encoding();<NEW_LINE>final String rustPrimitiveType = rustTypeName(encoding.primitiveType());<NEW_LINE>indent(sb, level, "/// REQUIRED enum\n");<NEW_LINE>indent(sb, level, "#[inline]\n");<NEW_LINE>indent(sb, level, "pub fn %s(&self) -> %s {\n", formatFunctionName(name), enumType);<NEW_LINE>if (fieldToken.version() > 0) {<NEW_LINE>indent(sb, level + 1, "if self.acting_version < %d {\n", fieldToken.version());<NEW_LINE>indent(sb, level + 2, "return %s::default();\n", enumType);<NEW_LINE>indent(sb, level + 1, "}\n\n");<NEW_LINE>}<NEW_LINE>indent(sb, level + 1, "self.get_buf().get_%s_at(self.%s).into()\n"<MASK><NEW_LINE>indent(sb, level, "}\n\n");<NEW_LINE>}<NEW_LINE>} | , rustPrimitiveType, getBufOffset(typeToken)); |
1,539,966 | // variable instance query /////////////////////////////<NEW_LINE>protected void configureVariableInstanceQuery(VariableInstanceQueryImpl query) {<NEW_LINE>configureQuery(query);<NEW_LINE>if (query.getAuthCheck().isAuthorizationCheckEnabled()) {<NEW_LINE>CompositePermissionCheck permissionCheck;<NEW_LINE>if (isEnsureSpecificVariablePermission()) {<NEW_LINE>permissionCheck = new PermissionCheckBuilder().disjunctive().atomicCheck(PROCESS_DEFINITION, "PROCDEF.KEY_", READ_INSTANCE_VARIABLE).atomicCheck(TASK, "RES.TASK_ID_", READ_VARIABLE).build();<NEW_LINE>} else {<NEW_LINE>permissionCheck = new PermissionCheckBuilder().disjunctive().atomicCheck(PROCESS_INSTANCE, "RES.PROC_INST_ID_", READ).atomicCheck(PROCESS_DEFINITION, "PROCDEF.KEY_", READ_INSTANCE).atomicCheck(TASK, <MASK><NEW_LINE>}<NEW_LINE>addPermissionCheck(query.getAuthCheck(), permissionCheck);<NEW_LINE>}<NEW_LINE>} | "RES.TASK_ID_", READ).build(); |
966,482 | public void writeRelationshipGroupCommand(WritableChannel channel, Command.RelationshipGroupCommand command) throws IOException {<NEW_LINE>int relType = Math.max(command.getBefore().getType(), command.getAfter().getType());<NEW_LINE>if (relType == Record.NULL_REFERENCE.intValue() || relType >>> Short.SIZE == 0) {<NEW_LINE>// relType will fit in a short<NEW_LINE>channel.put(NeoCommandType.REL_GROUP_COMMAND);<NEW_LINE>channel.putLong(command.getAfter().getId());<NEW_LINE>writeRelationshipGroupRecord(<MASK><NEW_LINE>writeRelationshipGroupRecord(channel, command.getAfter());<NEW_LINE>} else {<NEW_LINE>// here we need 3 bytes to store the relType<NEW_LINE>channel.put(NeoCommandType.REL_GROUP_EXTENDED_COMMAND);<NEW_LINE>channel.putLong(command.getAfter().getId());<NEW_LINE>writeRelationshipGroupExtendedRecord(channel, command.getBefore());<NEW_LINE>writeRelationshipGroupExtendedRecord(channel, command.getAfter());<NEW_LINE>}<NEW_LINE>} | channel, command.getBefore()); |
1,212,889 | public void hash(final String s, final LongTupleHashFunction hashFunction, final int off, final int len, final long[] result) {<NEW_LINE>final int sl = s.length();<NEW_LINE>if (len <= 0 || sl <= 0) {<NEW_LINE>// check as chars<NEW_LINE>checkArrayOffs(sl, off, len);<NEW_LINE>hashFunction.hashVoid(result);<NEW_LINE>} else {<NEW_LINE>final byte[] value = (byte[]) UnsafeAccess.UNSAFE.getObject(s, valueOffset);<NEW_LINE>if (enableCompactStrings && sl == value.length) {<NEW_LINE>// check as chars<NEW_LINE><MASK><NEW_LINE>// 'off' and 'len' are passed as bytes<NEW_LINE>hashFunction.hash(value, compactLatin1Access, (long) off * 2L, (long) len * 2L, result);<NEW_LINE>} else {<NEW_LINE>// hash as bytes<NEW_LINE>hashFunction.hashBytes(value, off * 2, len * 2, result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | checkArrayOffs(sl, off, len); |
1,601,047 | public Document mongoSerialise() {<NEW_LINE>Document dbObject = super.mongoSerialise();<NEW_LINE>dbObject.put("direction", getDirection().ordinal());<NEW_LINE>dbObject.put("hp", hp);<NEW_LINE>dbObject.put("shield", shield);<NEW_LINE>dbObject.put("action", lastAction.ordinal());<NEW_LINE>if (parent != null) {<NEW_LINE>// Only used client-side for now<NEW_LINE>dbObject.put("parent", parent.getUsername());<NEW_LINE>}<NEW_LINE>List<Document> hardwareList = new ArrayList<>();<NEW_LINE>for (Integer address : hardwareAddresses.keySet()) {<NEW_LINE>HardwareModule <MASK><NEW_LINE>Document serialisedHw = hardware.mongoSerialise();<NEW_LINE>serialisedHw.put("address", address);<NEW_LINE>hardwareList.add(serialisedHw);<NEW_LINE>}<NEW_LINE>dbObject.put("hardware", hardwareList);<NEW_LINE>dbObject.put("cpu", cpu.mongoSerialise());<NEW_LINE>return dbObject;<NEW_LINE>} | hardware = hardwareAddresses.get(address); |
1,798,720 | public void deleteAttachmentFilesForViewOnceMessage(long mmsId) {<NEW_LINE>Log.d(TAG, "[deleteAttachmentFilesForViewOnceMessage] mmsId: " + mmsId);<NEW_LINE>SQLiteDatabase database = databaseHelper.getSignalWritableDatabase();<NEW_LINE>Cursor cursor = null;<NEW_LINE>try {<NEW_LINE>cursor = database.query(TABLE_NAME, new String[] { DATA, CONTENT_TYPE, ROW_ID, UNIQUE_ID }, MMS_ID + " = ?", new String[] { mmsId + "" }, null, null, null);<NEW_LINE>while (cursor != null && cursor.moveToNext()) {<NEW_LINE>deleteAttachmentOnDisk(CursorUtil.requireString(cursor, DATA), CursorUtil.requireString(cursor, CONTENT_TYPE), new AttachmentId(CursorUtil.requireLong(cursor, ROW_ID), CursorUtil.requireLong(cursor, UNIQUE_ID)));<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (cursor != null)<NEW_LINE>cursor.close();<NEW_LINE>}<NEW_LINE>ContentValues values = new ContentValues();<NEW_LINE>values.put(DATA, (String) null);<NEW_LINE>values.put(DATA_RANDOM, (byte[]) null);<NEW_LINE>values.put(DATA_HASH, (String) null);<NEW_LINE>values.put(FILE_NAME, (String) null);<NEW_LINE>values.put(CAPTION, (String) null);<NEW_LINE>values.put(SIZE, 0);<NEW_LINE>values.put(WIDTH, 0);<NEW_LINE>values.put(HEIGHT, 0);<NEW_LINE>values.put(TRANSFER_STATE, TRANSFER_PROGRESS_DONE);<NEW_LINE>values.put(VISUAL_HASH, (String) null);<NEW_LINE>values.put(CONTENT_TYPE, MediaUtil.VIEW_ONCE);<NEW_LINE>database.update(TABLE_NAME, values, MMS_ID + " = ?", new String<MASK><NEW_LINE>notifyAttachmentListeners();<NEW_LINE>long threadId = SignalDatabase.mms().getThreadIdForMessage(mmsId);<NEW_LINE>if (threadId > 0) {<NEW_LINE>notifyConversationListeners(threadId);<NEW_LINE>}<NEW_LINE>} | [] { mmsId + "" }); |
77,751 | private String calculateInputSpecHash(File inputSpecFile) throws IOException {<NEW_LINE>URL inputSpecRemoteUrl = inputSpecRemoteUrl();<NEW_LINE>File inputSpecTempFile = inputSpecFile;<NEW_LINE>if (inputSpecRemoteUrl != null) {<NEW_LINE>inputSpecTempFile = java.nio.file.Files.createTempFile("openapi-spec", ".tmp").toFile();<NEW_LINE><MASK><NEW_LINE>if (isNotEmpty(auth)) {<NEW_LINE>List<AuthorizationValue> authList = AuthParser.parse(auth);<NEW_LINE>for (AuthorizationValue a : authList) {<NEW_LINE>conn.setRequestProperty(a.getKeyName(), a.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try (ReadableByteChannel readableByteChannel = Channels.newChannel(conn.getInputStream())) {<NEW_LINE>FileChannel fileChannel;<NEW_LINE>try (FileOutputStream fileOutputStream = new FileOutputStream(inputSpecTempFile)) {<NEW_LINE>fileChannel = fileOutputStream.getChannel();<NEW_LINE>fileChannel.transferFrom(readableByteChannel, 0, Long.MAX_VALUE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ByteSource inputSpecByteSource = inputSpecTempFile.exists() ? Files.asByteSource(inputSpecTempFile) : CharSource.wrap(ClasspathHelper.loadFileFromClasspath(inputSpecTempFile.toString().replaceAll("\\\\", "/"))).asByteSource(StandardCharsets.UTF_8);<NEW_LINE>return inputSpecByteSource.hash(Hashing.sha256()).toString();<NEW_LINE>} | URLConnection conn = inputSpecRemoteUrl.openConnection(); |
1,207,604 | public boolean checkRunConfig(RunConfig config) {<NEW_LINE>if (config.getPreExecution() != null && !checkRunConfig(config.getPreExecution())) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (config.getReactorStyle() == RunConfig.ReactorStyle.NONE) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>File dir = config.getExecutionDirectory();<NEW_LINE>FileObject fo = FileUtil.toFileObject(dir);<NEW_LINE>Project p = config.getProject();<NEW_LINE>if (p == null || fo != p.getProjectDirectory()) {<NEW_LINE>// Custom <basedir> perhaps? Skip.<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>NbMavenProject mavenprj = p.getLookup(<MASK><NEW_LINE>if (mavenprj == null) {<NEW_LINE>// Unloadable?<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (NbMavenProject.isErrorPlaceholder(mavenprj.getMavenProject())) {<NEW_LINE>// broken project<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>NbMavenProject reactor = findReactor(mavenprj);<NEW_LINE>File reactorRoot = reactor.getMavenProject().getBasedir();<NEW_LINE>if (reactor != mavenprj) {<NEW_LINE>try {<NEW_LINE>M2Configuration cfg = ProjectManager.getDefault().findProject(FileUtil.toFileObject(reactorRoot)).getLookup().lookup(M2ConfigProvider.class).getActiveConfiguration();<NEW_LINE>if (cfg != null) {<NEW_LINE>List<String> reactorProfiles = cfg.getActivatedProfiles();<NEW_LINE>if (!reactorProfiles.isEmpty()) {<NEW_LINE>List<String> profiles = new ArrayList<String>(config.getActivatedProfiles());<NEW_LINE>profiles.addAll(reactorProfiles);<NEW_LINE>config.setActivatedProfiles(profiles);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException x) {<NEW_LINE>Exceptions.printStackTrace(x);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>config.setExecutionDirectory(reactorRoot);<NEW_LINE>return true;<NEW_LINE>} | ).lookup(NbMavenProject.class); |
1,455,978 | private static Metadata metadataToSnapshot(Collection<IndexId> indices, Metadata metadata) {<NEW_LINE>Metadata.Builder <MASK><NEW_LINE>for (IndexId indexId : indices) {<NEW_LINE>IndexMetadata index = metadata.index(indexId.getName());<NEW_LINE>IndexMetadata.Builder indexMetadataBuilder = IndexMetadata.builder(index);<NEW_LINE>// for a minimal restore we basically disable indexing on all fields and only create an index<NEW_LINE>// that is valid from an operational perspective. ie. it will have all metadata fields like version/<NEW_LINE>// seqID etc. and an indexed ID field such that we can potentially perform updates on them or delete documents.<NEW_LINE>MappingMetadata mmd = index.mapping();<NEW_LINE>if (mmd != null) {<NEW_LINE>// we don't need to obey any routing here stuff is read-only anyway and get is disabled<NEW_LINE>final String mapping = "{ \"_doc\" : { \"enabled\": false, \"_meta\": " + mmd.source().string() + " } }";<NEW_LINE>indexMetadataBuilder.putMapping(mapping);<NEW_LINE>}<NEW_LINE>indexMetadataBuilder.settings(Settings.builder().put(index.getSettings()).put(SOURCE_ONLY.getKey(), true).put("index.blocks.write", true));<NEW_LINE>// read-only!<NEW_LINE>indexMetadataBuilder.settingsVersion(1 + indexMetadataBuilder.settingsVersion());<NEW_LINE>builder.put(indexMetadataBuilder);<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | builder = Metadata.builder(metadata); |
1,551,832 | public void marshall(UpdateProductRequest updateProductRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (updateProductRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getOwner(), OWNER_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getDistributor(), DISTRIBUTOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getSupportEmail(), SUPPORTEMAIL_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getSupportUrl(), SUPPORTURL_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getAddTags(), ADDTAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(updateProductRequest.getRemoveTags(), REMOVETAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | updateProductRequest.getSupportDescription(), SUPPORTDESCRIPTION_BINDING); |
567,768 | private <T extends ScriptObject> T initConstructor(final String name, final Class<T> clazz) {<NEW_LINE>try {<NEW_LINE>// Assuming class name pattern for built-in JS constructors.<NEW_LINE>final StringBuilder sb = new StringBuilder("jdk.nashorn.internal.objects.");<NEW_LINE>sb.append("Native");<NEW_LINE>sb.append(name);<NEW_LINE>sb.append("$Constructor");<NEW_LINE>final Class<?> funcClass = Class.<MASK><NEW_LINE>final T res = clazz.cast(funcClass.newInstance());<NEW_LINE>if (res instanceof ScriptFunction) {<NEW_LINE>// All global constructor prototypes are not-writable,<NEW_LINE>// not-enumerable and not-configurable.<NEW_LINE>final ScriptFunction func = (ScriptFunction) res;<NEW_LINE>func.modifyOwnProperty(func.getProperty("prototype"), Attribute.NON_ENUMERABLE_CONSTANT);<NEW_LINE>}<NEW_LINE>if (res.getProto() == null) {<NEW_LINE>res.setInitialProto(getObjectPrototype());<NEW_LINE>}<NEW_LINE>res.setIsBuiltin();<NEW_LINE>return res;<NEW_LINE>} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | forName(sb.toString()); |
1,197,252 | private boolean moveUser(UserVO user, long newAccountId) {<NEW_LINE>if (newAccountId == user.getAccountId()) {<NEW_LINE>// could do a not silent fail but the objective of the user is reached<NEW_LINE>// no need to create a new user object for this user<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return Transaction.execute(new TransactionCallback<Boolean>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Boolean doInTransaction(TransactionStatus status) {<NEW_LINE>UserVO newUser = new UserVO(user);<NEW_LINE>user.<MASK><NEW_LINE>user.setUuid(UUID.randomUUID().toString());<NEW_LINE>user.setApiKey(null);<NEW_LINE>user.setSecretKey(null);<NEW_LINE>_userDao.update(user.getId(), user);<NEW_LINE>newUser.setAccountId(newAccountId);<NEW_LINE>boolean success = _userDao.remove(user.getId());<NEW_LINE>UserVO persisted = _userDao.persist(newUser);<NEW_LINE>return success && persisted.getUuid().equals(user.getExternalEntity());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | setExternalEntity(user.getUuid()); |
1,594,746 | public static String parseUPN(GeneralName generalName) {<NEW_LINE>// OtherName ::= SEQUENCE {<NEW_LINE>// type-id OBJECT IDENTIFIER,<NEW_LINE>// value [0] EXPLICIT ANY DEFINED BY type-id }<NEW_LINE>ASN1Sequence otherName = <MASK><NEW_LINE>ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) otherName.getObjectAt(0);<NEW_LINE>if (UPN_OID.equals(oid.getId())) {<NEW_LINE>ASN1TaggedObject asn1TaggedObject = (ASN1TaggedObject) otherName.getObjectAt(1);<NEW_LINE>ASN1UTF8String upn = ASN1UTF8String.getInstance(asn1TaggedObject.getTagClass());<NEW_LINE>return MessageFormat.format(res.getString("GeneralNameUtil.OtherGeneralName"), "UPN", upn.getString());<NEW_LINE>}<NEW_LINE>// fallback to generic handling<NEW_LINE>ASN1Encodable value = otherName.getObjectAt(1);<NEW_LINE>try {<NEW_LINE>return MessageFormat.format(res.getString("GeneralNameUtil.OtherGeneralName"), ObjectIdUtil.toString(oid), HexUtil.getHexString(value.toASN1Primitive().getEncoded(ASN1Encoding.DER)));<NEW_LINE>} catch (IOException e) {<NEW_LINE>return MessageFormat.format(res.getString("GeneralNameUtil.OtherGeneralName"), ObjectIdUtil.toString(oid), "");<NEW_LINE>}<NEW_LINE>} | (ASN1Sequence) generalName.getName(); |
1,433,227 | public PageSTInterface<Key, Value> split() {<NEW_LINE>List<Key> keysToMove = new ArrayList<>();<NEW_LINE>int middleRank = binarySearchSymbolTable.size() / 2;<NEW_LINE>for (int index = middleRank; index < binarySearchSymbolTable.size(); index++) {<NEW_LINE>Key <MASK><NEW_LINE>keysToMove.add(keyToMove);<NEW_LINE>}<NEW_LINE>PageSTInterface<Key, Value> newPage = new BinarySearchSTPage<>(isExternal, maxNumberOfNodes, pagesInMemory);<NEW_LINE>int keysToMoveSize = 0;<NEW_LINE>for (Key key : keysToMove) {<NEW_LINE>PageValue pageValue = binarySearchSymbolTable.get(key);<NEW_LINE>PageSTInterface<Key, Value> childPage = pageValue.childPage;<NEW_LINE>Value value = pageValue.value;<NEW_LINE>if (!isExternal()) {<NEW_LINE>keysToMoveSize += childPage.keysSize(true);<NEW_LINE>newPage.addPage(childPage);<NEW_LINE>} else {<NEW_LINE>keysToMoveSize++;<NEW_LINE>newPage.add(key, value);<NEW_LINE>}<NEW_LINE>binarySearchSymbolTable.delete(key);<NEW_LINE>}<NEW_LINE>// No need to set containsSentinel because right nodes will never have it<NEW_LINE>newPage.setKeysSize(keysToMoveSize);<NEW_LINE>size -= keysToMoveSize;<NEW_LINE>return newPage;<NEW_LINE>} | keyToMove = binarySearchSymbolTable.select(index); |
1,200,037 | public void testCreateSharedNonDurableConsumer_JRException_TCP_SecOff(HttpServletRequest request, HttpServletResponse response) throws Throwable {<NEW_LINE>JMSContext jmsContextTCFTCP = tcfTCP.createContext();<NEW_LINE>JMSConsumer jmsConsumer1 = jmsContextTCFTCP.createSharedConsumer(topic1, "DURATEST1_TCP");<NEW_LINE><MASK><NEW_LINE>TextMessage msgOut = jmsContextTCFTCP.createTextMessage("This is a test message");<NEW_LINE>jmsProducer.send(topic1, msgOut);<NEW_LINE>TextMessage msgIn = (TextMessage) jmsConsumer1.receive(30000);<NEW_LINE>boolean testFailed = false;<NEW_LINE>try {<NEW_LINE>JMSConsumer jmsConsumer2 = jmsContextTCFTCP.createSharedConsumer(topic3, "DURATEST1_TCP");<NEW_LINE>testFailed = true;<NEW_LINE>} catch (JMSRuntimeException ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>jmsConsumer1.close();<NEW_LINE>jmsContextTCFTCP.close();<NEW_LINE>if (testFailed) {<NEW_LINE>throw new Exception("testCreateSharedNonDurableConsumer_JRException_B_SecOff failed");<NEW_LINE>}<NEW_LINE>} | JMSProducer jmsProducer = jmsContextTCFTCP.createProducer(); |
964,436 | public boolean processScriptAfter(String fieldName) {<NEW_LINE>int index = getIndexOfScript(fieldName, false);<NEW_LINE>if (index == -1) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String afterElementName = fieldName.substring(0, index);<NEW_LINE>if (StringUtils.isNotEmpty(afterElementName)) {<NEW_LINE>if (afterElementName.equals(getAfterTableToken())) {<NEW_LINE>afterElementName = getTableTableName();<NEW_LINE>} else if (afterElementName.equals(getAfterRowToken())) {<NEW_LINE>afterElementName = getTableRowName();<NEW_LINE>} else if (afterElementName.equals(getAfterTableCellToken())) {<NEW_LINE>afterElementName = getTableCellName();<NEW_LINE>} else if (afterElementName.startsWith(AFTER_TOKEN)) {<NEW_LINE>afterElementName = afterElementName.substring(AFTER_TOKEN.length(), afterElementName.length());<NEW_LINE>}<NEW_LINE>BufferedElement elementInfo = super<MASK><NEW_LINE>if (elementInfo == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String after = fieldName.substring(index, fieldName.length());<NEW_LINE>after = formatDirective(after);<NEW_LINE>elementInfo.setContentAfterEndTagElement(after);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | .findParentElementInfo(singletonList(afterElementName)); |
248,052 | private void createStream(MediaStreamTrack[] tracks, BiConsumer<String, ArrayList<WritableMap>> successCallback) {<NEW_LINE>String streamId = UUID.randomUUID().toString();<NEW_LINE>MediaStream mediaStream = webRTCModule.mFactory.createLocalMediaStream(streamId);<NEW_LINE>ArrayList<WritableMap> tracksInfo = new ArrayList<>();<NEW_LINE>for (MediaStreamTrack track : tracks) {<NEW_LINE>if (track == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (track instanceof AudioTrack) {<NEW_LINE>mediaStream.addTrack((AudioTrack) track);<NEW_LINE>} else {<NEW_LINE>mediaStream.addTrack((VideoTrack) track);<NEW_LINE>}<NEW_LINE>WritableMap trackInfo = Arguments.createMap();<NEW_LINE>String trackId = track.id();<NEW_LINE>trackInfo.putBoolean("enabled", track.enabled());<NEW_LINE>trackInfo.putString("id", trackId);<NEW_LINE>trackInfo.putString("kind", track.kind());<NEW_LINE>trackInfo.putString("label", trackId);<NEW_LINE>trackInfo.putString("readyState", track.<MASK><NEW_LINE>trackInfo.putBoolean("remote", false);<NEW_LINE>if (track instanceof VideoTrack) {<NEW_LINE>TrackPrivate tp = this.tracks.get(trackId);<NEW_LINE>AbstractVideoCaptureController vcc = tp.videoCaptureController;<NEW_LINE>WritableMap settings = Arguments.createMap();<NEW_LINE>settings.putInt("height", vcc.getHeight());<NEW_LINE>settings.putInt("width", vcc.getWidth());<NEW_LINE>settings.putInt("frameRate", vcc.getFrameRate());<NEW_LINE>trackInfo.putMap("settings", settings);<NEW_LINE>}<NEW_LINE>tracksInfo.add(trackInfo);<NEW_LINE>}<NEW_LINE>Log.d(TAG, "MediaStream id: " + streamId);<NEW_LINE>webRTCModule.localStreams.put(streamId, mediaStream);<NEW_LINE>successCallback.accept(streamId, tracksInfo);<NEW_LINE>} | state().toString()); |
179,363 | private static String removeMultiLineGarbage(String data, Pattern pattern) {<NEW_LINE>ArrayList<Region> regions = new ArrayList<Region>();<NEW_LINE>Matcher matcher = pattern.matcher(data);<NEW_LINE>while (matcher.find()) {<NEW_LINE>String declaration = matcher.group();<NEW_LINE>if (declaration.endsWith(C_MULTILINE_DELIM)) {<NEW_LINE>// multi-line declaration, locate first line that does not end with a \<NEW_LINE>int pos = data.indexOf(<MASK><NEW_LINE>int offset = 1;<NEW_LINE>if (pos != -1) {<NEW_LINE>if ('\r' == data.charAt(pos - 1)) {<NEW_LINE>// adjust for running on windows<NEW_LINE>offset++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>while ((pos != -1) && (C_MULTILINE_DELIM_CHAR == data.charAt(pos - offset))) {<NEW_LINE>pos = data.indexOf('\n', ++pos);<NEW_LINE>}<NEW_LINE>if (-1 == pos) {<NEW_LINE>String msg = String.format("Warning : unmatched end of multi-line declaration for %s starting at position %d", pattern.toString(), matcher.start());<NEW_LINE>System.err.println(msg);<NEW_LINE>} else {<NEW_LINE>regions.add(new Region(matcher.start(), ++pos));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// single line declaration<NEW_LINE>regions.add(new Region(matcher.start(), matcher.end()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (regions.size() != 0) {<NEW_LINE>// now remove all the specified regions from the string<NEW_LINE>StringBuilder temp = new StringBuilder();<NEW_LINE>int index = 0;<NEW_LINE>for (Region region : regions) {<NEW_LINE>temp.append(data.substring(index, region.getStart()));<NEW_LINE>index = region.getEnd();<NEW_LINE>}<NEW_LINE>// copy remaining text<NEW_LINE>temp.append(data.substring(index));<NEW_LINE>return temp.toString();<NEW_LINE>} else {<NEW_LINE>// return data unchanged<NEW_LINE>return data;<NEW_LINE>}<NEW_LINE>} | '\n', matcher.start()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.