idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,678,388 | public void testPersistentMessageClassicApi(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>QueueConnection con = jmsQCFBindings.createQueueConnection();<NEW_LINE>con.start();<NEW_LINE>QueueSession sessionSender = con.<MASK><NEW_LINE>QueueSender producer1 = sessionSender.createSender(jmsQueue);<NEW_LINE>emptyQueue(jmsQCFBindings, jmsQueue);<NEW_LINE>QueueSender producer2 = sessionSender.createSender(jmsQueue1);<NEW_LINE>emptyQueue(jmsQCFBindings, jmsQueue1);<NEW_LINE>producer1.setDeliveryMode(DeliveryMode.PERSISTENT);<NEW_LINE>producer1.setDeliveryDelay(1000);<NEW_LINE>TextMessage msg1 = sessionSender.createTextMessage("testPersistentMessage_PersistentMsgClassicApi");<NEW_LINE>producer1.send(msg1);<NEW_LINE>producer2.setDeliveryDelay(1000);<NEW_LINE>producer2.setDeliveryMode(DeliveryMode.NON_PERSISTENT);<NEW_LINE>TextMessage msg2 = sessionSender.createTextMessage("testPersistentMessage_NonPersistentMsgClassicApi");<NEW_LINE>producer2.send(msg2);<NEW_LINE>sessionSender.close();<NEW_LINE>con.close();<NEW_LINE>} | createQueueSession(false, Session.AUTO_ACKNOWLEDGE); |
504,885 | public void marshall(Device device, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (device == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(device.getDeviceArn(), DEVICEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(device.getDeviceSerialNumber(), DEVICESERIALNUMBER_BINDING);<NEW_LINE>protocolMarshaller.marshall(device.getDeviceType(), DEVICETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(device.getDeviceName(), DEVICENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(device.getSoftwareVersion(), SOFTWAREVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(device.getMacAddress(), MACADDRESS_BINDING);<NEW_LINE>protocolMarshaller.marshall(device.getRoomArn(), ROOMARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(device.getDeviceStatus(), DEVICESTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(device.getNetworkProfileInfo(), NETWORKPROFILEINFO_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | device.getDeviceStatusInfo(), DEVICESTATUSINFO_BINDING); |
417,735 | public ListFlowExecutionMessagesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListFlowExecutionMessagesResult listFlowExecutionMessagesResult = new ListFlowExecutionMessagesResult();<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 listFlowExecutionMessagesResult;<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("messages", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listFlowExecutionMessagesResult.setMessages(new ListUnmarshaller<FlowExecutionMessage>(FlowExecutionMessageJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listFlowExecutionMessagesResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listFlowExecutionMessagesResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,551,284 | public K lastKey() {<NEW_LINE>atomicOperationsManager.acquireReadLock(this);<NEW_LINE>try {<NEW_LINE>acquireSharedLock();<NEW_LINE>try {<NEW_LINE>final <MASK><NEW_LINE>final Optional<BucketSearchResult> searchResult = lastItem(atomicOperation);<NEW_LINE>if (!searchResult.isPresent()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final BucketSearchResult result = searchResult.get();<NEW_LINE>final OCacheEntry cacheEntry = loadPageForRead(atomicOperation, fileId, result.pageIndex, false);<NEW_LINE>try {<NEW_LINE>final CellBTreeSingleValueBucketV3<K> bucket = new CellBTreeSingleValueBucketV3<>(cacheEntry);<NEW_LINE>return bucket.getKey(result.itemIndex, keySerializer);<NEW_LINE>} finally {<NEW_LINE>releasePageFromRead(atomicOperation, cacheEntry);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>releaseSharedLock();<NEW_LINE>}<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw OException.wrapException(new CellBTreeSingleValueV3Exception("Error during finding last key in sbtree [" + getName() + "]", this), e);<NEW_LINE>} finally {<NEW_LINE>atomicOperationsManager.releaseReadLock(this);<NEW_LINE>}<NEW_LINE>} | OAtomicOperation atomicOperation = atomicOperationsManager.getCurrentOperation(); |
1,717,331 | public static void updateWidget(Context context, AppWidgetManager manager, Song song, int state) {<NEW_LINE>if (!sEnabled)<NEW_LINE>return;<NEW_LINE>RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.four_long_widget);<NEW_LINE>if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) {<NEW_LINE>views.setViewVisibility(R.id.play_pause, View.GONE);<NEW_LINE>views.setViewVisibility(R.id.next, View.GONE);<NEW_LINE>views.setViewVisibility(R.id.title, View.GONE);<NEW_LINE>views.setInt(R.id.artist, "setText", R.string.no_songs);<NEW_LINE>views.setViewVisibility(R.id.album, View.GONE);<NEW_LINE>} else if (song == null) {<NEW_LINE>views.setViewVisibility(R.id.play_pause, View.VISIBLE);<NEW_LINE>views.setViewVisibility(R.id.next, View.VISIBLE);<NEW_LINE>views.setViewVisibility(R.<MASK><NEW_LINE>views.setInt(R.id.artist, "setText", R.string.app_name);<NEW_LINE>views.setViewVisibility(R.id.album, View.GONE);<NEW_LINE>} else {<NEW_LINE>views.setViewVisibility(R.id.play_pause, View.VISIBLE);<NEW_LINE>views.setViewVisibility(R.id.next, View.VISIBLE);<NEW_LINE>views.setViewVisibility(R.id.title, View.VISIBLE);<NEW_LINE>views.setViewVisibility(R.id.album, View.VISIBLE);<NEW_LINE>views.setTextViewText(R.id.title, song.title);<NEW_LINE>views.setTextViewText(R.id.artist, song.artist);<NEW_LINE>views.setTextViewText(R.id.album, song.album);<NEW_LINE>Bitmap cover = song.getMediumCover(context);<NEW_LINE>if (cover == null) {<NEW_LINE>views.setImageViewResource(R.id.cover, R.drawable.fallback_cover_large);<NEW_LINE>} else {<NEW_LINE>views.setImageViewBitmap(R.id.cover, cover);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0;<NEW_LINE>views.setImageViewResource(R.id.play_pause, playing ? R.drawable.pause : R.drawable.play);<NEW_LINE>Intent intent;<NEW_LINE>PendingIntent pendingIntent;<NEW_LINE>int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME;<NEW_LINE>intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN);<NEW_LINE>pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);<NEW_LINE>views.setOnClickPendingIntent(R.id.cover, pendingIntent);<NEW_LINE>views.setOnClickPendingIntent(R.id.text_layout, pendingIntent);<NEW_LINE>intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK);<NEW_LINE>pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);<NEW_LINE>views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);<NEW_LINE>intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG);<NEW_LINE>pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);<NEW_LINE>views.setOnClickPendingIntent(R.id.next, pendingIntent);<NEW_LINE>manager.updateAppWidget(new ComponentName(context, FourLongWidget.class), views);<NEW_LINE>} | id.title, View.GONE); |
1,695,779 | public void onKey(KeyEvent event) {<NEW_LINE>if (Input.isKeyPressed(GLFW.GLFW_KEY_F3))<NEW_LINE>return;<NEW_LINE>// TODO: This is very bad but you all can cope :cope:<NEW_LINE>GUIMove guiMove = Modules.get().get(GUIMove.class);<NEW_LINE>if (mc.currentScreen != null && !guiMove.isActive())<NEW_LINE>return;<NEW_LINE>if (mc.currentScreen != null && guiMove.isActive() && guiMove.skip())<NEW_LINE>return;<NEW_LINE>boolean cancel = true;<NEW_LINE>if (mc.options.forwardKey.matchesKey(event.key, 0) || mc.options.forwardKey.matchesMouse(event.key)) {<NEW_LINE>forward <MASK><NEW_LINE>mc.options.forwardKey.setPressed(false);<NEW_LINE>} else if (mc.options.backKey.matchesKey(event.key, 0) || mc.options.backKey.matchesMouse(event.key)) {<NEW_LINE>backward = event.action != KeyAction.Release;<NEW_LINE>mc.options.backKey.setPressed(false);<NEW_LINE>} else if (mc.options.rightKey.matchesKey(event.key, 0) || mc.options.rightKey.matchesMouse(event.key)) {<NEW_LINE>right = event.action != KeyAction.Release;<NEW_LINE>mc.options.rightKey.setPressed(false);<NEW_LINE>} else if (mc.options.leftKey.matchesKey(event.key, 0) || mc.options.leftKey.matchesMouse(event.key)) {<NEW_LINE>left = event.action != KeyAction.Release;<NEW_LINE>mc.options.leftKey.setPressed(false);<NEW_LINE>} else if (mc.options.jumpKey.matchesKey(event.key, 0) || mc.options.jumpKey.matchesMouse(event.key)) {<NEW_LINE>up = event.action != KeyAction.Release;<NEW_LINE>mc.options.jumpKey.setPressed(false);<NEW_LINE>} else if (mc.options.sneakKey.matchesKey(event.key, 0) || mc.options.sneakKey.matchesMouse(event.key)) {<NEW_LINE>down = event.action != KeyAction.Release;<NEW_LINE>mc.options.sneakKey.setPressed(false);<NEW_LINE>} else {<NEW_LINE>cancel = false;<NEW_LINE>}<NEW_LINE>if (cancel)<NEW_LINE>event.cancel();<NEW_LINE>} | = event.action != KeyAction.Release; |
1,436,567 | default <R1, R2, R> ReactiveSeq<R> forEach3(Function<? super T, ? extends BaseStream<R1, ?>> stream1, BiFunction<? super T, ? super R1, ? extends BaseStream<R2, ?>> stream2, Function3<? super T, ? super R1, ? super R2, ? extends R> yieldingFunction) {<NEW_LINE>return this.flatMap(in -> {<NEW_LINE>ReactiveSeq<R1> a = stream1 instanceof ReactiveSeq ? (ReactiveSeq) stream1 : ReactiveSeq.fromIterable(() -> stream1.apply(in).iterator());<NEW_LINE>return ReactiveSeq.fromIterable(a).flatMap(ina -> {<NEW_LINE>ReactiveSeq<R2> b = stream2 instanceof ReactiveSeq ? (ReactiveSeq) stream2 : ReactiveSeq.fromIterable(() -> stream2.apply(in, ina).iterator());<NEW_LINE>return b.map(in2 -> yieldingFunction.apply<MASK><NEW_LINE>});<NEW_LINE>});<NEW_LINE>} | (in, ina, in2)); |
426,049 | protected void prePassivate(InvocationContext inv) {<NEW_LINE>try {<NEW_LINE>ResultsLocal results = ResultsLocalBean.getSFBean();<NEW_LINE>results.addPrePassivate(CLASS_NAME, "prePassivate");<NEW_LINE>// Validate and update context data.<NEW_LINE>Map<String, Object> map = inv.getContextData();<NEW_LINE>String data;<NEW_LINE>if (map.containsKey("PrePassivate")) {<NEW_LINE>data = (String) map.get("PrePassivate");<NEW_LINE>data = data + ":" + CLASS_NAME;<NEW_LINE>} else {<NEW_LINE>data = CLASS_NAME;<NEW_LINE>}<NEW_LINE>map.put("PrePassivate", data);<NEW_LINE>results.setPrePassivateContextData(data);<NEW_LINE>// Verify around invoke does not see any context data from lifecycle<NEW_LINE>// callback events.<NEW_LINE>if (map.containsKey("PostActivate")) {<NEW_LINE>throw new IllegalStateException("PostActivate context data shared with PrePassivate interceptor");<NEW_LINE>} else if (map.containsKey("AroundInvoke")) {<NEW_LINE>throw new IllegalStateException("AroundInvoke context data shared with PrePassivate interceptor");<NEW_LINE>} else if (map.containsKey("PreDestroy")) {<NEW_LINE>throw new IllegalStateException("PreDestroy context data shared with PrePassivate interceptor");<NEW_LINE>} else if (map.containsKey("PostConstruct")) {<NEW_LINE>throw new IllegalStateException("PostConstruct context data shared with PrePassivate interceptor");<NEW_LINE>}<NEW_LINE>// Verify same InvocationContext passed to each PrePassivate<NEW_LINE>// interceptor method.<NEW_LINE>InvocationContext ctxData;<NEW_LINE>if (map.containsKey("InvocationContext")) {<NEW_LINE>ctxData = (InvocationContext) map.get("InvocationContext");<NEW_LINE>if (inv != ctxData) {<NEW_LINE>throw new IllegalStateException("Same InvocationContext not passed to each PrePassivate interceptor");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>inv.proceed();<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new EJBException("unexpected Throwable", e);<NEW_LINE>}<NEW_LINE>} | map.put("InvocationContext", inv); |
1,724,646 | public SQLSelect clone() {<NEW_LINE>SQLSelect x = new SQLSelect();<NEW_LINE>x.withSubQuery = this.withSubQuery;<NEW_LINE>if (query != null) {<NEW_LINE>x.setQuery(query.clone());<NEW_LINE>}<NEW_LINE>if (orderBy != null) {<NEW_LINE>x.setOrderBy(this.orderBy.clone());<NEW_LINE>}<NEW_LINE>if (restriction != null) {<NEW_LINE>x.setRestriction(restriction.clone());<NEW_LINE>}<NEW_LINE>if (this.hints != null) {<NEW_LINE>for (SQLHint hint : this.hints) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>x.forBrowse = forBrowse;<NEW_LINE>if (forXmlOptions != null) {<NEW_LINE>x.forXmlOptions = new ArrayList<String>(forXmlOptions);<NEW_LINE>}<NEW_LINE>if (xmlPath != null) {<NEW_LINE>x.setXmlPath(xmlPath.clone());<NEW_LINE>}<NEW_LINE>if (rowCount != null) {<NEW_LINE>x.setRowCount(rowCount.clone());<NEW_LINE>}<NEW_LINE>if (offset != null) {<NEW_LINE>x.setOffset(offset.clone());<NEW_LINE>}<NEW_LINE>if (headHint != null) {<NEW_LINE>x.setHeadHint(headHint.clone());<NEW_LINE>}<NEW_LINE>return x;<NEW_LINE>} | x.hints.add(hint); |
1,454,863 | final UpdateSlotTypeResult executeUpdateSlotType(UpdateSlotTypeRequest updateSlotTypeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateSlotTypeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateSlotTypeRequest> request = null;<NEW_LINE>Response<UpdateSlotTypeResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateSlotTypeRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateSlotTypeRequest));<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, "UpdateSlotType");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateSlotTypeResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateSlotTypeResultJsonUnmarshaller());<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, "Lex Models V2"); |
561,731 | private static void initOriginMeta(ResultCursor rc, Row row, ArrayResultCursor result) throws SQLException, UnsupportedEncodingException {<NEW_LINE>List<ColumnMeta> metas = Lists.newArrayList();<NEW_LINE>String tableName = "explain";<NEW_LINE>for (int i = 1; i <= row.getColNum(); i++) {<NEW_LINE>final String columnName;<NEW_LINE>if (row instanceof XRowSet) {<NEW_LINE>final XResult xResult = ((XRowSet) row).getResult();<NEW_LINE>columnName = xResult.getMetaData().get(i - 1).getName().toString(XSession.toJavaEncoding(xResult.getSession().getResultMetaEncodingMySQL()));<NEW_LINE>} else {<NEW_LINE>columnName = ((ResultSetRow) row).getOriginMeta().getColumnName(i);<NEW_LINE>}<NEW_LINE>TddlTypeFactoryImpl factory = new TddlTypeFactoryImpl(TddlRelDataTypeSystemImpl.getInstance());<NEW_LINE>RelDataType dataType = <MASK><NEW_LINE>Field col = new Field(tableName, columnName, dataType);<NEW_LINE>ColumnMeta iColumnMeta = new ColumnMeta(tableName, columnName, null, col);<NEW_LINE>metas.add(iColumnMeta);<NEW_LINE>result.addColumn(iColumnMeta);<NEW_LINE>}<NEW_LINE>CursorMeta cursorMeta = CursorMeta.build(metas);<NEW_LINE>row.setCursorMeta(cursorMeta);<NEW_LINE>result.initMeta();<NEW_LINE>rc.setCursorMeta(cursorMeta);<NEW_LINE>} | factory.createSqlType(SqlTypeName.VARCHAR); |
1,313,070 | public void checkParentLimit(String label) throws CircuitBreakingException {<NEW_LINE>long totalUsed = 0;<NEW_LINE>for (CircuitBreaker breaker : this.breakers.values()) {<NEW_LINE>totalUsed += (breaker.getUsed() * breaker.getOverhead());<NEW_LINE>}<NEW_LINE>long parentLimit = this.parentSettings.getLimit();<NEW_LINE>if (totalUsed > parentLimit) {<NEW_LINE>this.parentTripCount.incrementAndGet();<NEW_LINE>final StringBuilder message = new StringBuilder("[parent] Data too large, data for [" + label + "]" + " would be [" + totalUsed + "/" + new ByteSizeValue(totalUsed) + "]" + ", which is larger than the limit of [" + parentLimit + "/" + new ByteSizeValue(parentLimit) + "]");<NEW_LINE>message.append(", usages [");<NEW_LINE>message.append(String.join(", ", this.breakers.entrySet().stream().map(e -> {<NEW_LINE>final <MASK><NEW_LINE>final long breakerUsed = (long) (breaker.getUsed() * breaker.getOverhead());<NEW_LINE>return e.getKey() + "=" + breakerUsed + "/" + new ByteSizeValue(breakerUsed);<NEW_LINE>}).collect(Collectors.toList())));<NEW_LINE>message.append("]");<NEW_LINE>throw new CircuitBreakingException(message.toString(), totalUsed, parentLimit);<NEW_LINE>}<NEW_LINE>} | CircuitBreaker breaker = e.getValue(); |
567,286 | final BatchGetJobsResult executeBatchGetJobs(BatchGetJobsRequest batchGetJobsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchGetJobsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchGetJobsRequest> request = null;<NEW_LINE>Response<BatchGetJobsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new BatchGetJobsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchGetJobsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Glue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchGetJobs");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchGetJobsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchGetJobsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
344,653 | public static SsurgPred assemblePredFromXML(Element elt) throws Exception {<NEW_LINE>String eltName = elt.getTagName();<NEW_LINE>switch(eltName) {<NEW_LINE>case SsurgeonPattern.PREDICATE_AND_TAG:<NEW_LINE>SsurgAndPred andPred = new SsurgAndPred();<NEW_LINE>for (Element childElt : getChildElements(elt)) {<NEW_LINE>SsurgPred childPred = assemblePredFromXML(childElt);<NEW_LINE>andPred.add(childPred);<NEW_LINE>return andPred;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case SsurgeonPattern.PREDICATE_OR_TAG:<NEW_LINE>SsurgOrPred orPred = new SsurgOrPred();<NEW_LINE>for (Element childElt : getChildElements(elt)) {<NEW_LINE>SsurgPred childPred = assemblePredFromXML(childElt);<NEW_LINE>orPred.add(childPred);<NEW_LINE>return orPred;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case SsurgeonPattern.PRED_WORDLIST_TEST_TAG:<NEW_LINE>String id = <MASK><NEW_LINE>String resourceID = elt.getAttribute("resourceID");<NEW_LINE>String typeStr = elt.getAttribute("type");<NEW_LINE>// node name to match on<NEW_LINE>String matchName = getEltText(elt).trim();<NEW_LINE>if (matchName == null) {<NEW_LINE>throw new Exception("Could not find match name for " + elt);<NEW_LINE>}<NEW_LINE>if (id == null) {<NEW_LINE>throw new Exception("No ID attribute for element = " + elt);<NEW_LINE>}<NEW_LINE>return new WordlistTest(id, resourceID, typeStr, matchName);<NEW_LINE>}<NEW_LINE>// Not a valid node, error out!<NEW_LINE>throw new Exception("Invalid node encountered during Ssurgeon predicate processing, node name=" + eltName);<NEW_LINE>} | elt.getAttribute(SsurgeonPattern.PRED_ID_ATTR); |
200,148 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "c0,c1,c2,c3,c4,c5".split(",");<NEW_LINE>SupportEvalBuilder builder = new SupportEvalBuilder("SupportBean_ST0_Container");<NEW_LINE>builder.expression(fields[0], "contained.mostFrequent(x => p00)");<NEW_LINE>builder.expression(fields[1], "contained.leastFrequent(x => p00)");<NEW_LINE>builder.expression(fields[2], "contained.mostFrequent( (x, i) => p00 + i*2)");<NEW_LINE>builder.expression(fields[3], "contained.leastFrequent( (x, i) => p00 + i*2)");<NEW_LINE>builder.expression(fields[4], "contained.mostFrequent( (x, i, s) => p00 + i*2 + s*4)");<NEW_LINE>builder.expression(fields[5], "contained.leastFrequent( (x, i, s) => p00 + i*2 + s*4)");<NEW_LINE>builder.statementConsumer(stmt -> assertTypesAllSame(stmt.getEventType(), fields, EPTypePremade.INTEGERBOXED.getEPType()));<NEW_LINE>SupportBean_ST0_Container bean = SupportBean_ST0_Container.make2Value("E1,12", "E2,11", "E2,2", "E3,12");<NEW_LINE>builder.assertion(bean).expect(fields, 12, 11, 12, 12, 28, 28);<NEW_LINE><MASK><NEW_LINE>builder.assertion(bean).expect(fields, 12, 12, 12, 12, 16, 16);<NEW_LINE>bean = SupportBean_ST0_Container.make2Value("E1,12", "E2,11", "E2,2", "E3,12", "E1,12", "E2,11", "E3,11");<NEW_LINE>builder.assertion(bean).expect(fields, 12, 2, 12, 12, 40, 40);<NEW_LINE>bean = SupportBean_ST0_Container.make2Value("E2,11", "E1,12", "E2,15", "E3,12", "E1,12", "E2,11", "E3,11");<NEW_LINE>builder.assertion(bean).expect(fields, 11, 15, 11, 11, 39, 39);<NEW_LINE>builder.assertion(SupportBean_ST0_Container.make2ValueNull()).expect(fields, null, null, null, null, null, null);<NEW_LINE>builder.assertion(SupportBean_ST0_Container.make2Value()).expect(fields, null, null, null, null, null, null);<NEW_LINE>builder.run(env);<NEW_LINE>} | bean = SupportBean_ST0_Container.make2Value("E1,12"); |
709,005 | private void execute(EntityAnalyseData entityAnalyseData) {<NEW_LINE>List<String> detail_ids = entityAnalyseData.getDetailIds();<NEW_LINE>AttendanceDetail detail = null;<NEW_LINE>statusSystemImportOpt.setProcessing(true);<NEW_LINE>statusSystemImportOpt.setProcessing_analysis(true);<NEW_LINE>if (detail_ids != null && !detail_ids.isEmpty()) {<NEW_LINE>for (String id : detail_ids) {<NEW_LINE>try {<NEW_LINE>detail = attendanceDetailServiceAdv.get(id);<NEW_LINE>if (detail != null) {<NEW_LINE>attendanceDetailAnalyseServiceAdv.analyseAttendanceDetail(detail, debugger);<NEW_LINE>statusSystemImportOpt.increaseProcess_analysis_count(1);<NEW_LINE>} else {<NEW_LINE>statusSystemImportOpt.increaseProcess_analysis_error(1);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>statusSystemImportOpt.increaseProcess_analysis_error(1);<NEW_LINE>logger.warn("attendance detail analyse got an exception.id:" + id);<NEW_LINE>logger.error(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.info("no attendance detail need to analyse.personName:" + entityAnalyseData.getPersonName());<NEW_LINE>}<NEW_LINE>logger.info("attendance detail analyse completed.person:" + detail.getEmpName() + ", count:" + detail_ids.size());<NEW_LINE>} | logger.warn("attendance detail not exists.id:" + id); |
1,779,880 | private int execute(List<?> requests, int maxRequestsPerBulk) throws SQLException {<NEW_LINE>int result = 0;<NEW_LINE><MASK><NEW_LINE>for (Object req : requests) {<NEW_LINE>if (req instanceof IndexRequest)<NEW_LINE>bulkReq.add((IndexRequest) req);<NEW_LINE>else if (req instanceof UpdateRequest)<NEW_LINE>bulkReq.add((UpdateRequest) req);<NEW_LINE>else if (req instanceof DeleteRequest)<NEW_LINE>bulkReq.add((DeleteRequest) req);<NEW_LINE>else if (req instanceof IndexRequestBuilder)<NEW_LINE>bulkReq.add((IndexRequestBuilder) req);<NEW_LINE>else if (req instanceof UpdateRequestBuilder)<NEW_LINE>bulkReq.add((UpdateRequestBuilder) req);<NEW_LINE>else if (req instanceof DeleteRequestBuilder)<NEW_LINE>bulkReq.add((DeleteRequestBuilder) req);<NEW_LINE>else<NEW_LINE>throw new SQLException("Type " + req.getClass() + " cannot be added to a bulk request");<NEW_LINE>if (bulkReq.numberOfActions() > maxRequestsPerBulk) {<NEW_LINE>result += bulkReq.get().getItems().length;<NEW_LINE>bulkReq = client.prepareBulk();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (bulkReq.numberOfActions() > 0) {<NEW_LINE>result += bulkReq.get().getItems().length;<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | BulkRequestBuilder bulkReq = client.prepareBulk(); |
277,029 | public void flagHelper(CommandContext args, Actor sender) throws CommandException {<NEW_LINE>// Get the world<NEW_LINE>World world = checkWorld(args, sender, 'w');<NEW_LINE>// Lookup the existing region<NEW_LINE>RegionManager manager = checkRegionManager(world);<NEW_LINE>ProtectedRegion region;<NEW_LINE>if (args.argsLength() == 0) {<NEW_LINE>// Get region from where the player is<NEW_LINE>if (!(sender instanceof LocalPlayer)) {<NEW_LINE>throw new CommandException("Please specify the region with /region flags -w world_name region_name.");<NEW_LINE>}<NEW_LINE>region = checkRegionStandingIn(manager, (LocalPlayer) sender, true, "/rg flags -w \"" + world.getName() + "\" %id%");<NEW_LINE>} else {<NEW_LINE>// Get region from the ID<NEW_LINE>region = checkExistingRegion(manager, args.getString(0), true);<NEW_LINE>}<NEW_LINE>final RegionPermissionModel perms = getPermissionModel(sender);<NEW_LINE>if (!perms.mayLookup(region)) {<NEW_LINE>throw new CommandPermissionsException();<NEW_LINE>}<NEW_LINE>int page = args.hasFlag('p') ? args.getFlagInteger('p') : 1;<NEW_LINE>sendFlagHelper(sender, <MASK><NEW_LINE>} | world, region, perms, page); |
1,569,185 | public final Value nextElement() {<NEW_LINE>if (this.isDone) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (this.currentElems.length == 0) {<NEW_LINE>if (coverage) {<NEW_LINE>cm.incSecondary();<NEW_LINE>}<NEW_LINE>this.isDone = true;<NEW_LINE>return new FcnRcdValue(this.dom, new Value[this.currentElems.length], true, cm);<NEW_LINE>} else {<NEW_LINE>// Take and store a snapshot of currentElems as the element to return for<NEW_LINE>// this invocation of nextElement().<NEW_LINE>final Value[] elems = new Value[this.currentElems.length];<NEW_LINE>System.arraycopy(this.currentElems, 0, elems, 0, this.currentElems.length);<NEW_LINE>// Eagerly generate the next element which is going to be returned the upon next<NEW_LINE>// invocation of nextElement().<NEW_LINE>if (coverage) {<NEW_LINE>cm.incSecondary(this.currentElems.length);<NEW_LINE>}<NEW_LINE>for (int i = this.currentElems.length - 1; i >= 0; i--) {<NEW_LINE>this.currentElems[i] = this.enums[i].nextElement();<NEW_LINE>if (this.currentElems[i] != null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (i == 0) {<NEW_LINE>this.isDone = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>this.enums[i].reset();<NEW_LINE>this.currentElems[i] = this.enums[i].nextElement();<NEW_LINE>}<NEW_LINE>return new FcnRcdValue(this.<MASK><NEW_LINE>}<NEW_LINE>} | dom, elems, true, cm); |
1,305,597 | public void storeHourlyReports(long startTime, StoragePolicy policy, int index) {<NEW_LINE>Transaction t = Cat.newTransaction("Checkpoint", m_name);<NEW_LINE>Map<String, T> reports = m_reports.get(startTime);<NEW_LINE>ReportBucket bucket = null;<NEW_LINE>try {<NEW_LINE>t.addData("reports", reports == null ? 0 : reports.size());<NEW_LINE>if (reports != null) {<NEW_LINE>Set<String> errorDomains = new HashSet<String>();<NEW_LINE>for (String domain : reports.keySet()) {<NEW_LINE>if (!m_validator.validate(domain)) {<NEW_LINE>errorDomains.add(domain);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String domain : errorDomains) {<NEW_LINE>reports.remove(domain);<NEW_LINE>}<NEW_LINE>if (!errorDomains.isEmpty()) {<NEW_LINE>m_logger.info("error domain:" + errorDomains);<NEW_LINE>}<NEW_LINE>m_reportDelegate.beforeSave(reports);<NEW_LINE>if (policy.forFile()) {<NEW_LINE>bucket = m_bucketManager.getReportBucket(startTime, m_name, index);<NEW_LINE>try {<NEW_LINE>storeFile(reports, bucket);<NEW_LINE>} finally {<NEW_LINE>m_bucketManager.closeBucket(bucket);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (policy.forDatabase()) {<NEW_LINE>storeDatabase(startTime, reports);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>t.setStatus(Message.SUCCESS);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Cat.logError(e);<NEW_LINE>t.setStatus(e);<NEW_LINE>m_logger.error(String.format("Error when storing %s reports of %s!", m_name, new <MASK><NEW_LINE>} finally {<NEW_LINE>cleanup(startTime);<NEW_LINE>t.complete();<NEW_LINE>if (bucket != null) {<NEW_LINE>m_bucketManager.closeBucket(bucket);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Date(startTime)), e); |
1,821,227 | protected void encodeStage(BsonWriter writer, GraphLookup value, EncoderContext encoderContext) {<NEW_LINE>document(writer, () -> {<NEW_LINE>if (value.getFrom() != null) {<NEW_LINE>value(writer, "from", value.getFrom());<NEW_LINE>} else {<NEW_LINE>writer.writeString("from", getDatastore().getMapper().getEntityModel(value.getFromType<MASK><NEW_LINE>}<NEW_LINE>expression(getDatastore(), writer, "startWith", value.getStartWith(), encoderContext);<NEW_LINE>value(writer, "connectFromField", value.getConnectFromField());<NEW_LINE>value(writer, "connectToField", value.getConnectToField());<NEW_LINE>value(writer, "as", value.getAs());<NEW_LINE>value(writer, "maxDepth", value.getMaxDepth());<NEW_LINE>value(writer, "depthField", value.getDepthField());<NEW_LINE>Filter[] restriction = value.getRestriction();<NEW_LINE>if (restriction != null) {<NEW_LINE>document(writer, "restrictSearchWithMatch", () -> {<NEW_LINE>for (Filter filter : restriction) {<NEW_LINE>filter.encode(getDatastore(), writer, encoderContext);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ()).getCollectionName()); |
333,226 | protected FutureTask<Boolean> prepareTask(@Nonnull PsiFile file, boolean processChangedTextOnly) {<NEW_LINE>if (DumbService.isDumb(file.getProject())) {<NEW_LINE>return new FutureTask<>(EmptyRunnable.INSTANCE, true);<NEW_LINE>}<NEW_LINE>final Set<ImportOptimizer> optimizers = LanguageImportStatements.INSTANCE.forFile(file);<NEW_LINE>final List<Runnable> runnables = new ArrayList<>();<NEW_LINE>List<PsiFile> files = file<MASK><NEW_LINE>for (ImportOptimizer optimizer : optimizers) {<NEW_LINE>for (PsiFile psiFile : files) {<NEW_LINE>if (optimizer.supports(psiFile)) {<NEW_LINE>runnables.add(optimizer.processFile(psiFile));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Runnable runnable = !runnables.isEmpty() ? () -> {<NEW_LINE>CodeStyleManagerImpl.setSequentialProcessingAllowed(false);<NEW_LINE>try {<NEW_LINE>for (Runnable runnable1 : runnables) {<NEW_LINE>runnable1.run();<NEW_LINE>retrieveAndStoreNotificationInfo(runnable1);<NEW_LINE>}<NEW_LINE>putNotificationInfoIntoCollector();<NEW_LINE>} finally {<NEW_LINE>CodeStyleManagerImpl.setSequentialProcessingAllowed(true);<NEW_LINE>}<NEW_LINE>} : EmptyRunnable.getInstance();<NEW_LINE>return new FutureTask<>(runnable, true);<NEW_LINE>} | .getViewProvider().getAllFiles(); |
1,156,643 | static ParserState doIntFromString(ParserState state, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx, Object kwdnames, Object varargs, @Shared("getArgNode") @Cached GetArgNode getArgNode, @Cached StringLenNode stringLenNode, @Shared("writeOutVarNode") @Cached WriteOutVarNode writeOutVarNode, @Shared("raiseNode") @Cached PRaiseNativeNode raiseNode) throws InteropException, ParseArgumentsException {<NEW_LINE>Object arg = getArgNode.execute(state, kwds, kwdnames, state.restKeywordsOnly);<NEW_LINE>if (!skipOptionalArg(arg, state.restOptional)) {<NEW_LINE>// TODO(fa): There could be native subclasses (i.e. the Java type would not be<NEW_LINE>// 'String' or 'PString') but we do currently not support this.<NEW_LINE>if (!(PGuards.isString(arg) && stringLenNode.execute(arg) == 1)) {<NEW_LINE>throw raise(raiseNode, TypeError, ErrorMessages.EXPECTED_UNICODE_CHAR_NOT_P, arg);<NEW_LINE>}<NEW_LINE>// TODO(fa) use the sequence lib to get the character once available<NEW_LINE>char singleChar;<NEW_LINE>if (arg instanceof String) {<NEW_LINE>singleChar = ((String) arg).charAt(0);<NEW_LINE>} else if (arg instanceof PString) {<NEW_LINE>singleChar = charFromPString(arg);<NEW_LINE>} else {<NEW_LINE>throw raise(raiseNode, SystemError, ErrorMessages.<MASK><NEW_LINE>}<NEW_LINE>writeOutVarNode.writeInt32(varargs, state.outIndex, (int) singleChar);<NEW_LINE>}<NEW_LINE>return state.incrementOutIndex();<NEW_LINE>} | UNSUPPORTED_STR_TYPE, arg.getClass()); |
1,127,484 | static Shape doNativeClass(PythonAbstractNativeObject clazz, @Cached GetTypeMemberNode getTpDictNode, @CachedLibrary(limit = "1") DynamicObjectLibrary lib) {<NEW_LINE>Object tpDictObj = getTpDictNode.<MASK><NEW_LINE>if (tpDictObj instanceof PDict) {<NEW_LINE>HashingStorage dictStorage = ((PDict) tpDictObj).getDictStorage();<NEW_LINE>if (dictStorage instanceof DynamicObjectStorage) {<NEW_LINE>Object instanceShapeObj = lib.getOrDefault(((DynamicObjectStorage) dictStorage).getStore(), PythonNativeClass.INSTANCESHAPE, PNone.NO_VALUE);<NEW_LINE>if (instanceShapeObj != PNone.NO_VALUE) {<NEW_LINE>return (Shape) instanceShapeObj;<NEW_LINE>}<NEW_LINE>throw CompilerDirectives.shouldNotReachHere("instanceshape object is not a shape");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO(fa): track unique shape per native class in language?<NEW_LINE>throw CompilerDirectives.shouldNotReachHere("custom dicts for native classes are unsupported");<NEW_LINE>} | execute(clazz, NativeMember.TP_DICT); |
1,159,426 | public static void doHighLatencyPeers(ArrayList<PEPeer> peers_to_choke, ArrayList<PEPeer> peers_to_unchoke, boolean allow_snubbed) {<NEW_LINE>// when called we don't want to choke high-latency peers<NEW_LINE>if (peers_to_choke.size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// System.out.println( "doHLP: " + peers_to_choke + ", " + peers_to_unchoke );<NEW_LINE>Iterator<PEPeer> choke_it = peers_to_choke.iterator();<NEW_LINE>int to_remove = 0;<NEW_LINE>while (choke_it.hasNext()) {<NEW_LINE>PEPeer peer = choke_it.next();<NEW_LINE>if (AENetworkClassifier.categoriseAddress(peer.getIp()) != AENetworkClassifier.AT_PUBLIC) {<NEW_LINE>if (isUnchokable(peer, allow_snubbed)) {<NEW_LINE>// System.out.println( " removed " + peer );<NEW_LINE>choke_it.remove();<NEW_LINE>to_remove++;<NEW_LINE>} else {<NEW_LINE>// it isn't unchokable so we need to choke it whatever<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// if we've removed any chokes then we need to balance things by removing an equal number<NEW_LINE>// of unchokes<NEW_LINE>if (to_remove > 0) {<NEW_LINE>ListIterator<PEPeer> unchoke_it = peers_to_unchoke.listIterator(peers_to_unchoke.size());<NEW_LINE>// preferrably balance with high latency peers<NEW_LINE>while (unchoke_it.hasPrevious()) {<NEW_LINE>PEPeer peer = unchoke_it.previous();<NEW_LINE>if (AENetworkClassifier.categoriseAddress(peer.getIp()) != AENetworkClassifier.AT_PUBLIC) {<NEW_LINE>// System.out.println( " balanced with " + peer );<NEW_LINE>unchoke_it.remove();<NEW_LINE>to_remove--;<NEW_LINE>if (to_remove == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (to_remove > 0) {<NEW_LINE>unchoke_it = peers_to_unchoke.<MASK><NEW_LINE>while (unchoke_it.hasPrevious()) {<NEW_LINE>PEPeer peer = unchoke_it.previous();<NEW_LINE>unchoke_it.remove();<NEW_LINE>to_remove--;<NEW_LINE>if (to_remove == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | listIterator(peers_to_unchoke.size()); |
640,165 | ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>ActionResult<List<Wo>> result = new ActionResult<>();<NEW_LINE>Business business = new Business(emc);<NEW_LINE>List<String> ids = business.imConversationFactory().listConversationWithPerson(effectivePerson.getDistinguishedName());<NEW_LINE>List<Wo> wos = Wo.copier.copy(emc.list(IMConversation.class, ids));<NEW_LINE>for (Wo wo : wos) {<NEW_LINE>IMConversationExt ext = business.imConversationFactory().getConversationExt(effectivePerson.getDistinguishedName(), wo.getId());<NEW_LINE>if (ext != null) {<NEW_LINE>wo.setIsTop(ext.getIsTop());<NEW_LINE>wo.setUnreadNumber(business.imConversationFactory().unreadNumber(ext));<NEW_LINE>} else {<NEW_LINE>IMConversationExt conversationExt = new IMConversationExt();<NEW_LINE>conversationExt.setConversationId(wo.getId());<NEW_LINE>conversationExt.setPerson(effectivePerson.getDistinguishedName());<NEW_LINE>emc.beginTransaction(IMConversationExt.class);<NEW_LINE>emc.persist(conversationExt, CheckPersistType.all);<NEW_LINE>emc.commit();<NEW_LINE>wo.setIsTop(false);<NEW_LINE>wo.setUnreadNumber(business.imConversationFactory<MASK><NEW_LINE>}<NEW_LINE>wo.setLastMessage(WoMsg.copier.copy(business.imConversationFactory().lastMessage(wo.getId())));<NEW_LINE>}<NEW_LINE>result.setData(wos);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | ().unreadNumber(conversationExt)); |
1,790,619 | protected void consumeOpenBlock() {<NEW_LINE>// OpenBlock ::= $empty<NEW_LINE>super.consumeOpenBlock();<NEW_LINE>int stackLength = this.blockStarts.length;<NEW_LINE>if (this.realBlockPtr >= stackLength) {<NEW_LINE>System.arraycopy(this.blockStarts, 0, this.blockStarts = new int[stackLength + StackIncrement], 0, stackLength);<NEW_LINE>}<NEW_LINE>this.blockStarts[this.realBlockPtr] = this.scanner.startPosition;<NEW_LINE>if (requireExtendedRecovery()) {<NEW_LINE>// This is an epsilon production: We are in the state with kernel item: Block ::= .OpenBlock LBRACE BlockStatementsopt RBRACE<NEW_LINE>if (this.currentToken == TokenNameLBRACE && this.unstackedAct > NUM_RULES) {<NEW_LINE>// wait for chain reductions to finish before commit.<NEW_LINE>stackLength = this.stack.length;<NEW_LINE>if (++this.stateStackTop >= stackLength - 1) {<NEW_LINE>// Need two slots.<NEW_LINE>System.arraycopy(this.stack, 0, this.stack = new int[stackLength + StackIncrement], 0, stackLength);<NEW_LINE>}<NEW_LINE>// transition to Block ::= OpenBlock .LBRACE BlockStatementsopt RBRACE<NEW_LINE>this.stack[this<MASK><NEW_LINE>// transition to Block ::= OpenBlock LBRACE .BlockStatementsopt RBRACE<NEW_LINE>this.stack[this.stateStackTop] = tAction(this.unstackedAct, this.currentToken);<NEW_LINE>commit(true);<NEW_LINE>this.stateStackTop -= 2;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .stateStackTop++] = this.unstackedAct; |
1,462,438 | private CallStatus beforePromotion() {<NEW_LINE>NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();<NEW_LINE><MASK><NEW_LINE>InternalPartitionServiceImpl partitionService = getService();<NEW_LINE>if (!partitionService.getMigrationManager().acquirePromotionPermit()) {<NEW_LINE>throw new RetryableHazelcastException("Another promotion is being run currently. " + "This is only expected when promotion is retried to an unresponsive destination.");<NEW_LINE>}<NEW_LINE>long partitionStateStamp;<NEW_LINE>partitionStateStamp = partitionService.getPartitionStateStamp();<NEW_LINE>if (partitionState.getStamp() == partitionStateStamp) {<NEW_LINE>return alreadyAppliedAllPromotions();<NEW_LINE>}<NEW_LINE>filterAlreadyAppliedPromotions();<NEW_LINE>if (promotions.isEmpty()) {<NEW_LINE>return alreadyAppliedAllPromotions();<NEW_LINE>}<NEW_LINE>ILogger logger = getLogger();<NEW_LINE>migrationState = new MigrationStateImpl(Clock.currentTimeMillis(), promotions.size(), 0, 0L);<NEW_LINE>partitionService.getMigrationInterceptor().onPromotionStart(MigrationParticipant.DESTINATION, promotions);<NEW_LINE>partitionService.getPartitionEventManager().sendMigrationProcessStartedEvent(migrationState);<NEW_LINE>if (logger.isFineEnabled()) {<NEW_LINE>logger.fine("Submitting BeforePromotionOperations for " + promotions.size() + " promotions. " + "Promotion partition state stamp: " + partitionState.getStamp() + ", current partition state stamp: " + partitionStateStamp);<NEW_LINE>}<NEW_LINE>PromotionOperationCallback beforePromotionsCallback = new BeforePromotionOperationCallback(this, promotions.size());<NEW_LINE>for (MigrationInfo promotion : promotions) {<NEW_LINE>if (logger.isFinestEnabled()) {<NEW_LINE>logger.finest("Submitting BeforePromotionOperation for promotion: " + promotion);<NEW_LINE>}<NEW_LINE>Operation op = new BeforePromotionOperation(promotion, beforePromotionsCallback);<NEW_LINE>op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService);<NEW_LINE>operationService.execute(op);<NEW_LINE>}<NEW_LINE>return CallStatus.VOID;<NEW_LINE>} | OperationServiceImpl operationService = nodeEngine.getOperationService(); |
968,481 | public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {<NEW_LINE>if (!(parentElement instanceof Event)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MessageEventDefinition eventDefinition = new MessageEventDefinition();<NEW_LINE>BpmnXMLUtil.addXMLLocation(eventDefinition, xtr);<NEW_LINE>eventDefinition.setMessageRef(xtr.getAttributeValue(null, ATTRIBUTE_MESSAGE_REF));<NEW_LINE>eventDefinition.setMessageExpression(BpmnXMLUtil.getAttributeValue(ATTRIBUTE_MESSAGE_EXPRESSION, xtr));<NEW_LINE>if (!StringUtils.isEmpty(eventDefinition.getMessageRef())) {<NEW_LINE>int indexOfP = eventDefinition.getMessageRef().indexOf(':');<NEW_LINE>if (indexOfP != -1) {<NEW_LINE>String prefix = eventDefinition.getMessageRef().substring(0, indexOfP);<NEW_LINE>String resolvedNamespace = model.getNamespace(prefix);<NEW_LINE>String messageRef = eventDefinition.getMessageRef().substring(indexOfP + 1);<NEW_LINE>if (resolvedNamespace == null) {<NEW_LINE>// if it's an invalid prefix will consider this is not a namespace prefix so will be used as part of the stringReference<NEW_LINE>messageRef = prefix + ":" + messageRef;<NEW_LINE>} else if (!resolvedNamespace.equalsIgnoreCase(model.getTargetNamespace())) {<NEW_LINE>// if it's a valid namespace prefix but it's not the targetNamespace then we'll use it as a valid namespace<NEW_LINE>// (even out editor does not support defining namespaces it is still a valid xml file)<NEW_LINE>messageRef = resolvedNamespace + ":" + messageRef;<NEW_LINE>}<NEW_LINE>eventDefinition.setMessageRef(messageRef);<NEW_LINE>} else {<NEW_LINE>eventDefinition.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>BpmnXMLUtil.parseChildElements(ELEMENT_EVENT_MESSAGEDEFINITION, eventDefinition, xtr, model);<NEW_LINE>((Event) parentElement).getEventDefinitions().add(eventDefinition);<NEW_LINE>} | setMessageRef(eventDefinition.getMessageRef()); |
1,059,074 | public static ModifyStrategyResponse unmarshall(ModifyStrategyResponse modifyStrategyResponse, UnmarshallerContext context) {<NEW_LINE>modifyStrategyResponse.setRequestId(context.stringValue("ModifyStrategyResponse.RequestId"));<NEW_LINE>modifyStrategyResponse.setSuccess(context.booleanValue("ModifyStrategyResponse.Success"));<NEW_LINE>modifyStrategyResponse.setCode(context.stringValue("ModifyStrategyResponse.Code"));<NEW_LINE>modifyStrategyResponse.setMessage(context.stringValue("ModifyStrategyResponse.Message"));<NEW_LINE>modifyStrategyResponse.setHttpStatusCode(context.integerValue("ModifyStrategyResponse.HttpStatusCode"));<NEW_LINE>Strategy strategy = new Strategy();<NEW_LINE>strategy.setStrategyId(context.stringValue("ModifyStrategyResponse.Strategy.StrategyId"));<NEW_LINE>strategy.setStrategyName(context.stringValue("ModifyStrategyResponse.Strategy.StrategyName"));<NEW_LINE>strategy.setStrategyDescription(context.stringValue("ModifyStrategyResponse.Strategy.StrategyDescription"));<NEW_LINE>strategy.setType(context.stringValue("ModifyStrategyResponse.Strategy.Type"));<NEW_LINE>strategy.setStartTime(context.longValue("ModifyStrategyResponse.Strategy.StartTime"));<NEW_LINE>strategy.setEndTime(context.longValue("ModifyStrategyResponse.Strategy.EndTime"));<NEW_LINE>strategy.setRepeatBy(context.stringValue("ModifyStrategyResponse.Strategy.RepeatBy"));<NEW_LINE>strategy.setMaxAttemptsPerDay(context.integerValue("ModifyStrategyResponse.Strategy.MaxAttemptsPerDay"));<NEW_LINE>strategy.setMinAttemptInterval(context.integerValue("ModifyStrategyResponse.Strategy.MinAttemptInterval"));<NEW_LINE>strategy.setCustomized<MASK><NEW_LINE>strategy.setRoutingStrategy(context.stringValue("ModifyStrategyResponse.Strategy.RoutingStrategy"));<NEW_LINE>strategy.setFollowUpStrategy(context.stringValue("ModifyStrategyResponse.Strategy.FollowUpStrategy"));<NEW_LINE>strategy.setIsTemplate(context.booleanValue("ModifyStrategyResponse.Strategy.IsTemplate"));<NEW_LINE>List<String> repeatDays = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < context.lengthValue("ModifyStrategyResponse.Strategy.RepeatDays.Length"); i++) {<NEW_LINE>repeatDays.add(context.stringValue("ModifyStrategyResponse.Strategy.RepeatDays[" + i + "]"));<NEW_LINE>}<NEW_LINE>strategy.setRepeatDays(repeatDays);<NEW_LINE>List<TimeFrame> workingTime = new ArrayList<TimeFrame>();<NEW_LINE>for (int i = 0; i < context.lengthValue("ModifyStrategyResponse.Strategy.WorkingTime.Length"); i++) {<NEW_LINE>TimeFrame timeFrame = new TimeFrame();<NEW_LINE>timeFrame.setBeginTime(context.stringValue("ModifyStrategyResponse.Strategy.WorkingTime[" + i + "].BeginTime"));<NEW_LINE>timeFrame.setEndTime(context.stringValue("ModifyStrategyResponse.Strategy.WorkingTime[" + i + "].EndTime"));<NEW_LINE>workingTime.add(timeFrame);<NEW_LINE>}<NEW_LINE>strategy.setWorkingTime(workingTime);<NEW_LINE>modifyStrategyResponse.setStrategy(strategy);<NEW_LINE>return modifyStrategyResponse;<NEW_LINE>} | (context.stringValue("ModifyStrategyResponse.Strategy.Customized")); |
355,480 | public String payrollMovement(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) {<NEW_LINE>if (isCalloutActive() || value == null)<NEW_LINE>return "";<NEW_LINE>// get value<NEW_LINE>int HR_Movement_ID = ((Integer) value).intValue();<NEW_LINE>if (HR_Movement_ID == 0)<NEW_LINE>return "";<NEW_LINE>// Get amount from movement<NEW_LINE>X_HR_Movement movement = new X_HR_Movement(ctx, HR_Movement_ID, null);<NEW_LINE>X_HR_Concept concept = new X_HR_Concept(ctx, movement.getHR_Concept_ID(), null);<NEW_LINE>// MHRConcept concept = MHRConcept.get(ctx, movement.getHR_Concept_ID());<NEW_LINE>if (!concept.getColumnType().equals(X_HR_Concept.COLUMNTYPE_Amount))<NEW_LINE>return "@HR_Concept_ID@ <> @Amount@";<NEW_LINE>// Valid payroll<NEW_LINE>X_HR_Payroll payroll = new X_HR_Payroll(ctx, <MASK><NEW_LINE>// MHRPayroll payroll = MHRPayroll.get(ctx, movement.getHR_Payroll_ID());<NEW_LINE>if (payroll.getC_Charge_ID() == 0)<NEW_LINE>return "@C_Charge_ID@ @NotFound@";<NEW_LINE>// Get Amount<NEW_LINE>mTab.setValue("PayAmt", movement.getAmount());<NEW_LINE>mTab.setValue("C_Charge_ID", payroll.getC_Charge_ID());<NEW_LINE>// Set BP from Document<NEW_LINE>mTab.setValue("C_BPartner_ID", movement.getC_BPartner_ID());<NEW_LINE>return "";<NEW_LINE>} | movement.getHR_Payroll_ID(), null); |
1,538,996 | public static void forwardBackWardDemo() {<NEW_LINE><MASK><NEW_LINE>System.out.println("======================");<NEW_LINE>System.out.println("Umbrella World");<NEW_LINE>System.out.println("--------------");<NEW_LINE>ForwardBackward uw = new ForwardBackward(GenericTemporalModelFactory.getUmbrellaWorldTransitionModel(), GenericTemporalModelFactory.getUmbrellaWorld_Xt_to_Xtm1_Map(), GenericTemporalModelFactory.getUmbrellaWorldSensorModel());<NEW_LINE>CategoricalDistribution prior = new ProbabilityTable(new double[] { 0.5, 0.5 }, ExampleRV.RAIN_t_RV);<NEW_LINE>// Day 1<NEW_LINE>List<List<AssignmentProposition>> evidence = new ArrayList<List<AssignmentProposition>>();<NEW_LINE>List<AssignmentProposition> e1 = new ArrayList<AssignmentProposition>();<NEW_LINE>e1.add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, Boolean.TRUE));<NEW_LINE>evidence.add(e1);<NEW_LINE>List<CategoricalDistribution> smoothed = uw.forwardBackward(evidence, prior);<NEW_LINE>System.out.println("Day 1 (Umbrealla_t=true) smoothed:\nday 1 = " + smoothed.get(0));<NEW_LINE>// Day 2<NEW_LINE>List<AssignmentProposition> e2 = new ArrayList<AssignmentProposition>();<NEW_LINE>e2.add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, Boolean.TRUE));<NEW_LINE>evidence.add(e2);<NEW_LINE>smoothed = uw.forwardBackward(evidence, prior);<NEW_LINE>System.out.println("Day 2 (Umbrealla_t=true) smoothed:\nday 1 = " + smoothed.get(0) + "\nday 2 = " + smoothed.get(1));<NEW_LINE>// Day 3<NEW_LINE>List<AssignmentProposition> e3 = new ArrayList<AssignmentProposition>();<NEW_LINE>e3.add(new AssignmentProposition(ExampleRV.UMBREALLA_t_RV, Boolean.FALSE));<NEW_LINE>evidence.add(e3);<NEW_LINE>smoothed = uw.forwardBackward(evidence, prior);<NEW_LINE>System.out.println("Day 3 (Umbrealla_t=false) smoothed:\nday 1 = " + smoothed.get(0) + "\nday 2 = " + smoothed.get(1) + "\nday 3 = " + smoothed.get(2));<NEW_LINE>System.out.println("======================");<NEW_LINE>} | System.out.println("DEMO: Forward-BackWard"); |
50,726 | public static GetNewbieTaskStatusResponse unmarshall(GetNewbieTaskStatusResponse getNewbieTaskStatusResponse, UnmarshallerContext context) {<NEW_LINE>getNewbieTaskStatusResponse.setRequestId(context.stringValue("GetNewbieTaskStatusResponse.RequestId"));<NEW_LINE>getNewbieTaskStatusResponse.setSuccess(context.booleanValue("GetNewbieTaskStatusResponse.Success"));<NEW_LINE>getNewbieTaskStatusResponse.setCode(context.stringValue("GetNewbieTaskStatusResponse.Code"));<NEW_LINE>getNewbieTaskStatusResponse.setMessage(context.stringValue("GetNewbieTaskStatusResponse.Message"));<NEW_LINE>getNewbieTaskStatusResponse.setHttpStatusCode(context.integerValue("GetNewbieTaskStatusResponse.HttpStatusCode"));<NEW_LINE>List<NewbieTaskStatus> taskStatus = new ArrayList<NewbieTaskStatus>();<NEW_LINE>for (int i = 0; i < context.lengthValue("GetNewbieTaskStatusResponse.TaskStatus.Length"); i++) {<NEW_LINE>NewbieTaskStatus newbieTaskStatus = new NewbieTaskStatus();<NEW_LINE>newbieTaskStatus.setTask(context.stringValue<MASK><NEW_LINE>newbieTaskStatus.setStatus(context.booleanValue("GetNewbieTaskStatusResponse.TaskStatus[" + i + "].Status"));<NEW_LINE>taskStatus.add(newbieTaskStatus);<NEW_LINE>}<NEW_LINE>getNewbieTaskStatusResponse.setTaskStatus(taskStatus);<NEW_LINE>return getNewbieTaskStatusResponse;<NEW_LINE>} | ("GetNewbieTaskStatusResponse.TaskStatus[" + i + "].Task")); |
467,037 | public void think() {<NEW_LINE>if (done)<NEW_LINE>throw new IllegalStateException("Path was already found!");<NEW_LINE>int i = 0;<NEW_LINE>for (; i < thinkSpeed && !checkFailed(); i++) {<NEW_LINE>// get next position from queue<NEW_LINE>current = queue.poll();<NEW_LINE>// check if path is found<NEW_LINE>if (checkDone())<NEW_LINE>return;<NEW_LINE>// add neighbors to queue<NEW_LINE>for (PathPos next : getNeighbors(current)) {<NEW_LINE>// check cost<NEW_LINE>float newCost = costMap.get(current<MASK><NEW_LINE>if (costMap.containsKey(next) && costMap.get(next) <= newCost)<NEW_LINE>continue;<NEW_LINE>// add to queue<NEW_LINE>costMap.put(next, newCost);<NEW_LINE>prevPosMap.put(next, current);<NEW_LINE>queue.add(next, newCost + getHeuristic(next));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>iterations += i;<NEW_LINE>} | ) + getCost(current, next); |
642,701 | public Quantity removeQty(final Quantity qtyToRemove, final Boolean allowNegativeCapacityOverride) {<NEW_LINE>Check.assumeNotNull(qtyToRemove, "qtyToRemove not null");<NEW_LINE>Check.assume(qtyToRemove.signum() >= 0, "qtyToRemove({}) >= 0", qtyToRemove);<NEW_LINE>final BigDecimal qtyToRemove_Qty = qtyToRemove.toBigDecimal();<NEW_LINE>final <MASK><NEW_LINE>final I_C_UOM baseUOM = getC_UOM();<NEW_LINE>if (qtyToRemove_Qty.signum() == 0) {<NEW_LINE>return new Quantity(BigDecimal.ZERO, qtyToRemove_UOM, BigDecimal.ZERO, baseUOM);<NEW_LINE>}<NEW_LINE>final BigDecimal qtyToRemoveBaseUom = convertToBaseUOM(qtyToRemove_Qty, qtyToRemove_UOM);<NEW_LINE>if (isInfiniteCapacity()) {<NEW_LINE>adjustQty(qtyToRemoveBaseUom.negate());<NEW_LINE>return new Quantity(qtyToRemove_Qty, qtyToRemove_UOM, qtyToRemoveBaseUom, baseUOM);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Enforce capacity<NEW_LINE>final BigDecimal qty = getQty();<NEW_LINE>final BigDecimal qtyToRemoveActualBaseUom;<NEW_LINE>final BigDecimal qtyToRemoveActual;<NEW_LINE>//<NEW_LINE>// Case: current storage quantity is negative<NEW_LINE>if (qty.signum() < 0) {<NEW_LINE>if (isAllowNegativeCapacity(allowNegativeCapacityOverride)) {<NEW_LINE>// we allow negative capacity, so we can remove everything<NEW_LINE>qtyToRemoveActualBaseUom = qtyToRemoveBaseUom;<NEW_LINE>qtyToRemoveActual = qtyToRemove_Qty;<NEW_LINE>} else {<NEW_LINE>return new Quantity(BigDecimal.ZERO, qtyToRemove_UOM, BigDecimal.ZERO, baseUOM);<NEW_LINE>}<NEW_LINE>} else //<NEW_LINE>// Case: in our storage there is more than required<NEW_LINE>// => we can remove everything that was required<NEW_LINE>if (qty.compareTo(qtyToRemoveBaseUom) >= 0) {<NEW_LINE>// we have enough qty used<NEW_LINE>qtyToRemoveActualBaseUom = qtyToRemoveBaseUom;<NEW_LINE>qtyToRemoveActual = qtyToRemove_Qty;<NEW_LINE>} else //<NEW_LINE>// Case: in our storage there is not enough quantity to remove<NEW_LINE>{<NEW_LINE>// we don't have enough qty used<NEW_LINE>if (isAllowNegativeCapacity(allowNegativeCapacityOverride)) {<NEW_LINE>// we allow negative capacity, so we can remove everything<NEW_LINE>qtyToRemoveActualBaseUom = qtyToRemoveBaseUom;<NEW_LINE>qtyToRemoveActual = qtyToRemove_Qty;<NEW_LINE>} else {<NEW_LINE>// we don't allow negative capacity, so we remove as much as we can<NEW_LINE>qtyToRemoveActualBaseUom = qty;<NEW_LINE>qtyToRemoveActual = convertFromBaseUOM(qtyToRemoveActualBaseUom, qtyToRemove_UOM);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Adjust Qty Used<NEW_LINE>adjustQty(qtyToRemoveActualBaseUom.negate());<NEW_LINE>return new Quantity(qtyToRemoveActual, qtyToRemove_UOM, qtyToRemoveActualBaseUom, baseUOM);<NEW_LINE>} | I_C_UOM qtyToRemove_UOM = qtyToRemove.getUOM(); |
169,370 | // Cleanup: default<NEW_LINE>public int updateChannel(GroupInfoUpdate groupInfoUpdate) {<NEW_LINE>if (groupInfoUpdate.getImageUrl() == null && groupInfoUpdate.getNewName() == null) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int rowUpdated = 0;<NEW_LINE>try {<NEW_LINE>ContentValues values = new ContentValues();<NEW_LINE>if (groupInfoUpdate != null) {<NEW_LINE>if (!TextUtils.isEmpty(groupInfoUpdate.getClientGroupId())) {<NEW_LINE>Channel channel = getChannelByClientGroupId(groupInfoUpdate.getClientGroupId());<NEW_LINE>groupInfoUpdate.<MASK><NEW_LINE>}<NEW_LINE>if (groupInfoUpdate.getNewName() != null) {<NEW_LINE>values.put("channelName", groupInfoUpdate.getNewName());<NEW_LINE>}<NEW_LINE>if (groupInfoUpdate.getImageUrl() != null) {<NEW_LINE>values.put("channelImageURL", groupInfoUpdate.getImageUrl());<NEW_LINE>values.putNull("channelImageLocalURI");<NEW_LINE>}<NEW_LINE>if (groupInfoUpdate.getMetadata() != null) {<NEW_LINE>Map<String, String> metadataToUpdate = getMetadataToUpdateToDatabaseFromGroupInfoUpdate(groupInfoUpdate);<NEW_LINE>if (metadataToUpdate != null) {<NEW_LINE>values.put(MobiComDatabaseHelper.CHANNEL_META_DATA, GsonUtils.getJsonFromObject(metadataToUpdate, Map.class));<NEW_LINE>if (metadataToUpdate.containsKey(Channel.AL_CATEGORY)) {<NEW_LINE>values.put(MobiComDatabaseHelper.AL_CATEGORY, metadataToUpdate.get(Channel.AL_CATEGORY));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>rowUpdated = dbHelper.getWritableDatabase().update("channel", values, "channelKey=" + groupInfoUpdate.getGroupId(), null);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return rowUpdated;<NEW_LINE>} | setGroupId(channel.getKey()); |
1,161,991 | private void run() throws IOException, OtrException {<NEW_LINE>BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));<NEW_LINE>while (true) {<NEW_LINE>System.out.print(">");<NEW_LINE>String line = reader.readLine().trim();<NEW_LINE>if ("/quit".equals(line)) {<NEW_LINE>disconnect();<NEW_LINE>return;<NEW_LINE>} else if ("/otr".equals(line)) {<NEW_LINE>otrEngine.startSession(sessionID);<NEW_LINE>} else if (line.startsWith("/smpr")) {<NEW_LINE>String secret = line.substring("/smpr ".length());<NEW_LINE>List<TLV> tlvs = otrSm.initRespondSmp(null, secret, false);<NEW_LINE>String encrypted = otrEngine.transformSending(sessionID, "", tlvs);<NEW_LINE>sendMessage(peer, encrypted);<NEW_LINE>} else if (line.startsWith("/smpa")) {<NEW_LINE>if (otrEngine.getSessionStatus(sessionID) != SessionStatus.ENCRYPTED) {<NEW_LINE>System.err.println("Not currently encrypted - use /otr");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>List<TLV> tlvs = otrSm.abortSmp();<NEW_LINE>String encrypted = otrEngine.transformSending(sessionID, "", tlvs);<NEW_LINE>sendMessage(peer, encrypted);<NEW_LINE>} else if (line.startsWith("/smp")) {<NEW_LINE>if (otrEngine.getSessionStatus(sessionID) != SessionStatus.ENCRYPTED) {<NEW_LINE>System.err.println("Not currently encrypted - use /otr");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String[] splits = line.split(" ", 3);<NEW_LINE>if (splits.length < 2) {<NEW_LINE>System.err.println("missing arguments");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>List<TLV> tlvs;<NEW_LINE>if (splits.length == 3) {<NEW_LINE>tlvs = otrSm.initRespondSmp(splits[1], splits[2], true);<NEW_LINE>} else {<NEW_LINE>tlvs = otrSm.initRespondSmp(null, splits[1], true);<NEW_LINE>}<NEW_LINE>String encrypted = otrEngine.transformSending(sessionID, "", tlvs);<NEW_LINE>sendMessage(peer, encrypted);<NEW_LINE>} else if ("/help".equals(line)) {<NEW_LINE><MASK><NEW_LINE>System.out.println("/otr");<NEW_LINE>System.out.println("/smpr SECRET - SMP response");<NEW_LINE>System.out.println("/smp [QUESTION] SECRET - SMP initiation");<NEW_LINE>System.out.println("/smpa - SMP abort");<NEW_LINE>} else if (line.startsWith("/")) {<NEW_LINE>System.err.println("Unknown command");<NEW_LINE>} else {<NEW_LINE>String encrypted = otrEngine.transformSending(sessionID, line, null);<NEW_LINE>sendMessage(peer, encrypted);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | System.out.println("/quit"); |
1,360,406 | public static DenseVector parseDense(String str) {<NEW_LINE>if (org.apache.flink.util.StringUtils.isNullOrWhitespaceOnly(str)) {<NEW_LINE>return new DenseVector();<NEW_LINE>}<NEW_LINE>int len = str.length();<NEW_LINE>int inDataBuffPos = 0;<NEW_LINE>boolean isInBuff = false;<NEW_LINE>for (int i = 0; i < len; ++i) {<NEW_LINE>char c = str.charAt(i);<NEW_LINE>if (// to be compatible with previous delimiter<NEW_LINE>c == ELEMENT_DELIMITER || c == ',') {<NEW_LINE>if (isInBuff) {<NEW_LINE>inDataBuffPos++;<NEW_LINE>}<NEW_LINE>isInBuff = false;<NEW_LINE>} else {<NEW_LINE>isInBuff = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isInBuff) {<NEW_LINE>inDataBuffPos++;<NEW_LINE>}<NEW_LINE>double[] data = new double[inDataBuffPos];<NEW_LINE>int lastestInCharBuffPos = 0;<NEW_LINE>inDataBuffPos = 0;<NEW_LINE>isInBuff = false;<NEW_LINE>for (int i = 0; i < len; ++i) {<NEW_LINE>char c = str.charAt(i);<NEW_LINE>if (// to be compatible with previous delimiter<NEW_LINE>c == ELEMENT_DELIMITER || c == ',') {<NEW_LINE>if (isInBuff) {<NEW_LINE>data[inDataBuffPos++] = Double.parseDouble(StringUtils.substring(str, lastestInCharBuffPos, i).trim());<NEW_LINE>lastestInCharBuffPos = i + 1;<NEW_LINE>}<NEW_LINE>isInBuff = false;<NEW_LINE>} else {<NEW_LINE>isInBuff = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isInBuff) {<NEW_LINE>data[inDataBuffPos] = Double.valueOf(StringUtils.substring(str<MASK><NEW_LINE>}<NEW_LINE>return new DenseVector(data);<NEW_LINE>} | , lastestInCharBuffPos).trim()); |
341,084 | final UpdatePublicKeyResult executeUpdatePublicKey(UpdatePublicKeyRequest updatePublicKeyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updatePublicKeyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdatePublicKeyRequest> request = null;<NEW_LINE>Response<UpdatePublicKeyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdatePublicKeyRequestMarshaller().marshall(super.beforeMarshalling(updatePublicKeyRequest));<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, "CloudFront");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdatePublicKey");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<UpdatePublicKeyResult> responseHandler = new StaxResponseHandler<UpdatePublicKeyResult>(new UpdatePublicKeyResultStaxUnmarshaller());<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,224,016 | static HazelcastInstance embeddedHazelcastServer() {<NEW_LINE>Config config = new Config();<NEW_LINE>NetworkConfig networkConfig = config.getNetworkConfig();<NEW_LINE>networkConfig.setPort(0);<NEW_LINE>networkConfig.getJoin().getMulticastConfig().setEnabled(false);<NEW_LINE>AttributeConfig attributeConfig = new AttributeConfig().setName(Hazelcast4IndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE).setExtractorClassName(Hazelcast4PrincipalNameExtractor.class.getName());<NEW_LINE>config.getMapConfig(Hazelcast4IndexedSessionRepository.DEFAULT_SESSION_MAP_NAME).addAttributeConfig(attributeConfig).addIndexConfig(new IndexConfig(IndexType<MASK><NEW_LINE>SerializerConfig serializerConfig = new SerializerConfig();<NEW_LINE>serializerConfig.setImplementation(new HazelcastSessionSerializer()).setTypeClass(MapSession.class);<NEW_LINE>config.getSerializationConfig().addSerializerConfig(serializerConfig);<NEW_LINE>return Hazelcast.newHazelcastInstance(config);<NEW_LINE>} | .HASH, Hazelcast4IndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)); |
305,302 | public void engineInit(int opmode, Key key, AlgorithmParameterSpec engineSpec, SecureRandom random) throws InvalidAlgorithmParameterException, InvalidKeyException {<NEW_LINE>otherKeyParameter = null;<NEW_LINE>this.engineSpec = (IESKEMParameterSpec) engineSpec;<NEW_LINE>// Parse the recipient's key<NEW_LINE>if (opmode == Cipher.ENCRYPT_MODE || opmode == Cipher.WRAP_MODE) {<NEW_LINE>if (key instanceof PublicKey) {<NEW_LINE>this.key = ECUtils.generatePublicKeyParameter((PublicKey) key);<NEW_LINE>} else {<NEW_LINE>throw new InvalidKeyException("must be passed recipient's public EC key for encryption");<NEW_LINE>}<NEW_LINE>} else if (opmode == Cipher.DECRYPT_MODE || opmode == Cipher.UNWRAP_MODE) {<NEW_LINE>if (key instanceof PrivateKey) {<NEW_LINE>this.key = ECUtil<MASK><NEW_LINE>} else {<NEW_LINE>throw new InvalidKeyException("must be passed recipient's private EC key for decryption");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new InvalidKeyException("must be passed EC key");<NEW_LINE>}<NEW_LINE>this.random = random;<NEW_LINE>this.state = opmode;<NEW_LINE>buffer.reset();<NEW_LINE>} | .generatePrivateKeyParameter((PrivateKey) key); |
217,044 | private static TestStepConfig createFromDialog(WsdlProject project, String name) {<NEW_LINE>WsdlMockResponseStepFactory.project = project;<NEW_LINE>try {<NEW_LINE>List<Interface> interfaces = new ArrayList<Interface>();<NEW_LINE>for (Interface iface : project.getInterfaces(WsdlInterfaceFactory.WSDL_TYPE)) {<NEW_LINE>if (iface.getOperationCount() > 0) {<NEW_LINE>interfaces.add(iface);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (interfaces.isEmpty()) {<NEW_LINE>UISupport.showErrorMessage("Missing Interfaces/Operations to mock");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>dialog.setValue(CreateForm.NAME, name);<NEW_LINE>dialog.setOptions(CreateForm.INTERFACE, new ModelItemNames<Interface>(interfaces).getNames());<NEW_LINE>dialog.setOptions(CreateForm.OPERATION, new ModelItemNames<Operation>(interfaces.get(0).getOperationList()).getNames());<NEW_LINE>if (!dialog.show()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TestStepConfig testStepConfig = TestStepConfig.Factory.newInstance();<NEW_LINE>testStepConfig.setType(MOCKRESPONSE_TYPE);<NEW_LINE>testStepConfig.setName(dialog.getValue(CreateForm.NAME));<NEW_LINE>MockResponseStepConfig config = MockResponseStepConfig.Factory.newInstance();<NEW_LINE>config.setInterface(dialog.getValue(CreateForm.INTERFACE));<NEW_LINE>config.setOperation(dialog.getValue(CreateForm.OPERATION));<NEW_LINE>config.setPort(dialog.getIntValue(CreateForm.PORT, 8080));<NEW_LINE>config.setPath(dialog.getValue(CreateForm.PATH));<NEW_LINE>config.addNewResponse();<NEW_LINE>config<MASK><NEW_LINE>if (dialog.getBooleanValue(CreateForm.CREATE_RESPONSE)) {<NEW_LINE>WsdlInterface iface = (WsdlInterface) project.getInterfaceByName(config.getInterface());<NEW_LINE>String response = iface.getOperationByName(config.getOperation()).createResponse(project.getSettings().getBoolean(WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS));<NEW_LINE>CompressedStringSupport.setString(config.getResponse().getResponseContent(), response);<NEW_LINE>}<NEW_LINE>testStepConfig.addNewConfig().set(config);<NEW_LINE>return testStepConfig;<NEW_LINE>} finally {<NEW_LINE>WsdlMockResponseStepFactory.project = null;<NEW_LINE>}<NEW_LINE>} | .getResponse().addNewResponseContent(); |
529,831 | public void onEvictInvalidateHash(long hash, Chain evictedChain) {<NEW_LINE>EvictionOutcome result = EvictionOutcome.SUCCESS;<NEW_LINE>clusteredStore.evictionObserver.begin();<NEW_LINE>if (clusteredStore.invalidationValve != null) {<NEW_LINE>try {<NEW_LINE>LOGGER.debug("CLIENT: calling invalidation valve for hash {}", hash);<NEW_LINE>clusteredStore.invalidationValve.invalidateAllWithHash(hash);<NEW_LINE>} catch (StoreAccessException sae) {<NEW_LINE>// TODO: what should be done here? delegate to resilience strategy?<NEW_LINE>LOGGER.error("Error invalidating hash {}", hash, sae);<NEW_LINE>result = EvictionOutcome.FAILURE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (evictedChain != null) {<NEW_LINE>StoreEventSink<K, V> sink = clusteredStore.storeEventDispatcher.eventSink();<NEW_LINE>Map<K, ValueHolder<V>> operationMap = clusteredStore.resolver.resolveAll(evictedChain);<NEW_LINE>long now = clusteredStore.timeSource.getTimeMillis();<NEW_LINE>for (Map.Entry<K, ValueHolder<V>> entry : operationMap.entrySet()) {<NEW_LINE>K key = entry.getKey();<NEW_LINE>ValueHolder<V> valueHolder = entry.getValue();<NEW_LINE>if (valueHolder.isExpired(now)) {<NEW_LINE>sink.expired(key, valueHolder);<NEW_LINE>} else {<NEW_LINE>sink.evicted(key, valueHolder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>clusteredStore.evictionObserver.end(result);<NEW_LINE>} | clusteredStore.storeEventDispatcher.releaseEventSink(sink); |
1,635,333 | public static Query<Optional<DateObj<Integer>>> fetchPeakPlayerCount(ServerUUID serverUUID, long afterDate) {<NEW_LINE>String subQuery = '(' + SELECT + "MAX(" + PLAYERS_ONLINE + ')' + FROM + TABLE_NAME + WHERE + SERVER_ID + "=" + ServerTable.STATEMENT_SELECT_SERVER_ID + AND + DATE + ">= ?)";<NEW_LINE>String sql = SELECT + DATE + ',' + PLAYERS_ONLINE + FROM + TABLE_NAME + WHERE + SERVER_ID + "=" + ServerTable.STATEMENT_SELECT_SERVER_ID + AND + DATE + ">= ?" + AND + PLAYERS_ONLINE + "=" + subQuery + ORDER_BY + DATE + " DESC LIMIT 1";<NEW_LINE>return new QueryStatement<Optional<DateObj<Integer>>>(sql) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void prepare(PreparedStatement statement) throws SQLException {<NEW_LINE>statement.setString(1, serverUUID.toString());<NEW_LINE>statement.setLong(2, afterDate);<NEW_LINE>statement.setString(<MASK><NEW_LINE>statement.setLong(4, afterDate);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Optional<DateObj<Integer>> processResults(ResultSet set) throws SQLException {<NEW_LINE>if (set.next()) {<NEW_LINE>return Optional.of(new DateObj<>(set.getLong(DATE), set.getInt(PLAYERS_ONLINE)));<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | 3, serverUUID.toString()); |
63,850 | private static void renderSidePower(EnumFacing side, double power, double centrePower, double offset, BufferBuilder bb) {<NEW_LINE>if (power < 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean overload = false;<NEW_LINE>double radius = 0.248 * power;<NEW_LINE>if (radius >= 0.248) {<NEW_LINE>// overload = true;<NEW_LINE>radius = 0.248;<NEW_LINE>}<NEW_LINE>TextureAtlasSprite sprite = (overload ? BCTransportSprites.POWER_FLOW_OVERLOAD : BCTransportSprites.POWER_FLOW).getSprite();<NEW_LINE>double centreRadius = 0.252 - (0.248 * centrePower);<NEW_LINE>Vec3d centre = VecUtil.offset(VecUtil.VEC_HALF, side, 0.25 + 0.125 - centreRadius / 2);<NEW_LINE>Vec3d radiusV = new Vec3d(radius, radius, radius);<NEW_LINE>radiusV = VecUtil.replaceValue(radiusV, side.getAxis(<MASK><NEW_LINE>Point3f centreF = new Point3f((float) centre.x, (float) centre.y, (float) centre.z);<NEW_LINE>Point3f radiusF = new Point3f((float) radiusV.x, (float) radiusV.y, (float) radiusV.z);<NEW_LINE>UvFaceData uvs = new UvFaceData();<NEW_LINE>for (EnumFacing face : EnumFacing.values()) {<NEW_LINE>if (face == side.getOpposite()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>AxisAlignedBB box = new AxisAlignedBB(centre.subtract(radiusV).scale(0.5), centre.add(radiusV).scale(0.5));<NEW_LINE>box = box.offset(VecUtil.offset(Vec3d.ZERO, side, offset * side.getAxisDirection().getOffset() / 32));<NEW_LINE>ModelUtil.mapBoxToUvs(box, face, uvs);<NEW_LINE>MutableQuad quad = ModelUtil.createFace(face, centreF, radiusF, uvs);<NEW_LINE>quad.texFromSprite(sprite);<NEW_LINE>quad.lighti(15, 15);<NEW_LINE>quad.render(bb);<NEW_LINE>}<NEW_LINE>} | ), 0.125 + centreRadius / 2); |
1,512,706 | // Sync from Ldap to KC<NEW_LINE>@Override<NEW_LINE>public SynchronizationResult syncDataFromFederationProviderToKeycloak(RealmModel realm) {<NEW_LINE>SynchronizationResult syncResult = new SynchronizationResult() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getStatus() {<NEW_LINE>return String.format("%d imported groups, %d updated groups, %d removed groups", getAdded(), getUpdated(), getRemoved());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>logger.debugf("Syncing groups from LDAP into Keycloak DB. Mapper is [%s], LDAP provider is [%s]", mapperModel.getName(), ldapProvider.getModel().getName());<NEW_LINE>// Get all LDAP groups<NEW_LINE>List<LDAPObject> ldapGroups = getAllLDAPGroups(config.isPreserveGroupsInheritance());<NEW_LINE>// Convert to internal format<NEW_LINE>Map<String, LDAPObject> ldapGroupsMap = new HashMap<>();<NEW_LINE>List<GroupTreeResolver.Group> <MASK><NEW_LINE>convertGroupsToInternalRep(ldapGroups, ldapGroupsMap, ldapGroupsRep);<NEW_LINE>// Now we have list of LDAP groups. Let's form the tree (if needed)<NEW_LINE>if (config.isPreserveGroupsInheritance()) {<NEW_LINE>try {<NEW_LINE>List<GroupTreeResolver.GroupTreeEntry> groupTrees = new GroupTreeResolver().resolveGroupTree(ldapGroupsRep, config.isIgnoreMissingGroups());<NEW_LINE>updateKeycloakGroupTree(realm, groupTrees, ldapGroupsMap, syncResult);<NEW_LINE>} catch (GroupTreeResolver.GroupTreeResolveException gre) {<NEW_LINE>throw new ModelException("Couldn't resolve groups from LDAP. Fix LDAP or skip preserve inheritance. Details: " + gre.getMessage(), gre);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>syncFlatGroupStructure(realm, syncResult, ldapGroupsMap);<NEW_LINE>}<NEW_LINE>syncFromLDAPPerformedInThisTransaction = true;<NEW_LINE>return syncResult;<NEW_LINE>} | ldapGroupsRep = new LinkedList<>(); |
125,726 | public static RelNode convert(Order order, ConversionContext context) throws InvalidRelException {<NEW_LINE>// if there are compound expressions in the order by, we need to convert into projects on either side.<NEW_LINE>RelNode input = context.toRel(order.getInput());<NEW_LINE>List<String> fields = input.getRowType().getFieldNames();<NEW_LINE>// build a map of field names to indices.<NEW_LINE>Map<String, Integer> fieldMap = Maps.newHashMap();<NEW_LINE>int i = 0;<NEW_LINE>for (String field : fields) {<NEW_LINE>fieldMap.put(field, i);<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>List<RelFieldCollation> collations = Lists.newArrayList();<NEW_LINE>for (Ordering o : order.getOrderings()) {<NEW_LINE>String fieldName = ExprHelper.getFieldName(o.getExpr());<NEW_LINE>int <MASK><NEW_LINE>RelFieldCollation c = new RelFieldCollation(fieldId, o.getDirection(), o.getNullDirection());<NEW_LINE>collations.add(c);<NEW_LINE>}<NEW_LINE>return new DrillSortRel(context.getCluster(), context.getLogicalTraits(), input, RelCollations.of(collations));<NEW_LINE>} | fieldId = fieldMap.get(fieldName); |
243,971 | protected void debugFlush() {<NEW_LINE>LOGGER.debug("Flushing dbSqlSession");<NEW_LINE>int nrOfInserts = 0;<NEW_LINE>int nrOfUpdates = 0;<NEW_LINE>int nrOfDeletes = 0;<NEW_LINE>for (Map<String, Entity> insertedObjectMap : insertedObjects.values()) {<NEW_LINE>for (Entity insertedObject : insertedObjectMap.values()) {<NEW_LINE>LOGGER.debug("insert {}", insertedObject);<NEW_LINE>nrOfInserts++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Entity updatedObject : updatedObjects) {<NEW_LINE>LOGGER.debug("update {}", updatedObject);<NEW_LINE>nrOfUpdates++;<NEW_LINE>}<NEW_LINE>for (Map<String, Entity> deletedObjectMap : deletedObjects.values()) {<NEW_LINE>for (Entity deletedObject : deletedObjectMap.values()) {<NEW_LINE>LOGGER.debug("delete {} with id {}", <MASK><NEW_LINE>nrOfDeletes++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Collection<BulkDeleteOperation> bulkDeleteOperationList : bulkDeleteOperations.values()) {<NEW_LINE>for (BulkDeleteOperation bulkDeleteOperation : bulkDeleteOperationList) {<NEW_LINE>LOGGER.debug("{}", bulkDeleteOperation);<NEW_LINE>nrOfDeletes++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOGGER.debug("flush summary: {} insert, {} update, {} delete.", nrOfInserts, nrOfUpdates, nrOfDeletes);<NEW_LINE>LOGGER.debug("now executing flush...");<NEW_LINE>} | deletedObject, deletedObject.getId()); |
1,147,183 | public static void importAddressReferences(final CConnection connection, final int rawModuleId, final int moduleId) throws SQLException {<NEW_LINE>Preconditions.checkNotNull(connection, "IE00266: connection argument can not be null");<NEW_LINE>Preconditions.<MASK><NEW_LINE>Preconditions.checkArgument(moduleId >= 0, "Error: module if can only be a positive number");<NEW_LINE>final String query = "INSERT INTO " + CTableNames.ADDRESS_REFERENCES_TABLE + " (module_id, address, position, expression_id, type, target) " + " SELECT " + moduleId + ", address, position, expression_node_id, " + " (ENUM_RANGE(NULL::address_reference_type))[type + 1], destination " + " FROM ex_" + rawModuleId + "_address_references WHERE position IS NOT NULL AND expression_node_id IS NOT NULL;";<NEW_LINE>connection.executeUpdate(query, true);<NEW_LINE>} | checkArgument(rawModuleId >= 0, "Error: raw module id can only be a positive number."); |
965,700 | private static void sendDiscover(String host, int port, String searchTarget) throws IOException {<NEW_LINE>String usn = PMS.get().usn();<NEW_LINE>String serverURL = MediaServer.getURL();<NEW_LINE>SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.US);<NEW_LINE>sdf.setTimeZone(TimeZone.getTimeZone("GMT"));<NEW_LINE>if (searchTarget.equals(usn)) {<NEW_LINE>usn = "";<NEW_LINE>} else {<NEW_LINE>usn += "::";<NEW_LINE>}<NEW_LINE>StringBuilder discovery = new StringBuilder();<NEW_LINE>discovery.append("HTTP/1.1 200 OK").append(CRLF);<NEW_LINE>discovery.append("CACHE-CONTROL: max-age=1800").append(CRLF);<NEW_LINE>discovery.append("DATE: ").append(sdf.format(new Date(System.currentTimeMillis()))).append(" GMT").append(CRLF);<NEW_LINE>discovery.append("LOCATION: ").append(serverURL).append("/description/fetch").append(CRLF);<NEW_LINE>discovery.append("SERVER: ").append(PMS.get().getServerName()).append(CRLF);<NEW_LINE>discovery.append("ST: ").append(searchTarget).append(CRLF);<NEW_LINE>discovery.append("EXT: ").append(CRLF);<NEW_LINE>discovery.append("USN: ").append(usn).append(searchTarget).append(CRLF);<NEW_LINE>discovery.append("Content-Length: 0").append(CRLF).append(CRLF);<NEW_LINE>String msg = discovery.toString();<NEW_LINE>if (LOGGER.isTraceEnabled()) {<NEW_LINE>if (searchTarget.equals(lastSearch)) {<NEW_LINE>LOGGER.trace("Resending last discovery [" + host + ":" + port + "]");<NEW_LINE>} else {<NEW_LINE>LOGGER.trace("Sending discovery [" + host + ":" + port + "]: " + StringUtils.replace<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>sendReply(host, port, msg);<NEW_LINE>lastSearch = searchTarget;<NEW_LINE>} | (msg, CRLF, "<CRLF>")); |
118,028 | public static FundingRecord adaptFundingRecord(Currency currency, CoinbaseProTransfer coinbaseProTransfer) {<NEW_LINE>FundingRecord.<MASK><NEW_LINE>Date processedAt = coinbaseProTransfer.processedAt();<NEW_LINE>Date canceledAt = coinbaseProTransfer.canceledAt();<NEW_LINE>if (canceledAt != null)<NEW_LINE>status = FundingRecord.Status.CANCELLED;<NEW_LINE>else if (processedAt != null)<NEW_LINE>status = FundingRecord.Status.COMPLETE;<NEW_LINE>String address = coinbaseProTransfer.getDetails().getCryptoAddress();<NEW_LINE>if (address == null)<NEW_LINE>address = coinbaseProTransfer.getDetails().getSentToAddress();<NEW_LINE>String cryptoTransactionHash = coinbaseProTransfer.getDetails().getCryptoTransactionHash();<NEW_LINE>String transactionHash = adaptTransactionHash(currency.getSymbol(), cryptoTransactionHash);<NEW_LINE>return new FundingRecord(address, coinbaseProTransfer.getDetails().getDestinationTag(), coinbaseProTransfer.createdAt(), currency, coinbaseProTransfer.amount(), coinbaseProTransfer.getId(), transactionHash, coinbaseProTransfer.type(), status, null, null, null);<NEW_LINE>} | Status status = FundingRecord.Status.PROCESSING; |
549,974 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String eplDeclare = "@public create table varTotalG2K (key0 string primary key, key1 int primary key, total sum(long), cnt count(*))";<NEW_LINE>env.compileDeploy(eplDeclare, path);<NEW_LINE>String eplBind = "into table varTotalG2K " + "select sum(longPrimitive) as total, count(*) as cnt " + "from SupportBean group by theString, intPrimitive";<NEW_LINE>env.compileDeploy(eplBind, path);<NEW_LINE>String eplUse = "@name('s0') select varTotalG2K[p00, id].total as c0, varTotalG2K[p00, id].cnt as c1 from SupportBean_S0";<NEW_LINE>env.compileDeploy(eplUse, path).addListener("s0");<NEW_LINE>makeSendBean(env, "E1", 10, 100);<NEW_LINE>String[] fields = "c0,c1".split(",");<NEW_LINE>env.sendEventBean(<MASK><NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 100L, 1L });<NEW_LINE>env.milestone(0);<NEW_LINE>env.sendEventBean(new SupportBean_S0(0, "E1"));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { null, null });<NEW_LINE>env.sendEventBean(new SupportBean_S0(10, "E2"));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { null, null });<NEW_LINE>env.undeployAll();<NEW_LINE>} | new SupportBean_S0(10, "E1")); |
1,535,844 | public void initXxlJobExecutor() {<NEW_LINE>// load executor prop<NEW_LINE>Properties xxlJobProp = loadProperties("xxl-job-executor.properties");<NEW_LINE>// init executor<NEW_LINE>xxlJobExecutor = new XxlJobSimpleExecutor();<NEW_LINE>xxlJobExecutor.setAdminAddresses(xxlJobProp.getProperty("xxl.job.admin.addresses"));<NEW_LINE>xxlJobExecutor.setAccessToken(xxlJobProp.getProperty("xxl.job.accessToken"));<NEW_LINE>xxlJobExecutor.setAppname(xxlJobProp.getProperty("xxl.job.executor.appname"));<NEW_LINE>xxlJobExecutor.setAddress(xxlJobProp.getProperty("xxl.job.executor.address"));<NEW_LINE>xxlJobExecutor.setIp(xxlJobProp.getProperty("xxl.job.executor.ip"));<NEW_LINE>xxlJobExecutor.setPort(Integer.valueOf(xxlJobProp.getProperty("xxl.job.executor.port")));<NEW_LINE>xxlJobExecutor.setLogPath(xxlJobProp.getProperty("xxl.job.executor.logpath"));<NEW_LINE>xxlJobExecutor.setLogRetentionDays(Integer.valueOf(xxlJobProp.getProperty("xxl.job.executor.logretentiondays")));<NEW_LINE>// registry job bean<NEW_LINE>xxlJobExecutor.setXxlJobBeanList(Arrays.asList(new SampleXxlJob()));<NEW_LINE>// start executor<NEW_LINE>try {<NEW_LINE>xxlJobExecutor.start();<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error(<MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
826,108 | public LatticeNode concatenateOov(List<LatticeNode> path, int begin, int end, short posId, Lattice lattice) {<NEW_LINE>if (begin >= end) {<NEW_LINE>throw new IndexOutOfBoundsException("begin >= end");<NEW_LINE>}<NEW_LINE>int b = path.<MASK><NEW_LINE>int e = path.get(end - 1).getEnd();<NEW_LINE>Optional<? extends LatticeNode> n = lattice.getMinimumNode(b, e);<NEW_LINE>if (n.isPresent()) {<NEW_LINE>LatticeNode node = n.get();<NEW_LINE>replaceNode(path, begin, end, node);<NEW_LINE>return node;<NEW_LINE>}<NEW_LINE>StringBuilder surface = new StringBuilder();<NEW_LINE>int length = 0;<NEW_LINE>for (int i = begin; i < end; i++) {<NEW_LINE>WordInfo info = path.get(i).getWordInfo();<NEW_LINE>surface.append(info.getSurface());<NEW_LINE>length += info.getLength();<NEW_LINE>}<NEW_LINE>String s = surface.toString();<NEW_LINE>WordInfo wi = new WordInfo(s, (short) length, posId, s, s, "");<NEW_LINE>LatticeNode node = lattice.createNode();<NEW_LINE>node.setRange(b, e);<NEW_LINE>node.setWordInfo(wi);<NEW_LINE>node.setOOV();<NEW_LINE>replaceNode(path, begin, end, node);<NEW_LINE>return node;<NEW_LINE>} | get(begin).getBegin(); |
682,650 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {<NEW_LINE>isInSubActivity = false;<NEW_LINE>// Only if none of the high 16 bits are set it might be one of our request codes<NEW_LINE>if ((requestCode & REQUEST_CODE_MASK) == 0) {<NEW_LINE>if ((requestCode & REQUEST_MASK_MESSAGE_BUILDER) == REQUEST_MASK_MESSAGE_BUILDER) {<NEW_LINE>requestCode ^= REQUEST_MASK_MESSAGE_BUILDER;<NEW_LINE>if (currentMessageBuilder == null) {<NEW_LINE>Timber.e("Got a message builder activity result for no message builder, " + "this is an illegal state!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>currentMessageBuilder.onActivityResult(<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if ((requestCode & REQUEST_MASK_RECIPIENT_PRESENTER) == REQUEST_MASK_RECIPIENT_PRESENTER) {<NEW_LINE>requestCode ^= REQUEST_MASK_RECIPIENT_PRESENTER;<NEW_LINE>recipientPresenter.onActivityResult(requestCode, resultCode, data);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if ((requestCode & REQUEST_MASK_LOADER_HELPER) == REQUEST_MASK_LOADER_HELPER) {<NEW_LINE>requestCode ^= REQUEST_MASK_LOADER_HELPER;<NEW_LINE>messageLoaderHelper.onActivityResult(requestCode, resultCode, data);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if ((requestCode & REQUEST_MASK_ATTACHMENT_PRESENTER) == REQUEST_MASK_ATTACHMENT_PRESENTER) {<NEW_LINE>requestCode ^= REQUEST_MASK_ATTACHMENT_PRESENTER;<NEW_LINE>attachmentPresenter.onActivityResult(resultCode, requestCode, data);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>super.onActivityResult(requestCode, resultCode, data);<NEW_LINE>} | requestCode, resultCode, data, this); |
1,695,881 | private void saveToFolder(Business business, Share share, String fileId, String folderId, EffectivePerson effectivePerson) throws Exception {<NEW_LINE>EntityManagerContainer emc = business.entityManagerContainer();<NEW_LINE>this.usedSize = business.attachment2().getUseCapacity(effectivePerson.getDistinguishedName());<NEW_LINE>if (Share.FILE_TYPE_ATTACHMENT.equals(share.getFileType())) {<NEW_LINE>Attachment2 att = emc.find(fileId, Attachment2.class);<NEW_LINE>if (att != null) {<NEW_LINE>usedSize = usedSize + att.getLength();<NEW_LINE>int vResult = business.verifyConstraint(effectivePerson.getDistinguishedName(), usedSize);<NEW_LINE>if (vResult > 0) {<NEW_LINE>long usedCapacity = usedSize / (1024 * 1024);<NEW_LINE>throw new ExceptionCapacityOut(usedCapacity, vResult);<NEW_LINE>}<NEW_LINE>Attachment2 newAtt = new Attachment2(att.getName(), effectivePerson.getDistinguishedName(), folderId, att.getOriginFile(), att.getLength(), att.getType());<NEW_LINE>emc.<MASK><NEW_LINE>emc.beginTransaction(Attachment2.class);<NEW_LINE>emc.persist(newAtt);<NEW_LINE>emc.commit();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Folder2 folder = emc.find(fileId, Folder2.class);<NEW_LINE>Folder2 newFolder = new Folder2(folder.getName(), effectivePerson.getDistinguishedName(), folderId, folder.getStatus());<NEW_LINE>EntityManager em = emc.beginTransaction(Folder2.class);<NEW_LINE>emc.check(newFolder, CheckPersistType.all);<NEW_LINE>em.persist(newFolder);<NEW_LINE>em.getTransaction().commit();<NEW_LINE>saveSubFolder(business, folder.getId(), newFolder.getId(), effectivePerson);<NEW_LINE>}<NEW_LINE>} | check(newAtt, CheckPersistType.all); |
249,103 | private void continueWithRedirection(RedirectionEntry redirectionEntry, String state) throws IOException {<NEW_LINE>if (state == null || state.isEmpty()) {<NEW_LINE>redirectionEntry.handleNoState(request, response);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String requestUrl = getOriginalRequestUrl(state);<NEW_LINE>if (requestUrl == null || requestUrl.isEmpty()) {<NEW_LINE>// CWWKS1750E<NEW_LINE>String errorMsg = Tr.formatMessage(tc, "OIDC_CLIENT_BAD_REQUEST_NO_COOKIE", request.getRequestURL());<NEW_LINE>Tr.error(tc, errorMsg);<NEW_LINE>response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String clientId = getClientId();<NEW_LINE>String oidcClientId = getOidcClientId(state);<NEW_LINE>String code = request.getParameter(Constants.CODE);<NEW_LINE>String idToken = request.getParameter(Constants.ID_TOKEN);<NEW_LINE>if (code != null || idToken != null) {<NEW_LINE>ConvergedClientConfig clientConfig = redirectionEntry.getConvergedClientConfig(request, clientId);<NEW_LINE>sendToOriginalRequestUrl(requestUrl, state, clientId, oidcClientId, idToken, clientConfig);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | redirectionEntry.sendError(request, response); |
1,402,973 | protected RunContentDescriptor doExecute(RunProfileState profile, ExecutionEnvironment env) throws ExecutionException {<NEW_LINE>BlazeCommandRunConfiguration blazeConfig = <MASK><NEW_LINE>ListenableFuture<BlazeInfo> blazeInfo = getBlazeInfo(env.getProject(), blazeConfig);<NEW_LINE>if (blazeInfo == null) {<NEW_LINE>throw new ExecutionException("Can't run with coverage: no sync data found. Please sync your project and retry.");<NEW_LINE>}<NEW_LINE>RunContentDescriptor result = super.doExecute(profile, env);<NEW_LINE>if (result == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>EventLoggingService.getInstance().logEvent(getClass(), "run-with-coverage");<NEW_LINE>// remove any old copy of the coverage data<NEW_LINE>// retrieve coverage data and copy locally<NEW_LINE>BlazeCoverageEnabledConfiguration config = (BlazeCoverageEnabledConfiguration) CoverageEnabledConfiguration.getOrCreate(blazeConfig);<NEW_LINE>String coverageFilePath = config.getCoverageFilePath();<NEW_LINE>ProcessHandler handler = result.getProcessHandler();<NEW_LINE>if (handler != null) {<NEW_LINE>ProcessHandler wrappedHandler = new ProcessHandlerWrapper(handler, exitCode -> copyCoverageOutput(() -> getCoverageOutputFile(blazeInfo), coverageFilePath, exitCode));<NEW_LINE>CoverageHelper.attachToProcess(blazeConfig, wrappedHandler, env.getRunnerSettings());<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (BlazeCommandRunConfiguration) env.getRunProfile(); |
266,885 | public static AlbumInfo parseRedditGallery(final String url, final JsonObject object) {<NEW_LINE>final JsonObject mediaMetadataList = object.getObject("media_metadata");<NEW_LINE>final JsonObject galleryData = object.getObject("gallery_data");<NEW_LINE>if (mediaMetadataList == null || galleryData == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final JsonArray galleryItems = galleryData.getArray("items");<NEW_LINE>final ArrayList<ImageInfo> images = new ArrayList<>();<NEW_LINE>for (final JsonValue itemValue : galleryItems) {<NEW_LINE>final JsonObject item = itemValue.asObject();<NEW_LINE>final String mediaId = StringEscapeUtils.unescapeHtml4(item.getString("media_id"));<NEW_LINE>@Nullable<NEW_LINE>final String caption = StringEscapeUtils.unescapeHtml4(item.getString("caption"));<NEW_LINE>// TODO show this in the UI<NEW_LINE>@SuppressWarnings("unused")<NEW_LINE>@Nullable<NEW_LINE>final String outboundUrl = StringEscapeUtils.unescapeHtml4(item.getString("outbound_url"));<NEW_LINE>final JsonObject mediaMetadataEntry = mediaMetadataList.getObject(mediaId);<NEW_LINE>@Nullable<NEW_LINE>final String mimetype = StringEscapeUtils.unescapeHtml4(mediaMetadataEntry.getString("m"));<NEW_LINE>final JsonObject standardImage = mediaMetadataEntry.getObject("s");<NEW_LINE>final ImageInfo.MediaType mediaType = stringToMediaType(mediaMetadataEntry.getString("e"));<NEW_LINE>String <MASK><NEW_LINE>if (urlEscaped == null) {<NEW_LINE>urlEscaped = standardImage.getString("mp4");<NEW_LINE>if (urlEscaped == null) {<NEW_LINE>urlEscaped = standardImage.getString("gif");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>images.add(new ImageInfo(StringEscapeUtils.unescapeHtml4(urlEscaped), getThumbnail(mediaMetadataEntry.getArray("p")), caption, null, mimetype, mediaType != ImageInfo.MediaType.IMAGE, standardImage.getLong("x"), standardImage.getLong("y"), null, mediaType, ImageInfo.HasAudio.NO_AUDIO, null, null, null));<NEW_LINE>}<NEW_LINE>final String title = StringEscapeUtils.unescapeHtml4(object.getString("title"));<NEW_LINE>return new AlbumInfo(url, title, null, images);<NEW_LINE>} | urlEscaped = standardImage.getString("u"); |
755,003 | private void renderSliderOption(Graphics g, GameOption option, int cy) {<NEW_LINE>// draw option name and value<NEW_LINE>final int padding = 10;<NEW_LINE>String value = option.getValueString();<NEW_LINE>int nameWidth = Fonts.MEDIUM.getWidth(option.getName());<NEW_LINE>int valueWidth = Fonts.MEDIUM.getWidth(value);<NEW_LINE>Fonts.MEDIUM.drawString(x + optionStartX, cy + optionTextOffsetY, <MASK><NEW_LINE>Fonts.MEDIUM.drawString(x + optionStartX + optionWidth - valueWidth, cy + optionTextOffsetY, value, COLOR_BLUE);<NEW_LINE>// calculate slider positions<NEW_LINE>int sliderWidth = optionWidth - nameWidth - padding - padding - valueWidth;<NEW_LINE>if (sliderWidth <= 1)<NEW_LINE>// menu hasn't slid in far enough to need to draw the slider<NEW_LINE>return;<NEW_LINE>int sliderStartX = (int) (x + optionStartX + nameWidth + padding);<NEW_LINE>if (hoverOption == option) {<NEW_LINE>sliderOptionStartX = sliderStartX;<NEW_LINE>if (!isAdjustingSlider)<NEW_LINE>sliderOptionWidth = sliderWidth;<NEW_LINE>else<NEW_LINE>sliderWidth = sliderOptionWidth;<NEW_LINE>}<NEW_LINE>int sliderEndX = sliderStartX + sliderWidth;<NEW_LINE>// draw slider<NEW_LINE>float sliderValue = (float) (option.getIntegerValue() - option.getMinValue()) / (option.getMaxValue() - option.getMinValue());<NEW_LINE>float sliderBallPos = sliderStartX + (int) ((sliderWidth - controlImageSize) * sliderValue);<NEW_LINE>g.setLineWidth(3f);<NEW_LINE>g.setColor(COLOR_PINK);<NEW_LINE>if (sliderValue > 0.0001f)<NEW_LINE>g.drawLine(sliderStartX, cy + optionHeight / 2, sliderBallPos, cy + optionHeight / 2);<NEW_LINE>sliderBallImg.draw(sliderBallPos, cy + controlImagePadding, COLOR_PINK);<NEW_LINE>if (sliderValue < 0.999f) {<NEW_LINE>float oldAlpha = COLOR_PINK.a;<NEW_LINE>COLOR_PINK.a *= 0.45f;<NEW_LINE>g.setColor(COLOR_PINK);<NEW_LINE>g.drawLine(sliderBallPos + controlImageSize + 1, cy + optionHeight / 2, sliderEndX, cy + optionHeight / 2);<NEW_LINE>COLOR_PINK.a = oldAlpha;<NEW_LINE>}<NEW_LINE>} | option.getName(), COLOR_WHITE); |
603,573 | public void installUI(JComponent c) {<NEW_LINE>myDelegateUI.installUI(c);<NEW_LINE>// unregister native popup<NEW_LINE>ComboPopup <MASK><NEW_LINE>if (o != null) {<NEW_LINE>o.uninstallingUI();<NEW_LINE>myDelegateUI.unconfigureArrowButton();<NEW_LINE>KeyListener keyListener = BasicComboBoxUIHacking.getKeyListener(myDelegateUI);<NEW_LINE>if (keyListener != null) {<NEW_LINE>c.removeKeyListener(keyListener);<NEW_LINE>BasicComboBoxUIHacking.setKeyListener(myDelegateUI, new KeyAdapter() {<NEW_LINE>});<NEW_LINE>}<NEW_LINE>MouseListener mouseListener = BasicComboBoxUIHacking.getMouseListener(myDelegateUI);<NEW_LINE>if (mouseListener != null) {<NEW_LINE>c.removeMouseListener(mouseListener);<NEW_LINE>BasicComboBoxUIHacking.setMouseListener(myDelegateUI, new MouseAdapter() {<NEW_LINE>});<NEW_LINE>}<NEW_LINE>MouseMotionListener mouseMotionListener = BasicComboBoxUIHacking.getMouseMotionListener(myDelegateUI);<NEW_LINE>if (mouseMotionListener != null) {<NEW_LINE>c.removeMouseMotionListener(mouseMotionListener);<NEW_LINE>BasicComboBoxUIHacking.setMouseMotionListener(myDelegateUI, new MouseMotionAdapter() {<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>BasicComboBoxUIHacking.setPopup(myDelegateUI, new HackComboBoxPopup(myButton));<NEW_LINE>myMouseListener = new MouseAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mouseClicked(MouseEvent e) {<NEW_LINE>myButton.showPopup0();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>c.addMouseListener(myMouseListener);<NEW_LINE>myDelegateUI.configureArrowButton();<NEW_LINE>} | o = BasicComboBoxUIHacking.getPopup(myDelegateUI); |
424,701 | protected void processMaxIdleBackups() {<NEW_LINE>if (!isStarted() || maxIdleBackup < 0)<NEW_LINE>return;<NEW_LINE>final List<Session> sessions = findSessions();<NEW_LINE>final long timeNow = System.currentTimeMillis();<NEW_LINE>// Back up all sessions idle longer than maxIdleBackup<NEW_LINE>if (maxIdleBackup >= 0) {<NEW_LINE>for (Session session1 : sessions) {<NEW_LINE>StandardSession session = (StandardSession) session1;<NEW_LINE>if (!session.isValid())<NEW_LINE>continue;<NEW_LINE>// Truncate, do not round up<NEW_LINE>int // Truncate, do not round up<NEW_LINE>timeIdle = (int) ((timeNow - session.getLastAccessedTime()) / 1000L);<NEW_LINE>if (timeIdle > maxIdleBackup) {<NEW_LINE>// if session cannot be background locked then skip it<NEW_LINE>if (session.lockBackground()) {<NEW_LINE>if (log.isLoggable(Level.FINE)) {<NEW_LINE>log.log(Level.FINE, LogFacade.BACKUP_SESSION_TO_STORE, new Object[] { session<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>writeSession(session);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// This is logged in writeSession()<NEW_LINE>} finally {<NEW_LINE>session.unlockBackground();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getIdInternal(), timeIdle }); |
1,398,672 | final BatchEnableStandardsResult executeBatchEnableStandards(BatchEnableStandardsRequest batchEnableStandardsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(batchEnableStandardsRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<BatchEnableStandardsRequest> request = null;<NEW_LINE>Response<BatchEnableStandardsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new BatchEnableStandardsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchEnableStandardsRequest));<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, "SecurityHub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchEnableStandards");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<BatchEnableStandardsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchEnableStandardsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
106,976 | protected void doPost(HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>try {<NEW_LINE>PostParams params = PostParams.getPostParams(request);<NEW_LINE>boolean visible = params.isVisible();<NEW_LINE>String input = params.getParams();<NEW_LINE>if (visible) {<NEW_LINE>JSONObject jsonObject = JSONObject.parseObject(input);<NEW_LINE>String value = jsonObject.getString(S_VALUE);<NEW_LINE>jsonObject.put(S_VALUE, Util.getHexAddress(value));<NEW_LINE>input = jsonObject.toJSONString();<NEW_LINE>}<NEW_LINE>BytesMessage.Builder build = BytesMessage.newBuilder();<NEW_LINE>JsonFormat.merge(input, build, visible);<NEW_LINE>SmartContract smartContract = wallet.getContract(build.build());<NEW_LINE>if (smartContract == null) {<NEW_LINE>response.<MASK><NEW_LINE>} else {<NEW_LINE>JSONObject jsonSmartContract = JSONObject.parseObject(JsonFormat.printToString(smartContract, visible));<NEW_LINE>response.getWriter().println(jsonSmartContract.toJSONString());<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Util.processError(e, response);<NEW_LINE>}<NEW_LINE>} | getWriter().println("{}"); |
990,012 | /* Build call for throttlingPoliciesAdvancedPolicyIdGet */<NEW_LINE>private com.squareup.okhttp.Call throttlingPoliciesAdvancedPolicyIdGetCall(String policyId, String ifNoneMatch, String ifModifiedSince, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/throttling/policies/advanced/{policyId}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "policyId" + "\\}", apiClient.escapeString(policyId.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>if (ifNoneMatch != null)<NEW_LINE>localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));<NEW_LINE>if (ifModifiedSince != null)<NEW_LINE>localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince));<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null)<NEW_LINE><MASK><NEW_LINE>final String[] localVarContentTypes = { "application/json" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>if (progressListener != null) {<NEW_LINE>apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {<NEW_LINE>com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());<NEW_LINE>return originalResponse.newBuilder().body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);<NEW_LINE>} | localVarHeaderParams.put("Accept", localVarAccept); |
1,742,530 | private void awaitMappingOnAllMembers(String name, IdentifiedDataSerializable metadata) {<NEW_LINE>Data keyData = nodeEngine.getSerializationService().toData(name);<NEW_LINE>int keyPartitionId = nodeEngine.getPartitionService().getPartitionId(keyData);<NEW_LINE>OperationService operationService = nodeEngine.getOperationService();<NEW_LINE>Collection<Address> memberAddresses = getMemberAddresses();<NEW_LINE>for (int i = 0; i < MAX_CHECK_ATTEMPTS && !memberAddresses.isEmpty(); i++) {<NEW_LINE>List<CompletableFuture<Address>> futures = memberAddresses.stream().map(memberAddress -> {<NEW_LINE>Operation operation = new GetOperation(CATALOG_MAP_NAME, keyData).setPartitionId(keyPartitionId).setValidateTarget(false);<NEW_LINE>return operationService.createInvocationBuilder(ReplicatedMapService.SERVICE_NAME, operation, memberAddress).setTryCount(1).invoke().toCompletableFuture().thenApply(result -> Objects.equals(metadata, result) ? memberAddress : null);<NEW_LINE>}).collect(toList());<NEW_LINE>for (CompletableFuture<Address> future : futures) {<NEW_LINE>try {<NEW_LINE>memberAddresses.remove(future.join());<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.warning("Error occurred while trying to fetch mapping: " + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!memberAddresses.isEmpty()) {<NEW_LINE>try {<NEW_LINE>Thread.sleep(SLEEP_MILLIS);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
1,697,222 | private ShorthandProjectionSegment createShorthandProjection(final QualifiedShorthandContext shorthand) {<NEW_LINE>ShorthandProjectionSegment result = new ShorthandProjectionSegment(shorthand.getStart().getStartIndex(), shorthand.getStop().getStopIndex());<NEW_LINE>IdentifierContext identifier = shorthand.identifier().get(shorthand.identifier().size() - 1);<NEW_LINE>OwnerSegment owner = new OwnerSegment(identifier.getStart().getStartIndex(), identifier.getStop().getStopIndex(), new IdentifierValue(identifier.getText()));<NEW_LINE>result.setOwner(owner);<NEW_LINE>if (shorthand.identifier().size() > 1) {<NEW_LINE>IdentifierContext schemaIdentifier = shorthand.identifier().get(0);<NEW_LINE>owner.setOwner(new OwnerSegment(schemaIdentifier.getStart().getStartIndex(), schemaIdentifier.getStop().getStopIndex(), new IdentifierValue(<MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | schemaIdentifier.getText()))); |
634,275 | public boolean apply(Game game, Ability source) {<NEW_LINE>Permanent permanent = game.getPermanentOrLKIBattlefield(id);<NEW_LINE>Player targetPlayer = null;<NEW_LINE>if (permanent != null) {<NEW_LINE>targetPlayer = game.<MASK><NEW_LINE>}<NEW_LINE>if (targetPlayer != null && permanent != null && (permanent.isLegendary())) {<NEW_LINE>FilterControlledPermanent filter = new FilterControlledLandPermanent("land to sacrifice");<NEW_LINE>filter.add(new ControllerIdPredicate(targetPlayer.getId()));<NEW_LINE>TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);<NEW_LINE>if (target.canChoose(targetPlayer.getId(), source, game)) {<NEW_LINE>targetPlayer.chooseTarget(Outcome.Sacrifice, target, source, game);<NEW_LINE>Permanent land = game.getPermanent(target.getFirstTarget());<NEW_LINE>if (land != null) {<NEW_LINE>land.sacrifice(source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getPlayer(permanent.getControllerId()); |
594,987 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>StackObject spell = null;<NEW_LINE>for (StackObject object : game.getStack()) {<NEW_LINE>if (object instanceof Spell && object.getSourceId().equals(source.getSourceId())) {<NEW_LINE>spell = object;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (spell != null) {<NEW_LINE>boolean drawCards = true;<NEW_LINE>for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null && player.chooseUse(Outcome.Detriment, "Have " + spell.getLogName() + " deal 5 damage to you?", source, game)) {<NEW_LINE>drawCards = false;<NEW_LINE>player.damage(5, source.getSourceId(), source, game);<NEW_LINE>game.informPlayers(player.getLogName() + " has " + spell.getLogName() + " deal 5 to them");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (drawCards) {<NEW_LINE>UUID targetPlayer = getTargetPointer().getFirst(game, source);<NEW_LINE>if (targetPlayer != null) {<NEW_LINE>Player player = game.getPlayer(targetPlayer);<NEW_LINE>if (player != null) {<NEW_LINE>player.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return drawCards;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | drawCards(3, source, game); |
475,918 | private void assignSelectedToCategory(final Core core, final Category category) {<NEW_LINE>tv.runForSelectedRows(new TableGroupRowRunner() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(TableRowCore row) {<NEW_LINE>TRHostTorrent tr_torrent = (TRHostTorrent) row.getDataSource(true);<NEW_LINE>final <MASK><NEW_LINE>DownloadManager dm = core.getGlobalManager().getDownloadManager(torrent);<NEW_LINE>if (dm != null) {<NEW_LINE>dm.getDownloadState().setCategory(category);<NEW_LINE>} else {<NEW_LINE>String cat_str;<NEW_LINE>if (category == null) {<NEW_LINE>cat_str = null;<NEW_LINE>} else if (category == CategoryManager.getCategory(Category.TYPE_UNCATEGORIZED)) {<NEW_LINE>cat_str = null;<NEW_LINE>} else {<NEW_LINE>cat_str = category.getName();<NEW_LINE>}<NEW_LINE>// bit of a hack-alert here<NEW_LINE>TorrentUtils.setPluginStringProperty(torrent, "azcoreplugins.category", cat_str);<NEW_LINE>try {<NEW_LINE>TorrentUtils.writeToFile(torrent);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Debug.printStackTrace(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | TOTorrent torrent = tr_torrent.getTorrent(); |
715,189 | public void drawPatch(Canvas canvas) {<NEW_LINE>canvas.save();<NEW_LINE>Point[] cubics = new Point[] { new Point(30, 10), new Point(40, 20), new Point(50, 10), new Point(70, 30), /* new Point(70, 30), */<NEW_LINE>new Point(60, 40), new Point(70, 50), new Point(50, 70), /* new Point(50, 70), */<NEW_LINE>new Point(40, 60), new Point(30, 70), new Point(10, 50), /* new Point(10, 50), */<NEW_LINE>new Point(20, 40), new Point(10, 30) /* new Point(30, 10) */<NEW_LINE>};<NEW_LINE>int[] colors = new int[] { 0xFFFF0000, 0xFF0000FF, 0xFFFFFF00, 0xFF00FFFF };<NEW_LINE>try (var paint = new Paint();<NEW_LINE>var shader = Shader.makeLinearGradient(0, 0, 70, 0, new int[] { 0xFF277da1, 0xFFffba08 })) {<NEW_LINE>canvas.drawPatch(cubics, colors, paint);<NEW_LINE>canvas.translate(80, 0);<NEW_LINE>paint.setShader(shader);<NEW_LINE>canvas.drawPatch(cubics, colors, paint);<NEW_LINE>canvas.translate(80, 0);<NEW_LINE>canvas.drawPatch(cubics, colors, <MASK><NEW_LINE>canvas.translate(80, 0);<NEW_LINE>colors = new int[] { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };<NEW_LINE>canvas.drawPatch(cubics, colors, paint);<NEW_LINE>canvas.translate(80, 0);<NEW_LINE>Point[] texCoords = new Point[] { new Point(0, 0), new Point(70, 0), new Point(70, 70), new Point(0, 70) };<NEW_LINE>canvas.drawPatch(cubics, colors, texCoords, paint);<NEW_LINE>canvas.translate(80, 0);<NEW_LINE>}<NEW_LINE>canvas.restore();<NEW_LINE>canvas.translate(0, 80);<NEW_LINE>} | null, BlendMode.SRC_OVER, paint); |
335,679 | private void createProtectedFieldGetterSetter(FieldMember field) {<NEW_LINE>String descriptor = field.descriptor;<NEW_LINE>String name = field.name;<NEW_LINE>ReturnType rt = ReturnType.getReturnType(descriptor);<NEW_LINE>if (field.isStatic()) {<NEW_LINE>MethodVisitor mv = cw.visitMethod(Modifier.PUBLIC | Modifier.STATIC, Utils.getProtectedFieldGetterName(name), "()" + descriptor, null, null);<NEW_LINE>mv.visitFieldInsn(GETSTATIC, slashedname, name, descriptor);<NEW_LINE>Utils.addCorrectReturnInstruction(mv, rt, false);<NEW_LINE>mv.visitMaxs(rt.isDoubleSlot() ? 2 : 1, 0);<NEW_LINE>mv.visitEnd();<NEW_LINE>mv = cw.visitMethod(Modifier.PUBLIC | Modifier.STATIC, Utils.getProtectedFieldSetterName(name), "(" + descriptor + ")V", null, null);<NEW_LINE>insertCorrectLoad(mv, rt, 0);<NEW_LINE>mv.visitFieldInsn(PUTSTATIC, slashedname, name, descriptor);<NEW_LINE>mv.visitInsn(RETURN);<NEW_LINE>mv.visitMaxs(rt.isDoubleSlot() ? 2 : 1, 1);<NEW_LINE>mv.visitEnd();<NEW_LINE>} else {<NEW_LINE>MethodVisitor mv = cw.visitMethod(Modifier.PUBLIC, Utils.getProtectedFieldGetterName(name), "()" + descriptor, null, null);<NEW_LINE><MASK><NEW_LINE>mv.visitFieldInsn(GETFIELD, slashedname, name, descriptor);<NEW_LINE>Utils.addCorrectReturnInstruction(mv, rt, false);<NEW_LINE>mv.visitMaxs(rt.isDoubleSlot() ? 2 : 1, 1);<NEW_LINE>mv.visitEnd();<NEW_LINE>mv = cw.visitMethod(Modifier.PUBLIC, Utils.getProtectedFieldSetterName(name), "(" + descriptor + ")V", null, null);<NEW_LINE>mv.visitVarInsn(ALOAD, 0);<NEW_LINE>insertCorrectLoad(mv, rt, 1);<NEW_LINE>mv.visitFieldInsn(PUTFIELD, slashedname, name, descriptor);<NEW_LINE>mv.visitInsn(RETURN);<NEW_LINE>mv.visitMaxs(rt.isDoubleSlot() ? 3 : 2, 2);<NEW_LINE>mv.visitEnd();<NEW_LINE>}<NEW_LINE>} | mv.visitVarInsn(ALOAD, 0); |
682,248 | public <T> ListenableFuture<T> submitListenableFuture(String schemaName, String traceId, int bucketIndex, Callable<T> task, CpuCollector cpuCollector) {<NEW_LINE>if (task == null) {<NEW_LINE>throw new NullPointerException();<NEW_LINE>}<NEW_LINE>if (bucketIndex < 0) {<NEW_LINE>bucketIndex = hashBucketIndex(schemaName, traceId);<NEW_LINE>} else {<NEW_LINE>bucketIndex = bucketIndex % numBuckets;<NEW_LINE>}<NEW_LINE>AppStats stat = appStats.getUnchecked(schemaName);<NEW_LINE>stat.taskCount.incrementAndGet();<NEW_LINE>AppStats.nodeTaskCount.incrementAndGet();<NEW_LINE>try {<NEW_LINE>if (executorBuckets != null) {<NEW_LINE>return MoreExecutors.listeningDecorator(executorBuckets[bucketIndex]).submit(new ListenCallableAdapter(schemaName<MASK><NEW_LINE>} else {<NEW_LINE>return MoreExecutors.listeningDecorator(executor).submit(new ListenCallableAdapter(schemaName, task, traceId, cpuCollector));<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>stat.taskCount.decrementAndGet();<NEW_LINE>AppStats.nodeTaskCount.decrementAndGet();<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>} | , task, traceId, cpuCollector)); |
76,507 | public AbstractContainerMenu createMenu(int id, Inventory playerInventory, Player player) {<NEW_LINE>if (this.lootTable != null) {<NEW_LINE>LootTable loottable = this.level.getServer().getLootTables().get(this.lootTable);<NEW_LINE>this.lootTable = null;<NEW_LINE>LootContext.Builder contextBuilder = new LootContext.Builder((ServerLevel) this.level);<NEW_LINE>contextBuilder.withParameter(LootContextParams.ORIGIN<MASK><NEW_LINE>if (player != null)<NEW_LINE>contextBuilder.withLuck(player.getLuck());<NEW_LINE>LootContext context = contextBuilder.create(LootContextParamSets.CHEST);<NEW_LINE>Random rand = new Random();<NEW_LINE>List<ItemStack> list = loottable.getRandomItems(context);<NEW_LINE>List<Integer> listSlots = Lists.newArrayList();<NEW_LINE>for (int i = 0; i < inventory.size(); i++) if (inventory.get(i).isEmpty())<NEW_LINE>listSlots.add(i);<NEW_LINE>Collections.shuffle(listSlots, rand);<NEW_LINE>if (!listSlots.isEmpty()) {<NEW_LINE>Utils.shuffleLootItems(list, listSlots.size(), rand);<NEW_LINE>for (ItemStack itemstack : list) {<NEW_LINE>int slot = listSlots.remove(listSlots.size() - 1);<NEW_LINE>inventory.set(slot, itemstack);<NEW_LINE>}<NEW_LINE>this.setChanged();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return IInteractionObjectIE.super.createMenu(id, playerInventory, player);<NEW_LINE>} | , Vec3.atCenterOf(worldPosition)); |
1,809,654 | public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException {<NEW_LINE>log.info("removing deployment-group: name={}", name);<NEW_LINE>final ZooKeeperClient client = provider.get("removeDeploymentGroup");<NEW_LINE>try {<NEW_LINE>client.ensurePath(Paths.configDeploymentGroups());<NEW_LINE>client.ensurePath(Paths.statusDeploymentGroups());<NEW_LINE>client.ensurePath(Paths.statusDeploymentGroupTasks());<NEW_LINE>final List<ZooKeeperOperation> operations = Lists.newArrayList();<NEW_LINE>final List<String> paths = ImmutableList.of(Paths.configDeploymentGroup(name), Paths.statusDeploymentGroup(name), Paths.statusDeploymentGroupHosts(name), Paths.statusDeploymentGroupRemovedHosts(name), Paths.statusDeploymentGroupTasks(name));<NEW_LINE>// For each deployment group path:<NEW_LINE>//<NEW_LINE>// * If it exists: delete it.<NEW_LINE>// * If it doesn't exist, add and delete it in the same transaction. This is a round-about<NEW_LINE>// way of ensuring that it wasn't created when we commit the transaction.<NEW_LINE>//<NEW_LINE>// This is particularly important for /status/deployment-group-tasks/[group-name], which<NEW_LINE>// might exist if a rolling-update is in progress. To avoid inconsistent state we make sure<NEW_LINE>// it's deleted if it does exist.<NEW_LINE>//<NEW_LINE>// Having /status/deployment-group-tasks/[group-name] for removed groups around will cause<NEW_LINE>// DGs to become slower and spam logs with errors so we want to avoid it.<NEW_LINE>for (final String path : paths) {<NEW_LINE>if (client.exists(path) == null) {<NEW_LINE>operations.add(create(path));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (final String path : Lists.reverse(paths)) {<NEW_LINE>operations.add(delete(path));<NEW_LINE>}<NEW_LINE>client.transaction(operations);<NEW_LINE>} catch (final NoNodeException e) {<NEW_LINE>throw new DeploymentGroupDoesNotExistException(name);<NEW_LINE>} catch (final KeeperException e) {<NEW_LINE>throw new HeliosRuntimeException(<MASK><NEW_LINE>}<NEW_LINE>} | "removing deployment-group " + name + " failed", e); |
1,412,401 | public SegmentCommitInfo clone() {<NEW_LINE>SegmentCommitInfo other = new SegmentCommitInfo(info, delCount, softDelCount, delGen, fieldInfosGen, docValuesGen, getId());<NEW_LINE>// Not clear that we need to carry over nextWriteDelGen<NEW_LINE>// (i.e. do we ever clone after a failed write and<NEW_LINE>// before the next successful write?), but just do it to<NEW_LINE>// be safe:<NEW_LINE>other.nextWriteDelGen = nextWriteDelGen;<NEW_LINE>other.nextWriteFieldInfosGen = nextWriteFieldInfosGen;<NEW_LINE>other.nextWriteDocValuesGen = nextWriteDocValuesGen;<NEW_LINE>// deep clone<NEW_LINE>for (Entry<Integer, Set<String>> e : dvUpdatesFiles.entrySet()) {<NEW_LINE>other.dvUpdatesFiles.put(e.getKey(), new HashSet<>(e.getValue()));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>return other;<NEW_LINE>} | other.fieldInfosFiles.addAll(fieldInfosFiles); |
1,656,760 | private boolean populate() {<NEW_LINE>if (parts == null) {<NEW_LINE>List<GuidePart> allText = new ArrayList<>();<NEW_LINE>List<PageLink> <MASK><NEW_LINE>// Depth first search<NEW_LINE>Deque<IContentsNode> queue = new ArrayDeque<>();<NEW_LINE>ArrayUtil.addAllReversed(queue, node.getVisibleChildren());<NEW_LINE>while (!queue.isEmpty()) {<NEW_LINE>IContentsNode next = queue.removeLast();<NEW_LINE>GuidePart part = next.createGuidePart(gui);<NEW_LINE>if (fontRenderer != null) {<NEW_LINE>part.setFontRenderer(fontRenderer);<NEW_LINE>}<NEW_LINE>allText.add(part);<NEW_LINE>if (next instanceof PageLink) {<NEW_LINE>allLinks.add((PageLink) next);<NEW_LINE>} else {<NEW_LINE>allLinks.add(null);<NEW_LINE>}<NEW_LINE>ArrayUtil.addAllReversed(queue, next.getVisibleChildren());<NEW_LINE>}<NEW_LINE>parts = allText.toArray(new GuidePart[0]);<NEW_LINE>links = allLinks.toArray(new PageLink[0]);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | allLinks = new ArrayList<>(); |
1,734,630 | public void outputHeader(String message) throws DatabaseException {<NEW_LINE>Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class<MASK><NEW_LINE>executor.comment("*********************************************************************");<NEW_LINE>executor.comment(message);<NEW_LINE>executor.comment("*********************************************************************");<NEW_LINE>executor.comment("Change Log: " + changeLogFile);<NEW_LINE>executor.comment("Ran at: " + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date()));<NEW_LINE>DatabaseConnection connection = getDatabase().getConnection();<NEW_LINE>if (connection != null) {<NEW_LINE>executor.comment("Against: " + connection.getConnectionUserName() + "@" + connection.getURL());<NEW_LINE>}<NEW_LINE>executor.comment("Liquibase version: " + LiquibaseUtil.getBuildVersionInfo());<NEW_LINE>executor.comment("*********************************************************************" + StreamUtil.getLineSeparator());<NEW_LINE>if ((database instanceof MSSQLDatabase) && (database.getDefaultCatalogName() != null)) {<NEW_LINE>executor.execute(new RawSqlStatement("USE " + database.escapeObjectName(database.getDefaultCatalogName(), Catalog.class) + ";"));<NEW_LINE>}<NEW_LINE>} | ).getExecutor("logging", database); |
987,561 | public static FindVersionTestsResponse unmarshall(FindVersionTestsResponse findVersionTestsResponse, UnmarshallerContext _ctx) {<NEW_LINE>findVersionTestsResponse.setRequestId(_ctx.stringValue("FindVersionTestsResponse.RequestId"));<NEW_LINE>VersionTestList versionTestList = new VersionTestList();<NEW_LINE>versionTestList.setTotalCount(_ctx.integerValue("FindVersionTestsResponse.VersionTestList.TotalCount"));<NEW_LINE>List<ItemsItem> items = new ArrayList<ItemsItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("FindVersionTestsResponse.VersionTestList.Items.Length"); i++) {<NEW_LINE>ItemsItem itemsItem = new ItemsItem();<NEW_LINE>itemsItem.setId(_ctx.longValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].Id"));<NEW_LINE>itemsItem.setVersionId(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].VersionId"));<NEW_LINE>itemsItem.setVersionType(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].VersionType"));<NEW_LINE>itemsItem.setName(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].Name"));<NEW_LINE>itemsItem.setDescription(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].Description"));<NEW_LINE>itemsItem.setGmtCreate(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].GmtCreate"));<NEW_LINE>itemsItem.setGmtModify(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].GmtModify"));<NEW_LINE>itemsItem.setDeviceGroupId(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].DeviceGroupId"));<NEW_LINE>itemsItem.setDeviceGroupName(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].DeviceGroupName"));<NEW_LINE>itemsItem.setSucceededCount(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].SucceededCount"));<NEW_LINE>itemsItem.setFailedCount(_ctx.stringValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].FailedCount"));<NEW_LINE>itemsItem.setSkippedCount(_ctx.stringValue<MASK><NEW_LINE>itemsItem.setGmtCreateTimestamp(_ctx.longValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].GmtCreateTimestamp"));<NEW_LINE>itemsItem.setGmtModifyTimestamp(_ctx.longValue("FindVersionTestsResponse.VersionTestList.Items[" + i + "].GmtModifyTimestamp"));<NEW_LINE>items.add(itemsItem);<NEW_LINE>}<NEW_LINE>versionTestList.setItems(items);<NEW_LINE>findVersionTestsResponse.setVersionTestList(versionTestList);<NEW_LINE>return findVersionTestsResponse;<NEW_LINE>} | ("FindVersionTestsResponse.VersionTestList.Items[" + i + "].SkippedCount")); |
701,593 | final DeleteAppInstanceAdminResult executeDeleteAppInstanceAdmin(DeleteAppInstanceAdminRequest deleteAppInstanceAdminRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAppInstanceAdminRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteAppInstanceAdminRequest> request = null;<NEW_LINE>Response<DeleteAppInstanceAdminResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteAppInstanceAdminRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAppInstanceAdminRequest));<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, "Chime SDK Identity");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteAppInstanceAdminResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAppInstanceAdminResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAppInstanceAdmin"); |
914,276 | final DescribeJobResult executeDescribeJob(DescribeJobRequest describeJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeJobRequest> request = null;<NEW_LINE>Response<DescribeJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeJobRequestMarshaller().marshall(super.beforeMarshalling(describeJobRequest));<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, "S3 Control");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>ValidationUtils.assertStringNotEmpty(describeJobRequest.getAccountId(), "AccountId");<NEW_LINE>HostnameValidator.validateHostnameCompliant(describeJobRequest.getAccountId(), "AccountId", "describeJobRequest");<NEW_LINE>String hostPrefix = "{AccountId}.";<NEW_LINE>String resolvedHostPrefix = String.format("%s.", describeJobRequest.getAccountId());<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeJobResult> responseHandler = new com.amazonaws.services.s3control.internal.S3ControlStaxResponseHandler<DescribeJobResult>(new DescribeJobResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,781,009 | public RuleResult execute(Map<String, String> ruleParam, Map<String, String> resourceAttributes) {<NEW_LINE>logger.debug("========CloudfrontAuthorizedHTMLContentDistributionRule started=========");<NEW_LINE>String cloudFrontResourceID = <MASK><NEW_LINE>MDC.put("executionId", ruleParam.get("executionId"));<NEW_LINE>MDC.put("ruleId", ruleParam.get(PacmanSdkConstants.RULE_ID));<NEW_LINE>boolean isWebsiteHosted = false;<NEW_LINE>String domainName = resourceAttributes.get("domainName");<NEW_LINE>String rootObject = resourceAttributes.get("deafultRootObject");<NEW_LINE>String enabled = resourceAttributes.get("enabled");<NEW_LINE>if (enabled != null && enabled.equalsIgnoreCase("true")) {<NEW_LINE>List<String> urlListToCheck = new ArrayList<>();<NEW_LINE>if (rootObject != null && rootObject.contains("htm")) {<NEW_LINE>urlListToCheck.add(HTTP_PROTOCOL_PREFIX + domainName + SLASH + rootObject);<NEW_LINE>}<NEW_LINE>urlListToCheck.add(HTTP_PROTOCOL_PREFIX + domainName);<NEW_LINE>urlListToCheck.add(HTTP_PROTOCOL_PREFIX + domainName + SLASH + INDEX_HTML);<NEW_LINE>urlListToCheck.add(HTTP_PROTOCOL_PREFIX + domainName + SLASH + INDEX_HTM);<NEW_LINE>for (String url : urlListToCheck) {<NEW_LINE>try {<NEW_LINE>isWebsiteHosted = isWebSiteHosted(url);<NEW_LINE>if (isWebsiteHosted) {<NEW_LINE>String description = "CloudFront instance: " + cloudFrontResourceID + " is unauthorized for html content distribution. Content hosted on url : " + url;<NEW_LINE>logger.debug(description);<NEW_LINE>return new RuleResult(PacmanSdkConstants.STATUS_FAILURE, PacmanRuleConstants.FAILURE_MESSAGE, PacmanUtils.createAnnotation("", ruleParam, description, PacmanSdkConstants.SEV_HIGH, PacmanSdkConstants.SECURITY));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("Exception getting from url :[{}],[{}] ", url, e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new RuleResult(PacmanSdkConstants.STATUS_SUCCESS, PacmanRuleConstants.SUCCESS_MESSAGE);<NEW_LINE>} | resourceAttributes.get(PacmanSdkConstants.RESOURCE_ID); |
1,699,524 | public void sessionPut(HttpServletRequest request, HttpServletResponse response) throws Throwable {<NEW_LINE>boolean createSession = Boolean.parseBoolean(request.getParameter("createSession"));<NEW_LINE>HttpSession session = request.getSession(createSession);<NEW_LINE>if (createSession)<NEW_LINE>System.out.println(<MASK><NEW_LINE>else<NEW_LINE>System.out.println("Re-using existing session with sessionID=" + session == null ? null : session.getId());<NEW_LINE>String key = request.getParameter("key");<NEW_LINE>String value = request.getParameter("value");<NEW_LINE>String type = request.getParameter("type");<NEW_LINE>Object val = toType(type, value);<NEW_LINE>session.setAttribute(key, val);<NEW_LINE>String sessionID = session.getId();<NEW_LINE>System.out.println("Put entry: " + key + '=' + value + " into sessionID=" + sessionID);<NEW_LINE>response.getWriter().write("session id: [" + sessionID + "]");<NEW_LINE>// Normally, session postinvoke writes the updates after the servlet returns control to the test logic.<NEW_LINE>// This can be a problem if the test logic proceeds to execute further test logic based on the expectation<NEW_LINE>// that updates made under the previous servlet request have gone into effect. Tests that are vulnerable<NEW_LINE>// to this can use the sync=true parameter to force update to be made before servlet returns.<NEW_LINE>boolean sync = Boolean.parseBoolean(request.getParameter("sync"));<NEW_LINE>if (sync)<NEW_LINE>((IBMSession) session).sync();<NEW_LINE>} | "Created a new session with sessionID=" + session.getId()); |
1,402,305 | public static void toJSON(OutputWriter jsonWriter, MaterialConfig materialConfig) {<NEW_LINE>if (!materialConfig.errors().isEmpty()) {<NEW_LINE>jsonWriter.addChild("errors", errorWriter -> {<NEW_LINE>HashMap<String, String> errorMapping = new HashMap<>();<NEW_LINE><MASK><NEW_LINE>errorMapping.put("folder", "destination");<NEW_LINE>errorMapping.put("autoUpdate", "auto_update");<NEW_LINE>errorMapping.put("filterAsString", "filter");<NEW_LINE>errorMapping.put("checkexternals", "check_externals");<NEW_LINE>errorMapping.put("serverAndPort", "port");<NEW_LINE>errorMapping.put("useTickets", "use_tickets");<NEW_LINE>errorMapping.put("pipelineName", "pipeline");<NEW_LINE>errorMapping.put("stageName", "stage");<NEW_LINE>errorMapping.put("pipelineStageName", "pipeline");<NEW_LINE>errorMapping.put("packageId", "ref");<NEW_LINE>errorMapping.put("scmId", "ref");<NEW_LINE>errorMapping.put("encryptedPassword", "encrypted_password");<NEW_LINE>new ErrorGetter(errorMapping).toJSON(errorWriter, materialConfig);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>stream(Materials.values()).filter(material -> material.type == materialConfig.getClass()).findFirst().ifPresent(material -> {<NEW_LINE>jsonWriter.add("type", material.name().toLowerCase());<NEW_LINE>jsonWriter.addChild("attributes", attributeWriter -> material.representer.toJSON(attributeWriter, materialConfig));<NEW_LINE>});<NEW_LINE>} | errorMapping.put("materialName", "name"); |
1,626,035 | private void run(Console console, Path checkoutDir, Iterable<String> args) throws IOException, ValidationException {<NEW_LINE>ImmutableList.Builder<String> argBuilder = new Builder<String>().add(buildifierOptions.buildifierBin);<NEW_LINE>if (type != null) {<NEW_LINE>argBuilder.add("-type=" + type);<NEW_LINE>}<NEW_LINE>if (lintMode != LintMode.OFF) {<NEW_LINE>argBuilder.add("-lint=" + lintMode.toString().toLowerCase());<NEW_LINE>if (!warnings.isEmpty()) {<NEW_LINE>argBuilder.add("-warnings=" + Joiner.on(",").join(warnings));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String[] argv = argBuilder.addAll(args).build().<MASK><NEW_LINE>try {<NEW_LINE>Command cmd = new Command(argv, /*environmentVariables*/<NEW_LINE>null, checkoutDir.toFile());<NEW_LINE>CommandOutputWithStatus output = generalOptions.newCommandRunner(cmd).withVerbose(generalOptions.isVerbose()).execute();<NEW_LINE>if (!output.getStdout().isEmpty()) {<NEW_LINE>logger.atInfo().log("buildifier stdout: %s", output.getStdout());<NEW_LINE>}<NEW_LINE>if (!output.getStderr().isEmpty()) {<NEW_LINE>logger.atInfo().log("buildifier stderr: %s", output.getStderr());<NEW_LINE>}<NEW_LINE>} catch (BadExitStatusWithOutputException e) {<NEW_LINE>log(console, e.getOutput());<NEW_LINE>checkCondition(e.getResult().getTerminationStatus().getExitCode() != 1, "Build file(s) couldn't be formatted because there was a syntax error");<NEW_LINE>throw new IOException("Failed to execute buildifier with args: " + args, e);<NEW_LINE>} catch (CommandException e) {<NEW_LINE>throw new IOException("Failed to execute buildifier with args: " + args, e);<NEW_LINE>}<NEW_LINE>} | toArray(new String[0]); |
764,077 | public static List<String> write(String path, List<String> entities, boolean dynamicFlag) throws Exception {<NEW_LINE>List<String> names = new ArrayList<>();<NEW_LINE>String name = "";<NEW_LINE>try {<NEW_LINE>names.addAll((List<String>) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES));<NEW_LINE>names = ListTools.includesExcludesWildcard(names, entities, null);<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>List<String> dyClasses = new ArrayList<>();<NEW_LINE>for (String className : names) {<NEW_LINE>name = className;<NEW_LINE>Class<? extends JpaObject> clazz = (Class<JpaObject>) Class.forName(className);<NEW_LINE>Element unit = persistence.addElement("persistence-unit");<NEW_LINE>unit.addAttribute("name", className);<NEW_LINE>unit.addAttribute("transaction-type", "RESOURCE_LOCAL");<NEW_LINE>Element provider = unit.addElement("provider");<NEW_LINE>provider.addText(PersistenceProviderImpl.class.getName());<NEW_LINE>for (Class<?> o : JpaObjectTools.scanMappedSuperclass(clazz)) {<NEW_LINE>Element mapped_element = unit.addElement("class");<NEW_LINE>mapped_element.addText(o.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dynamicFlag) {<NEW_LINE>for (String className : names) {<NEW_LINE>if (className.startsWith(DynamicEntity.CLASS_PACKAGE)) {<NEW_LINE>dyClasses.add(className);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!dyClasses.isEmpty()) {<NEW_LINE>String dyClassName = DynamicBaseEntity.class.getName();<NEW_LINE>names.add(dyClassName);<NEW_LINE>Element unit = persistence.addElement("persistence-unit");<NEW_LINE>unit.addAttribute("name", dyClassName);<NEW_LINE>unit.addAttribute("transaction-type", "RESOURCE_LOCAL");<NEW_LINE>Element provider = unit.addElement("provider");<NEW_LINE>provider.addText(PersistenceProviderImpl.class.getName());<NEW_LINE>for (String dyClass : dyClasses) {<NEW_LINE>Element mapped_element = unit.addElement("class");<NEW_LINE>mapped_element.addText(dyClass);<NEW_LINE>}<NEW_LINE>for (Class<?> o : JpaObjectTools.scanMappedSuperclass(DynamicBaseEntity.class)) {<NEW_LINE>if (!o.getName().equals(DynamicBaseEntity.class.getName())) {<NEW_LINE>Element <MASK><NEW_LINE>mapped_element.addText(o.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>OutputFormat format = OutputFormat.createPrettyPrint();<NEW_LINE>format.setEncoding("UTF-8");<NEW_LINE>File file = new File(path);<NEW_LINE>FileUtils.touch(file);<NEW_LINE>XMLWriter writer = new XMLWriter(new FileWriter(file), format);<NEW_LINE>writer.write(document);<NEW_LINE>writer.close();<NEW_LINE>return names;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new Exception("write error.className:" + name, e);<NEW_LINE>}<NEW_LINE>} | mapped_element = unit.addElement("class"); |
1,168,461 | public JavaScriptNode[] createArgumentNodes(JSContext context) {<NEW_LINE>NodeFactory <MASK><NEW_LINE>int totalArgs = getTotalArgumentCount();<NEW_LINE>JavaScriptNode[] callArgs = totalArgs == 0 ? EMPTY_NODE_ARRAY : new JavaScriptNode[totalArgs];<NEW_LINE>int index = 0;<NEW_LINE>if (hasThis) {<NEW_LINE>callArgs[index++] = factory.createAccessThis();<NEW_LINE>}<NEW_LINE>if (hasFunction) {<NEW_LINE>callArgs[index++] = factory.createAccessCallee(0);<NEW_LINE>}<NEW_LINE>int argIndex = 0;<NEW_LINE>int size = varArgs ? totalArgs - 1 : totalArgs;<NEW_LINE>for (int i = index; i < size; i++) {<NEW_LINE>callArgs[i] = factory.createAccessArgument(argIndex++);<NEW_LINE>}<NEW_LINE>if (varArgs) {<NEW_LINE>callArgs[size] = factory.createAccessVarArgs(argIndex++);<NEW_LINE>}<NEW_LINE>return callArgs;<NEW_LINE>} | factory = NodeFactory.getInstance(context); |
1,119,808 | public void marshall(TransferDomainRequest transferDomainRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (transferDomainRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getDomainName(), DOMAINNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getIdnLangCode(), IDNLANGCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getDurationInYears(), DURATIONINYEARS_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getNameservers(), NAMESERVERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getAuthCode(), AUTHCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getAutoRenew(), AUTORENEW_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getRegistrantContact(), REGISTRANTCONTACT_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getTechContact(), TECHCONTACT_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getPrivacyProtectAdminContact(), PRIVACYPROTECTADMINCONTACT_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getPrivacyProtectRegistrantContact(), PRIVACYPROTECTREGISTRANTCONTACT_BINDING);<NEW_LINE>protocolMarshaller.marshall(transferDomainRequest.getPrivacyProtectTechContact(), PRIVACYPROTECTTECHCONTACT_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | transferDomainRequest.getAdminContact(), ADMINCONTACT_BINDING); |
1,040,886 | public List<MetricIntervalValue> executeSelectInterval(MetricsQueryImpl query) {<NEW_LINE>List<MetricIntervalValue> intervalResult = getDbEntityManager().selectList(SELECT_METER_INTERVAL, query);<NEW_LINE>intervalResult = intervalResult != null ? intervalResult : new ArrayList<>();<NEW_LINE>String reporterId = Context.getProcessEngineConfiguration().getDbMetricsReporter().getMetricsCollectionTask().getReporter();<NEW_LINE>if (!intervalResult.isEmpty() && isEndTimeAfterLastReportInterval(query) && reporterId != null) {<NEW_LINE>Map<String, Meter> metrics = Context.getProcessEngineConfiguration().getMetricsRegistry().getDbMeters();<NEW_LINE>String queryName = query.getName();<NEW_LINE>// we have to add all unlogged metrics to last interval<NEW_LINE>if (queryName != null) {<NEW_LINE>MetricIntervalEntity intervalEntity = (MetricIntervalEntity) intervalResult.get(0);<NEW_LINE><MASK><NEW_LINE>if (metrics.get(queryName) != null) {<NEW_LINE>entityValue += metrics.get(queryName).get();<NEW_LINE>}<NEW_LINE>intervalEntity.setValue(entityValue);<NEW_LINE>} else {<NEW_LINE>Set<String> metricNames = metrics.keySet();<NEW_LINE>Date lastIntervalTimestamp = intervalResult.get(0).getTimestamp();<NEW_LINE>for (String metricName : metricNames) {<NEW_LINE>MetricIntervalEntity entity = new MetricIntervalEntity(lastIntervalTimestamp, metricName, reporterId);<NEW_LINE>int idx = intervalResult.indexOf(entity);<NEW_LINE>if (idx >= 0) {<NEW_LINE>MetricIntervalEntity intervalValue = (MetricIntervalEntity) intervalResult.get(idx);<NEW_LINE>intervalValue.setValue(intervalValue.getValue() + metrics.get(metricName).get());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return intervalResult;<NEW_LINE>} | long entityValue = intervalEntity.getValue(); |
1,548,832 | final PutAccountDedicatedIpWarmupAttributesResult executePutAccountDedicatedIpWarmupAttributes(PutAccountDedicatedIpWarmupAttributesRequest putAccountDedicatedIpWarmupAttributesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putAccountDedicatedIpWarmupAttributesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutAccountDedicatedIpWarmupAttributesRequest> request = null;<NEW_LINE>Response<PutAccountDedicatedIpWarmupAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutAccountDedicatedIpWarmupAttributesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putAccountDedicatedIpWarmupAttributesRequest));<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, "Pinpoint Email");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutAccountDedicatedIpWarmupAttributesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutAccountDedicatedIpWarmupAttributesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutAccountDedicatedIpWarmupAttributes"); |
1,793,346 | public static ClientMessage encodeRequest(java.lang.String mapName, java.lang.String cacheName, com.hazelcast.internal.serialization.Data predicate, int batchSize, int bufferSize, long delaySeconds, boolean populate, boolean coalesce) {<NEW_LINE>ClientMessage clientMessage = ClientMessage.createForEncode();<NEW_LINE>clientMessage.setRetryable(true);<NEW_LINE>clientMessage.setOperationName("ContinuousQuery.PublisherCreate");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);<NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeInt(initialFrame.content, REQUEST_BATCH_SIZE_FIELD_OFFSET, batchSize);<NEW_LINE>encodeInt(initialFrame.content, REQUEST_BUFFER_SIZE_FIELD_OFFSET, bufferSize);<NEW_LINE>encodeLong(initialFrame.content, REQUEST_DELAY_SECONDS_FIELD_OFFSET, delaySeconds);<NEW_LINE>encodeBoolean(initialFrame.content, REQUEST_POPULATE_FIELD_OFFSET, populate);<NEW_LINE>encodeBoolean(<MASK><NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE>StringCodec.encode(clientMessage, mapName);<NEW_LINE>StringCodec.encode(clientMessage, cacheName);<NEW_LINE>DataCodec.encode(clientMessage, predicate);<NEW_LINE>return clientMessage;<NEW_LINE>} | initialFrame.content, REQUEST_COALESCE_FIELD_OFFSET, coalesce); |
567,175 | private I_M_HU createNonAggregatedTU(final HUEditorRow tuRow, final HUEditorRow luRow) {<NEW_LINE>final I_M_HU newTU = newHUTransformation().tuToNewTUs(tuRow.getM_HU(), BigDecimal<MASK><NEW_LINE>if (luRow != null) {<NEW_LINE>final I_M_HU oldLU = luRow.getM_HU();<NEW_LINE>if (handlingUnitsBL.isDestroyed(oldLU)) {<NEW_LINE>final I_M_HU_PI_Item luPIItem = oldLU.getM_HU_LUTU_Configuration().getM_LU_HU_PI_Item();<NEW_LINE>final List<I_M_HU> tuToNewLUs = newHUTransformation().tuToNewLUs(newTU, BigDecimal.ONE, luPIItem, false);<NEW_LINE>huIDsToRemove.add(HuId.ofRepoId(oldLU.getM_HU_ID()));<NEW_LINE>huIDsAdded.add(HuId.ofRepoId(tuToNewLUs.get(0).getM_HU_ID()));<NEW_LINE>} else {<NEW_LINE>moveTUToLU(newTU.getM_HU_ID(), luRow, tuRow);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return newTU;<NEW_LINE>} | .ONE).get(0); |
489,292 | public Delta<DevStatSnapshot> diff(DevStatSnapshot bgn) {<NEW_LINE>return new Delta<DevStatSnapshot>(bgn, this) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected DevStatSnapshot computeDelta() {<NEW_LINE>DevStatSnapshot delta = new DevStatSnapshot();<NEW_LINE>delta.uptime = Differ.DigitDiffer.globalDiff(bgn.uptime, end.uptime);<NEW_LINE>delta.chargingRatio = Differ.DigitDiffer.globalDiff(bgn.chargingRatio, end.chargingRatio);<NEW_LINE>delta.unChargingRatio = Differ.DigitDiffer.globalDiff(bgn.unChargingRatio, end.unChargingRatio);<NEW_LINE>delta.screenOff = Differ.DigitDiffer.globalDiff(<MASK><NEW_LINE>delta.lowEnergyRatio = Differ.DigitDiffer.globalDiff(bgn.lowEnergyRatio, end.lowEnergyRatio);<NEW_LINE>return delta;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | bgn.screenOff, end.screenOff); |
1,691,244 | public ResponseInfo execute(HttpUriRequest request, String userName, String password, int... expectedStatusCodes) {<NEW_LINE>FlowableServiceException exception = null;<NEW_LINE>CloseableHttpClient client = getHttpClient(userName, password);<NEW_LINE>try {<NEW_LINE>try (CloseableHttpResponse response = client.execute(request)) {<NEW_LINE>JsonNode bodyNode = readJsonContent(response.getEntity().getContent());<NEW_LINE>int statusCode = -1;<NEW_LINE>if (response.getStatusLine() != null) {<NEW_LINE>statusCode = response.getStatusLine().getStatusCode();<NEW_LINE>}<NEW_LINE>boolean success = Arrays.asList(expectedStatusCodes).contains(statusCode);<NEW_LINE>if (success) {<NEW_LINE>return new ResponseInfo(statusCode, bodyNode);<NEW_LINE>} else {<NEW_LINE>exception = new FlowableServiceException(extractError(readJsonContent(response.getEntity().getContent()), "An error occurred while calling Flowable: " + response.getStatusLine()));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.warn("Error consuming response from uri {}", request.getURI(), e);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Error executing request to uri {}", request.getURI(), e);<NEW_LINE>exception = wrapException(e, request);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>client.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.warn("Error closing http client instance", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (exception != null) {<NEW_LINE>throw exception;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | exception = wrapException(e, request); |
748,540 | final CreateTransformJobResult executeCreateTransformJob(CreateTransformJobRequest createTransformJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createTransformJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<CreateTransformJobRequest> request = null;<NEW_LINE>Response<CreateTransformJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateTransformJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createTransformJobRequest));<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, "SageMaker");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateTransformJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateTransformJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateTransformJobResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
718,422 | public boolean appendIndex(Map<String, PullLogIndexEntry> indexMap) {<NEW_LINE>positionOfIndex = tablet.getWrotePosition();<NEW_LINE>for (Map.Entry<String, PullLogIndexEntry> entry : indexMap.entrySet()) {<NEW_LINE>final byte[] consumerBytes = entry.getKey().getBytes(StandardCharsets.UTF_8);<NEW_LINE>int size = Integer.BYTES + Short.BYTES + consumerBytes.length + Long.BYTES + Long.BYTES + Integer.BYTES + Integer.BYTES;<NEW_LINE>PullLogIndexEntry indexEntry = entry.getValue();<NEW_LINE>ByteBuf buffer = ByteBufAllocator.DEFAULT.ioBuffer(size);<NEW_LINE>try {<NEW_LINE>buffer.writeInt(MagicCode.PULL_LOG_MAGIC_V1);<NEW_LINE>buffer.writeShort((short) consumerBytes.length);<NEW_LINE>buffer.writeBytes(consumerBytes);<NEW_LINE>buffer.writeLong(indexEntry.startOfPullLogSequence);<NEW_LINE>buffer.writeLong(indexEntry.baseOfMessageSequence);<NEW_LINE>buffer.writeInt(indexEntry.position);<NEW_LINE>buffer.writeInt(indexEntry.num);<NEW_LINE><MASK><NEW_LINE>Checksums.update(crc, nioBuffer, nioBuffer.limit());<NEW_LINE>boolean result = tablet.appendData(nioBuffer);<NEW_LINE>if (!result)<NEW_LINE>return false;<NEW_LINE>} finally {<NEW_LINE>ReferenceCountUtil.safeRelease(buffer);<NEW_LINE>}<NEW_LINE>ConcurrentSkipListMap<PullLogSequence, SegmentLocation> index = sortedPullLogTable.index;<NEW_LINE>index.put(new PullLogSequence(entry.getKey(), indexEntry.startOfPullLogSequence), new SegmentLocation(indexEntry.baseOfMessageSequence, indexEntry.position, indexEntry.num, tablet));<NEW_LINE>tablet.retain();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | ByteBuffer nioBuffer = buffer.nioBuffer(); |
1,336,421 | private Mono<Response<Void>> updateResourceGroupLevelStateToResolveWithResponseAsync(String ascLocation, String alertName, String resourceGroupName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (ascLocation == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (alertName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter alertName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2021-01-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.updateResourceGroupLevelStateToResolve(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), ascLocation, alertName, resourceGroupName, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); |
315,601 | private static Map<TypeAlias, jnr.ffi.NativeType> buildTypeMap() {<NEW_LINE>Map<TypeAlias, jnr.ffi.NativeType> m = new EnumMap<TypeAlias, jnr.ffi.NativeType>(TypeAlias.class);<NEW_LINE>m.put(TypeAlias.int8_t, NativeType.SCHAR);<NEW_LINE>m.put(TypeAlias.u_int8_t, NativeType.UCHAR);<NEW_LINE>m.put(TypeAlias.int16_t, NativeType.SSHORT);<NEW_LINE>m.put(TypeAlias.u_int16_t, NativeType.USHORT);<NEW_LINE>m.put(TypeAlias.int32_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.u_int32_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.int64_t, NativeType.SLONGLONG);<NEW_LINE>m.put(TypeAlias.u_int64_t, NativeType.ULONGLONG);<NEW_LINE>m.put(TypeAlias.intptr_t, NativeType.SLONG);<NEW_LINE>m.put(TypeAlias.uintptr_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.caddr_t, NativeType.ADDRESS);<NEW_LINE>m.put(TypeAlias.dev_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.blkcnt_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.blksize_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.gid_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.in_addr_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.in_port_t, NativeType.USHORT);<NEW_LINE>m.put(TypeAlias.ino_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.ino64_t, NativeType.ULONGLONG);<NEW_LINE>m.put(TypeAlias.key_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.mode_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.nlink_t, NativeType.SSHORT);<NEW_LINE>m.put(TypeAlias.id_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.pid_t, NativeType.SINT);<NEW_LINE>m.put(<MASK><NEW_LINE>m.put(TypeAlias.swblk_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.uid_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.clock_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.size_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.ssize_t, NativeType.SLONG);<NEW_LINE>m.put(TypeAlias.time_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.fsblkcnt_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.fsfilcnt_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.sa_family_t, NativeType.UCHAR);<NEW_LINE>m.put(TypeAlias.socklen_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.rlim_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.cc_t, NativeType.UCHAR);<NEW_LINE>m.put(TypeAlias.speed_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.tcflag_t, NativeType.UINT);<NEW_LINE>return m;<NEW_LINE>} | TypeAlias.off_t, NativeType.SLONG); |
1,648,192 | void migration(MigrationStrategy strategy, boolean initializeEmpty, String schema, File databaseUpdateFile, Connection connection, KeycloakSession session) {<NEW_LINE>JpaUpdaterProvider updater = session.getProvider(JpaUpdaterProvider.class, LiquibaseJpaUpdaterProviderFactory.PROVIDER_ID);<NEW_LINE>JpaUpdaterProvider.Status status = updater.validate(connection, schema);<NEW_LINE>if (status == JpaUpdaterProvider.Status.VALID) {<NEW_LINE>logger.debug("Database is up-to-date");<NEW_LINE>} else if (status == JpaUpdaterProvider.Status.EMPTY) {<NEW_LINE>if (initializeEmpty) {<NEW_LINE>update(connection, schema, session, updater);<NEW_LINE>} else {<NEW_LINE>switch(strategy) {<NEW_LINE>case UPDATE:<NEW_LINE>update(connection, schema, session, updater);<NEW_LINE>break;<NEW_LINE>case MANUAL:<NEW_LINE>export(connection, schema, databaseUpdateFile, session, updater);<NEW_LINE>throw new ServerStartupError("Database not initialized, please initialize database with " + databaseUpdateFile.getAbsolutePath(), false);<NEW_LINE>case VALIDATE:<NEW_LINE>throw new ServerStartupError("Database not initialized, please enable database initialization", false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>switch(strategy) {<NEW_LINE>case UPDATE:<NEW_LINE>update(<MASK><NEW_LINE>break;<NEW_LINE>case MANUAL:<NEW_LINE>export(connection, schema, databaseUpdateFile, session, updater);<NEW_LINE>throw new ServerStartupError("Database not up-to-date, please migrate database with " + databaseUpdateFile.getAbsolutePath(), false);<NEW_LINE>case VALIDATE:<NEW_LINE>throw new ServerStartupError("Database not up-to-date, please enable database migration", false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | connection, schema, session, updater); |
843,326 | public boolean addSubscription(SubscriptionItem subscriptionItem, Session session) throws Exception {<NEW_LINE>if (subscriptionItem == null) {<NEW_LINE>logger.error("addSubscription param error,subscriptionItem is null", session);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String topic = subscriptionItem.getTopic();<NEW_LINE>if (session == null || !StringUtils.equalsIgnoreCase(group, EventMeshUtil.buildClientGroup(session.getClient().getGroup()))) {<NEW_LINE>logger.error("addSubscription param error,topic:{},session:{}", topic, session);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>boolean r = false;<NEW_LINE>try {<NEW_LINE>this.groupLock.writeLock().lockInterruptibly();<NEW_LINE>if (!topic2sessionInGroupMapping.containsKey(topic)) {<NEW_LINE>Set<Session> sessions = new HashSet<Session>();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>r = topic2sessionInGroupMapping.get(topic).add(session);<NEW_LINE>if (r) {<NEW_LINE>logger.info("addSubscription success, group:{} topic:{} client:{}", group, topic, session.getClient());<NEW_LINE>} else {<NEW_LINE>logger.warn("addSubscription fail, group:{} topic:{} client:{}", group, topic, session.getClient());<NEW_LINE>}<NEW_LINE>subscriptions.putIfAbsent(topic, subscriptionItem);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("addSubscription error! topic:{} client:{}", topic, session.getClient(), e);<NEW_LINE>throw new Exception("addSubscription fail");<NEW_LINE>} finally {<NEW_LINE>this.groupLock.writeLock().unlock();<NEW_LINE>}<NEW_LINE>return r;<NEW_LINE>} | topic2sessionInGroupMapping.put(topic, sessions); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.