idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,210,391 | public void run() {<NEW_LINE>if (!lock.getLock()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (log.isTraceEnable()) {<NEW_LINE>log.info(this, "NodeInfoWatcher RUN START.");<NEW_LINE>}<NEW_LINE>Map<String, String> data = cm.getHashAll(UAV_CACHE_REGION, "node.info");<NEW_LINE>if (!lock.isLockInHand()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (data == null || data.size() == 0) {<NEW_LINE>lock.releaseLock();<NEW_LINE>if (log.isTraceEnable()) {<NEW_LINE>log.info(this, "NodeInfoWatcher RUN END as No Data");<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isFrozen()) {<NEW_LINE>if (log.isDebugEnable()) {<NEW_LINE>log.debug(this, "NodeInfoWatcher is in frozen time.");<NEW_LINE>}<NEW_LINE>lock.releaseLock();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Map<String, Object>> mdflist = syncProcInfoToCache(data);<NEW_LINE>judgeProcCrash(data);<NEW_LINE>if (isExchange) {<NEW_LINE>exchangeToRuntimeNotify<MASK><NEW_LINE>}<NEW_LINE>if (isSendMq) {<NEW_LINE>sendToMQ(mdflist);<NEW_LINE>}<NEW_LINE>freezeTime();<NEW_LINE>lock.releaseLock();<NEW_LINE>} | (JSONHelper.toString(mdflist)); |
329,086 | public void flash() {<NEW_LINE>HashMap<String, String> variables = new HashMap<>();<NEW_LINE>//<NEW_LINE>variables.put("tx_isolation", Objects.toString(tx_isolation));<NEW_LINE>//<NEW_LINE>variables.put("transaction_isolation", transaction_isolation);<NEW_LINE>variables.put("auto_increment_increment", Objects.toString(auto_increment_increment));<NEW_LINE>variables.put("net_write_timeout", Objects.toString(net_write_timeout));<NEW_LINE>variables.put("local.character_set_results", Objects.toString(local_character_set_results));<NEW_LINE>//<NEW_LINE>variables.put("character_set_client", character_set_client);<NEW_LINE>//<NEW_LINE>variables.put("character_set_connection", character_set_connection);<NEW_LINE>//<NEW_LINE>variables.put("character_set_results", character_set_results);<NEW_LINE>//<NEW_LINE>variables.put("character_set_server", character_set_server);<NEW_LINE>//<NEW_LINE>variables.put("init_connect", init_connect);<NEW_LINE>//<NEW_LINE>variables.put("interactive_timeout", Objects.toString(interactive_timeout));<NEW_LINE>variables.put("max_allowed_packet", Objects.toString(max_allowed_packet));<NEW_LINE>variables.put("net_buffer_length", Objects.toString(net_buffer_length));<NEW_LINE>variables.put("query_cache_size", Objects.toString(query_cache_size));<NEW_LINE>variables.put("query_cache_type", Objects.toString(query_cache_type));<NEW_LINE>//<NEW_LINE>variables.put("sql_mode"<MASK><NEW_LINE>//<NEW_LINE>variables.put("system_time_zone", Objects.toString(system_time_zone));<NEW_LINE>//<NEW_LINE>variables.put("time_zone", Objects.toString(time_zone));<NEW_LINE>variables.put("lower_case_table_names", Objects.toString(lower_case_table_names));<NEW_LINE>//<NEW_LINE>variables.put("wait_timeout", Objects.toString(wait_timeout));<NEW_LINE>//<NEW_LINE>variables.put("character_set_system", Objects.toString(character_set_system));<NEW_LINE>//<NEW_LINE>variables.put("collation_server", Objects.toString(collation_server));<NEW_LINE>//<NEW_LINE>variables.put("performance_schema", Objects.toString(performance_schema));<NEW_LINE>this.variables = variables;<NEW_LINE>} | , Objects.toString(sql_mode)); |
549,731 | final GetCompatibleKafkaVersionsResult executeGetCompatibleKafkaVersions(GetCompatibleKafkaVersionsRequest getCompatibleKafkaVersionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getCompatibleKafkaVersionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetCompatibleKafkaVersionsRequest> request = null;<NEW_LINE>Response<GetCompatibleKafkaVersionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetCompatibleKafkaVersionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getCompatibleKafkaVersionsRequest));<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, "Kafka");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetCompatibleKafkaVersions");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetCompatibleKafkaVersionsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetCompatibleKafkaVersionsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,115,775 | public void save(boolean async) {<NEW_LINE>if (this.closed) {<NEW_LINE>throw new IllegalStateException("Tried to save closed player");<NEW_LINE>}<NEW_LINE>super.saveNBT();<NEW_LINE>if (this.level != null) {<NEW_LINE>this.namedTag.putString("Level", this.level.getFolderName());<NEW_LINE>if (this.spawnPosition != null && this.spawnPosition.getLevel() != null) {<NEW_LINE>this.namedTag.putString("SpawnLevel", this.spawnPosition.getLevel().getFolderName());<NEW_LINE>this.namedTag.putInt("SpawnX", (int) this.spawnPosition.x);<NEW_LINE>this.namedTag.putInt("SpawnY", (int) this.spawnPosition.y);<NEW_LINE>this.namedTag.putInt("SpawnZ", (int) this.spawnPosition.z);<NEW_LINE>}<NEW_LINE>CompoundTag achievements = new CompoundTag();<NEW_LINE>for (String achievement : this.achievements) {<NEW_LINE>achievements.putByte(achievement, 1);<NEW_LINE>}<NEW_LINE>this.namedTag.putCompound("Achievements", achievements);<NEW_LINE>this.namedTag.putInt("playerGameType", this.gamemode);<NEW_LINE>this.namedTag.putLong("lastPlayed", System.currentTimeMillis() / 1000);<NEW_LINE>this.namedTag.putString("lastIP", this.getAddress());<NEW_LINE>this.namedTag.putInt(<MASK><NEW_LINE>this.namedTag.putInt("expLevel", this.getExperienceLevel());<NEW_LINE>this.namedTag.putInt("foodLevel", this.getFoodData().getLevel());<NEW_LINE>this.namedTag.putFloat("foodSaturationLevel", this.getFoodData().getFoodSaturationLevel());<NEW_LINE>if (!this.username.isEmpty() && this.namedTag != null) {<NEW_LINE>this.server.saveOfflinePlayerData(this.username, this.namedTag, async);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "EXP", this.getExperience()); |
1,263,084 | private List<Pair<String, MapSqlParameterSource>> collectTicketCategoryMigrationData(String srcPriceCtsParam, boolean eventVatIncluded, BigDecimal vatPercentage, Map<String, Integer> eventIdParam) {<NEW_LINE>return jdbc.queryForList("select id, price_cts from ticket_category where event_id = :eventId and price_cts > 0 and src_price_cts = 0", eventIdParam).stream().map(category -> {<NEW_LINE>int oldCategoryPrice = (int) category.get("price_cts");<NEW_LINE>int categorySrcPrice = eventVatIncluded ? MonetaryUtil.addVAT(oldCategoryPrice, vatPercentage) : oldCategoryPrice;<NEW_LINE>return Pair.of("category", new MapSqlParameterSource(srcPriceCtsParam, categorySrcPrice).addValue("categoryId", <MASK><NEW_LINE>}).collect(toList());<NEW_LINE>} | category.get("id"))); |
1,707,083 | public com.amazonaws.services.iotfleethub.model.ConflictException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.iotfleethub.model.ConflictException conflictException = new com.amazonaws.services.iotfleethub.model.ConflictException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 conflictException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,697,081 | public UpdateJobQueueResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UpdateJobQueueResult updateJobQueueResult = new UpdateJobQueueResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return updateJobQueueResult;<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("jobQueueName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateJobQueueResult.setJobQueueName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("jobQueueArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>updateJobQueueResult.setJobQueueArn(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return updateJobQueueResult;<NEW_LINE>} | class).unmarshall(context)); |
1,071,079 | final ListObjectPoliciesResult executeListObjectPolicies(ListObjectPoliciesRequest listObjectPoliciesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listObjectPoliciesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListObjectPoliciesRequest> request = null;<NEW_LINE>Response<ListObjectPoliciesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListObjectPoliciesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listObjectPoliciesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CloudDirectory");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListObjectPolicies");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListObjectPoliciesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListObjectPoliciesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
1,000,388 | final GetEffectiveRecommendationPreferencesResult executeGetEffectiveRecommendationPreferences(GetEffectiveRecommendationPreferencesRequest getEffectiveRecommendationPreferencesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getEffectiveRecommendationPreferencesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetEffectiveRecommendationPreferencesRequest> request = null;<NEW_LINE>Response<GetEffectiveRecommendationPreferencesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetEffectiveRecommendationPreferencesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getEffectiveRecommendationPreferencesRequest));<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, "Compute Optimizer");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetEffectiveRecommendationPreferences");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetEffectiveRecommendationPreferencesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetEffectiveRecommendationPreferencesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
185,000 | public void init(MonthDescriptor month, List<List<MonthCellDescriptor>> cells, boolean displayOnly, Typeface titleTypeface, Typeface dateTypeface) {<NEW_LINE>Logr.d("Initializing MonthView (%d) for %s", System.identityHashCode(this), month);<NEW_LINE>long start = System.currentTimeMillis();<NEW_LINE>title.setText(month.getLabel());<NEW_LINE>NumberFormat numberFormatter;<NEW_LINE>if (alwaysDigitNumbers) {<NEW_LINE>numberFormatter = NumberFormat.getInstance(Locale.US);<NEW_LINE>} else {<NEW_LINE>numberFormatter = NumberFormat.getInstance(locale);<NEW_LINE>}<NEW_LINE>final int numRows = cells.size();<NEW_LINE>grid.setNumRows(numRows);<NEW_LINE>for (int i = 0; i < 6; i++) {<NEW_LINE>CalendarRowView weekRow = (CalendarRowView) grid.getChildAt(i + 1);<NEW_LINE>weekRow.setListener(listener);<NEW_LINE>if (i < numRows) {<NEW_LINE>weekRow.setVisibility(VISIBLE);<NEW_LINE>List<MonthCellDescriptor> week = cells.get(i);<NEW_LINE>for (int c = 0; c < week.size(); c++) {<NEW_LINE>MonthCellDescriptor cell = week.get(isRtl ? 6 - c : c);<NEW_LINE>CalendarCellView cellView = (CalendarCellView) weekRow.getChildAt(c);<NEW_LINE>String cellDate = numberFormatter.format(cell.getValue());<NEW_LINE>if (!cellView.getDayOfMonthTextView().getText().equals(cellDate)) {<NEW_LINE>cellView.getDayOfMonthTextView().setText(cellDate);<NEW_LINE>}<NEW_LINE>cellView.setEnabled(cell.isCurrentMonth());<NEW_LINE>cellView.setClickable(!displayOnly);<NEW_LINE>cellView.setSelectable(cell.isSelectable());<NEW_LINE>cellView.setSelected(cell.isSelected());<NEW_LINE>cellView.setCurrentMonth(cell.isCurrentMonth());<NEW_LINE>cellView.setToday(cell.isToday());<NEW_LINE>cellView.setRangeState(cell.getRangeState());<NEW_LINE>cellView.setHighlighted(cell.isHighlighted());<NEW_LINE>cellView.setTag(cell);<NEW_LINE>if (null != decorators) {<NEW_LINE>for (CalendarCellDecorator decorator : decorators) {<NEW_LINE>decorator.decorate(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>weekRow.setVisibility(GONE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (titleTypeface != null) {<NEW_LINE>title.setTypeface(titleTypeface);<NEW_LINE>}<NEW_LINE>if (dateTypeface != null) {<NEW_LINE>grid.setTypeface(dateTypeface);<NEW_LINE>}<NEW_LINE>Logr.d("MonthView.init took %d ms", System.currentTimeMillis() - start);<NEW_LINE>} | cellView, cell.getDate()); |
1,417,442 | public int writeHeaderType(DebugContext context, HeaderTypeEntry headerTypeEntry, byte[] buffer, int p) {<NEW_LINE>int pos = p;<NEW_LINE>String name = headerTypeEntry.getTypeName();<NEW_LINE>byte size = (byte) headerTypeEntry.getSize();<NEW_LINE>log(context, " [0x%08x] header type %s", pos, name);<NEW_LINE>setIndirectTypeIndex(headerTypeEntry, pos);<NEW_LINE>int abbrevCode = DwarfDebugInfo.DW_ABBREV_CODE_object_header;<NEW_LINE>log(context, " [0x%08x] <1> Abbrev Number %d", pos, abbrevCode);<NEW_LINE>pos = writeAbbrevCode(abbrevCode, buffer, pos);<NEW_LINE>log(context, " [0x%08x] name 0x%x (%s)", pos, debugStringIndex(name), name);<NEW_LINE>pos = writeAttrStrp(name, buffer, pos);<NEW_LINE>log(context, " [0x%08x] byte_size 0x%x", pos, size);<NEW_LINE>pos = <MASK><NEW_LINE>pos = writeHeaderFields(context, headerTypeEntry, buffer, pos);<NEW_LINE>return writeAttrNull(buffer, pos);<NEW_LINE>} | writeAttrData1(size, buffer, pos); |
1,789,506 | public RestartRequirement onApply(UserPrefs rPrefs) {<NEW_LINE>RestartRequirement restartRequirement = super.onApply(rPrefs);<NEW_LINE>if (dirty_) {<NEW_LINE>JsArrayString panes = JsArrayString.createArray().cast();<NEW_LINE>panes.push(leftTop_.getValue(leftTop_.getSelectedIndex()));<NEW_LINE>panes.push(leftBottom_.getValue(leftBottom_.getSelectedIndex()));<NEW_LINE>panes.push(rightTop_.getValue(rightTop_.getSelectedIndex()));<NEW_LINE>panes.push(rightBottom_.getValue(rightBottom_.getSelectedIndex()));<NEW_LINE>JsArrayString tabSet1 = JsArrayString<MASK><NEW_LINE>for (String tab : tabSet1ModuleList_.getValue()) tabSet1.push(tab);<NEW_LINE>JsArrayString tabSet2 = JsArrayString.createArray().cast();<NEW_LINE>for (String tab : tabSet2ModuleList_.getValue()) tabSet2.push(tab);<NEW_LINE>JsArrayString hiddenTabSet = JsArrayString.createArray().cast();<NEW_LINE>for (String tab : hiddenTabSetModuleList_.getValue()) hiddenTabSet.push(tab);<NEW_LINE>// Determine implicit preference for console top/bottom location<NEW_LINE>// This needs to be saved so that when the user executes the<NEW_LINE>// Console on Left/Right commands we know whether to position<NEW_LINE>// the Console on the Top or Bottom<NEW_LINE>PaneConfig prevConfig = userPrefs_.panes().getGlobalValue().cast();<NEW_LINE>boolean consoleLeftOnTop = prevConfig.getConsoleLeftOnTop();<NEW_LINE>boolean consoleRightOnTop = prevConfig.getConsoleRightOnTop();<NEW_LINE>final String kConsole = "Console";<NEW_LINE>if (panes.get(0).equals(kConsole))<NEW_LINE>consoleLeftOnTop = true;<NEW_LINE>else if (panes.get(1).equals(kConsole))<NEW_LINE>consoleLeftOnTop = false;<NEW_LINE>else if (panes.get(2).equals(kConsole))<NEW_LINE>consoleRightOnTop = true;<NEW_LINE>else if (panes.get(3).equals(kConsole))<NEW_LINE>consoleRightOnTop = false;<NEW_LINE>if (displayColumnCount_ != additionalColumnCount_)<NEW_LINE>additionalColumnCount_ = paneManager_.syncAdditionalColumnCount(displayColumnCount_, true);<NEW_LINE>userPrefs_.panes().setGlobalValue(PaneConfig.create(panes, tabSet1, tabSet2, hiddenTabSet, consoleLeftOnTop, consoleRightOnTop, additionalColumnCount_));<NEW_LINE>dirty_ = false;<NEW_LINE>}<NEW_LINE>return restartRequirement;<NEW_LINE>} | .createArray().cast(); |
862,775 | private byte[] readTileImage(int x, int y, int zoom) {<NEW_LINE>if (mTileBounds != null) {<NEW_LINE>Integer[] bounds = mTileBounds.get(zoom);<NEW_LINE>if (bounds == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (x < bounds[0] || x > bounds[1] || y < bounds[2] || y > bounds[3]) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>FileInputStream in = null;<NEW_LINE>ByteArrayOutputStream buffer = null;<NEW_LINE>try {<NEW_LINE>File tileFile = <MASK><NEW_LINE>if (!tileFile.exists() || !tileFile.canRead()) {<NEW_LINE>Log.d("tiler-response", "Not found: " + tileFile.getAbsolutePath());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>in = new FileInputStream(tileFile);<NEW_LINE>buffer = new ByteArrayOutputStream();<NEW_LINE>int nRead;<NEW_LINE>byte[] data = new byte[BUFFER_SIZE];<NEW_LINE>while ((nRead = in.read(data, 0, BUFFER_SIZE)) != -1) {<NEW_LINE>buffer.write(data, 0, nRead);<NEW_LINE>}<NEW_LINE>buffer.flush();<NEW_LINE>return buffer.toByteArray();<NEW_LINE>} catch (IOException e) {<NEW_LINE>Log.d("AnyPlaceTileProvider", e.getMessage());<NEW_LINE>return null;<NEW_LINE>} catch (OutOfMemoryError e) {<NEW_LINE>Log.d("AnyPlaceTileProvider", e.getMessage());<NEW_LINE>return null;<NEW_LINE>} finally {<NEW_LINE>if (in != null)<NEW_LINE>try {<NEW_LINE>in.close();<NEW_LINE>} catch (Exception ignored) {<NEW_LINE>Log.d("AnyplaceIO", "Cannot close input file of Tile!");<NEW_LINE>}<NEW_LINE>if (buffer != null)<NEW_LINE>try {<NEW_LINE>buffer.close();<NEW_LINE>} catch (Exception ignored) {<NEW_LINE>Log.d("AnyplaceIO", "Cannot close buffer file of Tile!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getTileFile(x, y, zoom); |
215,299 | public int onBackPressed() {<NEW_LINE>logDebug("onBackPressed");<NEW_LINE>parentHandle = adapter.getParentHandle();<NEW_LINE>MegaNode parentNode = megaApi.getParentNode<MASK><NEW_LINE>if (parentNode != null) {<NEW_LINE>boolean parentIsRoot = false;<NEW_LINE>if (parentNode.getType() == MegaNode.TYPE_ROOT) {<NEW_LINE>parentHandle = INVALID_HANDLE;<NEW_LINE>parentIsRoot = true;<NEW_LINE>changeActionBarTitle(context.getString(R.string.file_provider_title).toUpperCase());<NEW_LINE>} else {<NEW_LINE>String path = parentNode.getName();<NEW_LINE>String[] temp;<NEW_LINE>temp = path.split("/");<NEW_LINE>name = temp[temp.length - 1];<NEW_LINE>changeActionBarTitle(name);<NEW_LINE>parentHandle = parentNode.getHandle();<NEW_LINE>}<NEW_LINE>listView.setVisibility(View.VISIBLE);<NEW_LINE>emptyImageView.setVisibility(View.GONE);<NEW_LINE>emptyTextViewFirst.setVisibility(View.GONE);<NEW_LINE>nodes = megaApi.getChildren(parentNode);<NEW_LINE>setNodes(nodes);<NEW_LINE>int lastVisiblePosition = 0;<NEW_LINE>if (!lastPositionStack.empty()) {<NEW_LINE>lastVisiblePosition = lastPositionStack.pop();<NEW_LINE>logDebug("Pop of the stack " + lastVisiblePosition + " position");<NEW_LINE>}<NEW_LINE>logDebug("Scroll to " + lastVisiblePosition + " position");<NEW_LINE>if (lastVisiblePosition >= 0) {<NEW_LINE>mLayoutManager.scrollToPositionWithOffset(lastVisiblePosition, 0);<NEW_LINE>}<NEW_LINE>adapter.setParentHandle(parentHandle);<NEW_LINE>if (context instanceof FileProviderActivity) {<NEW_LINE>((FileProviderActivity) context).setParentHandle(parentHandle);<NEW_LINE>if (parentIsRoot) {<NEW_LINE>((FileProviderActivity) context).hideTabs(false, CLOUD_TAB);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 2;<NEW_LINE>} else {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>} | (megaApi.getNodeByHandle(parentHandle)); |
399,229 | public ExtendedDataSchema convertFromSObject(SExtendedDataSchema input, ExtendedDataSchema result, DatabaseSession session) throws BimserverDatabaseException {<NEW_LINE>if (input == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>result.setName(input.getName());<NEW_LINE>result.setUrl(input.getUrl());<NEW_LINE>result.setContentType(input.getContentType());<NEW_LINE>result.setDescription(input.getDescription());<NEW_LINE>result.setSize(input.getSize());<NEW_LINE>result.setFile((File) session.get(StorePackage.eINSTANCE.getFile(), input.getFileId(), OldQuery.getDefault()));<NEW_LINE>List<User> listusers = result.getUsers();<NEW_LINE>for (long oid : input.getUsers()) {<NEW_LINE>listusers.add((User) session.get(StorePackage.eINSTANCE.getUser(), oid, OldQuery.getDefault()));<NEW_LINE>}<NEW_LINE>List<ExtendedData> listextendedData = result.getExtendedData();<NEW_LINE>for (long oid : input.getExtendedData()) {<NEW_LINE>listextendedData.add((ExtendedData) session.get(StorePackage.eINSTANCE.getExtendedData(), oid<MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | , OldQuery.getDefault())); |
418,380 | public void updateContact(VCard vcard, Long key) throws RemoteException, OperationApplicationException {<NEW_LINE>List<NonEmptyContentValues> contentValues = new ArrayList<NonEmptyContentValues>();<NEW_LINE>convertName(contentValues, vcard);<NEW_LINE>convertNickname(contentValues, vcard);<NEW_LINE>convertPhones(contentValues, vcard);<NEW_LINE>convertEmails(contentValues, vcard);<NEW_LINE>convertAddresses(contentValues, vcard);<NEW_LINE>convertIms(contentValues, vcard);<NEW_LINE>// handle Android Custom fields..This is only valid for Android generated Vcards. As the Android would<NEW_LINE>// generate NickName, ContactEvents other than Birthday and RelationShip with this "X-ANDROID-CUSTOM" name<NEW_LINE>convertCustomFields(contentValues, vcard);<NEW_LINE>// handle Iphone kinda of group properties. which are grouped together.<NEW_LINE>convertGroupedProperties(contentValues, vcard);<NEW_LINE>convertBirthdays(contentValues, vcard);<NEW_LINE>convertWebsites(contentValues, vcard);<NEW_LINE>convertNotes(contentValues, vcard);<NEW_LINE>convertPhotos(contentValues, vcard);<NEW_LINE>convertOrganization(contentValues, vcard);<NEW_LINE>ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(contentValues.size());<NEW_LINE><MASK><NEW_LINE>// ContactsContract.RawContact.CONTENT_URI needed to add account, backReference is also not needed<NEW_LINE>long contactID = key;<NEW_LINE>ContentProviderOperation operation;<NEW_LINE>for (NonEmptyContentValues values : contentValues) {<NEW_LINE>cv = values.getContentValues();<NEW_LINE>if (cv.size() == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String mimeType = cv.getAsString("mimetype");<NEW_LINE>cv.remove("mimetype");<NEW_LINE>// @formatter:off<NEW_LINE>operation = ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI).withSelection(ContactsContract.Data.RAW_CONTACT_ID + " = ? AND " + ContactsContract.Data.MIMETYPE + " = ? ", new String[] { "" + contactID, "" + mimeType }).withValues(cv).build();<NEW_LINE>// @formatter:on<NEW_LINE>operations.add(operation);<NEW_LINE>}<NEW_LINE>// Executing all the insert operations as a single database transaction<NEW_LINE>context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations);<NEW_LINE>} | ContentValues cv = account.getContentValues(); |
227,289 | public void flatMap(Tuple2<Long, Object> value, Collector<Row> out) throws Exception {<NEW_LINE>long nTable = vectorSize + 2L;<NEW_LINE>Timestamp curModelTimestamp = <MASK><NEW_LINE>if (getRuntimeContext().getIndexOfThisSubtask() == 0 && (modelId != value.f0)) {<NEW_LINE>out.collect(Row.of(curModelTimestamp, nTable, -1L, JsonConverter.toJson(new double[] { 0.0 }), null));<NEW_LINE>modelId = value.f0;<NEW_LINE>}<NEW_LINE>Tuple3<Integer, Boolean, Object> model = (Tuple3<Integer, Boolean, Object>) value.f1;<NEW_LINE>if (model.f0 == -1 && model.f2 instanceof String) {<NEW_LINE>out.collect(Row.of(curModelTimestamp, nTable, null, model.f2, null));<NEW_LINE>} else {<NEW_LINE>out.collect(Row.of(curModelTimestamp, nTable, (model.f0).longValue(), JsonConverter.toJson(model.f2), null));<NEW_LINE>}<NEW_LINE>} | new Timestamp(-value.f0); |
141,777 | private void launchApplication(FrameworkStatus frameworkStatus, ApplicationSubmissionContext applicationContext) throws Exception {<NEW_LINE>String frameworkName = frameworkStatus.getFrameworkName();<NEW_LINE>Integer frameworkVersion = frameworkStatus.getFrameworkVersion();<NEW_LINE>String applicationId = frameworkStatus.getApplicationId();<NEW_LINE>String logPrefix = String.format(<MASK><NEW_LINE>// Ensure FrameworkStatus is unchanged.<NEW_LINE>if (!statusManager.containsFramework(frameworkStatus)) {<NEW_LINE>LOGGER.logWarning(logPrefix + "Framework not found in Status. Ignore it.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FrameworkRequest frameworkRequest = requestManager.tryGetFrameworkRequest(frameworkName, frameworkVersion);<NEW_LINE>if (frameworkRequest == null) {<NEW_LINE>LOGGER.logWarning(logPrefix + "Framework not found in Request. Ignore it.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>UserDescriptor user = frameworkRequest.getFrameworkDescriptor().getUser();<NEW_LINE>logPrefix += "SubmitApplication: ";<NEW_LINE>try {<NEW_LINE>LOGGER.logInfo(logPrefix + "ApplicationName: %s", applicationContext.getApplicationName());<NEW_LINE>LOGGER.logInfo(logPrefix + "ResourceRequest: %s", HadoopExts.toString(applicationContext.getAMContainerResourceRequest()));<NEW_LINE>LOGGER.logInfo(logPrefix + "Queue: %s", applicationContext.getQueue());<NEW_LINE>HadoopUtils.submitApplication(applicationContext, user);<NEW_LINE>LOGGER.logInfo(logPrefix + "Succeeded");<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LOGGER.logWarning(e, logPrefix + "Failed");<NEW_LINE>// YarnException indicates exceptions from yarn servers, and IOException indicates exceptions from RPC layer.<NEW_LINE>// So, consider YarnException as NonTransientError, and IOException as TransientError.<NEW_LINE>if (e instanceof YarnException) {<NEW_LINE>retrieveApplicationExitDiagnostics(applicationId, FrameworkExitCode.APP_SUBMISSION_YARN_EXCEPTION.toInt(), CommonUtils.toDiagnostics(e), true);<NEW_LINE>return;<NEW_LINE>} else if (e instanceof IOException) {<NEW_LINE>retrieveApplicationExitDiagnostics(applicationId, FrameworkExitCode.APP_SUBMISSION_IO_EXCEPTION.toInt(), CommonUtils.toDiagnostics(e), true);<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>retrieveApplicationExitDiagnostics(applicationId, FrameworkExitCode.APP_SUBMISSION_UNKNOWN_EXCEPTION.toInt(), CommonUtils.toDiagnostics(e), true);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>statusManager.transitionFrameworkState(frameworkName, FrameworkState.APPLICATION_LAUNCHED);<NEW_LINE>} | "[%s][%s][%s]: launchApplication: ", frameworkName, frameworkVersion, applicationId); |
912,201 | public int addConstraint(String tableName, String constraintClassName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {<NEW_LINE>EXISTING_TABLE_NAME.validate(tableName);<NEW_LINE>TreeSet<Integer> <MASK><NEW_LINE>TreeMap<String, Integer> constraintClasses = new TreeMap<>();<NEW_LINE>int i;<NEW_LINE>for (Entry<String, String> property : this.getProperties(tableName)) {<NEW_LINE>if (property.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.toString())) {<NEW_LINE>try {<NEW_LINE>i = Integer.parseInt(property.getKey().substring(Property.TABLE_CONSTRAINT_PREFIX.toString().length()));<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new AccumuloException("Bad key for existing constraint: " + property);<NEW_LINE>}<NEW_LINE>constraintNumbers.add(i);<NEW_LINE>constraintClasses.put(property.getValue(), i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>i = 1;<NEW_LINE>while (constraintNumbers.contains(i)) i++;<NEW_LINE>if (constraintClasses.containsKey(constraintClassName))<NEW_LINE>throw new AccumuloException("Constraint " + constraintClassName + " already exists for table " + tableName + " with number " + constraintClasses.get(constraintClassName));<NEW_LINE>this.setProperty(tableName, Property.TABLE_CONSTRAINT_PREFIX.toString() + i, constraintClassName);<NEW_LINE>return i;<NEW_LINE>} | constraintNumbers = new TreeSet<>(); |
986,786 | public RichIterable<BooleanIterable> chunk(int size) {<NEW_LINE>if (size <= 0) {<NEW_LINE>throw new IllegalArgumentException("Size for groups must be positive but was: " + size);<NEW_LINE>}<NEW_LINE>MutableList<BooleanIterable> result = Lists.mutable.empty();<NEW_LINE>switch(this.state) {<NEW_LINE>case 0:<NEW_LINE>return result;<NEW_LINE>case 1:<NEW_LINE>result.add(BooleanSets.mutable.with(false));<NEW_LINE>return result;<NEW_LINE>case 2:<NEW_LINE>result.add(BooleanSets.mutable.with(true));<NEW_LINE>return result;<NEW_LINE>case 3:<NEW_LINE>if (size == 1) {<NEW_LINE>result.add(BooleanSets.mutable.with(false));<NEW_LINE>result.add(BooleanSets<MASK><NEW_LINE>} else {<NEW_LINE>result.add(BooleanSets.mutable.with(false, true));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>default:<NEW_LINE>throw new AssertionError("Invalid state");<NEW_LINE>}<NEW_LINE>} | .mutable.with(true)); |
1,721,972 | private static ValgrindError parseErrorTag(SMInputCursor error) throws XMLStreamException {<NEW_LINE>SMInputCursor child = error.childElementCursor();<NEW_LINE>String kind = null;<NEW_LINE>String text = null;<NEW_LINE>var details = new ArrayList<String>();<NEW_LINE>var stacks = new ArrayList<ValgrindStack>();<NEW_LINE>while (child.getNext() != null) {<NEW_LINE>String tagName = child.getLocalName();<NEW_LINE>if ("kind".equalsIgnoreCase(tagName)) {<NEW_LINE>kind = child.getElemStringValue();<NEW_LINE>} else if ("xwhat".equalsIgnoreCase(tagName)) {<NEW_LINE>text = child.childElementCursor("text").advance().getElemStringValue();<NEW_LINE>} else if ("what".equalsIgnoreCase(tagName)) {<NEW_LINE>text = child.getElemStringValue();<NEW_LINE>} else if ("auxwhat".equalsIgnoreCase(tagName)) {<NEW_LINE>details.add(child.getElemStringValue());<NEW_LINE>} else if ("stack".equalsIgnoreCase(tagName)) {<NEW_LINE>stacks<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (text == null || kind == null || stacks.isEmpty()) {<NEW_LINE>var msg = "Valgrind error is incomplete: we require all of 'kind', '*what.text' and 'stack'";<NEW_LINE>child.throwStreamException(msg);<NEW_LINE>}<NEW_LINE>if (!details.isEmpty()) {<NEW_LINE>text = text + ": " + String.join("; ", details);<NEW_LINE>}<NEW_LINE>return new ValgrindError(kind, text, stacks);<NEW_LINE>} | .add(parseStackTag(child)); |
1,521,326 | private static JCExpression cloneType0(JavacTreeMaker maker, JCTree in) {<NEW_LINE>if (in == null)<NEW_LINE>return null;<NEW_LINE>if (in instanceof JCPrimitiveTypeTree) {<NEW_LINE>return maker.TypeIdent(TypeTag.typeTag(in));<NEW_LINE>}<NEW_LINE>if (in instanceof JCIdent) {<NEW_LINE>return maker.Ident(((JCIdent) in).name);<NEW_LINE>}<NEW_LINE>if (in instanceof JCFieldAccess) {<NEW_LINE>JCFieldAccess fa = (JCFieldAccess) in;<NEW_LINE>return maker.Select(cloneType0(maker, fa.selected), fa.name);<NEW_LINE>}<NEW_LINE>if (in instanceof JCArrayTypeTree) {<NEW_LINE>JCArrayTypeTree att = (JCArrayTypeTree) in;<NEW_LINE>return maker.TypeArray(cloneType0(maker, att.elemtype));<NEW_LINE>}<NEW_LINE>if (in instanceof JCTypeApply) {<NEW_LINE>JCTypeApply ta = (JCTypeApply) in;<NEW_LINE>ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>();<NEW_LINE>for (JCExpression typeArg : ta.arguments) {<NEW_LINE>lb.append<MASK><NEW_LINE>}<NEW_LINE>return maker.TypeApply(cloneType0(maker, ta.clazz), lb.toList());<NEW_LINE>}<NEW_LINE>if (in instanceof JCWildcard) {<NEW_LINE>JCWildcard w = (JCWildcard) in;<NEW_LINE>JCExpression newInner = cloneType0(maker, w.inner);<NEW_LINE>TypeBoundKind newKind;<NEW_LINE>switch(w.getKind()) {<NEW_LINE>case SUPER_WILDCARD:<NEW_LINE>newKind = maker.TypeBoundKind(BoundKind.SUPER);<NEW_LINE>break;<NEW_LINE>case EXTENDS_WILDCARD:<NEW_LINE>newKind = maker.TypeBoundKind(BoundKind.EXTENDS);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>case UNBOUNDED_WILDCARD:<NEW_LINE>newKind = maker.TypeBoundKind(BoundKind.UNBOUND);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return maker.Wildcard(newKind, newInner);<NEW_LINE>}<NEW_LINE>if (JCAnnotatedTypeReflect.is(in)) {<NEW_LINE>JCExpression underlyingType = cloneType0(maker, JCAnnotatedTypeReflect.getUnderlyingType(in));<NEW_LINE>List<JCAnnotation> anns = copyAnnotations(JCAnnotatedTypeReflect.getAnnotations(in));<NEW_LINE>return JCAnnotatedTypeReflect.create(anns, underlyingType);<NEW_LINE>}<NEW_LINE>// This is somewhat unsafe, but it's better than outright throwing an exception here. Returning null will just cause an exception down the pipeline.<NEW_LINE>return (JCExpression) in;<NEW_LINE>} | (cloneType0(maker, typeArg)); |
1,375,480 | public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException {<NEW_LINE>out.write(indent);<NEW_LINE>out.write("<");<NEW_LINE>if (namespace != null) {<NEW_LINE>out.write((String) namespaceMap.get(namespace));<NEW_LINE>out.write(":");<NEW_LINE>}<NEW_LINE>out.write(nodeName);<NEW_LINE>if (schemaLocation != null) {<NEW_LINE><MASK><NEW_LINE>out.write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='");<NEW_LINE>out.write(schemaLocation);<NEW_LINE>// NOI18N<NEW_LINE>out.write("'");<NEW_LINE>}<NEW_LINE>writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap);<NEW_LINE>out.write(">\n");<NEW_LINE>writeNodeChildren(out, nodeName, namespace, indent, namespaceMap);<NEW_LINE>out.write(indent);<NEW_LINE>out.write("</");<NEW_LINE>if (namespace != null) {<NEW_LINE>out.write((String) namespaceMap.get(namespace));<NEW_LINE>out.write(":");<NEW_LINE>}<NEW_LINE>out.write(nodeName);<NEW_LINE>out.write(">\n");<NEW_LINE>} | namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi"); |
779,697 | protected JComponent createCenterComponent() {<NEW_LINE>JPanel panel = new JPanel(new BorderLayout());<NEW_LINE>final JComponent component = super.createCenterComponent();<NEW_LINE>panel.add(component, BorderLayout.CENTER);<NEW_LINE>String preselect = PropertiesComponent.getInstance(myProject).getValue(SELECTED_SCOPE);<NEW_LINE>myScopes = new ScopeChooserCombo(myProject, false, true, preselect);<NEW_LINE>Disposer.register(this, myScopes);<NEW_LINE>myScopes.setCurrentSelection(false);<NEW_LINE>myScopes.setUsageView(false);<NEW_LINE>JPanel chooserPanel = new JPanel(new GridBagLayout());<NEW_LINE>final JLabel scopesLabel = new JLabel("Scope:");<NEW_LINE>scopesLabel.setDisplayedMnemonic('S');<NEW_LINE>scopesLabel.setLabelFor(myScopes);<NEW_LINE>final GridBagConstraints gc = new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insets(2), 0, 0);<NEW_LINE>chooserPanel.add(scopesLabel, gc);<NEW_LINE>chooserPanel.add(myScopes, gc);<NEW_LINE>gc.fill = GridBagConstraints.HORIZONTAL;<NEW_LINE>gc.weightx = 1;<NEW_LINE>chooserPanel.add(Box.createHorizontalBox(), gc);<NEW_LINE>panel.<MASK><NEW_LINE>return panel;<NEW_LINE>} | add(chooserPanel, BorderLayout.NORTH); |
198,884 | public void assertValid(@NonNull final List<RefundConfig> refundConfigs) {<NEW_LINE>Check.assumeNotEmpty(refundConfigs, "refundConfigs");<NEW_LINE>final IMsgBL msgBL = Services.get(IMsgBL.class);<NEW_LINE>if (hasDifferentValues(refundConfigs, RefundConfig::getRefundBase)) {<NEW_LINE><MASK><NEW_LINE>final ITranslatableString msg = msgBL.getTranslatableMsgText(MSG_REFUND_CONFIG_SAME_REFUND_BASE);<NEW_LINE>throw new AdempiereException(msg).markAsUserValidationError();<NEW_LINE>}<NEW_LINE>if (hasDifferentValues(refundConfigs, RefundConfig::getRefundMode)) {<NEW_LINE>Loggables.addLog("The given refundConfigs need to all have the same RefundMode; refundConfigs={}", refundConfigs);<NEW_LINE>final ITranslatableString msg = msgBL.getTranslatableMsgText(MSG_REFUND_CONFIG_SAME_REFUND_MODE);<NEW_LINE>throw new AdempiereException(msg).markAsUserValidationError();<NEW_LINE>}<NEW_LINE>if (RefundMode.APPLY_TO_ALL_QTIES.equals(extractRefundMode(refundConfigs))) {<NEW_LINE>// we have one IC with different configs, so those configs need to have the consistent settings<NEW_LINE>if (hasDifferentValues(refundConfigs, RefundConfig::getInvoiceSchedule)) {<NEW_LINE>Loggables.addLog("Because refundMode={}, all the given refundConfigs need to all have the same invoiceSchedule; refundConfigs={}", RefundMode.APPLY_TO_ALL_QTIES, refundConfigs);<NEW_LINE>final ITranslatableString msg = msgBL.getTranslatableMsgText(MSG_REFUND_CONFIG_SAME_INVOICE_SCHEDULE);<NEW_LINE>throw new AdempiereException(msg).markAsUserValidationError();<NEW_LINE>}<NEW_LINE>if (hasDifferentValues(refundConfigs, RefundConfig::getRefundInvoiceType)) {<NEW_LINE>Loggables.addLog("Because refundMode={}, all the given refundConfigs need to all have the same refundInvoiceType; refundConfigs={}", RefundMode.APPLY_TO_ALL_QTIES, refundConfigs);<NEW_LINE>final ITranslatableString msg = msgBL.getTranslatableMsgText(MSG_REFUND_CONFIG_SAME_REFUND_INVOICE_TYPE);<NEW_LINE>throw new AdempiereException(msg).markAsUserValidationError();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Loggables.addLog("The given refundConfigs need to all have the same RefundBase; refundConfigs={}", refundConfigs); |
719,320 | public double[][] inverse() {<NEW_LINE>if (!this.isNonsingular()) {<NEW_LINE>throw new MatrixError("Matrix is singular");<NEW_LINE>}<NEW_LINE>int rows = this.LU.length;<NEW_LINE>int columns = LU[0].length;<NEW_LINE>int count = rows;<NEW_LINE>double[][] lu = LU;<NEW_LINE>double[][] X = new double[rows][columns];<NEW_LINE>for (int i = 0; i < rows; i++) {<NEW_LINE>int k = this.piv[i];<NEW_LINE>X[i][k] = 1.0;<NEW_LINE>}<NEW_LINE>// Solve L*Y = B(piv,:)<NEW_LINE>for (int k = 0; k < columns; k++) {<NEW_LINE>for (int i = k + 1; i < columns; i++) {<NEW_LINE>for (int j = 0; j < count; j++) {<NEW_LINE>X[i][j] -= X[k][j] * lu[i][k];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Solve U*X = Y;<NEW_LINE>for (int k = columns - 1; k >= 0; k--) {<NEW_LINE>for (int j = 0; j < count; j++) {<NEW_LINE>X[k][j] <MASK><NEW_LINE>}<NEW_LINE>for (int i = 0; i < k; i++) {<NEW_LINE>for (int j = 0; j < count; j++) {<NEW_LINE>X[i][j] -= X[k][j] * lu[i][k];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return X;<NEW_LINE>} | /= lu[k][k]; |
816,927 | public CurrentReceivingHU execute() {<NEW_LINE>final I_PP_Order ppOrder = ppOrderBL.getById(ppOrderId);<NEW_LINE>final I_PP_Order_BOMLine coProductLine;<NEW_LINE>final LocatorId locatorId;<NEW_LINE>final UomId uomId;<NEW_LINE>final IPPOrderReceiptHUProducer huProducer;<NEW_LINE>if (coProductBOMLineId != null) {<NEW_LINE>coProductLine = ppOrderBOMBL.getOrderBOMLineById(coProductBOMLineId);<NEW_LINE>locatorId = LocatorId.ofRepoId(coProductLine.getM_Warehouse_ID(<MASK><NEW_LINE>uomId = UomId.ofRepoId(coProductLine.getC_UOM_ID());<NEW_LINE>huProducer = ppOrderBL.receivingByOrCoProduct(coProductBOMLineId);<NEW_LINE>} else {<NEW_LINE>coProductLine = null;<NEW_LINE>locatorId = LocatorId.ofRepoId(ppOrder.getM_Warehouse_ID(), ppOrder.getM_Locator_ID());<NEW_LINE>uomId = UomId.ofRepoId(ppOrder.getC_UOM_ID());<NEW_LINE>huProducer = ppOrderBL.receivingMainProduct(ppOrderId);<NEW_LINE>}<NEW_LINE>final HUPIItemProductId tuPIItemProductId = aggregateToLU.getTUPIItemProductId().orElseGet(() -> HUPIItemProductId.ofRepoIdOrNone(ppOrder.getCurrent_Receiving_TU_PI_Item_Product_ID()));<NEW_LINE>final List<I_M_HU> tusOrVhus = huProducer.movementDate(date).locatorId(locatorId).receiveTUs(Quantitys.create(qtyToReceiveBD, uomId), tuPIItemProductId);<NEW_LINE>final HuId luId = aggregateTUsToLU(tusOrVhus);<NEW_LINE>final CurrentReceivingHU currentReceivingHU = CurrentReceivingHU.builder().tuPIItemProductId(tuPIItemProductId).aggregateToLUId(luId).build();<NEW_LINE>//<NEW_LINE>// Remember current receiving LU.<NEW_LINE>// We will need it later too.<NEW_LINE>if (coProductLine != null) {<NEW_LINE>ManufacturingJobLoaderAndSaver.updateRecordFromCurrentReceivingHU(coProductLine, currentReceivingHU);<NEW_LINE>ppOrderBOMBL.save(coProductLine);<NEW_LINE>} else {<NEW_LINE>ManufacturingJobLoaderAndSaver.updateRecordFromCurrentReceivingHU(ppOrder, currentReceivingHU);<NEW_LINE>ppOrderBL.save(ppOrder);<NEW_LINE>}<NEW_LINE>return currentReceivingHU;<NEW_LINE>} | ), coProductLine.getM_Locator_ID()); |
421,301 | private void changeWorkflowAccess(@NonNull final RoleId roleId, @NonNull final ClientId clientId, @NonNull final OrgId orgId, final int adWorkflowId, @NonNull final Consumer<I_AD_Workflow_Access> updater) {<NEW_LINE>Preconditions.checkArgument(adWorkflowId > 0, "adWorkflowId > 0");<NEW_LINE>I_AD_Workflow_Access workflowAccess = queryBL.createQueryBuilder(I_AD_Workflow_Access.class).addEqualsFilter(I_AD_Workflow_Access.COLUMNNAME_AD_Role_ID, roleId).addEqualsFilter(I_AD_Workflow_Access.COLUMNNAME_AD_Workflow_ID, adWorkflowId).create(<MASK><NEW_LINE>if (workflowAccess == null) {<NEW_LINE>workflowAccess = InterfaceWrapperHelper.newInstance(I_AD_Workflow_Access.class);<NEW_LINE>InterfaceWrapperHelper.setValue(workflowAccess, I_AD_Workflow_Access.COLUMNNAME_AD_Client_ID, clientId.getRepoId());<NEW_LINE>workflowAccess.setAD_Org_ID(orgId.getRepoId());<NEW_LINE>workflowAccess.setAD_Role_ID(roleId.getRepoId());<NEW_LINE>workflowAccess.setAD_Workflow_ID(adWorkflowId);<NEW_LINE>}<NEW_LINE>updater.accept(workflowAccess);<NEW_LINE>if (workflowAccess.isActive()) {<NEW_LINE>InterfaceWrapperHelper.save(workflowAccess);<NEW_LINE>} else {<NEW_LINE>if (!InterfaceWrapperHelper.isNew(workflowAccess)) {<NEW_LINE>InterfaceWrapperHelper.delete(workflowAccess);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>resetCacheAfterTrxCommit();<NEW_LINE>} | ).firstOnly(I_AD_Workflow_Access.class); |
860,565 | public static void init(Connection conn) throws SQLException {<NEW_LINE>try (Statement stat = conn.createStatement()) {<NEW_LINE>stat.execute("CREATE SCHEMA IF NOT EXISTS " + SCHEMA);<NEW_LINE>stat.execute("CREATE TABLE IF NOT EXISTS " + SCHEMA + ".INDEXES(SCHEMA VARCHAR, `TABLE` VARCHAR, " + "COLUMNS VARCHAR, PRIMARY KEY(SCHEMA, `TABLE`))");<NEW_LINE>String className = FullTextLucene.class.getName();<NEW_LINE>stat.<MASK><NEW_LINE>stat.execute("CREATE ALIAS IF NOT EXISTS FTL_DROP_INDEX FOR '" + className + ".dropIndex'");<NEW_LINE>stat.execute("CREATE ALIAS IF NOT EXISTS FTL_SEARCH FOR '" + className + ".search'");<NEW_LINE>stat.execute("CREATE ALIAS IF NOT EXISTS FTL_SEARCH_DATA FOR '" + className + ".searchData'");<NEW_LINE>stat.execute("CREATE ALIAS IF NOT EXISTS FTL_REINDEX FOR '" + className + ".reindex'");<NEW_LINE>stat.execute("CREATE ALIAS IF NOT EXISTS FTL_DROP_ALL FOR '" + className + ".dropAll'");<NEW_LINE>}<NEW_LINE>} | execute("CREATE ALIAS IF NOT EXISTS FTL_CREATE_INDEX FOR '" + className + ".createIndex'"); |
1,011,334 | public RowMap deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {<NEW_LINE>ObjectNode node = jsonParser.getCodec().readTree(jsonParser);<NEW_LINE>JsonNode encrypted = node.get("encrypted");<NEW_LINE>if (encrypted != null) {<NEW_LINE>String iv = encrypted.get("iv").textValue();<NEW_LINE>String bytes = encrypted.<MASK><NEW_LINE>String decryptedData;<NEW_LINE>try {<NEW_LINE>decryptedData = RowEncrypt.decrypt(bytes, this.secret_key, iv);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>JsonNode decrypted = mapper.readTree(decryptedData);<NEW_LINE>if (!(decrypted instanceof ObjectNode)) {<NEW_LINE>throw new ParseException("`encrypted` must be an object after decrypting.");<NEW_LINE>}<NEW_LINE>node.setAll((ObjectNode) decrypted);<NEW_LINE>}<NEW_LINE>JsonNode type = node.get("type");<NEW_LINE>if (type == null) {<NEW_LINE>throw new ParseException("`type` is required and cannot be null.");<NEW_LINE>}<NEW_LINE>JsonNode database = node.get("database");<NEW_LINE>if (database == null) {<NEW_LINE>throw new ParseException("`database` is required and cannot be null.");<NEW_LINE>}<NEW_LINE>JsonNode table = node.get("table");<NEW_LINE>if (table == null) {<NEW_LINE>throw new ParseException("`table` is required and cannot be null.");<NEW_LINE>}<NEW_LINE>JsonNode ts = node.get("ts");<NEW_LINE>if (ts == null) {<NEW_LINE>throw new ParseException("`ts` is required and cannot be null.");<NEW_LINE>}<NEW_LINE>JsonNode xid = node.get("xid");<NEW_LINE>JsonNode commit = node.get("commit");<NEW_LINE>JsonNode data = node.get("data");<NEW_LINE>JsonNode oldData = node.get("old");<NEW_LINE>JsonNode comment = node.get("comment");<NEW_LINE>RowMap rowMap = new RowMap(type.asText(), database.asText(), table.asText(), ts.asLong() * 1000, new ArrayList<String>(), null);<NEW_LINE>if (xid != null) {<NEW_LINE>rowMap.setXid(xid.asLong());<NEW_LINE>}<NEW_LINE>if (commit != null && commit.asBoolean()) {<NEW_LINE>rowMap.setTXCommit();<NEW_LINE>}<NEW_LINE>if (data == null) {<NEW_LINE>throw new ParseException("`data` is required and cannot be null.");<NEW_LINE>}<NEW_LINE>readDataInto(rowMap, data, false);<NEW_LINE>if (oldData != null) {<NEW_LINE>readDataInto(rowMap, oldData, true);<NEW_LINE>}<NEW_LINE>if (comment != null) {<NEW_LINE>rowMap.setComment(comment.asText());<NEW_LINE>}<NEW_LINE>return rowMap;<NEW_LINE>} | get("bytes").textValue(); |
1,657,402 | protected void loadFromModelData(TFTableModelClassificationModelData modelData, TableSchema modelSchema) {<NEW_LINE>Params meta = modelData.getMeta();<NEW_LINE>String tfOutputSignatureDef = meta.get(TFModelDataConverterUtils.TF_OUTPUT_SIGNATURE_DEF);<NEW_LINE>TypeInformation<?> tfOutputSignatureType = AlinkTypes.FLOAT_TENSOR;<NEW_LINE>String[] reservedCols = null == params.get(HasReservedColsDefaultAsNull.RESERVED_COLS) ? getDataSchema().getFieldNames() : params.get(HasReservedColsDefaultAsNull.RESERVED_COLS);<NEW_LINE>TableSchema dataSchema = getDataSchema();<NEW_LINE>if (CollectionUtils.isNotEmpty(modelData.getPreprocessPipelineModelRows())) {<NEW_LINE>String preprocessPipelineModelSchemaStr = modelData.getPreprocessPipelineModelSchemaStr();<NEW_LINE>TableSchema <MASK><NEW_LINE>MapperChain mapperList = ModelExporterUtils.loadMapperListFromStages(modelData.getPreprocessPipelineModelRows(), pipelineModelSchema, dataSchema);<NEW_LINE>mappers.addAll(Arrays.asList(mapperList.getMappers()));<NEW_LINE>dataSchema = mappers.get(mappers.size() - 1).getOutputSchema();<NEW_LINE>}<NEW_LINE>String[] tfInputCols = meta.get(TFModelDataConverterUtils.TF_INPUT_COLS);<NEW_LINE>String predCol = params.get(TFTableModelClassificationPredictParams.PREDICTION_COL);<NEW_LINE>Params tfModelMapperParams = new Params();<NEW_LINE>tfModelMapperParams.set(TFTableModelPredictParams.OUTPUT_SIGNATURE_DEFS, new String[] { tfOutputSignatureDef });<NEW_LINE>tfModelMapperParams.set(TFTableModelPredictParams.OUTPUT_SCHEMA_STR, TableUtil.schema2SchemaStr(TableSchema.builder().field(predCol, tfOutputSignatureType).build()));<NEW_LINE>tfModelMapperParams.set(TFTableModelPredictParams.SELECTED_COLS, tfInputCols);<NEW_LINE>tfModelMapperParams.set(TFTableModelPredictParams.RESERVED_COLS, reservedCols);<NEW_LINE>tfModelMapper = new TFTableModelPredictModelMapper(modelSchema, dataSchema, tfModelMapperParams, factory);<NEW_LINE>if (null != modelData.getTfModelZipPath()) {<NEW_LINE>tfModelMapper.loadModelFromZipFile(modelData.getTfModelZipPath());<NEW_LINE>} else {<NEW_LINE>tfModelMapper.loadModel(modelData.getTfModelRows());<NEW_LINE>}<NEW_LINE>mappers.add(tfModelMapper);<NEW_LINE>predColId = TableUtil.findColIndex(tfModelMapper.getOutputSchema(), predCol);<NEW_LINE>sortedLabels = modelData.getSortedLabels();<NEW_LINE>isOutputLogits = meta.get(TFModelDataConverterUtils.IS_OUTPUT_LOGITS);<NEW_LINE>} | pipelineModelSchema = TableUtil.schemaStr2Schema(preprocessPipelineModelSchemaStr); |
982,616 | private void writeDefAssignment(TreeLogger logger, SourceWriter sw, JMethod toImplement, CssStylesheet cssStylesheet) throws UnableToCompleteException {<NEW_LINE>SubstitutionCollector collector = new SubstitutionCollector();<NEW_LINE>collector.accept(cssStylesheet);<NEW_LINE>String name = toImplement.getName();<NEW_LINE>// TODO: Annotation for override<NEW_LINE>CssDef def = collector.<MASK><NEW_LINE>if (def == null) {<NEW_LINE>logger.log(TreeLogger.ERROR, "No @def rule for name " + name);<NEW_LINE>throw new UnableToCompleteException();<NEW_LINE>}<NEW_LINE>JClassType classReturnType = toImplement.getReturnType().isClass();<NEW_LINE>if (def.getValues().size() != 1 && !isReturnTypeString(classReturnType)) {<NEW_LINE>logger.log(TreeLogger.ERROR, "@def rule " + name + " must define exactly one value or return type must be String");<NEW_LINE>throw new UnableToCompleteException();<NEW_LINE>}<NEW_LINE>String returnExpr = "";<NEW_LINE>if (isReturnTypeString(classReturnType)) {<NEW_LINE>List<String> returnValues = new ArrayList<String>();<NEW_LINE>for (Value val : def.getValues()) {<NEW_LINE>returnValues.add(Generator.escape(val.toString()));<NEW_LINE>}<NEW_LINE>returnExpr = "\"" + Joiner.on(" ").join(returnValues) + "\"";<NEW_LINE>} else {<NEW_LINE>JPrimitiveType returnType = toImplement.getReturnType().isPrimitive();<NEW_LINE>if (returnType == null) {<NEW_LINE>logger.log(TreeLogger.ERROR, toImplement.getName() + ": Return type must be primitive type or String for " + "@def accessors");<NEW_LINE>throw new UnableToCompleteException();<NEW_LINE>}<NEW_LINE>NumberValue numberValue = def.getValues().get(0).isNumberValue();<NEW_LINE>if (returnType == JPrimitiveType.INT || returnType == JPrimitiveType.LONG) {<NEW_LINE>returnExpr = "" + Math.round(numberValue.getValue());<NEW_LINE>} else if (returnType == JPrimitiveType.FLOAT) {<NEW_LINE>returnExpr = numberValue.getValue() + "F";<NEW_LINE>} else if (returnType == JPrimitiveType.DOUBLE) {<NEW_LINE>returnExpr = "" + numberValue.getValue();<NEW_LINE>} else {<NEW_LINE>logger.log(TreeLogger.ERROR, returnType.getQualifiedSourceName() + " is not a valid primitive return type for @def accessors");<NEW_LINE>throw new UnableToCompleteException();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writeSimpleGetter(toImplement, returnExpr, sw);<NEW_LINE>} | getSubstitutions().get(name); |
1,570,431 | private static String mkMessage(ExecutionStepInfo executionStepInfo, ResultPath path) {<NEW_LINE>GraphQLType unwrappedTyped = executionStepInfo.getUnwrappedNonNullType();<NEW_LINE>if (executionStepInfo.hasParent()) {<NEW_LINE>GraphQLType unwrappedParentType = executionStepInfo.getParent().getUnwrappedNonNullType();<NEW_LINE>return String.format("The field at path '%s' was declared as a non null type, but the code involved in retrieving" + " data has wrongly returned a null value. The graphql specification requires that the" + " parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on." + " The non-nullable type is '%s' within parent type '%s'", path, simplePrint(<MASK><NEW_LINE>} else {<NEW_LINE>return String.format("The field at path '%s' was declared as a non null type, but the code involved in retrieving" + " data has wrongly returned a null value. The graphql specification requires that the" + " parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on." + " The non-nullable type is '%s'", path, simplePrint(unwrappedTyped));<NEW_LINE>}<NEW_LINE>} | unwrappedTyped), simplePrint(unwrappedParentType)); |
1,477,931 | protected void doAction() {<NEW_LINE>try {<NEW_LINE>KeyStoreHistory history = kseFrame.getActiveKeyStoreHistory();<NEW_LINE>KeyStoreState currentState = history.getCurrentState();<NEW_LINE>String alias = kseFrame.getSelectedEntryAlias();<NEW_LINE>Password password = getEntryPassword(alias, currentState);<NEW_LINE>if (password == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>KeyStore keyStore = currentState.getKeyStore();<NEW_LINE>PrivateKey privateKey = (PrivateKey) keyStore.getKey(alias, password.toCharArray());<NEW_LINE>KeyPairType <MASK><NEW_LINE>DExportPrivateKeyType dExportPrivateKeyType = new DExportPrivateKeyType(frame, keyPairType);<NEW_LINE>dExportPrivateKeyType.setLocationRelativeTo(frame);<NEW_LINE>dExportPrivateKeyType.setVisible(true);<NEW_LINE>if (!dExportPrivateKeyType.exportTypeSelected()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (dExportPrivateKeyType.exportPkcs8()) {<NEW_LINE>exportAsPkcs8(privateKey, alias);<NEW_LINE>} else if (dExportPrivateKeyType.exportPvk()) {<NEW_LINE>exportAsPvk(privateKey, alias);<NEW_LINE>} else {<NEW_LINE>exportAsOpenSsl(privateKey, alias);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>DError.displayError(frame, ex);<NEW_LINE>}<NEW_LINE>} | keyPairType = KeyPairUtil.getKeyPairType(privateKey); |
310,508 | private static LedgerMetadata parseVersion1Config(long ledgerId, InputStream is) throws IOException {<NEW_LINE>try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8.name()))) {<NEW_LINE>LedgerMetadataBuilder builder = LedgerMetadataBuilder.create().withId(ledgerId).withMetadataFormatVersion(1);<NEW_LINE>int quorumSize = Integer.parseInt(reader.readLine());<NEW_LINE>int ensembleSize = Integer.parseInt(reader.readLine());<NEW_LINE>long length = Long.parseLong(reader.readLine());<NEW_LINE>builder.withEnsembleSize(ensembleSize).withWriteQuorumSize(quorumSize).withAckQuorumSize(quorumSize);<NEW_LINE>String line = reader.readLine();<NEW_LINE>while (line != null) {<NEW_LINE>String[] parts = line.split(FIELD_SPLITTER);<NEW_LINE>if (parts[1].equals(V1_CLOSED_TAG)) {<NEW_LINE>Long l = Long.parseLong(parts[0]);<NEW_LINE>if (l == V1_IN_RECOVERY_ENTRY_ID) {<NEW_LINE>builder.withInRecoveryState();<NEW_LINE>} else {<NEW_LINE>builder.withClosedState().withLastEntryId(l).withLength(length);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>ArrayList<BookieId> addrs = new ArrayList<BookieId>();<NEW_LINE>for (int j = 1; j < parts.length; j++) {<NEW_LINE>addrs.add(BookieId.<MASK><NEW_LINE>}<NEW_LINE>builder.newEnsembleEntry(Long.parseLong(parts[0]), addrs);<NEW_LINE>line = reader.readLine();<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new IOException(e);<NEW_LINE>}<NEW_LINE>} | parse(parts[j])); |
1,421,633 | private static void deleteUnknownLibs(Context context, PxAll all) {<NEW_LINE>HashSet<String> names = new HashSet<>();<NEW_LINE>for (PluginInfo p : all.getPlugins()) {<NEW_LINE>names.add(p.getOldNativeLibsDir().getName());<NEW_LINE>}<NEW_LINE>File dir = context.getDir(Constant.LOCAL_PLUGIN_DATA_LIB_DIR, 0);<NEW_LINE>File[] files = dir.listFiles();<NEW_LINE>if (files != null) {<NEW_LINE>for (File f : files) {<NEW_LINE>if (names.contains(f.getName())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (LOG) {<NEW_LINE>LogDebug.d(PLUGIN_TAG, <MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>FileUtils.forceDelete(f);<NEW_LINE>} catch (IOException e) {<NEW_LINE>if (LOG) {<NEW_LINE>LogDebug.d(PLUGIN_TAG, "can't delete unknown libs=" + f.getAbsolutePath(), e);<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException e2) {<NEW_LINE>if (LOG) {<NEW_LINE>e2.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "delete unknown libs=" + f.getAbsolutePath()); |
28,706 | private void createTorsoLink(VectorSet vertexLocations, Mesh[] meshes) {<NEW_LINE>if (vertexLocations == null || vertexLocations.numVectors() == 0) {<NEW_LINE>throw new IllegalArgumentException("No mesh vertices for the torso." + " Make sure the root bone is not linked.");<NEW_LINE>}<NEW_LINE>Joint bone = RagUtils.findMainBone(skeleton, meshes);<NEW_LINE>assert bone.getParent() == null;<NEW_LINE>Transform boneToMesh = bone.getModelTransform();<NEW_LINE>Transform meshToBone = boneToMesh.invert();<NEW_LINE>Vector3f <MASK><NEW_LINE>center.subtractLocal(boneToMesh.getTranslation());<NEW_LINE>CollisionShape shape = createShape(meshToBone, center, vertexLocations);<NEW_LINE>meshToBone.getTranslation().zero();<NEW_LINE>Vector3f offset = meshToBone.transformVector(center, null);<NEW_LINE>Transform meshToModel;<NEW_LINE>Spatial cgm = getSpatial();<NEW_LINE>if (cgm instanceof Node) {<NEW_LINE>Transform modelToMesh = RagUtils.relativeTransform(transformer, (Node) cgm, null);<NEW_LINE>meshToModel = modelToMesh.invert();<NEW_LINE>} else {<NEW_LINE>meshToModel = transformIdentity;<NEW_LINE>}<NEW_LINE>float mass = super.mass(torsoName);<NEW_LINE>torsoLink = new TorsoLink(this, bone, shape, mass, meshToModel, offset);<NEW_LINE>} | center = vertexLocations.mean(null); |
569,797 | private static boolean _cutteeStartCutterEndEvent(int eventIndex, EditShape editShape, ArrayList<CutEvent> cutEvents, int ipartCuttee, int ivertexCuttee, int ipartCutter, int ivertexCutter, int ifirstVertexCuttee) {<NEW_LINE>Segment segmentCuttee;<NEW_LINE>Segment segmentCutter;<NEW_LINE>Line lineCuttee = new Line();<NEW_LINE>Line lineCutter = new Line();<NEW_LINE>double[] scalarsCuttee = new double[2];<NEW_LINE>double[] scalarsCutter = new double[2];<NEW_LINE>CutEvent cutEvent;<NEW_LINE>segmentCuttee = editShape.getSegment(ivertexCuttee);<NEW_LINE>if (segmentCuttee == null) {<NEW_LINE>editShape.queryLineConnector(ivertexCuttee, lineCuttee);<NEW_LINE>segmentCuttee = lineCuttee;<NEW_LINE>}<NEW_LINE>segmentCutter = editShape.getSegment(ivertexCutter);<NEW_LINE>if (segmentCutter == null) {<NEW_LINE>editShape.queryLineConnector(ivertexCutter, lineCutter);<NEW_LINE>segmentCutter = lineCutter;<NEW_LINE>}<NEW_LINE>int count = segmentCuttee.intersect(segmentCutter, null, scalarsCuttee, scalarsCutter, 0.0);<NEW_LINE>// _ASSERT(count > 0);<NEW_LINE>int icutEvent;<NEW_LINE>if (count == 2) {<NEW_LINE>cutEvent = new CutEvent(ivertexCuttee, ipartCuttee, scalarsCuttee[0], scalarsCuttee[1], count, ivertexCutter, ipartCutter, scalarsCutter[0], scalarsCutter[1]);<NEW_LINE>cutEvents.add(cutEvent);<NEW_LINE>icutEvent = editShape.getUserIndex(ivertexCuttee, eventIndex);<NEW_LINE>if (icutEvent < 0)<NEW_LINE>editShape.setUserIndex(ivertexCuttee, eventIndex, <MASK><NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>boolean bCutEvent = false;<NEW_LINE>if (ivertexCuttee == ifirstVertexCuttee) {<NEW_LINE>cutEvent = new CutEvent(ivertexCuttee, ipartCuttee, scalarsCuttee[0], NumberUtils.NaN(), count, ivertexCutter, ipartCutter, scalarsCutter[0], NumberUtils.NaN());<NEW_LINE>cutEvents.add(cutEvent);<NEW_LINE>icutEvent = editShape.getUserIndex(ivertexCuttee, eventIndex);<NEW_LINE>if (icutEvent < 0)<NEW_LINE>editShape.setUserIndex(ivertexCuttee, eventIndex, cutEvents.size() - 1);<NEW_LINE>bCutEvent = true;<NEW_LINE>}<NEW_LINE>return bCutEvent;<NEW_LINE>}<NEW_LINE>} | cutEvents.size() - 1); |
1,491,702 | public static PsiLanguageInjectionHost findInjectionHost(@Nullable PsiElement psi) {<NEW_LINE>if (psi == null)<NEW_LINE>return null;<NEW_LINE>// * formatting<NEW_LINE>PsiFile containingFile = psi<MASK><NEW_LINE>// * quick-edit-handler<NEW_LINE>PsiElement fileContext = containingFile.getContext();<NEW_LINE>if (fileContext instanceof PsiLanguageInjectionHost)<NEW_LINE>return (PsiLanguageInjectionHost) fileContext;<NEW_LINE>// * injection-registrar<NEW_LINE>Place shreds = getShreds(containingFile.getViewProvider());<NEW_LINE>if (shreds == null) {<NEW_LINE>VirtualFile virtualFile = PsiUtilCore.getVirtualFile(containingFile);<NEW_LINE>if (virtualFile instanceof LightVirtualFile) {<NEW_LINE>// * dynamic files-from-text<NEW_LINE>virtualFile = ((LightVirtualFile) virtualFile).getOriginalFile();<NEW_LINE>}<NEW_LINE>if (virtualFile instanceof VirtualFileWindow) {<NEW_LINE>shreds = getShreds(((VirtualFileWindow) virtualFile).getDocumentWindow());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return shreds != null ? shreds.getHostPointer().getElement() : null;<NEW_LINE>} | .getContainingFile().getOriginalFile(); |
1,172,446 | protected void addCompletions(@NotNull final CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) {<NEW_LINE>Document document = parameters<MASK><NEW_LINE>int line = document.getLineNumber(parameters.getOffset());<NEW_LINE>PsiElement prevVisibleLeaf = PsiTreeUtil.prevVisibleLeaf(parameters.getPosition());<NEW_LINE>if (prevVisibleLeaf != null) {<NEW_LINE>// NOTE: "type Foo <completion>" would grammatically allow a new definition to follow immediately<NEW_LINE>// but this completion at that position is likely to be unexpected and would interfere with "implements" on types<NEW_LINE>// so we expect top level keywords to be the first visible element on the line to complete<NEW_LINE>if (line == document.getLineNumber(prevVisibleLeaf.getTextRange().getStartOffset())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (GraphQLCompletionKeyword keyword : TOP_LEVEL_KEYWORDS) {<NEW_LINE>result.addElement(GraphQLCompletionUtil.createKeywordLookupElement(keyword));<NEW_LINE>}<NEW_LINE>} | .getEditor().getDocument(); |
1,596,717 | private Object doInvokeMethod(Object target, String methodName, Object[] arguments, boolean isStatic) {<NEW_LINE>Object[] args = GroovyRuntimeUtil.asArgumentArray(arguments);<NEW_LINE>if (isGetMetaClassCallOnGroovyObject(target, methodName, args, isStatic)) {<NEW_LINE>// We handle this case explicitly because strangely enough, delegate.pickMethod()<NEW_LINE>// selects DGM.getMetaClass() even for GroovyObject's. This would result in getMetaClass()<NEW_LINE>// being mockable, but only Groovy callers would see the returned value (Groovy runtime would<NEW_LINE>// always sees the MockMetaClass). Our handling leads to a more consistent behavior;<NEW_LINE>// getMetaClass() returns same result no matter if it is invoked directly or via MOP.<NEW_LINE>return ((GroovyObject) target).getMetaClass();<NEW_LINE>}<NEW_LINE>MetaMethod metaMethod = delegate.pickMethod(methodName, ReflectionUtil.getTypes(args));<NEW_LINE>Method method = GroovyRuntimeUtil.toMethod(metaMethod);<NEW_LINE>// we evaluated the cast information from wrappers in getTypes above, now we need the pure arguments<NEW_LINE>Object[] unwrappedArgs = GroovyRuntimeUtil.asUnwrappedArgumentArray(args);<NEW_LINE>if (method != null && method.getDeclaringClass().isAssignableFrom(configuration.getType())) {<NEW_LINE>if (!isStatic && !ReflectionUtil.isFinalMethod(method) && !configuration.isGlobal()) {<NEW_LINE>// perform coercion of arguments, e.g. GString to String<NEW_LINE>Object[] coercedArgs = metaMethod.coerceArgumentsToClasses(unwrappedArgs);<NEW_LINE>// use standard proxy dispatch<NEW_LINE>return metaMethod.invoke(target, coercedArgs);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// MetaMethod.getDeclaringClass apparently differs from java.reflect.Method.getDeclaringClass()<NEW_LINE>// in that the originally declaring class/interface is returned; we leverage this behavior<NEW_LINE>// to check if a GroovyObject method was called<NEW_LINE>if (metaMethod != null && metaMethod.getDeclaringClass().getTheClass() == GroovyObject.class) {<NEW_LINE>if ("invokeMethod".equals(methodName)) {<NEW_LINE>return invokeMethod(target, (String) unwrappedArgs[0], GroovyRuntimeUtil.asArgumentArray(unwrappedArgs[1]));<NEW_LINE>}<NEW_LINE>if ("getProperty".equals(methodName)) {<NEW_LINE>return getProperty(target, (String) unwrappedArgs[0]);<NEW_LINE>}<NEW_LINE>if ("setProperty".equals(methodName)) {<NEW_LINE>setProperty(target, (String) unwrappedArgs[0], unwrappedArgs[1]);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// getMetaClass was already handled earlier; setMetaClass isn't handled specially<NEW_LINE>}<NEW_LINE>IMockInvocation invocation = createMockInvocation(metaMethod, <MASK><NEW_LINE>IMockController controller = specification.getSpecificationContext().getMockController();<NEW_LINE>return controller.handle(invocation);<NEW_LINE>} | target, methodName, args, isStatic); |
1,739,784 | public static final boolean featureDialog(final FeatureInfo featureInfo, final String notFoundMessage, final String featureName) {<NEW_LINE>final CountDownLatch called = new CountDownLatch(1);<NEW_LINE>final boolean[] result = new boolean[] { false };<NEW_LINE>final DialogDescriptor[] descriptor = new DialogDescriptor[1];<NEW_LINE>final Callable<JComponent> call = new Callable<JComponent>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public JComponent call() throws Exception {<NEW_LINE>result[0] = true;<NEW_LINE>called.countDown();<NEW_LINE>descriptor[0].setValue(DialogDescriptor.CLOSED_OPTION);<NEW_LINE>return new JPanel();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>final ConfigurationPanel[] arr = new ConfigurationPanel[1];<NEW_LINE>descriptor[0] = Mutex.EVENT.readAccess(new Mutex.Action<DialogDescriptor>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public DialogDescriptor run() {<NEW_LINE>arr[0] = new ConfigurationPanel(featureName, call, featureInfo);<NEW_LINE>return new DialogDescriptor(arr[0], notFoundMessage);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>descriptor[0].setOptions(new Object<MASK><NEW_LINE>if (!GraphicsEnvironment.isHeadless()) {<NEW_LINE>final Dialog d = DialogDisplayer.getDefault().createDialog(descriptor[0]);<NEW_LINE>descriptor[0].addPropertyChangeListener(new PropertyChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void propertyChange(PropertyChangeEvent arg0) {<NEW_LINE>d.setVisible(false);<NEW_LINE>d.dispose();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>d.setVisible(true);<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>called.await(10, TimeUnit.SECONDS);<NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result[0];<NEW_LINE>} | [] { DialogDescriptor.CANCEL_OPTION }); |
1,446,142 | public static void main(String[] args) {<NEW_LINE>OkHttpClient http = new OkHttpClient();<NEW_LINE>PokemonGo api = new PokemonGo(http);<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>api.login(new PtcCredentialProvider(http, ExampleConstants.LOGIN, ExampleConstants.PASSWORD), hasher);<NEW_LINE>api.setLocation(ExampleConstants.LATITUDE, ExampleConstants.LONGITUDE, ExampleConstants.ALTITUDE);<NEW_LINE>PokeBank pokebank = api.inventories.pokebank;<NEW_LINE>List<Pokemon> pokemons = pokebank.pokemons;<NEW_LINE>List<Pokemon> transferPokemons = new ArrayList<>();<NEW_LINE>// Find all pokemon of bad types or with IV less than 25%<NEW_LINE>for (Pokemon pokemon : pokemons) {<NEW_LINE>PokemonId id = pokemon.getPokemonId();<NEW_LINE>double iv = pokemon.getIvInPercentage();<NEW_LINE>if (iv < 90) {<NEW_LINE>if (id == PokemonId.RATTATA || id == PokemonId.PIDGEY || id == PokemonId.CATERPIE || id == PokemonId.WEEDLE || id == PokemonId.MAGIKARP || id == PokemonId.ZUBAT || iv < 25) {<NEW_LINE>transferPokemons.add(pokemon);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("Releasing " + transferPokemons.size() + " pokemon.");<NEW_LINE>Pokemon[] transferArray = transferPokemons.toArray(new Pokemon[transferPokemons.size()]);<NEW_LINE>Map<PokemonFamilyId, Integer> responses = pokebank.releasePokemon(transferArray);<NEW_LINE>// Loop through all responses and find the total amount of candies earned for each family<NEW_LINE>Map<PokemonFamilyId, Integer> candies = new HashMap<>();<NEW_LINE>for (Map.Entry<PokemonFamilyId, Integer> entry : responses.entrySet()) {<NEW_LINE>int candyAwarded = entry.getValue();<NEW_LINE>PokemonFamilyId family = entry.getKey();<NEW_LINE>Integer candy = candies.get(family);<NEW_LINE>if (candy == null) {<NEW_LINE>// candies map does not yet contain the amount if null, so set it to 0<NEW_LINE>candy = 0;<NEW_LINE>}<NEW_LINE>// Add the awarded candies from this request<NEW_LINE>candy += candyAwarded;<NEW_LINE>candies.put(family, candy);<NEW_LINE>}<NEW_LINE>for (Map.Entry<PokemonFamilyId, Integer> entry : candies.entrySet()) {<NEW_LINE>System.out.println(entry.getKey() + ": " + entry.getValue() + " candies awarded");<NEW_LINE>}<NEW_LINE>} catch (RequestFailedException e) {<NEW_LINE>// failed to login, invalid credentials, auth issue or server issue.<NEW_LINE>Log.e("Main", "Failed to login. Invalid credentials, captcha or server issue: ", e);<NEW_LINE>}<NEW_LINE>} | HashProvider hasher = ExampleConstants.getHashProvider(); |
1,658,212 | final StartImportResult executeStartImport(StartImportRequest startImportRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startImportRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StartImportRequest> request = null;<NEW_LINE>Response<StartImportResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartImportRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startImportRequest));<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, "Lex Models V2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartImport");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StartImportResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartImportResultJsonUnmarshaller());<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); |
117,244 | public String encryptSecret(String plainText) {<NEW_LINE>if (plainText.length() > MAX_PLAINTEXT_LENGTH) {<NEW_LINE>throw new IllegalArgumentException("Too long text");<NEW_LINE>}<NEW_LINE>byte[] nonce = generateNonce();<NEW_LINE>Cipher cipher = <MASK><NEW_LINE>byte[] plainTextBytes = plainText.getBytes(UTF_8);<NEW_LINE>if (plainTextBytes.length > MAX_PLAINTEXT_LENGTH) {<NEW_LINE>throw new IllegalArgumentException("Too long text");<NEW_LINE>}<NEW_LINE>int recordContentsLength = LENGTH_SIZE + plainTextBytes.length;<NEW_LINE>int recordLength = RECORD_SIZE_ALIGNMENT * ((recordContentsLength + RECORD_SIZE_ALIGNMENT - 1) / RECORD_SIZE_ALIGNMENT);<NEW_LINE>byte[] recordBytes = new byte[recordLength];<NEW_LINE>ByteBuffer recordBuffer = ByteBuffer.wrap(recordBytes);<NEW_LINE>recordBuffer.putInt(plainTextBytes.length);<NEW_LINE>recordBuffer.put(plainTextBytes);<NEW_LINE>byte[] cipherText;<NEW_LINE>try {<NEW_LINE>cipherText = cipher.doFinal(recordBytes);<NEW_LINE>} catch (IllegalBlockSizeException | BadPaddingException e) {<NEW_LINE>throw ThrowablesUtil.propagate(e);<NEW_LINE>}<NEW_LINE>byte[] opaque = new byte[WRAPPING_SIZE + cipherText.length];<NEW_LINE>ByteBuffer output = ByteBuffer.wrap(opaque);<NEW_LINE>output.put(NAME_BYTES);<NEW_LINE>output.putInt(VERSION_2);<NEW_LINE>output.putInt(TERM);<NEW_LINE>output.put(nonce);<NEW_LINE>output.put(cipherText);<NEW_LINE>assert output.remaining() == 0;<NEW_LINE>return Base64.getEncoder().encodeToString(opaque);<NEW_LINE>} | cipher(ENCRYPT_MODE, sharedSecret, nonce); |
159,683 | private OvsVpcRoutingPolicyConfigCommand prepareVpcRoutingPolicyUpdate(long vpcId) {<NEW_LINE>List<OvsVpcRoutingPolicyConfigCommand.Acl> acls = new ArrayList<>();<NEW_LINE>List<OvsVpcRoutingPolicyConfigCommand.Tier> tiers = new ArrayList<>();<NEW_LINE>VpcVO vpc = _vpcDao.findById(vpcId);<NEW_LINE>List<? extends Network> vpcNetworks = _vpcMgr.getVpcNetworks(vpcId);<NEW_LINE>assert (vpc != null && (vpcNetworks != null && !vpcNetworks.isEmpty())) : "invalid vpc id";<NEW_LINE>for (Network network : vpcNetworks) {<NEW_LINE>Long networkAclId = network.getNetworkACLId();<NEW_LINE>if (networkAclId == null)<NEW_LINE>continue;<NEW_LINE>NetworkACLVO networkAcl = _networkACLDao.findById(networkAclId);<NEW_LINE>List<OvsVpcRoutingPolicyConfigCommand.AclItem> aclItems = new ArrayList<>();<NEW_LINE>List<NetworkACLItemVO> aclItemVos = _networkACLItemDao.listByACL(networkAclId);<NEW_LINE>for (NetworkACLItemVO aclItem : aclItemVos) {<NEW_LINE>String[] sourceCidrs = aclItem.getSourceCidrList().toArray(new String[aclItem.getSourceCidrList().size()]);<NEW_LINE>aclItems.add(new OvsVpcRoutingPolicyConfigCommand.AclItem(aclItem.getNumber(), aclItem.getUuid(), aclItem.getAction().name(), aclItem.getTrafficType().name(), ((aclItem.getSourcePortStart() != null) ? aclItem.getSourcePortStart().toString() : null), ((aclItem.getSourcePortEnd() != null) ? aclItem.getSourcePortEnd().toString() : null), aclItem<MASK><NEW_LINE>}<NEW_LINE>OvsVpcRoutingPolicyConfigCommand.Acl acl = new OvsVpcRoutingPolicyConfigCommand.Acl(networkAcl.getUuid(), aclItems.toArray(new OvsVpcRoutingPolicyConfigCommand.AclItem[aclItems.size()]));<NEW_LINE>acls.add(acl);<NEW_LINE>OvsVpcRoutingPolicyConfigCommand.Tier tier = new OvsVpcRoutingPolicyConfigCommand.Tier(network.getUuid(), network.getCidr(), networkAcl.getUuid());<NEW_LINE>tiers.add(tier);<NEW_LINE>}<NEW_LINE>OvsVpcRoutingPolicyConfigCommand cmd = new OvsVpcRoutingPolicyConfigCommand(vpc.getUuid(), vpc.getCidr(), acls.toArray(new OvsVpcRoutingPolicyConfigCommand.Acl[acls.size()]), tiers.toArray(new OvsVpcRoutingPolicyConfigCommand.Tier[tiers.size()]));<NEW_LINE>return cmd;<NEW_LINE>} | .getProtocol(), sourceCidrs)); |
885,103 | private void mountGlobalRestFailureHandler(Router mainRouter) {<NEW_LINE>GlobalRestFailureHandler globalRestFailureHandler = SPIServiceUtils.getPriorityHighestService(GlobalRestFailureHandler.class);<NEW_LINE>Handler<RoutingContext> failureHandler = null == globalRestFailureHandler ? ctx -> {<NEW_LINE>if (ctx.response().closed() || ctx.response().ended()) {<NEW_LINE>// response has been sent, do nothing<NEW_LINE>LOGGER.error("get a failure with closed response", ctx.failure());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>HttpServerResponse response = ctx.response();<NEW_LINE>if (ctx.failure() instanceof InvocationException) {<NEW_LINE>// ServiceComb defined exception<NEW_LINE>InvocationException exception = (InvocationException) ctx.failure();<NEW_LINE>response.setStatusCode(exception.getStatusCode());<NEW_LINE>response.setStatusMessage(exception.getReasonPhrase());<NEW_LINE>response.end(exception.getErrorData().toString());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LOGGER.error("unexpected failure happened", ctx.failure());<NEW_LINE>try {<NEW_LINE>// unknown exception<NEW_LINE>CommonExceptionData unknownError = new CommonExceptionData("unknown error");<NEW_LINE>ctx.response().setStatusCode(500).putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).end(RestObjectMapperFactory.getRestObjectMapper<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("failed to send error response!", e);<NEW_LINE>}<NEW_LINE>} : globalRestFailureHandler;<NEW_LINE>// this handler does nothing, just ensure the failure handler can catch exception<NEW_LINE>mainRouter.route().handler(RoutingContext::next).failureHandler(failureHandler);<NEW_LINE>} | ().writeValueAsString(unknownError)); |
1,113,011 | public void onActivityResult(int requestCode, int resultCode, Intent intent) {<NEW_LINE>super.onActivityResult(requestCode, resultCode, intent);<NEW_LINE>if (onActivityResultCallbackContext != null && intent != null) {<NEW_LINE>intent.putExtra("requestCode", requestCode);<NEW_LINE>intent.putExtra("resultCode", resultCode);<NEW_LINE>PluginResult result = new PluginResult(PluginResult.Status.OK, getIntentJson(intent));<NEW_LINE>result.setKeepCallback(true);<NEW_LINE>onActivityResultCallbackContext.sendPluginResult(result);<NEW_LINE>} else if (onActivityResultCallbackContext != null) {<NEW_LINE>Intent canceledIntent = new Intent();<NEW_LINE>canceledIntent.putExtra("requestCode", requestCode);<NEW_LINE>canceledIntent.putExtra("resultCode", resultCode);<NEW_LINE>PluginResult canceledResult = new PluginResult(PluginResult.Status<MASK><NEW_LINE>canceledResult.setKeepCallback(true);<NEW_LINE>onActivityResultCallbackContext.sendPluginResult(canceledResult);<NEW_LINE>}<NEW_LINE>} | .OK, getIntentJson(canceledIntent)); |
1,285,737 | public static <T> T compatibleCast(Object value, Class<T> type) {<NEW_LINE>if (value == null || type == null || type.isAssignableFrom(value.getClass())) {<NEW_LINE>return (T) value;<NEW_LINE>}<NEW_LINE>if (value instanceof Number) {<NEW_LINE>Number number = (Number) value;<NEW_LINE>if (type == int.class || type == Integer.class) {<NEW_LINE>return (T) <MASK><NEW_LINE>}<NEW_LINE>if (type == long.class || type == Long.class) {<NEW_LINE>return (T) (Long) number.longValue();<NEW_LINE>}<NEW_LINE>if (type == double.class || type == Double.class) {<NEW_LINE>return (T) (Double) number.doubleValue();<NEW_LINE>}<NEW_LINE>if (type == float.class || type == Float.class) {<NEW_LINE>return (T) (Float) number.floatValue();<NEW_LINE>}<NEW_LINE>if (type == byte.class || type == Byte.class) {<NEW_LINE>return (T) (Byte) number.byteValue();<NEW_LINE>}<NEW_LINE>if (type == short.class || type == Short.class) {<NEW_LINE>return (T) (Short) number.shortValue();<NEW_LINE>}<NEW_LINE>if (type == BigInteger.class) {<NEW_LINE>return (T) BigInteger.valueOf(number.longValue());<NEW_LINE>}<NEW_LINE>if (type == BigDecimal.class) {<NEW_LINE>return (T) BigDecimal.valueOf(number.doubleValue());<NEW_LINE>}<NEW_LINE>if (type == Date.class) {<NEW_LINE>return (T) new Date(number.longValue());<NEW_LINE>}<NEW_LINE>if (type == Boolean.class) {<NEW_LINE>return (T) (Boolean) (number.doubleValue() != 0.0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (value instanceof String) {<NEW_LINE>String str = (String) value;<NEW_LINE>if (type == Boolean.class) {<NEW_LINE>return (T) (Boolean) !str.isEmpty();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (T) value;<NEW_LINE>} | (Integer) number.intValue(); |
1,100,429 | private static double[][] bcucof(double[] y, double[] y1, double[] y2, double[] y12, double d1, double d2) {<NEW_LINE>double d1d2 = d1 * d2;<NEW_LINE>double[] cl = new double[16];<NEW_LINE>double[] x = new double[16];<NEW_LINE>double[][] c = new double[4][4];<NEW_LINE>for (int i = 0; i < 4; i++) {<NEW_LINE>x[i] = y[i];<NEW_LINE>x[i + 4] = y1[i] * d1;<NEW_LINE>x[i + 8] = y2[i] * d2;<NEW_LINE>x[i + 12] = y12[i] * d1d2;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < 16; i++) {<NEW_LINE>double xx = 0.0;<NEW_LINE>for (int k = 0; k < 16; k++) {<NEW_LINE>xx += wt[i][k] * x[k];<NEW_LINE>}<NEW_LINE>cl[i] = xx;<NEW_LINE>}<NEW_LINE>for (int i = 0, l = 0; i < 4; i++) {<NEW_LINE>for (int j = 0; j < 4; j++) {<NEW_LINE>c[i][<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return c;<NEW_LINE>} | j] = cl[l++]; |
1,259,700 | private void updateButtonState(boolean next) {<NEW_LINE>if (showFilterItem != null) {<NEW_LINE>showFilterItem.setVisible(filter != null && !isNameSearch());<NEW_LINE>}<NEW_LINE>if (filter != null) {<NEW_LINE>int maxLength = 24;<NEW_LINE>String name = filter.getGeneratedName(maxLength);<NEW_LINE>// Next displays the actual query term instead of the generic "Seach by name", can be enabled for debugging or in general<NEW_LINE>if (isNameSearch()) {<NEW_LINE>name = "'" + filter.getFilterByName() + "'";<NEW_LINE>}<NEW_LINE>if (name.length() >= maxLength) {<NEW_LINE>name = name.substring(0, maxLength) + getString(R.string.shared_string_ellipsis);<NEW_LINE>}<NEW_LINE>if (filter instanceof NominatimPoiFilter && !((NominatimPoiFilter) filter).isPlacesQuery()) {<NEW_LINE>// nothing to add<NEW_LINE>} else {<NEW_LINE>name += " " + filter.getSearchArea(next);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (searchPOILevel != null) {<NEW_LINE>int title = location == null ? R.string.search_poi_location : R.string.search_POI_level_btn;<NEW_LINE>boolean taskAlreadyFinished = currentSearchTask == null || currentSearchTask.getStatus() != Status.RUNNING;<NEW_LINE>boolean enabled = taskAlreadyFinished && location != null && filter != null && filter.isSearchFurtherAvailable();<NEW_LINE>if (isNameSearch() && !Algorithms.objectEquals(searchFilter.getText().toString(), filter.getFilterByName())) {<NEW_LINE>title = R.string.search_button;<NEW_LINE>// Issue #2667 (2)<NEW_LINE>if (currentSearchTask == null) {<NEW_LINE>enabled = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>searchPOILevel.setEnabled(enabled);<NEW_LINE>searchPOILevel.setTitle(title);<NEW_LINE>}<NEW_LINE>} | getSupportActionBar().setTitle(name); |
1,132,741 | private boolean areDOMsEqual() {<NEW_LINE>// result<NEW_LINE>boolean result = true;<NEW_LINE>XPathFactory factory = XPathFactory.newInstance();<NEW_LINE>XPath xpathJ9DDR = factory.newXPath();<NEW_LINE>XPath xpathJExtract = factory.newXPath();<NEW_LINE>for (Iterator<Object> i = xpathQueries.keySet().iterator(); i.hasNext(); ) {<NEW_LINE>String key = (String) i.next();<NEW_LINE>String xpath = xpathQueries.getProperty(key);<NEW_LINE>messages.add("Test : " + key + " : " + xpath);<NEW_LINE>try {<NEW_LINE>NodeList resultJ9DDR = (NodeList) xpathJ9DDR.evaluate(<MASK><NEW_LINE>NodeList resultJExtract = (NodeList) xpathJExtract.evaluate(xpath, xmlJExtract, XPathConstants.NODESET);<NEW_LINE>boolean testResult = areNodeListsEqual(resultJ9DDR, resultJExtract);<NEW_LINE>if (!testResult) {<NEW_LINE>messages.add("Test failed : node lists are not equal");<NEW_LINE>}<NEW_LINE>result &= testResult;<NEW_LINE>} catch (XPathExpressionException e) {<NEW_LINE>messages.add("Skipping test, error in XPath expression : " + e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | xpath, xmlJ9DDR, XPathConstants.NODESET); |
1,375,262 | private void addGoalsNotIncludedInTargetCriteria(List<ExecutionResult> results) {<NEW_LINE>List<Properties.Criterion> requiredCriteria = new ArrayList<>(Arrays.asList(Properties.Criterion.OUTPUT, Properties.Criterion.INPUT, Properties.Criterion.METHOD, Properties.Criterion.METHODNOEXCEPTION, Properties.Criterion.EXCEPTION));<NEW_LINE>requiredCriteria.removeAll(Arrays.asList(Properties.CRITERION));<NEW_LINE>results = getUpdatedResults(requiredCriteria, results);<NEW_LINE>for (Properties.Criterion c : requiredCriteria) {<NEW_LINE>TestFitnessFactory<? extends TestFitnessFunction> <MASK><NEW_LINE>List<? extends TestFitnessFunction> goals = goalFactory.getCoverageGoals();<NEW_LINE>for (ExecutionResult result : results) {<NEW_LINE>for (TestFitnessFunction goal : goals) {<NEW_LINE>if (goal.isCovered(result))<NEW_LINE>result.test.addCoveredGoal(goal);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | goalFactory = FitnessFunctions.getFitnessFactory(c); |
1,019,731 | private void startNewUpload(User user, List<String> requestedUploads, boolean onWifiOnly, boolean whileChargingOnly, NameCollisionPolicy nameCollisionPolicy, int localAction, boolean isCreateRemoteFolder, int createdBy, OCFile file, boolean disableRetries) {<NEW_LINE>if (file.getStoragePath().startsWith("/data/data/")) {<NEW_LINE>Log_OC.d(TAG, "Upload from sensitive path is not allowed");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>OCUpload ocUpload <MASK><NEW_LINE>ocUpload.setFileSize(file.getFileLength());<NEW_LINE>ocUpload.setNameCollisionPolicy(nameCollisionPolicy);<NEW_LINE>ocUpload.setCreateRemoteFolder(isCreateRemoteFolder);<NEW_LINE>ocUpload.setCreatedBy(createdBy);<NEW_LINE>ocUpload.setLocalAction(localAction);<NEW_LINE>ocUpload.setUseWifiOnly(onWifiOnly);<NEW_LINE>ocUpload.setWhileChargingOnly(whileChargingOnly);<NEW_LINE>ocUpload.setUploadStatus(UploadStatus.UPLOAD_IN_PROGRESS);<NEW_LINE>UploadFileOperation newUpload = new UploadFileOperation(mUploadsStorageManager, connectivityService, powerManagementService, user, file, ocUpload, nameCollisionPolicy, localAction, this, onWifiOnly, whileChargingOnly, disableRetries, new FileDataStorageManager(user, getContentResolver()));<NEW_LINE>newUpload.setCreatedBy(createdBy);<NEW_LINE>if (isCreateRemoteFolder) {<NEW_LINE>newUpload.setRemoteFolderToBeCreated();<NEW_LINE>}<NEW_LINE>newUpload.addDataTransferProgressListener(this);<NEW_LINE>newUpload.addDataTransferProgressListener((FileUploaderBinder) mBinder);<NEW_LINE>newUpload.addRenameUploadListener(this);<NEW_LINE>Pair<String, String> putResult = mPendingUploads.putIfAbsent(user.getAccountName(), file.getRemotePath(), newUpload);<NEW_LINE>if (putResult != null) {<NEW_LINE>requestedUploads.add(putResult.first);<NEW_LINE>// Save upload in database<NEW_LINE>long id = mUploadsStorageManager.storeUpload(ocUpload);<NEW_LINE>newUpload.setOCUploadId(id);<NEW_LINE>}<NEW_LINE>} | = new OCUpload(file, user); |
944,203 | public EPPreparedQueryResult execute(FAFQueryMethodSelect select, ContextPartitionSelector[] contextPartitionSelectors, FAFQueryMethodAssignerSetter assignerSetter, ContextManagementService contextManagementService) {<NEW_LINE>FireAndForgetProcessor processor = select.getProcessors()[0];<NEW_LINE>ContextPartitionSelector singleSelector = contextPartitionSelectors != null && contextPartitionSelectors.length > 0 ? contextPartitionSelectors[0] : null;<NEW_LINE>Collection<Integer> agentInstanceIds = agentInstanceIds(processor, singleSelector, contextManagementService);<NEW_LINE>List<ContextPartitionResult> contextPartitionResults = new ArrayList<ContextPartitionResult>();<NEW_LINE>for (int agentInstanceId : agentInstanceIds) {<NEW_LINE>FireAndForgetInstance processorInstance = processor.getProcessorInstanceContextById(agentInstanceId);<NEW_LINE>if (processorInstance != null) {<NEW_LINE>Collection<EventBean> coll = processorInstance.snapshotBestEffort(select.getQueryGraph(), select.getAnnotations());<NEW_LINE>contextPartitionResults.add(new ContextPartitionResult(coll, processorInstance.getAgentInstanceContext()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// process context partitions<NEW_LINE>ArrayDeque<EventBean[]> events = new ArrayDeque<EventBean[]>();<NEW_LINE>ResultSetProcessor resultSetProcessor = null;<NEW_LINE>for (ContextPartitionResult contextPartitionResult : contextPartitionResults) {<NEW_LINE>resultSetProcessor = processorWithAssign(select.getResultSetProcessorFactoryProvider(), contextPartitionResult.getContext(), assignerSetter, select.getTableAccesses(<MASK><NEW_LINE>Collection<EventBean> snapshot = contextPartitionResult.getEvents();<NEW_LINE>if (select.getWhereClause() != null) {<NEW_LINE>snapshot = FAFQueryMethodSelectExecUtil.filtered(snapshot, select.getWhereClause(), contextPartitionResult.context);<NEW_LINE>}<NEW_LINE>EventBean[] rows = snapshot.toArray(new EventBean[snapshot.size()]);<NEW_LINE>resultSetProcessor.setExprEvaluatorContext(contextPartitionResult.getContext());<NEW_LINE>UniformPair<EventBean[]> results = resultSetProcessor.processViewResult(rows, null, true);<NEW_LINE>if (results != null && results.getFirst() != null && results.getFirst().length > 0) {<NEW_LINE>events.add(results.getFirst());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EventBean[] distinct = EventBeanUtility.getDistinctByProp(EventBeanUtility.flatten(events), select.getDistinctKeyGetter());<NEW_LINE>return new EPPreparedQueryResult(select.getEventType(), distinct);<NEW_LINE>} | ), select.getSubselects()); |
716,424 | public void read(org.apache.thrift.protocol.TProtocol iprot, key_value struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TField schemeField;<NEW_LINE>iprot.readStructBegin();<NEW_LINE>while (true) {<NEW_LINE>schemeField = iprot.readFieldBegin();<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(schemeField.id) {<NEW_LINE>case // KEY<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.key = new blob();<NEW_LINE><MASK><NEW_LINE>struct.setKeyIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // VALUE<NEW_LINE>2:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.value = new blob();<NEW_LINE>struct.value.read(iprot);<NEW_LINE>struct.setValueIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>iprot.readFieldEnd();<NEW_LINE>}<NEW_LINE>iprot.readStructEnd();<NEW_LINE>// check for required fields of primitive type, which can't be checked in the validate method<NEW_LINE>struct.validate();<NEW_LINE>} | struct.key.read(iprot); |
1,090,995 | private static void write(Argument arg) throws Exception {<NEW_LINE>try {<NEW_LINE>Document document = DocumentHelper.createDocument();<NEW_LINE>Element persistence = document.addElement("persistence", "http://java.sun.com/xml/ns/persistence");<NEW_LINE>persistence.addAttribute(QName.get("schemaLocation", "xsi", "http://www.w3.org/2001/XMLSchema-instance"), "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd");<NEW_LINE>persistence.addAttribute("version", "2.0");<NEW_LINE>for (Class<?> cls : scanContainerEntity(arg.getProject())) {<NEW_LINE>Element unit = persistence.addElement("persistence-unit");<NEW_LINE>unit.addAttribute("name", cls.getCanonicalName());<NEW_LINE>unit.addAttribute("transaction-type", "RESOURCE_LOCAL");<NEW_LINE>Element provider = unit.addElement("provider");<NEW_LINE>provider.addText(<MASK><NEW_LINE>for (Class<?> o : scanMappedSuperclass(cls)) {<NEW_LINE>Element mapped_element = unit.addElement("class");<NEW_LINE>mapped_element.addText(o.getCanonicalName());<NEW_LINE>}<NEW_LINE>Element slice_unit_properties = unit.addElement("properties");<NEW_LINE>Map<String, String> properties = new LinkedHashMap<String, String>();<NEW_LINE>for (Entry<String, String> entry : properties.entrySet()) {<NEW_LINE>Element property = slice_unit_properties.addElement("property");<NEW_LINE>property.addAttribute("name", entry.getKey());<NEW_LINE>property.addAttribute("value", entry.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>OutputFormat format = OutputFormat.createPrettyPrint();<NEW_LINE>format.setEncoding("UTF-8");<NEW_LINE>File file = new File(arg.getPath());<NEW_LINE>XMLWriter writer = new XMLWriter(new FileWriter(file), format);<NEW_LINE>writer.write(document);<NEW_LINE>writer.close();<NEW_LINE>System.out.println("create persistence.xml at path:" + arg.getPath());<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | PersistenceProviderImpl.class.getCanonicalName()); |
1,321,508 | private int parseSubject(int c) throws IOException, RDFParseException, RDFHandlerException {<NEW_LINE>final State state = peek();<NEW_LINE>// subject is either an uriref (<foo://bar>) or a nodeID (_:node1)<NEW_LINE>// OR a Statement.<NEW_LINE>if (c == '<') {<NEW_LINE>if (isStatement(c)) {<NEW_LINE>// Embedded statement.<NEW_LINE>// known '<'<NEW_LINE>c = reader.read();<NEW_LINE>if (c != '<')<NEW_LINE>reportFatalError("Expected '<', found: " + (char) c);<NEW_LINE>// have '<<', so this is an embedded statement.<NEW_LINE>// next character.<NEW_LINE>c = reader.read();<NEW_LINE>// skip any WS characters.<NEW_LINE>c = skipWhitespace(c);<NEW_LINE>push(new State());<NEW_LINE>c = parseTriple(c, true);<NEW_LINE>state.subject = pop().lastSID;<NEW_LINE>} else {<NEW_LINE>// subject is an uriref<NEW_LINE>final StringBuilder sb = getBuffer();<NEW_LINE>c = parseUriRef(c, sb);<NEW_LINE>state.subject = createURI(sb.toString());<NEW_LINE>}<NEW_LINE>} else if (c == '_') {<NEW_LINE>// subject is a bNode<NEW_LINE>final StringBuilder sb = getBuffer();<NEW_LINE>c = parseNodeID(c, sb);<NEW_LINE>state.subject = <MASK><NEW_LINE>} else if (c == -1) {<NEW_LINE>throwEOFException();<NEW_LINE>} else {<NEW_LINE>reportFatalError("Expected '<' or '_', found: " + (char) c);<NEW_LINE>}<NEW_LINE>return c;<NEW_LINE>} | createBNode(sb.toString()); |
700,858 | protected boolean createKeys(List<Content> list) {<NEW_LINE>if (accounts == null || accounts.isEmpty()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>CommunicationsManager communicationManager;<NEW_LINE>try {<NEW_LINE>communicationManager = Case.getCurrentCaseThrows().getSleuthkitCase().getCommunicationsManager();<NEW_LINE>} catch (NoCurrentCaseException | TskCoreException ex) {<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.WARNING, "Failed to get communications manager from case.", ex);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>accounts.forEach((account) -> {<NEW_LINE>try {<NEW_LINE>List<AccountFileInstance> <MASK><NEW_LINE>for (AccountFileInstance fileInstance : accountFileInstanceList) {<NEW_LINE>list.add(fileInstance.getFile());<NEW_LINE>}<NEW_LINE>} catch (TskCoreException ex) {<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.WARNING, String.format("Failed to getAccountFileInstances for account: %d", account.getAccountID()), ex);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return true;<NEW_LINE>} | accountFileInstanceList = communicationManager.getAccountFileInstances(account); |
894,896 | public void apply(Project project) {<NEW_LINE>if (project != project.getRootProject()) {<NEW_LINE>throw new IllegalStateException(this.getClass().getName() + " can only be applied to the root project.");<NEW_LINE>}<NEW_LINE>Provider<DockerSupportService> dockerSupportServiceProvider = project.getGradle().getSharedServices().registerIfAbsent(DOCKER_SUPPORT_SERVICE_NAME, DockerSupportService.class, spec -> spec.parameters(params -> {<NEW_LINE>params.setExclusionsFile(new File(project<MASK><NEW_LINE>}));<NEW_LINE>// Ensure that if we are trying to run any DockerBuildTask tasks, we assert an available Docker installation exists<NEW_LINE>project.getGradle().getTaskGraph().whenReady(graph -> {<NEW_LINE>List<String> dockerTasks = graph.getAllTasks().stream().filter(task -> task instanceof DockerBuildTask).map(Task::getPath).collect(Collectors.toList());<NEW_LINE>if (dockerTasks.isEmpty() == false) {<NEW_LINE>dockerSupportServiceProvider.get().failIfDockerUnavailable(dockerTasks);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | .getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE)); |
314,564 | public void start() throws Exception {<NEW_LINE>LOG.info("TracevisServer base location: " + _staticContentLocation + ", heapster location: " + _heapsterContentLocation);<NEW_LINE>LOG.info("Starting TracevisServer on port: " + _port + ", graphviz location: " + _dotLocation + ", cache size: " + _cacheSize + ", graphviz timeout: " + _timeoutMs + "ms");<NEW_LINE>final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors() + 1);<NEW_LINE>final Engine engine = new EngineBuilder().setTaskExecutor(scheduler).setTimerScheduler(scheduler).build();<NEW_LINE>Files.createDirectories(_cacheLocation);<NEW_LINE>for (File f : _cacheLocation.toFile().listFiles()) {<NEW_LINE>f.delete();<NEW_LINE>}<NEW_LINE>_graphvizEngine.start();<NEW_LINE>Server server = new Server();<NEW_LINE>server<MASK><NEW_LINE>server.setConnectors(getConnectors(server));<NEW_LINE>TracePostHandler tracePostHandler = new TracePostHandler(_staticContentLocation.toString());<NEW_LINE>ResourceHandler traceHandler = new ResourceHandler();<NEW_LINE>traceHandler.setDirectoriesListed(true);<NEW_LINE>traceHandler.setWelcomeFiles(new String[] { "trace.html" });<NEW_LINE>traceHandler.setResourceBase(_staticContentLocation.toString());<NEW_LINE>ResourceHandler heapsterHandler = new ResourceHandler();<NEW_LINE>heapsterHandler.setDirectoriesListed(true);<NEW_LINE>heapsterHandler.setResourceBase(_heapsterContentLocation.toString());<NEW_LINE>// Add the ResourceHandler to the server.<NEW_LINE>HandlerList handlers = new HandlerList();<NEW_LINE>handlers.setHandlers(new Handler[] { new DotHandler(_graphvizEngine, engine), new JhatHandler(engine), tracePostHandler, traceHandler, new HealthCheckHandler(), heapsterHandler, new DefaultHandler() });<NEW_LINE>server.setHandler(handlers);<NEW_LINE>try {<NEW_LINE>server.start();<NEW_LINE>server.join();<NEW_LINE>} finally {<NEW_LINE>server.stop();<NEW_LINE>_graphvizEngine.stop();<NEW_LINE>engine.shutdown();<NEW_LINE>scheduler.shutdownNow();<NEW_LINE>HttpClient.close();<NEW_LINE>}<NEW_LINE>} | .setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", -1); |
1,128,922 | public void probeMemory() {<NEW_LINE>long freeMemoryBytes = Runtime.getRuntime().freeMemory();<NEW_LINE>long totalMemoryBytes = Runtime<MASK><NEW_LINE>long maxMemoryBytes = Runtime.getRuntime().maxMemory();<NEW_LINE>long totalGcTimeMs = 0;<NEW_LINE>for (GarbageCollectorMXBean gcMxBean : ManagementFactory.getGarbageCollectorMXBeans()) {<NEW_LINE>long collectionTimeMs = gcMxBean.getCollectionTime();<NEW_LINE>if (collectionTimeMs == -1) {<NEW_LINE>// Gc collection time is not supported on this JVM.<NEW_LINE>totalGcTimeMs = -1;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>totalGcTimeMs += collectionTimeMs;<NEW_LINE>}<NEW_LINE>ImmutableMap.Builder<String, Long> currentMemoryBytesUsageByPool = ImmutableMap.builder();<NEW_LINE>for (MemoryPoolMXBean memoryPoolBean : ManagementFactory.getMemoryPoolMXBeans()) {<NEW_LINE>String name = memoryPoolBean.getName();<NEW_LINE>MemoryType type = memoryPoolBean.getType();<NEW_LINE>long currentlyUsedBytes = memoryPoolBean.getUsage().getUsed();<NEW_LINE>currentMemoryBytesUsageByPool.put(name + "(" + type + ")", currentlyUsedBytes);<NEW_LINE>}<NEW_LINE>eventBus.post(new MemoryPerfStatsEvent(freeMemoryBytes, totalMemoryBytes, maxMemoryBytes, totalGcTimeMs, currentMemoryBytesUsageByPool.build()));<NEW_LINE>} | .getRuntime().totalMemory(); |
1,503,522 | public static DescribeDnsGtmLogsResponse unmarshall(DescribeDnsGtmLogsResponse describeDnsGtmLogsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDnsGtmLogsResponse.setRequestId(_ctx.stringValue("DescribeDnsGtmLogsResponse.RequestId"));<NEW_LINE>describeDnsGtmLogsResponse.setTotalItems(_ctx.integerValue("DescribeDnsGtmLogsResponse.TotalItems"));<NEW_LINE>describeDnsGtmLogsResponse.setTotalPages(_ctx.integerValue("DescribeDnsGtmLogsResponse.TotalPages"));<NEW_LINE>describeDnsGtmLogsResponse.setPageSize(_ctx.integerValue("DescribeDnsGtmLogsResponse.PageSize"));<NEW_LINE>describeDnsGtmLogsResponse.setPageNumber(_ctx.integerValue("DescribeDnsGtmLogsResponse.PageNumber"));<NEW_LINE>List<Log> logs = new ArrayList<Log>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDnsGtmLogsResponse.Logs.Length"); i++) {<NEW_LINE>Log log = new Log();<NEW_LINE>log.setOperTime(_ctx.stringValue("DescribeDnsGtmLogsResponse.Logs[" + i + "].OperTime"));<NEW_LINE>log.setOperAction(_ctx.stringValue("DescribeDnsGtmLogsResponse.Logs[" + i + "].OperAction"));<NEW_LINE>log.setEntityType(_ctx.stringValue("DescribeDnsGtmLogsResponse.Logs[" + i + "].EntityType"));<NEW_LINE>log.setEntityId(_ctx.stringValue("DescribeDnsGtmLogsResponse.Logs[" + i + "].EntityId"));<NEW_LINE>log.setEntityName(_ctx.stringValue("DescribeDnsGtmLogsResponse.Logs[" + i + "].EntityName"));<NEW_LINE>log.setOperTimestamp(_ctx.longValue("DescribeDnsGtmLogsResponse.Logs[" + i + "].OperTimestamp"));<NEW_LINE>log.setId(_ctx.longValue<MASK><NEW_LINE>log.setContent(_ctx.stringValue("DescribeDnsGtmLogsResponse.Logs[" + i + "].Content"));<NEW_LINE>logs.add(log);<NEW_LINE>}<NEW_LINE>describeDnsGtmLogsResponse.setLogs(logs);<NEW_LINE>return describeDnsGtmLogsResponse;<NEW_LINE>} | ("DescribeDnsGtmLogsResponse.Logs[" + i + "].Id")); |
1,471,827 | public CodeActionResult codeActions(CodeActionContext context) {<NEW_LINE>CodeActionResult result = new CodeActionResult();<NEW_LINE>codeActionsMap.getOrDefault(context.diagnostic().diagnosticInfo().code(), Collections.emptyList()).forEach(codeActionDescriptor -> {<NEW_LINE>String codeActionName = getModifiedCodeActionName(context.diagnostic().diagnosticInfo().code(), codeActionDescriptor.compilerPluginInfo(), codeActionDescriptor.codeAction().name());<NEW_LINE>try {<NEW_LINE>codeActionDescriptor.codeAction().codeActionInfo(context).stream().peek(codeActionInfo -> {<NEW_LINE>// We change the provider name with package prefix<NEW_LINE>codeActionInfo.setProviderName(codeActionName);<NEW_LINE>codeActionInfo.<MASK><NEW_LINE>}).forEach(result::addCodeAction);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>CodeActionException ex = new CodeActionException(codeActionName, t);<NEW_LINE>result.addError(ex);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return result;<NEW_LINE>} | setArguments(codeActionInfo.getArguments()); |
1,269,361 | public static BaseRawValueBasedPredicateEvaluator newRawValueBasedEvaluator(EqPredicate eqPredicate, DataType dataType) {<NEW_LINE>String value = eqPredicate.getValue();<NEW_LINE>switch(dataType) {<NEW_LINE>case INT:<NEW_LINE>return new IntRawValueBasedEqPredicateEvaluator(eqPredicate, Integer.parseInt(value));<NEW_LINE>case LONG:<NEW_LINE>return new LongRawValueBasedEqPredicateEvaluator(eqPredicate, Long.parseLong(value));<NEW_LINE>case FLOAT:<NEW_LINE>return new FloatRawValueBasedEqPredicateEvaluator(eqPredicate, Float.parseFloat(value));<NEW_LINE>case DOUBLE:<NEW_LINE>return new DoubleRawValueBasedEqPredicateEvaluator(eqPredicate<MASK><NEW_LINE>case BOOLEAN:<NEW_LINE>return new IntRawValueBasedEqPredicateEvaluator(eqPredicate, BooleanUtils.toInt(value));<NEW_LINE>case TIMESTAMP:<NEW_LINE>return new LongRawValueBasedEqPredicateEvaluator(eqPredicate, TimestampUtils.toMillisSinceEpoch(value));<NEW_LINE>case STRING:<NEW_LINE>return new StringRawValueBasedEqPredicateEvaluator(eqPredicate, value);<NEW_LINE>case BYTES:<NEW_LINE>return new BytesRawValueBasedEqPredicateEvaluator(eqPredicate, BytesUtils.toBytes(value));<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("Unsupported data type: " + dataType);<NEW_LINE>}<NEW_LINE>} | , Double.parseDouble(value)); |
1,525,941 | protected void addCompilerSetupSteps(BuildContext context, ProjectFilesystem projectFilesystem, BuildTarget target, CompilerParameters compilerParameters, ResourcesParameters resourcesParameters, Builder<Step> steps) {<NEW_LINE>// Always create the output directory, even if there are no .java files to compile because there<NEW_LINE>// might be resources that need to be copied there.<NEW_LINE>steps.addAll(MakeCleanDirectoryStep.of(BuildCellRelativePath.fromCellRelativePath(context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getClassesDir())));<NEW_LINE>steps.addAll(MakeCleanDirectoryStep.of(BuildCellRelativePath.fromCellRelativePath(context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getAnnotationPath())));<NEW_LINE>steps.add(MkdirStep.of(BuildCellRelativePath.fromCellRelativePath(context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getOutputJarDirPath())));<NEW_LINE>// If there are resources, then link them to the appropriate place in the classes directory.<NEW_LINE>steps.add(new CopyResourcesStep(projectFilesystem, context, target, resourcesParameters, compilerParameters.getOutputPaths().getClassesDir()));<NEW_LINE>if (!compilerParameters.getSourceFilePaths().isEmpty()) {<NEW_LINE>steps.add(MkdirStep.of(BuildCellRelativePath.fromCellRelativePath(context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getPathToSourcesList(<MASK><NEW_LINE>steps.addAll(MakeCleanDirectoryStep.of(BuildCellRelativePath.fromCellRelativePath(context.getBuildCellRootPath(), projectFilesystem, compilerParameters.getOutputPaths().getWorkingDirectory())));<NEW_LINE>}<NEW_LINE>} | ).getParent()))); |
1,846,739 | private List<NameValueCountPair> listCreatorUnit(Business business, EffectivePerson effectivePerson, Application application) throws Exception {<NEW_LINE>EntityManager em = business.entityManagerContainer(<MASK><NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<String> cq = cb.createQuery(String.class);<NEW_LINE>Root<Work> root = cq.from(Work.class);<NEW_LINE>Predicate p = cb.equal(root.get(Work_.application), application.getId());<NEW_LINE>p = cb.and(p, cb.equal(root.get(Work_.creatorPerson), effectivePerson.getDistinguishedName()));<NEW_LINE>cq.select(root.get(Work_.creatorUnit)).where(p);<NEW_LINE>List<String> os = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());<NEW_LINE>List<NameValueCountPair> wos = new ArrayList<>();<NEW_LINE>for (String str : os) {<NEW_LINE>NameValueCountPair o = new NameValueCountPair();<NEW_LINE>o.setValue(str);<NEW_LINE>o.setName(StringUtils.defaultString(StringUtils.substringBefore(str, "@"), str));<NEW_LINE>wos.add(o);<NEW_LINE>}<NEW_LINE>SortTools.asc(wos, "name");<NEW_LINE>return wos;<NEW_LINE>} | ).get(Work.class); |
46,691 | // c: marshal_load<NEW_LINE>@JRubyMethod()<NEW_LINE>public IRubyObject marshal_load(ThreadContext context, IRubyObject arg) {<NEW_LINE>RubyArray load = arg.convertToArray();<NEW_LINE>if (load.size() != 3) {<NEW_LINE>throw <MASK><NEW_LINE>}<NEW_LINE>if (!(load.eltInternal(0) instanceof RubyBignum)) {<NEW_LINE>throw context.runtime.newTypeError(load.eltInternal(0), context.runtime.getBignum());<NEW_LINE>}<NEW_LINE>RubyBignum state = (RubyBignum) load.eltInternal(0);<NEW_LINE>int left = RubyNumeric.num2int(load.eltInternal(1));<NEW_LINE>IRubyObject seed = load.eltInternal(2);<NEW_LINE>checkFrozen();<NEW_LINE>random = new RandomType(seed, state, left);<NEW_LINE>if (load.hasVariables()) {<NEW_LINE>syncVariables((IRubyObject) load);<NEW_LINE>}<NEW_LINE>setFrozen(true);<NEW_LINE>return this;<NEW_LINE>} | context.runtime.newArgumentError("wrong dump data"); |
407,870 | final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(untagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UntagResourceRequest> request = null;<NEW_LINE>Response<UntagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));<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, "MediaPackage");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UntagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());<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,398,786 | static EObject apply(EProc proc, EObject fun, EObject args) throws Pausable {<NEW_LINE>ESeq a = args.testSeq();<NEW_LINE>if (a == null)<NEW_LINE>throw ERT.badarg(fun, args);<NEW_LINE>EObject res;<NEW_LINE>EFun f = fun.testFunction();<NEW_LINE>if (f != null) {<NEW_LINE>res = apply_last(proc, f, a);<NEW_LINE>} else {<NEW_LINE>ETuple t = fun.testTuple();<NEW_LINE>if (t == null) {<NEW_LINE>throw ERT.badfun(fun);<NEW_LINE>}<NEW_LINE>ETuple2 <MASK><NEW_LINE>if (t2 == null) {<NEW_LINE>throw ERT.badarg(fun, args);<NEW_LINE>}<NEW_LINE>EAtom mn = t2.elem1.testAtom();<NEW_LINE>EAtom fn = t2.elem2.testAtom();<NEW_LINE>FunID funspec;<NEW_LINE>f = EModuleManager.resolve(funspec = new FunID(mn, fn, a.length()));<NEW_LINE>if (f == null) {<NEW_LINE>throw ERT.undef(funspec, a.toArray());<NEW_LINE>}<NEW_LINE>res = apply_last(proc, f, a);<NEW_LINE>}<NEW_LINE>while (res == EProc.TAIL_MARKER) {<NEW_LINE>res = proc.tail.go(proc);<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | t2 = ETuple2.cast(t); |
1,406,654 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "create schema SupportBeanTwo as " + SupportBeanTwo.class.getName() + ";\n" + "on SupportBean event insert into astream select transpose(" + EPLInsertIntoTransposeStream.class.getName() + ".makeSB2Event(event));\n" + "on SupportBean event insert into bstream select transpose(" + EPLInsertIntoTransposeStream.class.getName() + ".makeSB2Event(event));\n" + "@name('a') select * from astream\n;" + "@name('b') select * from bstream\n;";<NEW_LINE>env.compileDeploy(epl).addListener("a").addListener("b");<NEW_LINE>env.sendEventBean(<MASK><NEW_LINE>String[] fields = new String[] { "stringTwo" };<NEW_LINE>env.assertPropsNew("a", fields, new Object[] { "E1" });<NEW_LINE>env.assertPropsNew("b", fields, new Object[] { "E1" });<NEW_LINE>env.undeployAll();<NEW_LINE>} | new SupportBean("E1", 1)); |
1,393,953 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>Settings.applyDarkThemeSetting(<MASK><NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>Intent intent = getIntent();<NEW_LINE>if (intent == null) {<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mSocketPath = intent.getStringExtra("socket");<NEW_LINE>if (mSocketPath == null) {<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>setContentView();<NEW_LINE>manageSocket();<NEW_LINE>// watch for the socket disappearing. that means su died.<NEW_LINE>new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>if (isFinishing())<NEW_LINE>return;<NEW_LINE>if (!new File(mSocketPath).exists()) {<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mHandler.postDelayed(this, 1000);<NEW_LINE>}<NEW_LINE>}.run();<NEW_LINE>mHandler.postDelayed(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (isFinishing())<NEW_LINE>return;<NEW_LINE>if (!mHandled)<NEW_LINE>handleAction(false, -1);<NEW_LINE>}<NEW_LINE>}, Settings.getRequestTimeout(this) * 1000);<NEW_LINE>} | this, R.style.RequestThemeDark); |
212,035 | public void doLayout() {<NEW_LINE>Dimension size = getSize();<NEW_LINE>if (!myTopStripe.isVisible()) {<NEW_LINE>myTopStripe.setBounds(0, 0, 0, 0);<NEW_LINE>myBottomStripe.setBounds(0, 0, 0, 0);<NEW_LINE>myLeftStripe.setBounds(0, 0, 0, 0);<NEW_LINE>myRightStripe.setBounds(0, 0, 0, 0);<NEW_LINE>myLayeredPane.setBounds(0, 0, getWidth(), getHeight());<NEW_LINE>} else {<NEW_LINE>Dimension topSize = myTopStripe.getPreferredSize();<NEW_LINE>Dimension bottomSize = myBottomStripe.getPreferredSize();<NEW_LINE>Dimension leftSize = myLeftStripe.getPreferredSize();<NEW_LINE>Dimension rightSize = myRightStripe.getPreferredSize();<NEW_LINE>myTopStripe.setBounds(0, 0, size.width, topSize.height);<NEW_LINE>myLeftStripe.setBounds(0, topSize.height, leftSize.width, size.height - topSize.height - bottomSize.height);<NEW_LINE>myRightStripe.setBounds(size.width - rightSize.width, topSize.height, rightSize.width, size.height - topSize.height - bottomSize.height);<NEW_LINE>myBottomStripe.setBounds(0, size.height - bottomSize.height, <MASK><NEW_LINE>if (UISettings.getInstance().getHideToolStripes() || UISettings.getInstance().getPresentationMode()) {<NEW_LINE>myLayeredPane.setBounds(0, 0, size.width, size.height);<NEW_LINE>} else {<NEW_LINE>myLayeredPane.setBounds(leftSize.width, topSize.height, size.width - leftSize.width - rightSize.width, size.height - topSize.height - bottomSize.height);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | size.width, bottomSize.height); |
1,187,025 | private Program doLoad(ByteProvider provider, String programName, DomainFolder programFolder, LoadSpec loadSpec, List<Option> options, MessageLog log, Object consumer, TaskMonitor monitor, Set<String> unprocessedLibraries) throws CancelledException, IOException {<NEW_LINE>LanguageCompilerSpecPair pair = loadSpec.getLanguageCompilerSpec();<NEW_LINE>Language language = getLanguageService().getLanguage(pair.languageID);<NEW_LINE>CompilerSpec compilerSpec = language.getCompilerSpecByID(pair.compilerSpecID);<NEW_LINE>monitor.setMessage(provider.getName());<NEW_LINE>Address imageBaseAddr = language.getAddressFactory().getDefaultAddressSpace().getAddress(loadSpec.getDesiredImageBase());<NEW_LINE>Program program = createProgram(provider, programName, imageBaseAddr, getName(<MASK><NEW_LINE>Comparator<String> libNameComparator = getLibNameComparator();<NEW_LINE>int transactionID = program.startTransaction("importing");<NEW_LINE>boolean success = false;<NEW_LINE>try {<NEW_LINE>log.appendMsg("----- Loading " + provider.getAbsolutePath() + " -----");<NEW_LINE>load(provider, loadSpec, options, program, monitor, log);<NEW_LINE>createDefaultMemoryBlocks(program, language, log);<NEW_LINE>if (unprocessedLibraries != null) {<NEW_LINE>ExternalManager extMgr = program.getExternalManager();<NEW_LINE>String[] externalNames = extMgr.getExternalLibraryNames();<NEW_LINE>Arrays.sort(externalNames, libNameComparator);<NEW_LINE>for (String name : externalNames) {<NEW_LINE>if (libNameComparator.compare(name, provider.getName()) == 0 || libNameComparator.compare(name, program.getName()) == 0 || Library.UNKNOWN.equals(name)) {<NEW_LINE>// skip self-references and UNKNOWN library...<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>unprocessedLibraries.add(name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>success = true;<NEW_LINE>return program;<NEW_LINE>} finally {<NEW_LINE>program.endTransaction(transactionID, success);<NEW_LINE>if (!success) {<NEW_LINE>program.release(consumer);<NEW_LINE>program = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), language, compilerSpec, consumer); |
1,805,666 | private List<String> splitSqlStatement(final String sql) {<NEW_LINE>List<String> parts = new ArrayList<>();<NEW_LINE>int apCount = 0;<NEW_LINE>int off = 0;<NEW_LINE>boolean skip = false;<NEW_LINE>for (int i = 0; i < sql.length(); i++) {<NEW_LINE>char c = sql.charAt(i);<NEW_LINE>if (skip) {<NEW_LINE>skip = false;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>switch(c) {<NEW_LINE>case '\'':<NEW_LINE>// skip something like 'xxxxx'<NEW_LINE>apCount++;<NEW_LINE>break;<NEW_LINE>case '\\':<NEW_LINE>// skip something like \r\n<NEW_LINE>skip = true;<NEW_LINE>break;<NEW_LINE>case '?':<NEW_LINE>// for input like: select a from 'bc' where d, 'bc' will be skipped<NEW_LINE>if ((apCount & 1) == 0) {<NEW_LINE>parts.add(sql<MASK><NEW_LINE>off = i + 1;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>parts.add(sql.substring(off));<NEW_LINE>return parts;<NEW_LINE>} | .substring(off, i)); |
299,245 | final ListEnvironmentAccountConnectionsResult executeListEnvironmentAccountConnections(ListEnvironmentAccountConnectionsRequest listEnvironmentAccountConnectionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listEnvironmentAccountConnectionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListEnvironmentAccountConnectionsRequest> request = null;<NEW_LINE>Response<ListEnvironmentAccountConnectionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListEnvironmentAccountConnectionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listEnvironmentAccountConnectionsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Proton");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEnvironmentAccountConnections");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListEnvironmentAccountConnectionsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListEnvironmentAccountConnectionsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
45,903 | final UpdateStreamingDistributionResult executeUpdateStreamingDistribution(UpdateStreamingDistributionRequest updateStreamingDistributionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateStreamingDistributionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateStreamingDistributionRequest> request = null;<NEW_LINE>Response<UpdateStreamingDistributionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateStreamingDistributionRequestMarshaller().marshall(super.beforeMarshalling(updateStreamingDistributionRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateStreamingDistribution");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<UpdateStreamingDistributionResult> responseHandler = new StaxResponseHandler<UpdateStreamingDistributionResult>(new UpdateStreamingDistributionResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "CloudFront"); |
55,557 | private boolean tooMuchTaskLag(long now, List<SingularityDisasterDataPoint> dataPoints) {<NEW_LINE>Optional<Long> criticalAvgLagTriggeredSince = Optional.empty();<NEW_LINE>Optional<Long> warningAvgLagTriggeredSince = Optional.empty();<NEW_LINE>Optional<Long> criticalPortionTriggeredSince = Optional.empty();<NEW_LINE>Optional<Long<MASK><NEW_LINE>for (SingularityDisasterDataPoint dataPoint : dataPoints) {<NEW_LINE>double overdueTaskPortion = dataPoint.getNumLateTasks() / (double) Math.max((dataPoint.getNumActiveTasks() + dataPoint.getNumPendingTasks()), 1);<NEW_LINE>boolean criticalOverdueTasksPortion = overdueTaskPortion > disasterConfiguration.getCriticalOverdueTaskPortion();<NEW_LINE>boolean warningOverdueTasksPortion = overdueTaskPortion > disasterConfiguration.getWarningOverdueTaskPortion();<NEW_LINE>boolean criticalAvgTaskLag = dataPoint.getAvgTaskLagMillis() > disasterConfiguration.getCriticalAvgTaskLagMillis() && warningOverdueTasksPortion;<NEW_LINE>boolean warningAvgTaskLag = dataPoint.getAvgTaskLagMillis() > disasterConfiguration.getWarningAvgTaskLagMillis();<NEW_LINE>if (criticalOverdueTasksPortion) {<NEW_LINE>criticalPortionTriggeredSince = Optional.of(dataPoint.getTimestamp());<NEW_LINE>}<NEW_LINE>if (warningOverdueTasksPortion) {<NEW_LINE>warningPortionTriggeredSince = Optional.of(dataPoint.getTimestamp());<NEW_LINE>}<NEW_LINE>if (criticalAvgTaskLag) {<NEW_LINE>criticalAvgLagTriggeredSince = Optional.of(dataPoint.getTimestamp());<NEW_LINE>}<NEW_LINE>if (warningAvgTaskLag) {<NEW_LINE>warningAvgLagTriggeredSince = Optional.of(dataPoint.getTimestamp());<NEW_LINE>}<NEW_LINE>if (!criticalOverdueTasksPortion && !warningOverdueTasksPortion && !criticalAvgTaskLag && !warningAvgTaskLag) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// 'true' if either critical condition is met<NEW_LINE>if ((criticalAvgLagTriggeredSince.isPresent() && now - criticalAvgLagTriggeredSince.get() > disasterConfiguration.getTriggerAfterMillisOverTaskLagThreshold()) || (criticalPortionTriggeredSince.isPresent() && now - criticalPortionTriggeredSince.get() > disasterConfiguration.getTriggerAfterMillisOverTaskLagThreshold())) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// 'true' if both warning conditions are met<NEW_LINE>return (warningAvgLagTriggeredSince.isPresent() && now - warningAvgLagTriggeredSince.get() > disasterConfiguration.getTriggerAfterMillisOverTaskLagThreshold() && warningPortionTriggeredSince.isPresent() && now - warningPortionTriggeredSince.get() > disasterConfiguration.getTriggerAfterMillisOverTaskLagThreshold());<NEW_LINE>} | > warningPortionTriggeredSince = Optional.empty(); |
874,790 | public static SearchHistoricalSnapshotsResponse unmarshall(SearchHistoricalSnapshotsResponse searchHistoricalSnapshotsResponse, UnmarshallerContext _ctx) {<NEW_LINE>searchHistoricalSnapshotsResponse.setRequestId(_ctx.stringValue("SearchHistoricalSnapshotsResponse.RequestId"));<NEW_LINE>searchHistoricalSnapshotsResponse.setSuccess(_ctx.booleanValue("SearchHistoricalSnapshotsResponse.Success"));<NEW_LINE>searchHistoricalSnapshotsResponse.setCode(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Code"));<NEW_LINE>searchHistoricalSnapshotsResponse.setMessage(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Message"));<NEW_LINE>searchHistoricalSnapshotsResponse.setLimit(_ctx.integerValue("SearchHistoricalSnapshotsResponse.Limit"));<NEW_LINE>searchHistoricalSnapshotsResponse.setNextToken(_ctx.stringValue("SearchHistoricalSnapshotsResponse.NextToken"));<NEW_LINE>searchHistoricalSnapshotsResponse.setTotalCount(_ctx.integerValue("SearchHistoricalSnapshotsResponse.TotalCount"));<NEW_LINE>List<Snapshot> snapshots = new ArrayList<Snapshot>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("SearchHistoricalSnapshotsResponse.Snapshots.Length"); i++) {<NEW_LINE>Snapshot snapshot = new Snapshot();<NEW_LINE>snapshot.setCreatedTime(_ctx.longValue<MASK><NEW_LINE>snapshot.setUpdatedTime(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].UpdatedTime"));<NEW_LINE>snapshot.setSnapshotId(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].SnapshotId"));<NEW_LINE>snapshot.setSourceType(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].SourceType"));<NEW_LINE>snapshot.setJobId(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].JobId"));<NEW_LINE>snapshot.setBackupType(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].BackupType"));<NEW_LINE>snapshot.setStatus(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].Status"));<NEW_LINE>snapshot.setSnapshotHash(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].SnapshotHash"));<NEW_LINE>snapshot.setParentSnapshotHash(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].ParentSnapshotHash"));<NEW_LINE>snapshot.setStartTime(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].StartTime"));<NEW_LINE>snapshot.setCompleteTime(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].CompleteTime"));<NEW_LINE>snapshot.setRetention(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].Retention"));<NEW_LINE>snapshot.setBytesTotal(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].BytesTotal"));<NEW_LINE>snapshot.setFileSystemId(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].FileSystemId"));<NEW_LINE>snapshot.setCreateTime(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].CreateTime"));<NEW_LINE>snapshot.setBucket(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].Bucket"));<NEW_LINE>snapshot.setPrefix(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].Prefix"));<NEW_LINE>snapshot.setInstanceId(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].InstanceId"));<NEW_LINE>snapshot.setPath(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].Path"));<NEW_LINE>snapshot.setClientId(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].ClientId"));<NEW_LINE>snapshot.setBytesDone(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].BytesDone"));<NEW_LINE>snapshot.setActualBytes(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].ActualBytes"));<NEW_LINE>snapshot.setItemsDone(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].ItemsDone"));<NEW_LINE>snapshot.setItemsTotal(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].ItemsTotal"));<NEW_LINE>snapshot.setActualItems(_ctx.longValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].ActualItems"));<NEW_LINE>snapshot.setErrorFile(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].ErrorFile"));<NEW_LINE>List<String> paths = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].Paths.Length"); j++) {<NEW_LINE>paths.add(_ctx.stringValue("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].Paths[" + j + "]"));<NEW_LINE>}<NEW_LINE>snapshot.setPaths(paths);<NEW_LINE>snapshots.add(snapshot);<NEW_LINE>}<NEW_LINE>searchHistoricalSnapshotsResponse.setSnapshots(snapshots);<NEW_LINE>return searchHistoricalSnapshotsResponse;<NEW_LINE>} | ("SearchHistoricalSnapshotsResponse.Snapshots[" + i + "].CreatedTime")); |
626,487 | public void invoke(@Nonnull Project project, Editor editor, PsiFile file, DataContext dataContext) {<NEW_LINE>int offset = editor.getCaretModel().getOffset();<NEW_LINE>editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);<NEW_LINE>PsiElement <MASK><NEW_LINE>while (true) {<NEW_LINE>if (element == null) {<NEW_LINE>String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("the.caret.should.be.positioned.at.the.class.method.or.field.to.be.refactored"));<NEW_LINE>CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, null);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (tryToMoveElement(element, project, dataContext, null, editor)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final TextRange range = element.getTextRange();<NEW_LINE>if (range != null) {<NEW_LINE>int relative = offset - range.getStartOffset();<NEW_LINE>final PsiReference reference = element.findReferenceAt(relative);<NEW_LINE>if (reference != null) {<NEW_LINE>final PsiElement refElement = reference.resolve();<NEW_LINE>if (refElement != null && tryToMoveElement(refElement, project, dataContext, reference, editor))<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>element = element.getParent();<NEW_LINE>}<NEW_LINE>} | element = file.findElementAt(offset); |
932,466 | private MetaDataContexts buildChangedMetaDataContextWithAddedDataSource(final ShardingSphereMetaData originalMetaData, final Map<String, DataSourceProperties> addedDataSourceProps) throws SQLException {<NEW_LINE>Map<String, DataSource> dataSourceMap = new HashMap<>(originalMetaData.getResource().getDataSources());<NEW_LINE>dataSourceMap.putAll(DataSourcePoolCreator.create(addedDataSourceProps));<NEW_LINE>Properties props = metaDataContexts.getProps().getProps();<NEW_LINE>SchemaConfiguration schemaConfiguration = new DataSourceProvidedSchemaConfiguration(dataSourceMap, originalMetaData.getRuleMetaData().getConfigurations());<NEW_LINE>Optional<MetaDataPersistService> metaDataPersistService = metaDataContexts.getMetaDataPersistService();<NEW_LINE>metaDataPersistService.ifPresent(optional -> persistTransactionConfiguration(schemaConfiguration, optional));<NEW_LINE>MetaDataContextsBuilder metaDataContextsBuilder = new MetaDataContextsBuilder(metaDataContexts.getGlobalRuleMetaData().getConfigurations(), props);<NEW_LINE>metaDataContextsBuilder.addSchema(originalMetaData.getName(), originalMetaData.getResource().getDatabaseType(), schemaConfiguration, props);<NEW_LINE>metaDataContexts.getMetaDataPersistService().ifPresent(optional -> optional.getSchemaMetaDataService().persist(originalMetaData.getName(), originalMetaData.getName(), metaDataContextsBuilder.getSchemaMap(originalMetaData.getName())));<NEW_LINE>return metaDataContextsBuilder.build(metaDataContexts.getMetaDataPersistService<MASK><NEW_LINE>} | ().orElse(null)); |
1,722,083 | public void addManagedBean(FileObject referenceFO, String beanName, String className) {<NEW_LINE>try {<NEW_LINE>WebModule webModule = WebModule.getWebModule(referenceFO);<NEW_LINE>if (webModule == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FileObject cfFileObject = null;<NEW_LINE>FileObject documentBase = webModule.getDocumentBase();<NEW_LINE>for (String file : JSFConfigUtilities.getConfigFiles(webModule)) {<NEW_LINE><MASK><NEW_LINE>if (cfFileObject != null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (cfFileObject == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final FacesConfig facesConfig = ConfigurationUtils.getConfigModel(cfFileObject, true).getRootComponent();<NEW_LINE>final ManagedBean managedBean = facesConfig.getModel().getFactory().createManagedBean();<NEW_LINE>managedBean.setManagedBeanName(beanName);<NEW_LINE>managedBean.setManagedBeanClass(className);<NEW_LINE>managedBean.setManagedBeanScope(ManagedBean.Scope.REQUEST);<NEW_LINE>// Description description = facesConfig.getModel().getFactory().createDescription();<NEW_LINE>// description.setValue("Managed Bean created by JSF Form");<NEW_LINE>// managedBean.addDescription(description);<NEW_LINE>JSFConfigModelUtilities.doInTransaction(facesConfig.getModel(), new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>facesConfig.addManagedBean(managedBean);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>JSFConfigModelUtilities.saveChanges(facesConfig.getModel());<NEW_LINE>} catch (IllegalStateException ex) {<NEW_LINE>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, ex.getMessage(), ex);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, ex.getMessage(), ex);<NEW_LINE>}<NEW_LINE>} | cfFileObject = documentBase.getFileObject(file); |
1,432,518 | public void start() {<NEW_LINE>if (this.running.compareAndSet(false, true)) {<NEW_LINE>EventListener eventListener = listenerMap.computeIfAbsent(buildKey(), event -> new EventListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onEvent(Event event) {<NEW_LINE>if (event instanceof NamingEvent) {<NEW_LINE>List<Instance> instances = ((NamingEvent) event).getInstances();<NEW_LINE>Optional<Instance> instanceOptional = selectCurrentInstance(instances);<NEW_LINE>instanceOptional.ifPresent(currentInstance -> {<NEW_LINE>resetIfNeeded(currentInstance);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>NamingService namingService = nacosServiceManager.<MASK><NEW_LINE>try {<NEW_LINE>namingService.subscribe(properties.getService(), properties.getGroup(), Arrays.asList(properties.getClusterName()), eventListener);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("namingService subscribe failed, properties:{}", properties, e);<NEW_LINE>}<NEW_LINE>this.watchFuture = this.taskScheduler.scheduleWithFixedDelay(this::nacosServicesWatch, this.properties.getWatchDelay());<NEW_LINE>}<NEW_LINE>} | getNamingService(properties.getNacosProperties()); |
678,686 | protected void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception {<NEW_LINE>for (Result result : results) {<NEW_LINE>log.debug("Query result: [{}]", result);<NEW_LINE>if (isNumeric(result.getValue())) {<NEW_LINE>Map<String, Object> map = new HashMap<>();<NEW_LINE>map.put("serverAlias", server.getAlias());<NEW_LINE>map.put("server", server.getHost());<NEW_LINE>map.put("port", server.getPort());<NEW_LINE>map.put("objDomain", result.getObjDomain());<NEW_LINE>map.put(<MASK><NEW_LINE>map.put("typeName", result.getTypeName());<NEW_LINE>map.put("attributeName", result.getAttributeName());<NEW_LINE>map.put("valuePath", Joiner.on('/').join(result.getValuePath()));<NEW_LINE>map.put("keyAlias", result.getKeyAlias());<NEW_LINE>map.put("value", Double.parseDouble(result.getValue().toString()));<NEW_LINE>map.put("timestamp", result.getEpoch());<NEW_LINE>log.debug("Insert into Elastic: Index: [{}] Type: [{}] Map: [{}]", indexName, ELASTIC_TYPE_NAME, map);<NEW_LINE>Index index = new Index.Builder(map).index(indexName).type(ELASTIC_TYPE_NAME).build();<NEW_LINE>JestResult addToIndex = jestClient.execute(index);<NEW_LINE>if (!addToIndex.isSucceeded()) {<NEW_LINE>throw new ElasticWriterException(String.format("Unable to write entry to elastic: %s", addToIndex.getErrorMessage()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>log.warn("Unable to submit non-numeric value to Elastic: [{}] from result [{}]", result.getValue(), result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "className", result.getClassName()); |
370,627 | final RemoveTagsFromVaultResult executeRemoveTagsFromVault(RemoveTagsFromVaultRequest removeTagsFromVaultRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(removeTagsFromVaultRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RemoveTagsFromVaultRequest> request = null;<NEW_LINE>Response<RemoveTagsFromVaultResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RemoveTagsFromVaultRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(removeTagsFromVaultRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Glacier");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RemoveTagsFromVault");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RemoveTagsFromVaultResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RemoveTagsFromVaultResultJsonUnmarshaller());<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.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
212,776 | // used by union and above<NEW_LINE>static final HllSketch heapify(final Memory srcMem, final boolean checkRebuild) {<NEW_LINE>final CurMode curMode = checkPreamble(srcMem);<NEW_LINE>final HllSketch heapSketch;<NEW_LINE>if (curMode == CurMode.HLL) {<NEW_LINE>final TgtHllType tgtHllType = extractTgtHllType(srcMem);<NEW_LINE>if (tgtHllType == TgtHllType.HLL_4) {<NEW_LINE>heapSketch = new HllSketch(Hll4Array.heapify(srcMem));<NEW_LINE>} else if (tgtHllType == TgtHllType.HLL_6) {<NEW_LINE>heapSketch = new HllSketch<MASK><NEW_LINE>} else {<NEW_LINE>// Hll_8<NEW_LINE>heapSketch = new HllSketch(Hll8Array.heapify(srcMem));<NEW_LINE>if (checkRebuild) {<NEW_LINE>Union.checkRebuildCurMinNumKxQ(heapSketch);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (curMode == CurMode.LIST) {<NEW_LINE>heapSketch = new HllSketch(CouponList.heapifyList(srcMem));<NEW_LINE>} else {<NEW_LINE>heapSketch = new HllSketch(CouponHashSet.heapifySet(srcMem));<NEW_LINE>}<NEW_LINE>return heapSketch;<NEW_LINE>} | (Hll6Array.heapify(srcMem)); |
770,843 | public void invoke(PHPRuleContext context, List<Hint> result) {<NEW_LINE>PHPParseResult phpParseResult = (PHPParseResult) context.parserResult;<NEW_LINE>if (phpParseResult.getProgram() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (CancelSupport.getDefault().isCancelled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final BaseDocument doc = context.doc;<NEW_LINE>OffsetRange lineBounds = VerificationUtils.createLineBounds(context.caretOffset, doc);<NEW_LINE>if (lineBounds.containsInclusive(context.caretOffset)) {<NEW_LINE>FileObject fileObject = phpParseResult.getSnapshot()<MASK><NEW_LINE>if (fileObject != null) {<NEW_LINE>CheckVisitor checkVisitor = new CheckVisitor(fileObject, this, context.doc, lineBounds);<NEW_LINE>phpParseResult.getProgram().accept(checkVisitor);<NEW_LINE>if (CancelSupport.getDefault().isCancelled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>result.addAll(checkVisitor.getHints());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getSource().getFileObject(); |
170,179 | public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {<NEW_LINE>TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "ori");<NEW_LINE>final Triple<IOperandTree, IOperandTree, IOperandTree> operands = OperandLoader.loadDuplicateFirst(instruction);<NEW_LINE>final String targetRegister = operands.first().getRootNode().getChildren().get(0).getValue();<NEW_LINE>final String sourceRegister = operands.second().getRootNode().getChildren().get(0).getValue();<NEW_LINE>final String sourceImmediate = operands.third().getRootNode().getChildren().<MASK><NEW_LINE>final OperandSize dw = OperandSize.DWORD;<NEW_LINE>final long baseOffset = ReilHelpers.toReilAddress(instruction.getAddress()).toLong();<NEW_LINE>final long offset = baseOffset;<NEW_LINE>instructions.add(ReilHelpers.createOr(offset, dw, sourceRegister, dw, sourceImmediate, dw, targetRegister));<NEW_LINE>} | get(0).getValue(); |
1,217,882 | public void onMessage(WebSocket webSocket, ByteBuffer bytes) {<NEW_LINE>byte streamID = bytes.get(0);<NEW_LINE>if (bytes.remaining() > 1) {<NEW_LINE>bytes.position(1);<NEW_LINE>KubernetesClientException exception = null;<NEW_LINE>String stringValue = StandardCharsets.UTF_8.<MASK><NEW_LINE>if (streamID == 3) {<NEW_LINE>try {<NEW_LINE>Status status = Serialization.unmarshal(stringValue, Status.class);<NEW_LINE>if (status != null) {<NEW_LINE>if (ExecWebSocketListener.parseExitCode(status) == 0) {<NEW_LINE>completeFuture.complete(null);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>exception = new KubernetesClientException(status);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// can't determine an exit code, just use the whole message as the error<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (exception == null) {<NEW_LINE>exception = new KubernetesClientException(stringValue);<NEW_LINE>}<NEW_LINE>completeFuture.completeExceptionally(exception);<NEW_LINE>}<NEW_LINE>} | decode(bytes).toString(); |
1,095,177 | private <T> Payload clientRequestPayloadToRSocketPayload(ClientRequestPayload<T> payload, TProtocolType protocolType) {<NEW_LINE>ByteBuf data = null;<NEW_LINE>ByteBuf metadata = null;<NEW_LINE>try {<NEW_LINE>data = alloc.buffer();<NEW_LINE>metadata = alloc.buffer();<NEW_LINE>final ByteBufTProtocol in = protocolType.apply(data);<NEW_LINE>in.writeStructBegin(PARAMETERS_STRUCT);<NEW_LINE>final Writer writer = payload.getDataWriter();<NEW_LINE>writer.write(in);<NEW_LINE>in.writeFieldStop();<NEW_LINE>in.writeStructEnd();<NEW_LINE>final ByteBufTProtocol metadataProtocol = TProtocolType.TCompact.apply(metadata);<NEW_LINE>payload.<MASK><NEW_LINE>return createPayload(alloc, payload.getRequestRpcMetadata().getCompression(), data, metadata);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>if (data != null && data.refCnt() > 0) {<NEW_LINE>data.release();<NEW_LINE>}<NEW_LINE>if (metadata != null && metadata.refCnt() > 0) {<NEW_LINE>metadata.release();<NEW_LINE>}<NEW_LINE>throw Exceptions.propagate(t);<NEW_LINE>}<NEW_LINE>} | getRequestRpcMetadata().write0(metadataProtocol); |
1,156,146 | final GetSMSSandboxAccountStatusResult executeGetSMSSandboxAccountStatus(GetSMSSandboxAccountStatusRequest getSMSSandboxAccountStatusRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getSMSSandboxAccountStatusRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetSMSSandboxAccountStatusRequest> request = null;<NEW_LINE>Response<GetSMSSandboxAccountStatusResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetSMSSandboxAccountStatusRequestMarshaller().marshall<MASK><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, "SNS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetSMSSandboxAccountStatus");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetSMSSandboxAccountStatusResult> responseHandler = new StaxResponseHandler<GetSMSSandboxAccountStatusResult>(new GetSMSSandboxAccountStatusResultStaxUnmarshaller());<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>} | (super.beforeMarshalling(getSMSSandboxAccountStatusRequest)); |
931,679 | public synchronized void handleFinishedReplica(AgentTask task, TTabletInfo finishTabletInfo, long reportVersion) throws MetaNotFoundException {<NEW_LINE>// report version is unused here<NEW_LINE>Preconditions.checkArgument(task instanceof CreateRollupTask);<NEW_LINE>CreateRollupTask createRollupTask = (CreateRollupTask) task;<NEW_LINE>long partitionId = createRollupTask.getPartitionId();<NEW_LINE>long rollupIndexId = createRollupTask.getIndexId();<NEW_LINE>long rollupTabletId = createRollupTask.getTabletId();<NEW_LINE>long rollupReplicaId = createRollupTask.getRollupReplicaId();<NEW_LINE>MaterializedIndex rollupIndex = this.partitionIdToRollupIndex.get(partitionId);<NEW_LINE>if (rollupIndex == null || rollupIndex.getId() != rollupIndexId) {<NEW_LINE>throw new MetaNotFoundException("Cannot find rollup index[" + rollupIndexId + "]");<NEW_LINE>}<NEW_LINE>Preconditions.checkState(rollupIndex.getState() == IndexState.ROLLUP);<NEW_LINE>Preconditions.checkArgument(finishTabletInfo.getTablet_id() == rollupTabletId);<NEW_LINE>LocalTablet rollupTablet = (LocalTablet) rollupIndex.getTablet(rollupTabletId);<NEW_LINE>if (rollupTablet == null) {<NEW_LINE>throw new MetaNotFoundException("Cannot find rollup tablet[" + rollupTabletId + "]");<NEW_LINE>}<NEW_LINE>Replica <MASK><NEW_LINE>if (rollupReplica == null) {<NEW_LINE>throw new MetaNotFoundException("Cannot find rollup replica[" + rollupReplicaId + "]");<NEW_LINE>}<NEW_LINE>if (rollupReplica.getState() == ReplicaState.NORMAL) {<NEW_LINE>// FIXME(cmy): still don't know why this can happen. add log to observe<NEW_LINE>LOG.warn("rollup replica[{}]' state is already set to NORMAL. tablet[{}]. backend[{}]", rollupReplicaId, rollupTabletId, task.getBackendId());<NEW_LINE>}<NEW_LINE>long version = finishTabletInfo.getVersion();<NEW_LINE>long dataSize = finishTabletInfo.getData_size();<NEW_LINE>long rowCount = finishTabletInfo.getRow_count();<NEW_LINE>// yiguolei: not check version here because the replica's first version will be set by rollup job<NEW_LINE>// the version is not set now<NEW_LINE>rollupReplica.updateRowCount(version, dataSize, rowCount);<NEW_LINE>if (finishTabletInfo.isSetPath_hash()) {<NEW_LINE>rollupReplica.setPathHash(finishTabletInfo.getPath_hash());<NEW_LINE>}<NEW_LINE>setReplicaFinished(partitionId, rollupReplicaId);<NEW_LINE>rollupReplica.setState(ReplicaState.NORMAL);<NEW_LINE>LOG.info("finished rollup replica[{}]. index[{}]. tablet[{}]. backend[{}], version: {}", rollupReplicaId, rollupIndexId, rollupTabletId, task.getBackendId(), version);<NEW_LINE>} | rollupReplica = rollupTablet.getReplicaById(rollupReplicaId); |
403,184 | private static void moveDirectory(File srcDir, File dstDir) throws IOException {<NEW_LINE>if (!srcDir.isDirectory()) {<NEW_LINE>throw new IllegalArgumentException("Source is not a directory: " + srcDir.getPath());<NEW_LINE>}<NEW_LINE>if (!srcDir.exists()) {<NEW_LINE>String msg = String.format(Locale.US, "Source directory %s does not exist", srcDir.getPath());<NEW_LINE>Log.e(LOG_TAG, msg);<NEW_LINE>throw new IOException(msg);<NEW_LINE>}<NEW_LINE>if (!dstDir.exists() || !dstDir.isDirectory()) {<NEW_LINE>Log.w(LOG_TAG, "Target directory does not exist. Attempting to create..." + dstDir.getPath());<NEW_LINE>if (!dstDir.mkdirs()) {<NEW_LINE>throw new IOException(String.format("Target directory %s does not exist and could not be created", dstDir.getPath()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (// nothing to see here, move along<NEW_LINE>srcDir.listFiles() == null)<NEW_LINE>return;<NEW_LINE>for (File src : srcDir.listFiles()) {<NEW_LINE>if (src.isDirectory()) {<NEW_LINE>File dst = new File(dstDir, src.getName());<NEW_LINE>dst.mkdir();<NEW_LINE>moveDirectory(src, dst);<NEW_LINE>if (!src.delete())<NEW_LINE>Log.i(LOG_TAG, <MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>File dst = new File(dstDir, src.getName());<NEW_LINE>MigrationHelper.moveFile(src, dst);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Log.e(LOG_TAG, "Error moving file " + src.getPath());<NEW_LINE>Crashlytics.logException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Failed to delete directory: " + src.getPath()); |
505,486 | public Answer execute(final MaintainCommand command, final CitrixResourceBase citrixResourceBase) {<NEW_LINE>final Connection conn = citrixResourceBase.getConnection();<NEW_LINE>try {<NEW_LINE>final XsHost xsHost = citrixResourceBase.getHost();<NEW_LINE>final String uuid = xsHost.getUuid();<NEW_LINE>final Host host = Host.getByUuid(conn, uuid);<NEW_LINE>// remove all tags cloud stack<NEW_LINE>final Host.Record hr = host.getRecord(conn);<NEW_LINE>// Adding this check because could not get the mock to work. Will push the code and fix it afterwards.<NEW_LINE>if (hr == null) {<NEW_LINE>s_logger.warn("Host.Record is null.");<NEW_LINE>return new MaintainAnswer(command, false, "Host.Record is null");<NEW_LINE>}<NEW_LINE>final Iterator<String> it = hr.tags.iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>final String tag = it.next();<NEW_LINE>if (tag.contains("cloud")) {<NEW_LINE>it.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>host.setTags(conn, hr.tags);<NEW_LINE>return new MaintainAnswer(command);<NEW_LINE>} catch (final XenAPIException e) {<NEW_LINE>s_logger.warn("Unable to put server in maintainence mode", e);<NEW_LINE>return new MaintainAnswer(command, false, e.getMessage());<NEW_LINE>} catch (final XmlRpcException e) {<NEW_LINE><MASK><NEW_LINE>return new MaintainAnswer(command, false, e.getMessage());<NEW_LINE>}<NEW_LINE>} | s_logger.warn("Unable to put server in maintainence mode", e); |
1,763,406 | public GeoMatchSet unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GeoMatchSet geoMatchSet = new GeoMatchSet();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("GeoMatchSetId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>geoMatchSet.setGeoMatchSetId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>geoMatchSet.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("GeoMatchConstraints", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>geoMatchSet.setGeoMatchConstraints(new ListUnmarshaller<GeoMatchConstraint>(GeoMatchConstraintJsonUnmarshaller.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 geoMatchSet;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,612,829 | void defineDestructuringPatternInVarDeclaration(Node pattern, TypedScope scope, Supplier<RValueInfo> patternTypeSupplier) {<NEW_LINE>for (DestructuredTarget target : DestructuredTarget.createAllNonEmptyTargetsInPattern(typeRegistry, () -> patternTypeSupplier.get().type, pattern)) {<NEW_LINE>Supplier<RValueInfo> typeSupplier = () -> inferTypeForDestructuredTarget(target, patternTypeSupplier);<NEW_LINE>if (target.getNode().isDestructuringPattern()) {<NEW_LINE>defineDestructuringPatternInVarDeclaration(target.getNode(), scope, typeSupplier);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>checkState(name.isName(), "This method is only for declaring variables: %s", name);<NEW_LINE>// variable's type<NEW_LINE>JSType type = getDeclaredType(name.getJSDocInfo(), name, /* rValue= */<NEW_LINE>null, typeSupplier);<NEW_LINE>if (type == null) {<NEW_LINE>// The variable's type will be inferred.<NEW_LINE>type = name.isFromExterns() ? unknownType : null;<NEW_LINE>}<NEW_LINE>new SlotDefiner().forDeclarationNode(name).forVariableName(name.getString()).inScope(scope).withType(type).allowLaterTypeInference(type == null).defineSlot();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Node name = target.getNode(); |
567,399 | // / Driver code<NEW_LINE>public static void main(String[] args) {<NEW_LINE>Scanner infile = new Scanner(System.in);<NEW_LINE>int w, n, i;<NEW_LINE><MASK><NEW_LINE>n = infile.nextInt();<NEW_LINE>System.out.println("Enter the maximum weight of knapsack: ");<NEW_LINE>w = infile.nextInt();<NEW_LINE>int[] val = new int[n];<NEW_LINE>int[] weights = new int[n];<NEW_LINE>System.out.println("Enter the weight of each element: ");<NEW_LINE>for (i = 0; i < n; i++) {<NEW_LINE>weights[i] = infile.nextInt();<NEW_LINE>}<NEW_LINE>System.out.println("Enter the value of each element: ");<NEW_LINE>for (i = 0; i < n; i++) {<NEW_LINE>val[i] = infile.nextInt();<NEW_LINE>}<NEW_LINE>infile.close();<NEW_LINE>System.out.println(knapSack(w, weights, val, n));<NEW_LINE>} | System.out.println("Enter the number of elements: "); |
146,470 | public ExecutionResult executeInVR(String routerIp, String script, String args, Duration timeout) {<NEW_LINE>if (!script.contains(domRCloudPath)) {<NEW_LINE>script = domRCloudPath + "/" + script;<NEW_LINE>}<NEW_LINE>String cmd = script + " " + args;<NEW_LINE>logger.debug("executeInVR via " + agentName + " on " + routerIp + ": " + cmd);<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>CloudstackPlugin.ReturnCode result;<NEW_LINE>result = cSp.domrExec(routerIp, cmd);<NEW_LINE>return new ExecutionResult(result.getRc(), result.getStdOut());<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("executeInVR FAILED via " + agentName + " on " + routerIp + ":" + cmd + ", " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>return new ExecutionResult(false, "");<NEW_LINE>} | CloudstackPlugin cSp = new CloudstackPlugin(c); |
1,365,852 | public void update(ViewerCell cell) {<NEW_LINE>DBPNamedObject element = <MASK><NEW_LINE>if (cell.getColumnIndex() == 0) {<NEW_LINE>cell.setText(element.getName());<NEW_LINE>DBPImage icon = null;<NEW_LINE>if (element instanceof DBPDriver) {<NEW_LINE>icon = ((DBPDriver) element).getIcon();<NEW_LINE>} else if (element instanceof DBPDataSourceProviderDescriptor) {<NEW_LINE>icon = ((DBPDataSourceProviderDescriptor) element).getIcon();<NEW_LINE>}<NEW_LINE>if (icon != null) {<NEW_LINE>cell.setImage(DBeaverIcons.getImage(icon));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (element instanceof DBPDriver) {<NEW_LINE>cell.setText(CommonUtils.notEmpty(((DBPDriver) element).getDescription()));<NEW_LINE>} else if (element instanceof DBPDataSourceProviderDescriptor) {<NEW_LINE>cell.setText(((DBPDataSourceProviderDescriptor) element).getDescription());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (DBPNamedObject) cell.getElement(); |
1,634,818 | public List<ShelvedChangeList> importChangeLists(final Collection<VirtualFile> files, final Consumer<VcsException> exceptionConsumer) {<NEW_LINE>final List<ShelvedChangeList> result = new ArrayList<>(files.size());<NEW_LINE>try {<NEW_LINE>final FilesProgress filesProgress = new FilesProgress(files.size(), "Processing ");<NEW_LINE>for (VirtualFile file : files) {<NEW_LINE>filesProgress.updateIndicator(file);<NEW_LINE>final String description = file.getNameWithoutExtension().replace('_', ' ');<NEW_LINE>File schemeNameDir = generateUniqueSchemePatchDir(description, true);<NEW_LINE><MASK><NEW_LINE>final ShelvedChangeList list = new ShelvedChangeList(patchPath.getPath(), description, new SmartList<>(), file.getTimeStamp());<NEW_LINE>list.setName(schemeNameDir.getName());<NEW_LINE>try {<NEW_LINE>final List<TextFilePatch> patchesList = loadPatches(myProject, file.getPath(), new CommitContext());<NEW_LINE>if (!patchesList.isEmpty()) {<NEW_LINE>FileUtil.copy(new File(file.getPath()), patchPath);<NEW_LINE>// add only if ok to read patch<NEW_LINE>mySchemeManager.addNewScheme(list, false);<NEW_LINE>result.add(list);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>exceptionConsumer.consume(new VcsException(e));<NEW_LINE>} catch (PatchSyntaxException e) {<NEW_LINE>exceptionConsumer.consume(new VcsException(e));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>notifyStateChanged();<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | final File patchPath = getPatchFileInConfigDir(schemeNameDir); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.