idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,471,375 | public static // All Three Normal or All Three Bitmap<NEW_LINE>void allThreeNormal(FastFixedHashTable thisThreadSetAggregates, int[] curColumnOneAttributes, int[] curColumnTwoAttributes, int[] curColumnThreeAttributes, AggregationOp[] aggregationOps, boolean[] singleNextArray, int startIndex, int endIndex, boolean useIntSetAsArray, IntSet curCandidate, double[][] aRows, int numAggregates) {<NEW_LINE>for (int rowNum = startIndex; rowNum < endIndex; rowNum++) {<NEW_LINE>int rowNumInCol = rowNum - startIndex;<NEW_LINE>// Only construct a triple if all its singleton members have minimum support.<NEW_LINE>if (curColumnOneAttributes[rowNumInCol] == AttributeEncoder.noSupport || curColumnTwoAttributes[rowNumInCol] == AttributeEncoder.noSupport || curColumnThreeAttributes[rowNumInCol] == AttributeEncoder.noSupport || !singleNextArray[curColumnThreeAttributes[rowNumInCol]] || !singleNextArray[curColumnOneAttributes[rowNumInCol]] || !singleNextArray[curColumnTwoAttributes[rowNumInCol]])<NEW_LINE>continue;<NEW_LINE>// Cascade to arrays if necessary, but otherwise pack attributes into longs.<NEW_LINE>if (useIntSetAsArray) {<NEW_LINE>curCandidate = new IntSetAsArray(curColumnOneAttributes[rowNumInCol], curColumnTwoAttributes[rowNumInCol], curColumnThreeAttributes[rowNumInCol]);<NEW_LINE>} else {<NEW_LINE>((IntSetAsLong) curCandidate).value = IntSetAsLong.threeIntToLong(curColumnOneAttributes[rowNumInCol], curColumnTwoAttributes[<MASK><NEW_LINE>}<NEW_LINE>updateAggregates(thisThreadSetAggregates, curCandidate, aggregationOps, aRows[rowNum], numAggregates);<NEW_LINE>}<NEW_LINE>} | rowNumInCol], curColumnThreeAttributes[rowNumInCol]); |
972,626 | final DescribeReservedNodesResult executeDescribeReservedNodes(DescribeReservedNodesRequest describeReservedNodesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeReservedNodesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeReservedNodesRequest> request = null;<NEW_LINE>Response<DescribeReservedNodesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeReservedNodesRequestMarshaller().marshall(super.beforeMarshalling(describeReservedNodesRequest));<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, "Redshift");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeReservedNodes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeReservedNodesResult> responseHandler = new StaxResponseHandler<DescribeReservedNodesResult>(new DescribeReservedNodesResultStaxUnmarshaller());<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); |
445,968 | public PublishSchemaResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>PublishSchemaResult publishSchemaResult = new PublishSchemaResult();<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 publishSchemaResult;<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("PublishedSchemaArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>publishSchemaResult.setPublishedSchemaArn(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 publishSchemaResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
37,110 | public static Document sign(SignatureUtilTransferObject dto, String canonicalizationMethodType) throws GeneralSecurityException, MarshalException, XMLSignatureException {<NEW_LINE>Document doc = dto.getDocumentToBeSigned();<NEW_LINE>String keyName = dto.getKeyName();<NEW_LINE>KeyPair keyPair = dto.getKeyPair();<NEW_LINE>Node nextSibling = dto.getNextSibling();<NEW_LINE>String digestMethod = dto.getDigestMethod();<NEW_LINE>String referenceURI = dto.getReferenceURI();<NEW_LINE>String signatureMethod = dto.getSignatureMethod();<NEW_LINE>if (logger.isTraceEnabled()) {<NEW_LINE>logger.trace("Document to be signed=" + DocumentUtil.asString(doc));<NEW_LINE>}<NEW_LINE>PrivateKey signingKey = keyPair.getPrivate();<NEW_LINE><MASK><NEW_LINE>DOMSignContext dsc = new DOMSignContext(signingKey, doc.getDocumentElement(), nextSibling);<NEW_LINE>signImpl(dsc, digestMethod, signatureMethod, referenceURI, keyName, publicKey, dto.getX509Certificate(), canonicalizationMethodType);<NEW_LINE>if (logger.isTraceEnabled()) {<NEW_LINE>logger.trace("Signed document=" + DocumentUtil.asString(doc));<NEW_LINE>}<NEW_LINE>return doc;<NEW_LINE>} | PublicKey publicKey = keyPair.getPublic(); |
313,617 | private void appendFromBaseTable(DbSqlContext ctx, SqlJoinType joinType) {<NEW_LINE>String alias = ctx.getTableAliasManyWhere(prefix);<NEW_LINE>String <MASK><NEW_LINE>if (nodeBeanProp instanceof STreePropertyAssocOne) {<NEW_LINE>nodeBeanProp.addJoin(joinType, parentAlias, alias, ctx);<NEW_LINE>if (softDelete) {<NEW_LINE>ctx.append(" and ").append(target.softDeletePredicate(alias));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>STreePropertyAssocMany manyProp = (STreePropertyAssocMany) nodeBeanProp;<NEW_LINE>if (!manyProp.hasJoinTable()) {<NEW_LINE>manyProp.addJoin(joinType, parentAlias, alias, ctx);<NEW_LINE>if (softDelete) {<NEW_LINE>ctx.append(" and ").append(target.softDeletePredicate(alias));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String alias2 = alias + "z_";<NEW_LINE>TableJoin manyToManyJoin = manyProp.intersectionTableJoin();<NEW_LINE>manyToManyJoin.addJoin(joinType, parentAlias, alias2, ctx);<NEW_LINE>manyProp.addJoin(joinType, alias2, alias, ctx);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | parentAlias = ctx.getTableAliasManyWhere(parentPrefix); |
1,284,492 | private static // also check if it is a valid type of property<NEW_LINE>String convert2PropName(String argProp) throws Exception {<NEW_LINE>// System.out.println("argProp: " + argProp);<NEW_LINE>if (!argProp.startsWith("--")) {<NEW_LINE>throw new Exception("argument: " + argProp + " does not start with --");<NEW_LINE>}<NEW_LINE>if (argProp.indexOf("=") == -1) {<NEW_LINE>throw new Exception("argument: " + argProp + " does not contain an = sign");<NEW_LINE>}<NEW_LINE>// remove hyphens<NEW_LINE>String argProperty = argProp.substring(2);<NEW_LINE>if (null == argProperty || "".equals(argProperty))<NEW_LINE>throw new <MASK><NEW_LINE>// get the lhs of =, the property name<NEW_LINE>String argPropName = argProperty.split("=")[0];<NEW_LINE>if (null == argPropName || "".equals(argPropName))<NEW_LINE>throw new Exception("argument: " + argProp + " not valid");<NEW_LINE>// get the rhs of =, the property value<NEW_LINE>int equalsAt = argProperty.indexOf('=');<NEW_LINE>String argPropValue = argProperty.substring(equalsAt + 1);<NEW_LINE>if (null == argPropValue || "".equals(argPropValue))<NEW_LINE>throw new Exception("argument: " + argProp + " not valid");<NEW_LINE>// System.out.println("argPropName: " + argPropName);<NEW_LINE>// ensure this type of prop is one that we will handle<NEW_LINE>// String[] dotSplit = argPropName.split("\\.");<NEW_LINE>// String propType = dotSplit[0];<NEW_LINE>// if (Arrays.binarySearch(PREFS_ALLOWED_PROP_TYPES, propType) < 0) {<NEW_LINE>// StringBuffer allowedProps = new StringBuffer();<NEW_LINE>// for (int i = 0; i < PREFS_ALLOWED_PROP_TYPES.length; i++) {<NEW_LINE>// allowedProps.append(PREFS_ALLOWED_PROP_TYPES[i]);<NEW_LINE>// allowedProps.append(" ");<NEW_LINE>// }<NEW_LINE>// throw new Exception("argument: " + argProp + " not allowed, " +<NEW_LINE>// allowedProps.toString());<NEW_LINE>// }<NEW_LINE>return argPropName;<NEW_LINE>} | Exception("argument: " + argProp + " not valid"); |
327,563 | protected void findLocalScaleSpaceMax(PyramidFloat<T> ss, int layerID) {<NEW_LINE>int index0 = spaceIndex;<NEW_LINE>int index1 = (spaceIndex + 1) % 3;<NEW_LINE>int index2 = (spaceIndex + 2) % 3;<NEW_LINE>List<Point2D_I16> candidates = maximums[index1];<NEW_LINE>ImageBorder_F32 inten0 = FactoryImageBorderAlgs.value(intensities[index0], 0);<NEW_LINE>GrayF32 inten1 = intensities[index1];<NEW_LINE>ImageBorder_F32 inten2 = FactoryImageBorderAlgs.value(intensities[index2], 0);<NEW_LINE>float scale0 = (float) ss.scale[layerID - 1];<NEW_LINE>float scale1 = (float) ss.scale[layerID];<NEW_LINE>float scale2 = (float) <MASK><NEW_LINE>float sigma0 = (float) ss.getSigma(layerID - 1);<NEW_LINE>float sigma1 = (float) ss.getSigma(layerID);<NEW_LINE>float sigma2 = (float) ss.getSigma(layerID + 1);<NEW_LINE>// not sure if this is the correct way to handle the change in scale<NEW_LINE>float ss0 = (float) (Math.pow(sigma0, scalePower) / scale0);<NEW_LINE>float ss1 = (float) (Math.pow(sigma1, scalePower) / scale1);<NEW_LINE>float ss2 = (float) (Math.pow(sigma2, scalePower) / scale2);<NEW_LINE>for (int canIdx = 0; canIdx < candidates.size(); canIdx++) {<NEW_LINE>Point2D_I16 c = candidates.get(canIdx);<NEW_LINE>float val = ss1 * inten1.get(c.x, c.y);<NEW_LINE>// find pixel location in each image's local coordinate<NEW_LINE>int x0 = (int) (c.x * scale1 / scale0);<NEW_LINE>int y0 = (int) (c.y * scale1 / scale0);<NEW_LINE>int x2 = (int) (c.x * scale1 / scale2);<NEW_LINE>int y2 = (int) (c.y * scale1 / scale2);<NEW_LINE>if (checkMax(inten0, val / ss0, x0, y0) && checkMax(inten2, val / ss2, x2, y2)) {<NEW_LINE>// put features into the scale of the upper image<NEW_LINE>foundPoints.add(new ScalePoint(c.x * scale1, c.y * scale1, sigma1));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ss.scale[layerID + 1]; |
353,562 | private static String makeMessage(Throwable e, Class<?> type, Class<?>[] argTypes) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>String name = null == type ? "unknown" : type.getName();<NEW_LINE>sb.append("Fail to born or cast to '").append(name).append('\'');<NEW_LINE>if (null != argTypes && argTypes.length > 0) {<NEW_LINE>if (argTypes.length > 1)<NEW_LINE>sb.append("\n");<NEW_LINE>sb.append("by args: [");<NEW_LINE>for (Object argType : argTypes) {<NEW_LINE>if (argTypes.length > 1)<NEW_LINE>sb.append("\n");<NEW_LINE>sb.append("@(").append<MASK><NEW_LINE>}<NEW_LINE>sb.append("]");<NEW_LINE>}<NEW_LINE>if (null != e) {<NEW_LINE>sb.append("because: ").append(getExceptionMessage(e));<NEW_LINE>} else if (type != null) {<NEW_LINE>if (type.isInterface()) {<NEW_LINE>sb.append(" because: ").append(type.getName()).append("is interface!!");<NEW_LINE>} else if (Modifier.isAbstract(type.getModifiers())) {<NEW_LINE>sb.append(" because: ").append(type.getName()).append("is abstract class and can't found static factory method!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | (argType).append(')'); |
161,481 | void buildDialog() {<NEW_LINE>int i;<NEW_LINE>int idx;<NEW_LINE>for (i = 0; ; i++) {<NEW_LINE>einfos[i] = elm.getEditInfo(i);<NEW_LINE>if (einfos[i] == null)<NEW_LINE>break;<NEW_LINE>EditInfo ei = einfos[i];<NEW_LINE>if (!ei.canCreateAdjustable())<NEW_LINE>continue;<NEW_LINE>Adjustable adj = findAdjustable(i);<NEW_LINE>String name = CirSim.LS(ei.name);<NEW_LINE><MASK><NEW_LINE>// remove HTML<NEW_LINE>name = name.replaceAll("<[^>]*>", "");<NEW_LINE>ei.checkbox = new Checkbox(name, adj != null);<NEW_LINE>vp.insert(ei.checkbox, idx++);<NEW_LINE>ei.checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {<NEW_LINE><NEW_LINE>public void onValueChange(ValueChangeEvent<Boolean> e) {<NEW_LINE>itemStateChanged(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (adj != null) {<NEW_LINE>vp.insert(new Label("Min Value"), idx++);<NEW_LINE>ei.minBox = new TextBox();<NEW_LINE>vp.insert(ei.minBox, idx++);<NEW_LINE>vp.insert(new Label("Max Value"), idx++);<NEW_LINE>ei.maxBox = new TextBox();<NEW_LINE>vp.insert(ei.maxBox, idx++);<NEW_LINE>vp.insert(new Label("Label"), idx++);<NEW_LINE>ei.labelBox = new TextBox();<NEW_LINE>ei.labelBox.setText(adj.sliderText);<NEW_LINE>vp.insert(ei.labelBox, idx++);<NEW_LINE>ei.minBox.setText(EditDialog.unitString(ei, adj.minValue));<NEW_LINE>ei.maxBox.setText(EditDialog.unitString(ei, adj.maxValue));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>einfocount = i;<NEW_LINE>} | idx = vp.getWidgetIndex(hp); |
1,684,349 | protected Result deleteVoD(String id) {<NEW_LINE>boolean success = false;<NEW_LINE>String message = "";<NEW_LINE>ApplicationContext appContext = getAppContext();<NEW_LINE>if (appContext != null) {<NEW_LINE>File videoFile = null;<NEW_LINE>VoD voD = getDataStore().getVoD(id);<NEW_LINE>if (voD != null) {<NEW_LINE>try {<NEW_LINE>String filePath = String.format("webapps/%s/%s", getScope().getName(), voD.getFilePath());<NEW_LINE>videoFile = new File(filePath);<NEW_LINE>boolean result = Files.deleteIfExists(videoFile.toPath());<NEW_LINE>if (!result) {<NEW_LINE>logger.warn("File is not deleted because it does not exist {}", videoFile.getAbsolutePath());<NEW_LINE>}<NEW_LINE>String previewFilePath = voD.getPreviewFilePath();<NEW_LINE>if (previewFilePath != null) {<NEW_LINE>File tmp = new File(previewFilePath);<NEW_LINE>boolean resultThumbnail = Files.deleteIfExists(tmp.toPath());<NEW_LINE>if (!resultThumbnail) {<NEW_LINE>logger.warn("Preview is not deleted because it does not exist {}", tmp.getAbsolutePath());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>success = getDataStore().deleteVod(id);<NEW_LINE>if (success) {<NEW_LINE>message = "vod deleted";<NEW_LINE>}<NEW_LINE>String fileName = videoFile.getName();<NEW_LINE>int indexOfFileExtension = fileName.lastIndexOf(".");<NEW_LINE>String finalFileName = fileName.substring(0, indexOfFileExtension);<NEW_LINE>// delete preview file if exists<NEW_LINE>File previewFile = Muxer.getPreviewFile(getScope(), finalFileName, ".png");<NEW_LINE>Files.<MASK><NEW_LINE>StorageClient storageClient = (StorageClient) appContext.getBean(StorageClient.BEAN_NAME);<NEW_LINE>storageClient.delete(getAppSettings().getS3StreamsFolderPath() + File.separator + fileName);<NEW_LINE>storageClient.delete(getAppSettings().getS3PreviewsFolderPath() + File.separator + finalFileName + ".png");<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error(ExceptionUtils.getStackTrace(e));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new Result(success, message);<NEW_LINE>} | deleteIfExists(previewFile.toPath()); |
1,050,842 | public Map<String, Object> populate(Map<String, Object> json, Map<String, Object> context) {<NEW_LINE>if (!Beans.get(AppProductionService.class).isApp("production")) {<NEW_LINE>return super.populate(json, context);<NEW_LINE>}<NEW_LINE>Object productFromView = json.get("product");<NEW_LINE>Object qtyFromView = json.get("qty");<NEW_LINE>Object toProduceManufOrderIdFromView;<NEW_LINE>if (context == null || context.isEmpty()) {<NEW_LINE>toProduceManufOrderIdFromView = json.get("toConsumeManufOrder") == null ? null : ((HashMap<String, Object>) json.get("toConsumeManufOrder")).get("id");<NEW_LINE>} else {<NEW_LINE>toProduceManufOrderIdFromView = context.get("id");<NEW_LINE>}<NEW_LINE>if (productFromView == null || qtyFromView == null || toProduceManufOrderIdFromView == null) {<NEW_LINE>return super.populate(json, context);<NEW_LINE>} else {<NEW_LINE>Long productId = (Long) ((HashMap<String, Object>) productFromView).get("id");<NEW_LINE>Long toProduceManufOrderId = (Long) toProduceManufOrderIdFromView;<NEW_LINE>json.put("$missingQty", computeMissingQty(productId, <MASK><NEW_LINE>}<NEW_LINE>return super.populate(json, context);<NEW_LINE>} | (BigDecimal) qtyFromView, toProduceManufOrderId)); |
915,321 | U32 decodeUTF8CharN(U8Pointer input, U16 result, UDATA bytesRemaining) throws CorruptDataException {<NEW_LINE>U8 c;<NEW_LINE>U8Pointer cursor = input;<NEW_LINE>if (bytesRemaining.longValue() < 1) {<NEW_LINE>return new U32(0);<NEW_LINE>}<NEW_LINE>c = cursor.at(0);<NEW_LINE>cursor = cursor.add(1);<NEW_LINE>if (c.eq(0x0)) {<NEW_LINE>// *result = (U_16)c;<NEW_LINE>return new U32(1);<NEW_LINE>} else if (c.bitAnd(0xE0).eq(0xC0)) {<NEW_LINE>U16 unicodeC;<NEW_LINE>if (bytesRemaining.lt(3)) {<NEW_LINE>return new U32(0);<NEW_LINE>}<NEW_LINE>unicodeC = new U16(c.bitAnd(0x0F).leftShift(12));<NEW_LINE>c = cursor.at(0);<NEW_LINE>cursor = cursor.add(1);<NEW_LINE>unicodeC = unicodeC.add(new U16(c.bitAnd(0x3F).leftShift(6)));<NEW_LINE>if (!c.bitAnd(0xC0).eq(0x80)) {<NEW_LINE>return new U32(0);<NEW_LINE>}<NEW_LINE>c = cursor.at(0);<NEW_LINE><MASK><NEW_LINE>unicodeC = unicodeC.add(new U16(c.bitAnd(0x3F)));<NEW_LINE>if (!c.bitAnd(0xC0).eq(0x80)) {<NEW_LINE>return new U32(0);<NEW_LINE>}<NEW_LINE>// *result = unicodeC;<NEW_LINE>return new U32(3);<NEW_LINE>} else {<NEW_LINE>return new U32(0);<NEW_LINE>}<NEW_LINE>} | cursor = cursor.add(1); |
42,056 | protected void configureService(ServiceBusClientBuilder.ServiceBusReceiverClientBuilder builder) {<NEW_LINE>Assert.notNull(receiverClientProperties.getEntityType(), "Entity type cannot be null.");<NEW_LINE>Assert.notNull(receiverClientProperties.getEntityName(), "Entity name cannot be null.");<NEW_LINE>if (ServiceBusEntityType.TOPIC == receiverClientProperties.getEntityType()) {<NEW_LINE>Assert.notNull(receiverClientProperties.getSubscriptionName(), "Subscription cannot be null.");<NEW_LINE>}<NEW_LINE>final PropertyMapper propertyMapper = new PropertyMapper();<NEW_LINE>if (ServiceBusEntityType.QUEUE == receiverClientProperties.getEntityType()) {<NEW_LINE>propertyMapper.from(receiverClientProperties.getEntityName()).to(builder::queueName);<NEW_LINE>} else if (ServiceBusEntityType.TOPIC == receiverClientProperties.getEntityType()) {<NEW_LINE>propertyMapper.from(receiverClientProperties.getEntityName()).to(builder::topicName);<NEW_LINE>propertyMapper.from(receiverClientProperties.getSubscriptionName()).to(builder::subscriptionName);<NEW_LINE>}<NEW_LINE>propertyMapper.from(receiverClientProperties.getReceiveMode()).to(builder::receiveMode);<NEW_LINE>propertyMapper.from(receiverClientProperties.getSubQueue()<MASK><NEW_LINE>propertyMapper.from(receiverClientProperties.getPrefetchCount()).to(builder::prefetchCount);<NEW_LINE>propertyMapper.from(receiverClientProperties.getMaxAutoLockRenewDuration()).to(builder::maxAutoLockRenewDuration);<NEW_LINE>propertyMapper.from(receiverClientProperties.getAutoComplete()).whenFalse().to(t -> builder.disableAutoComplete());<NEW_LINE>} | ).to(builder::subQueue); |
1,546,676 | public void run() {<NEW_LINE>dataRangeLbl.setText((lastIndex - lastSize + 1) + " ~ " + lastIndex);<NEW_LINE>if (lastIndex <= LIMIT_PER_PAGE) {<NEW_LINE>leftBtn.setEnabled(false);<NEW_LINE>}<NEW_LINE>rightBtn.setEnabled(true);<NEW_LINE>if (TagConstants.GROUP_SERVICE.equals(tagGroup)) {<NEW_LINE>Pack p = revList.get(0);<NEW_LINE>XLogPack xp = (XLogPack) p;<NEW_LINE>firstTime = xp.endTime;<NEW_LINE>firstTxid = xp.txid;<NEW_LINE>p = revList.get(revList.size() - 1);<NEW_LINE>xp = (XLogPack) p;<NEW_LINE>lastTime = xp.endTime;<NEW_LINE>lastTxid = xp.txid;<NEW_LINE>serviceTable.setInput(revList, serverId, tagGroup);<NEW_LINE>} else if (TagConstants.GROUP_ALERT.equals(tagGroup)) {<NEW_LINE>Pack p = revList.get(0);<NEW_LINE>AlertPack xp = (AlertPack) p;<NEW_LINE>firstTime = xp.time;<NEW_LINE>p = revList.get(<MASK><NEW_LINE>xp = (AlertPack) p;<NEW_LINE>lastTime = xp.time;<NEW_LINE>alertTable.setInput(revList, serverId, tagGroup);<NEW_LINE>}<NEW_LINE>} | revList.size() - 1); |
942,160 | protected final void updateOrientation() {<NEW_LINE>if (!container.isDisplayable()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (Boolean.FALSE.equals(container.getClientProperty(TabbedContainer.PROP_MANAGE_TAB_POSITION))) {<NEW_LINE>// The client has specified that it does not want automatic management<NEW_LINE>// of the displayer orientation<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Object currOrientation = tabDisplayer.getClientProperty(TabDisplayer.PROP_ORIENTATION);<NEW_LINE>Container window = container.getTopLevelAncestor();<NEW_LINE><MASK><NEW_LINE>containerBounds = SwingUtilities.convertRectangle(container, containerBounds, window);<NEW_LINE>boolean longestIsVertical = containerBounds.width < containerBounds.height;<NEW_LINE>int distanceToLeft = containerBounds.x;<NEW_LINE>int distanceToTop = containerBounds.y;<NEW_LINE>int distanceToRight = window.getWidth() - (containerBounds.x + containerBounds.width);<NEW_LINE>int distanceToBottom = window.getHeight() - (containerBounds.y + containerBounds.height);<NEW_LINE>Object orientation;<NEW_LINE>if (!longestIsVertical) {<NEW_LINE>if (distanceToBottom > distanceToTop) {<NEW_LINE>orientation = TabDisplayer.ORIENTATION_NORTH;<NEW_LINE>} else {<NEW_LINE>orientation = TabDisplayer.ORIENTATION_SOUTH;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (distanceToLeft > distanceToRight) {<NEW_LINE>orientation = TabDisplayer.ORIENTATION_EAST;<NEW_LINE>} else {<NEW_LINE>orientation = TabDisplayer.ORIENTATION_WEST;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (currOrientation != orientation) {<NEW_LINE>tabDisplayer.putClientProperty(TabDisplayer.PROP_ORIENTATION, orientation);<NEW_LINE>container.validate();<NEW_LINE>}<NEW_LINE>} | Rectangle containerBounds = container.getBounds(); |
927,904 | public void startPlayer(final MethodCall call, final Result result) {<NEW_LINE>Integer _codec = call.argument("codec");<NEW_LINE>t_CODEC codec = t_CODEC.values()[(_codec != null) ? _codec : 0];<NEW_LINE>byte[] dataBuffer = call.argument("fromDataBuffer");<NEW_LINE>Integer _blockSize = 4096;<NEW_LINE>if (call.argument("blockSize") != null) {<NEW_LINE>_blockSize = call.argument("blockSize");<NEW_LINE>}<NEW_LINE>String _path = call.argument("fromURI");<NEW_LINE>Integer _sampleRate = 16000;<NEW_LINE>if (call.argument("sampleRate") != null) {<NEW_LINE>_sampleRate = call.argument("sampleRate");<NEW_LINE>}<NEW_LINE>Integer _numChannels = 1;<NEW_LINE>if (call.argument("numChannels") != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>boolean b = m_flautoPlayer.startPlayer(codec, _path, dataBuffer, _numChannels, _sampleRate, _blockSize);<NEW_LINE>if (b) {<NEW_LINE>result.success(getPlayerState());<NEW_LINE>} else<NEW_LINE>result.error(ERR_UNKNOWN, ERR_UNKNOWN, "startPlayer() error");<NEW_LINE>} catch (Exception e) {<NEW_LINE>log(t_LOG_LEVEL.ERROR, "startPlayer() exception");<NEW_LINE>result.error(ERR_UNKNOWN, ERR_UNKNOWN, e.getMessage());<NEW_LINE>}<NEW_LINE>} | _numChannels = call.argument("numChannels"); |
837,124 | public void dump() {<NEW_LINE>if (isEnabled()) {<NEW_LINE>read();<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>try {<NEW_LINE>if (sent.isUsed() || received.isUsed() || sendBufferErrors.isUsed() || receiveBufferErrors.isUsed()) {<NEW_LINE>String eol = StringUtil.lineSeparator();<NEW_LINE>String head = " " + tag;<NEW_LINE>StringBuilder log = new StringBuilder();<NEW_LINE>log.append(tag).append("network statistic:").append(eol);<NEW_LINE>log.append(head).append(sent).append(eol);<NEW_LINE>log.append(head).append(received).append(eol);<NEW_LINE>log.append(head).append(sendBufferErrors).append(eol);<NEW_LINE>log.append(head).append(receiveBufferErrors).append(eol);<NEW_LINE>log.append(head).append(inErrors).append(eol);<NEW_LINE>log.append(head).append(inChecksumErrors).append(eol);<NEW_LINE>log.append<MASK><NEW_LINE>LOGGER.debug("{}", log);<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>LOGGER.error("{}", tag, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>transferCounter();<NEW_LINE>}<NEW_LINE>} | (head).append(noPorts); |
80,121 | protected RelationPlan visitTable(Table node, Void context) {<NEW_LINE>Query namedQuery = analysis.getNamedQuery(node);<NEW_LINE>Scope scope = analysis.getScope(node);<NEW_LINE>if (namedQuery != null) {<NEW_LINE>RelationPlan subPlan = process(namedQuery, null);<NEW_LINE>// Add implicit coercions if view query produces types that don't match the declared output types<NEW_LINE>// of the view (e.g., if the underlying tables referenced by the view changed)<NEW_LINE>Type[] types = scope.getRelationType().getAllFields().stream().map(Field::getType).toArray(Type[]::new);<NEW_LINE>RelationPlan withCoercions = addCoercions(subPlan, types);<NEW_LINE>return new RelationPlan(withCoercions.getRoot(), scope, withCoercions.getFieldMappings());<NEW_LINE>}<NEW_LINE>TableHandle handle = analysis.getTableHandle(node);<NEW_LINE>ImmutableList.Builder<VariableReferenceExpression> outputVariablesBuilder = ImmutableList.builder();<NEW_LINE>ImmutableMap.Builder<VariableReferenceExpression, ColumnHandle> columns = ImmutableMap.builder();<NEW_LINE>for (Field field : scope.getRelationType().getAllFields()) {<NEW_LINE>VariableReferenceExpression variable = variableAllocator.newVariable(getSourceLocation(node), field.getName().get(), field.getType());<NEW_LINE>outputVariablesBuilder.add(variable);<NEW_LINE>columns.put(variable<MASK><NEW_LINE>}<NEW_LINE>List<VariableReferenceExpression> outputVariables = outputVariablesBuilder.build();<NEW_LINE>PlanNode root = new TableScanNode(getSourceLocation(node.getLocation()), idAllocator.getNextId(), handle, outputVariables, columns.build(), TupleDomain.all(), TupleDomain.all());<NEW_LINE>return new RelationPlan(root, scope, outputVariables);<NEW_LINE>} | , analysis.getColumn(field)); |
1,515,646 | private void search() {<NEW_LINE>if (disposable != null) {<NEW_LINE>disposable.dispose();<NEW_LINE>}<NEW_LINE>chip.setVisibility((getArguments().getLong(ARG_FEED, 0) == 0) ? <MASK><NEW_LINE>disposable = Observable.fromCallable(this::performSearch).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(results -> {<NEW_LINE>progressBar.setVisibility(View.GONE);<NEW_LINE>this.results = results.first;<NEW_LINE>adapter.updateItems(results.first);<NEW_LINE>if (getArguments().getLong(ARG_FEED, 0) == 0) {<NEW_LINE>adapterFeeds.updateData(results.second);<NEW_LINE>} else {<NEW_LINE>adapterFeeds.updateData(Collections.emptyList());<NEW_LINE>}<NEW_LINE>if (searchView.getQuery().toString().isEmpty()) {<NEW_LINE>emptyViewHandler.setMessage(R.string.type_to_search);<NEW_LINE>} else {<NEW_LINE>emptyViewHandler.setMessage(getString(R.string.no_results_for_query, searchView.getQuery()));<NEW_LINE>}<NEW_LINE>}, error -> Log.e(TAG, Log.getStackTraceString(error)));<NEW_LINE>} | View.GONE : View.VISIBLE); |
1,065,853 | private void createGenericSignatureForMsgSend(SootMethod annotatedMethod, SootMethod m, List<Type> paramTypes, boolean extensions) {<NEW_LINE>SignatureTag tag = (SignatureTag) annotatedMethod.getTag(SignatureTag.class.getSimpleName());<NEW_LINE>if (tag != null) {<NEW_LINE>SootMethodType type = new SootMethodType(annotatedMethod);<NEW_LINE>List<String> genericParameterTypes = new ArrayList<>();<NEW_LINE>for (org.robovm.compiler.util.generic.Type t : type.getGenericParameterTypes()) {<NEW_LINE>genericParameterTypes.add(t.toGenericSignature());<NEW_LINE>}<NEW_LINE>if (!extensions) {<NEW_LINE>genericParameterTypes.add(0, Types.getDescriptor(<MASK><NEW_LINE>}<NEW_LINE>genericParameterTypes.add(1, Types.getDescriptor(paramTypes.get(1)));<NEW_LINE>StringBuilder sb = new StringBuilder("(");<NEW_LINE>sb.append(StringUtils.join(genericParameterTypes, ""));<NEW_LINE>sb.append(")");<NEW_LINE>sb.append(type.getGenericReturnType().toGenericSignature());<NEW_LINE>m.addTag(new SignatureTag(sb.toString()));<NEW_LINE>}<NEW_LINE>} | paramTypes.get(0))); |
172,477 | public void onSignIn(final String username, String password) {<NEW_LINE>showProgress();<NEW_LINE>Provider provider = Inject.provider();<NEW_LINE>subscription = provider.observeLogin(username, password).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Login.Status>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCompleted() {<NEW_LINE>if (!subscription.isUnsubscribed()) {<NEW_LINE>subscription.unsubscribe();<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(Throwable e) {<NEW_LINE>Inject.crashAnalytics().logSomethingWentWrong("Provider: login: " + username, e);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onNext(Login.Status status) {<NEW_LINE>if (status == Login.Status.SUCCESSFUL) {<NEW_LINE>Inject.<MASK><NEW_LINE>showSuccess(username);<NEW_LINE>navigate().toNews();<NEW_LINE>} else {<NEW_LINE>hideProgress();<NEW_LINE>loginView.showError();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | usageAnalytics().trackLogin(username); |
1,496,618 | public static void locateString(String searchString, TerminatingConsumer<Address> foundLocationConsumer, Program program, List<MemoryBlock> blocks, AddressSetView set, TaskMonitor monitor) throws CancelledException {<NEW_LINE>monitor.setMessage("Finding \"" + searchString + "\".");<NEW_LINE>int length = searchString.length();<NEW_LINE>byte[] bytes = searchString.getBytes();<NEW_LINE>Memory memory = program.getMemory();<NEW_LINE>for (MemoryBlock memoryBlock : blocks) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>Address startAddress = memoryBlock.getStart();<NEW_LINE><MASK><NEW_LINE>Address foundAddress;<NEW_LINE>do {<NEW_LINE>monitor.setMessage("Finding \"" + searchString + "\" @ " + startAddress + ".");<NEW_LINE>foundAddress = memory.findBytes(startAddress, endAddress, bytes, null, true, monitor);<NEW_LINE>if (foundAddress == null) {<NEW_LINE>// no more found in block.<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (set.contains(foundAddress)) {<NEW_LINE>foundLocationConsumer.accept(foundAddress);<NEW_LINE>if (foundLocationConsumer.terminationRequested()) {<NEW_LINE>// termination of search requested<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>startAddress = foundAddress.add(length);<NEW_LINE>} catch (AddressOutOfBoundsException e) {<NEW_LINE>// At end of block.<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} while (startAddress.compareTo(endAddress) <= 0);<NEW_LINE>}<NEW_LINE>} | Address endAddress = memoryBlock.getEnd(); |
767,208 | final GetEmailIdentityResult executeGetEmailIdentity(GetEmailIdentityRequest getEmailIdentityRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getEmailIdentityRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetEmailIdentityRequest> request = null;<NEW_LINE>Response<GetEmailIdentityResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetEmailIdentityRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getEmailIdentityRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Pinpoint Email");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetEmailIdentity");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetEmailIdentityResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetEmailIdentityResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
136,517 | public void run(CompilationController info) throws Exception {<NEW_LINE>info.toPhase(Phase.RESOLVED);<NEW_LINE>final Element element = WhereUsedPanel.this.element.resolveElement(info);<NEW_LINE>panel.initialize(element, info);<NEW_LINE>if ((element.getKind().equals(ElementKind.LOCAL_VARIABLE) || element.getKind().equals(ElementKind.PARAMETER)) || element.getModifiers().contains(Modifier.PRIVATE)) {<NEW_LINE>enableScope = false;<NEW_LINE>} else {<NEW_LINE>enableScope = scope.initialize(Lookups.fixed(WhereUsedPanel.this.element.getFileObject(), WhereUsedPanel.this.element, element), new AtomicBoolean());<NEW_LINE>}<NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>innerPanel.removeAll();<NEW_LINE>innerPanel.<MASK><NEW_LINE>panel.setVisible(true);<NEW_LINE>scope.setVisible(enableScope);<NEW_LINE>jLabel1.setVisible(enableScope);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | add(panel, BorderLayout.CENTER); |
982,244 | private static void runTransposeMapAndObjectArray(RegressionEnvironment env, EventRepresentationChoice representation) {<NEW_LINE>String[] fields = "p0,p1".split(",");<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String schema = representation.getAnnotationTextWJsonProvided(MyLocalJsonProvidedMySchema.class) + "@public @buseventtype @public create schema MySchema(p0 string, p1 int)";<NEW_LINE>env.compileDeploy(schema, path);<NEW_LINE>String generateFunction;<NEW_LINE>if (representation.isObjectArrayEvent()) {<NEW_LINE>generateFunction = "generateOA";<NEW_LINE>} else if (representation.isMapEvent()) {<NEW_LINE>generateFunction = "generateMap";<NEW_LINE>} else if (representation.isAvroEvent()) {<NEW_LINE>generateFunction = "generateAvro";<NEW_LINE>} else if (representation.isJsonEvent() || representation.isJsonProvidedClassEvent()) {<NEW_LINE>generateFunction = "generateJson";<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Unrecognized code " + representation);<NEW_LINE>}<NEW_LINE>String epl = "insert into MySchema select transpose(" + generateFunction + "(theString, intPrimitive)) from SupportBean";<NEW_LINE>env.compileDeploy("@name('s0') " + epl, path).addListener("s0");<NEW_LINE>env.sendEventBean(new SupportBean("E1", 1));<NEW_LINE>env.assertPropsNew("s0", fields, new Object<MASK><NEW_LINE>env.sendEventBean(new SupportBean("E2", 2));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "E2", 2 });<NEW_LINE>// MySchema already exists, start second statement<NEW_LINE>env.compileDeploy("@name('s1') " + epl, path).addListener("s1");<NEW_LINE>env.undeployModuleContaining("s0");<NEW_LINE>env.sendEventBean(new SupportBean("E3", 3));<NEW_LINE>env.assertPropsNew("s1", fields, new Object[] { "E3", 3 });<NEW_LINE>env.undeployAll();<NEW_LINE>} | [] { "E1", 1 }); |
455,832 | public void marshall(InstanceTypeConfig instanceTypeConfig, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (instanceTypeConfig == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(instanceTypeConfig.getInstanceType(), INSTANCETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceTypeConfig.getWeightedCapacity(), WEIGHTEDCAPACITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceTypeConfig.getBidPrice(), BIDPRICE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(instanceTypeConfig.getEbsConfiguration(), EBSCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceTypeConfig.getConfigurations(), CONFIGURATIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(instanceTypeConfig.getCustomAmiId(), CUSTOMAMIID_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | instanceTypeConfig.getBidPriceAsPercentageOfOnDemandPrice(), BIDPRICEASPERCENTAGEOFONDEMANDPRICE_BINDING); |
285,531 | private Document ticketToDoc(TicketModel ticket) {<NEW_LINE>Document doc = new Document();<NEW_LINE>// repository and document ids for Lucene querying<NEW_LINE>toDocField(doc, Lucene.rid, StringUtils.getSHA1(ticket.repository));<NEW_LINE>toDocField(doc, Lucene.did, StringUtils.getSHA1(ticket.repository + ticket.number));<NEW_LINE>toDocField(doc, Lucene.project, ticket.project);<NEW_LINE>toDocField(doc, Lucene.repository, ticket.repository);<NEW_LINE>toDocField(doc, Lucene.number, ticket.number);<NEW_LINE>toDocField(doc, Lucene.title, ticket.title);<NEW_LINE>toDocField(doc, Lucene.body, ticket.body);<NEW_LINE>toDocField(doc, Lucene.created, ticket.created);<NEW_LINE>toDocField(doc, Lucene.createdby, ticket.createdBy);<NEW_LINE>toDocField(doc, Lucene.updated, ticket.updated);<NEW_LINE>toDocField(doc, Lucene.updatedby, ticket.updatedBy);<NEW_LINE>toDocField(doc, Lucene.responsible, ticket.responsible);<NEW_LINE>toDocField(doc, Lucene.milestone, ticket.milestone);<NEW_LINE>toDocField(doc, Lucene.topic, ticket.topic);<NEW_LINE>toDocField(doc, Lucene.status, ticket.status.name());<NEW_LINE>toDocField(doc, Lucene.comments, ticket.getComments().size());<NEW_LINE>toDocField(doc, Lucene.type, ticket.type == null ? null : ticket.type.name());<NEW_LINE>toDocField(doc, Lucene.mergesha, ticket.mergeSha);<NEW_LINE>toDocField(doc, Lucene.mergeto, ticket.mergeTo);<NEW_LINE>toDocField(doc, Lucene.labels, StringUtils.flattenStrings(ticket.getLabels(), ";").toLowerCase());<NEW_LINE>toDocField(doc, Lucene.participants, StringUtils.flattenStrings(ticket.getParticipants(), ";").toLowerCase());<NEW_LINE>toDocField(doc, Lucene.watchedby, StringUtils.flattenStrings(ticket.getWatchers(), ";").toLowerCase());<NEW_LINE>toDocField(doc, Lucene.mentions, StringUtils.flattenStrings(ticket.getMentions(), ";").toLowerCase());<NEW_LINE>toDocField(doc, Lucene.votes, ticket.getVoters().size());<NEW_LINE>toDocField(doc, Lucene.priority, <MASK><NEW_LINE>toDocField(doc, Lucene.severity, ticket.severity.getValue());<NEW_LINE>List<String> attachments = new ArrayList<String>();<NEW_LINE>for (Attachment attachment : ticket.getAttachments()) {<NEW_LINE>attachments.add(attachment.name.toLowerCase());<NEW_LINE>}<NEW_LINE>toDocField(doc, Lucene.attachments, StringUtils.flattenStrings(attachments, ";"));<NEW_LINE>List<Patchset> patches = ticket.getPatchsets();<NEW_LINE>if (!patches.isEmpty()) {<NEW_LINE>toDocField(doc, Lucene.patchsets, patches.size());<NEW_LINE>Patchset patchset = patches.get(patches.size() - 1);<NEW_LINE>String flat = patchset.number + ":" + patchset.rev + ":" + patchset.tip + ":" + patchset.base + ":" + patchset.commits;<NEW_LINE>doc.add(new org.apache.lucene.document.Field(Lucene.patchset.name(), flat, TextField.TYPE_STORED));<NEW_LINE>}<NEW_LINE>doc.add(new TextField(Lucene.content.name(), ticket.toIndexableString(), Store.NO));<NEW_LINE>return doc;<NEW_LINE>} | ticket.priority.getValue()); |
63,615 | final Cluster executeModifyClusterIamRoles(ModifyClusterIamRolesRequest modifyClusterIamRolesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyClusterIamRolesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyClusterIamRolesRequest> request = null;<NEW_LINE>Response<Cluster> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyClusterIamRolesRequestMarshaller().marshall(super.beforeMarshalling(modifyClusterIamRolesRequest));<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, "Redshift");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ModifyClusterIamRoles");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<Cluster> responseHandler = new StaxResponseHandler<Cluster>(new ClusterStaxUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
1,691,269 | final GetPermissionPolicyResult executeGetPermissionPolicy(GetPermissionPolicyRequest getPermissionPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getPermissionPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<GetPermissionPolicyRequest> request = null;<NEW_LINE>Response<GetPermissionPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetPermissionPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getPermissionPolicyRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "WAF");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPermissionPolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetPermissionPolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetPermissionPolicyResultJsonUnmarshaller());<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); |
1,635,765 | public void createPartControl(Composite parent) {<NEW_LINE>parent.setLayout(UIUtil.formLayout(0, 0));<NEW_LINE>parent.setBackground(ColorUtil.getInstance().getColor(SWT.COLOR_WHITE));<NEW_LINE>canvas = new FigureCanvas(parent);<NEW_LINE>canvas.setScrollBarVisibility(FigureCanvas.NEVER);<NEW_LINE>canvas.setBackground(ColorUtil.getInstance().getColor(SWT.COLOR_WHITE));<NEW_LINE>canvas.setLayoutData(UIUtil.formData(0, leftMargin, 0, 0, 100, 0, 100, 0));<NEW_LINE>canvas.addControlListener(new ControlListener() {<NEW_LINE><NEW_LINE>boolean lock = false;<NEW_LINE><NEW_LINE>public void controlResized(ControlEvent e) {<NEW_LINE>org.eclipse.swt.graphics.Rectangle r = canvas.getClientArea();<NEW_LINE>if (!lock) {<NEW_LINE>lock = true;<NEW_LINE>if (ChartUtil.isShowDescriptionAllowSize(r.height)) {<NEW_LINE>CounterRealCountView.this.setContentDescription(desc);<NEW_LINE>} else {<NEW_LINE>CounterRealCountView.this.setContentDescription("");<NEW_LINE>}<NEW_LINE>r = canvas.getClientArea();<NEW_LINE>lock = false;<NEW_LINE>}<NEW_LINE>if (xyGraph == null)<NEW_LINE>return;<NEW_LINE>xyGraph.setSize(r.width, r.height);<NEW_LINE>trace.setLineWidth(r.width / 30);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void controlMoved(ControlEvent e) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>xyGraph = new XYGraph();<NEW_LINE>xyGraph.setShowLegend(false);<NEW_LINE>canvas.setContents(xyGraph);<NEW_LINE>xyGraph.primaryXAxis.setDateEnabled(false);<NEW_LINE>xyGraph.primaryXAxis.setShowMajorGrid(false);<NEW_LINE>xyGraph.primaryYAxis.setAutoScale(true);<NEW_LINE>xyGraph.primaryYAxis.setShowMajorGrid(true);<NEW_LINE>xyGraph.primaryXAxis.setTitle("");<NEW_LINE>xyGraph.primaryYAxis.setTitle("");<NEW_LINE>traceDataProvider = new CircularBufferDataProvider(true);<NEW_LINE>traceDataProvider.setBufferSize(24);<NEW_LINE>traceDataProvider.setCurrentXDataArray(new double[] {});<NEW_LINE>traceDataProvider.setCurrentYDataArray(new double[] {});<NEW_LINE>this.xyGraph.primaryXAxis.setRange(0, 24);<NEW_LINE>// create the trace<NEW_LINE>trace = new Trace("temp", xyGraph.primaryXAxis, xyGraph.primaryYAxis, traceDataProvider);<NEW_LINE>// set trace property<NEW_LINE><MASK><NEW_LINE>// trace.getXAxis().setFormatPattern("HH");<NEW_LINE>trace.getYAxis().setFormatPattern("#,##0");<NEW_LINE>trace.setLineWidth(15);<NEW_LINE>trace.setTraceType(TraceType.BAR);<NEW_LINE>trace.setAreaAlpha(200);<NEW_LINE>// add the trace to xyGraph<NEW_LINE>xyGraph.addTrace(trace);<NEW_LINE>restoreState();<NEW_LINE>} | trace.setPointStyle(PointStyle.NONE); |
1,151,022 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>jPanel1 = new javax.swing.JPanel();<NEW_LINE>jLabel1 = new javax.swing.JLabel();<NEW_LINE>userAgentInput = new javax.swing.JTextField();<NEW_LINE>jLabel2 = new javax.swing.JLabel();<NEW_LINE>cookieJarInput = new javax.swing.JTextField();<NEW_LINE>jButton1 = new javax.swing.JButton();<NEW_LINE>setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);<NEW_LINE>setTitle("JAV L");<NEW_LINE>setLocationByPlatform(true);<NEW_LINE>setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);<NEW_LINE>setPreferredSize(new java.awt.Dimension(500, 150));<NEW_LINE>jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Para"));<NEW_LINE>jPanel1.setLayout(new java.awt<MASK><NEW_LINE>jLabel1.setText("User Agent");<NEW_LINE>jPanel1.add(jLabel1);<NEW_LINE>userAgentInput.setToolTipText("The user agent used to generate to cookie jar.\n\nExemple: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0");<NEW_LINE>jPanel1.add(userAgentInput);<NEW_LINE>jLabel2.setText("Cookie jar file");<NEW_LINE>jPanel1.add(jLabel2);<NEW_LINE>cookieJarInput.setToolTipText("The path to the cookie jar file.\n\nCookie jar is curl formatted. One can use cookies.txt plugin for firefox to generate this file");<NEW_LINE>cookieJarInput.addMouseListener(new java.awt.event.MouseAdapter() {<NEW_LINE><NEW_LINE>public void mouseClicked(java.awt.event.MouseEvent evt) {<NEW_LINE>cookieJarInputMouseClicked(evt);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>jPanel1.add(cookieJarInput);<NEW_LINE>getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);<NEW_LINE>jButton1.setText("OK");<NEW_LINE>jButton1.addActionListener(new java.awt.event.ActionListener() {<NEW_LINE><NEW_LINE>public void actionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>jButton1ActionPerformed(evt);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>getContentPane().add(jButton1, java.awt.BorderLayout.SOUTH);<NEW_LINE>pack();<NEW_LINE>} | .GridLayout(0, 2)); |
1,130,897 | @Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@Operation(description = "Review group membership and take action to either extend and/or delete existing members.")<NEW_LINE>public void putGroupReview(@Parameter(description = "name of the domain", required = true) @PathParam("domainName") String domainName, @Parameter(description = "name of the group", required = true) @PathParam("groupName") String groupName, @Parameter(description = "Audit param required(not empty) if domain auditEnabled is true.", required = true) @HeaderParam("Y-Audit-Ref") String auditRef, @Parameter(description = "Group object with updated and/or deleted members", required = true) Group group) {<NEW_LINE>int code = ResourceException.OK;<NEW_LINE>ResourceContext context = null;<NEW_LINE>try {<NEW_LINE>context = this.delegate.newResourceContext(this.<MASK><NEW_LINE>context.authorize("update", "" + domainName + ":group." + groupName + "", null);<NEW_LINE>this.delegate.putGroupReview(context, domainName, groupName, auditRef, group);<NEW_LINE>} catch (ResourceException e) {<NEW_LINE>code = e.getCode();<NEW_LINE>switch(code) {<NEW_LINE>case ResourceException.BAD_REQUEST:<NEW_LINE>throw typedException(code, e, ResourceError.class);<NEW_LINE>case ResourceException.CONFLICT:<NEW_LINE>throw typedException(code, e, ResourceError.class);<NEW_LINE>case ResourceException.FORBIDDEN:<NEW_LINE>throw typedException(code, e, ResourceError.class);<NEW_LINE>case ResourceException.NOT_FOUND:<NEW_LINE>throw typedException(code, e, ResourceError.class);<NEW_LINE>case ResourceException.TOO_MANY_REQUESTS:<NEW_LINE>throw typedException(code, e, ResourceError.class);<NEW_LINE>case ResourceException.UNAUTHORIZED:<NEW_LINE>throw typedException(code, e, ResourceError.class);<NEW_LINE>default:<NEW_LINE>System.err.println("*** Warning: undeclared exception (" + code + ") for resource putGroupReview");<NEW_LINE>throw typedException(code, e, ResourceError.class);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>this.delegate.publishChangeMessage(context, code);<NEW_LINE>this.delegate.recordMetrics(context, code);<NEW_LINE>}<NEW_LINE>} | request, this.response, "putGroupReview"); |
1,073,767 | public static void process(GrayS16 src, final int kerA, final int kerB, GrayS16 derivX, GrayS16 derivY) {<NEW_LINE>final short[] data = src.data;<NEW_LINE>final short[] imgX = derivX.data;<NEW_LINE>final short[] imgY = derivY.data;<NEW_LINE>final int width = src.getWidth();<NEW_LINE>final int height = src.getHeight() - 1;<NEW_LINE>final int strideSrc = src.getStride();<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(1,height,y->{<NEW_LINE>for (int y = 1; y < height; y++) {<NEW_LINE>int indexSrc = src.startIndex + src.stride * y + 1;<NEW_LINE>final int endX = indexSrc + width - 2;<NEW_LINE>int indexX = derivX.startIndex + derivX.stride * y + 1;<NEW_LINE>int indexY = derivY.startIndex + derivY.stride * y + 1;<NEW_LINE>int a11, a12, a21, a22, a31, a32;<NEW_LINE>a11 = data[indexSrc - strideSrc - 1];<NEW_LINE>a12 = data[indexSrc - strideSrc];<NEW_LINE>a21 = data[indexSrc - 1];<NEW_LINE>a22 = data[indexSrc];<NEW_LINE>a31 = data[indexSrc + strideSrc - 1];<NEW_LINE>a32 = data[indexSrc + strideSrc];<NEW_LINE>for (; indexSrc < endX; indexSrc++) {<NEW_LINE>int a13 = data[indexSrc - strideSrc + 1];<NEW_LINE>int a23 = data[indexSrc + 1];<NEW_LINE>int a33 = data[indexSrc + strideSrc + 1];<NEW_LINE>int v = (a33 - a11) * kerA;<NEW_LINE>int w = (a31 - a13) * kerA;<NEW_LINE>imgY[indexY++] = (short) ((a32 - a12) * kerB + v + w);<NEW_LINE>imgX[indexX++] = (short) ((a23 - a21<MASK><NEW_LINE>a11 = a12;<NEW_LINE>a12 = a13;<NEW_LINE>a21 = a22;<NEW_LINE>a22 = a23;<NEW_LINE>a31 = a32;<NEW_LINE>a32 = a33;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | ) * kerB + v - w); |
213,243 | public void parseScope(Element scopeElement, ScopeImpl parentScope) {<NEW_LINE>// Not yet supported on process level (PVM additions needed):<NEW_LINE>// parseProperties(processElement);<NEW_LINE>// filter activities that must be parsed separately<NEW_LINE>List<Element> activityElements = new ArrayList<>(scopeElement.elements());<NEW_LINE>Map<String, Element> intermediateCatchEvents = filterIntermediateCatchEvents(activityElements);<NEW_LINE>activityElements.removeAll(intermediateCatchEvents.values());<NEW_LINE>Map<String, Element> compensationHandlers = filterCompensationHandlers(activityElements);<NEW_LINE>activityElements.removeAll(compensationHandlers.values());<NEW_LINE>parseStartEvents(scopeElement, parentScope);<NEW_LINE>parseActivities(activityElements, scopeElement, parentScope);<NEW_LINE><MASK><NEW_LINE>parseEndEvents(scopeElement, parentScope);<NEW_LINE>parseBoundaryEvents(scopeElement, parentScope);<NEW_LINE>parseSequenceFlow(scopeElement, parentScope, compensationHandlers);<NEW_LINE>parseExecutionListenersOnScope(scopeElement, parentScope);<NEW_LINE>parseAssociations(scopeElement, parentScope, compensationHandlers);<NEW_LINE>parseCompensationHandlers(parentScope, compensationHandlers);<NEW_LINE>for (ScopeImpl.BacklogErrorCallback callback : parentScope.getBacklogErrorCallbacks()) {<NEW_LINE>callback.callback();<NEW_LINE>}<NEW_LINE>if (parentScope instanceof ProcessDefinition) {<NEW_LINE>parseProcessDefinitionCustomExtensions(scopeElement, (ProcessDefinition) parentScope);<NEW_LINE>}<NEW_LINE>} | parseIntermediateCatchEvents(scopeElement, parentScope, intermediateCatchEvents); |
442,063 | private void verifyAggregations(QuerySpecification node, Scope sourceScope, Optional<Scope> orderByScope, List<Expression> groupByExpressions, List<Expression> outputExpressions, List<Expression> orderByExpressions) {<NEW_LINE>checkState(orderByExpressions.isEmpty() || <MASK><NEW_LINE>if (analysis.isAggregation(node)) {<NEW_LINE>// ensure SELECT, ORDER BY and HAVING are constant with respect to group<NEW_LINE>// e.g, these are all valid expressions:<NEW_LINE>// SELECT f(a) GROUP BY a<NEW_LINE>// SELECT f(a + 1) GROUP BY a + 1<NEW_LINE>// SELECT a + sum(b) GROUP BY a<NEW_LINE>List<Expression> distinctGroupingColumns = groupByExpressions.stream().distinct().collect(toImmutableList());<NEW_LINE>for (Expression expression : outputExpressions) {<NEW_LINE>verifySourceAggregations(distinctGroupingColumns, sourceScope, expression, metadata, analysis, warningCollector, session);<NEW_LINE>}<NEW_LINE>for (Expression expression : orderByExpressions) {<NEW_LINE>verifyOrderByAggregations(distinctGroupingColumns, sourceScope, orderByScope.get(), expression, metadata, analysis, warningCollector, session);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | orderByScope.isPresent(), "non-empty orderByExpressions list without orderByScope provided"); |
1,641,769 | protected PropertyChangeListener createPropertyChangeListener() {<NEW_LINE><MASK><NEW_LINE>return e -> {<NEW_LINE>superListener.propertyChange(e);<NEW_LINE>switch(e.getPropertyName()) {<NEW_LINE>case FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS:<NEW_LINE>JScrollBar vsb = scrollpane.getVerticalScrollBar();<NEW_LINE>JScrollBar hsb = scrollpane.getHorizontalScrollBar();<NEW_LINE>if (vsb != null) {<NEW_LINE>vsb.revalidate();<NEW_LINE>vsb.repaint();<NEW_LINE>}<NEW_LINE>if (hsb != null) {<NEW_LINE>hsb.revalidate();<NEW_LINE>hsb.repaint();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ScrollPaneConstants.LOWER_LEFT_CORNER:<NEW_LINE>case ScrollPaneConstants.LOWER_RIGHT_CORNER:<NEW_LINE>case ScrollPaneConstants.UPPER_LEFT_CORNER:<NEW_LINE>case ScrollPaneConstants.UPPER_RIGHT_CORNER:<NEW_LINE>// remove border from buttons added to corners<NEW_LINE>Object corner = e.getNewValue();<NEW_LINE>if (corner instanceof JButton && ((JButton) corner).getBorder() instanceof FlatButtonBorder && scrollpane.getViewport() != null && scrollpane.getViewport().getView() instanceof JTable) {<NEW_LINE>((JButton) corner).setBorder(BorderFactory.createEmptyBorder());<NEW_LINE>((JButton) corner).setFocusable(false);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case FlatClientProperties.OUTLINE:<NEW_LINE>scrollpane.repaint();<NEW_LINE>break;<NEW_LINE>case FlatClientProperties.STYLE:<NEW_LINE>case FlatClientProperties.STYLE_CLASS:<NEW_LINE>installStyle();<NEW_LINE>scrollpane.revalidate();<NEW_LINE>scrollpane.repaint();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | PropertyChangeListener superListener = super.createPropertyChangeListener(); |
560,653 | public void run() {<NEW_LINE>try {<NEW_LINE>log.info("Running {}", getName());<NEW_LINE>// Create the update lambda.<NEW_LINE>Universe.UniverseUpdater updater = universe -> {<NEW_LINE>// If this universe is not being edited, fail the request.<NEW_LINE>UniverseDefinitionTaskParams universeDetails = universe.getUniverseDetails();<NEW_LINE>if (!universeDetails.updateInProgress) {<NEW_LINE>String errMsg = "UserUniverse " <MASK><NEW_LINE>log.error(errMsg);<NEW_LINE>throw new RuntimeException(errMsg);<NEW_LINE>}<NEW_LINE>UniverseDefinitionTaskParams.UserIntent userIntent = universeDetails.getPrimaryCluster().userIntent;<NEW_LINE>userIntent.enableNodeToNodeEncrypt = taskParams().enableNodeToNodeEncrypt;<NEW_LINE>userIntent.enableClientToNodeEncrypt = taskParams().enableClientToNodeEncrypt;<NEW_LINE>universeDetails.allowInsecure = taskParams().allowInsecure;<NEW_LINE>universeDetails.rootCA = null;<NEW_LINE>universeDetails.clientRootCA = null;<NEW_LINE>universeDetails.rootAndClientRootCASame = taskParams().rootAndClientRootCASame;<NEW_LINE>if (EncryptionInTransitUtil.isRootCARequired(taskParams())) {<NEW_LINE>universeDetails.rootCA = taskParams().rootCA;<NEW_LINE>}<NEW_LINE>if (EncryptionInTransitUtil.isClientRootCARequired(taskParams())) {<NEW_LINE>universeDetails.clientRootCA = taskParams().clientRootCA;<NEW_LINE>}<NEW_LINE>universe.setUniverseDetails(universeDetails);<NEW_LINE>};<NEW_LINE>// Perform the update. If unsuccessful, this will throw a runtime<NEW_LINE>// exception which we do not catch as we want to fail.<NEW_LINE>saveUniverseDetails(updater);<NEW_LINE>} catch (Exception e) {<NEW_LINE>String msg = getName() + " failed with exception " + e.getMessage();<NEW_LINE>log.warn(msg, e.getMessage());<NEW_LINE>throw new RuntimeException(msg, e);<NEW_LINE>}<NEW_LINE>} | + taskParams().universeUUID + " is not being edited."; |
679,054 | public static void openObjectEditor(@NotNull EntityDiagram diagram, @NotNull ERDObject object) {<NEW_LINE>Object dbObject = object.getObject();<NEW_LINE>if (dbObject instanceof DBSObject) {<NEW_LINE>UIUtils.runUIJob("Open object editor", monitor -> {<NEW_LINE>if (!(dbObject instanceof DBSEntity) && OPEN_OBJECT_PROPERTIES) {<NEW_LINE>try {<NEW_LINE>IWorkbenchPage activePage = UIUtils.getActiveWorkbenchWindow().getActivePage();<NEW_LINE>IViewPart propsView = activePage.showView(IPageLayout.ID_PROP_SHEET);<NEW_LINE>if (propsView != null) {<NEW_LINE>propsView.setFocus();<NEW_LINE>}<NEW_LINE>} catch (PartInitException e) {<NEW_LINE>DBWorkbench.getPlatformUI().<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>DBNDatabaseNode node = DBNUtils.getNodeByObject(monitor, (DBSObject) dbObject, true);<NEW_LINE>if (node != null) {<NEW_LINE>NavigatorUtils.openNavigatorNode(node, UIUtils.getActiveWorkbenchWindow());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | showError("Object open", "Can't open property view", e); |
1,289,683 | // State and error message updates to tasks are done in this method instead of waitForSubTasks<NEW_LINE>// because nobody is waiting for the parent task.<NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>Throwable t = null;<NEW_LINE>TaskType taskType = taskInfo.getTaskType();<NEW_LINE>taskStartTime = Instant.now();<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>if (getAbortTime() != null) {<NEW_LINE>throw new CancellationException("Task " + task.getName() + " is aborted");<NEW_LINE>}<NEW_LINE>publishBeforeTask();<NEW_LINE>setTaskState(TaskInfo.State.Running);<NEW_LINE>log.debug("Invoking run() of task {}", task.getName());<NEW_LINE>task.run();<NEW_LINE>setTaskState(TaskInfo.State.Success);<NEW_LINE>} catch (CancellationException e) {<NEW_LINE>t = e;<NEW_LINE>updateTaskDetailsOnError(TaskInfo.State.Aborted, e);<NEW_LINE>throw e;<NEW_LINE>} catch (Exception e) {<NEW_LINE>t = e;<NEW_LINE>updateTaskDetailsOnError(TaskInfo.State.Failure, e);<NEW_LINE>Throwables.propagate(e);<NEW_LINE>} finally {<NEW_LINE>taskCompletionTime = Instant.now();<NEW_LINE>writeTaskStateMetric(taskType, taskStartTime, taskCompletionTime, getTaskState());<NEW_LINE>publishAfterTask(t);<NEW_LINE>task.terminate();<NEW_LINE>}<NEW_LINE>} | writeTaskWaitMetric(taskType, taskScheduledTime, taskStartTime); |
968,255 | // Copy pixel data from one PixelBuffer location to another<NEW_LINE>public void copyRect(Rect rect, Point move_by_delta) {<NEW_LINE>Raster srcData;<NEW_LINE>WritableRaster dstData;<NEW_LINE>Rect drect, srect;<NEW_LINE>drect = new Rect(rect.tl, rect.br);<NEW_LINE>if (!drect.enclosed_by(getRect())) {<NEW_LINE>String msg = "Destination rect %dx%d at %d,%d exceeds framebuffer %dx%d";<NEW_LINE>vlog.error(String.format(msg, drect.width(), drect.height(), drect.tl.x, drect.tl.y, width(), height()));<NEW_LINE>drect = <MASK><NEW_LINE>}<NEW_LINE>if (drect.is_empty())<NEW_LINE>return;<NEW_LINE>srect = drect.translate(move_by_delta.negate());<NEW_LINE>if (!srect.enclosed_by(getRect())) {<NEW_LINE>String msg = "Source rect %dx%d at %d,%d exceeds framebuffer %dx%d";<NEW_LINE>vlog.error(String.format(msg, srect.width(), srect.height(), srect.tl.x, srect.tl.y, width(), height()));<NEW_LINE>srect = srect.intersect(getRect());<NEW_LINE>// Need to readjust the destination now that the area has changed<NEW_LINE>drect = srect.translate(move_by_delta);<NEW_LINE>}<NEW_LINE>if (srect.is_empty())<NEW_LINE>return;<NEW_LINE>srcData = getBuffer(srect);<NEW_LINE>dstData = getBufferRW(drect);<NEW_LINE>synchronized (image) {<NEW_LINE>dstData.setDataElements(0, 0, srcData);<NEW_LINE>}<NEW_LINE>commitBufferRW(rect);<NEW_LINE>} | drect.intersect(getRect()); |
1,426,065 | public JobDetails unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>JobDetails jobDetails = new JobDetails();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("TranslatedDocumentsCount", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>jobDetails.setTranslatedDocumentsCount(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("DocumentsWithErrorsCount", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>jobDetails.setDocumentsWithErrorsCount(context.getUnmarshaller(Integer.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("InputDocumentsCount", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>jobDetails.setInputDocumentsCount(context.getUnmarshaller(Integer.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 jobDetails;<NEW_LINE>} | class).unmarshall(context)); |
1,823,165 | protected void appendDocumentHeader(HTMLConversionContext conversionContext, Document document, Element documentRoot) throws Docx4JException {<NEW_LINE>Element headEl = document.createElement("head");<NEW_LINE>Element meta = document.createElement("meta");<NEW_LINE>Element element = null;<NEW_LINE>StringBuilder buffer = new StringBuilder(10240);<NEW_LINE>String userCSS = conversionContext.getUserCSS();<NEW_LINE>String userScript = conversionContext.getUserScript();<NEW_LINE>boolean hasDefaultHeader = false;<NEW_LINE>boolean hasDefaultFooter = false;<NEW_LINE>documentRoot.appendChild(headEl);<NEW_LINE>meta.setAttribute("http-equiv", "Content-Type");<NEW_LINE><MASK><NEW_LINE>headEl.appendChild(meta);<NEW_LINE>// TODO: This doesn't quite work as the defaultHeader and defaultFooter are per section,<NEW_LINE>// but this definition is on the document level.<NEW_LINE>// To access the first section, we have to call first a next() and later return to start()<NEW_LINE>try {<NEW_LINE>conversionContext.getSections().next();<NEW_LINE>hasDefaultHeader = XsltCommonFunctions.hasDefaultHeader(conversionContext);<NEW_LINE>hasDefaultFooter = XsltCommonFunctions.hasDefaultHeader(conversionContext);<NEW_LINE>} finally {<NEW_LINE>conversionContext.getSections().start();<NEW_LINE>}<NEW_LINE>HtmlCssHelper.createDefaultCss(hasDefaultHeader, hasDefaultFooter, buffer);<NEW_LINE>HtmlCssHelper.createCssForStyles(conversionContext.getWmlPackage(), conversionContext.getStyleTree(), buffer);<NEW_LINE>if ((userCSS != null) && (userCSS.length() > 0)) {<NEW_LINE>buffer.append(userCSS);<NEW_LINE>}<NEW_LINE>element = conversionContext.createStyleElement(document, buffer.toString());<NEW_LINE>if (element != null) {<NEW_LINE>headEl.appendChild(element);<NEW_LINE>}<NEW_LINE>buffer.setLength(0);<NEW_LINE>HtmlScriptHelper.createDefaultScript(buffer);<NEW_LINE>if ((userScript != null) && (userScript.length() > 0)) {<NEW_LINE>buffer.append(userScript);<NEW_LINE>}<NEW_LINE>element = conversionContext.createScriptElement(document, buffer.toString());<NEW_LINE>if (element != null) {<NEW_LINE>headEl.appendChild(element);<NEW_LINE>}<NEW_LINE>} | meta.setAttribute("content", "text/html; charset=utf-8"); |
1,325,878 | private Channel buildChannel(List<Article> articles) {<NEW_LINE>Channel channel = new Channel("rss_2.0");<NEW_LINE>channel.setLink("http://localhost:8080/spring-mvc-simple/rss");<NEW_LINE>channel.setTitle("Article Feed");<NEW_LINE>channel.setDescription("Article Feed Description");<NEW_LINE>channel.setPubDate(new Date());<NEW_LINE>List<Item> items = new ArrayList<>();<NEW_LINE>for (Article article : articles) {<NEW_LINE>Item item = new Item();<NEW_LINE>item.setLink(article.getLink());<NEW_LINE>item.setTitle(article.getTitle());<NEW_LINE>Description description1 = new Description();<NEW_LINE>description1.setValue(article.getDescription());<NEW_LINE>item.setDescription(description1);<NEW_LINE>item.setPubDate(article.getPublishedDate());<NEW_LINE>item.<MASK><NEW_LINE>items.add(item);<NEW_LINE>}<NEW_LINE>channel.setItems(items);<NEW_LINE>return channel;<NEW_LINE>} | setAuthor(article.getAuthor()); |
187,300 | private ComponentPreset extractNoseCone() {<NEW_LINE>TypedPropertyMap props = new TypedPropertyMap();<NEW_LINE>try {<NEW_LINE>props.put(ComponentPreset.TYPE, ComponentPreset.Type.NOSE_CONE);<NEW_LINE>props.put(ComponentPreset.AFT_OUTER_DIAMETER, ncAftDia.getValue());<NEW_LINE>props.put(ComponentPreset.<MASK><NEW_LINE>props.put(ComponentPreset.AFT_SHOULDER_LENGTH, ncAftShoulderLen.getValue());<NEW_LINE>props.put(ComponentPreset.DESCRIPTION, ncDescTextField.getText());<NEW_LINE>props.put(ComponentPreset.PARTNO, ncPartNoTextField.getText());<NEW_LINE>props.put(ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer(mfgTextField.getText()));<NEW_LINE>props.put(ComponentPreset.LENGTH, ncLength.getValue());<NEW_LINE>props.put(ComponentPreset.SHAPE, Transition.Shape.toShape((String) ncShapeCB.getSelectedItem()));<NEW_LINE>final Material material = (Material) materialChooser.getSelectedItem();<NEW_LINE>if (material != null) {<NEW_LINE>props.put(ComponentPreset.MATERIAL, material);<NEW_LINE>} else {<NEW_LINE>JOptionPane.showMessageDialog(null, "A material must be selected.", "Error", JOptionPane.ERROR_MESSAGE);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>props.put(ComponentPreset.MASS, ncMass.getValue());<NEW_LINE>props.put(ComponentPreset.FILLED, ncFilledCB.isSelected());<NEW_LINE>if (ncImage != null) {<NEW_LINE>props.put(ComponentPreset.IMAGE, imageToByteArray(ncImage.getImage()));<NEW_LINE>}<NEW_LINE>return ComponentPresetFactory.create(props);<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>JOptionPane.showMessageDialog(null, "Could not convert nose cone attribute.", "Error", JOptionPane.ERROR_MESSAGE);<NEW_LINE>} catch (InvalidComponentPresetException e) {<NEW_LINE>JOptionPane.showMessageDialog(null, craftErrorMessage(e, "Mandatory nose cone attribute not set."), "Error", JOptionPane.ERROR_MESSAGE);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | AFT_SHOULDER_DIAMETER, ncAftShoulderDia.getValue()); |
173,896 | protected final void executeTask() {<NEW_LINE>final CompletableFuture<R> promise = new CompletableFuture<>();<NEW_LINE>responseStream = sendRequest();<NEW_LINE>responseStream.then(stream -> {<NEW_LINE>// Start the timeout now that the request has actually been sent<NEW_LINE>ethContext.getScheduler(<MASK><NEW_LINE>stream.then((streamClosed, message, peer1) -> handleMessage(promise, streamClosed, message, peer1));<NEW_LINE>}, promise::completeExceptionally);<NEW_LINE>promise.whenComplete((r, t) -> {<NEW_LINE>final Optional<RequestManager.ResponseStream> responseStream = this.responseStream.abort();<NEW_LINE>if (t != null) {<NEW_LINE>t = ExceptionUtils.rootCause(t);<NEW_LINE>if (t instanceof TimeoutException && responseStream.isPresent()) {<NEW_LINE>responseStream.get().getPeer().recordRequestTimeout(requestCode);<NEW_LINE>}<NEW_LINE>result.completeExceptionally(t);<NEW_LINE>} else if (r != null) {<NEW_LINE>// If we got a response we must have had a response stream...<NEW_LINE>result.complete(new PeerTaskResult<>(responseStream.get().getPeer(), r));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | ).failAfterTimeout(promise, timeout); |
869,871 | // //<NEW_LINE>// MOUSE MOTION LISTENER<NEW_LINE>@Override<NEW_LINE>public void mouseDragged(MouseEvent e) {<NEW_LINE>if (SwingUtilities.isLeftMouseButton(e)) {<NEW_LINE>Point imagePosition = getScaledImagePosition();<NEW_LINE>int x = (int) ((e.getX() - imagePosition.x) / scale.getScale() - dragOffsetX);<NEW_LINE>int y = (int) ((e.getY() - imagePosition.y) / scale.getScale() - dragOffsetY);<NEW_LINE>int oldOffsetX = gridOffsetX;<NEW_LINE>int oldOffsetY = gridOffsetY;<NEW_LINE>gridOffsetX = x % gridSize;<NEW_LINE>gridOffsetY = y % gridSize;<NEW_LINE>if (gridOffsetY > 0) {<NEW_LINE>gridOffsetY = gridOffsetY - gridSize;<NEW_LINE>}<NEW_LINE>if (gridOffsetX > 0) {<NEW_LINE>gridOffsetX = gridOffsetX - gridSize;<NEW_LINE>}<NEW_LINE>repaint();<NEW_LINE>propertyChangeSupport.<MASK><NEW_LINE>propertyChangeSupport.firePropertyChange(PROPERTY_GRID_OFFSET_Y, oldOffsetY, gridOffsetY);<NEW_LINE>} else {<NEW_LINE>int offsetX = scale.getOffsetX() + e.getX() - dragStartX;<NEW_LINE>int offsetY = scale.getOffsetY() + e.getY() - dragStartY;<NEW_LINE>scale.setOffset(offsetX, offsetY);<NEW_LINE>dragStartX = e.getX();<NEW_LINE>dragStartY = e.getY();<NEW_LINE>repaint();<NEW_LINE>}<NEW_LINE>} | firePropertyChange(PROPERTY_GRID_OFFSET_X, oldOffsetX, gridOffsetX); |
1,394,968 | public boolean onTouch(View view, MotionEvent motionEvent) {<NEW_LINE>// How long to hold your finger in place to trigger the app menu.<NEW_LINE>final int LONG_PRESS_DELAY = 250;<NEW_LINE>if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {<NEW_LINE>startTime = motionEvent.getEventTime();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// No need to do any extra work while dragging<NEW_LINE>if (isDragging) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>long holdTime = motionEvent.getEventTime() - startTime;<NEW_LINE>if (holdTime > LONG_PRESS_DELAY) {<NEW_LINE>// Long press, either drag or context menu<NEW_LINE>int intCurrentY = Math.round(motionEvent.getY());<NEW_LINE>int intCurrentX = Math.round(motionEvent.getX());<NEW_LINE>int intStartY = motionEvent.getHistorySize() > 0 ? Math.round(motionEvent.getHistoricalY(0)) : intCurrentY;<NEW_LINE>int intStartX = motionEvent.getHistorySize() > 0 ? Math.round(motionEvent.getHistoricalX(0)) : intCurrentX;<NEW_LINE>// How much you need to move your finger to be considered "moving"<NEW_LINE>int MOVE_SENSITIVITY = 8;<NEW_LINE>boolean hasMoved = (Math.abs(intCurrentX - intStartX) > MOVE_SENSITIVITY) || (Math.abs(intCurrentY - intStartY) > MOVE_SENSITIVITY);<NEW_LINE>if (hasMoved && mDragEnabled && !isDragging) {<NEW_LINE>view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);<NEW_LINE>mDragEnabled = false;<NEW_LINE>mainActivity.dismissPopup();<NEW_LINE>mainActivity.closeContextMenu();<NEW_LINE>mainActivity.favoritesBar.setOnDragListener(this);<NEW_LINE>View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);<NEW_LINE><MASK><NEW_LINE>isDragging = true;<NEW_LINE>view.cancelLongPress();<NEW_LINE>view.startDrag(null, shadowBuilder, view, 0);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | view.setVisibility(View.INVISIBLE); |
369,443 | private void pushLaunchPopup() {<NEW_LINE>Config config = context.get(Config.class);<NEW_LINE>TelemetryConfig telemetryConfig = config.getTelemetryConfig();<NEW_LINE>TranslationSystem translationSystem = <MASK><NEW_LINE>TelemetryLogstashAppender appender = TelemetryUtils.fetchTelemetryLogstashAppender();<NEW_LINE>if (!telemetryConfig.isLaunchPopupDisabled()) {<NEW_LINE>String telemetryTitle = translationSystem.translate("${engine:menu#telemetry-launch-popup-title}");<NEW_LINE>String telemetryMessage = translationSystem.translate("${engine:menu#telemetry-launch-popup-text}");<NEW_LINE>LaunchPopup telemetryConfirmPopup = nuiManager.pushScreen(LaunchPopup.ASSET_URI, LaunchPopup.class);<NEW_LINE>telemetryConfirmPopup.setMessage(telemetryTitle, telemetryMessage);<NEW_LINE>telemetryConfirmPopup.setYesHandler(() -> {<NEW_LINE>telemetryConfig.setTelemetryAndErrorReportingEnable(true);<NEW_LINE>// Enable error reporting<NEW_LINE>appender.start();<NEW_LINE>});<NEW_LINE>telemetryConfirmPopup.setNoHandler(() -> {<NEW_LINE>telemetryConfig.setTelemetryAndErrorReportingEnable(false);<NEW_LINE>// Disable error reporting<NEW_LINE>appender.stop();<NEW_LINE>});<NEW_LINE>telemetryConfirmPopup.setOptionButtonText(translationSystem.translate("${engine:menu#telemetry-button}"));<NEW_LINE>telemetryConfirmPopup.setOptionHandler(() -> {<NEW_LINE>nuiManager.pushScreen(TelemetryScreen.ASSET_URI, TelemetryScreen.class);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | context.get(TranslationSystem.class); |
359,929 | public void complete(LineReader reader, ParsedLine commandLine, final List<Candidate> candidates) {<NEW_LINE>assert commandLine != null;<NEW_LINE>assert candidates != null;<NEW_LINE>String buffer = commandLine.word().substring(0, commandLine.wordCursor());<NEW_LINE>Path current;<NEW_LINE>String curBuf;<NEW_LINE>String sep = getSeparator(reader.isSet(LineReader.Option.USE_FORWARD_SLASH));<NEW_LINE>int lastSep = buffer.lastIndexOf(sep);<NEW_LINE>try {<NEW_LINE>if (lastSep >= 0) {<NEW_LINE>curBuf = buffer.substring(0, lastSep + 1);<NEW_LINE>if (curBuf.startsWith("~")) {<NEW_LINE>if (curBuf.startsWith("~" + sep)) {<NEW_LINE>current = getUserHome().resolve(curBuf.substring(2));<NEW_LINE>} else {<NEW_LINE>current = getUserHome().getParent().resolve(curBuf.substring(1));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>current = <MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>curBuf = "";<NEW_LINE>current = getUserDir();<NEW_LINE>}<NEW_LINE>try (DirectoryStream<Path> directory = Files.newDirectoryStream(current, this::accept)) {<NEW_LINE>directory.forEach(p -> {<NEW_LINE>String value = curBuf + p.getFileName().toString();<NEW_LINE>if (Files.isDirectory(p)) {<NEW_LINE>candidates.add(new Candidate(value + (reader.isSet(LineReader.Option.AUTO_PARAM_SLASH) ? sep : ""), getDisplay(reader.getTerminal(), p), null, null, reader.isSet(LineReader.Option.AUTO_REMOVE_SLASH) ? sep : null, null, false));<NEW_LINE>} else {<NEW_LINE>candidates.add(new Candidate(value, getDisplay(reader.getTerminal(), p), null, null, null, null, true));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Ignore<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// Ignore<NEW_LINE>}<NEW_LINE>} | getUserDir().resolve(curBuf); |
864,898 | public static String generate(List<String> headers, List<AsciiTableAlignment> alignments, List<? extends List<String>> cells) {<NEW_LINE>int colCount = alignments.size();<NEW_LINE>int rowCount = cells.size();<NEW_LINE>ArgChecker.isTrue(headers.size() == colCount, "Number of headers {} must match number of alignments {}", headers.size(), colCount);<NEW_LINE>// find max length of each column<NEW_LINE>int[] colLengths = new int[colCount];<NEW_LINE>for (int colIdx = 0; colIdx < colCount; colIdx++) {<NEW_LINE>colLengths[colIdx] = headers.get(colIdx).length();<NEW_LINE>}<NEW_LINE>for (int rowIdx = 0; rowIdx < rowCount; rowIdx++) {<NEW_LINE>List<String> row = cells.get(rowIdx);<NEW_LINE>ArgChecker.isTrue(row.size() == colCount, "Table of cells has incorrect number of columns {} in row {}", row.size(), rowIdx);<NEW_LINE>for (int colIdx = 0; colIdx < colCount; colIdx++) {<NEW_LINE>colLengths[colIdx] = Math.max(colLengths[colIdx], row.get<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// allow for last vertical separator and windows line separator<NEW_LINE>int colTotalLength = 3;<NEW_LINE>for (int colIdx = 0; colIdx < colCount; colIdx++) {<NEW_LINE>// each column has two spaces and a vertical separator<NEW_LINE>colTotalLength += colLengths[colIdx] + 3;<NEW_LINE>}<NEW_LINE>// write table<NEW_LINE>StringBuilder buf = new StringBuilder((rowCount + 3) * colTotalLength);<NEW_LINE>writeSeparatorLine(buf, colLengths);<NEW_LINE>writeDataLine(buf, colLengths, alignments, headers);<NEW_LINE>writeSeparatorLine(buf, colLengths);<NEW_LINE>for (int rowIdx = 0; rowIdx < rowCount; rowIdx++) {<NEW_LINE>writeDataLine(buf, colLengths, alignments, cells.get(rowIdx));<NEW_LINE>}<NEW_LINE>writeSeparatorLine(buf, colLengths);<NEW_LINE>return buf.toString();<NEW_LINE>} | (colIdx).length()); |
955,138 | Method doLookup(Klass klass, String key, boolean publicOnly, boolean isStatic, int arity) throws ArityException {<NEW_LINE>String methodName;<NEW_LINE>String signature = null;<NEW_LINE>int separatorIndex = key.indexOf(METHOD_SELECTION_SEPARATOR);<NEW_LINE>if (separatorIndex >= 0) {<NEW_LINE>methodName = key.substring(0, separatorIndex);<NEW_LINE>signature = key.substring(separatorIndex + 1);<NEW_LINE>} else {<NEW_LINE>methodName = key;<NEW_LINE>}<NEW_LINE>Method result = null;<NEW_LINE>int minOverallArity = Integer.MAX_VALUE;<NEW_LINE>int maxOverallArity = -1;<NEW_LINE>for (Method.MethodVersion m : getMethodArray(klass)) {<NEW_LINE>if (matchMethod(m.getMethod(), methodName, signature, isStatic, publicOnly)) {<NEW_LINE>int matchArity = m.getMethod().getParameterCount();<NEW_LINE>minOverallArity = min(minOverallArity, matchArity);<NEW_LINE><MASK><NEW_LINE>if (matchArity == arity) {<NEW_LINE>if (result != null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>result = m.getMethod();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (result == null && maxOverallArity >= 0) {<NEW_LINE>throw ArityException.create(minOverallArity, maxOverallArity, arity);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | maxOverallArity = max(maxOverallArity, matchArity); |
817,057 | private void initializeHeader() {<NEW_LINE>String[] jwtParts = JsonTokenUtil.splitTokenString(this.tokenString);<NEW_LINE>String jwtHeaderSegment = jwtParts[0];<NEW_LINE>JsonParser parser = new JsonParser();<NEW_LINE>JsonObject jHeader = parser.parse(JsonTokenUtil.fromBase64ToJsonString(jwtHeaderSegment)).getAsJsonObject();<NEW_LINE>if (this.header == null) {<NEW_LINE>this.header = new JWSHeader();<NEW_LINE>}<NEW_LINE>JsonElement algElement = jHeader.get("alg");<NEW_LINE>if (algElement != null) {<NEW_LINE>String element = algElement.getAsString();<NEW_LINE>if (element != null) {<NEW_LINE>this.header.setAlgorithm(element);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>JsonElement idElement = jHeader.get(HeaderConstants.KEY_ID);<NEW_LINE>if (idElement != null) {<NEW_LINE>String element = idElement.getAsString();<NEW_LINE>if (element != null) {<NEW_LINE>this.header.setKeyId(element);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>idElement = jHeader.get(HeaderConstants.X509_TP);<NEW_LINE>if (idElement != null) {<NEW_LINE>String element = idElement.getAsString();<NEW_LINE>if (element != null) {<NEW_LINE>this.header.setX509Thumbprint(element);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>idElement = jHeader.get(HeaderConstants.X509_CERT);<NEW_LINE>if (idElement != null) {<NEW_LINE>String element = idElement.getAsString();<NEW_LINE>if (element != null) {<NEW_LINE>this.header.setX509Certificate(element);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>idElement = <MASK><NEW_LINE>if (idElement != null) {<NEW_LINE>String element = idElement.getAsString();<NEW_LINE>if (element != null) {<NEW_LINE>this.header.setX509Url(element);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | jHeader.get(HeaderConstants.X509_URL); |
1,391,008 | public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {<NEW_LINE>SerializeWriter out = serializer.out;<NEW_LINE>if (object == null) {<NEW_LINE>out.writeNull();<NEW_LINE>} else {<NEW_LINE>if (fieldType == null) {<NEW_LINE>fieldType = object.getClass();<NEW_LINE>}<NEW_LINE>if (fieldType == LocalDateTime.class) {<NEW_LINE>final int mask = SerializerFeature.UseISO8601DateFormat.getMask();<NEW_LINE>LocalDateTime dateTime = (LocalDateTime) object;<NEW_LINE><MASK><NEW_LINE>if (format == null) {<NEW_LINE>if ((features & mask) != 0 || serializer.isEnabled(SerializerFeature.UseISO8601DateFormat)) {<NEW_LINE>format = formatter_iso8601_pattern;<NEW_LINE>} else if (serializer.isEnabled(SerializerFeature.WriteDateUseDateFormat)) {<NEW_LINE>format = JSON.DEFFAULT_DATE_FORMAT;<NEW_LINE>} else {<NEW_LINE>int millis = dateTime.getMillisOfSecond();<NEW_LINE>if (millis == 0) {<NEW_LINE>format = formatter_iso8601_pattern_23;<NEW_LINE>} else {<NEW_LINE>format = formatter_iso8601_pattern_29;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (format != null) {<NEW_LINE>write(out, dateTime, format);<NEW_LINE>} else {<NEW_LINE>out.writeLong(dateTime.toDateTime(DateTimeZone.forTimeZone(JSON.defaultTimeZone)).toInstant().getMillis());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>out.writeString(object.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String format = serializer.getDateFormatPattern(); |
1,455,875 | public boolean extractResourceToFile(String inPrefix, String inFile, File outDir, String outFile) {<NEW_LINE>InputStream aIS;<NEW_LINE>FileOutputStream aFileOS;<NEW_LINE>String content = inPrefix + "/" + inFile;<NEW_LINE>try {<NEW_LINE>content = runningWindows ? content.replace("\\", "/") : content;<NEW_LINE>if (!content.startsWith("/")) {<NEW_LINE>content = "/" + content;<NEW_LINE>}<NEW_LINE>aIS = (<MASK><NEW_LINE>if (aIS == null) {<NEW_LINE>throw new IOException("resource not accessible");<NEW_LINE>}<NEW_LINE>File out = outFile.isEmpty() ? new File(outDir, inFile) : new File(outDir, inFile);<NEW_LINE>if (!out.getParentFile().exists()) {<NEW_LINE>out.getParentFile().mkdirs();<NEW_LINE>}<NEW_LINE>aFileOS = new FileOutputStream(out);<NEW_LINE>copy(aIS, aFileOS);<NEW_LINE>aIS.close();<NEW_LINE>aFileOS.close();<NEW_LINE>} catch (Exception ex) {<NEW_LINE>log(-1, "extractResourceToFile: %s\n%s", content, ex);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | InputStream) clsRef.getResourceAsStream(content); |
1,035,758 | private ExecutableNode planExecution(ExpressionContext expression) {<NEW_LINE>switch(expression.getType()) {<NEW_LINE>case LITERAL:<NEW_LINE>return new ConstantExecutionNode(expression.getLiteral());<NEW_LINE>case IDENTIFIER:<NEW_LINE>String columnName = expression.getIdentifier();<NEW_LINE>ColumnExecutionNode columnExecutionNode = new ColumnExecutionNode(columnName, _arguments.size());<NEW_LINE>_arguments.add(columnName);<NEW_LINE>return columnExecutionNode;<NEW_LINE>case FUNCTION:<NEW_LINE>FunctionContext function = expression.getFunction();<NEW_LINE>List<ExpressionContext> arguments = function.getArguments();<NEW_LINE>int numArguments = arguments.size();<NEW_LINE>ExecutableNode[] childNodes = new ExecutableNode[numArguments];<NEW_LINE>for (int i = 0; i < numArguments; i++) {<NEW_LINE>childNodes[i] = planExecution(arguments.get(i));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>FunctionInfo functionInfo = FunctionRegistry.getFunctionInfo(functionName, numArguments);<NEW_LINE>if (functionInfo == null) {<NEW_LINE>if (FunctionRegistry.containsFunction(functionName)) {<NEW_LINE>throw new IllegalStateException(String.format("Unsupported function: %s with %d parameters", functionName, numArguments));<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException(String.format("Unsupported function: %s not found", functionName));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new FunctionExecutionNode(functionInfo, childNodes);<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException();<NEW_LINE>}<NEW_LINE>} | String functionName = function.getFunctionName(); |
572,651 | private <PSI> Boolean handleFindFailed(PSI target, Image img, boolean isExists) {<NEW_LINE>log(lvl, "handleFindFailed: %s", target);<NEW_LINE>Boolean state = null;<NEW_LINE>ObserveEvent evt = null;<NEW_LINE>FindFailedResponse response = findFailedResponse;<NEW_LINE>if (FindFailedResponse.HANDLE.equals(response)) {<NEW_LINE>ObserveEvent.Type type = ObserveEvent.Type.FINDFAILED;<NEW_LINE>if (findFailedHandler != null && ((ObserverCallBack) findFailedHandler).getType().equals(type)) {<NEW_LINE>log(lvl, "handleFindFailed: Response.HANDLE: calling handler");<NEW_LINE>evt = new ObserveEvent("", type, <MASK><NEW_LINE>((ObserverCallBack) findFailedHandler).findfailed(evt);<NEW_LINE>response = evt.getResponse();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (FindFailedResponse.ABORT.equals(response)) {<NEW_LINE>state = null;<NEW_LINE>if (isExists) {<NEW_LINE>state = false;<NEW_LINE>}<NEW_LINE>} else if (FindFailedResponse.SKIP.equals(response)) {<NEW_LINE>state = false;<NEW_LINE>} else if (FindFailedResponse.RETRY.equals(response)) {<NEW_LINE>state = true;<NEW_LINE>}<NEW_LINE>if (FindFailedResponse.PROMPT.equals(response)) {<NEW_LINE>response = handleFindFailedShowDialog(img, false);<NEW_LINE>} else {<NEW_LINE>return state;<NEW_LINE>}<NEW_LINE>if (FindFailedResponse.ABORT.equals(response)) {<NEW_LINE>state = null;<NEW_LINE>} else if (FindFailedResponse.SKIP.equals(response)) {<NEW_LINE>// TODO HACK to allow recapture on FindFailed PROMPT<NEW_LINE>if (img.backup()) {<NEW_LINE>img.delete();<NEW_LINE>state = handleImageMissing(img, true);<NEW_LINE>if (state == null || !state) {<NEW_LINE>if (!img.restore()) {<NEW_LINE>state = null;<NEW_LINE>} else {<NEW_LINE>img.get();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (FindFailedResponse.RETRY.equals(response)) {<NEW_LINE>state = true;<NEW_LINE>}<NEW_LINE>return state;<NEW_LINE>} | target, img, this, 0); |
1,799,068 | protected Field createEntityField(Datasource datasource, MetaProperty property) {<NEW_LINE>Lookup lookup = property.getAnnotatedElement().getAnnotation(Lookup.class);<NEW_LINE>if (lookup != null && lookup.type() == LookupType.DROPDOWN) {<NEW_LINE>DataComponents dataComponents = AppBeans.get(DataComponents.class);<NEW_LINE>Metadata metadata = AppBeans.get(Metadata.class);<NEW_LINE>MetaClass metaClass = metadata.getClassNN(property.getJavaType());<NEW_LINE>CollectionContainer<Entity> container = dataComponents.createCollectionContainer(metaClass.getJavaClass());<NEW_LINE>CollectionLoader<Entity> loader = dataComponents.createCollectionLoader();<NEW_LINE>loader.setQuery("select e from " + <MASK><NEW_LINE>loader.setView(View.MINIMAL);<NEW_LINE>loader.setContainer(container);<NEW_LINE>loader.load();<NEW_LINE>LookupPickerField<Entity> lookupPickerField = componentsFactory.createComponent(LookupPickerField.NAME);<NEW_LINE>lookupPickerField.setDatasource(datasource, property.getName());<NEW_LINE>lookupPickerField.setOptions(new ContainerOptions(container));<NEW_LINE>GuiActionSupport guiActionSupport = AppBeans.get(GuiActionSupport.NAME);<NEW_LINE>guiActionSupport.createActionsByMetaAnnotations(lookupPickerField);<NEW_LINE>return lookupPickerField;<NEW_LINE>}<NEW_LINE>PickerField<Entity> pickerField = componentsFactory.createComponent(PickerField.NAME);<NEW_LINE>pickerField.setDatasource(datasource, property.getName());<NEW_LINE>GuiActionSupport guiActionSupport = AppBeans.get(GuiActionSupport.NAME);<NEW_LINE>guiActionSupport.createActionById(pickerField, PickerField.ActionType.LOOKUP.getId());<NEW_LINE>if (lookup == null || !guiActionSupport.createActionsByMetaAnnotations(pickerField)) {<NEW_LINE>guiActionSupport.createActionById(pickerField, PickerField.ActionType.CLEAR.getId());<NEW_LINE>}<NEW_LINE>return pickerField;<NEW_LINE>} | metaClass.getName() + " e"); |
708,617 | private static void notifyError(Context context, String key, Severity severity, String description, String displayName, int startOffset, int endOffset, Sanitize sanitizing) {<NEW_LINE>LOG.<MASK><NEW_LINE>LOG.log(Level.FINEST, "key : {0}\n", key);<NEW_LINE>LOG.log(Level.FINEST, "description : {0}\n", description);<NEW_LINE>LOG.log(Level.FINEST, "displayName : {0}\n", displayName);<NEW_LINE>LOG.log(Level.FINEST, "startOffset : {0}\n", startOffset);<NEW_LINE>LOG.log(Level.FINEST, "endOffset : {0}\n", endOffset);<NEW_LINE>// FIXME: we silently drop errors which have no description here.<NEW_LINE>// There might be still a way to recover.<NEW_LINE>if (description == null) {<NEW_LINE>LOG.log(Level.FINEST, "dropping error");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// TODO: we might need a smarter way to provide a key in the long run.<NEW_LINE>if (key == null) {<NEW_LINE>key = description;<NEW_LINE>}<NEW_LINE>// We gotta have a display name.<NEW_LINE>if (displayName == null) {<NEW_LINE>displayName = description;<NEW_LINE>}<NEW_LINE>Error error = new GroovyError(key, displayName, description, context.snapshot.getSource().getFileObject(), startOffset, endOffset, severity, CompilerErrorResolver.getId(description));<NEW_LINE>context.errorHandler.error(error);<NEW_LINE>if (sanitizing == Sanitize.NONE) {<NEW_LINE>context.errorOffset = startOffset;<NEW_LINE>}<NEW_LINE>} | log(Level.FINEST, "---------------------------------------------------"); |
772,041 | private void scanSingleBlock() {<NEW_LINE>BlockPos size = box.size();<NEW_LINE>if (templateScannedBlocks == null || blueprintScannedData == null) {<NEW_LINE>boxIterator = new BoxIterator(box, EnumAxisOrder.XZY.getMinToMaxOrder(), true);<NEW_LINE>templateScannedBlocks = new BitSet<MASK><NEW_LINE>blueprintScannedData = new int[Snapshot.getDataSize(size)];<NEW_LINE>}<NEW_LINE>// Read from world<NEW_LINE>BlockPos worldScanPos = boxIterator.getCurrent();<NEW_LINE>BlockPos schematicPos = worldScanPos.subtract(box.min());<NEW_LINE>if (snapshotType == EnumSnapshotType.TEMPLATE) {<NEW_LINE>templateScannedBlocks.set(Snapshot.posToIndex(box.size(), schematicPos), !world.isAirBlock(worldScanPos));<NEW_LINE>}<NEW_LINE>if (snapshotType == EnumSnapshotType.BLUEPRINT) {<NEW_LINE>ISchematicBlock schematicBlock = readSchematicBlock(worldScanPos);<NEW_LINE>int index = blueprintScannedPalette.indexOf(schematicBlock);<NEW_LINE>if (index == -1) {<NEW_LINE>index = blueprintScannedPalette.size();<NEW_LINE>blueprintScannedPalette.add(schematicBlock);<NEW_LINE>}<NEW_LINE>blueprintScannedData[Snapshot.posToIndex(box.size(), schematicPos)] = index;<NEW_LINE>}<NEW_LINE>createAndSendMessage(NET_SCAN, buffer -> MessageUtil.writeBlockPos(buffer, worldScanPos));<NEW_LINE>sendNetworkUpdate(NET_RENDER_DATA);<NEW_LINE>// Move scanPos along<NEW_LINE>boxIterator.advance();<NEW_LINE>if (boxIterator.hasFinished()) {<NEW_LINE>scanning = false;<NEW_LINE>boxIterator = null;<NEW_LINE>}<NEW_LINE>} | (Snapshot.getDataSize(size)); |
1,705,269 | void deleteFromHosts() throws CommandException {<NEW_LINE>SFTPClient sftpClient = null;<NEW_LINE>try {<NEW_LINE>List<String> files = getListOfInstallFiles(getInstallDir());<NEW_LINE>for (String host : hosts) {<NEW_LINE>sshLauncher.init(getRemoteUser(), host, getRemotePort(), sshpassword, sshkeyfile, sshkeypassphrase, logger);<NEW_LINE>if (sshkeyfile != null && !sshLauncher.checkConnection()) {<NEW_LINE>// key auth failed, so use password auth<NEW_LINE>promptPass = true;<NEW_LINE>}<NEW_LINE>if (promptPass) {<NEW_LINE>sshpassword = getSSHPassword(host);<NEW_LINE>// re-initialize<NEW_LINE>sshLauncher.init(getRemoteUser(), host, getRemotePort(), sshpassword, sshkeyfile, sshkeypassphrase, logger);<NEW_LINE>}<NEW_LINE>sftpClient = sshLauncher.getSFTPClient();<NEW_LINE>if (!sftpClient.exists(getInstallDir())) {<NEW_LINE>throw new IOException(getInstallDir() + " Directory does not exist");<NEW_LINE>}<NEW_LINE>deleteRemoteFiles(sftpClient, files, getInstallDir(), getForce());<NEW_LINE>if (isRemoteDirectoryEmpty(sftpClient, getInstallDir())) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>sftpClient.close();<NEW_LINE>}<NEW_LINE>} catch (CommandException ce) {<NEW_LINE>throw ce;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new CommandException(ex);<NEW_LINE>} finally {<NEW_LINE>if (sftpClient != null) {<NEW_LINE>sftpClient.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | sftpClient.rmdir(getInstallDir()); |
1,253,450 | public void change(Event event, @Nullable Object[] delta, ChangeMode mode) {<NEW_LINE>if (delta == null && mode != ChangeMode.DELETE)<NEW_LINE>return;<NEW_LINE>EnchantmentType et = mode != ChangeMode.DELETE ? (EnchantmentType) delta[0] : null;<NEW_LINE>if (event instanceof PrepareItemEnchantEvent) {<NEW_LINE>PrepareItemEnchantEvent e = (PrepareItemEnchantEvent) event;<NEW_LINE>switch(mode) {<NEW_LINE>case SET:<NEW_LINE>if (all) {<NEW_LINE>for (int i = 0; i <= 2; i++) {<NEW_LINE>EnchantmentOffer eo = e.getOffers()[i];<NEW_LINE>if (eo == null) {<NEW_LINE>eo = new EnchantmentOffer(et.getType(), et.getLevel(), getCost(i + 1, e.getEnchantmentBonus()));<NEW_LINE>e.<MASK><NEW_LINE>} else {<NEW_LINE>eo.setEnchantment(et.getType());<NEW_LINE>eo.setEnchantmentLevel(et.getLevel());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (Number n : exprOfferNumber.getArray(e)) {<NEW_LINE>int slot = n.intValue() - 1;<NEW_LINE>EnchantmentOffer eo = e.getOffers()[slot];<NEW_LINE>if (eo == null) {<NEW_LINE>eo = new EnchantmentOffer(et.getType(), et.getLevel(), getCost(slot + 1, e.getEnchantmentBonus()));<NEW_LINE>e.getOffers()[slot] = eo;<NEW_LINE>} else {<NEW_LINE>eo.setEnchantment(et.getType());<NEW_LINE>eo.setEnchantmentLevel(et.getLevel());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case DELETE:<NEW_LINE>if (all) {<NEW_LINE>Arrays.fill(e.getOffers(), null);<NEW_LINE>} else {<NEW_LINE>for (Number n : exprOfferNumber.getArray(e)) e.getOffers()[n.intValue() - 1] = null;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ADD:<NEW_LINE>case REMOVE:<NEW_LINE>case RESET:<NEW_LINE>case REMOVE_ALL:<NEW_LINE>assert false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getOffers()[i] = eo; |
1,413,972 | public static void drawLine(int x1, int y1, int x2, int y2, BiConsumer<Integer, Integer> drawPixel) {<NEW_LINE>int currentX = x1;<NEW_LINE>int currentY = y1;<NEW_LINE>int dx = Math.abs(x2 - x1);<NEW_LINE>int dy = Math.abs(y2 - y1);<NEW_LINE>int error = (dx > dy ? dx : -dy) / 2;<NEW_LINE>while (true) {<NEW_LINE>drawPixel.accept(currentX, currentY);<NEW_LINE>if (currentX == x2 && currentY == y2 || Math.abs(currentX - x1) > Math.abs(x2 - x1) || Math.abs(currentY - y1) > Math.abs(y2 - y1)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (error * 2 > -dx) {<NEW_LINE>error -= dy;<NEW_LINE>currentX += x1 < x2 ? 1 : -1;<NEW_LINE>}<NEW_LINE>if (error * 2 < dy) {<NEW_LINE>error += dx;<NEW_LINE>currentY += <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | y1 < y2 ? 1 : -1; |
1,052,187 | public void loadReplicationStrategy(Properties ctx) {<NEW_LINE>MReplicationStrategy.getByOrgAndRole(ctx, orgId, roleId, null).stream().filter(replicationStrategy -> replicationStrategy != null).forEach(replicationStrategy -> {<NEW_LINE>for (X_AD_ReplicationTable rplTable : replicationStrategy.getReplicationTables()) {<NEW_LINE>if (X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(rplTable.getReplicationType()) || X_AD_ReplicationTable.REPLICATIONTYPE_Broadcast.equals(rplTable.getReplicationType()) || X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(rplTable.getReplicationType())) {<NEW_LINE>String tableName = MTable.getTableName(replicationStrategy.getCtx(), rplTable.getAD_Table_ID());<NEW_LINE>modelValidationEngine.addModelChange(tableName, this);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Add Documents<NEW_LINE>// We want to be informed when Replication documents are created/updated/deleted!<NEW_LINE>for (X_AD_ReplicationDocument rplDocument : replicationStrategy.getReplicationDocuments()) {<NEW_LINE>if (X_AD_ReplicationDocument.REPLICATIONTYPE_Merge.equals(rplDocument.getReplicationType()) || X_AD_ReplicationDocument.REPLICATIONTYPE_Reference.equals(rplDocument.getReplicationType())) {<NEW_LINE>String tableName = MTable.getTableName(replicationStrategy.getCtx(), rplDocument.getAD_Table_ID());<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | modelValidationEngine.addDocValidate(tableName, this); |
195,249 | public void testCriteriaQuery_Byte(TestExecutionContext testExecCtx, TestExecutionResources testExecResources, Object managedComponentObject) throws Throwable {<NEW_LINE>final String testName = getTestName();<NEW_LINE>// Verify parameters<NEW_LINE>if (testExecCtx == null || testExecResources == null) {<NEW_LINE>Assert.fail(testName + ": Missing context and/or resources. Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final JPAResource jpaResource = testExecResources.getJpaResourceMap().get("test-jpa-resource");<NEW_LINE>if (jpaResource == null) {<NEW_LINE>Assert.fail("Missing JPAResource 'test-jpa-resource'). Cannot execute the test.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Process Test Properties<NEW_LINE>final Map<String, Serializable> testProps = testExecCtx.getProperties();<NEW_LINE>if (testProps != null) {<NEW_LINE>for (String key : testProps.keySet()) {<NEW_LINE>System.out.println("Test Property: " + key + " = " + testProps.get(key));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EntityManager em = jpaResource.getEm();<NEW_LINE>TransactionJacket tx = jpaResource.getTj();<NEW_LINE>// Execute Test Case<NEW_LINE>try {<NEW_LINE>tx.beginTransaction();<NEW_LINE>if (jpaResource.getPcCtxInfo().getPcType() == PersistenceContextType.APPLICATION_MANAGED_JTA)<NEW_LINE>em.joinTransaction();<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<Entity0002> cq = <MASK><NEW_LINE>Root<Entity0002> root = cq.from(Entity0002.class);<NEW_LINE>cq.select(root);<NEW_LINE>TypedQuery<Entity0002> tq = em.createQuery(cq);<NEW_LINE>Entity0002 findEntity = tq.getSingleResult();<NEW_LINE>System.out.println("Object returned by query: " + findEntity);<NEW_LINE>assertNotNull("Did not find entity in criteria query", findEntity);<NEW_LINE>assertTrue("Entity returned by find was not contained in the persistence context.", em.contains(findEntity));<NEW_LINE>assertEquals(new Byte((byte) 02), findEntity.getEntity0002_id());<NEW_LINE>assertEquals("Entity0002_STRING01", findEntity.getEntity0002_string01());<NEW_LINE>assertEquals("Entity0002_STRING02", findEntity.getEntity0002_string02());<NEW_LINE>assertEquals("Entity0002_STRING03", findEntity.getEntity0002_string03());<NEW_LINE>tx.commitTransaction();<NEW_LINE>} finally {<NEW_LINE>System.out.println(testName + ": End");<NEW_LINE>}<NEW_LINE>} | cb.createQuery(Entity0002.class); |
775,847 | public static Chunk cloneChunk(Chunk chunk) {<NEW_LINE>ObjectFactory jslFactory = objectFactoryMap.get(chunk.getClass().<MASK><NEW_LINE>Chunk newChunk = jslFactory.createChunk();<NEW_LINE>newChunk.setItemCount(chunk.getItemCount());<NEW_LINE>newChunk.setRetryLimit(chunk.getRetryLimit());<NEW_LINE>newChunk.setSkipLimit(chunk.getSkipLimit());<NEW_LINE>newChunk.setTimeLimit(chunk.getTimeLimit());<NEW_LINE>newChunk.setCheckpointPolicy(chunk.getCheckpointPolicy());<NEW_LINE>newChunk.setCheckpointAlgorithm(cloneCheckpointAlorithm(chunk.getCheckpointAlgorithm()));<NEW_LINE>newChunk.setProcessor(cloneItemProcessor(chunk.getProcessor()));<NEW_LINE>newChunk.setReader(cloneItemReader(chunk.getReader()));<NEW_LINE>newChunk.setWriter(cloneItemWriter(chunk.getWriter()));<NEW_LINE>newChunk.setNoRollbackExceptionClasses(cloneExceptionClassFilter(chunk.getNoRollbackExceptionClasses()));<NEW_LINE>newChunk.setRetryableExceptionClasses(cloneExceptionClassFilter(chunk.getRetryableExceptionClasses()));<NEW_LINE>newChunk.setSkippableExceptionClasses(cloneExceptionClassFilter(chunk.getSkippableExceptionClasses()));<NEW_LINE>return newChunk;<NEW_LINE>} | getPackage().getName()); |
585,834 | public void start() {<NEW_LINE>if (current != null) {<NEW_LINE>current.show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Form hi = new Form("Hi World", BoxLayout.y());<NEW_LINE>Button checkIfDetectionAvailable = new Button("Check if GPS Detection Available");<NEW_LINE>checkIfDetectionAvailable.addActionListener(e -> {<NEW_LINE>String message = LocationManager.getLocationManager().isGPSDetectionSupported() ? "GPS Detection IS supported" : "GPS Detection is NOT supported";<NEW_LINE>Dialog.show("GPS Detection Result", message, "OK", null);<NEW_LINE>});<NEW_LINE><MASK><NEW_LINE>isGPSEnabled.addActionListener(e -> {<NEW_LINE>String message = LocationManager.getLocationManager().isGPSEnabled() ? "GPS IS enabled" : "GPS is NOT enabled";<NEW_LINE>Dialog.show("GPS Enabled?", message, "OK", null);<NEW_LINE>});<NEW_LINE>Button getLocation = new Button("Get Location");<NEW_LINE>getLocation.addActionListener(e -> {<NEW_LINE>Location loc = LocationManager.getLocationManager().getCurrentLocationSync(3000);<NEW_LINE>String message = loc != null ? "Location is " + loc : "Location not found";<NEW_LINE>Dialog.show("Location", message, "OK", null);<NEW_LINE>});<NEW_LINE>hi.addAll(checkIfDetectionAvailable, isGPSEnabled, getLocation);<NEW_LINE>hi.show();<NEW_LINE>} | Button isGPSEnabled = new Button("GPS Status"); |
57,165 | final AssociateConnectionWithLagResult executeAssociateConnectionWithLag(AssociateConnectionWithLagRequest associateConnectionWithLagRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(associateConnectionWithLagRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<AssociateConnectionWithLagRequest> request = null;<NEW_LINE>Response<AssociateConnectionWithLagResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AssociateConnectionWithLagRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(associateConnectionWithLagRequest));<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, "Direct Connect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateConnectionWithLag");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AssociateConnectionWithLagResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AssociateConnectionWithLagResultJsonUnmarshaller());<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); |
292,640 | void assignBatchWork() {<NEW_LINE>if (hasEnoughTasksForNextBatch()) {<NEW_LINE>if (batchWorkRequests.tryAcquire(1)) {<NEW_LINE>long now = System.currentTimeMillis();<NEW_LINE>int len = Math.min(<MASK><NEW_LINE>List<TaskHolder<ID, T>> holders = new ArrayList<>(len);<NEW_LINE>while (holders.size() < len && !processingOrder.isEmpty()) {<NEW_LINE>ID id = processingOrder.poll();<NEW_LINE>TaskHolder<ID, T> holder = pendingTasks.remove(id);<NEW_LINE>if (holder.getExpiryTime() > now) {<NEW_LINE>holders.add(holder);<NEW_LINE>} else {<NEW_LINE>expiredTasks++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (holders.isEmpty()) {<NEW_LINE>batchWorkRequests.release();<NEW_LINE>} else {<NEW_LINE>batchSizeMetric.record(holders.size(), TimeUnit.MILLISECONDS);<NEW_LINE>batchWorkQueue.add(holders);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | maxBatchingSize, processingOrder.size()); |
637,153 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller != null) {<NEW_LINE>Card lastCreatureCard = null;<NEW_LINE>for (Card card : controller.getGraveyard().getCards(game)) {<NEW_LINE>if (card.isCreature(game)) {<NEW_LINE>lastCreatureCard = card;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (lastCreatureCard != null) {<NEW_LINE>if (controller.moveCards(lastCreatureCard, Zone.BATTLEFIELD, source, game)) {<NEW_LINE>Permanent returnedCreature = game.getPermanent(lastCreatureCard.getId());<NEW_LINE>if (returnedCreature != null) {<NEW_LINE>FixedTarget fixedTarget = new FixedTarget(returnedCreature, game);<NEW_LINE>// Gains Haste<NEW_LINE>ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.<MASK><NEW_LINE>hasteEffect.setTargetPointer(fixedTarget);<NEW_LINE>game.addEffect(hasteEffect, source);<NEW_LINE>// Exile it at end of turn<NEW_LINE>ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);<NEW_LINE>exileEffect.setTargetPointer(fixedTarget);<NEW_LINE>DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);<NEW_LINE>game.addDelayedTriggeredAbility(delayedAbility, source);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getInstance(), Duration.EndOfTurn); |
1,739,434 | public void contextInitialized(ServletContextEvent event) {<NEW_LINE>ServletContext servletContext = event.getServletContext();<NEW_LINE>String contextName = servletContext.getContextPath().replaceAll("/", "");<NEW_LINE>if ("".equals(contextName)) {<NEW_LINE>contextName = "root";<NEW_LINE>}<NEW_LINE>System.out.printf("Context init: %s%n", contextName);<NEW_LINE>ConfigurableWebApplicationContext appctx = (ConfigurableWebApplicationContext) <MASK><NEW_LINE>if (appctx != null) {<NEW_LINE>System.out.printf("ConfigurableWebApplicationContext is not null in ContextLoggingListener for: %s, this indicates a misconfiguration or load order problem%n", contextName);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// get the selector<NEW_LINE>ContextSelector selector = Red5LoggerFactory.getContextSelector();<NEW_LINE>// get the logger context for this servlet / app context by name<NEW_LINE>URL url = servletContext.getResource(String.format("/WEB-INF/classes/logback-%s.xml", contextName));<NEW_LINE>if (url != null && Files.exists(Paths.get(url.toURI()))) {<NEW_LINE>System.out.printf("Context logger config found: %s%n", url.toURI());<NEW_LINE>} else {<NEW_LINE>url = servletContext.getResource("/WEB-INF/classes/logback.xml");<NEW_LINE>if (url != null && Files.exists(Paths.get(url.toURI()))) {<NEW_LINE>System.out.printf("Context logger config found: %s%n", url.toURI());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// get the logger context for the servlet context<NEW_LINE>LoggerContext loggerContext = url != null ? ((LoggingContextSelector) selector).getLoggerContext(contextName, url) : selector.getLoggerContext(contextName);<NEW_LINE>// set the logger context for use elsewhere in the servlet context<NEW_LINE>servletContext.setAttribute(Red5LoggerFactory.LOGGER_CONTEXT_ATTRIBUTE, loggerContext);<NEW_LINE>// get the root logger for this context<NEW_LINE>Logger logger = Red5LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME, contextName);<NEW_LINE>logger.info("Starting up context: {}", contextName);<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.err.printf("LoggingContextSelector is not the correct type: %s%n", e.getMessage());<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); |
600,857 | protected void swap(int a, int b) {<NEW_LINE>if (results[a] != results[b]) {<NEW_LINE>super.swap(a, b);<NEW_LINE>String tmp = sortedClassNames[a];<NEW_LINE>sortedClassNames[a] = sortedClassNames[b];<NEW_LINE>sortedClassNames[b] = tmp;<NEW_LINE>int tmpI = sortedClassIds[a];<NEW_LINE>sortedClassIds<MASK><NEW_LINE>sortedClassIds[b] = tmpI;<NEW_LINE>for (int i = 0; i < nSecIDataArrays; i++) {<NEW_LINE>tmpI = secondaryIntData[i][a];<NEW_LINE>secondaryIntData[i][a] = secondaryIntData[i][b];<NEW_LINE>secondaryIntData[i][b] = tmpI;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < nSecLDataArrays; i++) {<NEW_LINE>long tmpL = secondaryLongData[i][a];<NEW_LINE>secondaryLongData[i][a] = secondaryLongData[i][b];<NEW_LINE>secondaryLongData[i][b] = tmpL;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < nSecFDataArrays; i++) {<NEW_LINE>float tmpF = secondaryFloatData[i][a];<NEW_LINE>secondaryFloatData[i][a] = secondaryFloatData[i][b];<NEW_LINE>secondaryFloatData[i][b] = tmpF;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | [a] = sortedClassIds[b]; |
191,243 | final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTagsForResourceRequest> request = null;<NEW_LINE>Response<ListTagsForResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListTagsForResourceRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "DataSync");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListTagsForResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsForResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(listTagsForResourceRequest)); |
955,990 | public ListIAMPolicyAssignmentsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListIAMPolicyAssignmentsResult listIAMPolicyAssignmentsResult = new ListIAMPolicyAssignmentsResult();<NEW_LINE>listIAMPolicyAssignmentsResult.setStatus(context.<MASK><NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listIAMPolicyAssignmentsResult;<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("IAMPolicyAssignments", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listIAMPolicyAssignmentsResult.setIAMPolicyAssignments(new ListUnmarshaller<IAMPolicyAssignmentSummary>(IAMPolicyAssignmentSummaryJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listIAMPolicyAssignmentsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("RequestId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listIAMPolicyAssignmentsResult.setRequestId(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 listIAMPolicyAssignmentsResult;<NEW_LINE>} | getHttpResponse().getStatusCode()); |
132,617 | public void testResourceMethodLinkUsedInInvocationForCTS(Map<String, String> param, StringBuilder ret) {<NEW_LINE>String ServerUri = "http://justforcts.test:6789/resource/";<NEW_LINE>final String linkName = "link";<NEW_LINE>Client client = ClientBuilder.newClient();<NEW_LINE>client.register(new ClientRequestFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void filter(ClientRequestContext ctx) throws IOException {<NEW_LINE>String uri = ctx.getUri().toASCIIString();<NEW_LINE>Link.Builder builder = Link.fromMethod(Resource.class, "consumesAppJson").rel(linkName);<NEW_LINE>builder.baseUri(uri);<NEW_LINE>Link link = builder.build();<NEW_LINE>System.out.println("filter invoke: Link build");<NEW_LINE>Response response = Response.ok(uri).links(link).build();<NEW_LINE>ctx.abortWith(response);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>String result = "";<NEW_LINE>// Phase 1, ask for a link;<NEW_LINE>System.out.println("Phase 1, ask for a link");<NEW_LINE>WebTarget target = client.target(ServerUri + "get");<NEW_LINE>Response response = target.request().get();<NEW_LINE>String entity = response.readEntity(String.class);<NEW_LINE>result = entity.contains("resource/get") + ",";<NEW_LINE>// Phase 2, use the link, check the correctness<NEW_LINE>System.out.println("Phase 2, use the link, check the correctness");<NEW_LINE>Link <MASK><NEW_LINE>response = client.invocation(link).post(null);<NEW_LINE>entity = response.readEntity(String.class);<NEW_LINE>result += entity.contains("resource/consumesappjson") + "";<NEW_LINE>ret.append(result);<NEW_LINE>} | link = response.getLink(linkName); |
247,064 | public void testProducerRecordTopic() {<NEW_LINE>String topicIn = ProducerRecordBean.CHANNEL_IN;<NEW_LINE>String expectedTopicOut = ProducerRecordBean.PRODUCER_RECORD_TOPIC;<NEW_LINE>String unexpectedTopicOut = ProducerRecordBean.CONFIGURED_TOPIC;<NEW_LINE>String keyOut = ProducerRecordBean.PRODUCER_RECORD_KEY;<NEW_LINE>String valueOut = ProducerRecordBean.PRODUCER_RECORD_VALUE;<NEW_LINE>KafkaWriter<String, String> writer = kafkaTestClient.writerFor(topicIn);<NEW_LINE>// this value doesn't matter<NEW_LINE>String value = "hello";<NEW_LINE>writer.sendMessage(value);<NEW_LINE>KafkaReader<String, String> reader = kafkaTestClient.readerFor(expectedTopicOut);<NEW_LINE>List<ConsumerRecord<String, String>> expectedRecords = reader.<MASK><NEW_LINE>reader = kafkaTestClient.readerFor(unexpectedTopicOut);<NEW_LINE>List<ConsumerRecord<String, String>> unexpectedRecords = reader.readRecords(1, KafkaTestConstants.EXPECTED_FAILURE_KAFKA_TIMEOUT);<NEW_LINE>if (expectedRecords.size() == 1) {<NEW_LINE>if (unexpectedRecords.size() != 0) {<NEW_LINE>fail("Message may have been sent to more than one topic???");<NEW_LINE>} else {<NEW_LINE>ConsumerRecord<String, String> record = expectedRecords.get(0);<NEW_LINE>assertEquals(keyOut, record.key());<NEW_LINE>assertEquals(valueOut, record.value());<NEW_LINE>assertEquals(expectedTopicOut, record.topic());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (unexpectedRecords.size() == 0) {<NEW_LINE>fail("Message not found on any topic");<NEW_LINE>} else {<NEW_LINE>fail("Message was sent to wrong topic: " + unexpectedTopicOut);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | readRecords(1, KafkaTestConstants.DEFAULT_KAFKA_TIMEOUT); |
929,107 | private static String translateState(final DiffNode.State state, final Object base, final Object modified) {<NEW_LINE>if (state == DiffNode.State.IGNORED) {<NEW_LINE>return "has been ignored";<NEW_LINE>} else if (state == DiffNode.State.CHANGED) {<NEW_LINE>return String.format("has changed from [ %s ] to [ %s ]", Strings.toSingleLineString(base)<MASK><NEW_LINE>} else if (state == DiffNode.State.ADDED) {<NEW_LINE>return String.format("has been added => [ %s ]", Strings.toSingleLineString(modified));<NEW_LINE>} else if (state == DiffNode.State.REMOVED) {<NEW_LINE>return String.format("with value [ %s ] has been removed", Strings.toSingleLineString(base));<NEW_LINE>} else if (state == DiffNode.State.UNTOUCHED) {<NEW_LINE>return "has not changed";<NEW_LINE>} else if (state == DiffNode.State.CIRCULAR) {<NEW_LINE>return "has already been processed at another position. (Circular reference!)";<NEW_LINE>}<NEW_LINE>return '(' + state.name() + ')';<NEW_LINE>} | , Strings.toSingleLineString(modified)); |
1,537,257 | public static void main(String[] args) throws Exception {<NEW_LINE>if (args.length > 3 || args.length < 2 || (args.length == 3 && !args[0].equals("--train"))) {<NEW_LINE>System.err.println("Usage:");<NEW_LINE>System.err.println("java HierarchicalClassifierTrainer [--train] <questionLang> <corpusLang>\n");<NEW_LINE>System.err.println(" - <questionLang> and <corpusLang> must be one of the following:");<NEW_LINE>System.err.println(" en_US, ja_JP, jp_JP, zh_TW, zh_CN");<NEW_LINE>System.err.println(" - Outputs a trained model in the current directory if --train is used.");<NEW_LINE>System.err.println(" - Otherwise, performs an evaluation using the configuration in the");<NEW_LINE>System.err.println(" properties file and outputs a report describing the results.");<NEW_LINE>System.exit(0);<NEW_LINE>}<NEW_LINE>boolean train = false;<NEW_LINE>int langPairInd = 0;<NEW_LINE>if (args[0].equals("--train")) {<NEW_LINE>train = true;<NEW_LINE>langPairInd++;<NEW_LINE>}<NEW_LINE>Pair<Language, Language> languagePair = new Pair<Language, Language>(Language.valueOf(args[langPairInd]), Language.valueOf(args[langPairInd + 1]));<NEW_LINE>HierarchicalClassifierTrainer qct = new HierarchicalClassifierTrainer(languagePair);<NEW_LINE>qct.initialize();<NEW_LINE>if (train) {<NEW_LINE>System.out.println("Training classifier...");<NEW_LINE>qct.trainClassifier();<NEW_LINE>qct.saveClassifier();<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>System.out.println("Running experiment...");<NEW_LINE>Evaluation eval = qct.runExperiment();<NEW_LINE>FileUtil.writeFile(qct.createReport(), args[0] + ".report" + System.currentTimeMillis() + ".txt", "UTF-8");<NEW_LINE>ViewerFrame frame = new ViewerFrame(args[0], eval.toGUI());<NEW_LINE>frame.setVisible(true);<NEW_LINE>}<NEW_LINE>} | System.out.println("Classifier saved."); |
1,605,956 | public static List<ContentletSearch> query(String query, int limit, String sort, User user, String tmDate) {<NEW_LINE>List<ContentletSearch> ret = null;<NEW_LINE>try {<NEW_LINE>if (tmDate != null && query.contains("+live:true")) {<NEW_LINE>// with timemachine on!<NEW_LINE>// as we need to load contentlets anyway to sort<NEW_LINE>// lets just call pull here<NEW_LINE>List<Contentlet> conts = pull(query, limit, sort, user, tmDate);<NEW_LINE>ret = new ArrayList<ContentletSearch>(conts.size());<NEW_LINE>for (Contentlet cm : conts) {<NEW_LINE>ContentletSearch cs = new ContentletSearch();<NEW_LINE>cs.setInode((String) cm.get("inode"));<NEW_LINE>cs.setIdentifier((String) cm.get("identifier"));<NEW_LINE>ret.add(cs);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// normal query<NEW_LINE>ret = conAPI.searchIndex(query, limit, -1, sort, user, true);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(ContentUtils.class, e.getMessage(), e);<NEW_LINE>}<NEW_LINE>if (ret == null) {<NEW_LINE>ret <MASK><NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | = new ArrayList<ContentletSearch>(); |
1,188,870 | public static List<Suggestion> requestHint(String query, int queryPosition, AutoCompleteSupport sender, int senderCursorPosition, @Nullable HintProvider provider) {<NEW_LINE>DomainModelBuilder builder = AppBeans.get(DomainModelWithCaptionsBuilder.NAME);<NEW_LINE>DomainModel domainModel = builder.produce();<NEW_LINE>if (provider == null) {<NEW_LINE>provider = new HintProvider(domainModel);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>HintRequest request = new HintRequest();<NEW_LINE>request.setQuery(query);<NEW_LINE>request.setPosition(queryPosition);<NEW_LINE>HintResponse response = provider.requestHint(request);<NEW_LINE>String prefix = response.getLastWord();<NEW_LINE>List<Option> options = response.getOptionObjects();<NEW_LINE>List<Suggestion> <MASK><NEW_LINE>for (Option option : options) {<NEW_LINE>Suggestion suggestion = JpqlSuggestionFactory.produce(sender, option.getValue(), option.getDescription(), senderCursorPosition, prefix == null ? 0 : prefix.length());<NEW_LINE>result.add(suggestion);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} catch (org.antlr.runtime.RecognitionException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | result = new ArrayList<>(); |
1,829,103 | public void waitForNodesHavingSystemStateVersionEqualToOrAbove(int version, int nodeCount, int timeout) throws InterruptedException {<NEW_LINE>long maxTime = System.currentTimeMillis() + timeout;<NEW_LINE>synchronized (monitor) {<NEW_LINE>while (true) {<NEW_LINE>int ackedNodes = 0;<NEW_LINE>for (NodeInfo node : cluster.getNodeInfo()) {<NEW_LINE>if (node.getClusterStateVersionBundleAcknowledged() >= version) {<NEW_LINE>++ackedNodes;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ackedNodes >= nodeCount) {<NEW_LINE>context.log(logger, Level.INFO, ackedNodes + " nodes now have acked system state " + version + " or higher.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long remainingTime = maxTime - System.currentTimeMillis();<NEW_LINE>if (remainingTime <= 0) {<NEW_LINE>throw new IllegalStateException("Did not get " + nodeCount + " nodes to system state " + <MASK><NEW_LINE>}<NEW_LINE>monitor.wait(10);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | version + " within timeout of " + timeout + " milliseconds."); |
1,698,595 | public static void main(final String[] args) {<NEW_LINE>final String s = "4CEvsI8FRczRBo_ApRCkwfEbFLn1pIFXg39QGMgj5RHM6HpIMJq67QX3M5iQYr_LyI_5aGDaa_bYbRgJ9XnQjpmq6QkOoGWAoEaihRqhV3kItLFHjRtqauUR";<NEW_LINE>final BinSearch bs = new BinSearch(<MASK><NEW_LINE>for (int i = 0; i + 6 <= s.length(); i = i + 6) {<NEW_LINE>System.out.println(s.substring(i, i + 6) + ":" + ((bs.contains(s.substring(i, i + 6).getBytes())) ? "drin" : "draussen"));<NEW_LINE>}<NEW_LINE>for (int i = 0; i + 7 <= s.length(); i = i + 6) {<NEW_LINE>System.out.println(s.substring(i + 1, i + 7) + ":" + ((bs.contains(s.substring(i + 1, i + 7).getBytes())) ? "drin" : "draussen"));<NEW_LINE>}<NEW_LINE>} | s.getBytes(), 6); |
59,524 | public DeleteMembersResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DeleteMembersResult deleteMembersResult = new DeleteMembersResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return deleteMembersResult;<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("AccountIds", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deleteMembersResult.setAccountIds(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("UnprocessedAccounts", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deleteMembersResult.setUnprocessedAccounts(new ListUnmarshaller<UnprocessedAccount>(UnprocessedAccountJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return deleteMembersResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
196,418 | public BigDecimal decimalValue() {<NEW_LINE>if (numberSale > 0 && !numberExp) {<NEW_LINE>int len = bufPos;<NEW_LINE>if (len < 20) {<NEW_LINE>long unscaleVal = 0;<NEW_LINE>boolean negative = false;<NEW_LINE>int i = 0;<NEW_LINE>char first = text.charAt(mark);<NEW_LINE>if (first == '+') {<NEW_LINE>i++;<NEW_LINE>} else if (first == '-') {<NEW_LINE>i++;<NEW_LINE>negative = true;<NEW_LINE>}<NEW_LINE>for (; i < len; ++i) {<NEW_LINE>char ch = <MASK><NEW_LINE>if (ch == '.') {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>int digit = ch - '0';<NEW_LINE>unscaleVal = unscaleVal * 10 + digit;<NEW_LINE>}<NEW_LINE>return BigDecimal.valueOf(negative ? -unscaleVal : unscaleVal, numberSale);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>char[] value = sub_chars(mark, bufPos);<NEW_LINE>if (!StringUtils.isNumber(value)) {<NEW_LINE>throw new ParserException(value + " is not a number! " + info());<NEW_LINE>}<NEW_LINE>return new BigDecimal(value);<NEW_LINE>} | text.charAt(mark + i); |
586,913 | private MetaInfo parseResponse(MetaInfoResponse response) {<NEW_LINE>if (response == null)<NEW_LINE>return null;<NEW_LINE>String subject = response.getSubject();<NEW_LINE>if (Strings.isNullOrEmpty(subject))<NEW_LINE>return null;<NEW_LINE>ClientType clientType = parseClientType(response);<NEW_LINE>if (clientType == null)<NEW_LINE>return null;<NEW_LINE>BrokerCluster cluster = response.getBrokerCluster();<NEW_LINE>List<BrokerGroup> groups = cluster == null ? null : cluster.getBrokerGroups();<NEW_LINE>if (groups == null || groups.isEmpty()) {<NEW_LINE>return new MetaInfo(subject, clientType, new BrokerClusterInfo());<NEW_LINE>}<NEW_LINE>List<BrokerGroup> validBrokers = new ArrayList<>(groups.size());<NEW_LINE>for (BrokerGroup group : groups) {<NEW_LINE>if (inValid(group))<NEW_LINE>continue;<NEW_LINE>BrokerState state = group.getBrokerState();<NEW_LINE>if (clientType.isConsumer() && state.canRead()) {<NEW_LINE>validBrokers.add(group);<NEW_LINE>} else if (clientType.isProducer() && state.canWrite()) {<NEW_LINE>validBrokers.add(group);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (validBrokers.isEmpty()) {<NEW_LINE>return new MetaInfo(subject, clientType, new BrokerClusterInfo());<NEW_LINE>}<NEW_LINE>List<BrokerGroupInfo> groupInfos = new ArrayList<>(validBrokers.size());<NEW_LINE>for (int i = 0; i < validBrokers.size(); i++) {<NEW_LINE>BrokerGroup bg = validBrokers.get(i);<NEW_LINE>groupInfos.add(new BrokerGroupInfo(i, bg.getGroupName(), bg.getMaster(), bg.getSlaves()));<NEW_LINE>}<NEW_LINE>BrokerClusterInfo clusterInfo = new BrokerClusterInfo(groupInfos);<NEW_LINE>return new <MASK><NEW_LINE>} | MetaInfo(subject, clientType, clusterInfo); |
635,950 | private void addNewDeferConstructor(final CtClass clazz) throws CannotCompileException {<NEW_LINE>final CtClass superClass;<NEW_LINE>try {<NEW_LINE>superClass = clazz.getSuperclass();<NEW_LINE>} catch (NotFoundException e1) {<NEW_LINE>throw new IllegalArgumentException("Internal error: Failed to get superclass for " + clazz.getName() + " when about to create a new default constructor.");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>final CtClass constructorType;<NEW_LINE>try {<NEW_LINE>constructorType = classPool.get(IndicateReloadClass.class.getName());<NEW_LINE>} catch (NotFoundException e) {<NEW_LINE>throw new IllegalArgumentException("Internal error: failed to get the " + IndicateReloadClass.class.getName() + " when added defer constructor.");<NEW_LINE>}<NEW_LINE>clazz.defrost();<NEW_LINE>if (superClass.getName().equals(Object.class.getName())) {<NEW_LINE>try {<NEW_LINE>clazz.addConstructor(CtNewConstructor.make(new CtClass[] { constructorType }, new CtClass[0], "{super();}", clazz));<NEW_LINE>} catch (DuplicateMemberException e) {<NEW_LINE>// OK, the constructor has already been added.<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>addNewDeferConstructor(superClass);<NEW_LINE>try {<NEW_LINE>clazz.addConstructor(CtNewConstructor.make(new CtClass[] { constructorType }, new CtClass[0], "{super($$);}", clazz));<NEW_LINE>} catch (DuplicateMemberException e) {<NEW_LINE>// OK, the constructor has already been added.<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ClassPool classPool = clazz.getClassPool(); |
1,501,524 | public V execute(Command<V> command) throws Exception {<NEW_LINE>for (int i = 0; n == -1 || i <= n; i++) {<NEW_LINE>if (destroyed.get()) {<NEW_LINE>logger.info("[execute][destroyed return null]{}", this);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (i >= 1) {<NEW_LINE>logger.info("[execute][retry]{}, {}", i, command);<NEW_LINE>retryPolicy.retryWaitMilli(true);<NEW_LINE>}<NEW_LINE>if (destroyed.get()) {<NEW_LINE>logger.info("[execute][destroyed return null]{}", this);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>logger.debug("[execute]{}, {}", i, command);<NEW_LINE>CommandFuture<V> future = command.execute();<NEW_LINE>if (future == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return future.get(retryPolicy.waitTimeoutMilli(), TimeUnit.MILLISECONDS);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (isLogDetail()) {<NEW_LINE>logger.warn(String.format("cmd:%s, message:%s", command, e<MASK><NEW_LINE>}<NEW_LINE>Exception originalException = getOriginalException(e);<NEW_LINE>if (i == n || !retryPolicy.retry(originalException)) {<NEW_LINE>throw originalException;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>command.reset();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | .getMessage()), e); |
512,859 | protected void onPostExecute(Boolean created) {<NEW_LINE>// add a toast - now following or unfollowed<NEW_LINE>// true = followed<NEW_LINE>// false = unfollowed<NEW_LINE>if (created != null) {<NEW_LINE>if (created) {<NEW_LINE>Toast.makeText(context, getResources().getString(R.string.followed_user), <MASK><NEW_LINE>} else {<NEW_LINE>Toast.makeText(context, getResources().getString(R.string.unfollowed_user), Toast.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Toast.makeText(context, getResources().getString(R.string.error), Toast.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>if (settings.liveStreaming) {<NEW_LINE>context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE"));<NEW_LINE>context.startService(new Intent(context, TalonPullNotificationService.class));<NEW_LINE>}<NEW_LINE>new GetActionBarInfo().execute();<NEW_LINE>} | Toast.LENGTH_SHORT).show(); |
230,280 | private List<Column> buildQueryColumns(DataFetchingEnvironment environment) {<NEW_LINE>List<SelectedField> valuesFields = environment.getSelectionSet().getFields("values");<NEW_LINE>if (valuesFields.isEmpty()) {<NEW_LINE>return ImmutableList.of();<NEW_LINE>}<NEW_LINE>// While convoluted, it's technically valid to reference 'values' multiple times under<NEW_LINE>// different aliases, for example:<NEW_LINE>// {<NEW_LINE>// values { id }<NEW_LINE>// values2: values { first_name last_name }<NEW_LINE>// }<NEW_LINE>// We iterate all the occurrences and build the union of their subsets.<NEW_LINE>Set<Column> queryColumns = new LinkedHashSet<>();<NEW_LINE>for (SelectedField valuesField : valuesFields) {<NEW_LINE>for (SelectedField selectedField : valuesField.getSelectionSet().getFields()) {<NEW_LINE>if ("__typename".equals(selectedField.getName())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String column = dbColumnGetter.getDBColumnName(<MASK><NEW_LINE>if (column != null) {<NEW_LINE>queryColumns.add(Column.reference(column));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ImmutableList.copyOf(queryColumns);<NEW_LINE>} | table, selectedField.getName()); |
1,313,450 | public boolean onPrepareOptionsMenu(Menu menu) {<NEW_LINE>MenuItem closeIssue = menu.findItem(R.id.closeIssue);<NEW_LINE>MenuItem lockIssue = menu.findItem(R.id.lockIssue);<NEW_LINE>MenuItem milestone = menu.findItem(R.id.milestone);<NEW_LINE>MenuItem labels = menu.findItem(R.id.labels);<NEW_LINE>MenuItem assignees = menu.findItem(R.id.assignees);<NEW_LINE>MenuItem edit = menu.findItem(R.id.edit);<NEW_LINE>MenuItem editMenu = menu.findItem(R.id.editMenu);<NEW_LINE>MenuItem pinUnpin = menu.findItem(R.id.pinUnpin);<NEW_LINE>boolean isOwner = getPresenter().isOwner();<NEW_LINE>boolean isLocked = getPresenter().isLocked();<NEW_LINE>boolean isCollaborator = getPresenter().isCollaborator();<NEW_LINE>boolean isRepoOwner = getPresenter().isRepoOwner();<NEW_LINE>editMenu.setVisible(isOwner || isCollaborator || isRepoOwner);<NEW_LINE>milestone.setVisible(isCollaborator || isRepoOwner);<NEW_LINE><MASK><NEW_LINE>assignees.setVisible(isCollaborator || isRepoOwner);<NEW_LINE>edit.setVisible(isCollaborator || isRepoOwner || isOwner);<NEW_LINE>lockIssue.setVisible(isRepoOwner || isCollaborator);<NEW_LINE>labels.setVisible(getPresenter().isRepoOwner() || isCollaborator);<NEW_LINE>closeIssue.setVisible(isOwner || isCollaborator);<NEW_LINE>if (getPresenter().getIssue() != null) {<NEW_LINE>boolean isPinned = PinnedIssues.isPinned(getPresenter().getIssue().getId());<NEW_LINE>pinUnpin.setIcon(isPinned ? ContextCompat.getDrawable(this, R.drawable.ic_pin_filled) : ContextCompat.getDrawable(this, R.drawable.ic_pin));<NEW_LINE>closeIssue.setTitle(getPresenter().getIssue().getState() == IssueState.closed ? getString(R.string.re_open) : getString(R.string.close));<NEW_LINE>lockIssue.setTitle(isLocked ? getString(R.string.unlock_issue) : getString(R.string.lock_issue));<NEW_LINE>}<NEW_LINE>return super.onPrepareOptionsMenu(menu);<NEW_LINE>} | labels.setVisible(isCollaborator || isRepoOwner); |
1,048,291 | private void restartModuleIfRequired() {<NEW_LINE>Context context = getActivity();<NEW_LINE>if (context == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean dnsCryptRunning = ModulesAux.isDnsCryptSavedStateRunning();<NEW_LINE>boolean torRunning = ModulesAux.isTorSavedStateRunning();<NEW_LINE>boolean itpdRunning = ModulesAux.isITPDSavedStateRunning();<NEW_LINE>if (dnsCryptRunning && "DNSCrypt".equals(moduleName)) {<NEW_LINE>ModulesRestarter.restartDNSCrypt(context);<NEW_LINE>} else if (torRunning && "Tor".equals(moduleName)) {<NEW_LINE>ModulesRestarter.restartTor(context);<NEW_LINE>} else if (itpdRunning && "ITPD".equals(moduleName)) {<NEW_LINE>ModulesRestarter.restartITPD(context);<NEW_LINE>SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);<NEW_LINE>boolean torTethering = sharedPreferences.getBoolean(TOR_TETHERING, false) && torRunning;<NEW_LINE>boolean itpdTethering = sharedPreferences.getBoolean(ITPD_TETHERING, false);<NEW_LINE>boolean routeAllThroughTorTether = <MASK><NEW_LINE>if (torTethering && routeAllThroughTorTether && itpdTethering) {<NEW_LINE>ModulesStatus.getInstance().setIptablesRulesUpdateRequested(context, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | sharedPreferences.getBoolean("pref_common_tor_route_all", false); |
1,023,495 | public void undeploy(Archive<?> archive) throws DeploymentException {<NEW_LINE>if (isRemoteMode()) {<NEW_LINE>log.infof("Skipped undeployment of '%s' as we are in remote mode!", archive.getName());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Field containerField = Reflections.findDeclaredField(UndertowJaxrsServer.class, "container");<NEW_LINE>Reflections.setAccessible(containerField);<NEW_LINE>ServletContainer container = (ServletContainer) Reflections.getFieldValue(containerField, undertow);<NEW_LINE>DeploymentManager deploymentMgr = container.getDeployment(archive.getName());<NEW_LINE>if (deploymentMgr != null) {<NEW_LINE>DeploymentInfo deployment = deploymentMgr.getDeployment().getDeploymentInfo();<NEW_LINE>try {<NEW_LINE>deploymentMgr.stop();<NEW_LINE>} catch (ServletException se) {<NEW_LINE>throw new DeploymentException(se.getMessage(), se);<NEW_LINE>}<NEW_LINE>deploymentMgr.undeploy();<NEW_LINE>Field rootField = Reflections.findDeclaredField(UndertowJaxrsServer.class, "root");<NEW_LINE>Reflections.setAccessible(rootField);<NEW_LINE>PathHandler root = (PathHandler) Reflections.getFieldValue(rootField, undertow);<NEW_LINE>String path = deployedArchivesToContextPath.get(archive.getName());<NEW_LINE>root.removePrefixPath(path);<NEW_LINE>container.removeDeployment(deployment);<NEW_LINE>} else {<NEW_LINE>log.warnf(<MASK><NEW_LINE>}<NEW_LINE>} | "Deployment '%s' not found", archive.getName()); |
1,834,064 | protected String parseInnerMessage(boolean ui, Message message, Date timestamp, String parentMessageId) {<NEW_LINE>if (message.getType() == Message.Type.error)<NEW_LINE>return null;<NEW_LINE>final org.jxmpp.jid.Jid from = message.getFrom();<NEW_LINE>final Resourcepart resource = from.getResourceOrNull();<NEW_LINE>String text = message.getBody();<NEW_LINE>final String subject = message.getSubject();<NEW_LINE>if (text == null)<NEW_LINE>return null;<NEW_LINE>if (subject != null)<NEW_LINE>return null;<NEW_LINE>RealmList<Attachment> attachments = HttpFileUploadManager.parseFileMessage(message);<NEW_LINE>String uid = UUID.randomUUID().toString();<NEW_LINE>RealmList<ForwardId> forwardIds = parseForwardedMessage(ui, message, uid);<NEW_LINE>String originalStanza = message.toXML().toString();<NEW_LINE>String originalFrom = message.getFrom().toString();<NEW_LINE>boolean fromMUC = message.getType(<MASK><NEW_LINE>// forward comment (to support previous forwarded xep)<NEW_LINE>String forwardComment = ForwardManager.parseForwardComment(message);<NEW_LINE>if (forwardComment != null)<NEW_LINE>text = forwardComment;<NEW_LINE>// modify body with references<NEW_LINE>Pair<String, String> bodies = ReferencesManager.modifyBodyWithReferences(message, text);<NEW_LINE>text = bodies.first;<NEW_LINE>String markupText = bodies.second;<NEW_LINE>// create message with file-attachments<NEW_LINE>if (attachments.size() > 0)<NEW_LINE>createAndSaveFileMessage(ui, uid, resource, text, markupText, null, timestamp, getDelayStamp(message), true, false, false, false, getStanzaId(message), attachments, originalStanza, parentMessageId, originalFrom, fromMUC, true, null);<NEW_LINE>else<NEW_LINE>// create message without attachments<NEW_LINE>createAndSaveNewMessage(ui, uid, resource, text, markupText, null, timestamp, getDelayStamp(message), true, false, false, false, getStanzaId(message), originalStanza, parentMessageId, originalFrom, forwardIds, fromMUC, true, null);<NEW_LINE>return uid;<NEW_LINE>} | ).equals(Type.groupchat); |
836,303 | private SingularityDeployResult checkLbRevertToActiveTasks(SingularityRequest request, SingularityDeploy deploy, SingularityPendingDeploy pendingDeploy, SingularityDeployProgress updatedProgress, DeployState acceptanceHookDeployState, Collection<SingularityTaskId> deployActiveTasks, Collection<SingularityTaskId> otherActiveTasks) {<NEW_LINE>final SingularityLoadBalancerUpdate lbUpdate = lbClient.getState(pendingDeploy.getDeployProgress().getPendingLbUpdate().get().getLoadBalancerRequestId());<NEW_LINE>DeployProgressLbUpdateHolder lbUpdateHolder = updatedProgress.getLbUpdates().get(lbUpdate.getLoadBalancerRequestId().toString());<NEW_LINE>if (lbUpdateHolder == null) {<NEW_LINE>return new SingularityDeployResult(DeployState.FAILED_INTERNAL_STATE, "Load balancer update metadata not found");<NEW_LINE>}<NEW_LINE>updateLoadBalancerStateForTasks(lbUpdateHolder.getAdded(), LoadBalancerRequestType.ADD, lbUpdate);<NEW_LINE>switch(lbUpdate.getLoadBalancerState()) {<NEW_LINE>case SUCCESS:<NEW_LINE>LOG.info("LB revert succeeded, continuing with original deploy status");<NEW_LINE>updatePendingDeploy(pendingDeploy, acceptanceHookDeployState, updatedProgress.withFinishedLbUpdate(lbUpdate, lbUpdateHolder));<NEW_LINE>return new SingularityDeployResult(acceptanceHookDeployState, String.join(", ", updatedProgress.getAcceptanceResultMessageHistory()));<NEW_LINE>case WAITING:<NEW_LINE>return new SingularityDeployResult(DeployState.WAITING);<NEW_LINE>default:<NEW_LINE>// Keep trying until we time out, since abandoning here would leave nothing in the LB<NEW_LINE>if (deployCheckHelper.isDeployOverdue(pendingDeploy, deploy)) {<NEW_LINE>LOG.error("Unable to revert load balancer for deploy failure");<NEW_LINE>return new SingularityDeployResult(DeployState.FAILED_INTERNAL_STATE, "Unable to revert load balancer for deploy failure");<NEW_LINE>} else {<NEW_LINE>LOG.warn("Retrying failed LB revert for {} {}", pendingDeploy.getDeployMarker().getRequestId(), pendingDeploy.<MASK><NEW_LINE>return enqueueLbRevertToActiveTasks(request, pendingDeploy, updatedProgress, deployActiveTasks, otherActiveTasks);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getDeployMarker().getDeployId()); |
1,472,914 | public void marshall(ProductViewSummary productViewSummary, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (productViewSummary == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getProductId(), PRODUCTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(productViewSummary.getOwner(), OWNER_BINDING);<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getShortDescription(), SHORTDESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getType(), TYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getDistributor(), DISTRIBUTOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getHasDefaultPath(), HASDEFAULTPATH_BINDING);<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getSupportEmail(), SUPPORTEMAIL_BINDING);<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getSupportDescription(), SUPPORTDESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(productViewSummary.getSupportUrl(), SUPPORTURL_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | productViewSummary.getName(), NAME_BINDING); |
1,232,605 | public AccountUsage unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AccountUsage accountUsage = new AccountUsage();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("TotalCodeSize", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>accountUsage.setTotalCodeSize(context.getUnmarshaller(Long.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("FunctionCount", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>accountUsage.setFunctionCount(context.getUnmarshaller(Long.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 accountUsage;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
226,923 | public void marshall(AwsEcrContainerAggregation awsEcrContainerAggregation, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (awsEcrContainerAggregation == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(awsEcrContainerAggregation.getArchitectures(), ARCHITECTURES_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsEcrContainerAggregation.getImageShas(), IMAGESHAS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsEcrContainerAggregation.getImageTags(), IMAGETAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsEcrContainerAggregation.getRepositories(), REPOSITORIES_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(awsEcrContainerAggregation.getSortBy(), SORTBY_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsEcrContainerAggregation.getSortOrder(), SORTORDER_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | awsEcrContainerAggregation.getResourceIds(), RESOURCEIDS_BINDING); |
1,550,211 | public void assertTopicOffsetAdvancesTo(long newOffset, Duration timeout, String topicName, int partitionId, String consumerGroupId) throws InterruptedException {<NEW_LINE>try (KafkaConsumer<?, ?> kafka = getKafkaTopicOffsetConsumer(consumerGroupId)) {<NEW_LINE>TopicPartition topicPartition;<NEW_LINE>if (partitionId == -1) {<NEW_LINE>topicPartition = getTopicPartition(kafka, topicName);<NEW_LINE>} else {<NEW_LINE>topicPartition <MASK><NEW_LINE>}<NEW_LINE>Duration remaining = timeout;<NEW_LINE>long startTime = System.nanoTime();<NEW_LINE>long currentOffset = getOffset(kafka, topicPartition);<NEW_LINE>while (!remaining.isNegative() && currentOffset < newOffset) {<NEW_LINE>Thread.sleep(100);<NEW_LINE>currentOffset = getOffset(kafka, topicPartition);<NEW_LINE>Duration elapsed = Duration.ofNanos(System.nanoTime() - startTime);<NEW_LINE>remaining = timeout.minus(elapsed);<NEW_LINE>}<NEW_LINE>assertEquals("Committed offset did not advance as expected", newOffset, currentOffset);<NEW_LINE>}<NEW_LINE>} | = new TopicPartition(topicName, partitionId); |
1,399,528 | public Order mergeCart(Customer customer, WebRequest request) {<NEW_LINE>Customer anonymousCustomer = customerStateRequestProcessor.getAnonymousCustomer(request);<NEW_LINE>MergeCartResponse mergeCartResponse;<NEW_LINE>try {<NEW_LINE>Order cart = orderService.findCartForCustomer(anonymousCustomer);<NEW_LINE>mergeCartResponse = <MASK><NEW_LINE>} catch (PricingException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} catch (RemoveFromCartException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>if (BLCRequestUtils.isOKtoUseSession(request)) {<NEW_LINE>// The anonymous customer from session is no longer needed; it can be safely removed<NEW_LINE>request.removeAttribute(CustomerStateRequestProcessor.getAnonymousCustomerSessionAttributeName(), WebRequest.SCOPE_SESSION);<NEW_LINE>request.removeAttribute(CustomerStateRequestProcessor.getAnonymousCustomerIdSessionAttributeName(), WebRequest.SCOPE_SESSION);<NEW_LINE>}<NEW_LINE>return mergeCartResponse.getOrder();<NEW_LINE>} | mergeCartService.mergeCart(customer, cart); |
1,822,623 | public void marshall(ChannelMessage channelMessage, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (channelMessage == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(channelMessage.getMessageId(), MESSAGEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getContent(), CONTENT_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getMetadata(), METADATA_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getType(), TYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getCreatedTimestamp(), CREATEDTIMESTAMP_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getLastEditedTimestamp(), LASTEDITEDTIMESTAMP_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getLastUpdatedTimestamp(), LASTUPDATEDTIMESTAMP_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getSender(), SENDER_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getRedacted(), REDACTED_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getPersistence(), PERSISTENCE_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelMessage.getMessageAttributes(), MESSAGEATTRIBUTES_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | channelMessage.getChannelArn(), CHANNELARN_BINDING); |
1,195,359 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {<NEW_LINE>// View rootView = inflater.inflate(R.layout.fragment_main, container, false);<NEW_LINE>FragmentMainBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_main, container, false);<NEW_LINE>binding.setHandlers(new MyHandler());<NEW_LINE>View rootView = binding.getRoot();<NEW_LINE>// Button button = (Button) rootView.findViewById(R.id.btnDetail);<NEW_LINE>// button.setOnClickListener(new View.OnClickListener() {<NEW_LINE>// @Override<NEW_LINE>// public void onClick(View v) {<NEW_LINE>// Small.openUri("detail?from=app.home", getContext());<NEW_LINE>// }<NEW_LINE>// });<NEW_LINE>Button button = (Button) rootView.findViewById(R.id.btnSubDetail);<NEW_LINE>button.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>Small.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>button = (Button) rootView.findViewById(R.id.btnAbout);<NEW_LINE>button.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>Small.openUri("about", getContext());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>button = (Button) rootView.findViewById(R.id.btnLib);<NEW_LINE>button.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>UIUtils.showToast(getContext(), "Hello World!");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>button = (Button) rootView.findViewById(R.id.btnUpgrade);<NEW_LINE>button.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>checkUpgrade();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return rootView;<NEW_LINE>} | openUri("detail/sub", getContext()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.