idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,785,878 | public int compareTo(waitForFlush_result other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.getClass().getName());<NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetSec(<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetSec()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sec, other.sec);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetTope(), other.isSetTope());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetTope()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tope, other.tope);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetTnase(), other.isSetTnase());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetTnase()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tnase, other.tnase);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | ), other.isSetSec()); |
369,478 | protected ArrayList<KeyNamePair> loadOrderData(int C_BPartner_ID, boolean forInvoice, boolean sameWarehouseOnly) {<NEW_LINE>ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>();<NEW_LINE>// Display<NEW_LINE>StringBuffer display = new StringBuffer("o.DocumentNo||' - ' ||").append(DB.TO_CHAR("o.DateOrdered", DisplayType.Date, Env.getAD_Language(Env.getCtx()))).append("||' - '||").append(DB.TO_CHAR("o.GrandTotal", DisplayType.Amount, Env.getAD_Language(Env.getCtx())));<NEW_LINE>//<NEW_LINE>String column = "ol.QtyDelivered";<NEW_LINE>if (forInvoice)<NEW_LINE>column = "ol.QtyInvoiced";<NEW_LINE>StringBuffer sql = new StringBuffer("SELECT o.C_Order_ID,").append(display).append(" FROM C_Order o " + "WHERE o.C_BPartner_ID=? AND o.IsSOTrx='N' AND o.DocStatus IN ('CL','CO')" + " AND o.C_Order_ID IN " + "(SELECT ol.C_Order_ID FROM C_OrderLine ol" + " WHERE ol.QtyOrdered - ").append(column).append(" != 0) ");<NEW_LINE>if (sameWarehouseOnly) {<NEW_LINE>sql = sql.append(" AND o.M_Warehouse_ID=? ");<NEW_LINE>}<NEW_LINE>sql = sql.append("ORDER BY o.DateOrdered");<NEW_LINE>//<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(<MASK><NEW_LINE>pstmt.setInt(1, C_BPartner_ID);<NEW_LINE>if (sameWarehouseOnly) {<NEW_LINE>// only active for material receipts<NEW_LINE>pstmt.setInt(2, getM_Warehouse_ID());<NEW_LINE>}<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>while (rs.next()) {<NEW_LINE>list.add(new KeyNamePair(rs.getInt(1), rs.getString(2)));<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.error(sql.toString(), e);<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>rs = null;<NEW_LINE>pstmt = null;<NEW_LINE>}<NEW_LINE>return list;<NEW_LINE>} | sql.toString(), null); |
1,008,247 | public void LAPACK_ztgsyl(String arg0, int[] arg1, int[] arg2, int[] arg3, double[] arg4, int[] arg5, double[] arg6, int[] arg7, double[] arg8, int[] arg9, double[] arg10, int[] arg11, double[] arg12, int[] arg13, double[] arg14, int[] arg15, double[] arg16, double[] arg17, double[] arg18, int[] arg19, int[] arg20, int[] arg21) {<NEW_LINE>LAPACK_ztgsyl(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, <MASK><NEW_LINE>} | arg18, arg19, arg20, arg21); |
611,655 | final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<TagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));<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, "AppRunner");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource"); |
1,010,650 | String censorMessage(final String username, final String message) {<NEW_LINE>String strippedMessage = jagexPrintableCharMatcher.retainFrom(message).replace('\u00A0', ' ');<NEW_LINE>String strippedAccents = StringUtils.stripAccents(strippedMessage);<NEW_LINE>assert strippedMessage.length() == strippedAccents.length();<NEW_LINE>if (username != null && shouldFilterByName(username)) {<NEW_LINE>switch(config.filterType()) {<NEW_LINE>case CENSOR_WORDS:<NEW_LINE>return StringUtils.repeat('*', strippedMessage.length());<NEW_LINE>case CENSOR_MESSAGE:<NEW_LINE>return CENSOR_MESSAGE;<NEW_LINE>case REMOVE_MESSAGE:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean filtered = false;<NEW_LINE>for (Pattern pattern : filteredPatterns) {<NEW_LINE>Matcher m = pattern.matcher(strippedAccents);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>int idx = 0;<NEW_LINE>while (m.find()) {<NEW_LINE>switch(config.filterType()) {<NEW_LINE>case CENSOR_WORDS:<NEW_LINE>MatchResult matchResult = m.toMatchResult();<NEW_LINE>sb.append(strippedMessage, idx, matchResult.start()).append(StringUtils.repeat('*', matchResult.group().length()));<NEW_LINE>idx = m.end();<NEW_LINE>filtered = true;<NEW_LINE>break;<NEW_LINE>case CENSOR_MESSAGE:<NEW_LINE>return CENSOR_MESSAGE;<NEW_LINE>case REMOVE_MESSAGE:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sb.append<MASK><NEW_LINE>strippedMessage = sb.toString();<NEW_LINE>assert strippedMessage.length() == strippedAccents.length();<NEW_LINE>}<NEW_LINE>return filtered ? strippedMessage : message;<NEW_LINE>} | (strippedMessage.substring(idx)); |
1,305,227 | protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {<NEW_LINE>GlStateManager.disableLighting();<NEW_LINE>GlStateManager.disableBlend();<NEW_LINE>final <MASK><NEW_LINE>fontRenderer.drawString(I18n.format("container.repair"), 60, 6 + ANVIL_Y_OFFSET, 4210752);<NEW_LINE>if (anvil.anvil.getMaximumCost() > 0) {<NEW_LINE>int i = 8453920;<NEW_LINE>boolean flag = true;<NEW_LINE>String s = I18n.format("container.repair.cost", anvil.anvil.getMaximumCost());<NEW_LINE>if (anvil.anvil.getMaximumCost() >= AnvilSubContainer.getMaxCost() && !parent.mc.player.capabilities.isCreativeMode) {<NEW_LINE>s = I18n.format("container.repair.expensive");<NEW_LINE>i = 16736352;<NEW_LINE>} else if (!this.anvil.getSlot(2).getHasStack()) {<NEW_LINE>flag = false;<NEW_LINE>} else if (!this.anvil.getSlot(2).canTakeStack(anvil.anvil.player)) {<NEW_LINE>i = 16736352;<NEW_LINE>}<NEW_LINE>if (flag) {<NEW_LINE>int j = -16777216 | (i & 16579836) >> 2 | i & -16777216;<NEW_LINE>int k = parent.getXSize() - 8 - fontRenderer.getStringWidth(s);<NEW_LINE>if (fontRenderer.getUnicodeFlag()) {<NEW_LINE>Gui.drawRect(k - 3, 65, parent.getXSize() - 7, 77 + ANVIL_Y_OFFSET, -16777216);<NEW_LINE>Gui.drawRect(k - 2, 66, parent.getXSize() - 8, 76 + ANVIL_Y_OFFSET, -12895429);<NEW_LINE>} else {<NEW_LINE>fontRenderer.drawString(s, k, 68 + ANVIL_Y_OFFSET, j);<NEW_LINE>fontRenderer.drawString(s, k + 1, 67 + ANVIL_Y_OFFSET, j);<NEW_LINE>fontRenderer.drawString(s, k + 1, 68 + ANVIL_Y_OFFSET, j);<NEW_LINE>}<NEW_LINE>fontRenderer.drawString(s, k, 67 + ANVIL_Y_OFFSET, i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>GlStateManager.disableLighting();<NEW_LINE>GlStateManager.disableBlend();<NEW_LINE>nameField.drawTextBox();<NEW_LINE>GlStateManager.enableBlend();<NEW_LINE>GlStateManager.enableLighting();<NEW_LINE>} | FontRenderer fontRenderer = parent.getFontRenderer(); |
52,146 | public final ResultList<Location> listPrefixesAfter(Fields fields, String fqn, int limitParam, String after) throws IOException {<NEW_LINE>String service = EntityUtil.splitFQN(fqn)[0];<NEW_LINE>// forward scrolling, if after == null then first page is being asked<NEW_LINE>List<String> jsons = daoCollection.locationDAO().listPrefixesAfter(daoCollection.locationDAO().getTableName(), daoCollection.locationDAO().getNameColumn(), fqn, service, limitParam + 1, after == null ? "" <MASK><NEW_LINE>List<Location> entities = new ArrayList<>();<NEW_LINE>for (String json : jsons) {<NEW_LINE>entities.add(setFields(JsonUtils.readValue(json, Location.class), fields));<NEW_LINE>}<NEW_LINE>int total = daoCollection.locationDAO().listPrefixesCount(daoCollection.locationDAO().getTableName(), daoCollection.locationDAO().getNameColumn(), fqn, service);<NEW_LINE>String beforeCursor;<NEW_LINE>String afterCursor = null;<NEW_LINE>beforeCursor = after == null ? null : getFullyQualifiedName(entities.get(0));<NEW_LINE>if (entities.size() > limitParam) {<NEW_LINE>// If extra result exists, then next page exists - return after cursor<NEW_LINE>entities.remove(limitParam);<NEW_LINE>afterCursor = getFullyQualifiedName(entities.get(limitParam - 1));<NEW_LINE>}<NEW_LINE>return getResultList(entities, beforeCursor, afterCursor, total);<NEW_LINE>} | : RestUtil.decodeCursor(after)); |
1,001,563 | public CreateCustomRoutingListenerResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateCustomRoutingListenerResult createCustomRoutingListenerResult = new CreateCustomRoutingListenerResult();<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 createCustomRoutingListenerResult;<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("Listener", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createCustomRoutingListenerResult.setListener(CustomRoutingListenerJsonUnmarshaller.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 createCustomRoutingListenerResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
444,214 | public JsonNode call(ObjectNode request) throws ReflectorException {<NEW_LINE>try {<NEW_LINE>if (tokenHolder.getToken() != null) {<NEW_LINE>request.put("token", tokenHolder.getToken());<NEW_LINE>}<NEW_LINE>HttpPost httppost = new HttpPost(remoteAddress);<NEW_LINE>httppost.setHeader("Content-Type", "application/json");<NEW_LINE>httppost.setEntity(new StringEntity(request.toString(), Charsets.UTF_8));<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug(request.toString());<NEW_LINE>}<NEW_LINE>HttpResponse response = <MASK><NEW_LINE>try {<NEW_LINE>if (response.getStatusLine().getStatusCode() == 200) {<NEW_LINE>HttpEntity resultEntity = response.getEntity();<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>InputStream inputStream = resultEntity.getContent();<NEW_LINE>ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();<NEW_LINE>IOUtils.copy(inputStream, byteArrayOutputStream);<NEW_LINE>LOGGER.debug(new String(byteArrayOutputStream.toByteArray(), Charsets.UTF_8));<NEW_LINE>ObjectNode resultObject = OBJECT_MAPPER.readValue(byteArrayOutputStream.toByteArray(), ObjectNode.class);<NEW_LINE>return resultObject;<NEW_LINE>} else {<NEW_LINE>return OBJECT_MAPPER.readValue(resultEntity.getContent(), ObjectNode.class);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new ReflectorException("Call unsuccessful, status code: " + response.getStatusLine().getStatusCode() + " (" + response.getStatusLine().getReasonPhrase() + "), " + remoteAddress);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>httppost.releaseConnection();<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new ReflectorException(e);<NEW_LINE>}<NEW_LINE>} | httpclient.execute(httppost, context); |
1,728,947 | public static void main(String[] args) {<NEW_LINE>Jsonb jsonb = JsonbBuilder.create();<NEW_LINE>Model instance = new Model();<NEW_LINE>instance.string = "Hello World!";<NEW_LINE>instance.number = 42;<NEW_LINE>instance.integers = Arrays.asList(1, 2, 3);<NEW_LINE>instance.decimals = new HashSet<>(Arrays.asList(BigDecimal.ONE, BigDecimal.ZERO));<NEW_LINE>instance.uuids = new UUID[] { new UUID(1L, 2L), new UUID(3L, 4L) };<NEW_LINE>instance.longs = new Vector<>(Arrays.asList(1L, 2L));<NEW_LINE>instance.nested = Arrays.asList(new Model.Nested(), null);<NEW_LINE>instance.inheritance = new Model.ParentClass();<NEW_LINE>instance.inheritance.a = 5;<NEW_LINE>instance.inheritance.b = 6;<NEW_LINE>instance.iface = new Model.WithCustomCtor(5, 6);<NEW_LINE>instance.person = new ImmutablePerson("first name", "last name", 35);<NEW_LINE>instance.states = Arrays.asList(Model.State.HI, Model.State.LOW);<NEW_LINE>instance.intList = new ArrayList<>(Arrays.asList(123, 456));<NEW_LINE>instance.map = new HashMap<>();<NEW_LINE>instance.map.put("abc", 678);<NEW_LINE>instance.map.put("array", new int[] { 2, 4, 8 });<NEW_LINE>instance.factories = Arrays.asList(null, Model.ViaFactory.create("me", 2), Model.ViaFactory.create("you", 3), null);<NEW_LINE>instance.builder = PersonBuilder.builder().firstName("first").lastName("last").<MASK><NEW_LINE>// TODO while string API is supported, it should be avoided in favor of stream API<NEW_LINE>String result = jsonb.toJson(instance);<NEW_LINE>System.out.println(result);<NEW_LINE>// TODO while string API is supported, it should be avoided in favor of stream API<NEW_LINE>Model deser = jsonb.fromJson(result, Model.class);<NEW_LINE>System.out.println(deser.string);<NEW_LINE>} | age(42).build(); |
1,779,699 | public static ErrorDescription apply(HintContext hc) {<NEW_LINE>if (hc.isCanceled()) {<NEW_LINE>// NOI18N<NEW_LINE>// we pass only if it is an annotation<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final JPAProblemContext ctx = ModelUtils.getOrCreateCachedContext(hc);<NEW_LINE>if (ctx == null || hc.isCanceled()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TypeElement subject = ctx.getJavaClass();<NEW_LINE>AnnotationMirror isENtityMapped = getFirstAnnotationFromGivenSet(subject, Arrays.asList(JPAAnnotations.ENTITY, JPAAnnotations.MAPPED_SUPERCLASS));<NEW_LINE>if (isENtityMapped != null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>AnnotationMirror firstOffendingAnotation = getFirstAnnotationFromGivenSet(subject, Arrays.asList(JPAAnnotations.NAMED_QUERY, JPAAnnotations.NAMED_NATIVE_QUERY, JPAAnnotations<MASK><NEW_LINE>if (firstOffendingAnotation != null) {<NEW_LINE>TreePath par = hc.getPath();<NEW_LINE>while (par != null && par.getParentPath() != null && par.getLeaf().getKind() != Tree.Kind.CLASS) {<NEW_LINE>par = par.getParentPath();<NEW_LINE>}<NEW_LINE>Utilities.TextSpan underlineSpan = Utilities.getUnderlineSpan(ctx.getCompilationInfo(), par.getLeaf());<NEW_LINE>return ErrorDescriptionFactory.forSpan(hc, underlineSpan.getStartOffset(), underlineSpan.getEndOffset(), NbBundle.getMessage(QueriesProperlyDefined.class, "MSG_QueriesProperlyDefined"));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | .NAMED_QUERIES, JPAAnnotations.NAMED_NATIVE_QUERIES)); |
513,692 | public static boolean shouldColocateJoin(AbstractPhysicalJoin<PhysicalPlan, PhysicalPlan> join) {<NEW_LINE>if (ConnectContext.get() == null || ConnectContext.get().getSessionVariable().isDisableColocatePlan()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>DistributionSpec joinDistributionSpec = join.getPhysicalProperties().getDistributionSpec();<NEW_LINE>DistributionSpec leftDistributionSpec = join.left().getPhysicalProperties().getDistributionSpec();<NEW_LINE>DistributionSpec rightDistributionSpec = join.right()<MASK><NEW_LINE>if (!(leftDistributionSpec instanceof DistributionSpecHash) || !(rightDistributionSpec instanceof DistributionSpecHash) || !(joinDistributionSpec instanceof DistributionSpecHash)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>DistributionSpecHash leftHash = (DistributionSpecHash) leftDistributionSpec;<NEW_LINE>DistributionSpecHash rightHash = (DistributionSpecHash) rightDistributionSpec;<NEW_LINE>DistributionSpecHash joinHash = (DistributionSpecHash) joinDistributionSpec;<NEW_LINE>return leftHash.getShuffleType() == ShuffleType.NATURAL && rightHash.getShuffleType() == ShuffleType.NATURAL && joinHash.getShuffleType() == ShuffleType.NATURAL;<NEW_LINE>} | .getPhysicalProperties().getDistributionSpec(); |
667,933 | public Mono<Response<Void>> updateWithResponseAsync(String objectId, String tenantId, ServicePrincipalUpdateParameters parameters) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (objectId == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (tenantId == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter tenantId is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json, text/json";<NEW_LINE>return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), objectId, this.client.getApiVersion(), tenantId, parameters, accept, context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));<NEW_LINE>} | error(new IllegalArgumentException("Parameter objectId is required and cannot be null.")); |
53,998 | private Result equalsParametrizedTypes(List<Type> commandParametrizedTypes, List<Type> fallbackParametrizedTypes) {<NEW_LINE>if (commandParametrizedTypes.size() != fallbackParametrizedTypes.size()) {<NEW_LINE>return Result.failure(Collections.singletonList(new Error("Different size of types variables.\n" + "Command type literals size = " + commandParametrizedTypes.size() + ": " + commandParametrizedTypes + "\n" + "Fallback type literals size = " + fallbackParametrizedTypes.size() + ": " + fallbackParametrizedTypes + "\n")));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < commandParametrizedTypes.size(); i++) {<NEW_LINE>Type commandParametrizedType = commandParametrizedTypes.get(i);<NEW_LINE>Type fallbackParametrizedType = fallbackParametrizedTypes.get(i);<NEW_LINE>Result <MASK><NEW_LINE>if (!result.success)<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>return SUCCESS;<NEW_LINE>} | result = equals(commandParametrizedType, fallbackParametrizedType); |
250,917 | private void publishValue(String itemName, Object value, WeatherBindingConfig bindingConfig) {<NEW_LINE>if (value == null) {<NEW_LINE>context.getEventPublisher().postUpdate(itemName, UnDefType.UNDEF);<NEW_LINE>} else if (value instanceof Calendar) {<NEW_LINE>Calendar calendar = (Calendar) value;<NEW_LINE>context.getEventPublisher().postUpdate(itemName, new DateTimeType(calendar));<NEW_LINE>} else if (value instanceof Number) {<NEW_LINE>context.getEventPublisher().postUpdate(itemName, new DecimalType(round(value.toString(), bindingConfig)));<NEW_LINE>} else if (value instanceof String || value instanceof Enum) {<NEW_LINE>if (value instanceof Enum) {<NEW_LINE>String enumValue = WordUtils.capitalizeFully(StringUtils.replace(value.toString(), "_", " "));<NEW_LINE>context.getEventPublisher().postUpdate(itemName, new StringType(enumValue));<NEW_LINE>} else {<NEW_LINE>context.getEventPublisher().postUpdate(itemName, new StringType<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.warn("Unsupported value type {}", value.getClass().getSimpleName());<NEW_LINE>}<NEW_LINE>} | (value.toString())); |
482,039 | private void sendAlarmConsumerError(AlarmConfigInfo alarmConfing, AlarmConsumerInfo alarmConsumer, long lag, AlarmMessageInfo alarmMsg) {<NEW_LINE>if (alarmConfing.getAlarmType().equals(KConstants.AlarmType.EMAIL)) {<NEW_LINE>alarmMsg.setTitle("EFAK - Alert Consumer Notice");<NEW_LINE>alarmMsg.setAlarmStatus("PROBLEM");<NEW_LINE>alarmMsg.setAlarmContent("lag.overflow [ cluster(" + alarmConsumer.getCluster() + "), group(" + alarmConsumer.getGroup() + "), topic(" + alarmConsumer.getTopic() + "), current(" + lag + "), max(" + alarmConsumer.getLag() + ") ]");<NEW_LINE>IMService im = new IMFactory().create();<NEW_LINE>JSONObject object = new JSONObject();<NEW_LINE>object.put("address", alarmConfing.getAlarmAddress());<NEW_LINE>if (JSONUtils.isJsonObject(alarmConfing.getAlarmUrl())) {<NEW_LINE>object.put("msg", alarmMsg.toMailJSON());<NEW_LINE>} else {<NEW_LINE>object.put(<MASK><NEW_LINE>}<NEW_LINE>object.put("title", alarmMsg.getTitle());<NEW_LINE>im.sendPostMsgByMail(object.toJSONString(), alarmConfing.getAlarmUrl());<NEW_LINE>} else if (alarmConfing.getAlarmType().equals(KConstants.AlarmType.DingDing)) {<NEW_LINE>alarmMsg.setTitle("EFAK - Alert Consumer Notice");<NEW_LINE>alarmMsg.setAlarmContent("lag.overflow [ cluster(" + alarmConsumer.getCluster() + "), group(" + alarmConsumer.getGroup() + "), topic(" + alarmConsumer.getTopic() + "), current(" + lag + "), max(" + alarmConsumer.getLag() + ") ]");<NEW_LINE>alarmMsg.setAlarmStatus("PROBLEM");<NEW_LINE>IMService im = new IMFactory().create();<NEW_LINE>im.sendPostMsgByDingDing(alarmMsg.toDingDingMarkDown(), alarmConfing.getAlarmUrl());<NEW_LINE>} else if (alarmConfing.getAlarmType().equals(KConstants.AlarmType.WeChat)) {<NEW_LINE>alarmMsg.setTitle("`EFAK - Alert Consumer Notice`\n");<NEW_LINE>alarmMsg.setAlarmContent("<font color=\"warning\">lag.overflow [ cluster(" + alarmConsumer.getCluster() + "), group(" + alarmConsumer.getGroup() + "), topic(" + alarmConsumer.getTopic() + "), current(" + lag + "), max(" + alarmConsumer.getLag() + ") ]</font>");<NEW_LINE>alarmMsg.setAlarmStatus("<font color=\"warning\">PROBLEM</font>");<NEW_LINE>IMServiceImpl im = new IMServiceImpl();<NEW_LINE>im.sendPostMsgByWeChat(alarmMsg.toWeChatMarkDown(), alarmConfing.getAlarmUrl());<NEW_LINE>}<NEW_LINE>} | "msg", alarmMsg.toMail()); |
245,007 | protected void encodeTabularLayout(FacesContext context, SelectOneRadio radio, String layout) throws IOException {<NEW_LINE>ResponseWriter writer = context.getResponseWriter();<NEW_LINE>String clientId = radio.getClientId(context);<NEW_LINE>List<SelectItem> selectItems = getSelectItems(context, radio);<NEW_LINE>String style = radio.getStyle();<NEW_LINE>String styleClass = getStyleClassBuilder(context).add(radio.getStyleClass()).add(radio.isPlain(), SelectOneRadio.NATIVE_STYLE_CLASS, SelectOneRadio.STYLE_CLASS).build();<NEW_LINE>String labelledBy = radio.getLabel();<NEW_LINE><MASK><NEW_LINE>writer.writeAttribute("id", clientId, "id");<NEW_LINE>writer.writeAttribute("role", "radiogroup", null);<NEW_LINE>if (labelledBy != null) {<NEW_LINE>writer.writeAttribute("aria-labelledby", labelledBy, "label");<NEW_LINE>}<NEW_LINE>writer.writeAttribute("class", styleClass, "styleClass");<NEW_LINE>if (style != null) {<NEW_LINE>writer.writeAttribute("style", style, "style");<NEW_LINE>}<NEW_LINE>renderARIARequired(context, radio);<NEW_LINE>encodeSelectItems(context, radio, selectItems, layout);<NEW_LINE>writer.endElement("table");<NEW_LINE>} | writer.startElement("table", radio); |
1,175,968 | private void reloadHistoryInternal() {<NEW_LINE>if (historySearchFragment != null) {<NEW_LINE>try {<NEW_LINE>List<QuickSearchListItem> <MASK><NEW_LINE>boolean historyEnabled = app.getSettings().SEARCH_HISTORY.get();<NEW_LINE>if (historyEnabled) {<NEW_LINE>SearchResultCollection res = searchUICore.shallowSearch(SearchHistoryAPI.class, "", null, false, false);<NEW_LINE>if (res != null) {<NEW_LINE>for (SearchResult sr : res.getCurrentSearchResults()) {<NEW_LINE>rows.add(new QuickSearchListItem(app, sr));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>OnClickListener listener = v -> {<NEW_LINE>FragmentManager fragmentManager = getFragmentManager();<NEW_LINE>if (fragmentManager != null) {<NEW_LINE>SearchHistorySettingsFragment.showInstance(getFragmentManager(), QuickSearchDialogFragment.this);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>rows.add(new QuickSearchDisabledHistoryItem(app, listener));<NEW_LINE>}<NEW_LINE>historySearchFragment.updateListAdapter(rows, false, historyEnabled);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>app.showToastMessage(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | rows = new ArrayList<>(); |
246,817 | public static void main(String[] args) throws Exception {<NEW_LINE>if (args == null || args.length < 1) {<NEW_LINE>System.out.println("Invalid parameter");<NEW_LINE>usage();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String topologyName = args[0];<NEW_LINE>String[] str2 = Arrays.copyOfRange(args, 1, args.length);<NEW_LINE>CommandLineParser parser = new GnuParser();<NEW_LINE>Options r = buildGeneralOptions(new Options());<NEW_LINE>CommandLine commandLine = parser.parse(r, str2, true);<NEW_LINE>int workerNum = 0;<NEW_LINE>String component = null;<NEW_LINE>List<String> workers = null;<NEW_LINE>if (commandLine.hasOption("n")) {<NEW_LINE>workerNum = Integer.valueOf(commandLine.getOptionValue("n"));<NEW_LINE>}<NEW_LINE>if (commandLine.hasOption("p")) {<NEW_LINE>component = commandLine.getOptionValue("p");<NEW_LINE>}<NEW_LINE>if (commandLine.hasOption("w")) {<NEW_LINE>String <MASK><NEW_LINE>if (!StringUtils.isBlank(w)) {<NEW_LINE>workers = Lists.newArrayList();<NEW_LINE>String[] parts = w.split(",");<NEW_LINE>for (String part : parts) {<NEW_LINE>if (part.split(":").length == 2) {<NEW_LINE>workers.add(part.trim());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>upgradeTopology(topologyName, component, workers, workerNum);<NEW_LINE>} | w = commandLine.getOptionValue("w"); |
539,183 | public void processMessage(final WebSocketMessage webSocketData) {<NEW_LINE>setDoTransactionNotifications(true);<NEW_LINE>final SecurityContext securityContext = getWebSocket().getSecurityContext();<NEW_LINE>try {<NEW_LINE>final String uuid = webSocketData.getId();<NEW_LINE>int sequenceNumber = webSocketData.getNodeDataIntegerValue("chunkId");<NEW_LINE>int chunkSize = webSocketData.getNodeDataIntegerValue("chunkSize");<NEW_LINE>int chunks = webSocketData.getNodeDataIntegerValue("chunks");<NEW_LINE>Object rawData = webSocketData.getNodeData().get("chunk");<NEW_LINE>byte[] data = new byte[0];<NEW_LINE>if (rawData != null) {<NEW_LINE>if (rawData instanceof String) {<NEW_LINE>logger.debug("Raw data: {}", rawData);<NEW_LINE>// data = Base64.decodeBase64(((String)rawData).getBytes("UTF-8"));<NEW_LINE>data = Base64.decode(((String) rawData));<NEW_LINE>logger.debug("Decoded data: {}", data);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final File file = (File) getNode(uuid);<NEW_LINE>if (file.isTemplate()) {<NEW_LINE>logger.warn("No write permission, file is in template mode: {}", new Object[] { file.toString() });<NEW_LINE>getWebSocket().send(MessageBuilder.status().message("No write permission, file is in template mode").code(400).build(), true);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!file.isGranted(Permission.write, securityContext)) {<NEW_LINE>logger.warn("No write permission for {} on {}", new Object[] { getWebSocket().getCurrentUser().toString(), file.toString() });<NEW_LINE>getWebSocket().send(MessageBuilder.status().message("No write permission").code(400).build(), true);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>getWebSocket().handleFileChunk(uuid, sequenceNumber, chunkSize, data, chunks);<NEW_LINE>if (sequenceNumber + 1 == chunks) {<NEW_LINE>FileHelper.updateMetadata(file);<NEW_LINE>file.increaseVersion();<NEW_LINE>getWebSocket().removeFileUploadHandler(uuid);<NEW_LINE>logger.debug("File upload finished. Checksum: {}, size: {}", new Object[] { file.getChecksum(), file.getSize() });<NEW_LINE>}<NEW_LINE>final long currentSize = (long) (sequenceNumber * chunkSize) + data.length;<NEW_LINE>// This should trigger setting of lastModifiedDate in any case<NEW_LINE>getWebSocket().send(MessageBuilder.status().code(200).message("{\"id\":\"" + file.getUuid() + "\", \"name\":\"" + file.getName() + "\",\"size\":" + currentSize + "}").build(), true);<NEW_LINE>if (sequenceNumber + 1 == chunks) {<NEW_LINE>TransactionCommand.registerNodeCallback((NodeInterface) file, callback);<NEW_LINE>}<NEW_LINE>} catch (IOException | FrameworkException ex) {<NEW_LINE>String msg = ex.toString();<NEW_LINE>// return error message<NEW_LINE>getWebSocket().send(MessageBuilder.status().code(400).message("Could not process chunk data: ".concat((msg != null) ? msg : "")<MASK><NEW_LINE>}<NEW_LINE>} | ).build(), true); |
916,148 | final AddFlowMediaStreamsResult executeAddFlowMediaStreams(AddFlowMediaStreamsRequest addFlowMediaStreamsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(addFlowMediaStreamsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<AddFlowMediaStreamsRequest> request = null;<NEW_LINE>Response<AddFlowMediaStreamsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AddFlowMediaStreamsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(addFlowMediaStreamsRequest));<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, "MediaConnect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AddFlowMediaStreams");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AddFlowMediaStreamsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AddFlowMediaStreamsResultJsonUnmarshaller());<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); |
618,033 | public StatementMetricHandle addStatement(DeploymentIdNamePair statement) {<NEW_LINE>// determine group<NEW_LINE>int countGroups = 1;<NEW_LINE>int groupNumber = -1;<NEW_LINE>for (Map.Entry<String, ConfigurationRuntimeMetricsReporting.StmtGroupMetrics> entry : specification.getStatementGroups().entrySet()) {<NEW_LINE>List<Pair<StringPatternSet, Boolean>> patterns = entry<MASK><NEW_LINE>boolean result = StringPatternSetUtil.evaluate(entry.getValue().isDefaultInclude(), patterns, statement.getName());<NEW_LINE>if (result) {<NEW_LINE>groupNumber = countGroups;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>countGroups++;<NEW_LINE>}<NEW_LINE>// assign to default group if none other apply<NEW_LINE>if (groupNumber == -1) {<NEW_LINE>groupNumber = 0;<NEW_LINE>}<NEW_LINE>int index = groupMetrics[groupNumber].addStatementGetIndex(statement);<NEW_LINE>statementGroups.put(statement, groupNumber);<NEW_LINE>return new StatementMetricHandle(groupNumber, index);<NEW_LINE>} | .getValue().getPatterns(); |
557,867 | public static void addToItemTooltip(ItemTooltipEvent event) {<NEW_LINE>if (!AllConfigs.CLIENT.tooltips.get())<NEW_LINE>return;<NEW_LINE>if (event.getPlayer() == null)<NEW_LINE>return;<NEW_LINE>ItemStack stack = event.getItemStack();<NEW_LINE>String translationKey = stack.getItem().getDescriptionId(stack);<NEW_LINE>if (translationKey.startsWith(ITEM_PREFIX) || translationKey.startsWith(BLOCK_PREFIX))<NEW_LINE>if (TooltipHelper.hasTooltip(stack, event.getPlayer())) {<NEW_LINE>List<Component> itemTooltip = event.getToolTip();<NEW_LINE>List<Component> toolTip = new ArrayList<>();<NEW_LINE>toolTip.add(itemTooltip.remove(0));<NEW_LINE>TooltipHelper.getTooltip(stack).addInformation(toolTip);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (stack.getItem() instanceof BlockItem) {<NEW_LINE>BlockItem item = (BlockItem) stack.getItem();<NEW_LINE>if (item.getBlock() instanceof IRotate || item.getBlock() instanceof EngineBlock) {<NEW_LINE>List<Component> kineticStats = ItemDescription.getKineticStats(item.getBlock());<NEW_LINE>if (!kineticStats.isEmpty()) {<NEW_LINE>event.getToolTip().add(new TextComponent(""));<NEW_LINE>event.getToolTip().addAll(kineticStats);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>PonderTooltipHandler.addToTooltip(event.getToolTip(), stack);<NEW_LINE>SequencedAssemblyRecipe.addToTooltip(event.getToolTip(), stack);<NEW_LINE>} | itemTooltip.addAll(0, toolTip); |
567,965 | // ------------------------------------------------------------------------<NEW_LINE>// [NOT] BETWEEN predicates<NEW_LINE>// ------------------------------------------------------------------------<NEW_LINE>@Override<NEW_LINE>public final BetweenAndStep16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> between(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16) {<NEW_LINE>return between(row(Tools.field(t1, (DataType) dataType(0)), Tools.field(t2, (DataType) dataType(1)), Tools.field(t3, (DataType) dataType(2)), Tools.field(t4, (DataType) dataType(3)), Tools.field(t5, (DataType) dataType(4)), Tools.field(t6, (DataType) dataType(5)), Tools.field(t7, (DataType) dataType(6)), Tools.field(t8, (DataType) dataType(7)), Tools.field(t9, (DataType) dataType(8)), Tools.field(t10, (DataType) dataType(9)), Tools.field(t11, (DataType) dataType(10)), Tools.field(t12, (DataType) dataType(11)), Tools.field(t13, (DataType) dataType(12)), Tools.field(t14, (DataType) dataType(13)), Tools.field(t15, (DataType) dataType(14)), Tools.field(t16, (DataType<MASK><NEW_LINE>} | ) dataType(15)))); |
1,089,983 | <OUTPUT_TYPE extends QueryTarget> Set<OUTPUT_TYPE> eval(QueryEvaluator<NODE_TYPE> evaluator, QueryEnvironment<NODE_TYPE> env) throws QueryException {<NEW_LINE>ImmutableList<QueryExpression<NODE_TYPE>> operands = getOperands();<NEW_LINE>Set<QueryTarget> lhsValue = new LinkedHashSet<>(evaluator.eval(operands.get(0), env));<NEW_LINE>for (int i = 1; i < operands.size(); i++) {<NEW_LINE>Set<QueryTarget> rhsValue = evaluator.eval(operands<MASK><NEW_LINE>switch(getOperator()) {<NEW_LINE>case INTERSECT:<NEW_LINE>lhsValue.retainAll(rhsValue);<NEW_LINE>break;<NEW_LINE>case UNION:<NEW_LINE>lhsValue.addAll(rhsValue);<NEW_LINE>break;<NEW_LINE>case EXCEPT:<NEW_LINE>lhsValue.removeAll(rhsValue);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("operator=" + getOperator());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (Set<OUTPUT_TYPE>) lhsValue;<NEW_LINE>} | .get(i), env); |
179,695 | public static void main(String[] args) {<NEW_LINE>try {<NEW_LINE>TreeReader tr = new PennTreeReader(new StringReader("(S (NP (NNP Sam)) (VP (VBD died) (NP (NN today))))"), new LabeledScoredTreeFactory());<NEW_LINE>Tree t = tr.readTree();<NEW_LINE>System.out.println(t);<NEW_LINE>TreeGraphNode tgn = new TreeGraphNode(t, (TreeGraphNode) null);<NEW_LINE>System.out.println(tgn.toPrettyString(0));<NEW_LINE><MASK><NEW_LINE>System.out.println(tgn.toPrettyString(0));<NEW_LINE>tgn.percolateHeads(new SemanticHeadFinder());<NEW_LINE>System.out.println(tgn.toPrettyString(0));<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Horrible error: " + e);<NEW_LINE>log.error(e);<NEW_LINE>}<NEW_LINE>} | EnglishGrammaticalStructure gs = new EnglishGrammaticalStructure(tgn); |
1,522,664 | private void passwordVisibilityToggled(boolean isMasked, CharSequence password) {<NEW_LINE>if (maskDrawable == null) {<NEW_LINE>// lazily create the drawable that morphs the dots<NEW_LINE>if (!isLaidOut() || getText() == null || getText().length() < 1)<NEW_LINE>return;<NEW_LINE>maskDrawable = new MaskMorphDrawable(getContext(), getPaint(), getBaseline(), getLayout().getPrimaryHorizontal(1), getPaddingLeft());<NEW_LINE>maskDrawable.setBounds(getPaddingLeft(), getPaddingTop(), getPaddingLeft(), getHeight() - getPaddingBottom());<NEW_LINE>getOverlay().add(maskDrawable);<NEW_LINE>}<NEW_LINE>// hide the text during the animation<NEW_LINE>setTextColor(Color.TRANSPARENT);<NEW_LINE>Animator maskMorph = isMasked ? maskDrawable.createShowMaskAnimator(password<MASK><NEW_LINE>maskMorph.addListener(new AnimatorListenerAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onAnimationEnd(Animator animation) {<NEW_LINE>// restore the proper text color<NEW_LINE>setTextColor(textColor);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>maskMorph.start();<NEW_LINE>} | ) : maskDrawable.createHideMaskAnimator(password); |
88,374 | public void showClientMyLateTickets(ActionRequest request, ActionResponse response) {<NEW_LINE>try {<NEW_LINE>ClientViewService clientViewService = Beans.get(ClientViewService.class);<NEW_LINE>User clientUser = clientViewService.getClientUser();<NEW_LINE>if (clientUser.getPartner() == null) {<NEW_LINE>response.setError(I18n.get(ITranslation.CLIENT_PORTAL_NO_PARTNER));<NEW_LINE>} else {<NEW_LINE>Filter filter = clientViewService.getLateTicketsOfUser<MASK><NEW_LINE>if (filter != null) {<NEW_LINE>response.setView(ActionView.define(I18n.get("Late tickets")).model(Ticket.class.getName()).add("grid", "ticket-grid").add("form", "ticket-form").param("search-filters", "ticket-filters").domain(filter.getQuery()).map());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>TraceBackService.trace(response, e);<NEW_LINE>}<NEW_LINE>} | (clientUser).get(0); |
217,943 | public void prepare() throws Exception {<NEW_LINE>// The task ID is different for local and cluster executions<NEW_LINE>// So including that in the log can help associate the log to the run<NEW_LINE>LOG.info("Task ID is {}", mBaseParameters.mId);<NEW_LINE>// Prepare block IDs to use for this test<NEW_LINE>// We prepare the IDs before test starts so each RPC does not waste time in the conversion<NEW_LINE>Map<BlockStoreLocation, List<Long>> blockMap = RpcBenchPreparationUtils.generateBlockIdOnTiers(mParameters.mTiers);<NEW_LINE>BlockMasterClient client = new BlockMasterClient(MasterClientContext.newBuilder(ClientContext.create(mConf)).build());<NEW_LINE>mLocationBlockIdList = client.convertBlockListMapToProto(blockMap);<NEW_LINE>// The preparation is done by the invoking shell process to ensure the preparation is only<NEW_LINE>// done once, so skip preparation when running in job worker<NEW_LINE>if (!mBaseParameters.mDistributed) {<NEW_LINE>// Prepare these block IDs concurrently<NEW_LINE>LOG.info("Preparing block IDs at the master");<NEW_LINE>RpcBenchPreparationUtils.prepareBlocksInMaster(blockMap);<NEW_LINE>LOG.info("Created all blocks at the master");<NEW_LINE>}<NEW_LINE>// Prepare simulated workers<NEW_LINE>int numWorkers = mParameters.mConcurrency;<NEW_LINE>LOG.info("Register {} simulated workers for the test", numWorkers);<NEW_LINE>mWorkerPool = RpcBenchPreparationUtils.prepareWorkerIds(client, numWorkers);<NEW_LINE>Preconditions.checkState(mWorkerPool.size() == numWorkers, "Expecting %s workers but registered %s", <MASK><NEW_LINE>RpcBenchPreparationUtils.registerWorkers(client, mWorkerPool);<NEW_LINE>LOG.info("All workers registered with the master {}", mWorkerPool);<NEW_LINE>} | numWorkers, mWorkerPool.size()); |
70,745 | public void updateIndices(SegmentDirectory.Writer segmentWriter, IndexCreatorProvider indexCreatorProvider) throws IOException {<NEW_LINE>// Remove indices not set in table config any more.<NEW_LINE>String segmentName = _segmentMetadata.getName();<NEW_LINE>Set<String> existingColumns = segmentWriter.toSegmentDirectory().getColumnsWithIndex(ColumnIndexType.INVERTED_INDEX);<NEW_LINE>for (String column : existingColumns) {<NEW_LINE>if (!_columnsToAddIdx.remove(column)) {<NEW_LINE>LOGGER.info("Removing existing inverted index from segment: {}, column: {}", segmentName, column);<NEW_LINE>segmentWriter.removeIndex(column, ColumnIndexType.INVERTED_INDEX);<NEW_LINE>LOGGER.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String column : _columnsToAddIdx) {<NEW_LINE>ColumnMetadata columnMetadata = _segmentMetadata.getColumnMetadataFor(column);<NEW_LINE>if (shouldCreateInvertedIndex(columnMetadata)) {<NEW_LINE>createInvertedIndexForColumn(segmentWriter, columnMetadata, indexCreatorProvider);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | info("Removed existing inverted index from segment: {}, column: {}", segmentName, column); |
429,267 | public void indexDocumentsAsync() {<NEW_LINE>// BEGIN: com.azure.search.documents.SearchAsyncClient.indexDocuments#IndexDocumentsBatch<NEW_LINE>SearchDocument searchDocument1 = new SearchDocument();<NEW_LINE>searchDocument1.put("hotelId", "1");<NEW_LINE><MASK><NEW_LINE>SearchDocument searchDocument2 = new SearchDocument();<NEW_LINE>searchDocument2.put("hotelId", "2");<NEW_LINE>searchDocument2.put("hotelName", "test2");<NEW_LINE>IndexDocumentsBatch<SearchDocument> indexDocumentsBatch = new IndexDocumentsBatch<>();<NEW_LINE>indexDocumentsBatch.addUploadActions(Collections.singletonList(searchDocument1));<NEW_LINE>indexDocumentsBatch.addDeleteActions(Collections.singletonList(searchDocument2));<NEW_LINE>searchAsyncClient.indexDocuments(indexDocumentsBatch).subscribe(result -> {<NEW_LINE>for (IndexingResult indexingResult : result.getResults()) {<NEW_LINE>System.out.printf("Does document with key %s finish successfully? %b%n", indexingResult.getKey(), indexingResult.isSucceeded());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// END: com.azure.search.documents.SearchAsyncClient.indexDocuments#IndexDocumentsBatch<NEW_LINE>} | searchDocument1.put("hotelName", "test1"); |
1,694,467 | private void extractColumns(ResultSet set, Table.Factory table) throws SQLException {<NEW_LINE>String col1 = set.getString(ExtensionTableProviderTable.COL_1);<NEW_LINE>if (col1 != null) {<NEW_LINE>table.columnOne(col1<MASK><NEW_LINE>table.columnOneFormat(extractFormat(set, ExtensionTableProviderTable.FORMAT_1));<NEW_LINE>}<NEW_LINE>String col2 = set.getString(ExtensionTableProviderTable.COL_2);<NEW_LINE>if (col2 != null) {<NEW_LINE>table.columnTwo(col2, extractIcon(set, "i2"));<NEW_LINE>table.columnTwoFormat(extractFormat(set, ExtensionTableProviderTable.FORMAT_2));<NEW_LINE>}<NEW_LINE>String col3 = set.getString(ExtensionTableProviderTable.COL_3);<NEW_LINE>if (col3 != null) {<NEW_LINE>table.columnThree(col3, extractIcon(set, "i3"));<NEW_LINE>table.columnThreeFormat(extractFormat(set, ExtensionTableProviderTable.FORMAT_3));<NEW_LINE>}<NEW_LINE>String col4 = set.getString(ExtensionTableProviderTable.COL_4);<NEW_LINE>if (col4 != null) {<NEW_LINE>table.columnFour(col4, extractIcon(set, "i4"));<NEW_LINE>table.columnFourFormat(extractFormat(set, ExtensionTableProviderTable.FORMAT_4));<NEW_LINE>}<NEW_LINE>String col5 = set.getString(ExtensionTableProviderTable.COL_5);<NEW_LINE>if (col5 != null) {<NEW_LINE>table.columnFive(col5, extractIcon(set, "i5"));<NEW_LINE>table.columnFiveFormat(extractFormat(set, ExtensionTableProviderTable.FORMAT_5));<NEW_LINE>}<NEW_LINE>} | , extractIcon(set, "i1")); |
1,223,875 | static void canonicalize(Buffer out, String input, int pos, int limit, String encodeSet, boolean alreadyEncoded, boolean plusIsSpace, boolean asciiOnly) throws Exception {<NEW_LINE>// Lazily allocated.<NEW_LINE>Buffer utf8Buffer = null;<NEW_LINE>int codePoint;<NEW_LINE>for (int i = pos; i < limit; i += Character.charCount(codePoint)) {<NEW_LINE>codePoint = input.codePointAt(i);<NEW_LINE>if (alreadyEncoded && (codePoint == '\t' || codePoint == '\n' || codePoint == '\f' || codePoint == '\r')) {<NEW_LINE>// Skip this character.<NEW_LINE>} else if (codePoint == '+' && plusIsSpace) {<NEW_LINE>// Encode '+' as '%2B' since we permit ' ' to be encoded as either '+' or '%20'.<NEW_LINE>out.writeUtf8(alreadyEncoded ? "+" : "%2B");<NEW_LINE>} else if (codePoint < 0x20 || codePoint == 0x7f || (codePoint >= 0x80 && asciiOnly) || encodeSet.indexOf(codePoint) != -1 || (codePoint == '%' && !alreadyEncoded)) {<NEW_LINE>// Percent encode this character.<NEW_LINE>if (utf8Buffer == null) {<NEW_LINE>utf8Buffer = new Buffer();<NEW_LINE>}<NEW_LINE>utf8Buffer.writeUtf8CodePoint(codePoint);<NEW_LINE>while (!utf8Buffer.exhausted()) {<NEW_LINE>int b = utf8Buffer.readByte() & 0xff;<NEW_LINE>out.writeByte('%');<NEW_LINE>out.writeByte(HEX_DIGITS[(b <MASK><NEW_LINE>out.writeByte(HEX_DIGITS[b & 0xf]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// This character doesn't need encoding. Just copy it over.<NEW_LINE>out.writeUtf8CodePoint(codePoint);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | >> 4) & 0xf]); |
518,818 | private Map<String, String> createTags(MonitorDataFrame mdf, String instanceId, String meId, String plusTag, Map<String, Object> fields) {<NEW_LINE>Map<String, String> tags = new LinkedHashMap<>();<NEW_LINE>// IP<NEW_LINE>String encodeIP = DataStoreHelper.encodeForOpenTSDB(mdf.getIP());<NEW_LINE>tags.put("ip", encodeIP);<NEW_LINE>if (meId.indexOf("hostState") == 0) {<NEW_LINE>// group Id :for hostState, always "0"<NEW_LINE>tags.put("pgid", "0");<NEW_LINE>// Instance Id: for hostState, instid is IP<NEW_LINE>tags.put("instid", encodeIP);<NEW_LINE>} else if (meId.indexOf("procState") == 0) {<NEW_LINE>String[] <MASK><NEW_LINE>if (("java".equals(temp[1]) || "javaw.exe".equals(temp[1]) || "java.exe".equals(temp[1])) && !StringHelper.isEmpty((String) fields.get("main"))) {<NEW_LINE>String mainClass = (String) fields.get("main");<NEW_LINE>// group Id :for java, pgid is main class<NEW_LINE>tags.put("pgid", DataStoreHelper.encodeForOpenTSDB(mainClass));<NEW_LINE>// Instance Id: for java, instance id is ip_mainClass_pid<NEW_LINE>tags.put("instid", DataStoreHelper.encodeForOpenTSDB(temp[0] + "_" + mainClass + "_" + temp[2]));<NEW_LINE>} else {<NEW_LINE>// group Id :program name<NEW_LINE>tags.put("pgid", DataStoreHelper.encodeForOpenTSDB(temp[1]));<NEW_LINE>// Instance Id<NEW_LINE>tags.put("instid", DataStoreHelper.encodeForOpenTSDB(instanceId));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (plusTag != null) {<NEW_LINE>tags.put("ptag", DataStoreHelper.encodeForOpenTSDB(plusTag));<NEW_LINE>}<NEW_LINE>// tags.put("host", mdf.getHost());<NEW_LINE>return tags;<NEW_LINE>} | temp = instanceId.split("_"); |
316,524 | void validateSourceNatServiceCapablities(final Map<Capability, String> sourceNatServiceCapabilityMap) {<NEW_LINE>if (sourceNatServiceCapabilityMap != null && !sourceNatServiceCapabilityMap.isEmpty()) {<NEW_LINE>if (sourceNatServiceCapabilityMap.keySet().size() > 2) {<NEW_LINE>throw new InvalidParameterValueException("Only " + Capability.SupportedSourceNatTypes.getName() + " and " + Capability.RedundantRouter + " capabilities can be sepcified for source nat service");<NEW_LINE>}<NEW_LINE>for (final Map.Entry<Capability, String> srcNatPair : sourceNatServiceCapabilityMap.entrySet()) {<NEW_LINE>final Capability capability = srcNatPair.getKey();<NEW_LINE>final String value = srcNatPair.getValue();<NEW_LINE>if (capability == Capability.SupportedSourceNatTypes) {<NEW_LINE>final boolean perAccount = value.contains("peraccount");<NEW_LINE>final boolean <MASK><NEW_LINE>if (perAccount && perZone || !perAccount && !perZone) {<NEW_LINE>throw new InvalidParameterValueException("Either peraccount or perzone source NAT type can be specified for " + Capability.SupportedSourceNatTypes.getName());<NEW_LINE>}<NEW_LINE>} else if (capability == Capability.RedundantRouter) {<NEW_LINE>final boolean enabled = value.contains("true");<NEW_LINE>final boolean disabled = value.contains("false");<NEW_LINE>if (!enabled && !disabled) {<NEW_LINE>throw new InvalidParameterValueException("Unknown specified value for " + Capability.RedundantRouter.getName());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new InvalidParameterValueException("Only " + Capability.SupportedSourceNatTypes.getName() + " and " + Capability.RedundantRouter + " capabilities can be sepcified for source nat service");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | perZone = value.contains("perzone"); |
1,829,318 | public byte[] serialise(final TypeValue typeValue) throws SerialisationException {<NEW_LINE>String type = typeValue.getType();<NEW_LINE>String value = typeValue.getValue();<NEW_LINE>if ((null == type || type.isEmpty()) && (null == value || value.isEmpty())) {<NEW_LINE>throw new SerialisationException("TypeValue passed to serialiser is blank");<NEW_LINE>}<NEW_LINE>ByteArrayOutputStream out = new ByteArrayOutputStream();<NEW_LINE>if (null != type) {<NEW_LINE>try {<NEW_LINE>out.write(ByteArrayEscapeUtils.escape(type.getBytes(CommonConstants.UTF_8)));<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new SerialisationException("Failed to serialise the Type from TypeValue Object", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.write(ByteArrayEscapeUtils.DELIMITER);<NEW_LINE>if (null != value) {<NEW_LINE>try {<NEW_LINE>out.write(ByteArrayEscapeUtils.escape(value.getBytes(CommonConstants.UTF_8)));<NEW_LINE>} catch (final IOException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return out.toByteArray();<NEW_LINE>} | throw new SerialisationException("Failed to serialise the Value from TypeValue Object", e); |
1,398,538 | // GEN-LAST:event_bnCancelActionPerformed<NEW_LINE>@Messages({ "AddNewOrganizationDialog.bnOk.addFailed.text=Failed to add new organization." })<NEW_LINE>private void bnOKActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_bnOKActionPerformed<NEW_LINE>try {<NEW_LINE>CentralRepository dbManager = CentralRepository.getInstance();<NEW_LINE>if (organizationToEdit != null) {<NEW_LINE>// make a copy in case the update fails<NEW_LINE>newOrg = dbManager.getOrganizationByID(organizationToEdit.getOrgID());<NEW_LINE>newOrg.setName(tfOrganizationName.getText());<NEW_LINE>newOrg.<MASK><NEW_LINE>newOrg.setPocEmail(tfPocEmail.getText());<NEW_LINE>newOrg.setPocPhone(tfPocPhone.getText());<NEW_LINE>dbManager.updateOrganization(newOrg);<NEW_LINE>} else {<NEW_LINE>newOrg = new CentralRepoOrganization(tfOrganizationName.getText(), tfPocName.getText(), tfPocEmail.getText(), tfPocPhone.getText());<NEW_LINE>newOrg = dbManager.newOrganization(newOrg);<NEW_LINE>}<NEW_LINE>hasChanged = true;<NEW_LINE>dispose();<NEW_LINE>} catch (CentralRepoException ex) {<NEW_LINE>lbWarningMsg.setText(Bundle.AddNewOrganizationDialog_bnOk_addFailed_text());<NEW_LINE>logger.log(Level.SEVERE, "Failed adding new organization.", ex);<NEW_LINE>newOrg = null;<NEW_LINE>}<NEW_LINE>} | setPocName(tfPocName.getText()); |
696,453 | private RequestBody createRequestBody(BaseRequest<?, ?> request) {<NEW_LINE>if (request.isMultipart()) {<NEW_LINE>MediaType contentType = MediaType.parse(request.getContentType());<NEW_LINE>MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM);<NEW_LINE>for (Map.Entry<String, Object> parameter : request.getParameters().entrySet()) {<NEW_LINE>String name = parameter.getKey();<NEW_LINE>Object value = parameter.getValue();<NEW_LINE>if (value instanceof byte[]) {<NEW_LINE>builder.addFormDataPart(name, request.getFileName(), RequestBody.create(contentType, (byte[]) value));<NEW_LINE>} else if (value instanceof File) {<NEW_LINE>builder.addFormDataPart(name, request.getFileName(), RequestBody.create(<MASK><NEW_LINE>} else {<NEW_LINE>builder.addFormDataPart(name, toParamValue(value));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} else {<NEW_LINE>FormBody.Builder builder = new FormBody.Builder();<NEW_LINE>for (Map.Entry<String, Object> parameter : request.getParameters().entrySet()) {<NEW_LINE>builder.add(parameter.getKey(), toParamValue(parameter.getValue()));<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>}<NEW_LINE>} | contentType, (File) value)); |
1,437,111 | public boolean isQLowRemoteLimit() {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(tc, "isQLowRemoteLimit");<NEW_LINE>long remoteLowLimit = _destHighMsgs;<NEW_LINE>boolean isUnderDestinationLowLimit = false;<NEW_LINE>// Find the halfway mark between the two high limits<NEW_LINE>if (_remoteQueueHighLimit > _destHighMsgs) {<NEW_LINE>remoteLowLimit = _remoteQueueHighLimit - (<MASK><NEW_LINE>}<NEW_LINE>// Find out how deep the itemStream is<NEW_LINE>isUnderDestinationLowLimit = (getTotalMsgCount() <= remoteLowLimit);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())<NEW_LINE>SibTr.debug(tc, "Queue depth=" + getTotalMsgCount() + ", RemoteLowLimit=" + remoteLowLimit);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(tc, "isQLowRemoteLimit", Boolean.valueOf(isUnderDestinationLowLimit));<NEW_LINE>return isUnderDestinationLowLimit;<NEW_LINE>} | (_remoteQueueHighLimit - _destHighMsgs) / 2); |
1,282,440 | protected void writeToXml(EwsServiceXmlWriter writer) throws Exception {<NEW_LINE>writer.writeStartDocument();<NEW_LINE>writer.writeStartElement(XmlNamespace.Soap, XmlElementNames.SOAPEnvelopeElementName);<NEW_LINE>writer.writeAttributeValue("xmlns", EwsUtilities.getNamespacePrefix(XmlNamespace.Soap), EwsUtilities.getNamespaceUri(XmlNamespace.Soap));<NEW_LINE>writer.writeAttributeValue("xmlns", EwsUtilities.EwsXmlSchemaInstanceNamespacePrefix, EwsUtilities.EwsXmlSchemaInstanceNamespace);<NEW_LINE>writer.writeAttributeValue("xmlns", EwsUtilities.EwsMessagesNamespacePrefix, EwsUtilities.EwsMessagesNamespace);<NEW_LINE>writer.writeAttributeValue("xmlns", EwsUtilities.EwsTypesNamespacePrefix, EwsUtilities.EwsTypesNamespace);<NEW_LINE>if (writer.isRequireWSSecurityUtilityNamespace()) {<NEW_LINE>writer.writeAttributeValue("xmlns", <MASK><NEW_LINE>}<NEW_LINE>writer.writeStartElement(XmlNamespace.Soap, XmlElementNames.SOAPHeaderElementName);<NEW_LINE>if (this.service.getCredentials() != null) {<NEW_LINE>this.service.getCredentials().emitExtraSoapHeaderNamespaceAliases(writer.getInternalWriter());<NEW_LINE>}<NEW_LINE>// Emit the RequestServerVersion header<NEW_LINE>writer.writeStartElement(XmlNamespace.Types, XmlElementNames.RequestServerVersion);<NEW_LINE>writer.writeAttributeValue(XmlAttributeNames.Version, this.getRequestedServiceVersionString());<NEW_LINE>// RequestServerVersion<NEW_LINE>writer.writeEndElement();<NEW_LINE>if (this.service.getPreferredCulture() != null) {<NEW_LINE>writer.writeElementValue(XmlNamespace.Types, XmlElementNames.MailboxCulture, this.service.getPreferredCulture().getDisplayName());<NEW_LINE>}<NEW_LINE>if (this.getService().getDateTimePrecision().ordinal() != DateTimePrecision.Default.ordinal()) {<NEW_LINE>writer.writeElementValue(XmlNamespace.Types, XmlElementNames.DateTimePrecision, this.getService().getDateTimePrecision().toString());<NEW_LINE>}<NEW_LINE>if (this.service.getImpersonatedUserId() != null) {<NEW_LINE>this.service.getImpersonatedUserId().writeToXml(writer);<NEW_LINE>}<NEW_LINE>if (this.service.getCredentials() != null) {<NEW_LINE>this.service.getCredentials().serializeExtraSoapHeaders(writer.getInternalWriter(), this.getXmlElementName());<NEW_LINE>}<NEW_LINE>this.service.doOnSerializeCustomSoapHeaders(writer.getInternalWriter());<NEW_LINE>// soap:Header<NEW_LINE>writer.writeEndElement();<NEW_LINE>writer.writeStartElement(XmlNamespace.Soap, XmlElementNames.SOAPBodyElementName);<NEW_LINE>this.writeBodyToXml(writer);<NEW_LINE>// soap:Body<NEW_LINE>writer.writeEndElement();<NEW_LINE>// soap:Envelope<NEW_LINE>writer.writeEndElement();<NEW_LINE>writer.flush();<NEW_LINE>} | EwsUtilities.WSSecurityUtilityNamespacePrefix, EwsUtilities.WSSecurityUtilityNamespace); |
1,309,239 | private static void copyResourceTableToTmpDirectory(String sourcePath, String tableName, File baseDir, File dataDir) throws IOException {<NEW_LINE>File schemaFile = new File(baseDir, tableName + "_schema.json");<NEW_LINE>File tableConfigFile = new File(baseDir, tableName + "_offline_table_config.json");<NEW_LINE>File ingestionJobSpecFile = new File(baseDir, "ingestionJobSpec.yaml");<NEW_LINE>File dataFile = new File(dataDir, tableName + "_data.csv");<NEW_LINE>ClassLoader classLoader = Quickstart.class.getClassLoader();<NEW_LINE>URL resource = classLoader.getResource(sourcePath + File.separator + tableName + "_schema.json");<NEW_LINE>com.google.common.base.Preconditions.checkNotNull(resource);<NEW_LINE><MASK><NEW_LINE>resource = classLoader.getResource(sourcePath + File.separator + "rawdata" + File.separator + tableName + "_data.csv");<NEW_LINE>com.google.common.base.Preconditions.checkNotNull(resource);<NEW_LINE>FileUtils.copyURLToFile(resource, dataFile);<NEW_LINE>resource = classLoader.getResource(sourcePath + File.separator + "ingestionJobSpec.yaml");<NEW_LINE>if (resource != null) {<NEW_LINE>FileUtils.copyURLToFile(resource, ingestionJobSpecFile);<NEW_LINE>}<NEW_LINE>resource = classLoader.getResource(sourcePath + File.separator + tableName + "_offline_table_config.json");<NEW_LINE>com.google.common.base.Preconditions.checkNotNull(resource);<NEW_LINE>FileUtils.copyURLToFile(resource, tableConfigFile);<NEW_LINE>} | FileUtils.copyURLToFile(resource, schemaFile); |
238,629 | // snippet-start:[ec2.java2.describe_account.main]<NEW_LINE>public static void describeEC2Account(Ec2Client ec2) {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>List<AccountAttribute> accountList = accountResults.accountAttributes();<NEW_LINE>for (ListIterator iter = accountList.listIterator(); iter.hasNext(); ) {<NEW_LINE>AccountAttribute attribute = (AccountAttribute) iter.next();<NEW_LINE>System.out.print("\n The name of the attribute is " + attribute.attributeName());<NEW_LINE>List<AccountAttributeValue> values = attribute.attributeValues();<NEW_LINE>for (ListIterator iterVals = values.listIterator(); iterVals.hasNext(); ) {<NEW_LINE>AccountAttributeValue myValue = (AccountAttributeValue) iterVals.next();<NEW_LINE>System.out.print("\n The value of the attribute is " + myValue.attributeValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Ec2Exception e) {<NEW_LINE>System.err.println(e.awsErrorDetails().errorMessage());<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>} | DescribeAccountAttributesResponse accountResults = ec2.describeAccountAttributes(); |
1,108,560 | private static void sendOrderEvent(RegressionEnvironment env, EventRepresentationChoice eventRepresentationEnum, String orderId, String productId, double price, int quantity, boolean deletedFlag) {<NEW_LINE>if (eventRepresentationEnum.isObjectArrayEvent()) {<NEW_LINE>env.sendEventObjectArray(new Object[] { orderId, productId, price, quantity, deletedFlag }, "OrderEvent");<NEW_LINE>} else if (eventRepresentationEnum.isMapEvent()) {<NEW_LINE>Map<String, Object> theEvent = new LinkedHashMap<String, Object>();<NEW_LINE>theEvent.put("orderId", orderId);<NEW_LINE>theEvent.put("productId", productId);<NEW_LINE>theEvent.put("price", price);<NEW_LINE>theEvent.put("quantity", quantity);<NEW_LINE>theEvent.put("deletedFlag", deletedFlag);<NEW_LINE>env.sendEventMap(theEvent, "OrderEvent");<NEW_LINE>} else if (eventRepresentationEnum.isAvroEvent()) {<NEW_LINE>GenericData.Record theEvent = new GenericData.Record(env.runtimeAvroSchemaPreconfigured("OrderEvent"));<NEW_LINE>theEvent.put("orderId", orderId);<NEW_LINE>theEvent.put("productId", productId);<NEW_LINE>theEvent.put("price", price);<NEW_LINE><MASK><NEW_LINE>theEvent.put("deletedFlag", deletedFlag);<NEW_LINE>env.sendEventAvro(theEvent, "OrderEvent");<NEW_LINE>} else {<NEW_LINE>JsonObject object = new JsonObject();<NEW_LINE>object.add("orderId", orderId);<NEW_LINE>object.add("productId", productId);<NEW_LINE>object.add("price", price);<NEW_LINE>object.add("quantity", quantity);<NEW_LINE>object.add("deletedFlag", deletedFlag);<NEW_LINE>env.sendEventJson(object.toString(), "OrderEvent");<NEW_LINE>}<NEW_LINE>} | theEvent.put("quantity", quantity); |
236,615 | public static List<PEMObject> readPEMObjects(InputStream is) throws IOException {<NEW_LINE>List<PEMObject> pemContents = new ArrayList<PEMObject>();<NEW_LINE>boolean readingContent = false;<NEW_LINE>String beginMarker = null;<NEW_LINE>String endMarker = null;<NEW_LINE>StringBuffer sb = null;<NEW_LINE>String line;<NEW_LINE>BufferedReader reader = new BufferedReader(new InputStreamReader(is, StringUtils.UTF8));<NEW_LINE>try {<NEW_LINE>while ((line = reader.readLine()) != null) {<NEW_LINE>if (readingContent) {<NEW_LINE>if (line.indexOf(endMarker) != -1) {<NEW_LINE>// completed reading one PEM object<NEW_LINE>pemContents.add(new PEMObject(beginMarker, Base64.decode(<MASK><NEW_LINE>readingContent = false;<NEW_LINE>} else {<NEW_LINE>sb.append(line.trim());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (line.indexOf(BEGIN_MARKER) != -1) {<NEW_LINE>readingContent = true;<NEW_LINE>beginMarker = line.trim();<NEW_LINE>endMarker = beginMarker.replace("BEGIN", "END");<NEW_LINE>sb = new StringBuffer();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return pemContents;<NEW_LINE>} finally {<NEW_LINE>reader.close();<NEW_LINE>}<NEW_LINE>} | sb.toString()))); |
1,549,637 | public boolean validate() throws ContractValidateException {<NEW_LINE>if (!VMConfig.allowTvmConstantinople()) {<NEW_LINE>throw new ContractValidateException("contract type error,unexpected type [ClearABIContract]");<NEW_LINE>}<NEW_LINE>if (this.any == null) {<NEW_LINE>throw new ContractValidateException(ActuatorConstant.CONTRACT_NOT_EXIST);<NEW_LINE>}<NEW_LINE>if (chainBaseManager == null) {<NEW_LINE>throw new ContractValidateException("No account store or contract store!");<NEW_LINE>}<NEW_LINE>AccountStore accountStore = chainBaseManager.getAccountStore();<NEW_LINE>ContractStore contractStore = chainBaseManager.getContractStore();<NEW_LINE>if (!this.any.is(ClearABIContract.class)) {<NEW_LINE>throw new ContractValidateException("contract type error,expected type [ClearABIContract],real type[" + any.getClass() + "]");<NEW_LINE>}<NEW_LINE>final ClearABIContract contract;<NEW_LINE>try {<NEW_LINE>contract = this.any.unpack(ClearABIContract.class);<NEW_LINE>} catch (InvalidProtocolBufferException e) {<NEW_LINE>logger.debug(<MASK><NEW_LINE>throw new ContractValidateException(e.getMessage());<NEW_LINE>}<NEW_LINE>if (!DecodeUtil.addressValid(contract.getOwnerAddress().toByteArray())) {<NEW_LINE>throw new ContractValidateException("Invalid address");<NEW_LINE>}<NEW_LINE>byte[] ownerAddress = contract.getOwnerAddress().toByteArray();<NEW_LINE>String readableOwnerAddress = StringUtil.createReadableString(ownerAddress);<NEW_LINE>AccountCapsule accountCapsule = accountStore.get(ownerAddress);<NEW_LINE>if (accountCapsule == null) {<NEW_LINE>throw new ContractValidateException(ActuatorConstant.ACCOUNT_EXCEPTION_STR + readableOwnerAddress + NOT_EXIST_STR);<NEW_LINE>}<NEW_LINE>byte[] contractAddress = contract.getContractAddress().toByteArray();<NEW_LINE>ContractCapsule deployedContract = contractStore.get(contractAddress);<NEW_LINE>if (deployedContract == null) {<NEW_LINE>throw new ContractValidateException("Contract not exists");<NEW_LINE>}<NEW_LINE>byte[] deployedContractOwnerAddress = deployedContract.getInstance().getOriginAddress().toByteArray();<NEW_LINE>if (!Arrays.equals(ownerAddress, deployedContractOwnerAddress)) {<NEW_LINE>throw new ContractValidateException(ActuatorConstant.ACCOUNT_EXCEPTION_STR + readableOwnerAddress + "] is not the owner of the contract");<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | e.getMessage(), e); |
43,951 | private void mapResponseHeaders(org.springframework.cloud.contract.spec.internal.Response contractResponse, Response pactResponse) {<NEW_LINE>MatchingRuleCategory headerRules = pactResponse.getMatchingRules().rulesForCategory("header");<NEW_LINE>contractResponse.headers((headers) -> pactResponse.getHeaders().forEach((key, values) -> {<NEW_LINE>if (key.equalsIgnoreCase("Cookie")) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (headerRules.getMatchingRules().containsKey(key)) {<NEW_LINE>MatchingRuleGroup matchingRuleGroup = headerRules.getMatchingRules().get(key);<NEW_LINE>if (matchingRuleGroup.getRules().size() > 1) {<NEW_LINE>throw new UnsupportedOperationException("Currently only 1 rule at a time for a header is supported");<NEW_LINE>}<NEW_LINE>MatchingRule matchingRule = matchingRuleGroup.<MASK><NEW_LINE>if (matchingRule instanceof RegexMatcher) {<NEW_LINE>values.forEach((value) -> {<NEW_LINE>headers.header(key, contractResponse.$(contractResponse.p(contractResponse.regex(Pattern.compile(((RegexMatcher) matchingRule).getRegex()))), contractResponse.c(value)));<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("Currently only the header matcher of type regex is supported");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>values.forEach((value) -> headers.header(key, value));<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>} | getRules().get(0); |
1,686,527 | final AssociateIamInstanceProfileResult executeAssociateIamInstanceProfile(AssociateIamInstanceProfileRequest associateIamInstanceProfileRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(associateIamInstanceProfileRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AssociateIamInstanceProfileRequest> request = null;<NEW_LINE>Response<AssociateIamInstanceProfileResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AssociateIamInstanceProfileRequestMarshaller().marshall(super.beforeMarshalling(associateIamInstanceProfileRequest));<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, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateIamInstanceProfile");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<AssociateIamInstanceProfileResult> responseHandler = new StaxResponseHandler<AssociateIamInstanceProfileResult>(new AssociateIamInstanceProfileResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,627,443 | static void c_3() throws Exception {<NEW_LINE>AkSourceBatchOp source = new AkSourceBatchOp().setFilePath(DATA_DIR + SPARSE_TRAIN_FILE);<NEW_LINE>source.link(new PcaTrainBatchOp().setK(39).setCalculationType(CalculationType.COV).setVectorCol(VECTOR_COL_NAME).lazyPrintModelInfo()).link(new AkSinkBatchOp().setFilePath(DATA_DIR + PCA_MODEL_FILE).setOverwriteSink(true));<NEW_LINE>BatchOperator.execute();<NEW_LINE>BatchOperator<?> pca_result = new PcaPredictBatchOp().setVectorCol(VECTOR_COL_NAME).setPredictionCol(VECTOR_COL_NAME).linkFrom(new AkSourceBatchOp().setFilePath(DATA_DIR + PCA_MODEL_FILE), source);<NEW_LINE>Stopwatch sw = new Stopwatch();<NEW_LINE>KMeans kmeans = new KMeans().setK(10).setVectorCol(VECTOR_COL_NAME).setPredictionCol(PREDICTION_COL_NAME);<NEW_LINE>sw.reset();<NEW_LINE>sw.start();<NEW_LINE>kmeans.fit(source).transform(source).link(new EvalClusterBatchOp().setVectorCol(VECTOR_COL_NAME).setPredictionCol(PREDICTION_COL_NAME).setLabelCol(LABEL_COL_NAME).lazyPrintMetrics("KMeans"));<NEW_LINE>BatchOperator.execute();<NEW_LINE>sw.stop();<NEW_LINE>System.out.println(sw.getElapsedTimeSpan());<NEW_LINE>sw.reset();<NEW_LINE>sw.start();<NEW_LINE>kmeans.fit(pca_result).transform(pca_result).link(new EvalClusterBatchOp().setVectorCol(VECTOR_COL_NAME).setPredictionCol(PREDICTION_COL_NAME).setLabelCol(LABEL_COL_NAME).lazyPrintMetrics("KMeans + PCA"));<NEW_LINE>BatchOperator.execute();<NEW_LINE>sw.stop();<NEW_LINE>System.out.<MASK><NEW_LINE>} | println(sw.getElapsedTimeSpan()); |
612,856 | public void s2iBuildFromNative(S2iConfig s2iConfig, ContainerImageConfig containerImageConfig, KubernetesClientBuildItem kubernetesClient, ContainerImageInfoBuildItem containerImage, ArchiveRootBuildItem archiveRoot, OutputTargetBuildItem out, PackageConfig packageConfig, List<GeneratedFileSystemResourceBuildItem> generatedResources, Optional<ContainerImageBuildRequestBuildItem> buildRequest, Optional<ContainerImagePushRequestBuildItem> pushRequest, BuildProducer<ArtifactResultBuildItem> artifactResultProducer, BuildProducer<ContainerImageBuilderBuildItem> containerImageBuilder, NativeImageBuildItem nativeImage) {<NEW_LINE>if (containerImageConfig.isBuildExplicitlyDisabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!containerImageConfig.isBuildExplicitlyEnabled() && !containerImageConfig.isPushExplicitlyEnabled() && !buildRequest.isPresent() && !pushRequest.isPresent()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String namespace = Optional.ofNullable(kubernetesClient.getClient().getNamespace()).orElse("default");<NEW_LINE>LOG.info("Performing s2i binary build with native image on server: " + kubernetesClient.getClient().getMasterUrl() + " in namespace:" + namespace + ".");<NEW_LINE>Optional<GeneratedFileSystemResourceBuildItem> openshiftYml = generatedResources.stream().filter(r -> r.getName().endsWith("kubernetes" + File.separator + "openshift.yml")).findFirst();<NEW_LINE>if (openshiftYml.isEmpty()) {<NEW_LINE>LOG.warn("No Openshift manifests were generated so no s2i process will be taking place");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>createContainerImage(kubernetesClient, openshiftYml.get(), s2iConfig, out.getOutputDirectory(<MASK><NEW_LINE>artifactResultProducer.produce(new ArtifactResultBuildItem(null, "native-container", Collections.emptyMap()));<NEW_LINE>containerImageBuilder.produce(new ContainerImageBuilderBuildItem(S2I));<NEW_LINE>} | ), nativeImage.getPath()); |
1,026,536 | public Broadcast<List<PrestoSparkStorageHandle>> executeBroadcast(JavaSparkContext sparkContext) throws SparkException, TimeoutException {<NEW_LINE>List<PrestoSparkStorageHandle> broadcastValue = broadcastDependency.collectAndDestroyDependenciesWithTimeout(computeNextTimeout(queryCompletionDeadline), MILLISECONDS, waitTimeMetrics).stream().map(Tuple2::_2).collect(toList());<NEW_LINE>// release memory retained by the RDD (splits and dependencies)<NEW_LINE>broadcastDependency = null;<NEW_LINE>long compressedBroadcastSizeInBytes = broadcastValue.stream().mapToLong(metadata -> metadata.getCompressedSizeInBytes()).sum();<NEW_LINE>long uncompressedBroadcastSizeInBytes = broadcastValue.stream().mapToLong(metadata -> metadata.getUncompressedSizeInBytes()).sum();<NEW_LINE>log.info("Got back %d pages. compressedBroadcastSizeInBytes: %d; uncompressedBroadcastSizeInBytes: %d", broadcastValue.<MASK><NEW_LINE>long maxBroadcastSizeInBytes = maxBroadcastSize.toBytes();<NEW_LINE>if (compressedBroadcastSizeInBytes > maxBroadcastSizeInBytes) {<NEW_LINE>throw exceededLocalBroadcastMemoryLimit(maxBroadcastSize, format("Compressed broadcast size: %s", succinctBytes(compressedBroadcastSizeInBytes)));<NEW_LINE>}<NEW_LINE>if (uncompressedBroadcastSizeInBytes > maxBroadcastSizeInBytes) {<NEW_LINE>throw exceededLocalBroadcastMemoryLimit(maxBroadcastSize, format("Uncompressed broadcast size: %s", succinctBytes(uncompressedBroadcastSizeInBytes)));<NEW_LINE>}<NEW_LINE>if (compressedBroadcastSizeInBytes > queryMaxTotalMemoryPerNode.toBytes() || uncompressedBroadcastSizeInBytes > queryMaxTotalMemoryPerNode.toBytes()) {<NEW_LINE>throw exceededLocalTotalMemoryLimit(queryMaxTotalMemoryPerNode, format("Compressed broadcast size: %s; Uncompressed broadcast size: %s", succinctBytes(compressedBroadcastSizeInBytes), succinctBytes(uncompressedBroadcastSizeInBytes)), false, Optional.empty());<NEW_LINE>}<NEW_LINE>broadcastVariable = sparkContext.broadcast(broadcastValue);<NEW_LINE>return broadcastVariable;<NEW_LINE>} | size(), compressedBroadcastSizeInBytes, uncompressedBroadcastSizeInBytes); |
1,685,500 | public SortedMap<String, HealthCheck.Result> runHealthChecks(ExecutorService executor, HealthCheckFilter filter) {<NEW_LINE>final Map<String, Future<HealthCheck.Result>> futures = new HashMap<>();<NEW_LINE>for (final Map.Entry<String, HealthCheck> entry : healthChecks.entrySet()) {<NEW_LINE>final String name = entry.getKey();<NEW_LINE>final HealthCheck healthCheck = entry.getValue();<NEW_LINE>if (filter.matches(name, healthCheck)) {<NEW_LINE>futures.put(name, executor.submit(() -> healthCheck.execute()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final SortedMap<String, HealthCheck.Result> results = new TreeMap<>();<NEW_LINE>for (Map.Entry<String, Future<Result>> entry : futures.entrySet()) {<NEW_LINE>try {<NEW_LINE>results.put(entry.getKey(), entry.<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.warn("Error executing health check {}", entry.getKey(), e);<NEW_LINE>results.put(entry.getKey(), HealthCheck.Result.unhealthy(e));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Collections.unmodifiableSortedMap(results);<NEW_LINE>} | getValue().get()); |
385,941 | public static JobTestBuilder aFailedJobWithRetries() {<NEW_LINE>final JobTestBuilder jobTestBuilder = aJob().withName("failed job").withJobDetails(systemOutPrintLnJobDetails("a test")).withState(new ScheduledState(now().minusSeconds(11 * 60 * 60)));<NEW_LINE>UUID serverId = UUID.randomUUID();<NEW_LINE>for (int i = 0; i < 11; i++) {<NEW_LINE>jobTestBuilder.withState(new EnqueuedState());<NEW_LINE>jobTestBuilder.withState(new ProcessingState(serverId));<NEW_LINE>jobTestBuilder.withState(new FailedState("An exception occurred", new IllegalStateException()));<NEW_LINE>if (i < 10) {<NEW_LINE>jobTestBuilder.withState(new ScheduledState(now().minusSeconds((10 - i) * 60 * 60), "Retry attempt " + (i + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return jobTestBuilder;<NEW_LINE>} | 1) + " of " + 10)); |
586,571 | final Snapshot executeDeleteSnapshot(DeleteSnapshotRequest deleteSnapshotRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteSnapshotRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteSnapshotRequest> request = null;<NEW_LINE>Response<Snapshot> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteSnapshotRequestMarshaller().marshall(super.beforeMarshalling(deleteSnapshotRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteSnapshot");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<Snapshot> responseHandler = new StaxResponseHandler<Snapshot>(new SnapshotStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "ElastiCache"); |
1,297,222 | protected void handleMultiInstanceSubProcess(ExecutionEntityManager executionEntityManager, ExecutionEntity parentExecution) {<NEW_LINE>List<ExecutionEntity> activeChildExecutions = getActiveChildExecutionsForExecution(executionEntityManager, parentExecution.getId());<NEW_LINE>boolean containsOtherChildExecutions = false;<NEW_LINE>for (ExecutionEntity activeExecution : activeChildExecutions) {<NEW_LINE>if (!activeExecution.getId().equals(execution.getId())) {<NEW_LINE>containsOtherChildExecutions = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!containsOtherChildExecutions) {<NEW_LINE>// Destroy the current scope (subprocess) and leave via the subprocess<NEW_LINE>ScopeUtil.createCopyOfSubProcessExecutionForCompensation(parentExecution);<NEW_LINE>Context.getAgenda().planDestroyScopeOperation(parentExecution);<NEW_LINE>SubProcess subProcess = execution.getCurrentFlowElement().getSubProcess();<NEW_LINE>MultiInstanceActivityBehavior multiInstanceBehavior = <MASK><NEW_LINE>parentExecution.setCurrentFlowElement(subProcess);<NEW_LINE>multiInstanceBehavior.leave(parentExecution);<NEW_LINE>}<NEW_LINE>} | (MultiInstanceActivityBehavior) subProcess.getBehavior(); |
526,410 | public static DescribeDtsServiceLogResponse unmarshall(DescribeDtsServiceLogResponse describeDtsServiceLogResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDtsServiceLogResponse.setRequestId(_ctx.stringValue("DescribeDtsServiceLogResponse.RequestId"));<NEW_LINE>describeDtsServiceLogResponse.setHttpStatusCode(_ctx.integerValue("DescribeDtsServiceLogResponse.HttpStatusCode"));<NEW_LINE>describeDtsServiceLogResponse.setErrCode(_ctx.stringValue("DescribeDtsServiceLogResponse.ErrCode"));<NEW_LINE>describeDtsServiceLogResponse.setSuccess(_ctx.booleanValue("DescribeDtsServiceLogResponse.Success"));<NEW_LINE>describeDtsServiceLogResponse.setPageRecordCount(_ctx.integerValue("DescribeDtsServiceLogResponse.PageRecordCount"));<NEW_LINE>describeDtsServiceLogResponse.setTotalRecordCount(_ctx.longValue("DescribeDtsServiceLogResponse.TotalRecordCount"));<NEW_LINE>describeDtsServiceLogResponse.setErrMessage<MASK><NEW_LINE>describeDtsServiceLogResponse.setDynamicMessage(_ctx.stringValue("DescribeDtsServiceLogResponse.DynamicMessage"));<NEW_LINE>describeDtsServiceLogResponse.setPageNumber(_ctx.integerValue("DescribeDtsServiceLogResponse.PageNumber"));<NEW_LINE>describeDtsServiceLogResponse.setDynamicCode(_ctx.stringValue("DescribeDtsServiceLogResponse.DynamicCode"));<NEW_LINE>List<ServiceLogContext> serviceLogContexts = new ArrayList<ServiceLogContext>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDtsServiceLogResponse.ServiceLogContexts.Length"); i++) {<NEW_LINE>ServiceLogContext serviceLogContext = new ServiceLogContext();<NEW_LINE>serviceLogContext.setContext(_ctx.stringValue("DescribeDtsServiceLogResponse.ServiceLogContexts[" + i + "].Context"));<NEW_LINE>serviceLogContext.setTime(_ctx.stringValue("DescribeDtsServiceLogResponse.ServiceLogContexts[" + i + "].Time"));<NEW_LINE>serviceLogContext.setState(_ctx.stringValue("DescribeDtsServiceLogResponse.ServiceLogContexts[" + i + "].State"));<NEW_LINE>serviceLogContexts.add(serviceLogContext);<NEW_LINE>}<NEW_LINE>describeDtsServiceLogResponse.setServiceLogContexts(serviceLogContexts);<NEW_LINE>return describeDtsServiceLogResponse;<NEW_LINE>} | (_ctx.stringValue("DescribeDtsServiceLogResponse.ErrMessage")); |
1,398,491 | public void findOpposite(FileObject fileObj, int caretOffset, LocationListener callback) {<NEW_LINE>boolean isJavaFile = false;<NEW_LINE>ClassPath srcCP;<NEW_LINE>FileObject fileObjRoot;<NEW_LINE>Project project;<NEW_LINE>boolean sourceToTest = true;<NEW_LINE>if ((fileObj == null) || !fileObj.isFolder() && !(isJavaFile = TestUtil.isJavaFile(fileObj)) || ((srcCP = ClassPath.getClassPath(fileObj, ClassPath.SOURCE)) == null) || ((fileObjRoot = srcCP.findOwnerRoot(fileObj)) == null) || ((project = FileOwnerQuery.getOwner(fileObjRoot)) == null) || // side effect - assignment<NEW_LINE>(UnitTestForSourceQuery.findUnitTests(fileObjRoot).length == 0) && !(sourceToTest = false) && (!isJavaFile || (UnitTestForSourceQuery.findSources(fileObjRoot).length == 0))) {<NEW_LINE>callback.foundLocation(fileObj, new LocationResult(null));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>TestNGPlugin plugin = TestUtil.getPluginForProject(project);<NEW_LINE>assert plugin != null;<NEW_LINE>SourceGroup[] srcGroups;<NEW_LINE>FileObject[] srcRoots;<NEW_LINE>srcGroups = ProjectUtils.getSources(project<MASK><NEW_LINE>srcRoots = new FileObject[srcGroups.length];<NEW_LINE>for (int i = 0; i < srcGroups.length; i++) {<NEW_LINE>srcRoots[i] = srcGroups[i].getRootFolder();<NEW_LINE>}<NEW_LINE>ClassPath srcClassPath = ClassPathSupport.createClassPath(srcRoots);<NEW_LINE>RequestProcessor.getDefault().post(new ActionImpl(plugin, callback, new Location(fileObj), sourceToTest, srcClassPath));<NEW_LINE>} | ).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA); |
521,473 | public static void main(final String... args) throws IOException, ProcessingException {<NEW_LINE>final JsonNode <MASK><NEW_LINE>final JsonNode good = Utils.loadResource("/fstab-good.json");<NEW_LINE>final JsonNode bad = Utils.loadResource("/fstab-bad.json");<NEW_LINE>final JsonNode bad2 = Utils.loadResource("/fstab-bad2.json");<NEW_LINE>final LoadingConfiguration cfg = LoadingConfiguration.newBuilder().dereferencing(Dereferencing.INLINE).freeze();<NEW_LINE>final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder().setLoadingConfiguration(cfg).freeze();<NEW_LINE>final JsonSchema schema = factory.getJsonSchema(fstabSchema);<NEW_LINE>ProcessingReport report;<NEW_LINE>report = schema.validate(good);<NEW_LINE>System.out.println(report);<NEW_LINE>report = schema.validate(bad);<NEW_LINE>System.out.println(report);<NEW_LINE>report = schema.validate(bad2);<NEW_LINE>System.out.println(report);<NEW_LINE>} | fstabSchema = Utils.loadResource("/fstab-inline.json"); |
1,488,124 | public static EObject spawn_opt(EProc self, EObject tup) throws Pausable {<NEW_LINE>ETuple t;<NEW_LINE>EAtom m;<NEW_LINE>EAtom f;<NEW_LINE>ESeq a;<NEW_LINE>ESeq o;<NEW_LINE>if ((t = tup.testTuple()) == null || t.arity() != 4 || (m = t.elm(1).testAtom()) == null || (f = t.elm(2).testAtom()) == null || (a = t.elm(3).testSeq()) == null || (o = t.elm(4).testSeq()) == null)<NEW_LINE>throw ERT.badarg(tup);<NEW_LINE>boolean link = false;<NEW_LINE>boolean monitor = false;<NEW_LINE>EAtom priority = null;<NEW_LINE>for (; !o.isNil(); o = o.tail()) {<NEW_LINE>EObject val = o.head();<NEW_LINE>ETuple2 t2;<NEW_LINE>if (val == am_link) {<NEW_LINE>link = true;<NEW_LINE>} else if (val == am_monitor) {<NEW_LINE>monitor = true;<NEW_LINE>} else if ((t2 = ETuple2.cast(val)) != null) {<NEW_LINE>if (t2.elm(1) == am_priority) {<NEW_LINE>EAtom am = t2.elm(2).testAtom();<NEW_LINE>if (am != null)<NEW_LINE>priority = am;<NEW_LINE>}<NEW_LINE>// ignore full_sweep_after and min_heap_size<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EProc p2 = new EProc(self.group_leader(), m, f, a);<NEW_LINE>if (link) {<NEW_LINE>self.link_to(p2);<NEW_LINE>}<NEW_LINE>if (priority != null) {<NEW_LINE>// may throw badarg!<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>ERef ref = null;<NEW_LINE>if (monitor) {<NEW_LINE>ref = ERT.getLocalNode().createRef();<NEW_LINE>if (!self.monitor(p2.self_handle(), p2.self_handle(), ref)) {<NEW_LINE>throw new InternalError("cannot monitor new process?");<NEW_LINE>// self.mbox_send(ETuple.make(ERT.am_DOWN, ref, p2.self_handle(), ERT.am_noproc));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ERT.run(p2);<NEW_LINE>if (monitor) {<NEW_LINE>return new ETuple2(p2.self_handle(), ref);<NEW_LINE>} else {<NEW_LINE>return p2.self_handle();<NEW_LINE>}<NEW_LINE>} | p2.process_flag(am_priority, priority); |
849,700 | public AuthResult authenticate(CallHeaders incomingHeaders) {<NEW_LINE>try {<NEW_LINE>final String authEncoded = AuthUtilities.getValueFromAuthHeader(incomingHeaders, Auth2Constants.BASIC_PREFIX);<NEW_LINE>if (authEncoded == null) {<NEW_LINE>throw CallStatus.UNAUTHENTICATED.toRuntimeException();<NEW_LINE>}<NEW_LINE>// The value has the format Base64(<username>:<password>)<NEW_LINE>final String authDecoded = new String(Base64.getDecoder().decode(authEncoded), StandardCharsets.UTF_8);<NEW_LINE>final int colonPos = authDecoded.indexOf(':');<NEW_LINE>if (colonPos == -1) {<NEW_LINE>throw CallStatus.UNAUTHENTICATED.toRuntimeException();<NEW_LINE>}<NEW_LINE>final String user = <MASK><NEW_LINE>final String password = authDecoded.substring(colonPos + 1);<NEW_LINE>return authValidator.validate(user, password);<NEW_LINE>} catch (UnsupportedEncodingException ex) {<NEW_LINE>// Note: Intentionally discarding the exception cause when reporting back to the client for security purposes.<NEW_LINE>logger.error("Authentication failed due to missing encoding.", ex);<NEW_LINE>throw CallStatus.INTERNAL.toRuntimeException();<NEW_LINE>} catch (FlightRuntimeException ex) {<NEW_LINE>throw ex;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>// Note: Intentionally discarding the exception cause when reporting back to the client for security purposes.<NEW_LINE>logger.error("Authentication failed.", ex);<NEW_LINE>throw CallStatus.UNAUTHENTICATED.toRuntimeException();<NEW_LINE>}<NEW_LINE>} | authDecoded.substring(0, colonPos); |
1,309,198 | protected byte[] engineGetEncoded() throws IOException {<NEW_LINE>long cbbRef = 0;<NEW_LINE>long seqRef = 0;<NEW_LINE>try {<NEW_LINE>cbbRef = NativeCrypto.asn1_write_init();<NEW_LINE><MASK><NEW_LINE>writeHashAndMgfHash(seqRef, spec.getDigestAlgorithm(), (MGF1ParameterSpec) spec.getMGFParameters());<NEW_LINE>PSource.PSpecified pSource = (PSource.PSpecified) spec.getPSource();<NEW_LINE>// Implementations are prohibited from writing the default value for any of the fields<NEW_LINE>if (pSource.getValue().length != 0) {<NEW_LINE>long pSourceRef = 0;<NEW_LINE>long pSourceParamsRef = 0;<NEW_LINE>try {<NEW_LINE>pSourceRef = NativeCrypto.asn1_write_tag(seqRef, 2);<NEW_LINE>pSourceParamsRef = writeAlgorithmIdentifier(pSourceRef, PSPECIFIED_OID);<NEW_LINE>NativeCrypto.asn1_write_octetstring(pSourceParamsRef, pSource.getValue());<NEW_LINE>} finally {<NEW_LINE>NativeCrypto.asn1_write_flush(seqRef);<NEW_LINE>NativeCrypto.asn1_write_free(pSourceParamsRef);<NEW_LINE>NativeCrypto.asn1_write_free(pSourceRef);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return NativeCrypto.asn1_write_finish(cbbRef);<NEW_LINE>} catch (IOException e) {<NEW_LINE>NativeCrypto.asn1_write_cleanup(cbbRef);<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>NativeCrypto.asn1_write_free(seqRef);<NEW_LINE>NativeCrypto.asn1_write_free(cbbRef);<NEW_LINE>}<NEW_LINE>} | seqRef = NativeCrypto.asn1_write_sequence(cbbRef); |
505,701 | public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {<NEW_LINE>// Verify that the request originates from the application.<NEW_LINE>if (req.getParameter("token").compareTo(pubsubVerificationToken) != 0) {<NEW_LINE>resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Get the Cloud Pub/Sub-generated JWT in the "Authorization" header.<NEW_LINE>String authorizationHeader = req.getHeader("Authorization");<NEW_LINE>if (authorizationHeader == null || authorizationHeader.isEmpty() || authorizationHeader.split(" ").length != 2) {<NEW_LINE>resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String authorization = authorizationHeader<MASK><NEW_LINE>try {<NEW_LINE>// Verify and decode the JWT.<NEW_LINE>// Note: For high volume push requests, it would save some network overhead<NEW_LINE>// if you verify the tokens offline by decoding them using Google's Public<NEW_LINE>// Cert; caching already seen tokens works best when a large volume of<NEW_LINE>// messsages have prompted a single push server to handle them, in which<NEW_LINE>// case they would all share the same token for a limited time window.<NEW_LINE>GoogleIdToken idToken = verifier.verify(authorization);<NEW_LINE>GoogleIdToken.Payload payload = idToken.getPayload();<NEW_LINE>// IMPORTANT: you should validate claim details not covered by signature<NEW_LINE>// and audience verification above, including:<NEW_LINE>// - Ensure that `payload.getEmail()` is equal to the expected service<NEW_LINE>// account set up in the push subscription settings.<NEW_LINE>// - Ensure that `payload.getEmailVerified()` is set to true.<NEW_LINE>messageRepository.saveToken(authorization);<NEW_LINE>messageRepository.saveClaim(payload.toPrettyString());<NEW_LINE>// parse message object from "message" field in the request body json<NEW_LINE>// decode message data from base64<NEW_LINE>Message message = getMessage(req);<NEW_LINE>messageRepository.save(message);<NEW_LINE>// 200, 201, 204, 102 status codes are interpreted as success by the Pub/Sub system<NEW_LINE>resp.setStatus(102);<NEW_LINE>super.doPost(req, resp);<NEW_LINE>} catch (Exception e) {<NEW_LINE>resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);<NEW_LINE>}<NEW_LINE>} | .split(" ")[1]; |
158,080 | public void verticalTransitionRotationMap(Direction facingOld, Direction facingNew) {<NEW_LINE>// see if it transition is to or from vertical. return if none of the directions are vertical<NEW_LINE>boolean toVert = false;<NEW_LINE>if (facingNew.getAxis() == Axis.Y)<NEW_LINE>toVert = true;<NEW_LINE>if ((facingOld.getAxis() == Axis.Y) == toVert)<NEW_LINE>return;<NEW_LINE>Direction horizontalFacing = (toVert ? facingOld : facingNew);<NEW_LINE>int offset;<NEW_LINE>if (horizontalFacing.getAxis() == Axis.Z)<NEW_LINE>offset = facingNew.getAxisDirection() == facingOld.getAxisDirection() ? 2 : 0;<NEW_LINE>else<NEW_LINE>offset = (horizontalFacing.getAxisDirection() == AxisDirection.POSITIVE) == toVert ? 3 : 1;<NEW_LINE>Rotation[] oldRotMap = rotationMapping.clone();<NEW_LINE>boolean[] oldRedstone = redstone.clone();<NEW_LINE>for (int i = 0; i < rotationMapping.length; i++) {<NEW_LINE>int sourceIndex = Math.floorMod(<MASK><NEW_LINE>rotationMapping[i] = oldRotMap[sourceIndex];<NEW_LINE>// rotate redstone, too, to prevent toggling<NEW_LINE>redstone[i] = oldRedstone[sourceIndex];<NEW_LINE>}<NEW_LINE>} | i + offset, rotationMapping.length); |
1,340,364 | public synchronized void reportTo(PrintWriter writer) {<NEW_LINE>// name is ignored: only one kind of report for now<NEW_LINE>writer.print("Queue ");<NEW_LINE>writer.print(classKey);<NEW_LINE>writer.print(" (p");<NEW_LINE><MASK><NEW_LINE>writer.print(")\n");<NEW_LINE>writer.print(" ");<NEW_LINE>writer.print(Long.toString(count));<NEW_LINE>writer.print(" items");<NEW_LINE>if (wakeTime != 0) {<NEW_LINE>writer.print("\n wakes in: " + ArchiveUtils.formatMillisecondsToConventional(wakeTime - System.currentTimeMillis()));<NEW_LINE>}<NEW_LINE>writer.print("\n last enqueued: ");<NEW_LINE>writer.print(lastQueued);<NEW_LINE>writer.print("\n last peeked: ");<NEW_LINE>writer.print(lastPeeked);<NEW_LINE>writer.print("\n");<NEW_LINE>writer.print(" total expended: ");<NEW_LINE>writer.print(Long.toString(totalExpenditure));<NEW_LINE>writer.print(" (total budget: ");<NEW_LINE>writer.print(Long.toString(totalBudget));<NEW_LINE>writer.print(")\n");<NEW_LINE>writer.print(" active balance: ");<NEW_LINE>writer.print(getSessionBalance());<NEW_LINE>writer.print("\n last(avg) cost: ");<NEW_LINE>writer.print(lastCost);<NEW_LINE>writer.print("(");<NEW_LINE>writer.print(ArchiveUtils.doubleToString(((double) totalExpenditure / costCount), 1));<NEW_LINE>writer.print(")\n ");<NEW_LINE>writer.print(getSubstats().shortReportLegend());<NEW_LINE>writer.print("\n ");<NEW_LINE>writer.print(getSubstats().shortReportLine());<NEW_LINE>writer.print("\n ");<NEW_LINE>writer.print(getPrecedenceProvider().shortReportLegend());<NEW_LINE>writer.print("\n ");<NEW_LINE>writer.print(getPrecedenceProvider().shortReportLine());<NEW_LINE>writer.print("\n\n");<NEW_LINE>} | writer.print(getPrecedence()); |
1,034,086 | private void init() {<NEW_LINE>GraphicsEnvironment gfx = GraphicsEnvironment.getLocalGraphicsEnvironment();<NEW_LINE>String[<MASK><NEW_LINE>// preload the font map with the font names as keys<NEW_LINE>// don't add the actual font objects because that would be a waste of memory<NEW_LINE>// we will only add them once we need to use them<NEW_LINE>// put empty strings in instead<NEW_LINE>for (String fontName : availableFonts) {<NEW_LINE>availableFontsHash.put(fontName, null);<NEW_LINE>}<NEW_LINE>// preload sans, serif, and monospace into the available font hash<NEW_LINE>availableFontsHash.put("Serif", new Font("Serif", Font.PLAIN, 1));<NEW_LINE>availableFontsHash.put("SansSerif", new Font("SansSerif", Font.PLAIN, 1));<NEW_LINE>availableFontsHash.put("Monospaced", new Font("Monospaced", Font.PLAIN, 1));<NEW_LINE>} | ] availableFonts = gfx.getAvailableFontFamilyNames(); |
327,553 | public static void introduceTransposeError(HealthRecord.Encounter encounter, String obsType) {<NEW_LINE>HealthRecord.Observation obs;<NEW_LINE>if (obsType.equals("weight")) {<NEW_LINE>obs = weightObservation(encounter);<NEW_LINE>} else {<NEW_LINE>obs = heightObservation(encounter);<NEW_LINE>}<NEW_LINE>Double original = (Double) obs.value;<NEW_LINE>if (original >= 10) {<NEW_LINE><MASK><NEW_LINE>int decimalPointPosition = originalString.indexOf('.');<NEW_LINE>char[] originalChars = originalString.toCharArray();<NEW_LINE>char tens = originalChars[decimalPointPosition - 2];<NEW_LINE>char ones = originalChars[decimalPointPosition - 1];<NEW_LINE>originalChars[decimalPointPosition - 2] = ones;<NEW_LINE>originalChars[decimalPointPosition - 1] = tens;<NEW_LINE>obs.value = Double.parseDouble(new String(originalChars));<NEW_LINE>} else {<NEW_LINE>// for those with a single digit, just shift the ones to the tens<NEW_LINE>double ones = Math.floor(original);<NEW_LINE>double newTens = ones * 10;<NEW_LINE>obs.value = original - ones + newTens;<NEW_LINE>}<NEW_LINE>} | String originalString = original.toString(); |
385,689 | final CreateContextResult executeCreateContext(CreateContextRequest createContextRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createContextRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateContextRequest> request = null;<NEW_LINE>Response<CreateContextResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateContextRequestProtocolMarshaller(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, "SageMaker");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateContext");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateContextResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateContextResultJsonUnmarshaller());<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(createContextRequest)); |
777,783 | static List<CompositeBatch> groupBatches(List<Batch> batchList) {<NEW_LINE>Map<AggregationKey, CompositeBatch> batchGroups = new HashMap<AggregationKey, CompositeBatch>();<NEW_LINE>for (int i = 0; i < batchList.size(); i++) {<NEW_LINE>for (int j = i + 1; j < batchList.size(); ) {<NEW_LINE>final Batch <MASK><NEW_LINE>final Batch jBatch = batchList.get(j);<NEW_LINE>if (iBatch.canBatch(jBatch)) {<NEW_LINE>batchList.remove(j);<NEW_LINE>addToCompositeBatch(batchGroups, iBatch, jBatch);<NEW_LINE>} else if (jBatch.canBatch(iBatch)) {<NEW_LINE>batchList.set(i, jBatch);<NEW_LINE>batchList.remove(j);<NEW_LINE>addToCompositeBatch(batchGroups, jBatch, iBatch);<NEW_LINE>j = i + 1;<NEW_LINE>} else {<NEW_LINE>j++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>wrapNonBatchedBatchesWithCompositeBatches(batchList, batchGroups);<NEW_LINE>final CompositeBatch[] compositeBatches = batchGroups.values().toArray(new CompositeBatch[batchGroups.size()]);<NEW_LINE>Arrays.sort(compositeBatches, CompositeBatchComparator.instance);<NEW_LINE>return Arrays.asList(compositeBatches);<NEW_LINE>} | iBatch = batchList.get(i); |
1,085,711 | private void createNewDestLocalizations() {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {<NEW_LINE>SibTr.entry(tc, "createNewDestLocalizations", this);<NEW_LINE>}<NEW_LINE>if (!isInZOSServentRegion() && _mpAdmin != null) {<NEW_LINE>Iterator i = newDestinations.iterator();<NEW_LINE>while (i.hasNext()) {<NEW_LINE>String key = (String) i.next();<NEW_LINE>MainEntry m = mainMap.get(key);<NEW_LINE>try {<NEW_LINE>DestinationDefinition dd = (DestinationDefinition) _me.getSIBDestinationByUuid(_me.getBusName(), key, true);<NEW_LINE>// if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>// SibTr.debug(tc, "createNewDestLocalizations: adding DestinationLocalization, UUID=" + key + " Name=" + dd.getName());<NEW_LINE>// }<NEW_LINE>//<NEW_LINE>// LocalizationDefinition dld = m.getDestinationLocalization();<NEW_LINE>// MediationLocalizationDefinition mld = m.getMediationLocalization();<NEW_LINE>// MediationExecutionPointDefinition mepd = m.getMediationExecutionPoint();<NEW_LINE>// MQLocalizationDefinition mqdld = m.getMQDestinationLocalization();<NEW_LINE>// MQMediationLocalizationDefinition mqmld = m.getMQMediationLocalization();<NEW_LINE>//<NEW_LINE>// _mpAdmin.createDestinationLocalization(dd, dld, mld, mepd, mqdld, mqmld);<NEW_LINE>} catch (Exception e) {<NEW_LINE>com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".createNewDestLocalizations", "1", this);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {<NEW_LINE>SibTr.exit(tc, "createNewDestLocalizations");<NEW_LINE>}<NEW_LINE>} | SibTr.exception(tc, e); |
370,753 | private Node createHistoryView(History history) {<NEW_LINE>byte[] data = history.peek();<NEW_LINE>boolean isClass = ClassUtil.isClass(data);<NEW_LINE>String type = isClass ? "class" : "file";<NEW_LINE>BorderPane pane = new BorderPane();<NEW_LINE>// Content<NEW_LINE>int count = history.size() - 1;<NEW_LINE>String sub = count > 0 ? "[" + count + " states]" : "[Initial state]";<NEW_LINE>BorderPane display = new BorderPane();<NEW_LINE>display.setTop(new SubLabeled(history.name, sub));<NEW_LINE>display.setCenter(new VBox(new TextArea("Last updated: " + history.getMostRecentUpdate() + "\n" + "Content length: " + data.length + "\n" + "Content hash (MD5): " + DigestUtils.md5Hex(data) + "\n" + "Content hash (SHA1): " + DigestUtils.sha1Hex(data) + "\n" + "Content hash (SHA256): " + DigestUtils.sha256Hex(data))));<NEW_LINE>display.getCenter().getStyleClass().add("hist-data");<NEW_LINE>pane.setCenter(display);<NEW_LINE>// Buttons<NEW_LINE>HBox horizontal = new HBox();<NEW_LINE>horizontal.getStyleClass().add("hist-buttons");<NEW_LINE>horizontal.getChildren().addAll(new ActionButton(LangUtil.translate("ui.history.pop"), () -> {<NEW_LINE>pop(history, isClass);<NEW_LINE>// Update content sub-text<NEW_LINE>int updatedCount = history.size() - 1;<NEW_LINE>String updatedSub = updatedCount > 0 ? "[" + updatedCount + " states]" : "[Initial state]";<NEW_LINE>display.setTop(new SubLabeled(history.name, updatedSub));<NEW_LINE>// Update content data<NEW_LINE>byte[] updatedData = history.peek();<NEW_LINE>display.setCenter(new VBox(new Label("Last updated: " + history.getMostRecentUpdate()), new Label("Content length: " + updatedData.length), new Label("Content hash (MD5): " + DigestUtils.md5Hex(updatedData)), new Label("Content hash (SHA1): " + DigestUtils<MASK><NEW_LINE>display.getCenter().getStyleClass().add("monospaced");<NEW_LINE>}), new ActionButton(LangUtil.translate("ui.history.open." + type), () -> open(history, isClass)));<NEW_LINE>pane.setBottom(horizontal);<NEW_LINE>return pane;<NEW_LINE>} | .sha1Hex(updatedData)))); |
1,744,368 | public void actionPerformed(ActionEvent e) {<NEW_LINE>final String centeredNodeId = slide.getPlacedNodeId();<NEW_LINE>final IMapSelection selection = Controller.getCurrentController().getSelection();<NEW_LINE>if (centeredNodeId == null) {<NEW_LINE>final NodeModel selected = selection.getSelected();<NEW_LINE>if (selected != null) {<NEW_LINE>UndoableSlide.of(slide).setPlacedNodeId(selected.getID());<NEW_LINE>setNodePlacementControlsEnabled(<MASK><NEW_LINE>} else {<NEW_LINE>UndoableSlide.of(slide).setPlacedNodeId(null);<NEW_LINE>setNodePlacementControlsEnabled(false, slide.getPlacedNodePosition());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>UndoableSlide.of(slide).setPlacedNodeId(null);<NEW_LINE>setNodePlacementControlsEnabled(false, slide.getPlacedNodePosition());<NEW_LINE>final MapModel map = Controller.getCurrentController().getMap();<NEW_LINE>final NodeModel node = map.getNodeForID(centeredNodeId);<NEW_LINE>if (node != null)<NEW_LINE>selection.selectAsTheOnlyOneSelected(node);<NEW_LINE>}<NEW_LINE>checkBoxOnlySpecificNodes.setSelected(slide.getPlacedNodeId() != null);<NEW_LINE>} | true, slide.getPlacedNodePosition()); |
664,466 | private void insertTargetF0Values() throws Exception {<NEW_LINE>NodeList phoneNodes;<NEW_LINE>try {<NEW_LINE>phoneNodes = getPhoneNodes();<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new Exception("Could not get the phone Nodes from the Document", e);<NEW_LINE>}<NEW_LINE>// count the number of Datagrams we need, which is the number of F0 target values the ProsodyElementHandler will return:<NEW_LINE>int totalNumberOfFrames = getNumberOfFrames();<NEW_LINE>// this method hinges on the F0 attribute parsing done in modules.acoustic<NEW_LINE>ProsodyElementHandler elementHandler = new ProsodyElementHandler();<NEW_LINE>double[] f0Targets = elementHandler.getF0Contour(phoneNodes, totalNumberOfFrames);<NEW_LINE>int f0TargetStartIndex = 0;<NEW_LINE>for (Phone phone : phones) {<NEW_LINE>int numberOfLeftUnitFrames = phone.getNumberOfLeftUnitFrames();<NEW_LINE>int f0TargetMidIndex = f0TargetStartIndex + numberOfLeftUnitFrames;<NEW_LINE>double[] leftF0Targets = ArrayUtils.<MASK><NEW_LINE>phone.setLeftTargetF0Values(leftF0Targets);<NEW_LINE>int numberOfRightUnitFrames = phone.getNumberOfRightUnitFrames();<NEW_LINE>int f0TargetEndIndex = f0TargetMidIndex + numberOfRightUnitFrames;<NEW_LINE>double[] rightF0Targets = ArrayUtils.subarray(f0Targets, f0TargetMidIndex, f0TargetEndIndex);<NEW_LINE>phone.setRightTargetF0Values(rightF0Targets);<NEW_LINE>f0TargetStartIndex = f0TargetEndIndex;<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} | subarray(f0Targets, f0TargetStartIndex, f0TargetMidIndex); |
1,354,852 | public static MediaType produceType(RequestHeaders headers) {<NEW_LINE>final MediaType contentType = headers.contentType();<NEW_LINE>if (HttpMethod.POST == headers.method() && contentType != null && contentType.is(MediaType.GRAPHQL)) {<NEW_LINE>return MediaType.GRAPHQL_JSON;<NEW_LINE>}<NEW_LINE>final List<MediaType<MASK><NEW_LINE>if (acceptTypes.isEmpty()) {<NEW_LINE>// If there is no Accept header in the request, the response MUST include<NEW_LINE>// a Content-Type: application/graphql+json header<NEW_LINE>return MediaType.GRAPHQL_JSON;<NEW_LINE>}<NEW_LINE>for (MediaType accept : acceptTypes) {<NEW_LINE>if (MediaType.ANY_TYPE.is(accept) || MediaType.ANY_APPLICATION_TYPE.is(accept)) {<NEW_LINE>return MediaType.GRAPHQL_JSON;<NEW_LINE>}<NEW_LINE>if (accept.is(MediaType.GRAPHQL_JSON) || accept.is(MediaType.JSON)) {<NEW_LINE>return accept;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Not acceptable<NEW_LINE>return null;<NEW_LINE>} | > acceptTypes = headers.accept(); |
464,647 | protected void nextIteration() {<NEW_LINE>if ((inner != null) && inner.hasNext()) {<NEW_LINE>next = inner.next();<NEW_LINE>hasNext = true;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>if (inner == null || !inner.hasNext()) {<NEW_LINE>if (innerStream != null) {<NEW_LINE>innerStream.close();<NEW_LINE>innerStream = null;<NEW_LINE>}<NEW_LINE>final T arg = iterator.next();<NEW_LINE>final Stream<? extends R> <MASK><NEW_LINE>if (result != null) {<NEW_LINE>inner = result.iterator();<NEW_LINE>innerStream = result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if ((inner != null) && inner.hasNext()) {<NEW_LINE>next = inner.next();<NEW_LINE>hasNext = true;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>hasNext = false;<NEW_LINE>if (innerStream != null) {<NEW_LINE>innerStream.close();<NEW_LINE>innerStream = null;<NEW_LINE>}<NEW_LINE>} | result = mapper.apply(arg); |
1,579,671 | public List<IViewRow> retrievePage(final ViewEvaluationCtx viewEvalCtx, final ViewRowIdsOrderedSelection orderedSelection, final int firstRow, final int pageLength) throws DBException {<NEW_LINE>logger.debug("Getting page: firstRow={}, pageLength={} - {}", firstRow, pageLength, this);<NEW_LINE><MASK><NEW_LINE>final ViewId viewId = orderedSelection.getViewId();<NEW_LINE>final SqlAndParams sqlAndParams = sqlViewSelect.selectByPage().viewEvalCtx(viewEvalCtx).viewId(viewId).firstRowZeroBased(firstRow).pageLength(pageLength).build();<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sqlAndParams.getSql(), ITrx.TRXNAME_ThreadInherited);<NEW_LINE>pstmt.setMaxRows(pageLength);<NEW_LINE>DB.setParameters(pstmt, sqlAndParams.getSqlParams());<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>return loadViewRows(rs, viewEvalCtx, viewId, pageLength);<NEW_LINE>} catch (final SQLException | DBException e) {<NEW_LINE>throw DBException.wrapIfNeeded(e).setSqlIfAbsent(sqlAndParams.getSql(), sqlAndParams.getSqlParams());<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>}<NEW_LINE>} | logger.debug("Using: {}", orderedSelection); |
781,480 | public void mouseDown(MouseEvent e) {<NEW_LINE>if (control.isDisposed()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final String text = provider.getText();<NEW_LINE>if (control.getMenu() != null || text == null || text.length() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!(e.button == 3 || (e.button == 1 && e.stateMask == SWT.CONTROL))) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Menu menu = new Menu(control.getShell(), SWT.POP_UP);<NEW_LINE>MenuItem item = new MenuItem(menu, SWT.NONE);<NEW_LINE>item.setData(MENU_ITEM_KEY, "");<NEW_LINE>String msg_text_id;<NEW_LINE>if (provider instanceof copyToClipProvider2) {<NEW_LINE>msg_text_id = ((<MASK><NEW_LINE>} else {<NEW_LINE>msg_text_id = "label.copy.to.clipboard";<NEW_LINE>}<NEW_LINE>item.setText(MessageText.getString(msg_text_id));<NEW_LINE>item.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void widgetSelected(SelectionEvent arg0) {<NEW_LINE>new Clipboard(control.getDisplay()).setContents(new Object[] { text }, new Transfer[] { TextTransfer.getInstance() });<NEW_LINE>}<NEW_LINE>});<NEW_LINE>control.setMenu(menu);<NEW_LINE>menu.addMenuListener(new MenuAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void menuHidden(MenuEvent arg0) {<NEW_LINE>if (control.getMenu() == menu) {<NEW_LINE>control.setMenu(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>menu.setVisible(true);<NEW_LINE>} | copyToClipProvider2) provider).getMenuResource(); |
1,556,548 | public void handle(PacketWrapper wrapper) throws Exception {<NEW_LINE>String name = wrapper.get(Type.STRING, 0);<NEW_LINE>SoundEffect effect = SoundEffect.getByName(name);<NEW_LINE>int catid = 0;<NEW_LINE>String newname = name;<NEW_LINE>if (effect != null) {<NEW_LINE>catid = effect.getCategory().getId();<NEW_LINE>newname = effect.getNewName();<NEW_LINE>}<NEW_LINE>wrapper.set(Type.STRING, 0, newname);<NEW_LINE>// Write Category ID<NEW_LINE>wrapper.write(Type.VAR_INT, catid);<NEW_LINE>if (effect != null && effect.isBreaksound()) {<NEW_LINE>EntityTracker1_9 tracker = wrapper.user().getEntityTracker(Protocol1_9To1_8.class);<NEW_LINE>// Position X<NEW_LINE>int x = <MASK><NEW_LINE>// Position Y<NEW_LINE>int y = wrapper.passthrough(Type.INT);<NEW_LINE>// Position Z<NEW_LINE>int z = wrapper.passthrough(Type.INT);<NEW_LINE>if (tracker.interactedBlockRecently((int) Math.floor(x / 8.0), (int) Math.floor(y / 8.0), (int) Math.floor(z / 8.0))) {<NEW_LINE>wrapper.cancel();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | wrapper.passthrough(Type.INT); |
1,741,609 | protected void writeRuntimeEsproc(RaqsoftConfig config) throws SAXException {<NEW_LINE>level = 2;<NEW_LINE><MASK><NEW_LINE>level = 3;<NEW_LINE>writeAttribute(ConfigConsts.CHAR_SET, config.getCharSet());<NEW_LINE>List<String> paths = config.getSplPathList();<NEW_LINE>if (paths != null && !paths.isEmpty()) {<NEW_LINE>startElement(ConfigConsts.SPL_PATH_LIST, null);<NEW_LINE>level = 4;<NEW_LINE>for (int i = 0; i < paths.size(); i++) {<NEW_LINE>writeAttribute(ConfigConsts.SPL_PATH, (String) paths.get(i));<NEW_LINE>}<NEW_LINE>level = 3;<NEW_LINE>endElement(ConfigConsts.SPL_PATH_LIST);<NEW_LINE>}<NEW_LINE>writeAttribute(ConfigConsts.DATE_FORMAT, config.getDateFormat());<NEW_LINE>writeAttribute(ConfigConsts.TIME_FORMAT, config.getTimeFormat());<NEW_LINE>writeAttribute(ConfigConsts.DATE_TIME_FORMAT, config.getDateTimeFormat());<NEW_LINE>writeAttribute(ConfigConsts.MAIN_PATH, config.getMainPath());<NEW_LINE>writeAttribute(ConfigConsts.TEMP_PATH, config.getTempPath());<NEW_LINE>writeAttribute(ConfigConsts.BUF_SIZE, config.getBufSize());<NEW_LINE>writeAttribute(ConfigConsts.LOCAL_HOST, config.getLocalHost());<NEW_LINE>writeAttribute(ConfigConsts.LOCAL_PORT, config.getLocalPort());<NEW_LINE>writeAttribute(ConfigConsts.PARALLEL_NUM, config.getParallelNum());<NEW_LINE>writeAttribute(ConfigConsts.CURSOR_PARALLEL_NUM, config.getCursorParallelNum());<NEW_LINE>writeAttribute(ConfigConsts.BLOCK_SIZE, config.getBlockSize());<NEW_LINE>writeAttribute(ConfigConsts.NULL_STRINGS, config.getNullStrings());<NEW_LINE>writeAttribute(ConfigConsts.FETCH_COUNT, config.getFetchCount());<NEW_LINE>writeAttribute(ConfigConsts.EXTLIBS, config.getExtLibsPath());<NEW_LINE>writeImportLibList(config.getImportLibs());<NEW_LINE>writeAttribute(ConfigConsts.CUSTOM_FUNCTION_FILE, config.getCustomFunctionFile());<NEW_LINE>level = 2;<NEW_LINE>endElement(ConfigConsts.ESPROC);<NEW_LINE>} | startElement(ConfigConsts.ESPROC, null); |
206,614 | private void processContainerDependency(final Container container) {<NEW_LINE>try {<NEW_LINE>final String containerId = container.getIdentifier();<NEW_LINE>final Container containerById = APILocator.getContainerAPI().getWorkingContainerById(containerId, user, false);<NEW_LINE>// Host Dependency<NEW_LINE>tryToAddSilently(PusheableAsset.SITE, pushPublishigDependencyProvider.getHostByContainer(containerById), ManifestReason.INCLUDE_DEPENDENCY_FROM.getMessage(container));<NEW_LINE>// Content Type Dependencies<NEW_LINE>tryToAddAllAndProcessDependencies(PusheableAsset.CONTENT_TYPE, pushPublishigDependencyProvider.getContentTypeByWorkingContainer(containerId), ManifestReason.INCLUDE_DEPENDENCY_FROM.getMessage(container));<NEW_LINE>tryToAddAllAndProcessDependencies(PusheableAsset.CONTENT_TYPE, pushPublishigDependencyProvider.getContentTypeByLiveContainer(containerId), ManifestReason.INCLUDE_DEPENDENCY_FROM.getMessage(container));<NEW_LINE>if (containerById instanceof FileAssetContainer) {<NEW_LINE>// Process FileAssetContainer<NEW_LINE>tryToAddAsDependency(PusheableAsset.FOLDER, pushPublishigDependencyProvider.getFileAssetContainerRootFolder(FileAssetContainer.class.cast(containerById)), container);<NEW_LINE>}<NEW_LINE>} catch (DotSecurityException e) {<NEW_LINE>Logger.error(this, e.getMessage(), e);<NEW_LINE>} catch (DotDataException e) {<NEW_LINE>Logger.error(this, <MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
1,846,550 | public void redirectBranches(final InstructionHandle old_target, final InstructionHandle new_target) {<NEW_LINE>for (InstructionHandle ih = start; ih != null; ih = ih.getNext()) {<NEW_LINE>final Instruction i = ih.getInstruction();<NEW_LINE>if (i instanceof BranchInstruction) {<NEW_LINE>final BranchInstruction b = (BranchInstruction) i;<NEW_LINE>final <MASK><NEW_LINE>if (target == old_target) {<NEW_LINE>b.setTarget(new_target);<NEW_LINE>}<NEW_LINE>if (b instanceof Select) {<NEW_LINE>// Either LOOKUPSWITCH or TABLESWITCH<NEW_LINE>final InstructionHandle[] targets = ((Select) b).getTargets();<NEW_LINE>for (int j = 0; j < targets.length; j++) {<NEW_LINE>if (targets[j] == old_target) {<NEW_LINE>((Select) b).setTarget(j, new_target);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | InstructionHandle target = b.getTarget(); |
1,055,041 | public void onAcceptMediationResult(Trade trade, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {<NEW_LINE>String tradeId = trade.getId();<NEW_LINE>Optional<Dispute> optionalDispute = findDispute(tradeId);<NEW_LINE>checkArgument(optionalDispute.isPresent(), "dispute must be present");<NEW_LINE>DisputeResult disputeResult = optionalDispute.get().getDisputeResultProperty().get();<NEW_LINE>Coin buyerPayoutAmount = disputeResult.getBuyerPayoutAmount();<NEW_LINE>Coin sellerPayoutAmount = disputeResult.getSellerPayoutAmount();<NEW_LINE>ProcessModel processModel = trade.getProcessModel();<NEW_LINE>processModel.setBuyerPayoutAmountFromMediation(buyerPayoutAmount.value);<NEW_LINE>processModel.setSellerPayoutAmountFromMediation(sellerPayoutAmount.value);<NEW_LINE>DisputeProtocol tradeProtocol = (DisputeProtocol) tradeManager.getTradeProtocol(trade);<NEW_LINE>trade.setMediationResultState(MediationResultState.MEDIATION_RESULT_ACCEPTED);<NEW_LINE>tradeManager.requestPersistence();<NEW_LINE>// If we have not got yet the peers signature we sign and send to the peer our signature.<NEW_LINE>// Otherwise we sign and complete with the peers signature the payout tx.<NEW_LINE>if (processModel.getTradePeer().getMediatedPayoutTxSignature() == null) {<NEW_LINE>tradeProtocol.onAcceptMediationResult(() -> {<NEW_LINE>if (trade.getPayoutTx() != null) {<NEW_LINE>tradeManager.closeDisputedTrade(tradeId, Trade.DisputeState.MEDIATION_CLOSED);<NEW_LINE>}<NEW_LINE>resultHandler.handleResult();<NEW_LINE>}, errorMessageHandler);<NEW_LINE>} else {<NEW_LINE>tradeProtocol.onFinalizeMediationResultPayout(() -> {<NEW_LINE>if (trade.getPayoutTx() != null) {<NEW_LINE>tradeManager.closeDisputedTrade(<MASK><NEW_LINE>}<NEW_LINE>resultHandler.handleResult();<NEW_LINE>}, errorMessageHandler);<NEW_LINE>}<NEW_LINE>} | tradeId, Trade.DisputeState.MEDIATION_CLOSED); |
749,611 | public static void show(final Context c) {<NEW_LINE>final View inflate = LayoutInflater.from(c).inflate(R.layout.dialog_tap_zone, null, false);<NEW_LINE>final List<String> items = Arrays.asList(c.getString(R.string.next_page), c.getString(R.string.previous_page), c.getString(R.string.db_do_nothing));<NEW_LINE>final BaseItemLayoutAdapter<String> adapter = new BaseItemLayoutAdapter<String>(c, android.R.layout.simple_spinner_dropdown_item, items) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void populateView(View inflate, int arg1, String value) {<NEW_LINE>Views.text(inflate, android.R.id.text1, "" + value);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getItem(int position) {<NEW_LINE>return items.get(position);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>final Spinner leftSide = (Spinner) inflate.findViewById(R.id.leftSide);<NEW_LINE>final Spinner rightSide = (Spinner) inflate.<MASK><NEW_LINE>final Spinner topSide = (Spinner) inflate.findViewById(R.id.topSide);<NEW_LINE>final Spinner bottomSide = (Spinner) inflate.findViewById(R.id.bottomSide);<NEW_LINE>leftSide.setAdapter(adapter);<NEW_LINE>rightSide.setAdapter(adapter);<NEW_LINE>topSide.setAdapter(adapter);<NEW_LINE>bottomSide.setAdapter(adapter);<NEW_LINE>leftSide.setSelection(AppState.get().tapZoneLeft, false);<NEW_LINE>rightSide.setSelection(AppState.get().tapZoneRight, false);<NEW_LINE>topSide.setSelection(AppState.get().tapZoneTop, false);<NEW_LINE>bottomSide.setSelection(AppState.get().tapZoneBottom, false);<NEW_LINE>final AlertDialog.Builder builder = new AlertDialog.Builder(c);<NEW_LINE>builder.setTitle(R.string.customize_tap_zones);<NEW_LINE>builder.setView(inflate);<NEW_LINE>builder.setPositiveButton(R.string.apply, new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int which) {<NEW_LINE>AppState.get().tapZoneLeft = leftSide.getSelectedItemPosition();<NEW_LINE>AppState.get().tapZoneRight = rightSide.getSelectedItemPosition();<NEW_LINE>AppState.get().tapZoneTop = topSide.getSelectedItemPosition();<NEW_LINE>AppState.get().tapZoneBottom = bottomSide.getSelectedItemPosition();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int which) {<NEW_LINE>dialog.dismiss();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>builder.show();<NEW_LINE>} | findViewById(R.id.rightSide); |
188,686 | public Frame clone() {<NEW_LINE>Frame newFrame = new Frame();<NEW_LINE>// Video part<NEW_LINE>newFrame.imageWidth = imageWidth;<NEW_LINE>newFrame.imageHeight = imageHeight;<NEW_LINE>newFrame.imageDepth = imageDepth;<NEW_LINE>newFrame.imageChannels = imageChannels;<NEW_LINE>newFrame.imageStride = imageStride;<NEW_LINE>newFrame.keyFrame = keyFrame;<NEW_LINE>newFrame.pictType = pictType;<NEW_LINE>newFrame.streamIndex = streamIndex;<NEW_LINE>newFrame.type = type;<NEW_LINE>newFrame.opaque = new Pointer[3];<NEW_LINE>if (image != null) {<NEW_LINE>newFrame.image = new Buffer[image.length];<NEW_LINE>((Pointer[]) newFrame.opaque)[0] = cloneBufferArray(image, newFrame.image);<NEW_LINE>}<NEW_LINE>// Audio part<NEW_LINE>newFrame.audioChannels = audioChannels;<NEW_LINE>newFrame.sampleRate = sampleRate;<NEW_LINE>if (samples != null) {<NEW_LINE>newFrame.samples <MASK><NEW_LINE>((Pointer[]) newFrame.opaque)[1] = cloneBufferArray(samples, newFrame.samples);<NEW_LINE>}<NEW_LINE>// Other data streams<NEW_LINE>if (data != null) {<NEW_LINE>ByteBuffer[] dst = new ByteBuffer[1];<NEW_LINE>((Pointer[]) newFrame.opaque)[2] = cloneBufferArray(new ByteBuffer[] { data }, dst);<NEW_LINE>newFrame.data = dst[0];<NEW_LINE>}<NEW_LINE>// Add timestamp<NEW_LINE>newFrame.timestamp = timestamp;<NEW_LINE>return newFrame;<NEW_LINE>} | = new Buffer[samples.length]; |
183,512 | private final void internalEvent(Object source, Class sourceClass, String methodName, Throwable throwable) {<NEW_LINE>StringBuffer stringBuffer = new StringBuffer();<NEW_LINE>stringBuffer.append(methodName);<NEW_LINE>stringBuffer.append(" [");<NEW_LINE>if (source != null) {<NEW_LINE>stringBuffer.append(source);<NEW_LINE>} else {<NEW_LINE>stringBuffer.append("Static");<NEW_LINE>}<NEW_LINE>stringBuffer.append("]");<NEW_LINE>if (throwable != null) {<NEW_LINE>Tr.event(traceComponent, stringBuffer.toString(), new Object<MASK><NEW_LINE>} else {<NEW_LINE>Tr.event(traceComponent, stringBuffer.toString());<NEW_LINE>}<NEW_LINE>if (usePrintWriterForTrace) {<NEW_LINE>if (printWriter != null) {<NEW_LINE>printWriter.print(new java.util.Date() + " E ");<NEW_LINE>printWriter.print(sourceClass.getName());<NEW_LINE>printWriter.print(".");<NEW_LINE>printWriter.println(stringBuffer.toString());<NEW_LINE>if (throwable != null) {<NEW_LINE>throwable.printStackTrace(printWriter);<NEW_LINE>}<NEW_LINE>printWriter.flush();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | [] { "Exception caught: ", throwable }); |
1,226,573 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller != null) {<NEW_LINE>Map<UUID, Integer> destroyedCreatures = new HashMap<>();<NEW_LINE>for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game)) {<NEW_LINE>if (permanent.destroy(source, game, false)) {<NEW_LINE>int count = destroyedCreatures.getOrDefault(permanent.getControllerId(), 0);<NEW_LINE>destroyedCreatures.put(permanent.getControllerId(), count + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) {<NEW_LINE>int count = destroyedCreatures.getOrDefault(playerId, 0);<NEW_LINE>if (count > 0) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null) {<NEW_LINE>player.loseLife(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | count, game, source, false); |
933,285 | private boolean processSelector(@NotNull GoSelectorExpr parent, @NotNull GoScopeProcessor processor, @NotNull ResolveState state, @Nullable PsiElement another) {<NEW_LINE>List<GoExpression> list = parent.getExpressionList();<NEW_LINE>if (list.size() > 1 && list.get(1).isEquivalentTo(another)) {<NEW_LINE>GoExpression e = list.get(0);<NEW_LINE>List<GoReferenceExpression> refs = ContainerUtil.newArrayList(PsiTreeUtil.findChildrenOfType(e, GoReferenceExpression.class));<NEW_LINE>GoExpression o = refs.size() > 1 ? refs.get(refs.size() - 1) : e;<NEW_LINE>PsiReference ref = o.getReference();<NEW_LINE>PsiElement resolve = ref != null ? ref.resolve() : null;<NEW_LINE>// var c = C.call(); c.a.b.d;<NEW_LINE>if (resolve == o)<NEW_LINE>return processor.execute(myElement, state);<NEW_LINE>GoType type = e<MASK><NEW_LINE>if (type != null && !processGoType(type, processor, state))<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .getGoType(createContextOnElement(myElement)); |
1,265,170 | final DescribeAuditSuppressionResult executeDescribeAuditSuppression(DescribeAuditSuppressionRequest describeAuditSuppressionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAuditSuppressionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAuditSuppressionRequest> request = null;<NEW_LINE>Response<DescribeAuditSuppressionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAuditSuppressionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeAuditSuppressionRequest));<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, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAuditSuppression");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAuditSuppressionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new DescribeAuditSuppressionResultJsonUnmarshaller()); |
1,414,156 | private void ensureExpandedTexture() {<NEW_LINE>if (mExpandedTitleTexture != null || mExpandedBounds.isEmpty() || TextUtils.isEmpty(mTextToDraw)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>calculateOffsets(0f);<NEW_LINE>mTextureAscent = mTextPaint.ascent();<NEW_LINE>mTextureDescent = mTextPaint.descent();<NEW_LINE>final int w = Math.round(mTextPaint.measureText(mTextToDraw, 0, mTextToDraw.length()));<NEW_LINE>final int h = Math.round(mTextureDescent - mTextureAscent);<NEW_LINE>if (w <= 0 || h <= 0) {<NEW_LINE>// If the width or height are 0, return<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mExpandedTitleTexture = Bitmap.createBitmap(w, <MASK><NEW_LINE>Canvas c = new Canvas(mExpandedTitleTexture);<NEW_LINE>c.drawText(mTextToDraw, 0, mTextToDraw.length(), 0, h - mTextPaint.descent(), mTextPaint);<NEW_LINE>if (mTexturePaint == null) {<NEW_LINE>// Make sure we have a paint<NEW_LINE>mTexturePaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);<NEW_LINE>}<NEW_LINE>} | h, Bitmap.Config.ARGB_8888); |
1,227,860 | public static Method wrapper(String name) throws NoSuchMethodException {<NEW_LINE>switch(name.toLowerCase()) {<NEW_LINE>case "boolean":<NEW_LINE>return Boolean.class.getDeclaredMethod("valueOf", Boolean.TYPE);<NEW_LINE>case "char":<NEW_LINE>case "character":<NEW_LINE>return Character.class.<MASK><NEW_LINE>case "byte":<NEW_LINE>return Byte.class.getDeclaredMethod("valueOf", Byte.TYPE);<NEW_LINE>case "short":<NEW_LINE>return Short.class.getDeclaredMethod("valueOf", Short.TYPE);<NEW_LINE>case "int":<NEW_LINE>case "integer":<NEW_LINE>return Integer.class.getDeclaredMethod("valueOf", Integer.TYPE);<NEW_LINE>case "long":<NEW_LINE>return Long.class.getDeclaredMethod("valueOf", Long.TYPE);<NEW_LINE>case "float":<NEW_LINE>return Float.class.getDeclaredMethod("valueOf", Float.TYPE);<NEW_LINE>case "double":<NEW_LINE>return Double.class.getDeclaredMethod("valueOf", Double.TYPE);<NEW_LINE>default:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | getDeclaredMethod("valueOf", Character.TYPE); |
1,360,810 | public static ByteBuf encodeMetadata(ByteBufAllocator allocator, String customAuthType, ByteBuf metadata) {<NEW_LINE>int actualASCIILength = ByteBufUtil.utf8Bytes(customAuthType);<NEW_LINE>if (actualASCIILength != customAuthType.length()) {<NEW_LINE>throw new IllegalArgumentException("custom auth type must be US_ASCII characters only");<NEW_LINE>}<NEW_LINE>if (actualASCIILength < 1 || actualASCIILength > 128) {<NEW_LINE>throw new IllegalArgumentException("custom auth type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128");<NEW_LINE>}<NEW_LINE>int capacity = 1 + actualASCIILength;<NEW_LINE>ByteBuf headerBuffer = <MASK><NEW_LINE>// encoded length is one less than actual length, since 0 is never a valid length, which gives<NEW_LINE>// wider representation range<NEW_LINE>headerBuffer.writeByte(actualASCIILength - 1);<NEW_LINE>ByteBufUtil.reserveAndWriteUtf8(headerBuffer, customAuthType, actualASCIILength);<NEW_LINE>return allocator.compositeBuffer(2).addComponents(true, headerBuffer, metadata);<NEW_LINE>} | allocator.buffer(capacity, capacity); |
1,142,573 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>lblFile = new javax.swing.JLabel();<NEW_LINE>txtFile = <MASK><NEW_LINE>btnFile = new javax.swing.JButton();<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(lblFile, "Javadoc Location :");<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(btnFile, org.openide.util.NbBundle.getMessage(InstallDocSourcePanel.class, "BTN_Browse"));<NEW_LINE>btnFile.addActionListener(new java.awt.event.ActionListener() {<NEW_LINE><NEW_LINE>public void actionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>btnFileActionPerformed(evt);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);<NEW_LINE>this.setLayout(layout);<NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(lblFile).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(txtFile, javax.swing.GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(btnFile).addContainerGap()));<NEW_LINE>layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(lblFile).addComponent(btnFile).addComponent(txtFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap(36, Short.MAX_VALUE)));<NEW_LINE>} | new javax.swing.JTextField(); |
893,977 | public static void horizontal7(Kernel1D_S32 kernel, GrayU16 image, GrayI16 dest, int divisor) {<NEW_LINE>final short[] dataSrc = image.data;<NEW_LINE>final short[] dataDst = dest.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int k6 = kernel.data[5];<NEW_LINE>final int k7 = kernel.data[6];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int width = image.getWidth();<NEW_LINE>final int halfDivisor = divisor / 2;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, image.height, i -> {<NEW_LINE>for (int i = 0; i < image.height; i++) {<NEW_LINE>int indexDst = dest.startIndex + i * dest.stride + radius;<NEW_LINE>int j = image.startIndex + i * image.stride - radius;<NEW_LINE>final int jEnd = j + width - radius;<NEW_LINE>for (j += radius; j < jEnd; j++) {<NEW_LINE>int indexSrc = j;<NEW_LINE>int total = (dataSrc[indexSrc++] & 0xFFFF) * k1;<NEW_LINE>total += (dataSrc[<MASK><NEW_LINE>total += (dataSrc[indexSrc++] & 0xFFFF) * k3;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFFFF) * k4;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFFFF) * k5;<NEW_LINE>total += (dataSrc[indexSrc++] & 0xFFFF) * k6;<NEW_LINE>total += (dataSrc[indexSrc] & 0xFFFF) * k7;<NEW_LINE>dataDst[indexDst++] = (short) ((total + halfDivisor) / divisor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | indexSrc++] & 0xFFFF) * k2; |
1,634,821 | final RejectSkillResult executeRejectSkill(RejectSkillRequest rejectSkillRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(rejectSkillRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RejectSkillRequest> request = null;<NEW_LINE>Response<RejectSkillResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RejectSkillRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(rejectSkillRequest));<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, "Alexa For Business");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RejectSkill");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RejectSkillResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RejectSkillResultJsonUnmarshaller());<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,292,205 | public static void delete(final RheaKVStore rheaKVStore) {<NEW_LINE>rheaKVStore.bPut("delete_test", writeUtf8("1"));<NEW_LINE>LOG.info("Value={}", readUtf8(rheaKVStore.bGet("delete_test")));<NEW_LINE>final CompletableFuture<Boolean> f1 = rheaKVStore.delete(writeUtf8("delete_test"));<NEW_LINE>FutureHelper.get(f1);<NEW_LINE>LOG.info("Value={}", readUtf8(rheaKVStore.bGet("delete_test")));<NEW_LINE>rheaKVStore.bPut("delete_test", writeUtf8("1"));<NEW_LINE>LOG.info("Value={}", readUtf8(rheaKVStore.bGet("delete_test")));<NEW_LINE>final CompletableFuture<Boolean> f2 = rheaKVStore.delete("delete_test");<NEW_LINE>FutureHelper.get(f2);<NEW_LINE>LOG.info("Value={}", readUtf8(<MASK><NEW_LINE>rheaKVStore.bPut("delete_test", writeUtf8("1"));<NEW_LINE>LOG.info("Value={}", readUtf8(rheaKVStore.bGet("delete_test")));<NEW_LINE>rheaKVStore.bDelete(writeUtf8("delete_test"));<NEW_LINE>LOG.info("Value={}", readUtf8(rheaKVStore.bGet("delete_test")));<NEW_LINE>rheaKVStore.bPut("delete_test", writeUtf8("1"));<NEW_LINE>LOG.info("Value={}", readUtf8(rheaKVStore.bGet("delete_test")));<NEW_LINE>rheaKVStore.bDelete("delete_test");<NEW_LINE>LOG.info("Value={}", readUtf8(rheaKVStore.bGet("delete_test")));<NEW_LINE>} | rheaKVStore.bGet("delete_test"))); |
1,080,505 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>super.setContentView(R.layout.activity_drawer);<NEW_LINE>mDrawer = findViewById(R.id.drawer);<NEW_LINE>mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);<NEW_LINE>mDrawerAccount = (TextView) <MASK><NEW_LINE>mDrawerLogout = findViewById(R.id.drawer_logout);<NEW_LINE>mDrawerUser = findViewById(R.id.drawer_user);<NEW_LINE>mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.open_drawer, R.string.close_drawer) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onDrawerClosed(View drawerView) {<NEW_LINE>super.onDrawerClosed(drawerView);<NEW_LINE>if (drawerView.equals(mDrawer) && mPendingNavigation != null) {<NEW_LINE>final Intent intent = new Intent(DrawerActivity.this, mPendingNavigation);<NEW_LINE>if (mPendingNavigationExtras != null) {<NEW_LINE>intent.putExtras(mPendingNavigationExtras);<NEW_LINE>mPendingNavigationExtras = null;<NEW_LINE>}<NEW_LINE>// TODO M bug https://code.google.com/p/android/issues/detail?id=193822<NEW_LINE>intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);<NEW_LINE>startActivity(intent);<NEW_LINE>mPendingNavigation = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>mDrawerLayout.addDrawerListener(mDrawerToggle);<NEW_LINE>PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(mLoginListener);<NEW_LINE>setUpDrawer();<NEW_LINE>setUsername();<NEW_LINE>} | findViewById(R.id.drawer_account); |
503,917 | public void marshall(CreateWorkspaceRequest createWorkspaceRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createWorkspaceRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getAccountAccessType(), ACCOUNTACCESSTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getAuthenticationProviders(), AUTHENTICATIONPROVIDERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getClientToken(), CLIENTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getOrganizationRoleName(), ORGANIZATIONROLENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getPermissionType(), PERMISSIONTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getStackSetName(), STACKSETNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getWorkspaceDataSources(), WORKSPACEDATASOURCES_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getWorkspaceDescription(), WORKSPACEDESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getWorkspaceName(), WORKSPACENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getWorkspaceOrganizationalUnits(), WORKSPACEORGANIZATIONALUNITS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createWorkspaceRequest.getWorkspaceRoleArn(), WORKSPACEROLEARN_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createWorkspaceRequest.getWorkspaceNotificationDestinations(), WORKSPACENOTIFICATIONDESTINATIONS_BINDING); |
1,173,821 | public String[][] generateFwRules(final LoadBalancerConfigCommand lbCmd) {<NEW_LINE>final String[][] result = new String[3][];<NEW_LINE>final Set<String> toAdd = new HashSet<String>();<NEW_LINE>final Set<String> toRemove = new HashSet<String>();<NEW_LINE>final Set<String> toStats = new HashSet<String>();<NEW_LINE>for (final LoadBalancerTO lbTO : lbCmd.getLoadBalancers()) {<NEW_LINE>final StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append(lbTO.getSrcIp()).append(":");<NEW_LINE>sb.append(lbTO.getSrcPort()).append(":");<NEW_LINE>final String lbRuleEntry = sb.toString();<NEW_LINE>if (!lbTO.isRevoked()) {<NEW_LINE>toAdd.add(lbRuleEntry);<NEW_LINE>} else {<NEW_LINE>toRemove.add(lbRuleEntry);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder("");<NEW_LINE>if (lbCmd.lbStatsVisibility.equals("guest-network")) {<NEW_LINE>sb = new StringBuilder(lbCmd.lbStatsGuestIP).append(":").append(lbCmd.lbStatsPort).append(":").append(lbCmd.lbStatsSrcCidrs).append(":,");<NEW_LINE>} else if (lbCmd.lbStatsVisibility.equals("link-local")) {<NEW_LINE>sb = new StringBuilder(lbCmd.lbStatsPrivateIP).append(":").append(lbCmd.lbStatsPort).append(":").append(lbCmd.lbStatsSrcCidrs).append(":,");<NEW_LINE>} else if (lbCmd.lbStatsVisibility.equals("global")) {<NEW_LINE>sb = new StringBuilder(lbCmd.lbStatsPublicIP).append(":").append(lbCmd.lbStatsPort).append(":").append(lbCmd<MASK><NEW_LINE>} else if (lbCmd.lbStatsVisibility.equals("all")) {<NEW_LINE>sb = new StringBuilder("0.0.0.0/0").append(":").append(lbCmd.lbStatsPort).append(":").append(lbCmd.lbStatsSrcCidrs).append(":,");<NEW_LINE>}<NEW_LINE>toStats.add(sb.toString());<NEW_LINE>toRemove.removeAll(toAdd);<NEW_LINE>result[ADD] = toAdd.toArray(new String[toAdd.size()]);<NEW_LINE>result[REMOVE] = toRemove.toArray(new String[toRemove.size()]);<NEW_LINE>result[STATS] = toStats.toArray(new String[toStats.size()]);<NEW_LINE>return result;<NEW_LINE>} | .lbStatsSrcCidrs).append(":,"); |
694,501 | public void testSyncBulkheadSmall() throws Exception {<NEW_LINE>// the tasks notify that they are running<NEW_LINE>CountDownLatch notify = new CountDownLatch(2);<NEW_LINE>// and then wait to be released<NEW_LINE><MASK><NEW_LINE>// connectA has a poolSize of 2<NEW_LINE>// first two should be run straight away, in parallel<NEW_LINE>Future<Boolean> future1 = runner.call(() -> {<NEW_LINE>return bean1.connectA("One", wait, notify);<NEW_LINE>});<NEW_LINE>Future<Boolean> future2 = runner.call(() -> {<NEW_LINE>return bean1.connectA("Two", wait, notify);<NEW_LINE>});<NEW_LINE>// wait for the first two to be properly started<NEW_LINE>notify.await(TestConstants.TEST_TIMEOUT, TimeUnit.MILLISECONDS);<NEW_LINE>// next two should be reject because the bulkhead is full<NEW_LINE>Future<Boolean> future3 = runner.call(() -> {<NEW_LINE>return bean1.connectA("Three", wait, notify);<NEW_LINE>});<NEW_LINE>Future<Boolean> future4 = runner.call(() -> {<NEW_LINE>return bean1.connectA("Four", wait, notify);<NEW_LINE>});<NEW_LINE>try {<NEW_LINE>future3.get(TestConstants.FUTURE_THRESHOLD, TimeUnit.MILLISECONDS);<NEW_LINE>throw new AssertionError("Exception not thrown");<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>// expected<NEW_LINE>if (!(e.getCause() instanceof BulkheadException)) {<NEW_LINE>throw new AssertionError("Cause was not a BulkheadException: " + e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>future4.get(TestConstants.FUTURE_THRESHOLD, TimeUnit.MILLISECONDS);<NEW_LINE>throw new AssertionError("Exception not thrown");<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>// expected<NEW_LINE>if (!(e.getCause() instanceof BulkheadException)) {<NEW_LINE>throw new AssertionError("Cause was not a BulkheadException: " + e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// release the first two to complete<NEW_LINE>wait.countDown();<NEW_LINE>} | CountDownLatch wait = new CountDownLatch(1); |
953,773 | public static Flowable<Object[]> read(MigrateUtil.MigrateJdbcInput migrateJdbcInput, Partition backend) {<NEW_LINE>MycatRouterConfig routerConfig = MetaClusterCurrent.wrapper(MycatRouterConfig.class);<NEW_LINE>ReplicaSelectorManager replicaSelectorRuntime = MetaClusterCurrent.wrapper(ReplicaSelectorManager.class);<NEW_LINE>String targetName = backend.getTargetName();<NEW_LINE>String tableName = backend.getTable();<NEW_LINE>String schemaName = backend.getSchema();<NEW_LINE>String datasourceName = replicaSelectorRuntime.getDatasourceNameByReplicaName(targetName, true, null);<NEW_LINE>List<DatasourceConfig<MASK><NEW_LINE>DatasourceConfig datasourceConfig = datasources.stream().filter(i -> i.getName().equals(datasourceName)).findFirst().orElseThrow((Supplier<Throwable>) () -> {<NEW_LINE>MycatException mycatException = new MycatException("can not found datasource " + datasourceName);<NEW_LINE>LOGGER.error("", mycatException);<NEW_LINE>return mycatException;<NEW_LINE>});<NEW_LINE>return read(migrateJdbcInput, tableName, schemaName, datasourceConfig.getUrl(), datasourceConfig.getUser(), datasourceConfig.getPassword());<NEW_LINE>} | > datasources = routerConfig.getDatasources(); |
1,089,582 | private static void solve() {<NEW_LINE>Solver solver = new Solver("SetCovering2");<NEW_LINE>//<NEW_LINE>// data<NEW_LINE>//<NEW_LINE>// Example 9.1-2 from<NEW_LINE>// Taha "Operations Research - An Introduction",<NEW_LINE>// page 354ff.<NEW_LINE>// Minimize the number of security telephones in street<NEW_LINE>// corners on a campus.<NEW_LINE>// maximum number of corners<NEW_LINE>int n = 8;<NEW_LINE>// number of connected streets<NEW_LINE>int num_streets = 11;<NEW_LINE>// corners of each street<NEW_LINE>// Note: 1-based (handled below)<NEW_LINE>int[][] corner = { { 1, 2 }, { 2, 3 }, { 4, 5 }, { 7, 8 }, { 6, 7 }, { 2, 6 }, { 1, 6 }, { 4, 7 }, { 2, 4 }, { 5, 8 }, { 3, 5 } };<NEW_LINE>//<NEW_LINE>// variables<NEW_LINE>//<NEW_LINE>IntVar[] x = solver.makeIntVarArray(n, 0, 1, "x");<NEW_LINE>// number of telephones, to be minimize<NEW_LINE>IntVar z = solver.makeSum(x).var();<NEW_LINE>//<NEW_LINE>// constraints<NEW_LINE>//<NEW_LINE>// ensure that all cities are covered<NEW_LINE>for (int i = 0; i < num_streets; i++) {<NEW_LINE>IntVar[] b = new IntVar[2];<NEW_LINE>b[0] = x[corner[i][0] - 1];<NEW_LINE>b[1] = x[corner[<MASK><NEW_LINE>solver.addConstraint(solver.makeSumGreaterOrEqual(b, 1));<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// objective<NEW_LINE>//<NEW_LINE>OptimizeVar objective = solver.makeMinimize(z, 1);<NEW_LINE>//<NEW_LINE>// search<NEW_LINE>//<NEW_LINE>DecisionBuilder db = solver.makePhase(x, solver.INT_VAR_DEFAULT, solver.INT_VALUE_DEFAULT);<NEW_LINE>solver.newSearch(db, objective);<NEW_LINE>//<NEW_LINE>// output<NEW_LINE>//<NEW_LINE>while (solver.nextSolution()) {<NEW_LINE>System.out.println("z: " + z.value());<NEW_LINE>System.out.print("x: ");<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>System.out.print(x[i].value() + " ");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>solver.endSearch();<NEW_LINE>// Statistics<NEW_LINE>System.out.println();<NEW_LINE>System.out.println("Solutions: " + solver.solutions());<NEW_LINE>System.out.println("Failures: " + solver.failures());<NEW_LINE>System.out.println("Branches: " + solver.branches());<NEW_LINE>System.out.println("Wall time: " + solver.wallTime() + "ms");<NEW_LINE>} | i][1] - 1]; |
1,795,766 | public static PhysicalPartition parsePhysicalPartitionString(String pPartString, String del) throws IOException {<NEW_LINE>// format is name<del>id<NEW_LINE>String[] parts = pPartString.split(del);<NEW_LINE>if (parts.length <= 1)<NEW_LINE>throw new IOException("invalid physical source name/id format in " + pPartString + ";del=" + del);<NEW_LINE>String idS = parts[parts.length - 1];<NEW_LINE>Integer id = Integer.parseInt(idS);<NEW_LINE>String name = pPartString.substring(0, pPartString.length() - <MASK><NEW_LINE>if (name.length() < 1)<NEW_LINE>throw new IOException("invalid physical source name format in " + pPartString + ";del=" + del);<NEW_LINE>if (id.intValue() < 0)<NEW_LINE>throw new IOException("invalid physical source id format in " + pPartString + ";del=" + del);<NEW_LINE>return new PhysicalPartition(id, name);<NEW_LINE>} | idS.length() - 1); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.