idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,854,732 | final UpdateDomainContactPrivacyResult executeUpdateDomainContactPrivacy(UpdateDomainContactPrivacyRequest updateDomainContactPrivacyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateDomainContactPrivacyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateDomainContactPrivacyRequest> request = null;<NEW_LINE>Response<UpdateDomainContactPrivacyResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new UpdateDomainContactPrivacyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateDomainContactPrivacyRequest));<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, "Route 53 Domains");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateDomainContactPrivacy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateDomainContactPrivacyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateDomainContactPrivacyResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,059,089 | private static TypeQualifierAnnotation computeEffectiveTypeQualifierAnnotation(TypeQualifierValue<?> typeQualifierValue, AnnotatedObject o) {<NEW_LINE>Map<AnnotatedObject, TypeQualifierAnnotation> map = getEffectiveObjectAnnotations().computeIfAbsent(typeQualifierValue, k -> new HashMap<>());<NEW_LINE>// Check cached answer<NEW_LINE>TypeQualifierAnnotation result;<NEW_LINE>if (map.containsKey(o)) {<NEW_LINE>result = map.get(o);<NEW_LINE>} else {<NEW_LINE>if (DEBUG) {<NEW_LINE>System.out.println(<MASK><NEW_LINE>}<NEW_LINE>// Compute answer<NEW_LINE>TypeQualifierAnnotation tqa;<NEW_LINE>// See if there is a direct application<NEW_LINE>tqa = getDirectTypeQualifierAnnotation(o, typeQualifierValue);<NEW_LINE>// If it's an instance method, check for an inherited annotation<NEW_LINE>if (tqa == null && (o instanceof XMethod) && !((XMethod) o).isStatic() && !((XMethod) o).isPrivate() && !"<init>".equals(((XMethod) o).getName())) {<NEW_LINE>tqa = getInheritedTypeQualifierAnnotation((XMethod) o, typeQualifierValue);<NEW_LINE>}<NEW_LINE>boolean methodOverrides = false;<NEW_LINE>if (tqa == TypeQualifierAnnotation.OVERRIDES_BUT_NO_ANNOTATION) {<NEW_LINE>methodOverrides = true;<NEW_LINE>tqa = null;<NEW_LINE>}<NEW_LINE>// Check for a default (outer scope) annotation<NEW_LINE>if (tqa == null) {<NEW_LINE>tqa = getDefaultTypeQualifierAnnotation(o, typeQualifierValue, methodOverrides);<NEW_LINE>}<NEW_LINE>// Cache computed answer<NEW_LINE>result = tqa;<NEW_LINE>map.put(o, result);<NEW_LINE>if (DEBUG && result != null) {<NEW_LINE>System.out.println(" => Answer: " + result.when + " on " + o);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Return cached answer<NEW_LINE>return result;<NEW_LINE>} | "Looking up application of " + typeQualifierValue + " on " + o); |
1,275,230 | public void readSettings(WizardDescriptor wiz) {<NEW_LINE>boolean init = false;<NEW_LINE>if (wizard == null) {<NEW_LINE>init = true;<NEW_LINE>wizard = wiz;<NEW_LINE>}<NEW_LINE>Configuration panel = component.getConfiguration();<NEW_LINE>String displayName = (String) wiz.getProperty(AddDockerInstanceWizard.DISPLAY_NAME_PROPERTY);<NEW_LINE>if (displayName == null && init) {<NEW_LINE>displayName = Bundle.LBL_DefaultDisplayName();<NEW_LINE>}<NEW_LINE>panel.setDisplayName(displayName);<NEW_LINE>Boolean socketSelected = (Boolean) wiz.getProperty(AddDockerInstanceWizard.SOCKET_SELECTED_PROPERTY);<NEW_LINE>if (socketSelected == null) {<NEW_LINE>socketSelected = DockerSupport.getDefault().isSocketSupported();<NEW_LINE>}<NEW_LINE>panel.setSocketSelected(socketSelected);<NEW_LINE>File socket = (File) <MASK><NEW_LINE>if (socket == null && init && socketSelected) {<NEW_LINE>socket = getDefaultSocket();<NEW_LINE>}<NEW_LINE>panel.setSocket(socket);<NEW_LINE>String url = (String) wiz.getProperty(AddDockerInstanceWizard.URL_PROPERTY);<NEW_LINE>if (url == null && init && !socketSelected) {<NEW_LINE>url = getDefaultUrl();<NEW_LINE>}<NEW_LINE>panel.setUrl(url);<NEW_LINE>String certPath = (String) wiz.getProperty(AddDockerInstanceWizard.CERTIFICATE_PATH_PROPERTY);<NEW_LINE>if (certPath == null && init && !socketSelected) {<NEW_LINE>certPath = getDefaultCertificatePath();<NEW_LINE>}<NEW_LINE>panel.setCertPath(certPath);<NEW_LINE>// XXX revalidate; is this bug?<NEW_LINE>changeSupport.fireChange();<NEW_LINE>} | wiz.getProperty(AddDockerInstanceWizard.SOCKET_PROPERTY); |
1,528,208 | protected void validateKvmExtraConfig(String decodedUrl) {<NEW_LINE>String[] allowedConfigOptionList = KvmAdditionalConfigAllowList.value().split(",");<NEW_LINE>// Skip allowed keys validation validation for DPDK<NEW_LINE>if (!decodedUrl.contains(":")) {<NEW_LINE>try {<NEW_LINE>DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();<NEW_LINE>InputSource src = new InputSource();<NEW_LINE>src.setCharacterStream(new StringReader(String.format("<config>\n%s\n</config>", decodedUrl)));<NEW_LINE>Document doc = builder.parse(src);<NEW_LINE>doc.getDocumentElement().normalize();<NEW_LINE>NodeList <MASK><NEW_LINE>for (int i = 1; i < nodeList.getLength(); i++) {<NEW_LINE>// First element is config so skip it<NEW_LINE>Element element = (Element) nodeList.item(i);<NEW_LINE>boolean isValidConfig = false;<NEW_LINE>String currentConfig = element.getNodeName().trim();<NEW_LINE>for (String tag : allowedConfigOptionList) {<NEW_LINE>if (currentConfig.equals(tag.trim())) {<NEW_LINE>isValidConfig = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!isValidConfig) {<NEW_LINE>throw new CloudRuntimeException(String.format("Extra config %s is not on the list of allowed keys for KVM hypervisor hosts", currentConfig));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (ParserConfigurationException | IOException | SAXException e) {<NEW_LINE>throw new CloudRuntimeException("Failed to parse additional XML configuration: " + e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | nodeList = doc.getElementsByTagName("*"); |
1,616,907 | private static // to separate the different tokens.<NEW_LINE>List<TokenizedString> preTokensToDelimitedTokens(List<PreTokenizedString> pretokens) {<NEW_LINE>List<TokenizedString> tokens = new ArrayList<>();<NEW_LINE>int size = pretokens.size();<NEW_LINE>int i = 0;<NEW_LINE>while (i < size) {<NEW_LINE>StringBuilder chars = new StringBuilder(pretokens.get(i).getString());<NEW_LINE>PreToken pt = pretokens.get(i).getToken();<NEW_LINE>switch(pt) {<NEW_LINE>case ALPHA_PLUS:<NEW_LINE>// combine everything up to the next delimiter into a single alphanumeric token<NEW_LINE>int next = i + 1;<NEW_LINE>while (next < size && pretokens.get(next).getToken() != PreToken.DELIMITER) {<NEW_LINE>chars.append(pretokens.get(next).getString());<NEW_LINE>next++;<NEW_LINE>}<NEW_LINE>i = next - 1;<NEW_LINE>tokens.add(new TokenizedString(chars.toString<MASK><NEW_LINE>break;<NEW_LINE>case DELIMITER:<NEW_LINE>tokens.add(new TokenizedString(chars.toString(), Token.DELIMITER));<NEW_LINE>break;<NEW_LINE>case DIGIT_PLUS:<NEW_LINE>tokens.add(new TokenizedString(chars.toString(), Token.DIGIT_PLUS));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new BatfishException("Unknown pretoken " + pt);<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>return tokens;<NEW_LINE>} | (), Token.ALNUM_PLUS)); |
945,496 | public ResponseEntity<Void> deleteUserWithHttpInfo(String username) throws RestClientException {<NEW_LINE>Object postBody = null;<NEW_LINE>// verify the required parameter 'username' is set<NEW_LINE>if (username == null) {<NEW_LINE>throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling deleteUser");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>final Map<String, Object> uriVariables = new HashMap<String, Object>();<NEW_LINE>uriVariables.put("username", username);<NEW_LINE>String path = apiClient.expandPath("/user/{username}", uriVariables);<NEW_LINE>final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final HttpHeaders headerParams = new HttpHeaders();<NEW_LINE>final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final MultiValueMap formParams = new LinkedMultiValueMap();<NEW_LINE>final String[] accepts = {};<NEW_LINE>final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);<NEW_LINE><MASK><NEW_LINE>final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);<NEW_LINE>String[] authNames = new String[] {};<NEW_LINE>ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);<NEW_LINE>} | final String[] contentTypes = {}; |
1,273,292 | final RegisterConnectorResult executeRegisterConnector(RegisterConnectorRequest registerConnectorRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(registerConnectorRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<RegisterConnectorRequest> request = null;<NEW_LINE>Response<RegisterConnectorResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RegisterConnectorRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(registerConnectorRequest));<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, "Appflow");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RegisterConnector");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RegisterConnectorResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RegisterConnectorResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
196,731 | private void redraw(Area area) {<NEW_LINE>if (!area.isEmpty()) {<NEW_LINE>Rectangle r = getClientArea();<NEW_LINE>if (area != Area.FULL) {<NEW_LINE>r.x = Math.max(0, Math.min(r.width - 1, (int) Math.<MASK><NEW_LINE>r.y = Math.max(0, Math.min(r.height - 1, (int) Math.floor(area.y)));<NEW_LINE>r.width = Math.max(0, Math.min(r.width - r.x, (int) Math.ceil(area.w + (area.x - r.x))));<NEW_LINE>r.height = Math.max(0, Math.min(r.height - r.y, (int) Math.ceil(area.h + (area.y - r.y))));<NEW_LINE>}<NEW_LINE>redraw(r.x, r.y, r.width, r.height, false);<NEW_LINE>}<NEW_LINE>} | floor(area.x))); |
309,240 | public int compareTo(final Sample other) {<NEW_LINE>int cmp = ID.compareTo(other.getID());<NEW_LINE>if (0 == cmp) {<NEW_LINE>// use a null-tolerant string comparator for the optional strings<NEW_LINE>Comparator<String> compStr = Comparator.nullsFirst(Comparator.comparing(String::toString));<NEW_LINE>cmp = compStr.compare(familyID, other.getFamilyID());<NEW_LINE>if (0 == cmp) {<NEW_LINE>cmp = compStr.compare(paternalID, other.getPaternalID());<NEW_LINE>}<NEW_LINE>if (0 == cmp) {<NEW_LINE>cmp = compStr.compare(<MASK><NEW_LINE>}<NEW_LINE>if (0 == cmp) {<NEW_LINE>cmp = gender.compareTo(other.getSex());<NEW_LINE>}<NEW_LINE>if (0 == cmp) {<NEW_LINE>cmp = affection.compareTo(other.getAffection());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return cmp;<NEW_LINE>} | maternalID, other.getMaternalID()); |
1,050,962 | static Slime encodeRequest(ConfigKey<?> key, String hostname, DefContent defSchema, PayloadChecksums payloadChecksums, long generation, long timeout, Trace trace, long protocolVersion, CompressionType compressionType, Optional<VespaVersion> vespaVersion) {<NEW_LINE>Slime data = new Slime();<NEW_LINE><MASK><NEW_LINE>request.setLong(REQUEST_VERSION, protocolVersion);<NEW_LINE>request.setString(REQUEST_DEF_NAME, key.getName());<NEW_LINE>request.setString(REQUEST_DEF_NAMESPACE, key.getNamespace());<NEW_LINE>request.setString(REQUEST_DEF_MD5, ConfigUtils.getDefMd5(defSchema.asList()));<NEW_LINE>request.setString(REQUEST_CLIENT_CONFIGID, key.getConfigId());<NEW_LINE>request.setString(REQUEST_CLIENT_HOSTNAME, hostname);<NEW_LINE>defSchema.serialize(request.setArray(REQUEST_DEF_CONTENT));<NEW_LINE>if (payloadChecksums.getForType(XXHASH64) != null)<NEW_LINE>request.setString(REQUEST_CONFIG_XXHASH64, payloadChecksums.getForType(XXHASH64).asString());<NEW_LINE>if (payloadChecksums.getForType(MD5) != null)<NEW_LINE>request.setString(REQUEST_CONFIG_MD5, payloadChecksums.getForType(MD5).asString());<NEW_LINE>request.setLong(REQUEST_CURRENT_GENERATION, generation);<NEW_LINE>request.setLong(REQUEST_TIMEOUT, timeout);<NEW_LINE>request.setString(REQUEST_COMPRESSION_TYPE, compressionType.name());<NEW_LINE>vespaVersion.ifPresent(version -> request.setString(REQUEST_VESPA_VERSION, version.toString()));<NEW_LINE>trace.serialize(request.setObject(REQUEST_TRACE));<NEW_LINE>return data;<NEW_LINE>} | Cursor request = data.setObject(); |
1,469,484 | public List<BtcNodes.BtcNode> selectPreferredNodes(BtcNodes nodes) {<NEW_LINE>List<BtcNodes.BtcNode> result;<NEW_LINE>BtcNodes.BitcoinNodesOption nodesOption = BtcNodes.BitcoinNodesOption.values()[preferences.getBitcoinNodesOptionOrdinal()];<NEW_LINE>switch(nodesOption) {<NEW_LINE>case CUSTOM:<NEW_LINE><MASK><NEW_LINE>Set<String> distinctNodes = Utilities.commaSeparatedListToSet(bitcoinNodes, false);<NEW_LINE>result = BtcNodes.toBtcNodesList(distinctNodes);<NEW_LINE>if (result.isEmpty()) {<NEW_LINE>log.warn("Custom nodes is set but no valid nodes are provided. " + "We fall back to provided nodes option.");<NEW_LINE>preferences.setBitcoinNodesOptionOrdinal(BtcNodes.BitcoinNodesOption.PROVIDED.ordinal());<NEW_LINE>result = nodes.getProvidedBtcNodes();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case PUBLIC:<NEW_LINE>result = Collections.emptyList();<NEW_LINE>break;<NEW_LINE>case PROVIDED:<NEW_LINE>default:<NEW_LINE>result = nodes.getProvidedBtcNodes();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | String bitcoinNodes = preferences.getBitcoinNodes(); |
511,546 | public static void vertical5(Kernel1D_S32 kernel, GrayU16 src, GrayI16 dst) {<NEW_LINE>final short[] dataSrc = src.data;<NEW_LINE>final short[] dataDst = dst.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final <MASK><NEW_LINE>final int imgHeight = dst.getHeight();<NEW_LINE>final int yEnd = imgHeight - radius;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(radius, yEnd, y -> {<NEW_LINE>for (int y = radius; y < yEnd; y++) {<NEW_LINE>int indexDst = dst.startIndex + y * dst.stride;<NEW_LINE>int i = src.startIndex + (y - radius) * src.stride;<NEW_LINE>final int iEnd = i + imgWidth;<NEW_LINE>for (; i < iEnd; i++) {<NEW_LINE>int indexSrc = i;<NEW_LINE>int total = (dataSrc[indexSrc] & 0xFFFF) * k1;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFFFF) * k2;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFFFF) * k3;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFFFF) * k4;<NEW_LINE>indexSrc += src.stride;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFFFF) * k5;<NEW_LINE>dataDst[indexDst++] = (short) total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | int imgWidth = dst.getWidth(); |
774,937 | public static ListAppsResponse unmarshall(ListAppsResponse listAppsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listAppsResponse.setRequestId(_ctx.stringValue("ListAppsResponse.RequestId"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageNumber(_ctx.integerValue("ListAppsResponse.Data.PageNumber"));<NEW_LINE>data.setPageSize(_ctx.integerValue("ListAppsResponse.Data.PageSize"));<NEW_LINE>data.setTotalCount<MASK><NEW_LINE>List<AppItem> items = new ArrayList<AppItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListAppsResponse.Data.Items.Length"); i++) {<NEW_LINE>AppItem appItem = new AppItem();<NEW_LINE>appItem.setAppId(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].AppId"));<NEW_LINE>appItem.setDescription(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].Description"));<NEW_LINE>appItem.setCreateTime(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].CreateTime"));<NEW_LINE>appItem.setModifiedTime(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].ModifiedTime"));<NEW_LINE>appItem.setIcon(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].Icon"));<NEW_LINE>appItem.setIsTemplate(_ctx.booleanValue("ListAppsResponse.Data.Items[" + i + "].IsTemplate"));<NEW_LINE>appItem.setLastEditTime(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].LastEditTime"));<NEW_LINE>appItem.setMainModuleId(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].MainModuleId"));<NEW_LINE>appItem.setAppName(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].AppName"));<NEW_LINE>appItem.setSchemaVersion(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].SchemaVersion"));<NEW_LINE>appItem.setSource(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].Source"));<NEW_LINE>appItem.setAppStatus(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].AppStatus"));<NEW_LINE>appItem.setAppType(_ctx.stringValue("ListAppsResponse.Data.Items[" + i + "].AppType"));<NEW_LINE>items.add(appItem);<NEW_LINE>}<NEW_LINE>data.setItems(items);<NEW_LINE>listAppsResponse.setData(data);<NEW_LINE>return listAppsResponse;<NEW_LINE>} | (_ctx.integerValue("ListAppsResponse.Data.TotalCount")); |
1,019,400 | public void mockRemoteGitRepos(Validator validator, GitRepository credentialsRepo) throws IOException {<NEW_LINE>assertWithMessage("mockRemoteGitRepos() method called more than once in this test").that(mockHttpTransport).isNull();<NEW_LINE>mockHttpTransport = mock(MockHttpTransport.class, withSettings().defaultAnswer(invocation -> {<NEW_LINE>String method = (String) invocation.getArguments()[0];<NEW_LINE>String url = (String) invocation.getArguments()[1];<NEW_LINE>return mockResponseWithStatus("not used", 404, new MockRequestAssertion("Always throw", content -> {<NEW_LINE>throw new AssertionError(String.format("Cannot find a programmed answer for: %s %s\n%s"<MASK><NEW_LINE>}));<NEW_LINE>}));<NEW_LINE>optionsBuilder.git = new GitOptionsForTest(optionsBuilder.general, validator);<NEW_LINE>optionsBuilder.github = mockGitHubOptions(credentialsRepo);<NEW_LINE>optionsBuilder.gerrit = mockGerritOptions(credentialsRepo);<NEW_LINE>} | , method, url, content)); |
1,541,917 | protected Map<String, Object> buildCustomHeaders(ServiceBusReceivedMessage message) {<NEW_LINE>Map<String, Object> headers = new HashMap<>();<NEW_LINE>// Spring MessageHeaders<NEW_LINE>setValueIfHasText(headers, MessageHeaders.ID, message.getMessageId());<NEW_LINE>setValueIfHasText(headers, MessageHeaders.CONTENT_TYPE, message.getContentType());<NEW_LINE>setValueIfHasText(headers, MessageHeaders.REPLY_CHANNEL, message.getReplyTo());<NEW_LINE>// AzureHeaders.<NEW_LINE>// Does not have SCHEDULED_ENQUEUE_MESSAGE, because it's meaningless in receiver side.<NEW_LINE>// ServiceBusMessageHeaders.<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.CORRELATION_ID, message.getCorrelationId());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.MESSAGE_ID, message.getMessageId());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.PARTITION_KEY, message.getPartitionKey());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.TO, message.getTo());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.TIME_TO_LIVE, message.getTimeToLive());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.SCHEDULED_ENQUEUE_TIME, message.getScheduledEnqueueTime());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.REPLY_TO_SESSION_ID, message.getReplyToSessionId());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.SESSION_ID, message.getSessionId());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.DEAD_LETTER_ERROR_DESCRIPTION, message.getDeadLetterErrorDescription());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.<MASK><NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.DEAD_LETTER_SOURCE, message.getDeadLetterSource());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.DELIVERY_COUNT, message.getDeliveryCount());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.ENQUEUED_SEQUENCE_NUMBER, message.getEnqueuedSequenceNumber());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.ENQUEUED_TIME, message.getEnqueuedTime());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.EXPIRES_AT, message.getExpiresAt());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.LOCK_TOKEN, message.getLockToken());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.LOCKED_UNTIL, message.getLockedUntil());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.SEQUENCE_NUMBER, message.getSequenceNumber());<NEW_LINE>setValueIfPresent(headers, ServiceBusMessageHeaders.STATE, message.getState());<NEW_LINE>setValueIfHasText(headers, ServiceBusMessageHeaders.SUBJECT, message.getSubject());<NEW_LINE>message.getApplicationProperties().forEach(headers::putIfAbsent);<NEW_LINE>return Collections.unmodifiableMap(headers);<NEW_LINE>} | DEAD_LETTER_REASON, message.getDeadLetterReason()); |
1,222,201 | public void testHandleListClosesConnectionLeakedAcrossContextualTask() throws Exception {<NEW_LINE>// HandleList pseudo-context must be cleared regardless. It is not a configurable context type.<NEW_LINE>ThreadContext contextualizer = ThreadContext.builder().propagated(ThreadContext.NONE).cleared(ThreadContext.NONE).unchanged(ThreadContext.ALL_REMAINING).build();<NEW_LINE>Callable<Connection> insertWilkinCounty = contextualizer.contextualCallable(() -> {<NEW_LINE><MASK><NEW_LINE>con2.createStatement().executeUpdate("INSERT INTO MNCOUNTIES VALUES ('Wilkin', 6576)");<NEW_LINE>return con2;<NEW_LINE>});<NEW_LINE>tx.begin();<NEW_LINE>try (Connection con1 = defaultDataSource_unsharable.getConnection()) {<NEW_LINE>con1.createStatement().executeUpdate("INSERT INTO MNCOUNTIES VALUES ('Watonwan', 11211)");<NEW_LINE>Connection con2 = insertWilkinCounty.call();<NEW_LINE>assertFalse(con1.isClosed());<NEW_LINE>assertTrue(con2.isClosed());<NEW_LINE>} finally {<NEW_LINE>tx.commit();<NEW_LINE>}<NEW_LINE>// Verify that both updates committed<NEW_LINE>try (Connection con = defaultDataSource_unsharable.getConnection();<NEW_LINE>Statement st = con.createStatement()) {<NEW_LINE>ResultSet result = st.executeQuery("SELECT SUM(POPULATION) FROM MNCOUNTIES WHERE NAME='Watonwan' OR NAME='Wilkin'");<NEW_LINE>assertTrue(result.next());<NEW_LINE>assertEquals(17787, result.getInt(1));<NEW_LINE>}<NEW_LINE>} | Connection con2 = defaultDataSource_unsharable.getConnection(); |
1,729,869 | private /* GRECLIPSE edit -- GROOVY-10113<NEW_LINE>private void checkCyclicInheritance(ClassNode originalNode, ClassNode parentToCompare, ClassNode[] interfacesToCompare) {<NEW_LINE>if(!originalNode.isInterface()) {<NEW_LINE>if(parentToCompare == null) return;<NEW_LINE>if(originalNode == parentToCompare.redirect()) {<NEW_LINE>addError("Cyclic inheritance involving " + parentToCompare.getName() + " in class " + <MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if(interfacesToCompare != null && interfacesToCompare.length > 0) {<NEW_LINE>for(ClassNode intfToCompare : interfacesToCompare) {<NEW_LINE>if(originalNode == intfToCompare.redirect()) {<NEW_LINE>addError("Cycle detected: the type " + originalNode.getName() + " cannot implement itself" , originalNode);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if(parentToCompare == ClassHelper.OBJECT_TYPE) return;<NEW_LINE>checkCyclicInheritance(originalNode, parentToCompare.getUnresolvedSuperClass(), null);<NEW_LINE>} else {<NEW_LINE>if(interfacesToCompare != null && interfacesToCompare.length > 0) {<NEW_LINE>// check interfaces at this level first<NEW_LINE>for(ClassNode intfToCompare : interfacesToCompare) {<NEW_LINE>if(originalNode == intfToCompare.redirect()) {<NEW_LINE>addError("Cyclic inheritance involving " + intfToCompare.getName() + " in interface " + originalNode.getName(), originalNode);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// check next level of interfaces<NEW_LINE>for(ClassNode intf : interfacesToCompare) {<NEW_LINE>checkCyclicInheritance(originalNode, null, intf.getInterfaces());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>*/<NEW_LINE>void checkCyclicInheritance(final ClassNode node, final ClassNode type) {<NEW_LINE>if (type.redirect() == node || type.getOuterClasses().contains(node)) {<NEW_LINE>addError("Cycle detected: the type " + node.getName() + " cannot extend/implement itself or one of its own member types", type);<NEW_LINE>node.setHasInconsistentHierarchy(true);<NEW_LINE>} else if (type != ClassHelper.OBJECT_TYPE) {<NEW_LINE>Set<ClassNode> done = new HashSet<>();<NEW_LINE>done.add(ClassHelper.OBJECT_TYPE);<NEW_LINE>done.add(null);<NEW_LINE>LinkedList<ClassNode> todo = new LinkedList<>();<NEW_LINE>Collections.addAll(todo, type.getInterfaces());<NEW_LINE>todo.add(type.getUnresolvedSuperClass());<NEW_LINE>todo.add(type.getOuterClass());<NEW_LINE>do {<NEW_LINE>ClassNode next = todo.poll();<NEW_LINE>if (!done.add(next))<NEW_LINE>continue;<NEW_LINE>if (next.redirect() == node) {<NEW_LINE>ClassNode cn = type;<NEW_LINE>while (cn.getOuterClass() != null) cn = cn.getOuterClass();<NEW_LINE>addError("Cycle detected: a cycle exists in the type hierarchy between " + node.getName() + " and " + cn.getName(), type);<NEW_LINE>node.setHasInconsistentHierarchy(true);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Collections.addAll(todo, next.getInterfaces());<NEW_LINE>todo.add(next.getUnresolvedSuperClass());<NEW_LINE>todo.add(next.getOuterClass());<NEW_LINE>} while (!todo.isEmpty());<NEW_LINE>}<NEW_LINE>} | originalNode.getName(), originalNode); |
204,838 | public Buffer readFrom(final Class<Buffer> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws WebApplicationException {<NEW_LINE>return handleEntityStream(entityStream, ctxRefProvider.get().get().executionContext().bufferAllocator(), (p, a) -> {<NEW_LINE>final Buffer buf = newBufferForRequestContent(getRequestContentLength(requestCtxProvider), a);<NEW_LINE>p.toIterable().forEach(buf::writeBytes);<NEW_LINE>return buf;<NEW_LINE>}, (is, a) -> {<NEW_LINE>final int contentLength = getRequestContentLength(requestCtxProvider);<NEW_LINE>final Buffer buf = contentLength == -1 ? a.newBuffer() : a.newBuffer(contentLength);<NEW_LINE>try {<NEW_LINE>// Configured via the org.glassfish.jersey.message.MessageProperties#IO_BUFFER_SIZE property<NEW_LINE>final int written = buf.writeBytesUntilEndStream(is, BUFFER_SIZE);<NEW_LINE>if (contentLength > 0 && written != contentLength) {<NEW_LINE>throw new BadRequestException(<MASK><NEW_LINE>}<NEW_LINE>return buf;<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new InternalServerErrorException(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | "Not enough bytes for content-length: " + contentLength + ", only got: " + written); |
685,073 | public static Locale toLocale(String localeString) {<NEW_LINE>if (Strings.isNullOrEmpty(localeString)) {<NEW_LINE>return Locale.getDefault();<NEW_LINE>}<NEW_LINE>int separatorCountry = localeString.indexOf('_');<NEW_LINE>char separator;<NEW_LINE>if (separatorCountry >= 0) {<NEW_LINE>separator = '_';<NEW_LINE>} else {<NEW_LINE>separatorCountry = localeString.indexOf('-');<NEW_LINE>separator = '-';<NEW_LINE>}<NEW_LINE>String language;<NEW_LINE>String country;<NEW_LINE>String variant;<NEW_LINE>if (separatorCountry < 0) {<NEW_LINE>language = localeString;<NEW_LINE>country = "";<NEW_LINE>variant = "";<NEW_LINE>} else {<NEW_LINE>language = localeString.substring(0, separatorCountry);<NEW_LINE>int separatorVariant = localeString.indexOf(separator, separatorCountry + 1);<NEW_LINE>if (separatorVariant < 0) {<NEW_LINE>country = localeString.substring(separatorCountry + 1);<NEW_LINE>variant = "";<NEW_LINE>} else {<NEW_LINE>country = localeString.substring(separatorCountry + 1, separatorVariant);<NEW_LINE>variant = localeString.substring(separatorVariant + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new <MASK><NEW_LINE>} | Locale(language, country, variant); |
465,839 | protected final Result onRunJob(@NonNull Params params) {<NEW_LINE>PersistableBundleCompat extras = params.getExtras();<NEW_LINE>boolean runOnce = extras.getBoolean(EXTRA_ONCE, false);<NEW_LINE>if (!runOnce && (!extras.containsKey(EXTRA_START_MS) || !extras.containsKey(EXTRA_END_MS))) {<NEW_LINE>CAT.e("Daily job doesn't contain start and end time");<NEW_LINE>return Result.FAILURE;<NEW_LINE>}<NEW_LINE>DailyJobResult result = null;<NEW_LINE>try {<NEW_LINE>if (meetsRequirements(true)) {<NEW_LINE>result = onRunDailyJob(params);<NEW_LINE>} else {<NEW_LINE>// reschedule<NEW_LINE>result = DailyJobResult.SUCCESS;<NEW_LINE>CAT.i("Daily job requirements not met, reschedule for the next day");<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (result == null) {<NEW_LINE>// shouldn't happen if the job follows the contract<NEW_LINE>result = DailyJobResult.SUCCESS;<NEW_LINE>CAT.e("Daily job result was null");<NEW_LINE>}<NEW_LINE>if (!runOnce) {<NEW_LINE>JobRequest request = params.getRequest();<NEW_LINE>if (result == DailyJobResult.SUCCESS) {<NEW_LINE><MASK><NEW_LINE>// don't update current, it would cancel this currently running job<NEW_LINE>int newJobId = schedule(request.createBuilder(), false, extras.getLong(EXTRA_START_MS, 0) % DAY, extras.getLong(EXTRA_END_MS, 0L) % DAY, true);<NEW_LINE>request = JobManager.instance().getJobRequest(newJobId);<NEW_LINE>if (request != null) {<NEW_LINE>request.updateStats(false, true);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>CAT.i("Cancel daily job %s", request);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Result.SUCCESS;<NEW_LINE>} | CAT.i("Rescheduling daily job %s", request); |
1,447,377 | public String[] orLogicalCriteria() {<NEW_LINE>final Session session = HibernateUtil.getHibernateSession();<NEW_LINE>final CriteriaBuilder cb = session.getCriteriaBuilder();<NEW_LINE>final CriteriaQuery<Item> cr = cb.createQuery(Item.class);<NEW_LINE>final Root<Item> root = cr.from(Item.class);<NEW_LINE>Predicate greaterThanPrice = cb.gt(root.get("itemPrice"), 1000);<NEW_LINE>Predicate chairItems = cb.like(root.get("itemName"), "Chair%");<NEW_LINE>cr.select(root).where(cb<MASK><NEW_LINE>Query<Item> query = session.createQuery(cr);<NEW_LINE>final List<Item> orItemsList = query.getResultList();<NEW_LINE>final String[] orItems = new String[orItemsList.size()];<NEW_LINE>for (int i = 0; i < orItemsList.size(); i++) {<NEW_LINE>orItems[i] = orItemsList.get(i).getItemName();<NEW_LINE>}<NEW_LINE>session.close();<NEW_LINE>return orItems;<NEW_LINE>} | .or(greaterThanPrice, chairItems)); |
1,151,981 | final DeleteLanguageModelResult executeDeleteLanguageModel(DeleteLanguageModelRequest deleteLanguageModelRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteLanguageModelRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteLanguageModelRequest> request = null;<NEW_LINE>Response<DeleteLanguageModelResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteLanguageModelRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteLanguageModelRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Transcribe");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteLanguageModel");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteLanguageModelResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteLanguageModelResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
565,549 | final CreateCrawlerResult executeCreateCrawler(CreateCrawlerRequest createCrawlerRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createCrawlerRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateCrawlerRequest> request = null;<NEW_LINE>Response<CreateCrawlerResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateCrawlerRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createCrawlerRequest));<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, "Glue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateCrawler");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateCrawlerResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateCrawlerResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,653,707 | private HintResponse hintFieldName(String lastWord, String input, int caretPosition, Set<InferredType> expectedTypes) {<NEW_LINE>QueryTree queryTree;<NEW_LINE>try {<NEW_LINE>queryTree = new QueryTree(model, input, false);<NEW_LINE>} catch (JPA2RecognitionException e) {<NEW_LINE>List<String> errorMessages = new ArrayList<>();<NEW_LINE>errorMessages.add(e.getMessage());<NEW_LINE>return new HintResponse("Query error", errorMessages);<NEW_LINE>}<NEW_LINE>List<ErrorRec> errorRecs = queryTree.getInvalidIdVarNodes();<NEW_LINE>QueryVariableContext root = queryTree.getQueryVariableContext();<NEW_LINE>if (root == null) {<NEW_LINE>List<String> errorMessages = prepareErrorMessages(errorRecs);<NEW_LINE>errorMessages.add(0, "Query variable context is null");<NEW_LINE>return new HintResponse("Query error", errorMessages);<NEW_LINE>}<NEW_LINE>QueryVariableContext queryVC = root.getContextByCaretPosition(caretPosition);<NEW_LINE>EntityPath path = EntityPath.parseEntityPath(lastWord);<NEW_LINE>Pointer pointer = path.resolvePointer(model, queryVC);<NEW_LINE>if (pointer instanceof NoPointer) {<NEW_LINE>List<String> errorMessages = prepareErrorMessages(errorRecs);<NEW_LINE>errorMessages.add(0, "Cannot parse [" + lastWord + "]");<NEW_LINE>return new HintResponse("Query error", errorMessages);<NEW_LINE>}<NEW_LINE>if (pointer instanceof CollectionPointer) {<NEW_LINE>List<String> errorMessages = prepareErrorMessages(errorRecs);<NEW_LINE>errorMessages.add(0, "Cannot get attribute of collection [" + lastWord + "]");<NEW_LINE>return new HintResponse("Query error", errorMessages);<NEW_LINE>}<NEW_LINE>if (!(pointer instanceof EntityPointer)) {<NEW_LINE>List<String> errorMessages = prepareErrorMessages(errorRecs);<NEW_LINE>return new HintResponse("Query error", errorMessages);<NEW_LINE>}<NEW_LINE>List<Option> options = new ArrayList<>();<NEW_LINE>JpqlEntityModel targetEntity = ((EntityPointer) pointer).getEntity();<NEW_LINE>if (targetEntity instanceof NoJpqlEntityModel)<NEW_LINE>return new HintResponse(options, path.lastEntityFieldPattern);<NEW_LINE>List<Attribute> attributes = targetEntity.<MASK><NEW_LINE>for (Attribute attribute : attributes) {<NEW_LINE>options.add(new Option(attribute.getName(), attribute.getUserFriendlyName()));<NEW_LINE>}<NEW_LINE>return new HintResponse(options, path.lastEntityFieldPattern);<NEW_LINE>} | findAttributesStartingWith(path.lastEntityFieldPattern, expectedTypes); |
38,183 | public void draw(Batch batch, float parentAlpha) {<NEW_LINE>validate();<NEW_LINE>setBackground(getBackgroundDrawable());<NEW_LINE><MASK><NEW_LINE>if (isPressed() && !isDisabled()) {<NEW_LINE>offsetX = style.pressedOffsetX;<NEW_LINE>offsetY = style.pressedOffsetY;<NEW_LINE>} else if (isChecked() && !isDisabled()) {<NEW_LINE>offsetX = style.checkedOffsetX;<NEW_LINE>offsetY = style.checkedOffsetY;<NEW_LINE>} else {<NEW_LINE>offsetX = style.unpressedOffsetX;<NEW_LINE>offsetY = style.unpressedOffsetY;<NEW_LINE>}<NEW_LINE>boolean offset = offsetX != 0 || offsetY != 0;<NEW_LINE>Array<Actor> children = getChildren();<NEW_LINE>if (offset) {<NEW_LINE>for (int i = 0; i < children.size; i++) children.get(i).moveBy(offsetX, offsetY);<NEW_LINE>}<NEW_LINE>super.draw(batch, parentAlpha);<NEW_LINE>if (offset) {<NEW_LINE>for (int i = 0; i < children.size; i++) children.get(i).moveBy(-offsetX, -offsetY);<NEW_LINE>}<NEW_LINE>Stage stage = getStage();<NEW_LINE>if (stage != null && stage.getActionsRequestRendering() && isPressed() != clickListener.isPressed())<NEW_LINE>Gdx.graphics.requestRendering();<NEW_LINE>} | float offsetX = 0, offsetY = 0; |
1,302,906 | /*<NEW_LINE>* Given an array of variables, check if any are arrays and if so expand any other of the given variables to arrays of the same length.<NEW_LINE>* Doubles are turned into arrays of all the same value as original. Arrays of other lengths are padded with zeros.<NEW_LINE>*/<NEW_LINE>public Variable[] expandVariables(Variable[] values) {<NEW_LINE>// Check if any variables have preferred representation as arrays<NEW_LINE>int maxLength = 0;<NEW_LINE>for (Variable v : values) {<NEW_LINE>if (v.getPrimary() == Variable.Primary.ARRAY && v.getArrayValue().length > maxLength) {<NEW_LINE>maxLength = v.getArrayValue().length;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// if necessary, expand any non-array variables to maximum length<NEW_LINE>if (maxLength > 0) {<NEW_LINE>for (int n = 0; n < values.length; n++) {<NEW_LINE>Variable v = values[n];<NEW_LINE>if (v.getPrimary() == Variable.Primary.DOUBLE) {<NEW_LINE>double[] a = new double[maxLength];<NEW_LINE>Arrays.fill(a, v.getDoubleValue());<NEW_LINE>values[n] = new Variable(v.getName(), a);<NEW_LINE>} else if (v.getPrimary() == Variable.Primary.ARRAY) {<NEW_LINE>// inlining Arrays.copyOf to provide compatibility with Froyo<NEW_LINE>double[] a = new double[maxLength];<NEW_LINE>int i = 0;<NEW_LINE>double[<MASK><NEW_LINE>while (i < vArrayValues.length && i < maxLength) {<NEW_LINE>a[i] = vArrayValues[i];<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>while (i < maxLength) {<NEW_LINE>a[i] = 0.0;<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>values[n] = new Variable(v.getName(), a);<NEW_LINE>} else {<NEW_LINE>// Should not happen, if it does return invalid variable<NEW_LINE>return new Variable[] { new Variable("Invalid") };<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return values;<NEW_LINE>} | ] vArrayValues = v.getArrayValue(); |
131,200 | protected void run(StructuredGraph graph) {<NEW_LINE>EconomicMap<LoopBeginNode, EconomicSet<LocationIdentity>> modifiedInLoops = null;<NEW_LINE>if (graph.hasLoops()) {<NEW_LINE>modifiedInLoops = EconomicMap.create(Equivalence.IDENTITY);<NEW_LINE>ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, true, false, false);<NEW_LINE>for (Loop<?> l : cfg.getLoops()) {<NEW_LINE>HIRLoop loop = (HIRLoop) l;<NEW_LINE>processLoop(loop, modifiedInLoops);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EconomicSetNodeEventListener listener = new EconomicSetNodeEventListener(EnumSet.of(NODE_ADDED, ZERO_USAGES));<NEW_LINE>try (Graph.NodeEventScope nes = graph.trackNodeEvents(listener)) {<NEW_LINE>ReentrantNodeIterator.apply(new TornadoFloatingReadReplacement.FloatingReadClosure(modifiedInLoops, createFloatingReads, createMemoryMapNodes), graph.start(), new TornadoFloatingReadReplacement.MemoryMapImpl<MASK><NEW_LINE>}<NEW_LINE>for (Node n : removeExternallyUsedNodes(listener.getNodes())) {<NEW_LINE>if (n.isAlive() && n instanceof FloatingNode) {<NEW_LINE>n.replaceAtUsages(null);<NEW_LINE>GraphUtil.killWithUnusedFloatingInputs(n);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (createFloatingReads) {<NEW_LINE>graph.setAfterStage(StructuredGraph.StageFlag.FLOATING_READS);<NEW_LINE>}<NEW_LINE>} | (graph.start())); |
597,777 | // GEN-LAST:event_rbRegisteredLibraryItemStateChanged<NEW_LINE>private void jbBrowseActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_jbBrowseActionPerformed<NEW_LINE>JFileChooser chooser = new JFileChooser();<NEW_LINE>// NOI18N<NEW_LINE>chooser.setDialogTitle(NbBundle.getMessage(JSFConfigurationPanelVisual.class, "LBL_SelectLibraryLocation"));<NEW_LINE>chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);<NEW_LINE>chooser.setFileFilter(new FileFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean accept(File f) {<NEW_LINE>if (f.getName().endsWith(".jar") || f.isDirectory()) {<NEW_LINE>// N0I18N<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getDescription() {<NEW_LINE>// NOI18N<NEW_LINE>return NbBundle.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>chooser.setCurrentDirectory(new File(customBundleTextField.getText().trim()));<NEW_LINE>if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {<NEW_LINE>File selectedEntry = chooser.getSelectedFile();<NEW_LINE>customBundleTextField.setText(selectedEntry.getAbsolutePath());<NEW_LINE>setNewLibraryFolder();<NEW_LINE>}<NEW_LINE>} | getMessage(JSFConfigurationPanelVisual.class, "LBL_FileTypeInChooser"); |
465,370 | /*<NEW_LINE>public static boolean createWorld(MinecraftServer server, String worldKey, Long seed)<NEW_LINE>{<NEW_LINE>ResourceLocation worldId = new ResourceLocation(worldKey);<NEW_LINE>ServerLevel overWorld = server.overworld();<NEW_LINE><NEW_LINE>Set<ResourceKey<Level>> worldKeys = server.levelKeys();<NEW_LINE>for (ResourceKey<Level> worldRegistryKey : worldKeys)<NEW_LINE>{<NEW_LINE>if (worldRegistryKey.location().equals(worldId))<NEW_LINE>{<NEW_LINE>// world with this id already exists<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ServerLevelData serverWorldProperties = server.getWorldData().overworldData();<NEW_LINE>WorldGenSettings generatorOptions = server.getWorldData().worldGenSettings();<NEW_LINE>boolean bl = generatorOptions.isDebug();<NEW_LINE>long l = generatorOptions.seed();<NEW_LINE>long m = BiomeManager.obfuscateSeed(l);<NEW_LINE>List<CustomSpawner> list = List.of();<NEW_LINE>Registry<LevelStem> simpleRegistry = generatorOptions.dimensions();<NEW_LINE>LevelStem dimensionOptions = simpleRegistry.get(LevelStem.OVERWORLD);<NEW_LINE>ChunkGenerator chunkGenerator2;<NEW_LINE>Holder<DimensionType> dimensionType2;<NEW_LINE>if (dimensionOptions == null) {<NEW_LINE>dimensionType2 = server.registryAccess().registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY).getOrCreateHolder(DimensionType.OVERWORLD_LOCATION);;<NEW_LINE>chunkGenerator2 = WorldGenSettings.makeDefaultOverworld(server.registryAccess(), (new Random<MASK><NEW_LINE>} else {<NEW_LINE>dimensionType2 = dimensionOptions.typeHolder();<NEW_LINE>chunkGenerator2 = dimensionOptions.generator();<NEW_LINE>}<NEW_LINE><NEW_LINE>ResourceKey<Level> customWorld = ResourceKey.create(Registry.DIMENSION_REGISTRY, worldId);<NEW_LINE><NEW_LINE>//chunkGenerator2 = GeneratorOptions.createOverworldGenerator(server.getRegistryManager().get(Registry.BIOME_KEY), server.getRegistryManager().get(Registry.NOISE_SETTINGS_WORLDGEN), (seed==null)?l:seed);<NEW_LINE><NEW_LINE>// from world/gen/GeneratorOptions<NEW_LINE>//chunkGenerator2 = new NoiseChunkGenerator(MultiNoiseBiomeSource.createVanillaSource(server.getRegistryManager().get(Registry.BIOME_KEY), seed), seed, () -> {<NEW_LINE>// return server.getRegistryManager().get(Registry.CHUNK_GENERATOR_SETTINGS_KEY).getOrThrow(ChunkGeneratorSettings.OVERWORLD);<NEW_LINE>//});<NEW_LINE><NEW_LINE>chunkGenerator2 = new NoiseBasedChunkGenerator(<NEW_LINE>server.registryAccess().registryOrThrow(Registry.STRUCTURE_SET_REGISTRY),<NEW_LINE>server.registryAccess().registryOrThrow(Registry.NOISE_REGISTRY),<NEW_LINE>MultiNoiseBiomeSource.Preset.OVERWORLD.biomeSource(server.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)), seed,<NEW_LINE>Holder.direct(server.registryAccess().registryOrThrow(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY).getOrThrow(NoiseGeneratorSettings.OVERWORLD))<NEW_LINE>);<NEW_LINE><NEW_LINE>ServerLevel serverWorld = new ServerLevel(<NEW_LINE>server,<NEW_LINE>Util.backgroundExecutor(),<NEW_LINE>((MinecraftServerInterface) server).getCMSession(),<NEW_LINE>new DerivedLevelData(server.getWorldData(), serverWorldProperties),<NEW_LINE>customWorld,<NEW_LINE>dimensionType2,<NEW_LINE>NOOP_LISTENER,<NEW_LINE>chunkGenerator2,<NEW_LINE>bl,<NEW_LINE>(seed==null)?l:seed,<NEW_LINE>list,<NEW_LINE>false);<NEW_LINE>overWorld.getWorldBorder().addListener(new BorderChangeListener.DelegateBorderChangeListener(serverWorld.getWorldBorder()));<NEW_LINE>((MinecraftServerInterface) server).getCMWorlds().put(customWorld, serverWorld);<NEW_LINE>return true;<NEW_LINE>}*/<NEW_LINE>public static void forceChunkUpdate(BlockPos pos, ServerLevel world) {<NEW_LINE>LevelChunk worldChunk = world.getChunkSource().getChunk(pos.getX() >> 4, pos.getZ() >> 4, false);<NEW_LINE>if (worldChunk != null) {<NEW_LINE>int vd = world.getServer().getPlayerList().getViewDistance() * 16;<NEW_LINE>int vvd = vd * vd;<NEW_LINE>List<ServerPlayer> nearbyPlayers = world.getPlayers(p -> pos.distToCenterSqr(p.getX(), pos.getY(), p.getZ()) < vvd);<NEW_LINE>if (!nearbyPlayers.isEmpty()) {<NEW_LINE>// false seems to update neighbours as well.<NEW_LINE>ClientboundLevelChunkWithLightPacket packet = new ClientboundLevelChunkWithLightPacket(worldChunk, world.getLightEngine(), null, null, false);<NEW_LINE>ChunkPos chpos = new ChunkPos(pos);<NEW_LINE>nearbyPlayers.forEach(p -> p.connection.send(packet));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ()).nextLong()); |
738,368 | private void updateContainers(String type, String name, String targetKey, JSONArray updateDatas) {<NEW_LINE>JSONObject workloadSpec = (JSONObject<MASK><NEW_LINE>log.info("configmap trait parent workload {}", workloadSpec.toJSONString());<NEW_LINE>JSONArray containers;<NEW_LINE>if (workloadSpec.get("cloneSet") != null) {<NEW_LINE>JSONObject cloneSetSpec = workloadSpec.getJSONObject("cloneSet").getJSONObject("template").getJSONObject("spec");<NEW_LINE>containers = cloneSetSpec.getJSONArray(type + "s");<NEW_LINE>} else if (workloadSpec.get("advancedStatefulSet") != null) {<NEW_LINE>JSONObject advancedStatefulSetSpec = workloadSpec.getJSONObject("advancedStatefulSet").getJSONObject("template").getJSONObject("spec");<NEW_LINE>containers = advancedStatefulSetSpec.getJSONArray(type + "s");<NEW_LINE>} else if ("Deployment".equals(workloadSpec.getString("kind"))) {<NEW_LINE>containers = workloadSpec.getJSONArray(type + "s");<NEW_LINE>} else {<NEW_LINE>throw new AppException(AppErrorCode.INVALID_USER_ARGS, "not supported");<NEW_LINE>}<NEW_LINE>for (int i = 0; i < containers.size(); i++) {<NEW_LINE>JSONObject container = containers.getJSONObject(i);<NEW_LINE>if (!Objects.equals(container.getString("name"), name)) {<NEW_LINE>log.info("container name not match {} {}", container.getString("name"), name);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>container.putIfAbsent(targetKey, new JSONArray());<NEW_LINE>JSONArray target = container.getJSONArray(targetKey);<NEW_LINE>for (int j = 0; j < updateDatas.size(); j++) {<NEW_LINE>JSONObject updateData = updateDatas.getJSONObject(i);<NEW_LINE>log.info("update container {} {}", target.toJSONString(), updateData.toJSONString());<NEW_LINE>target.add(updateData);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.info("configmap trait parent workload after update {}", workloadSpec.toJSONString());<NEW_LINE>} | ) getWorkloadRef().getSpec(); |
136,992 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>try {<NEW_LINE>String str1 = request.getParameter("str1");<NEW_LINE>String str2 = request.getParameter("str2");<NEW_LINE>String str3 = request.getParameter("str3");<NEW_LINE>if (str1 != null && str2 != null && str3 != null && str1.length() > 0 && str2.length() > 0 && str3.length() > 0) {<NEW_LINE>// Create a new entity based on the incoming content<NEW_LINE>ExampleEntity entity = new ExampleEntity();<NEW_LINE>entity.setStr1(str1);<NEW_LINE>entity.setStr2(str2);<NEW_LINE>entity.setStr3(str3);<NEW_LINE>mas.addEntity(entity);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>response.getWriter().println("Something went wrong. Caught exception " + e);<NEW_LINE>response<MASK><NEW_LINE>}<NEW_LINE>doGet(request, response);<NEW_LINE>} | .getWriter().flush(); |
614,181 | void persistLocalCacheFile(File baseDir, String namespace) {<NEW_LINE>if (baseDir == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File file = assembleLocalCacheFile(baseDir, namespace);<NEW_LINE>OutputStream out = null;<NEW_LINE>Transaction transaction = <MASK><NEW_LINE>transaction.addData("LocalConfigFile", file.getAbsolutePath());<NEW_LINE>try {<NEW_LINE>out = new FileOutputStream(file);<NEW_LINE>m_fileProperties.store(out, "Persisted by DefaultConfig");<NEW_LINE>transaction.setStatus(Transaction.SUCCESS);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>ApolloConfigException exception = new ApolloConfigException(String.format("Persist local cache file %s failed", file.getAbsolutePath()), ex);<NEW_LINE>Tracer.logError(exception);<NEW_LINE>transaction.setStatus(exception);<NEW_LINE>logger.warn("Persist local cache file {} failed, reason: {}.", file.getAbsolutePath(), ExceptionUtil.getDetailMessage(ex));<NEW_LINE>} finally {<NEW_LINE>if (out != null) {<NEW_LINE>try {<NEW_LINE>out.close();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>}<NEW_LINE>transaction.complete();<NEW_LINE>}<NEW_LINE>} | Tracer.newTransaction("Apollo.ConfigService", "persistLocalConfigFile"); |
526,486 | private void generateAlias(GwtLocale locale, GwtLocale parent) throws IOException {<NEW_LINE>System.out.println("Generating alias " + locale);<NEW_LINE>String suffix;<NEW_LINE>if (parent.isDefault()) {<NEW_LINE>suffix = "";<NEW_LINE>} else {<NEW_LINE>suffix = "_" + parent.getAsString();<NEW_LINE>}<NEW_LINE>String packageName = "com.google.gwt.i18n.client.impl.cldr";<NEW_LINE>String className <MASK><NEW_LINE>PrintWriter out = null;<NEW_LINE>try {<NEW_LINE>out = createClassSource(packageName, className);<NEW_LINE>out.println("/**");<NEW_LINE>out.println(" * Locale \"" + locale + "\" is an alias for \"" + parent + "\".");<NEW_LINE>out.println(" */");<NEW_LINE>out.println("public class " + className + " extends DateTimeFormatInfoImpl" + suffix + " {");<NEW_LINE>out.println("}");<NEW_LINE>} finally {<NEW_LINE>if (out != null) {<NEW_LINE>out.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = "DateTimeFormatInfoImpl_" + locale.getAsString(); |
1,081,737 | private void drawYAxis() {<NEW_LINE>long yInc = findScale(maxY - minY);<NEW_LINE>minYQ = (minY / yInc) * yInc;<NEW_LINE>maxYQ = (1 + (maxY / yInc)) * yInc;<NEW_LINE>long gridY = minYQ;<NEW_LINE>int maxYLabelWidth = StringUtil.formatThousands(Long.toString(maxYQ)).length();<NEW_LINE>graphGapLeft = Math.max(40.5, maxYLabelWidth * 9);<NEW_LINE>double yLabelX = graphGapLeft - (1 + maxYLabelWidth) * 8;<NEW_LINE>while (gridY <= maxYQ) {<NEW_LINE>if (gridY >= minYQ) {<NEW_LINE>double <MASK><NEW_LINE>setStrokeForAxis();<NEW_LINE>gc.strokeLine(fix(graphGapLeft), fix(y), fix(graphGapLeft + chartWidth), fix(y));<NEW_LINE>setStrokeForText();<NEW_LINE>gc.fillText(StringUtil.formatThousands(Long.toString(gridY)), fix(yLabelX), fix(y - getStringHeight() / 2));<NEW_LINE>}<NEW_LINE>gridY += yInc;<NEW_LINE>}<NEW_LINE>} | y = graphGapTop + normaliseY(gridY); |
354,301 | public void propertyChange(PropertyChangeEvent evt) {<NEW_LINE>if (evt.getSource() == lb) {<NEW_LINE>handleURL(lb.getURL());<NEW_LINE>} else if (DataObject.PROP_PRIMARY_FILE.equals(evt.getPropertyName())) {<NEW_LINE>FileObject newFO = ((DataObject) evt.getSource()).getPrimaryFile();<NEW_LINE>boolean addBack = false;<NEW_LINE>synchronized (this) {<NEW_LINE>fo = newFO;<NEW_LINE>if (fileWasDeleted) {<NEW_LINE>// Add back<NEW_LINE>addBack = true;<NEW_LINE>fileWasDeleted = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lb.setURL(newFO.<MASK><NEW_LINE>if (addBack) {<NEW_LINE>try {<NEW_LINE>preferedHandler.set(this);<NEW_LINE>DebuggerManager.getDebuggerManager().addBreakpoint(lb);<NEW_LINE>lb.addPropertyChangeListener(LineBreakpoint.PROP_URL, this);<NEW_LINE>} finally {<NEW_LINE>preferedHandler.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | toURL().toString()); |
1,273,744 | private void renderPillar(BannerBlockEntity bannerBlockEntity, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {<NEW_LINE>matrixStack.push();<NEW_LINE>BlockState blockState = bannerBlockEntity.getCachedState();<NEW_LINE>matrixStack.translate(0.5D, 0.5D, 0.5D);<NEW_LINE>float h = (float) (-(Integer) blockState.get(BannerBlock.ROTATION) * 360) / 16.0F;<NEW_LINE>matrixStack.multiply(Vec3f<MASK><NEW_LINE>matrixStack.push();<NEW_LINE>matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F);<NEW_LINE>VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid);<NEW_LINE>this.pillar.render(matrixStack, vertexConsumer, i, j);<NEW_LINE>matrixStack.pop();<NEW_LINE>matrixStack.pop();<NEW_LINE>} | .POSITIVE_Y.getDegreesQuaternion(h)); |
773,578 | static String printTemplate(Template template) {<NEW_LINE>int[] columnWidths = new int[] { TABLE_WIDTH };<NEW_LINE>List<String> templateProperty = new ArrayList<>();<NEW_LINE>templateProperty.add(template.getUID());<NEW_LINE>String titleRow = Utils.getRow(columnWidths, templateProperty);<NEW_LINE>List<String> templateContent = new ArrayList<>();<NEW_LINE>columnWidths = new int[] { COLUMN_PROPERTY, COLUMN_PROPERTY_VALUE };<NEW_LINE>templateProperty.set(0, UID);<NEW_LINE>templateProperty.add(template.getUID());<NEW_LINE>templateContent.add(Utils.getRow(columnWidths, templateProperty));<NEW_LINE>if (template.getLabel() != null) {<NEW_LINE>templateProperty.set(0, LABEL);<NEW_LINE>templateProperty.set(1, template.getLabel());<NEW_LINE>templateContent.add(Utils.getRow(columnWidths, templateProperty));<NEW_LINE>}<NEW_LINE>if (template.getDescription() != null) {<NEW_LINE>templateProperty.set(0, DESCRIPTION);<NEW_LINE>templateProperty.set(1, template.getDescription());<NEW_LINE>templateContent.add(Utils.getRow(columnWidths, templateProperty));<NEW_LINE>}<NEW_LINE>templateProperty.set(0, VISIBILITY);<NEW_LINE>templateProperty.set(1, template.getVisibility().toString());<NEW_LINE>templateContent.add(Utils.getRow(columnWidths, templateProperty));<NEW_LINE>templateProperty.set(0, TAGS);<NEW_LINE>templateProperty.set(1, getTagsRecord(template.getTags()));<NEW_LINE>templateContent.add(Utils<MASK><NEW_LINE>if (template instanceof RuleTemplate) {<NEW_LINE>templateContent.addAll(collectRecords(columnWidths, CONFIGURATION_DESCRIPTIONS, getConfigurationDescriptionRecords(((RuleTemplate) template).getConfigurationDescriptions())));<NEW_LINE>templateContent.addAll(collectRecords(columnWidths, TRIGGERS, ((RuleTemplate) template).getTriggers()));<NEW_LINE>templateContent.addAll(collectRecords(columnWidths, CONDITIONS, ((RuleTemplate) template).getConditions()));<NEW_LINE>templateContent.addAll(collectRecords(columnWidths, ACTIONS, ((RuleTemplate) template).getActions()));<NEW_LINE>}<NEW_LINE>return Utils.getTableContent(TABLE_WIDTH, columnWidths, templateContent, titleRow);<NEW_LINE>} | .getRow(columnWidths, templateProperty)); |
953,432 | public RubyString inspect() {<NEW_LINE>if (str == null)<NEW_LINE>return (RubyString) anyToString();<NEW_LINE>Ruby runtime = metaClass.runtime;<NEW_LINE>RubyString result = runtime.newString();<NEW_LINE>result.cat((byte) '#').cat((byte) '<');<NEW_LINE>result.append(getMetaClass().getRealClass().to_s());<NEW_LINE>NameEntry[] names = new NameEntry[regs == null ? 1 : regs.numRegs];<NEW_LINE>final Regex pattern = getPattern();<NEW_LINE>for (Iterator<NameEntry> i = pattern.namedBackrefIterator(); i.hasNext(); ) {<NEW_LINE><MASK><NEW_LINE>for (int num : e.getBackRefs()) names[num] = e;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < names.length; i++) {<NEW_LINE>result.cat((byte) ' ');<NEW_LINE>if (i > 0) {<NEW_LINE>NameEntry e = names[i];<NEW_LINE>if (e != null) {<NEW_LINE>result.cat(e.name, e.nameP, e.nameEnd - e.nameP);<NEW_LINE>} else {<NEW_LINE>result.cat((byte) ('0' + i));<NEW_LINE>}<NEW_LINE>result.cat((byte) ':');<NEW_LINE>}<NEW_LINE>IRubyObject v = RubyRegexp.nth_match(i, this);<NEW_LINE>if (v.isNil()) {<NEW_LINE>// "nil"<NEW_LINE>result.cat(RubyNil.nilBytes);<NEW_LINE>} else {<NEW_LINE>result.append(((RubyString) v).inspect(runtime));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result.cat((byte) '>');<NEW_LINE>} | NameEntry e = i.next(); |
1,220,900 | private List<File> findResourcesFromExportTxt(final File contentsDir) {<NEW_LINE>final File exportTxt = new File(contentsDir, "export.txt");<NEW_LINE>if (!exportTxt.exists()) {<NEW_LINE>log(<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final Map<String, String[]> exportTable;<NEW_LINE>try {<NEW_LINE>exportTable = parseExportTxt(exportTxt);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>log("Couldn't parse export.txt: " + e.getMessage());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final String[] resourceNames;<NEW_LINE>// Check from most-specific to least-specific:<NEW_LINE>if (exportTable.containsKey("application." + PLATFORM + BITS)) {<NEW_LINE>log("Found 'application." + PLATFORM + BITS + "' in export.txt");<NEW_LINE>resourceNames = exportTable.get("application." + PLATFORM + BITS);<NEW_LINE>} else if (exportTable.containsKey("application." + PLATFORM)) {<NEW_LINE>log("Found 'application." + PLATFORM + "' in export.txt");<NEW_LINE>resourceNames = exportTable.get("application." + PLATFORM);<NEW_LINE>} else if (exportTable.containsKey("application")) {<NEW_LINE>log("Found 'application' in export.txt");<NEW_LINE>resourceNames = exportTable.get("application");<NEW_LINE>} else {<NEW_LINE>log("No matching platform in " + exportTxt.getAbsolutePath());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final List<File> resources = new ArrayList<>();<NEW_LINE>for (final String resourceName : resourceNames) {<NEW_LINE>final File resource = new File(contentsDir, resourceName).getAbsoluteFile();<NEW_LINE>if (resource.exists()) {<NEW_LINE>resources.add(resource);<NEW_LINE>} else {<NEW_LINE>log(resourceName + " is mentioned in " + exportTxt.getAbsolutePath() + "but doesn't actually exist. Moving on.");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return resources;<NEW_LINE>} | "No export.txt in " + contentsDir.getAbsolutePath()); |
1,489,968 | public static void sample_IU16(final GrayU16 input, final FastAccess<Point2D_I32> sample, final InterleavedU16 output, @Nullable ImageBorder_S32<GrayU16> border, @Nullable DogArray_I32 workSpace) {<NEW_LINE>// Compute the number of 16-bit values that are needed to store<NEW_LINE>int numBlocks = BoofMiscOps.bitsToWords(sample.size, 16);<NEW_LINE>output.reshape(input.width, input.height, numBlocks);<NEW_LINE>// Precompute the offset in array indexes for the sample points<NEW_LINE>if (workSpace == null)<NEW_LINE>workSpace = new DogArray_I32();<NEW_LINE>int borderRadius = computeRadiusWorkspace(input, sample, workSpace);<NEW_LINE>if (BoofConcurrency.USE_CONCURRENT) {<NEW_LINE>ImplCensusTransformInner_MT.sample_IU16(<MASK><NEW_LINE>} else {<NEW_LINE>ImplCensusTransformInner.sample_IU16(input, borderRadius, workSpace, output);<NEW_LINE>}<NEW_LINE>if (border != null) {<NEW_LINE>border.setImage(input);<NEW_LINE>ImplCensusTransformBorder.sample_IU16(border, borderRadius, sample, output);<NEW_LINE>}<NEW_LINE>} | input, borderRadius, workSpace, output); |
527,023 | public void uploadCodeSnippets() {<NEW_LINE>// BEGIN: com.azure.storage.file.datalake.DataLakeFileClient.upload#InputStream-long<NEW_LINE>try {<NEW_LINE>client.upload(data, length);<NEW_LINE>System.out.println("Upload from file succeeded");<NEW_LINE>} catch (UncheckedIOException ex) {<NEW_LINE>System.err.printf("Failed to upload from file %s%n", ex.getMessage());<NEW_LINE>}<NEW_LINE>// END: com.azure.storage.file.datalake.DataLakeFileClient.upload#InputStream-long<NEW_LINE>// BEGIN: com.azure.storage.file.datalake.DataLakeFileClient.upload#InputStream-long-boolean<NEW_LINE>try {<NEW_LINE>boolean overwrite = false;<NEW_LINE>client.upload(data, length, overwrite);<NEW_LINE>System.out.println("Upload from file succeeded");<NEW_LINE>} catch (UncheckedIOException ex) {<NEW_LINE>System.err.printf("Failed to upload from file %s%n", ex.getMessage());<NEW_LINE>}<NEW_LINE>// END: com.azure.storage.file.datalake.DataLakeFileClient.upload#InputStream-long-boolean<NEW_LINE>// BEGIN: com.azure.storage.file.datalake.DataLakeFileClient.uploadWithResponse#FileParallelUploadOptions-Duration-Context<NEW_LINE>PathHttpHeaders headers = new PathHttpHeaders().setContentMd5("data".getBytes(StandardCharsets.UTF_8)).setContentLanguage("en-US").setContentType("binary");<NEW_LINE>Map<String, String> metadata = Collections.singletonMap("metadata", "value");<NEW_LINE>DataLakeRequestConditions requestConditions = new DataLakeRequestConditions().setLeaseId(leaseId).setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));<NEW_LINE>// 100 MB;<NEW_LINE>Long blockSize = 100L * 1024L * 1024L;<NEW_LINE>ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize);<NEW_LINE>try {<NEW_LINE>client.uploadWithResponse(new FileParallelUploadOptions(data, length).setParallelTransferOptions(parallelTransferOptions).setHeaders(headers).setMetadata(metadata).setRequestConditions(requestConditions).setPermissions("permissions").setUmask("umask"), timeout, new Context("key", "value"));<NEW_LINE>System.out.println("Upload from file succeeded");<NEW_LINE>} catch (UncheckedIOException ex) {<NEW_LINE>System.err.printf(<MASK><NEW_LINE>}<NEW_LINE>// END: com.azure.storage.file.datalake.DataLakeFileClient.uploadWithResponse#FileParallelUploadOptions-Duration-Context<NEW_LINE>} | "Failed to upload from file %s%n", ex.getMessage()); |
1,713,782 | protected Stream<HoodieClusteringGroup> buildClusteringGroupsForPartition(String partitionPath, List<FileSlice> fileSlices) {<NEW_LINE>List<Pair<List<FileSlice>, Integer>> fileSliceGroups = new ArrayList<>();<NEW_LINE>List<FileSlice> currentGroup = new ArrayList<>();<NEW_LINE>long totalSizeSoFar = 0;<NEW_LINE>HoodieWriteConfig writeConfig = getWriteConfig();<NEW_LINE>for (FileSlice currentSlice : fileSlices) {<NEW_LINE>// assume each filegroup size is ~= parquet.max.file.size<NEW_LINE>totalSizeSoFar += currentSlice.getBaseFile().isPresent() ? currentSlice.getBaseFile().get().getFileSize() : writeConfig.getParquetMaxFileSize();<NEW_LINE>// check if max size is reached and create new group, if needed.<NEW_LINE>if (totalSizeSoFar >= writeConfig.getClusteringMaxBytesInGroup() && !currentGroup.isEmpty()) {<NEW_LINE>int numOutputGroups = getNumberOfOutputFileGroups(totalSizeSoFar, writeConfig.getClusteringTargetFileMaxBytes());<NEW_LINE>LOG.info("Adding one clustering group " + totalSizeSoFar + " max bytes: " + writeConfig.getClusteringMaxBytesInGroup() + " num input slices: " + currentGroup.size() + " output groups: " + numOutputGroups);<NEW_LINE>fileSliceGroups.add(Pair<MASK><NEW_LINE>currentGroup = new ArrayList<>();<NEW_LINE>totalSizeSoFar = 0;<NEW_LINE>}<NEW_LINE>currentGroup.add(currentSlice);<NEW_LINE>// totalSizeSoFar could be 0 when new group was created in the previous conditional block.<NEW_LINE>// reset to the size of current slice, otherwise the number of output file group will become 0 even though current slice is present.<NEW_LINE>if (totalSizeSoFar == 0) {<NEW_LINE>totalSizeSoFar += currentSlice.getBaseFile().isPresent() ? currentSlice.getBaseFile().get().getFileSize() : writeConfig.getParquetMaxFileSize();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!currentGroup.isEmpty()) {<NEW_LINE>int numOutputGroups = getNumberOfOutputFileGroups(totalSizeSoFar, writeConfig.getClusteringTargetFileMaxBytes());<NEW_LINE>LOG.info("Adding final clustering group " + totalSizeSoFar + " max bytes: " + writeConfig.getClusteringMaxBytesInGroup() + " num input slices: " + currentGroup.size() + " output groups: " + numOutputGroups);<NEW_LINE>fileSliceGroups.add(Pair.of(currentGroup, numOutputGroups));<NEW_LINE>}<NEW_LINE>return fileSliceGroups.stream().map(fileSliceGroup -> HoodieClusteringGroup.newBuilder().setSlices(getFileSliceInfo(fileSliceGroup.getLeft())).setNumOutputFileGroups(fileSliceGroup.getRight()).setMetrics(buildMetrics(fileSliceGroup.getLeft())).build());<NEW_LINE>} | .of(currentGroup, numOutputGroups)); |
1,768,806 | public static String generateUnformattedCptJsonSchema() {<NEW_LINE>List<Map<String, String>> anyStringList = new ArrayList<>();<NEW_LINE>Map<String, String> stringMap = new HashMap<>();<NEW_LINE>stringMap.put("type", "string");<NEW_LINE>anyStringList.add(stringMap);<NEW_LINE>Map<String, String> <MASK><NEW_LINE>nullMap.put("type", "null");<NEW_LINE>anyStringList.add(nullMap);<NEW_LINE>Map<String, Object> anyMap = new LinkedHashMap<>();<NEW_LINE>anyMap.put("anyOf", anyStringList);<NEW_LINE>Map<String, Object> patternMap = new LinkedHashMap<>();<NEW_LINE>patternMap.put("^.*$", anyMap);<NEW_LINE>Map<String, Object> cptSchemaMap = new LinkedHashMap<>();<NEW_LINE>cptSchemaMap.put(JsonSchemaConstant.SCHEMA_KEY, JsonSchemaConstant.SCHEMA_VALUE);<NEW_LINE>cptSchemaMap.put(JsonSchemaConstant.TYPE_KEY, JsonSchemaConstant.DATA_TYPE_OBJECT);<NEW_LINE>cptSchemaMap.put("title", "Unformatted CPT");<NEW_LINE>cptSchemaMap.put("description", "Universal unformatted CPT template");<NEW_LINE>cptSchemaMap.put("patternProperties", patternMap);<NEW_LINE>return DataToolUtils.objToJsonStrWithNoPretty(cptSchemaMap);<NEW_LINE>} | nullMap = new HashMap<>(); |
1,352,568 | // checking for existing version of the plugin<NEW_LINE>private void verifyPluginName(Path pluginPath, String pluginName) throws UserException, IOException {<NEW_LINE>// don't let user install plugin conflicting with module...<NEW_LINE>// they might be unavoidably in maven central and are packaged up the same way)<NEW_LINE>if (MODULES.contains(pluginName)) {<NEW_LINE>throw new UserException(ExitCodes.USAGE, "plugin '" + pluginName + "' cannot be installed as a plugin, it is a system module");<NEW_LINE>}<NEW_LINE>// scan all the installed plugins to see if the plugin being installed already exists<NEW_LINE>// either with the plugin name or a custom folder name<NEW_LINE>Path destination = PluginHelper.verifyIfPluginExists(pluginPath, pluginName);<NEW_LINE>if (Files.exists(destination)) {<NEW_LINE>final String message = String.format(Locale.ROOT, <MASK><NEW_LINE>throw new UserException(PLUGIN_EXISTS, message);<NEW_LINE>}<NEW_LINE>} | "plugin directory [%s] already exists; if you need to update the plugin, " + "uninstall it first using command 'remove %s'", destination, pluginName); |
1,852,971 | public void run() {<NEW_LINE>TcpProxy tcp = TcpProxy.getTcpProxy(serverId);<NEW_LINE>final List<Long> timeList = new ArrayList<Long>();<NEW_LINE>try {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE>param.put("objName", objName);<NEW_LINE>long <MASK><NEW_LINE>param.put("from", from);<NEW_LINE>param.put("to", from + DateUtil.MILLIS_PER_DAY - 1);<NEW_LINE>tcp.process(RequestCmd.GET_STACK_INDEX, param, new INetReader() {<NEW_LINE><NEW_LINE>public void process(DataInputX in) throws IOException {<NEW_LINE>long time = in.readLong();<NEW_LINE>timeList.add(new Long(time));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(tcp);<NEW_LINE>}<NEW_LINE>Collections.sort(timeList);<NEW_LINE>ExUtil.exec(table, new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>for (int i = 0; i < timeList.size(); i++) {<NEW_LINE>TableItem item = new TableItem(table, SWT.NONE);<NEW_LINE>item.setText(0, String.valueOf(i + 1));<NEW_LINE>long time = timeList.get(i).longValue();<NEW_LINE>item.setText(1, DateUtil.format(time, "yyyy-MM-dd HH:mm:ss"));<NEW_LINE>item.setData(time);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | from = DateUtil.yyyymmdd(date); |
1,287,671 | public MiniAccumuloConfigImpl useExistingInstance(File accumuloProps, File hadoopConfDir) throws IOException {<NEW_LINE>if (existingInstance != null && !existingInstance) {<NEW_LINE>throw new UnsupportedOperationException("Cannot set to useExistingInstance after specifying config/zookeeper");<NEW_LINE>}<NEW_LINE>this.existingInstance = Boolean.TRUE;<NEW_LINE>System.setProperty("accumulo.properties", "accumulo.properties");<NEW_LINE>this.hadoopConfDir = hadoopConfDir;<NEW_LINE>hadoopConf = new Configuration(false);<NEW_LINE>accumuloConf = SiteConfiguration.fromFile(accumuloProps).build();<NEW_LINE>File coreSite <MASK><NEW_LINE>File hdfsSite = new File(hadoopConfDir, "hdfs-site.xml");<NEW_LINE>try {<NEW_LINE>hadoopConf.addResource(coreSite.toURI().toURL());<NEW_LINE>hadoopConf.addResource(hdfsSite.toURI().toURL());<NEW_LINE>} catch (MalformedURLException e1) {<NEW_LINE>throw e1;<NEW_LINE>}<NEW_LINE>Map<String, String> siteConfigMap = new HashMap<>();<NEW_LINE>for (Entry<String, String> e : accumuloConf) {<NEW_LINE>siteConfigMap.put(e.getKey(), e.getValue());<NEW_LINE>}<NEW_LINE>_setSiteConfig(siteConfigMap);<NEW_LINE>return this;<NEW_LINE>} | = new File(hadoopConfDir, "core-site.xml"); |
877,082 | public JsonNodeContainer evaluate(JsonNodeContainer contextNode) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("---> evaluating expression [" + expression + "] on a node with (size: " + contextNode.getSize() + ", cSize: " + contextNode.getContainerSize() + ")");<NEW_LINE>}<NEW_LINE>JsonNodeContainer result = new JsonNodeContainer();<NEW_LINE>switch(expression.getDirection()) {<NEW_LINE>case DOWN:<NEW_LINE>Integer start = getSliceStart(contextNode.getContainerSize());<NEW_LINE>if (start >= contextNode.getContainerSize()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Integer end = getSliceEnd(contextNode.getContainerSize());<NEW_LINE>if (end < 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("start: " + start + ", end: " + end);<NEW_LINE>}<NEW_LINE>List<JRJsonNode> containerNodes = contextNode.getContainerNodes();<NEW_LINE>for (int i = start; i < end; i++) {<NEW_LINE>JRJsonNode nodeAtIndex = containerNodes.get(i);<NEW_LINE>if (applyFilter(nodeAtIndex)) {<NEW_LINE>result.add(nodeAtIndex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ANYWHERE_DOWN:<NEW_LINE>for (JRJsonNode node : contextNode.getContainerNodes()) {<NEW_LINE>result<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (result.getSize() > 0) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | .addNodes(goAnywhereDown(node)); |
1,699,119 | private boolean isSQLStartLogicMatches(final Workflow workflow, final PO document) {<NEW_LINE>String logic = workflow.getDocValueWorkflowTriggerLogic();<NEW_LINE>// "SQL="<NEW_LINE>logic = logic.substring(4);<NEW_LINE>//<NEW_LINE>final String tableName = document.get_TableName();<NEW_LINE>final String[] keyColumns = document.get_KeyColumns();<NEW_LINE>if (keyColumns.length != 1) {<NEW_LINE>log.error("Tables with more then one key column not supported - " + tableName + " = " + keyColumns.length);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final String keyColumn = keyColumns[0];<NEW_LINE>final StringBuilder sql = // #1<NEW_LINE>new StringBuilder("SELECT ").append(keyColumn).append(" FROM ").append(tableName).// #1<NEW_LINE>append(" WHERE AD_Client_ID=? AND ").append(// #2<NEW_LINE>keyColumn).// #2<NEW_LINE>append("=? AND ").append(// Duplicate Open Workflow test<NEW_LINE>logic).append(// #3<NEW_LINE>" AND NOT EXISTS (SELECT 1 FROM AD_WF_Process wfp ").// #3<NEW_LINE>append("WHERE wfp.AD_Table_ID=? AND wfp.Record_ID=").append(tableName).append(".").append(// #4<NEW_LINE>keyColumn).// #4<NEW_LINE>append(" AND wfp.AD_Workflow_ID=?").append(" AND SUBSTR(wfp.WFState,1,1)='O')");<NEW_LINE>final Object[] sqlParams = new Object[] { workflow.getClientId(), document.get_ID(), document.get_Table_ID(), workflow.getId() };<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql.toString(<MASK><NEW_LINE>DB.setParameters(pstmt, sqlParams);<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>return rs.next();<NEW_LINE>} catch (final Exception ex) {<NEW_LINE>throw new DBException(ex, sql, sqlParams);<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>}<NEW_LINE>} | ), document.get_TrxName()); |
1,811,456 | public void process(T image) {<NEW_LINE>Objects.requireNonNull(norm_to_pixel, "You must set norm_to_pixel first");<NEW_LINE>BoofMiscOps.checkTrue(width != 0 && height != 0, "You must specify width and height");<NEW_LINE>frameID++;<NEW_LINE>observedID.clear();<NEW_LINE>dropped.clear();<NEW_LINE>spawned.clear();<NEW_LINE>spawnable.reset();<NEW_LINE>for (int cloudIdx = 0; cloudIdx < cloud.size(); cloudIdx++) {<NEW_LINE>Point3D_F64 X = cloud.get(cloudIdx);<NEW_LINE><MASK><NEW_LINE>if (viewX.z <= 0.0)<NEW_LINE>continue;<NEW_LINE>norm_to_pixel.compute(viewX.x / viewX.z, viewX.y / viewX.z, pixel);<NEW_LINE>if (!BoofMiscOps.isInside(width, height, pixel.x, pixel.y))<NEW_LINE>continue;<NEW_LINE>if (cloudIdx_to_id.containsKey(cloudIdx)) {<NEW_LINE>long id = cloudIdx_to_id.get(cloudIdx);<NEW_LINE>PointTrack track = id_to_track.get(id);<NEW_LINE>// if it has been observed twice, that's a bug<NEW_LINE>BoofMiscOps.checkTrue(observedID.add(id));<NEW_LINE>// Save the observed pixel coordinate<NEW_LINE>track.pixel.setTo(pixel);<NEW_LINE>track.lastSeenFrameID = frameID;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Mark this point as a potential point that can be spawned into a new track<NEW_LINE>spawnable.grow().setTo(cloudIdx, pixel);<NEW_LINE>}<NEW_LINE>// Drop tracks which have not been observed.<NEW_LINE>dropUnobserved();<NEW_LINE>// System.out.println("active.size="+activeTracks.size+" dropped.size="+dropped.size()+" totalTracks="+totalTracks);<NEW_LINE>} | world_to_view.transform(X, viewX); |
362,989 | public TargetDetails translateDropTargetDetails(Map<String, Object> clientVariables) {<NEW_LINE>Map<String, Object> serverVariables = new HashMap<String, Object>();<NEW_LINE>if (clientVariables.containsKey("dropSlotIndex")) {<NEW_LINE>int slotIndex = (Integer) clientVariables.get("dropSlotIndex");<NEW_LINE>int dayIndex = (Integer) clientVariables.get("dropDayIndex");<NEW_LINE>currentCalendar.setTime(getStartOfDay(currentCalendar, startDate));<NEW_LINE>currentCalendar.add(java.util.Calendar.DATE, dayIndex);<NEW_LINE>// change this if slot length is modified<NEW_LINE>currentCalendar.add(java.util.Calendar.MINUTE, slotIndex * 30);<NEW_LINE>serverVariables.put("dropTime", currentCalendar.getTime());<NEW_LINE>} else {<NEW_LINE>int dayIndex = (Integer) clientVariables.get("dropDayIndex");<NEW_LINE>currentCalendar.setTime(expandStartDate(startDate, true));<NEW_LINE>currentCalendar.add(java.util.Calendar.DATE, dayIndex);<NEW_LINE>serverVariables.put("dropDay", currentCalendar.getTime());<NEW_LINE>}<NEW_LINE>serverVariables.put("mouseEvent", clientVariables.get("mouseEvent"));<NEW_LINE>CalendarTargetDetails td = new CalendarTargetDetails(serverVariables, this);<NEW_LINE>td.setHasDropTime<MASK><NEW_LINE>return td;<NEW_LINE>} | (clientVariables.containsKey("dropSlotIndex")); |
116,301 | private boolean areImplicitInputsUpToDate(ImplicitInputsCapturingInstantiator serviceRegistry, KEY key, ConfigurableRules<DETAILS> rules, CachedEntry<RESULT> entry) {<NEW_LINE>for (Map.Entry<String, Collection<ImplicitInputRecord<?, ?>>> implicitEntry : entry.getImplicits().asMap().entrySet()) {<NEW_LINE>String serviceName = implicitEntry.getKey();<NEW_LINE>ImplicitInputsProvidingService<Object, Object, ?> provider = Cast.uncheckedCast(serviceRegistry.findInputCapturingServiceByName(serviceName));<NEW_LINE>for (ImplicitInputRecord<?, ?> list : implicitEntry.getValue()) {<NEW_LINE>if (!provider.isUpToDate(list.getInput(), list.getOutput())) {<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("Invalidating result for rule {} and key {} in cache because implicit input provided by service {} changed", rules, <MASK><NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | key, provider.getClass()); |
1,500,977 | public void marshall(Job job, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (job == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(job.getAccelerationSettings(), ACCELERATIONSETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getAccelerationStatus(), ACCELERATIONSTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getArn(), ARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getBillingTagsSource(), BILLINGTAGSSOURCE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getCreatedAt(), CREATEDAT_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getCurrentPhase(), CURRENTPHASE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getErrorCode(), ERRORCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getErrorMessage(), ERRORMESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getHopDestinations(), HOPDESTINATIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getJobPercentComplete(), JOBPERCENTCOMPLETE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getJobTemplate(), JOBTEMPLATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getMessages(), MESSAGES_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getOutputGroupDetails(), OUTPUTGROUPDETAILS_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getPriority(), PRIORITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getQueue(), QUEUE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getQueueTransitions(), QUEUETRANSITIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getRetryCount(), RETRYCOUNT_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getRole(), ROLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getSettings(), SETTINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getSimulateReservedQueue(), SIMULATERESERVEDQUEUE_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(job.getStatusUpdateInterval(), STATUSUPDATEINTERVAL_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(job.getUserMetadata(), USERMETADATA_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | job.getTiming(), TIMING_BINDING); |
411 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {<NEW_LINE>final int width = getMeasuredWidth();<NEW_LINE>final int height = getMeasuredHeight();<NEW_LINE>ResourceHelper helper = new ResourceHelper(getContext(), "com.klinker.android.twitter");<NEW_LINE>if (Build.VERSION.SDK_INT > 18 && AppSettings.getInstance(getContext()).uiExtras && (getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE || helper.getBoolean("isTablet")) && !MainActivity.isPopup) {<NEW_LINE>// action bar plus the status bar<NEW_LINE>translation = Utils.getStatusBarHeight(getContext()) + Utils.getActionBarHeight(getContext());<NEW_LINE>} else {<NEW_LINE>// just the action bar<NEW_LINE>translation = Utils.getActionBarHeight(getContext());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>int immersive = android.provider.Settings.System.getInt(getContext().getContentResolver(), "immersive_mode");<NEW_LINE>if (immersive == 1) {<NEW_LINE>mImmersive = true;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>statusTranslation = Utils.getStatusBarHeight(getContext());<NEW_LINE>actionBarTranslation = Utils.getActionBarHeight(getContext());<NEW_LINE>mProgressBar.setBounds(0, 0, width, mProgressBarHeight);<NEW_LINE>if (getChildCount() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final View child = getChildAt(0);<NEW_LINE>final int childLeft = getPaddingLeft();<NEW_LINE>final <MASK><NEW_LINE>final int childWidth = width - getPaddingLeft() - getPaddingRight();<NEW_LINE>final int childHeight = height - getPaddingTop() - getPaddingBottom();<NEW_LINE>child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);<NEW_LINE>} | int childTop = mCurrentTargetOffsetTop + getPaddingTop(); |
1,332,261 | public void withdrawReward(byte[] address) {<NEW_LINE>if (!dynamicPropertiesStore.allowChangeDelegation()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AccountCapsule accountCapsule = accountStore.get(address);<NEW_LINE>long beginCycle = delegationStore.getBeginCycle(address);<NEW_LINE>long endCycle = delegationStore.getEndCycle(address);<NEW_LINE>long currentCycle = dynamicPropertiesStore.getCurrentCycleNumber();<NEW_LINE>long reward = 0;<NEW_LINE>if (beginCycle > currentCycle || accountCapsule == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (beginCycle == currentCycle) {<NEW_LINE>AccountCapsule account = delegationStore.getAccountVote(beginCycle, address);<NEW_LINE>if (account != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// withdraw the latest cycle reward<NEW_LINE>if (beginCycle + 1 == endCycle && beginCycle < currentCycle) {<NEW_LINE>AccountCapsule account = delegationStore.getAccountVote(beginCycle, address);<NEW_LINE>if (account != null) {<NEW_LINE>reward = computeReward(beginCycle, endCycle, account);<NEW_LINE>adjustAllowance(address, reward);<NEW_LINE>reward = 0;<NEW_LINE>logger.info("latest cycle reward {},{}", beginCycle, account.getVotesList());<NEW_LINE>}<NEW_LINE>beginCycle += 1;<NEW_LINE>}<NEW_LINE>//<NEW_LINE>endCycle = currentCycle;<NEW_LINE>if (CollectionUtils.isEmpty(accountCapsule.getVotesList())) {<NEW_LINE>delegationStore.<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (beginCycle < endCycle) {<NEW_LINE>reward += computeReward(beginCycle, endCycle, accountCapsule);<NEW_LINE>adjustAllowance(address, reward);<NEW_LINE>}<NEW_LINE>delegationStore.setBeginCycle(address, endCycle);<NEW_LINE>delegationStore.setEndCycle(address, endCycle + 1);<NEW_LINE>delegationStore.setAccountVote(endCycle, address, accountCapsule);<NEW_LINE>logger.info("adjust {} allowance {}, now currentCycle {}, beginCycle {}, endCycle {}, " + "account vote {},", Hex.toHexString(address), reward, currentCycle, beginCycle, endCycle, accountCapsule.getVotesList());<NEW_LINE>} | setBeginCycle(address, endCycle + 1); |
295,385 | protected final Size computeCaptureSize(@NonNull Mode mode) {<NEW_LINE>// We want to pass stuff into the REF_VIEW reference, not the sensor one.<NEW_LINE>// This is already managed by CameraOptions, so we just flip again at the end.<NEW_LINE>boolean flip = getAngles().flip(Reference.SENSOR, Reference.VIEW);<NEW_LINE>SizeSelector selector;<NEW_LINE>Collection<Size> sizes;<NEW_LINE>if (mode == Mode.PICTURE) {<NEW_LINE>selector = mPictureSizeSelector;<NEW_LINE>sizes = mCameraOptions.getSupportedPictureSizes();<NEW_LINE>} else {<NEW_LINE>selector = mVideoSizeSelector;<NEW_LINE>sizes = mCameraOptions.getSupportedVideoSizes();<NEW_LINE>}<NEW_LINE>selector = SizeSelectors.or(<MASK><NEW_LINE>List<Size> list = new ArrayList<>(sizes);<NEW_LINE>Size result = selector.select(list).get(0);<NEW_LINE>if (!list.contains(result)) {<NEW_LINE>throw new RuntimeException("SizeSelectors must not return Sizes other than " + "those in the input list.");<NEW_LINE>}<NEW_LINE>LOG.i("computeCaptureSize:", "result:", result, "flip:", flip, "mode:", mode);<NEW_LINE>// Go back to REF_SENSOR<NEW_LINE>if (flip)<NEW_LINE>result = result.flip();<NEW_LINE>return result;<NEW_LINE>} | selector, SizeSelectors.biggest()); |
595,817 | private static void copyRequiredLibraries(AntProjectHelper h, ReferenceHelper rh) throws IOException {<NEW_LINE>if (!h.isSharableProject()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (// NOI18N<NEW_LINE>rh.getProjectLibraryManager().getLibrary("junit") == null && LibraryManager.getDefault().getLibrary("junit") != null) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>rh.copyLibrary(LibraryManager.getDefault<MASK><NEW_LINE>}<NEW_LINE>if (// NOI18N<NEW_LINE>rh.getProjectLibraryManager().getLibrary("junit_4") == null && LibraryManager.getDefault().getLibrary("junit_4") != null) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>rh.copyLibrary(LibraryManager.getDefault().getLibrary("junit_4"));<NEW_LINE>}<NEW_LINE>if (// NOI18N<NEW_LINE>rh.getProjectLibraryManager().getLibrary("CopyLibs") == null && LibraryManager.getDefault().getLibrary("CopyLibs") != null) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>rh.copyLibrary(LibraryManager.getDefault().getLibrary("CopyLibs"));<NEW_LINE>}<NEW_LINE>if (// NOI18N<NEW_LINE>rh.getProjectLibraryManager().getLibrary("JavaFX2Runtime") == null && LibraryManager.getDefault().getLibrary("JavaFX2Runtime") != null) {<NEW_LINE>// NOI18N<NEW_LINE>File mainPropertiesFile = h.resolveFile(h.getLibrariesLocation());<NEW_LINE>// NOI18N<NEW_LINE>referenceLibrary(LibraryManager.getDefault().getLibrary("JavaFX2Runtime"), mainPropertiesFile.toURI().toURL(), true);<NEW_LINE>}<NEW_LINE>} | ().getLibrary("junit")); |
1,145,123 | private void doUnregisterHandler(final Thing thing, final ThingHandlerFactory thingHandlerFactory) {<NEW_LINE>logger.debug("Calling unregisterHandler handler for thing '{}' at '{}'.", thing.getUID(), thingHandlerFactory);<NEW_LINE>safeCaller.create(() -> {<NEW_LINE>ThingHandler thingHandler = thing.getHandler();<NEW_LINE>thingHandlerFactory.unregisterHandler(thing);<NEW_LINE>if (thingHandler != null) {<NEW_LINE>thingHandler.setCallback(null);<NEW_LINE>}<NEW_LINE>thing.setHandler(null);<NEW_LINE>boolean enabled = !isDisabledByStorage(thing.getUID());<NEW_LINE>ThingStatusDetail detail = enabled ? ThingStatusDetail.HANDLER_MISSING_ERROR : ThingStatusDetail.DISABLED;<NEW_LINE>setThingStatus(thing, buildStatusInfo<MASK><NEW_LINE>thingHandlers.remove(thing.getUID());<NEW_LINE>synchronized (thingHandlersByFactory) {<NEW_LINE>final Set<ThingHandler> thingHandlers = thingHandlersByFactory.get(thingHandlerFactory);<NEW_LINE>if (thingHandlers != null) {<NEW_LINE>thingHandlers.remove(thingHandler);<NEW_LINE>if (thingHandlers.isEmpty()) {<NEW_LINE>thingHandlersByFactory.remove(thingHandlerFactory);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, Runnable.class).build().run();<NEW_LINE>} | (ThingStatus.UNINITIALIZED, detail)); |
272,411 | public AntennaDownlinkConfig unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AntennaDownlinkConfig antennaDownlinkConfig = new AntennaDownlinkConfig();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return 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("spectrumConfig", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>antennaDownlinkConfig.setSpectrumConfig(SpectrumConfigJsonUnmarshaller.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 antennaDownlinkConfig;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,519,823 | private void restorePullRequestBranch() {<NEW_LINE>PullRequestMarker head = mPullRequest.head();<NEW_LINE>if (head.repo() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String owner = head.repo().owner().login();<NEW_LINE>String repo = head.repo().name();<NEW_LINE>GitService service = ServiceFactory.get(GitService.class, false);<NEW_LINE>CreateGitReference request = CreateGitReference.builder().ref("refs/heads/" + head.ref()).sha(head.sha()).build();<NEW_LINE>service.createGitReference(owner, repo, request).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(getBaseActivity(), R.string.saving_msg, R.string.restore_branch_error)).subscribe(result -> {<NEW_LINE>mHeadReference = result;<NEW_LINE>onHeadReferenceUpdated();<NEW_LINE>}, error <MASK><NEW_LINE>} | -> handleActionFailure("Restoring PR branch failed", error)); |
1,433,707 | private static String makeMessage(AssignmentEntry assignment, /* Nullable */<NEW_LINE>String reason, boolean isField) {<NEW_LINE>// if reason is null, then the variable is unused (at most assigned to)<NEW_LINE>String varName = assignment.var.getName();<NEW_LINE>StringBuilder result = new StringBuilder(64);<NEW_LINE>if (assignment.rhs instanceof ASTVariableInitializer) {<NEW_LINE>result.append(isField ? "the field initializer for" : "the initializer for variable");<NEW_LINE>} else if (assignment.rhs instanceof ASTVariableDeclaratorId) {<NEW_LINE>if (reason != null) {<NEW_LINE>result.append("the initial value of ");<NEW_LINE>}<NEW_LINE>result.append(getKind(assignment.var));<NEW_LINE>} else {<NEW_LINE>if (assignment.rhs instanceof ASTPreIncrementExpression || assignment.rhs instanceof ASTPreDecrementExpression || assignment.rhs instanceof ASTPostfixExpression) {<NEW_LINE>result.append("the updated value of ");<NEW_LINE>} else {<NEW_LINE>result.append("the value assigned to ");<NEW_LINE>}<NEW_LINE>result.append(isField ? "field" : "variable");<NEW_LINE>}<NEW_LINE>result.append(" ''").append(varName).append("''");<NEW_LINE>result.append(" is never used");<NEW_LINE>if (reason != null) {<NEW_LINE>result.append(" (").append(reason).append(")");<NEW_LINE>}<NEW_LINE>result.setCharAt(0, Character.toUpperCase(<MASK><NEW_LINE>return result.toString();<NEW_LINE>} | result.charAt(0))); |
1,135,925 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_drawer);<NEW_LINE>// set up an authentication handler to take credentials for access to arcgis.com<NEW_LINE>AuthenticationChallengeHandler handler = new DefaultAuthenticationChallengeHandler(this);<NEW_LINE>AuthenticationManager.setAuthenticationChallengeHandler(handler);<NEW_LINE>mDrawerTitle = getTitle();<NEW_LINE>// inflate MapView from layout<NEW_LINE>mMapView = findViewById(R.id.mapView);<NEW_LINE>// create a map with Topographic Basemap<NEW_LINE>Basemap streetsBasemap = new Basemap(BasemapStyle.ARCGIS_STREETS);<NEW_LINE>ArcGISMap map = new ArcGISMap(streetsBasemap);<NEW_LINE>map.addDoneLoadingListener(() -> {<NEW_LINE>if (map.getLoadStatus() != LoadStatus.LOADED) {<NEW_LINE>String error = "Error loading map: " + map.getLoadError().getCause().getMessage();<NEW_LINE>Toast.makeText(this, error, Toast.LENGTH_SHORT).show();<NEW_LINE>Log.e(TAG, error);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// set the map to be displayed in this view<NEW_LINE>mMapView.setMap(map);<NEW_LINE>mMapView.setViewpoint(new Viewpoint(48.354388, -99.998245, 100000000));<NEW_LINE>// inflate the Basemap and Layer list views<NEW_LINE>mBasemapListView = findViewById(R.id.basemap_list);<NEW_LINE>mLayerListView = findViewById(R.id.layer_list);<NEW_LINE>mDrawerLayout = findViewById(R.id.drawer_layout);<NEW_LINE>ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer");<NEW_LINE>ArcGISMapImageLayer mapImageLayer = new ArcGISMapImageLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer");<NEW_LINE>// setting the scales at which the map image layer layer can be viewed<NEW_LINE>mapImageLayer.setMinScale(MIN_SCALE);<NEW_LINE>mapImageLayer.setMaxScale(MIN_SCALE / 100);<NEW_LINE>// create base map array and set it to a list view adapter<NEW_LINE>String[] basemapTiles = getResources().getStringArray(R.array.basemap_array);<NEW_LINE>mBasemapListView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_single_choice, basemapTiles));<NEW_LINE>mBasemapListView.setItemChecked(0, true);<NEW_LINE>// create operation layers array and set it to a list view adapter<NEW_LINE>String[] operationalLayerTiles = getResources().getStringArray(R.array.operational_layer_array);<NEW_LINE>mLayerListView.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_multiple_choice, operationalLayerTiles));<NEW_LINE>// creates a drawer to handle display of layers on the map<NEW_LINE>createDrawer(tiledLayer, mapImageLayer);<NEW_LINE>getSupportActionBar().setDisplayHomeAsUpEnabled(true);<NEW_LINE><MASK><NEW_LINE>} | getSupportActionBar().setHomeButtonEnabled(true); |
505,012 | final GetNodeResult executeGetNode(GetNodeRequest getNodeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getNodeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetNodeRequest> request = null;<NEW_LINE>Response<GetNodeResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetNodeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getNodeRequest));<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, "ManagedBlockchain");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetNode");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetNodeResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new GetNodeResultJsonUnmarshaller()); |
793,413 | public CompletableFuture<Collection<Instant>> renewMessageLocksAsync(UUID[] lockTokens) {<NEW_LINE>this.throwIfInUnusableState();<NEW_LINE>if (TRACE_LOGGER.isDebugEnabled()) {<NEW_LINE>TRACE_LOGGER.debug("Renewing message locks for lock tokens '{}' of entity '{}', sesion '{}'", Arrays.toString(lockTokens), this.receivePath, this.isSessionReceiver ? this.getSessionId() : "");<NEW_LINE>}<NEW_LINE>return this.createRequestResponseLinkAsync().thenComposeAsync((v) -> {<NEW_LINE>HashMap requestBodyMap = new HashMap();<NEW_LINE>requestBodyMap.<MASK><NEW_LINE>if (this.isSessionReceiver) {<NEW_LINE>requestBodyMap.put(ClientConstants.REQUEST_RESPONSE_SESSIONID, this.getSessionId());<NEW_LINE>}<NEW_LINE>Message requestMessage = RequestResponseUtils.createRequestMessageFromPropertyBag(ClientConstants.REQUEST_RESPONSE_RENEWLOCK_OPERATION, requestBodyMap, Util.adjustServerTimeout(this.operationTimeout), this.receiveLink.getName());<NEW_LINE>CompletableFuture<Message> responseFuture = this.requestResponseLink.requestAysnc(requestMessage, TransactionContext.NULL_TXN, this.operationTimeout);<NEW_LINE>return responseFuture.thenComposeAsync((responseMessage) -> {<NEW_LINE>CompletableFuture<Collection<Instant>> returningFuture = new CompletableFuture<>();<NEW_LINE>int statusCode = RequestResponseUtils.getResponseStatusCode(responseMessage);<NEW_LINE>if (statusCode == ClientConstants.REQUEST_RESPONSE_OK_STATUS_CODE) {<NEW_LINE>if (TRACE_LOGGER.isDebugEnabled()) {<NEW_LINE>TRACE_LOGGER.debug("Message locks for lock tokens '{}' renewed", Arrays.toString(lockTokens));<NEW_LINE>}<NEW_LINE>Date[] expirations = (Date[]) RequestResponseUtils.getResponseBody(responseMessage).get(ClientConstants.REQUEST_RESPONSE_EXPIRATIONS);<NEW_LINE>returningFuture.complete(Arrays.stream(expirations).map((d) -> d.toInstant()).collect(Collectors.toList()));<NEW_LINE>} else {<NEW_LINE>// error response<NEW_LINE>Exception failureException = RequestResponseUtils.genereateExceptionFromResponse(responseMessage);<NEW_LINE>TRACE_LOGGER.info("Renewing message locks for lock tokens '{}' on entity '{}' failed", Arrays.toString(lockTokens), this.receivePath, failureException);<NEW_LINE>returningFuture.completeExceptionally(failureException);<NEW_LINE>}<NEW_LINE>return returningFuture;<NEW_LINE>}, MessagingFactory.INTERNAL_THREAD_POOL);<NEW_LINE>}, MessagingFactory.INTERNAL_THREAD_POOL);<NEW_LINE>} | put(ClientConstants.REQUEST_RESPONSE_LOCKTOKENS, lockTokens); |
1,701,627 | public void processOpts() {<NEW_LINE>super.processOpts();<NEW_LINE>if (StringUtils.isEmpty(System.getenv("OCAML_POST_PROCESS_FILE"))) {<NEW_LINE>LOGGER.info("Hint: Environment variable 'OCAML_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export OCAML_POST_PROCESS_FILE=\"ocamlformat -i --enable-outside-detected-project\"' (Linux/Mac)");<NEW_LINE>LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");<NEW_LINE>} else if (!this.isEnablePostProcessFile()) {<NEW_LINE>LOGGER.info("Warning: Environment variable 'OCAML_POST_PROCESS_FILE' is set but file post-processing is not enabled. To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).");<NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {<NEW_LINE>setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));<NEW_LINE>} else {<NEW_LINE>setPackageName("openapi");<NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {<NEW_LINE>setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION));<NEW_LINE>} else {<NEW_LINE>setPackageVersion("1.0.0");<NEW_LINE>}<NEW_LINE>additionalProperties.<MASK><NEW_LINE>additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);<NEW_LINE>additionalProperties.put("apiDocPath", apiDocPath);<NEW_LINE>additionalProperties.put("modelDocPath", modelDocPath);<NEW_LINE>apiTemplateFiles.put("api-impl.mustache", ".ml");<NEW_LINE>apiTemplateFiles.put("api-intf.mustache", ".mli");<NEW_LINE>modelPackage = packageName;<NEW_LINE>apiPackage = packageName;<NEW_LINE>} | put(CodegenConstants.PACKAGE_NAME, packageName); |
595,823 | public ModelArchive registerModel(String url, String modelName, Manifest.RuntimeType runtime, String handler, int batchSize, int maxBatchDelay, int responseTimeout, String defaultModelName, boolean ignoreDuplicate, boolean isWorkflowModel, boolean s3SseKms) throws ModelException, IOException, InterruptedException, DownloadArchiveException {<NEW_LINE>ModelArchive archive;<NEW_LINE>if (isWorkflowModel && url == null) {<NEW_LINE>// This is a workflow function<NEW_LINE>Manifest manifest = new Manifest();<NEW_LINE>manifest.getModel().setVersion("1.0");<NEW_LINE>manifest.getModel().setModelVersion("1.0");<NEW_LINE>manifest.getModel().setModelName(modelName);<NEW_LINE>manifest.getModel().setHandler(new File(handler).getName());<NEW_LINE>File f = new File(handler.substring(0, handler.lastIndexOf(':')));<NEW_LINE>archive = new ModelArchive(manifest, url, f.getParentFile(), true);<NEW_LINE>} else {<NEW_LINE>archive = createModelArchive(modelName, url, handler, runtime, defaultModelName, s3SseKms);<NEW_LINE>}<NEW_LINE>Model tempModel = createModel(archive, batchSize, maxBatchDelay, responseTimeout, isWorkflowModel);<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>createVersionedModel(tempModel, versionId);<NEW_LINE>} catch (ConflictStatusException e) {<NEW_LINE>if (!ignoreDuplicate) {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setupModelDependencies(tempModel);<NEW_LINE>logger.info("Model {} loaded.", tempModel.getModelName());<NEW_LINE>return archive;<NEW_LINE>} | String versionId = archive.getModelVersion(); |
811,015 | private void initCompletedUserTaskRetentionPolicy(KafkaCruiseControlConfig config, List<CruiseControlEndpointType> endpointTypes) {<NEW_LINE>Integer defaultMaxCachedCompletedUserTasks = config.getInt(UserTaskManagerConfig.MAX_CACHED_COMPLETED_USER_TASKS_CONFIG);<NEW_LINE>Long defaultCompletedUserTaskRetentionTimeMs = config.getLong(UserTaskManagerConfig.COMPLETED_USER_TASK_RETENTION_TIME_MS_CONFIG);<NEW_LINE>for (CruiseControlEndpointType endpointType : endpointTypes) {<NEW_LINE>Integer maxCachedCompletedUserTasks;<NEW_LINE>Long completedUserTaskRetentionTimeMs;<NEW_LINE>switch(endpointType) {<NEW_LINE>case CRUISE_CONTROL_ADMIN:<NEW_LINE>maxCachedCompletedUserTasks = config.getInt(UserTaskManagerConfig.MAX_CACHED_COMPLETED_CRUISE_CONTROL_ADMIN_USER_TASKS_CONFIG);<NEW_LINE>completedUserTaskRetentionTimeMs = config.getLong(UserTaskManagerConfig.COMPLETED_CRUISE_CONTROL_ADMIN_USER_TASK_RETENTION_TIME_MS_CONFIG);<NEW_LINE>break;<NEW_LINE>case KAFKA_ADMIN:<NEW_LINE>maxCachedCompletedUserTasks = <MASK><NEW_LINE>completedUserTaskRetentionTimeMs = config.getLong(UserTaskManagerConfig.COMPLETED_KAFKA_ADMIN_USER_TASK_RETENTION_TIME_MS_CONFIG);<NEW_LINE>break;<NEW_LINE>case CRUISE_CONTROL_MONITOR:<NEW_LINE>maxCachedCompletedUserTasks = config.getInt(UserTaskManagerConfig.MAX_CACHED_COMPLETED_CRUISE_CONTROL_MONITOR_USER_TASKS_CONFIG);<NEW_LINE>completedUserTaskRetentionTimeMs = config.getLong(UserTaskManagerConfig.COMPLETED_CRUISE_CONTROL_MONITOR_USER_TASK_RETENTION_TIME_MS_CONFIG);<NEW_LINE>break;<NEW_LINE>case KAFKA_MONITOR:<NEW_LINE>maxCachedCompletedUserTasks = config.getInt(UserTaskManagerConfig.MAX_CACHED_COMPLETED_KAFKA_MONITOR_USER_TASKS_CONFIG);<NEW_LINE>completedUserTaskRetentionTimeMs = config.getLong(UserTaskManagerConfig.COMPLETED_KAFKA_MONITOR_USER_TASK_RETENTION_TIME_MS_CONFIG);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("Unknown endpoint type " + endpointType);<NEW_LINE>}<NEW_LINE>Integer mapSize = maxCachedCompletedUserTasks == null ? defaultMaxCachedCompletedUserTasks : maxCachedCompletedUserTasks;<NEW_LINE>_uuidToCompletedUserTaskInfoMap.put(endpointType, new LinkedHashMap<>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected boolean removeEldestEntry(Map.Entry<UUID, UserTaskInfo> eldest) {<NEW_LINE>return this.size() > mapSize;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>_completedUserTaskRetentionTimeMs.put(endpointType, completedUserTaskRetentionTimeMs == null ? defaultCompletedUserTaskRetentionTimeMs : completedUserTaskRetentionTimeMs);<NEW_LINE>}<NEW_LINE>} | config.getInt(UserTaskManagerConfig.MAX_CACHED_COMPLETED_KAFKA_ADMIN_USER_TASKS_CONFIG); |
1,788,840 | private void assertCompatibleAttributes(NodeState first, NodeState second, Set<NodeState> incompatibleNodes) {<NEW_LINE>ImmutableAttributes firstAttributes = first.getMetadata().getAttributes();<NEW_LINE>ImmutableAttributes secondAttributes = second.getMetadata().getAttributes();<NEW_LINE>ImmutableSet<Attribute<?>> firstKeys = firstAttributes.keySet();<NEW_LINE>ImmutableSet<Attribute<?>> secondKeys = secondAttributes.keySet();<NEW_LINE>for (Attribute<?> attribute : Sets.intersection(firstKeys, secondKeys)) {<NEW_LINE>CompatibilityRule<Object> rule = attributesSchema.compatibilityRules(attribute);<NEW_LINE>Object <MASK><NEW_LINE>Object v2 = secondAttributes.getAttribute(attribute);<NEW_LINE>// for all commons attributes, make sure they are compatible with each other<NEW_LINE>if (!compatible(rule, v1, v2) && !compatible(rule, v2, v1)) {<NEW_LINE>incompatibleNodes.add(first);<NEW_LINE>incompatibleNodes.add(second);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | v1 = firstAttributes.getAttribute(attribute); |
695,667 | public boolean isCached(RequestAuthenticator authenticator) {<NEW_LINE>// Assuming authenticatedPrincipal set by previous call of checkCurrentToken() during this request<NEW_LINE>if (authenticatedPrincipal != null) {<NEW_LINE>log.debug("remote logged in already. Establish state from cookie");<NEW_LINE>RefreshableKeycloakSecurityContext securityContext = authenticatedPrincipal.getKeycloakSecurityContext();<NEW_LINE>if (!securityContext.getRealm().equals(deployment.getRealm())) {<NEW_LINE>log.debug("Account from cookie is from a different realm than for the request.");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>securityContext.setCurrentRequestInfo(deployment, this);<NEW_LINE>request.setAttribute(KeycloakSecurityContext.<MASK><NEW_LINE>JettyRequestAuthenticator jettyAuthenticator = (JettyRequestAuthenticator) authenticator;<NEW_LINE>KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal = AdapterUtils.createPrincipal(deployment, securityContext);<NEW_LINE>jettyAuthenticator.principal = principal;<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | class.getName(), securityContext); |
372,906 | public void initSDK(MethodCall methodCall, MethodChannel.Result result) {<NEW_LINE>int sdkAppID = methodCall.argument("sdkAppID");<NEW_LINE>int logLevel = methodCall.argument("logLevel");<NEW_LINE>String uiPlatform = methodCall.argument("uiPlatform");<NEW_LINE>final String listenerUuid = methodCall.argument("listenerUuid");<NEW_LINE>// Global configuration<NEW_LINE>V2TIMManager.getInstance().callExperimentalAPI("setUIPlatform", uiPlatform, null);<NEW_LINE>// The main thread initializes the SDK<NEW_LINE>// if (SessionWrapper.isMainProcess(context)) {<NEW_LINE>V2TIMSDKConfig config = new V2TIMSDKConfig();<NEW_LINE>config.setLogLevel(logLevel);<NEW_LINE>Boolean res = V2TIMManager.getInstance().initSDK(context, sdkAppID, config, new V2TIMSDKListener() {<NEW_LINE><NEW_LINE>public void onConnecting() {<NEW_LINE>makeEventData("onConnecting", null, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onConnectSuccess() {<NEW_LINE>makeEventData("onConnectSuccess", null, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onConnectFailed(int code, String error) {<NEW_LINE>HashMap<String, Object> err = new HashMap<String, Object>();<NEW_LINE>err.put("code", code);<NEW_LINE>err.put("desc", error);<NEW_LINE>makeEventData("onConnectFailed", err, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onKickedOffline() {<NEW_LINE>makeEventData("onKickedOffline", null, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onUserSigExpired() {<NEW_LINE>makeEventData("onUserSigExpired", null, listenerUuid);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void onSelfInfoUpdated(V2TIMUserFullInfo info) {<NEW_LINE>makeEventData("onSelfInfoUpdated", CommonUtil.convertV2TIMUserFullInfoToMap(info), listenerUuid);<NEW_LINE>}<NEW_LINE>});<NEW_LINE><MASK><NEW_LINE>// }<NEW_LINE>} | CommonUtil.returnSuccess(result, res); |
1,373,788 | private // -----------------//<NEW_LINE>void processDynamics(DynamicsInter dynamics) {<NEW_LINE>try {<NEW_LINE>logger.debug("Visiting {}", dynamics);<NEW_LINE>// No point to export incorrect dynamics<NEW_LINE>if (dynamics.getShape() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Direction direction = factory.createDirection();<NEW_LINE>DirectionType directionType = factory.createDirectionType();<NEW_LINE>Dynamics pmDynamics = factory.createDynamics();<NEW_LINE>// Precise dynamic signature<NEW_LINE>pmDynamics.getPOrPpOrPpp().add(getDynamicsObject(dynamics.getShape()));<NEW_LINE>// Staff?<NEW_LINE>Staff staff = current.note.getStaff();<NEW_LINE>insertStaffId(direction, staff);<NEW_LINE>// Placement<NEW_LINE>final Point location = dynamics.getCenterLeft();<NEW_LINE>if (location.y < current.note.getCenter().y) {<NEW_LINE>direction.setPlacement(AboveBelow.ABOVE);<NEW_LINE>} else {<NEW_LINE>direction.setPlacement(AboveBelow.BELOW);<NEW_LINE>}<NEW_LINE>// default-y<NEW_LINE>pmDynamics.setDefaultY<MASK><NEW_LINE>// Relative-x (No offset for the time being) using note left side<NEW_LINE>pmDynamics.setRelativeX(toTenths(location.x - current.note.getCenterLeft().x));<NEW_LINE>// Related sound level, if available<NEW_LINE>Integer soundLevel = dynamics.getSoundLevel();<NEW_LINE>if (soundLevel != null) {<NEW_LINE>Sound sound = factory.createSound();<NEW_LINE>sound.setDynamics(new BigDecimal(soundLevel));<NEW_LINE>direction.setSound(sound);<NEW_LINE>}<NEW_LINE>// Everything is now OK<NEW_LINE>directionType.getDynamics().add(pmDynamics);<NEW_LINE>direction.getDirectionType().add(directionType);<NEW_LINE>current.pmMeasure.getNoteOrBackupOrForward().add(direction);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.warn("Error visiting {} in {}", dynamics, current.page, ex);<NEW_LINE>}<NEW_LINE>} | (yOf(location, staff)); |
43,108 | public byte[] retrieveKey(UUID universeUUID, UUID configUUID, byte[] keyRef, EncryptionAtRestConfig config) {<NEW_LINE>if (keyRef == null) {<NEW_LINE>String errMsg = String.format("Retrieve key could not find a key ref for universe %s...", universeUUID.toString());<NEW_LINE>LOG.warn(errMsg);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Attempt to retrieve cached entry<NEW_LINE>byte[] keyVal = EncryptionAtRestUtil.getUniverseKeyCacheEntry(universeUUID, keyRef);<NEW_LINE>// Retrieve through KMS provider if no cache entry exists<NEW_LINE>if (keyVal == null) {<NEW_LINE>LOG.debug("Universe key cache entry empty. Retrieving key from service");<NEW_LINE>keyVal = retrieveKeyWithService(<MASK><NEW_LINE>// Update the cache entry<NEW_LINE>if (keyVal != null) {<NEW_LINE>EncryptionAtRestUtil.setUniverseKeyCacheEntry(universeUUID, keyRef, keyVal);<NEW_LINE>} else {<NEW_LINE>LOG.warn("Could not retrieve key from key ref for universe " + universeUUID.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return keyVal;<NEW_LINE>} | universeUUID, configUUID, keyRef, config); |
500,956 | public static I_C_Invoice_Candidate createIcAndSetCommonFields(@NonNull final I_C_Flatrate_Term term) {<NEW_LINE>// Services<NEW_LINE>final DimensionService dimensionService = SpringContextHolder.instance.getBean(DimensionService.class);<NEW_LINE>final IOrderDAO orderDAO = Services.get(IOrderDAO.class);<NEW_LINE>final IDocTypeBL docTypeBL = Services.get(IDocTypeBL.class);<NEW_LINE>final I_C_Invoice_Candidate ic = newInstance(I_C_Invoice_Candidate.class);<NEW_LINE>ic.setAD_Org_ID(term.getAD_Org_ID());<NEW_LINE>ic.setAD_Table_ID(InterfaceWrapperHelper.getTableId(I_C_Flatrate_Term.class));<NEW_LINE>ic.setRecord_ID(term.getC_Flatrate_Term_ID());<NEW_LINE>ic.setC_Async_Batch_ID(term.getC_Async_Batch_ID());<NEW_LINE>ic.setM_Product_ID(term.getM_Product_ID());<NEW_LINE>ic.setC_Currency_ID(term.getC_Currency_ID());<NEW_LINE>// to be computed<NEW_LINE>ic.setQtyToInvoice(BigDecimal.ZERO);<NEW_LINE>InvoiceCandidateLocationAdapterFactory.billLocationAdapter(ic).setFrom(ContractLocationHelper.extractBillLocation(term));<NEW_LINE>ic.setM_PricingSystem_ID(term.getM_PricingSystem_ID());<NEW_LINE>// 07442 activity and tax<NEW_LINE>final ActivityId activityId = Services.get(IProductAcctDAO.class).retrieveActivityForAcct(ClientId.ofRepoId(term.getAD_Client_ID()), OrgId.ofRepoId(term.getAD_Org_ID()), ProductId.ofRepoId<MASK><NEW_LINE>ic.setIsTaxIncluded(term.isTaxIncluded());<NEW_LINE>if (term.getC_OrderLine_Term_ID() > 0) {<NEW_LINE>final I_C_OrderLine orderLine = orderDAO.getOrderLineById(OrderLineId.ofRepoId(term.getC_OrderLine_Term_ID()));<NEW_LINE>ic.setC_OrderLine_ID(orderLine.getC_OrderLine_ID());<NEW_LINE>final I_C_Order order = orderDAO.getById(OrderId.ofRepoId(orderLine.getC_Order_ID()));<NEW_LINE>ic.setC_Order_ID(orderLine.getC_Order_ID());<NEW_LINE>ic.setC_Incoterms_ID(order.getC_Incoterms_ID());<NEW_LINE>ic.setIncotermLocation(order.getIncotermLocation());<NEW_LINE>// DocType<NEW_LINE>final DocTypeId orderDocTypeId = CoalesceUtil.coalesceSuppliers(() -> DocTypeId.ofRepoIdOrNull(order.getC_DocType_ID()), () -> DocTypeId.ofRepoIdOrNull(order.getC_DocTypeTarget_ID()));<NEW_LINE>if (orderDocTypeId != null) {<NEW_LINE>final I_C_DocType orderDocType = docTypeBL.getById(orderDocTypeId);<NEW_LINE>final DocTypeId invoiceDocTypeId = DocTypeId.ofRepoIdOrNull(orderDocType.getC_DocTypeInvoice_ID());<NEW_LINE>if (invoiceDocTypeId != null) {<NEW_LINE>ic.setC_DocTypeInvoice_ID(invoiceDocTypeId.getRepoId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Dimension orderLineDimension = dimensionService.getFromRecord(orderLine);<NEW_LINE>if (orderLineDimension.getActivityId() == null) {<NEW_LINE>dimensionService.updateRecord(ic, orderLineDimension.withActivityId(activityId));<NEW_LINE>} else {<NEW_LINE>dimensionService.updateRecord(ic, orderLineDimension);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ic;<NEW_LINE>} | (term.getM_Product_ID())); |
1,205,886 | public static void start(String cfgPath) {<NEW_LINE>if (!started.compareAndSet(false, true)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>MonitorCfg cfg = MonitorCfgLoader.load(cfgPath);<NEW_LINE>agent.<MASK><NEW_LINE>agent.setClusterName(cfg.getClusterName());<NEW_LINE>if (StringUtils.isNotEmpty(cfg.getBindIp())) {<NEW_LINE>agent.setBindIp(cfg.getBindIp());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(cfg.getIdentity())) {<NEW_LINE>agent.setIdentity(cfg.getIdentity());<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, String> config : cfg.getConfigs().entrySet()) {<NEW_LINE>agent.addConfig(config.getKey(), config.getValue());<NEW_LINE>}<NEW_LINE>agent.start();<NEW_LINE>Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>agent.stop();<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>} catch (CfgException e) {<NEW_LINE>System.err.println("Monitor Startup Error: " + e.getMessage());<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | setRegistryAddress(cfg.getRegistryAddress()); |
686,123 | public void deleteById(String id) {<NEW_LINE>String resourceGroupName = <MASK><NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>String serviceName = Utils.getValueFromIdByName(id, "service");<NEW_LINE>if (serviceName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'service'.", id)));<NEW_LINE>}<NEW_LINE>String apiId = Utils.getValueFromIdByName(id, "apis");<NEW_LINE>if (apiId == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'apis'.", id)));<NEW_LINE>}<NEW_LINE>String issueId = Utils.getValueFromIdByName(id, "issues");<NEW_LINE>if (issueId == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'issues'.", id)));<NEW_LINE>}<NEW_LINE>String attachmentId = Utils.getValueFromIdByName(id, "attachments");<NEW_LINE>if (attachmentId == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'attachments'.", id)));<NEW_LINE>}<NEW_LINE>String localIfMatch = null;<NEW_LINE>this.deleteWithResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, localIfMatch, Context.NONE);<NEW_LINE>} | Utils.getValueFromIdByName(id, "resourceGroups"); |
953,298 | private Component createCellImpl(Object value, final int row, final int column, boolean editable) {<NEW_LINE>Component c = createCell(value, row, column, editable);<NEW_LINE>c.putClientProperty("row", new Integer(row));<NEW_LINE>c.putClientProperty("column", new Integer(column));<NEW_LINE>// we do this here to allow subclasses to return a text area or its subclass<NEW_LINE>if (c instanceof TextArea) {<NEW_LINE>((TextArea<MASK><NEW_LINE>} else {<NEW_LINE>if (c instanceof Button) {<NEW_LINE>((Button) c).addActionListener(listener);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Style s = c.getSelectedStyle();<NEW_LINE>// s.setMargin(0, 0, 0, 0);<NEW_LINE>s.setMargin(verticalBorderSpacing, verticalBorderSpacing, horizontalBorderSpacing, horizontalBorderSpacing);<NEW_LINE>if ((drawBorder) && (innerBorder != INNER_BORDERS_NONE)) {<NEW_LINE>s.setBorder(null);<NEW_LINE>s = c.getUnselectedStyle();<NEW_LINE>s.setBorder(null);<NEW_LINE>} else {<NEW_LINE>s = c.getUnselectedStyle();<NEW_LINE>}<NEW_LINE>// s.setBgTransparency(0);<NEW_LINE>// s.setMargin(0, 0, 0, 0);<NEW_LINE>s.setMargin(verticalBorderSpacing, verticalBorderSpacing, horizontalBorderSpacing, horizontalBorderSpacing);<NEW_LINE>return c;<NEW_LINE>} | ) c).addActionListener(listener); |
4,253 | public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {<NEW_LINE>if (args.length < 1) {<NEW_LINE>throw new NotEnoughArgumentsException();<NEW_LINE>}<NEW_LINE>final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;<NEW_LINE>final String senderDisplayName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.DISPLAY_NAME;<NEW_LINE>String ipAddress;<NEW_LINE>if (FormatUtil.validIP(args[0])) {<NEW_LINE>ipAddress = args[0];<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>final User player = getPlayer(server, args, 0, true, true);<NEW_LINE>ipAddress = player.getLastLoginAddress();<NEW_LINE>} catch (final PlayerNotFoundException ex) {<NEW_LINE>ipAddress = args[0];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ipAddress.isEmpty()) {<NEW_LINE>throw new PlayerNotFoundException();<NEW_LINE>}<NEW_LINE>final String banReason;<NEW_LINE>if (args.length > 1) {<NEW_LINE>banReason = FormatUtil.replaceFormat(getFinalArg(args, 1).replace("\\n", "\n").replace("|", "\n"));<NEW_LINE>} else {<NEW_LINE>banReason = tl("defaultBanReason");<NEW_LINE>}<NEW_LINE>final String banDisplay = tl("banFormat", banReason, senderDisplayName);<NEW_LINE>ess.getServer().getBanList(BanList.Type.IP).addBan(<MASK><NEW_LINE>server.getLogger().log(Level.INFO, tl("playerBanIpAddress", senderDisplayName, ipAddress, banReason));<NEW_LINE>for (final Player player : ess.getServer().getOnlinePlayers()) {<NEW_LINE>if (player.getAddress().getAddress().getHostAddress().equalsIgnoreCase(ipAddress)) {<NEW_LINE>player.kickPlayer(banDisplay);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ess.broadcastMessage("essentials.banip.notify", tl("playerBanIpAddress", senderDisplayName, ipAddress, banReason));<NEW_LINE>} | ipAddress, banReason, null, senderName); |
1,641,549 | public double multi8p(int x, int y, double masc) {<NEW_LINE>int aR = getIntComponent0(x - 1, y - 1);<NEW_LINE>int bR = getIntComponent0(x - 1, y);<NEW_LINE>int cR = getIntComponent0(x - 1, y + 1);<NEW_LINE>int aG = getIntComponent1(x - 1, y - 1);<NEW_LINE>int bG = getIntComponent1(x - 1, y);<NEW_LINE>int cG = getIntComponent1(x - 1, y + 1);<NEW_LINE>int aB = getIntComponent1(x - 1, y - 1);<NEW_LINE>int bB = getIntComponent1(x - 1, y);<NEW_LINE>int cB = getIntComponent1(x - 1, y + 1);<NEW_LINE>int dR = getIntComponent0(x, y - 1);<NEW_LINE>int eR = getIntComponent0(x, y);<NEW_LINE>int fR = getIntComponent0(x, y + 1);<NEW_LINE>int dG = getIntComponent1(x, y - 1);<NEW_LINE>int eG = getIntComponent1(x, y);<NEW_LINE>int fG = getIntComponent1(x, y + 1);<NEW_LINE>int dB = getIntComponent1(x, y - 1);<NEW_LINE>int eB = getIntComponent1(x, y);<NEW_LINE>int fB = getIntComponent1(x, y + 1);<NEW_LINE>int gR = getIntComponent0(x + 1, y - 1);<NEW_LINE>int hR = <MASK><NEW_LINE>int iR = getIntComponent0(x + 1, y + 1);<NEW_LINE>int gG = getIntComponent1(x + 1, y - 1);<NEW_LINE>int hG = getIntComponent1(x + 1, y);<NEW_LINE>int iG = getIntComponent1(x + 1, y + 1);<NEW_LINE>int gB = getIntComponent1(x + 1, y - 1);<NEW_LINE>int hB = getIntComponent1(x + 1, y);<NEW_LINE>int iB = getIntComponent1(x + 1, y + 1);<NEW_LINE>double rgb;<NEW_LINE>rgb = ((aR * masc) + (bR * masc) + (cR * masc) + (dR * masc) + (eR * masc) + (fR * masc) + (gR * masc) + (hR * masc) + (iR * masc));<NEW_LINE>return (rgb);<NEW_LINE>} | getIntComponent0(x + 1, y); |
1,648,091 | static SimHash<int[]> of(byte[][] features) {<NEW_LINE>int n = features.length;<NEW_LINE>long[] hash = new long[n];<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>ByteBuffer buffer = ByteBuffer.wrap(features[i]);<NEW_LINE>hash[i] = MurmurHash2.hash64(buffer, 0, features<MASK><NEW_LINE>}<NEW_LINE>return weight -> {<NEW_LINE>if (weight.length != n) {<NEW_LINE>throw new IllegalArgumentException("Invalid weight vector size");<NEW_LINE>}<NEW_LINE>final int BITS = 64;<NEW_LINE>int[] count = new int[n];<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>long h = hash[i];<NEW_LINE>int w = weight[i];<NEW_LINE>for (int j = 0; j < BITS; j++) {<NEW_LINE>if (((h >>> i) & 1) == 1) {<NEW_LINE>count[j] += w;<NEW_LINE>} else {<NEW_LINE>count[j] -= w;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long bits = 0;<NEW_LINE>long one = 1;<NEW_LINE>for (int i = 0; i < BITS; i++) {<NEW_LINE>if (count[i] >= 0) {<NEW_LINE>bits |= one;<NEW_LINE>}<NEW_LINE>one <<= 1;<NEW_LINE>}<NEW_LINE>return bits;<NEW_LINE>};<NEW_LINE>} | [i].length, 0); |
364,917 | private void appendTypesToRegenerateStaleGeneratedTypes(Set<String> staleTypeNames) {<NEW_LINE>Set<String> generatedCompilationUnitNames = reboundTypeNamesByGeneratedCompilationUnitNames.keySet();<NEW_LINE>// Filter the current stale types list for any compilation units that are known to be generated.<NEW_LINE>Set<String> staleGeneratedCompilationUnitNames = Sets.intersection(computeCompilationUnitNames(staleTypeNames), generatedCompilationUnitNames);<NEW_LINE>boolean discoveredMoreStaleTypes;<NEW_LINE>do {<NEW_LINE>// Accumulate staleGeneratedCompilationUnits -> generators -><NEW_LINE>// generatorTriggeringCompilationUnits.<NEW_LINE>Set<<MASK><NEW_LINE>Set<String> generatorTriggeringTypes = computeTypesThatRebindTypes(reboundTypesThatGenerateTheStaleCompilationUnits);<NEW_LINE>// Mark these generator triggering types stale and keep track of whether any of them were not<NEW_LINE>// previously known to be stale.<NEW_LINE>discoveredMoreStaleTypes = staleTypeNames.addAll(generatorTriggeringTypes);<NEW_LINE>// It's possible that a generator triggering type was itself also created by a Generator.<NEW_LINE>// Repeat the backwards trace process till none of the newly stale types are generated types.<NEW_LINE>staleGeneratedCompilationUnitNames = Sets.intersection(computeCompilationUnitNames(generatorTriggeringTypes), generatedCompilationUnitNames);<NEW_LINE>} while (discoveredMoreStaleTypes);<NEW_LINE>} | String> reboundTypesThatGenerateTheStaleCompilationUnits = computeReboundTypesThatGenerateTypes(staleGeneratedCompilationUnitNames); |
401,981 | public static DescribeStrategyTargetResponse unmarshall(DescribeStrategyTargetResponse describeStrategyTargetResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeStrategyTargetResponse.setRequestId(_ctx.stringValue("DescribeStrategyTargetResponse.RequestId"));<NEW_LINE>List<StrategyTarget> strategyTargets = new ArrayList<StrategyTarget>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeStrategyTargetResponse.StrategyTargets.Length"); i++) {<NEW_LINE>StrategyTarget strategyTarget = new StrategyTarget();<NEW_LINE>strategyTarget.setFlag(_ctx.stringValue<MASK><NEW_LINE>strategyTarget.setTarget(_ctx.stringValue("DescribeStrategyTargetResponse.StrategyTargets[" + i + "].Target"));<NEW_LINE>strategyTarget.setTargetType(_ctx.stringValue("DescribeStrategyTargetResponse.StrategyTargets[" + i + "].TargetType"));<NEW_LINE>strategyTarget.setBindUuidCount(_ctx.integerValue("DescribeStrategyTargetResponse.StrategyTargets[" + i + "].BindUuidCount"));<NEW_LINE>strategyTargets.add(strategyTarget);<NEW_LINE>}<NEW_LINE>describeStrategyTargetResponse.setStrategyTargets(strategyTargets);<NEW_LINE>return describeStrategyTargetResponse;<NEW_LINE>} | ("DescribeStrategyTargetResponse.StrategyTargets[" + i + "].Flag")); |
715,530 | private static List<Pair<String, List<Pair<Integer, Long>>>> findGetIndex(TableMeta tableMeta, List<XPlanEqualTuple> conditions) {<NEW_LINE>final Map<String, Integer> keyMap = new <MASK><NEW_LINE>for (int idx = 0; idx < conditions.size(); ++idx) {<NEW_LINE>keyMap.put(tableMeta.getAllColumns().get(conditions.get(idx).getKey().getIndex()).getName(), idx);<NEW_LINE>}<NEW_LINE>final List<Pair<String, List<Pair<Integer, Long>>>> result = new ArrayList<>();<NEW_LINE>// Note: Indexes include PRIMARY.<NEW_LINE>for (IndexMeta indexMeta : tableMeta.getIndexes()) {<NEW_LINE>if (indexMeta.getPhysicalIndexName().equalsIgnoreCase("PRIMARY") && !tableMeta.isHasPrimaryKey()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final List<Pair<Integer, Long>> conditionIndexes = new ArrayList<>();<NEW_LINE>for (IndexColumnMeta columnMeta : indexMeta.getKeyColumnsExt()) {<NEW_LINE>final Integer idx = keyMap.get(columnMeta.getColumnMeta().getName());<NEW_LINE>if (null == idx) {<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>// Record the sub part length.<NEW_LINE>conditionIndexes.add(Pair.of(idx, columnMeta.getSubPart()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (conditionIndexes.size() > 0) {<NEW_LINE>result.add(Pair.of(indexMeta.getPhysicalIndexName(), conditionIndexes));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | TreeMap<>(String.CASE_INSENSITIVE_ORDER); |
1,041,378 | private void exportTasks(Map<Integer, net.sf.mpxj.Task> id2mpxjTask) throws MPXJException {<NEW_LINE>// Map<CustomPropertyDefinition, FieldType> customProperty_fieldType = new HashMap<CustomPropertyDefinition, FieldType>();<NEW_LINE>// collectCustomProperties(getTaskManager().getCustomPropertyManager(), customProperty_fieldType, TaskField.class);<NEW_LINE>Map<CustomPropertyDefinition, FieldType> customProperty_fieldType = CustomPropertyMapping.buildMapping(getTaskManager());<NEW_LINE>exportCustomFieldTypes(customProperty_fieldType);<NEW_LINE>net.sf.mpxj.<MASK><NEW_LINE>rootTask.setEffortDriven(false);<NEW_LINE>rootTask.setID(0);<NEW_LINE>rootTask.setUniqueID(0);<NEW_LINE>rootTask.setOutlineLevel(0);<NEW_LINE>rootTask.setWBS("0");<NEW_LINE>rootTask.setOutlineNumber("0");<NEW_LINE>rootTask.setStart(convertStartTime(getTaskManager().getProjectStart()));<NEW_LINE>rootTask.setFinish(convertFinishTime(getTaskManager().getProjectEnd()));<NEW_LINE>rootTask.setDuration(convertDuration(getTaskManager().createLength(getTaskManager().getRootTask().getDuration().getTimeUnit(), getTaskManager().getProjectStart(), getTaskManager().getProjectEnd())));<NEW_LINE>// rootTask.setDurationFormat(TimeUnit.DAYS);<NEW_LINE>rootTask.setTaskMode(TaskMode.AUTO_SCHEDULED);<NEW_LINE>int i = 0;<NEW_LINE>for (Task t : getTaskHierarchy().getNestedTasks(getTaskHierarchy().getRootTask())) {<NEW_LINE>exportTask(t, null, 1, ++i, id2mpxjTask, customProperty_fieldType);<NEW_LINE>}<NEW_LINE>} | Task rootTask = myOutputProject.addTask(); |
1,221,477 | public <T extends IBaseResource> T doParseResource(Class<T> theResourceType, Reader theReader) throws DataFormatException {<NEW_LINE>// We can only parse to bundles.<NEW_LINE>if ((theResourceType != null) && (!(IBaseBundle.class.isAssignableFrom(theResourceType)))) {<NEW_LINE>throw new DataFormatException(Msg.code(1834) + "NDJsonParser can only parse to Bundle types. Received " + theResourceType.getName());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// Now we go through line-by-line parsing the JSON and then stuffing it into a bundle.<NEW_LINE>BundleBuilder myBuilder = new BundleBuilder(myFhirContext);<NEW_LINE>myBuilder.setType("collection");<NEW_LINE>BufferedReader myBufferedReader = new BufferedReader(theReader);<NEW_LINE>String jsonString = myBufferedReader.readLine();<NEW_LINE>while (jsonString != null) {<NEW_LINE>// And add it to a collection in a Bundle.<NEW_LINE>// The string must be trimmed, as per the NDJson spec 3.2<NEW_LINE>myBuilder.addCollectionEntry(myJsonParser.parseResource(jsonString.trim()));<NEW_LINE>// Try to read another line.<NEW_LINE>jsonString = myBufferedReader.readLine();<NEW_LINE>}<NEW_LINE>return (T) myBuilder.getBundle();<NEW_LINE>} catch (IOException err) {<NEW_LINE>throw new DataFormatException(Msg.code(1835<MASK><NEW_LINE>}<NEW_LINE>} | ) + err.getMessage()); |
1,735,182 | public static void drawHorizontalMarginString(Graphics2D g, Color stringColor, String string, boolean isReference, int x1, int x2, int y) {<NEW_LINE>if (stringColor != null) {<NEW_LINE>g.setColor(stringColor);<NEW_LINE>}<NEW_LINE>if (string != null) {<NEW_LINE>Font previousFont = g.getFont();<NEW_LINE>g.setFont(sFont);<NEW_LINE>FontMetrics metrics = g.getFontMetrics();<NEW_LINE>Rectangle2D rect = <MASK><NEW_LINE>float sx = (float) ((x1 + x2) / 2 - rect.getWidth() / 2);<NEW_LINE>float sy = (float) (y - MARGIN_SPACING - metrics.getDescent());<NEW_LINE>if (isReference) {<NEW_LINE>g.setFont(sFontReference);<NEW_LINE>}<NEW_LINE>g.drawString(string, sx, sy);<NEW_LINE>g.setFont(previousFont);<NEW_LINE>}<NEW_LINE>} | metrics.getStringBounds(string, g); |
1,718,126 | private void loadNode623() {<NEW_LINE>BaseDataVariableTypeNode node = new BaseDataVariableTypeNode(this.context, Identifiers.SessionDiagnosticsVariableType_ServerUri, new QualifiedName(0, "ServerUri"), new LocalizedText("en", "ServerUri"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.String, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.SessionDiagnosticsVariableType_ServerUri, Identifiers.HasTypeDefinition, Identifiers.BaseDataVariableType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.SessionDiagnosticsVariableType_ServerUri, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.SessionDiagnosticsVariableType_ServerUri, Identifiers.HasComponent, Identifiers.SessionDiagnosticsVariableType.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | (1), 0.0, false); |
13,608 | private void startDLCluster() {<NEW_LINE>System.out.println("Starting DL cluster...");<NEW_LINE>try {<NEW_LINE>mlContext = DLClusterUtils.makeMLContext(taskId, mlConfig, ExecutionMode.TRAIN);<NEW_LINE>Map<String, String<MASK><NEW_LINE>String workDir = properties.get(MLConstants.WORK_DIR);<NEW_LINE>DLClusterUtils.setMLContextIpPorts(taskId, mlContext, taskIpPorts);<NEW_LINE>prepareExternalFiles(mlContext, workDir);<NEW_LINE>// Update external files-related properties according to workDir<NEW_LINE>{<NEW_LINE>String pythonEnv = properties.get(DLConstants.PYTHON_ENV);<NEW_LINE>if (StringUtils.isNullOrWhitespaceOnly(pythonEnv)) {<NEW_LINE>Version version = Version.valueOf(properties.get(DLConstants.ENV_VERSION));<NEW_LINE>LOG.info(String.format("Use pythonEnv from plugin: %s", version));<NEW_LINE>pythonEnv = DLEnvConfig.getDefaultPythonEnv(version);<NEW_LINE>properties.put(MLConstants.VIRTUAL_ENV_DIR, pythonEnv.substring("file://".length()));<NEW_LINE>} else {<NEW_LINE>if (PythonFileUtils.isLocalFile(pythonEnv)) {<NEW_LINE>properties.put(MLConstants.VIRTUAL_ENV_DIR, pythonEnv.substring("file://".length()));<NEW_LINE>} else {<NEW_LINE>properties.put(MLConstants.VIRTUAL_ENV_DIR, new File(workDir, pythonEnv).getAbsolutePath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String entryScriptFileName = PythonFileUtils.getFileName(properties.get(DLConstants.ENTRY_SCRIPT));<NEW_LINE>mlContext.setPythonDir(new File(workDir).toPath());<NEW_LINE>mlContext.setPythonFiles(new String[] { new File(workDir, entryScriptFileName).getAbsolutePath() });<NEW_LINE>}<NEW_LINE>Tuple3<DataExchange<Row, Row>, FutureTask<Void>, Thread> dataExchangeFutureTaskThreadTuple3 = DLClusterUtils.startDLCluster(mlContext);<NEW_LINE>dataExchange = dataExchangeFutureTaskThreadTuple3.f0;<NEW_LINE>serverFuture = dataExchangeFutureTaskThreadTuple3.f1;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new RuntimeException("Start TF cluster failed: ", ex);<NEW_LINE>}<NEW_LINE>} | > properties = mlConfig.getProperties(); |
1,627,732 | public void process(List<AddRemoveListItem<T>> addRemoveList, TableData<T> tableData, TaskMonitor monitor) throws CancelledException {<NEW_LINE>int n = addRemoveList.size();<NEW_LINE>monitor.setMessage("Adding/Removing " + n + " items...");<NEW_LINE>monitor.initialize(n);<NEW_LINE>Set<T> failedToRemove = new HashSet<>();<NEW_LINE>// Note: this class does not directly perform a binary search, but instead relies on that<NEW_LINE>// work to be done by the call to TableData.remove()<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>AddRemoveListItem<T> item = addRemoveList.get(i);<NEW_LINE>T value = item.getValue();<NEW_LINE>if (item.isChange()) {<NEW_LINE>tableData.remove(value);<NEW_LINE>tableData.insert(value);<NEW_LINE>} else if (item.isRemove()) {<NEW_LINE>if (!tableData.remove(value)) {<NEW_LINE>failedToRemove.add(value);<NEW_LINE>}<NEW_LINE>} else if (item.isAdd()) {<NEW_LINE>tableData.insert(value);<NEW_LINE>}<NEW_LINE>monitor.checkCanceled();<NEW_LINE>monitor.setProgress(i);<NEW_LINE>}<NEW_LINE>if (!failedToRemove.isEmpty()) {<NEW_LINE>int size = failedToRemove.size();<NEW_LINE>String message = size == 1 ? "1 deleted item..." : size + " deleted items...";<NEW_LINE><MASK><NEW_LINE>tableData.process((data, sortContext) -> {<NEW_LINE>return expungeLostItems(failedToRemove, data, sortContext);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>monitor.setMessage("Done adding/removing");<NEW_LINE>} | monitor.setMessage("Removing " + message); |
750,716 | public ResponseData<Boolean> removeDataBucketItem(String bucketId, boolean force, WeIdPrivateKey privateKey) {<NEW_LINE>try {<NEW_LINE>logger.info("[remove] remove Bucket Item, bucketId is {}, force is {}.", bucketId, force);<NEW_LINE>TransactionReceipt receipt = getDataBucket(privateKey.getPrivateKey()).removeDataBucketItem(bucketId, force).send();<NEW_LINE>if (StringUtils.equals(receipt.getStatus(), ParamKeyConstant.TRNSACTION_RECEIPT_STATUS_SUCCESS)) {<NEW_LINE>logger.info("[remove] remove Bucket Item from chain success, bucketId is {}.", bucketId);<NEW_LINE>ErrorCode code = analysisErrorCode(receipt);<NEW_LINE>return new ResponseData<Boolean>(code == ErrorCode.SUCCESS, code);<NEW_LINE>}<NEW_LINE>logger.error("[remove] remove Bucket Item from chain fail, bucketId is {}.", bucketId);<NEW_LINE>return new ResponseData<Boolean<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("[remove] remove Bucket Item from chain has excpetion, bucketId is {}, exception:", bucketId, e);<NEW_LINE>return new ResponseData<Boolean>(false, ErrorCode.UNKNOW_ERROR);<NEW_LINE>}<NEW_LINE>} | >(false, ErrorCode.TRANSACTION_EXECUTE_ERROR); |
242,621 | private static void applyComments(ClassNode cls, List<ICodeComment> clsComments) {<NEW_LINE>for (ICodeComment comment : clsComments) {<NEW_LINE><MASK><NEW_LINE>switch(nodeRef.getType()) {<NEW_LINE>case CLASS:<NEW_LINE>addComment(cls, comment.getComment());<NEW_LINE>break;<NEW_LINE>case FIELD:<NEW_LINE>FieldNode fieldNode = cls.searchFieldByShortId(nodeRef.getShortId());<NEW_LINE>if (fieldNode == null) {<NEW_LINE>LOG.warn("Field reference not found: {}", nodeRef);<NEW_LINE>} else {<NEW_LINE>addComment(fieldNode, comment.getComment());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case METHOD:<NEW_LINE>MethodNode methodNode = cls.searchMethodByShortId(nodeRef.getShortId());<NEW_LINE>if (methodNode == null) {<NEW_LINE>LOG.warn("Method reference not found: {}", nodeRef);<NEW_LINE>} else {<NEW_LINE>IJavaCodeRef codeRef = comment.getCodeRef();<NEW_LINE>if (codeRef == null) {<NEW_LINE>addComment(methodNode, comment.getComment());<NEW_LINE>} else {<NEW_LINE>processCustomAttach(methodNode, codeRef, comment);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | IJavaNodeRef nodeRef = comment.getNodeRef(); |
1,656,331 | private String[] initProperties() {<NEW_LINE>List<String> props = new ArrayList<>();<NEW_LINE>props.add(createPropertyKey(P.TYPE));<NEW_LINE>props.add(createPropertyKey(P.NAME));<NEW_LINE>props.add(createPropertyKey(P.CALLABLE));<NEW_LINE>props.add(createPropertyKey(P.DESCRIPTION));<NEW_LINE>props.add(createPropertyKey(P.CONTEXT));<NEW_LINE>props.add(createPropertyKey(P.STATUS, DataType.BYTE));<NEW_LINE>props.add(createPropertyKey(P.PROGRESS, DataType.INT));<NEW_LINE>props.add(createPropertyKey(P.CREATE, DataType.DATE));<NEW_LINE>props.add(createPropertyKey(P.UPDATE, DataType.DATE));<NEW_LINE>props.add(createPropertyKey(P.RETRIES, DataType.INT));<NEW_LINE>props.add(createPropertyKey(P.INPUT, DataType.BLOB));<NEW_LINE>props.add(createPropertyKey(P.RESULT, DataType.BLOB));<NEW_LINE>props.add(createPropertyKey(P.DEPENDENCIES, DataType.LONG, Cardinality.SET));<NEW_LINE>props.add(createPropertyKey(P.SERVER));<NEW_LINE>return props.<MASK><NEW_LINE>} | toArray(new String[0]); |
371,143 | private String findMainClass(IJavaProject javaProject) throws Exception {<NEW_LINE>ArrayList<IJavaElement> srcs = new ArrayList<IJavaElement>();<NEW_LINE>for (IClasspathEntry entry : javaProject.getResolvedClasspath(true)) {<NEW_LINE>if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {<NEW_LINE>for (IPackageFragmentRoot root : javaProject.findPackageFragmentRoots(entry)) {<NEW_LINE>srcs.add(root);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final ArrayList<IMethod> methods <MASK><NEW_LINE>int context = IJavaSearchConstants.DECLARATIONS;<NEW_LINE>int type = IJavaSearchConstants.METHOD;<NEW_LINE>int matchType = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;<NEW_LINE>IJavaSearchScope scope = SearchEngine.createJavaSearchScope(srcs.toArray(new IJavaElement[srcs.size()]));<NEW_LINE>SearchPattern pattern = SearchPattern.createPattern("main(String[])", type, context, matchType);<NEW_LINE>SearchRequestor requestor = new SearchRequestor() {<NEW_LINE><NEW_LINE>public void acceptSearchMatch(SearchMatch match) {<NEW_LINE>if (match.getAccuracy() != SearchMatch.A_ACCURATE) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>IMethod method = (IMethod) match.getElement();<NEW_LINE>String[] params = method.getParameterTypes();<NEW_LINE>if (params.length != 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!Signature.SIG_VOID.equals(method.getReturnType())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int flags = method.getFlags();<NEW_LINE>if (!Flags.isPublic(flags) || !Flags.isStatic(flags)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>methods.add(method);<NEW_LINE>} catch (JavaModelException e) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>SearchEngine engine = new SearchEngine();<NEW_LINE>SearchParticipant[] participants = new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };<NEW_LINE>engine.search(pattern, participants, scope, requestor, null);<NEW_LINE>// if we found only 1 result, we can use it.<NEW_LINE>if (methods.size() == 1) {<NEW_LINE>IMethod method = methods.get(0);<NEW_LINE>ICompilationUnit cu = method.getCompilationUnit();<NEW_LINE>IPackageDeclaration[] packages = cu.getPackageDeclarations();<NEW_LINE>if (packages != null && packages.length > 0) {<NEW_LINE>return packages[0].getElementName() + "." + cu.getElementName();<NEW_LINE>}<NEW_LINE>return cu.getElementName();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | = new ArrayList<IMethod>(); |
1,224,925 | public void execute() throws BuildException {<NEW_LINE>try {<NEW_LINE>// XXX workaround for http://issues.apache.org/bugzilla/show_bug.cgi?id=43398<NEW_LINE>pseudoTests = new LinkedHashMap<>();<NEW_LINE>if (getProject().getProperty("allmodules") != null) {<NEW_LINE>modules = new TreeSet<>(Arrays.asList(getProject().getProperty("allmodules").split("[, ]+")));<NEW_LINE>modules.add("nbbuild");<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>modules = new TreeSet<>(Files.walk(nbAllPath).filter(p -> Files.exists(p.resolve("external/binaries-list"))).map(p -> nbAllPath.relativize(p)).map(p -> p.toString()).collect(Collectors.toSet()));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>testNoStrayThirdPartyBinaries();<NEW_LINE>testLicenseFilesAreProperlyFormattedPhysically();<NEW_LINE>testLicenses();<NEW_LINE>testBinaryUniqueness();<NEW_LINE>testLicenseinfo();<NEW_LINE>} catch (IOException x) {<NEW_LINE>throw new BuildException(x, getLocation());<NEW_LINE>}<NEW_LINE>JUnitReportWriter.writeReport(this, null, reportFile, pseudoTests);<NEW_LINE>if (haltonfailure && pseudoTests.values().stream().anyMatch(err -> err != null)) {<NEW_LINE>throw new BuildException("Failed VerifyLibsAndLicenses test(s):\n" + pseudoTests.values().stream().filter(err -> err != null).collect(Collectors.joining("\n")), getLocation());<NEW_LINE>}<NEW_LINE>} catch (NullPointerException | IOException x) {<NEW_LINE>x.printStackTrace();<NEW_LINE>throw new BuildException(x);<NEW_LINE>}<NEW_LINE>} | Path nbAllPath = nball.toPath(); |
1,195,503 | public void registerFactories() {<NEW_LINE>//<NEW_LINE>// Register payment action handlers.<NEW_LINE>final IESRImportBL esrImportBL = Services.get(IESRImportBL.class);<NEW_LINE>esrImportBL.registerActionHandler(X_ESR_ImportLine.ESR_PAYMENT_ACTION_Write_Off_Amount, new WriteoffESRActionHandler());<NEW_LINE>esrImportBL.registerActionHandler(X_ESR_ImportLine.ESR_PAYMENT_ACTION_Keep_For_Dunning, new DunningESRActionHandler());<NEW_LINE>esrImportBL.registerActionHandler(X_ESR_ImportLine.ESR_PAYMENT_ACTION_Money_Was_Transfered_Back_to_Partner, new MoneyTransferedBackESRActionHandler());<NEW_LINE>esrImportBL.registerActionHandler(X_ESR_ImportLine.ESR_PAYMENT_ACTION_Allocate_Payment_With_Next_Invoice, new WithNextInvoiceESRActionHandler());<NEW_LINE>esrImportBL.registerActionHandler(X_ESR_ImportLine.ESR_PAYMENT_ACTION_Allocate_Payment_With_Current_Invoice, new WithCurrenttInvoiceESRActionHandler());<NEW_LINE>esrImportBL.registerActionHandler(X_ESR_ImportLine.ESR_PAYMENT_ACTION_Unable_To_Assign_Income, new UnableToAssignESRActionHandler());<NEW_LINE>esrImportBL.registerActionHandler(X_ESR_ImportLine.ESR_PAYMENT_ACTION_Discount, new DiscountESRActionHandler());<NEW_LINE>esrImportBL.registerActionHandler(X_ESR_ImportLine.ESR_PAYMENT_ACTION_Duplicate_Payment, new DuplicatePaymentESRActionHandler());<NEW_LINE>//<NEW_LINE>// Register ESR Payment Parsers<NEW_LINE>final IPaymentStringParserFactory paymentStringParserFactory = <MASK><NEW_LINE>paymentStringParserFactory.registerParser(PaymentParserType.ESRRegular.getType(), ESRRegularLineParser.instance);<NEW_LINE>paymentStringParserFactory.registerParser(PaymentParserType.ESRCreaLogix.getType(), ESRCreaLogixStringParser.instance);<NEW_LINE>paymentStringParserFactory.registerParser(PaymentParserType.QRCode.getType(), new QRCodeStringParser());<NEW_LINE>//<NEW_LINE>// Payment batch provider for Bank Statement matching<NEW_LINE>Services.get(IPaymentBatchFactory.class).addPaymentBatchProvider(new ESRPaymentBatchProvider());<NEW_LINE>//<NEW_LINE>// Bank statement listener<NEW_LINE>Services.get(IBankStatementListenerService.class).addListener(new ESRBankStatementListener(esrImportBL));<NEW_LINE>//<NEW_LINE>// ESR match listener<NEW_LINE>// 08741<NEW_LINE>Services.get(IESRLineHandlersService.class).registerESRLineListener(new DefaultESRLineHandler());<NEW_LINE>} | Services.get(IPaymentStringParserFactory.class); |
931,613 | static String buildExternalJson(String dsl, CompileOptions options, LogLevel logLevel, Messager messager) throws IOException {<NEW_LINE>File temp = File.createTempFile("annotation-", ".dsl");<NEW_LINE>try {<NEW_LINE>FileOutputStream fos = new FileOutputStream(temp);<NEW_LINE>fos.write(dsl.getBytes());<NEW_LINE>fos.close();<NEW_LINE>DslContext ctx = new DslContext(messager, logLevel);<NEW_LINE>Targets.Option target = options.useAndroid ? Targets.Option.ANDORID_EXTERNAL_JSON : Targets.Option.JAVA_EXTERNAL_JSON;<NEW_LINE>ctx.put("library:" + Targets.Option.JAVA_EXTERNAL_JSON.toString(), "1.9.0");<NEW_LINE>ctx.put(target.toString(), null);<NEW_LINE>ctx.put(DslPath.INSTANCE, temp.getAbsolutePath());<NEW_LINE>ctx.put(DisablePrompt.INSTANCE, null);<NEW_LINE>ctx.put(Settings.Option.SOURCE_ONLY.toString(), null);<NEW_LINE>ctx.put(Settings.Option.MANUAL_JSON.toString(), null);<NEW_LINE>if (options.useJodaTime) {<NEW_LINE>ctx.put(Settings.Option.JODA_TIME.toString(), null);<NEW_LINE>}<NEW_LINE>ctx.put(Namespace.INSTANCE, options.namespace);<NEW_LINE>if (options.compiler != null && options.compiler.length() > 0) {<NEW_LINE>File compiler = new File(options.compiler);<NEW_LINE>if (!compiler.exists()) {<NEW_LINE>throw new ConfigurationException("DSL compiler specified with dsljson.compiler option not found. Check used option: " + options.compiler);<NEW_LINE>} else if (compiler.isDirectory()) {<NEW_LINE>throw new ConfigurationException("DSL compiler specified with dsljson.compiler option is an folder. Please specify file instead: " + options.compiler);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>File compiler = new File("dsl-compiler.exe");<NEW_LINE>if (!compiler.exists()) {<NEW_LINE>ctx.put(Download.INSTANCE, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ctx.put(DslCompiler.INSTANCE, options.compiler);<NEW_LINE>List<CompileParameter> parameters = Main.initializeParameters(ctx, ".");<NEW_LINE>if (!Main.processContext(ctx, parameters)) {<NEW_LINE>if (logLevel != LogLevel.DEBUG) {<NEW_LINE>throw new ConfigurationException("Unable to setup DSL-JSON processing environment. Specify dsljson.loglevel=DEBUG for more information.");<NEW_LINE>} else {<NEW_LINE>throw new ConfigurationException("Unable to setup DSL-JSON processing environment. Inspect javac output log for more information.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>File projectPath = TempPath.getTempProjectPath(ctx);<NEW_LINE>File rootPackage = new File(new File(projectPath, target.name<MASK><NEW_LINE>File jsonFolder = new File(rootPackage, "json");<NEW_LINE>Either<String> content = Utils.readFile(new File(jsonFolder, "ExternalSerialization.java"));<NEW_LINE>if (!content.isSuccess()) {<NEW_LINE>throw new ConfigurationException(content.whyNot());<NEW_LINE>}<NEW_LINE>return content.get();<NEW_LINE>} finally {<NEW_LINE>if (!temp.delete() && logLevel != LogLevel.NONE) {<NEW_LINE>messager.printMessage(Diagnostic.Kind.WARNING, "Unable to delete temporary file: " + temp.getAbsolutePath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ()), options.namespace); |
523,482 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.ExtendableMessage<com.google.transit.realtime.GtfsRealtime.VehiclePosition.CarriageDetails>.ExtensionWriter extensionWriter = newExtensionWriter();<NEW_LINE>if (((bitField0_ & 0x00000001) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) != 0)) {<NEW_LINE>com.google.protobuf.GeneratedMessageV3.writeString(output, 2, label_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) != 0)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) != 0)) {<NEW_LINE>output.writeInt32(4, occupancyPercentage_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000010) != 0)) {<NEW_LINE>output.writeUInt32(5, carriageSequence_);<NEW_LINE>}<NEW_LINE>extensionWriter.writeUntil(2000, output);<NEW_LINE>extensionWriter.writeUntil(10000, output);<NEW_LINE>unknownFields.writeTo(output);<NEW_LINE>} | output.writeEnum(3, occupancyStatus_); |
698,926 | public Map<String, Object> saveFileAction(String selectedItem, String wfActionAssign, String wfActionId, String wfActionComments, String wfConId, String wfPublishDate, String wfPublishTime, String wfExpireDate, String wfExpireTime, String wfNeverExpire, String whereToSend, String forcePush, String pathToMove) throws DotSecurityException, ServletException {<NEW_LINE>WebContext ctx = WebContextFactory.get();<NEW_LINE>User user = getUser(ctx.getHttpServletRequest());<NEW_LINE>Contentlet contentlet = null;<NEW_LINE>Map<String, Object> result = new HashMap<String, Object>();<NEW_LINE>WorkflowAPI wapi = APILocator.getWorkflowAPI();<NEW_LINE>try {<NEW_LINE>WorkflowAction action = wapi.findAction(wfActionId, user);<NEW_LINE>if (action == null) {<NEW_LINE>throw new ServletException("No such workflow action");<NEW_LINE>}<NEW_LINE>contentlet = APILocator.getContentletAPI().<MASK><NEW_LINE>contentlet.setStringProperty("wfActionId", action.getId());<NEW_LINE>contentlet.setStringProperty("wfActionComments", wfActionComments);<NEW_LINE>contentlet.setStringProperty("wfActionAssign", wfActionAssign);<NEW_LINE>contentlet.setStringProperty("wfPublishDate", wfPublishDate);<NEW_LINE>contentlet.setStringProperty("wfPublishTime", wfPublishTime);<NEW_LINE>contentlet.setStringProperty("wfExpireDate", wfExpireDate);<NEW_LINE>contentlet.setStringProperty("wfExpireTime", wfExpireTime);<NEW_LINE>contentlet.setStringProperty("wfNeverExpire", wfNeverExpire);<NEW_LINE>contentlet.setStringProperty("whereToSend", whereToSend);<NEW_LINE>contentlet.setStringProperty("forcePush", forcePush);<NEW_LINE>if (UtilMethods.isSet(pathToMove)) {<NEW_LINE>contentlet.setProperty(Contentlet.PATH_TO_MOVE, pathToMove);<NEW_LINE>}<NEW_LINE>contentlet.setTags();<NEW_LINE>wapi.fireWorkflowNoCheckin(contentlet, user);<NEW_LINE>result.put("status", "success");<NEW_LINE>result.put("message", UtilMethods.escapeSingleQuotes(LanguageUtil.get(user, "Workflow-executed")));<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(BrowserAjax.class, e.getMessage(), e);<NEW_LINE>result.put("status", "error");<NEW_LINE>try {<NEW_LINE>result.put("message", UtilMethods.escapeSingleQuotes(LanguageUtil.get(user, "Workflow-action-execution-error") + " " + e.getMessage()));<NEW_LINE>} catch (LanguageException le) {<NEW_LINE>Logger.error(BrowserAjax.class, le.getMessage(), le);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | find(wfConId, user, false); |
1,286,393 | final StopEngagementResult executeStopEngagement(StopEngagementRequest stopEngagementRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(stopEngagementRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StopEngagementRequest> request = null;<NEW_LINE>Response<StopEngagementResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new StopEngagementRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(stopEngagementRequest));<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, "SSM Contacts");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StopEngagement");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StopEngagementResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StopEngagementResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
686,655 | private void doMarkInstance(ClusterShardHostPort clusterShardHostPort, boolean state) throws OuterClientException {<NEW_LINE>try {<NEW_LINE>catTransactionMonitor.logTransaction(TYPE, String.format("doMarkInstance-%s-%s", clusterShardHostPort, state), new Task() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void go() throws Exception {<NEW_LINE>logger.info("[doMarkInstance][begin]{},{}", clusterShardHostPort, state);<NEW_LINE>String address = CREDIS_SERVICE.SWITCH_STATUS.getRealPath(credisConfig.getCredisServiceAddress());<NEW_LINE>String cluster = clusterShardHostPort.getClusterName();<NEW_LINE>HostPort hostPort = clusterShardHostPort.getHostPort();<NEW_LINE>MarkInstanceResponse response = restOperations.postForObject(address + "?clusterName={cluster}&ip={ip}&port={port}&canRead={canRead}", null, MarkInstanceResponse.class, cluster, hostPort.getHost(), hostPort.getPort(), state);<NEW_LINE>logger.info(<MASK><NEW_LINE>if (!response.isSuccess()) {<NEW_LINE>throw new IllegalStateException(String.format("%s %s, response:%s", clusterShardHostPort, state, response));<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Map getData() {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new OuterClientException("mark:" + clusterShardHostPort + ":" + state, e);<NEW_LINE>}<NEW_LINE>} | "[doMarkInstance][ end ]{},{},{}", clusterShardHostPort, state, response); |
1,777,080 | private List<Writable> rowToRecord(Row currRow) {<NEW_LINE>if (numColumns < 0) {<NEW_LINE>numColumns = currRow.getLastCellNum();<NEW_LINE>}<NEW_LINE>if (currRow.getLastCellNum() != numColumns) {<NEW_LINE>throw new IllegalStateException("Invalid number of columns for row. First number of columns found was " + numColumns + " but row " + currRow.getRowNum() + " was " + currRow.getLastCellNum());<NEW_LINE>}<NEW_LINE>List<Writable> ret = new ArrayList<>(currRow.getLastCellNum());<NEW_LINE>for (Cell cell : currRow) {<NEW_LINE>String cellValue = dataFormatter.formatCellValue(cell);<NEW_LINE>switch(cell.getCellType()) {<NEW_LINE>case BLANK:<NEW_LINE>ret.add(new Text(""));<NEW_LINE>break;<NEW_LINE>case STRING:<NEW_LINE>ret.add(new Text(""));<NEW_LINE>break;<NEW_LINE>case BOOLEAN:<NEW_LINE>ret.add(new BooleanWritable(Boolean.valueOf(cellValue)));<NEW_LINE>break;<NEW_LINE>case NUMERIC:<NEW_LINE>ret.add(new DoubleWritable(<MASK><NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>ret.add(new Text(cellValue));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | Double.parseDouble(cellValue))); |
892,495 | private void deleteAliasesAndModel(DeleteTrainedModelAction.Request request, List<String> modelAliases, ActionListener<AcknowledgedResponse> listener) {<NEW_LINE>logger.debug(() -> new ParameterizedMessage("[{}] Deleting model", request.getId()));<NEW_LINE>ActionListener<AcknowledgedResponse> nameDeletionListener = ActionListener.wrap(ack -> trainedModelProvider.deleteTrainedModel(request.getId(), ActionListener.wrap(r -> {<NEW_LINE>auditor.info(request.getId(), "trained model deleted");<NEW_LINE>listener.onResponse(AcknowledgedResponse.TRUE);<NEW_LINE>}, listener::onFailure)), listener::onFailure);<NEW_LINE>// No reason to update cluster state, simply delete the model<NEW_LINE>if (modelAliases.isEmpty()) {<NEW_LINE>nameDeletionListener.onResponse(AcknowledgedResponse.of(true));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>clusterService.submitStateUpdateTask("delete-trained-model-alias", new AckedClusterStateUpdateTask(request, nameDeletionListener) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ClusterState execute(final ClusterState currentState) {<NEW_LINE>final ClusterState.Builder <MASK><NEW_LINE>final ModelAliasMetadata currentMetadata = ModelAliasMetadata.fromState(currentState);<NEW_LINE>if (currentMetadata.modelAliases().isEmpty()) {<NEW_LINE>return currentState;<NEW_LINE>}<NEW_LINE>final Map<String, ModelAliasMetadata.ModelAliasEntry> newMetadata = new HashMap<>(currentMetadata.modelAliases());<NEW_LINE>logger.info("[{}] delete model model_aliases {}", request.getId(), modelAliases);<NEW_LINE>modelAliases.forEach(newMetadata::remove);<NEW_LINE>final ModelAliasMetadata modelAliasMetadata = new ModelAliasMetadata(newMetadata);<NEW_LINE>builder.metadata(Metadata.builder(currentState.getMetadata()).putCustom(ModelAliasMetadata.NAME, modelAliasMetadata).build());<NEW_LINE>return builder.build();<NEW_LINE>}<NEW_LINE>}, newExecutor());<NEW_LINE>} | builder = ClusterState.builder(currentState); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.