idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
153,662 | private static IntrospectedInfo merge(IntrospectedInfo[] proxied) {<NEW_LINE>final IntrospectedInfo ii = new IntrospectedInfo();<NEW_LINE>ChangeListener l = new ChangeListener() {<NEW_LINE><NEW_LINE>public void stateChanged(ChangeEvent ev) {<NEW_LINE>IntrospectedInfo ii2 = (IntrospectedInfo) ev.getSource();<NEW_LINE>ii2.init();<NEW_LINE>ii.clazzes.putAll(ii2.clazzes);<NEW_LINE>for (Map.Entry<String, Map<String, String>> e : ii2.namedefs.entrySet()) {<NEW_LINE>String kind = e.getKey();<NEW_LINE>Map<String, String<MASK><NEW_LINE>if (ii.namedefs.containsKey(kind)) {<NEW_LINE>ii.namedefs.get(kind).putAll(entries);<NEW_LINE>} else {<NEW_LINE>ii.namedefs.put(kind, new TreeMap<String, String>(entries));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ii.fireStateChanged();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>ii.holder = l;<NEW_LINE>for (IntrospectedInfo info : proxied) {<NEW_LINE>info.addChangeListener(WeakListeners.change(l, info));<NEW_LINE>l.stateChanged(new ChangeEvent(info));<NEW_LINE>}<NEW_LINE>return ii;<NEW_LINE>} | > entries = e.getValue(); |
1,444,787 | public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {<NEW_LINE>MethodSymbol method = ASTHelpers.getSymbol(tree);<NEW_LINE>Type currentClass = getOutermostClass(state);<NEW_LINE>if (method.isStatic() || method.isConstructor() || currentClass == null) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>// allow super.foo() calls to @ForOverride methods from overriding methods<NEW_LINE>if (isSuperCall(currentClass, tree, state)) {<NEW_LINE>MethodTree currentMethod = findDirectMethod(state.getPath());<NEW_LINE>// currentMethod might be null if we are in a field initializer<NEW_LINE>if (currentMethod != null) {<NEW_LINE>// MethodSymbol.overrides doesn't check that names match, so we need to do that first.<NEW_LINE>if (currentMethod.getName().equals(method.name)) {<NEW_LINE>MethodSymbol currentMethodSymbol = ASTHelpers.getSymbol(currentMethod);<NEW_LINE>if (currentMethodSymbol.overrides(method, (TypeSymbol) method.owner, state.getTypes(), /* checkResult= */<NEW_LINE>true)) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ImmutableList<MethodSymbol> overriddenMethods = getOverriddenMethods(state, method);<NEW_LINE>for (Symbol overriddenMethod : overriddenMethods) {<NEW_LINE>Type declaringClass = ASTHelpers.<MASK><NEW_LINE>if (!ASTHelpers.isSameType(declaringClass, currentClass, state)) {<NEW_LINE>String customMessage = MESSAGE_BASE + "must not be invoked directly " + "(except by the declaring class, " + declaringClass + ")";<NEW_LINE>return buildDescription(tree).setMessage(customMessage).build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>} | outermostClass(overriddenMethod).asType(); |
1,808,722 | public void onError(Channel channel, Throwable error) {<NEW_LINE>if (error instanceof OutOfMemoryError) {<NEW_LINE>OutOfMemoryErrorDispatcher<MASK><NEW_LINE>}<NEW_LINE>if (channel == null) {<NEW_LINE>// todo: question is if logging is the best solution. If an exception happened without a channel, it is a pretty<NEW_LINE>// big event and perhaps we should shutdown the whole HZ instance.<NEW_LINE>logger.severe(error);<NEW_LINE>} else {<NEW_LINE>TcpServerConnection connection = (TcpServerConnection) channel.attributeMap().get(ServerConnection.class);<NEW_LINE>if (connection != null) {<NEW_LINE>String closeReason = (error instanceof EOFException) ? "Connection closed by the other side" : "Exception in " + connection + ", thread=" + Thread.currentThread().getName();<NEW_LINE>connection.close(closeReason, error);<NEW_LINE>} else {<NEW_LINE>logger.warning("Channel error occurred", error);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .onOutOfMemory((OutOfMemoryError) error); |
879,197 | private void addMethodArguments(ICodeWriter code, List<RegisterArg> args) {<NEW_LINE>AnnotationMethodParamsAttr paramsAnnotation = mth.get(JadxAttrType.ANNOTATION_MTH_PARAMETERS);<NEW_LINE>int i = 0;<NEW_LINE>Iterator<RegisterArg> it = args.iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>RegisterArg mthArg = it.next();<NEW_LINE>SSAVar ssaVar = mthArg.getSVar();<NEW_LINE>CodeVar var;<NEW_LINE>if (ssaVar == null) {<NEW_LINE>// abstract or interface methods<NEW_LINE>var = CodeVar.fromMthArg(mthArg, classGen.isFallbackMode());<NEW_LINE>} else {<NEW_LINE>var = ssaVar.getCodeVar();<NEW_LINE>}<NEW_LINE>// add argument annotation<NEW_LINE>if (paramsAnnotation != null) {<NEW_LINE>annotationGen.addForParameter(code, paramsAnnotation, i);<NEW_LINE>}<NEW_LINE>if (var.isFinal()) {<NEW_LINE>code.add("final ");<NEW_LINE>}<NEW_LINE>ArgType argType;<NEW_LINE>ArgType varType = var.getType();<NEW_LINE>if (varType == null || varType == ArgType.UNKNOWN) {<NEW_LINE>// occur on decompilation errors<NEW_LINE>argType = mthArg.getInitType();<NEW_LINE>} else {<NEW_LINE>argType = varType;<NEW_LINE>}<NEW_LINE>if (!it.hasNext() && mth.getAccessFlags().isVarArgs()) {<NEW_LINE>// change last array argument to varargs<NEW_LINE>if (argType.isArray()) {<NEW_LINE>ArgType elType = argType.getArrayElement();<NEW_LINE><MASK><NEW_LINE>code.add("...");<NEW_LINE>} else {<NEW_LINE>mth.addWarnComment("Last argument in varargs method is not array: " + var);<NEW_LINE>classGen.useType(code, argType);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>classGen.useType(code, argType);<NEW_LINE>}<NEW_LINE>code.add(' ');<NEW_LINE>String varName = nameGen.assignArg(var);<NEW_LINE>if (code.isMetadataSupported() && ssaVar != null) /* for fallback mode */<NEW_LINE>{<NEW_LINE>code.attachDefinition(VarDeclareRef.get(mth, var));<NEW_LINE>}<NEW_LINE>code.add(varName);<NEW_LINE>i++;<NEW_LINE>if (it.hasNext()) {<NEW_LINE>code.add(", ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | classGen.useType(code, elType); |
141,140 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (expressRouteGatewayName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter expressRouteGatewayName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (connectionName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter connectionName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2021-05-01";<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.delete(this.client.getEndpoint(), resourceGroupName, expressRouteGatewayName, connectionName, apiVersion, this.client.<MASK><NEW_LINE>} | getSubscriptionId(), accept, context); |
1,527,430 | Collection<InferenceVariable> inputVariables(final InferenceContext18 context) {<NEW_LINE>// from 18.5.2.<NEW_LINE>if (this.left instanceof LambdaExpression) {<NEW_LINE>if (this.right instanceof InferenceVariable) {<NEW_LINE>return Collections.singletonList((InferenceVariable) this.right);<NEW_LINE>}<NEW_LINE>if (this.right.isFunctionalInterface(context.scope)) {<NEW_LINE>LambdaExpression lambda = (LambdaExpression) this.left;<NEW_LINE>ReferenceBinding targetType = (ReferenceBinding) this.right;<NEW_LINE>ParameterizedTypeBinding <MASK><NEW_LINE>if (withWildCards != null) {<NEW_LINE>targetType = ConstraintExpressionFormula.findGroundTargetType(context, lambda.enclosingScope, lambda, withWildCards);<NEW_LINE>}<NEW_LINE>if (targetType == null) {<NEW_LINE>return EMPTY_VARIABLE_LIST;<NEW_LINE>}<NEW_LINE>MethodBinding sam = targetType.getSingleAbstractMethod(context.scope, true);<NEW_LINE>final Set<InferenceVariable> variables = new HashSet<>();<NEW_LINE>if (lambda.argumentsTypeElided()) {<NEW_LINE>// i)<NEW_LINE>int len = sam.parameters.length;<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>sam.parameters[i].collectInferenceVariables(variables);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (sam.returnType != TypeBinding.VOID) {<NEW_LINE>// ii)<NEW_LINE>final TypeBinding r = sam.returnType;<NEW_LINE>LambdaExpression resolved = lambda.resolveExpressionExpecting(this.right, context.scope, context);<NEW_LINE>Expression[] resultExpressions = resolved != null ? resolved.resultExpressions() : null;<NEW_LINE>for (int i = 0, length = resultExpressions == null ? 0 : resultExpressions.length; i < length; i++) {<NEW_LINE>variables.addAll(new ConstraintExpressionFormula(resultExpressions[i], r, COMPATIBLE).inputVariables(context));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return variables;<NEW_LINE>}<NEW_LINE>} else if (this.left instanceof ReferenceExpression) {<NEW_LINE>if (this.right instanceof InferenceVariable) {<NEW_LINE>return Collections.singletonList((InferenceVariable) this.right);<NEW_LINE>}<NEW_LINE>if (this.right.isFunctionalInterface(context.scope) && !this.left.isExactMethodReference()) {<NEW_LINE>MethodBinding sam = this.right.getSingleAbstractMethod(context.scope, true);<NEW_LINE>final Set<InferenceVariable> variables = new HashSet<>();<NEW_LINE>int len = sam.parameters.length;<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>sam.parameters[i].collectInferenceVariables(variables);<NEW_LINE>}<NEW_LINE>return variables;<NEW_LINE>}<NEW_LINE>} else if (this.left instanceof ConditionalExpression && this.left.isPolyExpression()) {<NEW_LINE>ConditionalExpression expr = (ConditionalExpression) this.left;<NEW_LINE>Set<InferenceVariable> variables = new HashSet<>();<NEW_LINE>variables.addAll(new ConstraintExpressionFormula(expr.valueIfTrue, this.right, COMPATIBLE).inputVariables(context));<NEW_LINE>variables.addAll(new ConstraintExpressionFormula(expr.valueIfFalse, this.right, COMPATIBLE).inputVariables(context));<NEW_LINE>return variables;<NEW_LINE>}<NEW_LINE>return EMPTY_VARIABLE_LIST;<NEW_LINE>} | withWildCards = InferenceContext18.parameterizedWithWildcard(targetType); |
1,808,761 | /*<NEW_LINE>* @see org.apache.kafka.streams.processor.Processor#process(java.lang.Object,<NEW_LINE>* java.lang.Object)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void process(UUID key, GProcessedEventPayload event) {<NEW_LINE>try {<NEW_LINE>// Convert payload to API object.<NEW_LINE>ProcessedEventPayload payload = EventModelConverter.asApiProcessedEventPayload(event);<NEW_LINE>// Pass decoded payload to processing strategy implementation.<NEW_LINE>ICommandProcessingStrategy strategy = ((ICommandDeliveryTenantEngine) getTenantEngine()).getCommandProcessingStrategy();<NEW_LINE>IDeviceCommandInvocation invocation = <MASK><NEW_LINE>strategy.deliverCommand(payload.getEventContext(), invocation);<NEW_LINE>}// TODO: Push errors to well-known topics.<NEW_LINE>catch (SiteWhereException e) {<NEW_LINE>getLogger().error("Unable to process inbound event payload.", e);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>getLogger().error("Unhandled exception processing inbound event payload.", e);<NEW_LINE>}<NEW_LINE>} | (IDeviceCommandInvocation) payload.getEvent(); |
142,822 | static void loadCsv(String projectId, String instanceId, String databaseId, String tableName, String filePath, String[] optFlags) throws Exception {<NEW_LINE>SpannerOptions options = SpannerOptions.newBuilder().build();<NEW_LINE>Spanner spanner = options.getService();<NEW_LINE>// Initialize option flags<NEW_LINE>Options opt = new Options();<NEW_LINE>opt.addOption("h", true, "File Contains Header");<NEW_LINE>opt.addOption("f", true, "Format Type of Input File " + "(EXCEL, POSTGRESQL_CSV, POSTGRESQL_TEXT, DEFAULT)");<NEW_LINE>opt.addOption("n", true, "String Representing Null Value");<NEW_LINE>opt.addOption("d", true, "Character Separating Columns");<NEW_LINE>opt.<MASK><NEW_LINE>CommandLineParser clParser = new DefaultParser();<NEW_LINE>CommandLine cmd = clParser.parse(opt, optFlags);<NEW_LINE>try {<NEW_LINE>// Initialize connection to Cloud Spanner<NEW_LINE>connection = DriverManager.getConnection(String.format("jdbc:cloudspanner:/projects/%s/instances/%s/databases/%s", projectId, instanceId, databaseId));<NEW_LINE>parseTableColumns(tableName);<NEW_LINE>try (Reader in = new FileReader(filePath);<NEW_LINE>CSVParser parser = CSVParser.parse(in, setFormat(cmd))) {<NEW_LINE>// If file has header, verify that header fields are valid<NEW_LINE>if (hasHeader && !isValidHeader(parser)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Write CSV record data to Cloud Spanner<NEW_LINE>writeToSpanner(parser, tableName);<NEW_LINE>} catch (SQLException e) {<NEW_LINE>System.out.println(e.getMessage());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>spanner.close();<NEW_LINE>connection.close();<NEW_LINE>}<NEW_LINE>} | addOption("e", true, "Character To Escape"); |
1,834,656 | public boolean apply(Game game, Ability source) {<NEW_LINE>List<UUID> perms = new ArrayList<>();<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller != null) {<NEW_LINE>for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null && !playerId.equals(source.getControllerId())) {<NEW_LINE>TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();<NEW_LINE>target.setNotTarget(true);<NEW_LINE>if (target.canChoose(player.getId(), source, game)) {<NEW_LINE>player.chooseTarget(Outcome.Sacrifice, target, source, game);<NEW_LINE>perms.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (UUID permID : perms) {<NEW_LINE>Permanent permanent = game.getPermanent(permID);<NEW_LINE>if (permanent != null) {<NEW_LINE>permanent.sacrifice(source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | addAll(target.getTargets()); |
673,945 | public void paintInstance(InstancePainter painter) {<NEW_LINE>Graphics2D g = <MASK><NEW_LINE>Bounds bds = painter.getInstance().getBounds();<NEW_LINE>int x = bds.getX();<NEW_LINE>int y = bds.getY();<NEW_LINE>painter.drawLabel();<NEW_LINE>g.setColor(Color.BLACK);<NEW_LINE>boolean drawUp;<NEW_LINE>if (painter.getShowState()) {<NEW_LINE>ProgrammableGeneratorState state = getState(painter);<NEW_LINE>painter.drawRoundBounds(state.sending.getColor());<NEW_LINE>drawUp = state.sending == Value.TRUE;<NEW_LINE>} else {<NEW_LINE>painter.drawBounds();<NEW_LINE>drawUp = true;<NEW_LINE>}<NEW_LINE>g.setColor(Color.WHITE);<NEW_LINE>x += 10;<NEW_LINE>y += 10;<NEW_LINE>int[] xs = { x + 1, x + 1, x + 4, x + 4, x + 7, x + 7 };<NEW_LINE>int[] ys;<NEW_LINE>if (drawUp) {<NEW_LINE>ys = new int[] { y + 5, y + 3, y + 3, y + 7, y + 7, y + 5 };<NEW_LINE>} else {<NEW_LINE>ys = new int[] { y + 5, y + 7, y + 7, y + 3, y + 3, y + 5 };<NEW_LINE>}<NEW_LINE>g.drawPolyline(xs, ys, xs.length);<NEW_LINE>GraphicsUtil.switchToWidth(g, 2);<NEW_LINE>xs = new int[] { x - 5, x - 5, x + 1, x + 1, x - 4 };<NEW_LINE>ys = new int[] { y + 5, y - 5, y - 5, y, y };<NEW_LINE>g.drawPolyline(xs, ys, xs.length);<NEW_LINE>painter.drawPorts();<NEW_LINE>} | (Graphics2D) painter.getGraphics(); |
414,697 | private void addFloat(int index, float element) {<NEW_LINE>ensureIsMutable();<NEW_LINE>if (index < 0 || index > size) {<NEW_LINE>throw new IndexOutOfBoundsException(makeOutOfBoundsExceptionMessage(index));<NEW_LINE>}<NEW_LINE>if (size < array.length) {<NEW_LINE>// Shift everything over to make room<NEW_LINE>System.arraycopy(array, index, array, <MASK><NEW_LINE>} else {<NEW_LINE>// Resize to 1.5x the size<NEW_LINE>int length = ((size * 3) / 2) + 1;<NEW_LINE>float[] newArray = new float[length];<NEW_LINE>// Copy the first part directly<NEW_LINE>System.arraycopy(array, 0, newArray, 0, index);<NEW_LINE>// Copy the rest shifted over by one to make room<NEW_LINE>System.arraycopy(array, index, newArray, index + 1, size - index);<NEW_LINE>array = newArray;<NEW_LINE>}<NEW_LINE>array[index] = element;<NEW_LINE>size++;<NEW_LINE>modCount++;<NEW_LINE>} | index + 1, size - index); |
236,194 | public static APICreateDataVolumeTemplateFromVolumeEvent __example__() {<NEW_LINE>APICreateDataVolumeTemplateFromVolumeEvent event = new APICreateDataVolumeTemplateFromVolumeEvent();<NEW_LINE>ImageInventory inv = new ImageInventory();<NEW_LINE>inv.setUuid(uuid());<NEW_LINE>ImageBackupStorageRefInventory ref = new ImageBackupStorageRefInventory();<NEW_LINE>ref.setBackupStorageUuid(uuid());<NEW_LINE>ref.setImageUuid(inv.getUuid());<NEW_LINE>ref.setInstallPath("ceph://zs-data-volume/0cd599ec519249489475112a058bb93a");<NEW_LINE>ref.setStatus(ImageStatus.Ready.toString());<NEW_LINE>inv.setName("My Data Volume Template");<NEW_LINE>inv.setBackupStorageRefs<MASK><NEW_LINE>inv.setFormat(ImageConstant.RAW_FORMAT_STRING);<NEW_LINE>inv.setMediaType(ImageConstant.ImageMediaType.DataVolumeTemplate.toString());<NEW_LINE>inv.setPlatform(ImagePlatform.Linux.toString());<NEW_LINE>event.setInventory(inv);<NEW_LINE>return event;<NEW_LINE>} | (Collections.singletonList(ref)); |
1,515,336 | private void init(Hashtable toCopy) {<NEW_LINE>super.copy(toCopy);<NEW_LINE>Hashtable f = (Hashtable) toCopy.get("from");<NEW_LINE>if (f != null) {<NEW_LINE>from.copy(f);<NEW_LINE>}<NEW_LINE>iconUrl = (<MASK><NEW_LINE>pictureUrl = (String) toCopy.get("picture");<NEW_LINE>sourceUrl = (String) toCopy.get("source");<NEW_LINE>String heightStr = (String) toCopy.get("height");<NEW_LINE>if (heightStr != null) {<NEW_LINE>height = Integer.parseInt(heightStr);<NEW_LINE>}<NEW_LINE>String widthStr = (String) toCopy.get("width");<NEW_LINE>if (widthStr != null) {<NEW_LINE>width = Integer.parseInt(widthStr);<NEW_LINE>}<NEW_LINE>link = (String) toCopy.get("link");<NEW_LINE>created_time = (String) toCopy.get("created_time");<NEW_LINE>updated_time = (String) toCopy.get("updated_time");<NEW_LINE>String positionStr = (String) toCopy.get("position");<NEW_LINE>if (positionStr != null) {<NEW_LINE>position = Integer.parseInt(positionStr);<NEW_LINE>}<NEW_LINE>images = (Vector) toCopy.get("images");<NEW_LINE>Hashtable data = (Hashtable) toCopy.get("comments");<NEW_LINE>if (data != null) {<NEW_LINE>comments = new Vector();<NEW_LINE>Vector commentsArray = (Vector) data.get("data");<NEW_LINE>for (int i = 0; i < commentsArray.size(); i++) {<NEW_LINE>Hashtable comment = (Hashtable) commentsArray.elementAt(i);<NEW_LINE>Post p = new Post();<NEW_LINE>p.copy(comment);<NEW_LINE>comments.addElement(p);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String) toCopy.get("icon"); |
1,307,457 | void doAudit(InstanceConfigAuditModel auditModel) {<NEW_LINE>String instanceCacheKey = assembleInstanceKey(auditModel.getAppId(), auditModel.getClusterName(), auditModel.getIp(), auditModel.getDataCenter());<NEW_LINE>Long instanceId = instanceCache.getIfPresent(instanceCacheKey);<NEW_LINE>if (instanceId == null) {<NEW_LINE>instanceId = prepareInstanceId(auditModel);<NEW_LINE>instanceCache.put(instanceCacheKey, instanceId);<NEW_LINE>}<NEW_LINE>// load instance config release key from cache, and check if release key is the same<NEW_LINE>String instanceConfigCacheKey = assembleInstanceConfigKey(instanceId, auditModel.getConfigAppId(), auditModel.getConfigNamespace());<NEW_LINE>String cacheReleaseKey = instanceConfigReleaseKeyCache.getIfPresent(instanceConfigCacheKey);<NEW_LINE>// if release key is the same, then skip audit<NEW_LINE>if (cacheReleaseKey != null && Objects.equals(cacheReleaseKey, auditModel.getReleaseKey())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>instanceConfigReleaseKeyCache.put(instanceConfigCacheKey, auditModel.getReleaseKey());<NEW_LINE>// if release key is not the same or cannot find in cache, then do audit<NEW_LINE>InstanceConfig instanceConfig = instanceService.findInstanceConfig(instanceId, auditModel.getConfigAppId(), auditModel.getConfigNamespace());<NEW_LINE>if (instanceConfig != null) {<NEW_LINE>if (!Objects.equals(instanceConfig.getReleaseKey(), auditModel.getReleaseKey())) {<NEW_LINE>instanceConfig.setConfigClusterName(auditModel.getConfigClusterName());<NEW_LINE>instanceConfig.setReleaseKey(auditModel.getReleaseKey());<NEW_LINE>instanceConfig.setReleaseDeliveryTime(auditModel.getOfferTime());<NEW_LINE>} else if (offerTimeAndLastModifiedTimeCloseEnough(auditModel.getOfferTime(), instanceConfig.getDataChangeLastModifiedTime())) {<NEW_LINE>// when releaseKey is the same, optimize to reduce writes if the record was updated not long ago<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// we need to update no matter the release key is the same or not, to ensure the<NEW_LINE>// last modified time is updated each day<NEW_LINE>instanceConfig.setDataChangeLastModifiedTime(auditModel.getOfferTime());<NEW_LINE>instanceService.updateInstanceConfig(instanceConfig);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>instanceConfig = new InstanceConfig();<NEW_LINE>instanceConfig.setInstanceId(instanceId);<NEW_LINE>instanceConfig.setConfigAppId(auditModel.getConfigAppId());<NEW_LINE>instanceConfig.<MASK><NEW_LINE>instanceConfig.setConfigNamespaceName(auditModel.getConfigNamespace());<NEW_LINE>instanceConfig.setReleaseKey(auditModel.getReleaseKey());<NEW_LINE>instanceConfig.setReleaseDeliveryTime(auditModel.getOfferTime());<NEW_LINE>instanceConfig.setDataChangeCreatedTime(auditModel.getOfferTime());<NEW_LINE>try {<NEW_LINE>instanceService.createInstanceConfig(instanceConfig);<NEW_LINE>} catch (DataIntegrityViolationException ex) {<NEW_LINE>// concurrent insertion, safe to ignore<NEW_LINE>}<NEW_LINE>} | setConfigClusterName(auditModel.getConfigClusterName()); |
1,208,900 | private static TableScanNode createEnumerable(Compiler compiler, TableScan rel, Enumerable<Row> enumerable, final ImmutableIntList acceptedProjects, List<RexNode> rejectedFilters, final ImmutableIntList rejectedProjects) {<NEW_LINE>if (!rejectedFilters.isEmpty()) {<NEW_LINE>final RexNode filter = RexUtil.composeConjunction(rel.getCluster().getRexBuilder(), rejectedFilters);<NEW_LINE>// Re-map filter for the projects that have been applied already<NEW_LINE>final RexNode filter2;<NEW_LINE>final RelDataType inputRowType;<NEW_LINE>if (acceptedProjects == null) {<NEW_LINE>filter2 = filter;<NEW_LINE>inputRowType = rel.getRowType();<NEW_LINE>} else {<NEW_LINE>final Mapping mapping = Mappings.target(acceptedProjects, rel.getTable().getRowType().getFieldCount());<NEW_LINE>filter2 = RexUtil.apply(mapping, filter);<NEW_LINE>final RelDataTypeFactory.Builder builder = rel.getCluster().getTypeFactory().builder();<NEW_LINE>final List<RelDataTypeField> fieldList = rel.getTable()<MASK><NEW_LINE>for (int acceptedProject : acceptedProjects) {<NEW_LINE>builder.add(fieldList.get(acceptedProject));<NEW_LINE>}<NEW_LINE>inputRowType = builder.build();<NEW_LINE>}<NEW_LINE>final Scalar condition = compiler.compile(ImmutableList.of(filter2), inputRowType);<NEW_LINE>final Context context = compiler.createContext();<NEW_LINE>enumerable = enumerable.where(row -> {<NEW_LINE>context.values = row.getValues();<NEW_LINE>Boolean b = (Boolean) condition.execute(context);<NEW_LINE>return b != null && b;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>if (rejectedProjects != null) {<NEW_LINE>enumerable = enumerable.select(new Function1<Row, Row>() {<NEW_LINE><NEW_LINE>final Object[] values = new Object[rejectedProjects.size()];<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Row apply(Row row) {<NEW_LINE>final Object[] inValues = row.getValues();<NEW_LINE>for (int i = 0; i < rejectedProjects.size(); i++) {<NEW_LINE>values[i] = inValues[rejectedProjects.get(i)];<NEW_LINE>}<NEW_LINE>return Row.asCopy(values);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>return new TableScanNode(compiler, rel, enumerable);<NEW_LINE>} | .getRowType().getFieldList(); |
984,141 | protected Action[] createNewTabActions() {<NEW_LINE>if (tabContext.rerun == null) {<NEW_LINE>tabContext.rerun = new ReRunAction(false);<NEW_LINE>tabContext.rerunDebug = new ReRunAction(true);<NEW_LINE>tabContext.resume = new ResumeAction();<NEW_LINE>tabContext.stop = new StopAction();<NEW_LINE>tabContext.options = new OptionsAction();<NEW_LINE>tabContext.overview = new ShowOverviewAction();<NEW_LINE>}<NEW_LINE>tabContext.rerun.setConfig(config);<NEW_LINE>tabContext.rerunDebug.setConfig(config);<NEW_LINE><MASK><NEW_LINE>tabContext.overview.setExecutor((MavenCommandLineExecutor) this);<NEW_LINE>tabContext.stop.setExecutor(this);<NEW_LINE>return new Action[] { tabContext.rerun, tabContext.rerunDebug, tabContext.resume, tabContext.overview, tabContext.stop, tabContext.options };<NEW_LINE>} | tabContext.resume.setConfig(config); |
486,301 | public static QueryDeviceResponse unmarshall(QueryDeviceResponse queryDeviceResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryDeviceResponse.setRequestId(_ctx.stringValue("QueryDeviceResponse.RequestId"));<NEW_LINE>queryDeviceResponse.setSuccess(_ctx.booleanValue("QueryDeviceResponse.Success"));<NEW_LINE>queryDeviceResponse.setCode(_ctx.stringValue("QueryDeviceResponse.Code"));<NEW_LINE>queryDeviceResponse.setErrorMessage(_ctx.stringValue("QueryDeviceResponse.ErrorMessage"));<NEW_LINE>queryDeviceResponse.setTotal(_ctx.integerValue("QueryDeviceResponse.Total"));<NEW_LINE>queryDeviceResponse.setPageSize(_ctx.integerValue("QueryDeviceResponse.PageSize"));<NEW_LINE>queryDeviceResponse.setPageCount(_ctx.integerValue("QueryDeviceResponse.PageCount"));<NEW_LINE>queryDeviceResponse.setPage(_ctx.integerValue("QueryDeviceResponse.Page"));<NEW_LINE>queryDeviceResponse.setNextToken(_ctx.stringValue("QueryDeviceResponse.NextToken"));<NEW_LINE>List<DeviceInfo> data = new ArrayList<DeviceInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryDeviceResponse.Data.Length"); i++) {<NEW_LINE>DeviceInfo deviceInfo = new DeviceInfo();<NEW_LINE>deviceInfo.setDeviceId(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceId"));<NEW_LINE>deviceInfo.setDeviceSecret(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceSecret"));<NEW_LINE>deviceInfo.setProductKey(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].ProductKey"));<NEW_LINE>deviceInfo.setDeviceStatus(_ctx.stringValue<MASK><NEW_LINE>deviceInfo.setDeviceName(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceName"));<NEW_LINE>deviceInfo.setDeviceType(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceType"));<NEW_LINE>deviceInfo.setGmtCreate(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].GmtCreate"));<NEW_LINE>deviceInfo.setGmtModified(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].GmtModified"));<NEW_LINE>deviceInfo.setUtcCreate(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].UtcCreate"));<NEW_LINE>deviceInfo.setUtcModified(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].UtcModified"));<NEW_LINE>deviceInfo.setIotId(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].IotId"));<NEW_LINE>deviceInfo.setNickname(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].Nickname"));<NEW_LINE>data.add(deviceInfo);<NEW_LINE>}<NEW_LINE>queryDeviceResponse.setData(data);<NEW_LINE>return queryDeviceResponse;<NEW_LINE>} | ("QueryDeviceResponse.Data[" + i + "].DeviceStatus")); |
1,773,349 | protected void createBundle(final String contextPath, final String actionPath, final String bundleId, final List<String> sources) throws IOException {<NEW_LINE>final File bundleFile = createBundleFile(bundleId);<NEW_LINE>if (bundleFile.exists()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final StringBand sb = new StringBand(sources.size() * 2);<NEW_LINE>for (String src : sources) {<NEW_LINE>if (sb.length() != 0) {<NEW_LINE>sb.append(StringPool.NEWLINE);<NEW_LINE>}<NEW_LINE>String content;<NEW_LINE>if (isExternalResource(src)) {<NEW_LINE>content = downloadString(src);<NEW_LINE>} else {<NEW_LINE>if (!downloadLocal) {<NEW_LINE>// load local resource from file system<NEW_LINE>String localFile = webRoot;<NEW_LINE>if (src.startsWith(contextPath + '/')) {<NEW_LINE>src = src.substring(contextPath.length());<NEW_LINE>}<NEW_LINE>if (src.startsWith(StringPool.SLASH)) {<NEW_LINE>// absolute path<NEW_LINE>localFile += src;<NEW_LINE>} else {<NEW_LINE>// relative path<NEW_LINE>localFile += '/' + FileNameUtil.getPathNoEndSeparator(actionPath) + '/' + src;<NEW_LINE>}<NEW_LINE>// trim link parameters, if any<NEW_LINE>final int qmndx = localFile.indexOf('?');<NEW_LINE>if (qmndx != -1) {<NEW_LINE>localFile = localFile.substring(0, qmndx);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>content = FileUtil.readString(localFile);<NEW_LINE>} catch (final IOException ioex) {<NEW_LINE>if (notFoundExceptionEnabled) {<NEW_LINE>throw ioex;<NEW_LINE>}<NEW_LINE>if (log.isWarnEnabled()) {<NEW_LINE>log.warn(ioex.getMessage());<NEW_LINE>}<NEW_LINE>content = null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// download local resource<NEW_LINE>String localUrl = localAddressAndPort;<NEW_LINE>if (src.startsWith(StringPool.SLASH)) {<NEW_LINE>localUrl += contextPath + src;<NEW_LINE>} else {<NEW_LINE>localUrl += contextPath + FileNameUtil.getPath(actionPath) + '/' + src;<NEW_LINE>}<NEW_LINE>content = downloadString(localUrl);<NEW_LINE>}<NEW_LINE>if (content != null) {<NEW_LINE>if (isCssResource(src)) {<NEW_LINE>content = fixCssRelativeUrls(content, src);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (content != null) {<NEW_LINE>content = onResourceContent(content);<NEW_LINE>sb.append(content);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>FileUtil.writeString(bundleFile, sb.toString());<NEW_LINE>if (log.isInfoEnabled()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | log.info("Bundle created: " + bundleId); |
1,309,300 | protected Object createFieldReference(Object receiver) throws InvalidInputException {<NEW_LINE>try {<NEW_LINE>// Get receiver type<NEW_LINE>TypeReference typeRef = null;<NEW_LINE>boolean useReceiver = false;<NEW_LINE>if (receiver instanceof JavadocModuleReference) {<NEW_LINE>JavadocModuleReference jRef = (JavadocModuleReference) receiver;<NEW_LINE>if (jRef.typeReference != null) {<NEW_LINE>typeRef = jRef.typeReference;<NEW_LINE>useReceiver = true;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>typeRef = (TypeReference) receiver;<NEW_LINE>}<NEW_LINE>if (typeRef == null) {<NEW_LINE>char[] name = this.sourceParser.compilationUnit.getMainTypeName();<NEW_LINE>typeRef = new JavadocImplicitTypeReference(name, this.memberStart);<NEW_LINE>}<NEW_LINE>// Create field<NEW_LINE>JavadocFieldReference field = new JavadocFieldReference(this.identifierStack[0]<MASK><NEW_LINE>field.receiver = useReceiver ? (Expression) receiver : typeRef;<NEW_LINE>field.tagSourceStart = this.tagSourceStart;<NEW_LINE>field.tagSourceEnd = this.tagSourceEnd;<NEW_LINE>field.tagValue = this.tagValue;<NEW_LINE>return field;<NEW_LINE>} catch (ClassCastException ex) {<NEW_LINE>throw new InvalidInputException();<NEW_LINE>}<NEW_LINE>} | , this.identifierPositionStack[0]); |
1,521,668 | private Mono<PagedResponse<PasswordCredentialInner>> listPasswordCredentialsSinglePageAsync(String objectId, String tenantId, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (objectId == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter objectId is required and cannot be null."));<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>final String accept = "application/json, text/json";<NEW_LINE>context = <MASK><NEW_LINE>return service.listPasswordCredentials(this.client.getEndpoint(), objectId, this.client.getApiVersion(), tenantId, accept, context).map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null));<NEW_LINE>} | this.client.mergeContext(context); |
1,097,371 | public void actionPerformed(ActionEvent e) {<NEW_LINE>String str = e.getActionCommand();<NEW_LINE>if (str.equals("pack")) {<NEW_LINE>packDbg();<NEW_LINE>} else {<NEW_LINE>// Open: "showzip" - zipped file folder<NEW_LINE>// not "showzip" - one of the listed files<NEW_LINE>File file = str.equals("showzip") ? new File(zippedLogFile).getParentFile() : new File(str);<NEW_LINE>if (file.exists()) {<NEW_LINE>try {<NEW_LINE>java.awt.Desktop.getDesktop().open(file);<NEW_LINE>} catch (IOException e2) {<NEW_LINE>LOGGER.warn("Failed to open default desktop application: {}", e2);<NEW_LINE>if (Platform.isWindows()) {<NEW_LINE>JOptionPane.showMessageDialog(null, Messages.getString("DbgPacker.5") + e2, Messages.getString("TracesTab.6"), JOptionPane.ERROR_MESSAGE);<NEW_LINE>} else {<NEW_LINE>JOptionPane.showMessageDialog(null, Messages.getString("DbgPacker.6") + e2, Messages.getString<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>JOptionPane.showMessageDialog(null, String.format(Messages.getString("DbgPacker.7"), file.getAbsolutePath()), null, JOptionPane.INFORMATION_MESSAGE);<NEW_LINE>reload((JComponent) e.getSource());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ("TracesTab.6"), JOptionPane.ERROR_MESSAGE); |
1,177,171 | public ListEntityRecognizersResult listEntityRecognizers(ListEntityRecognizersRequest listEntityRecognizersRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listEntityRecognizersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListEntityRecognizersRequest> request = null;<NEW_LINE>Response<ListEntityRecognizersResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListEntityRecognizersRequestMarshaller().marshall(listEntityRecognizersRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<ListEntityRecognizersResult, <MASK><NEW_LINE>JsonResponseHandler<ListEntityRecognizersResult> responseHandler = new JsonResponseHandler<ListEntityRecognizersResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | JsonUnmarshallerContext> unmarshaller = new ListEntityRecognizersResultJsonUnmarshaller(); |
1,499,786 | public String sendMessage(TUIMessageBean messageInfo, boolean isGroup, String id, OfflinePushInfo offlinePushInfo, IUIKitCallback<TUIMessageBean> callBack) {<NEW_LINE>V2TIMMessage forwardMessage = messageInfo.getV2TIMMessage();<NEW_LINE>forwardMessage.setExcludedFromUnreadCount(TUIChatConfigs.getConfigs().<MASK><NEW_LINE>forwardMessage.setExcludedFromLastMessage(TUIChatConfigs.getConfigs().getGeneralConfig().isExcludedFromLastMessage());<NEW_LINE>V2TIMOfflinePushInfo v2TIMOfflinePushInfo = OfflinePushInfoUtils.convertOfflinePushInfoToV2PushInfo(offlinePushInfo);<NEW_LINE>String msgId = V2TIMManager.getMessageManager().sendMessage(forwardMessage, isGroup ? null : id, isGroup ? id : null, V2TIMMessage.V2TIM_PRIORITY_DEFAULT, false, v2TIMOfflinePushInfo, new V2TIMSendCallback<V2TIMMessage>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onProgress(int progress) {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(int code, String desc) {<NEW_LINE>TUIChatUtils.callbackOnError(callBack, TAG, code, desc);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(V2TIMMessage v2TIMMessage) {<NEW_LINE>TUIMessageBean data = ChatMessageParser.parseMessage(v2TIMMessage);<NEW_LINE>TUIChatUtils.callbackOnSuccess(callBack, data);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return msgId;<NEW_LINE>} | getGeneralConfig().isExcludedFromUnreadCount()); |
543,742 | public void run() {<NEW_LINE>try {<NEW_LINE>if (zipFilename != null) {<NEW_LINE>parser = ParserGrammar.loadModelFromZip(zipFilename, filename);<NEW_LINE>} else {<NEW_LINE>parser = ParserGrammar.loadModel(filename);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>JOptionPane.showMessageDialog(ParserPanel.this, "Error loading parser: " + filename, null, JOptionPane.ERROR_MESSAGE);<NEW_LINE>setStatus("Error loading parser");<NEW_LINE>parser = null;<NEW_LINE>} catch (OutOfMemoryError e) {<NEW_LINE>JOptionPane.showMessageDialog(ParserPanel.this, "Could not load parser. Out of memory.", null, JOptionPane.ERROR_MESSAGE);<NEW_LINE>setStatus("Error loading parser");<NEW_LINE>parser = null;<NEW_LINE>}<NEW_LINE>stopProgressMonitor();<NEW_LINE>if (parser != null) {<NEW_LINE>setStatus("Loaded parser.");<NEW_LINE><MASK><NEW_LINE>parseButton.setEnabled(true);<NEW_LINE>parseNextButton.setEnabled(true);<NEW_LINE>saveOutputButton.setEnabled(true);<NEW_LINE>tlp = parser.getOp().langpack();<NEW_LINE>encoding = tlp.getEncoding();<NEW_LINE>}<NEW_LINE>} | parserFileLabel.setText("Parser: " + filename); |
1,764,286 | protected void readDiversifications() {<NEW_LINE>if (suspendDivs()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>storage_mon.enter();<NEW_LINE>Map map = readMapFromFile("diverse");<NEW_LINE>List keys = (List) map.get("local");<NEW_LINE>if (keys != null) {<NEW_LINE>long now = SystemTime.getCurrentTime();<NEW_LINE>for (int i = 0; i < keys.size(); i++) {<NEW_LINE>storageKey d = storageKey.deserialise(this, (Map) keys.get(i));<NEW_LINE>long time_left = d.getExpiry() - now;<NEW_LINE>if (time_left > 0) {<NEW_LINE>local_storage_keys.put(d.getKey(), d);<NEW_LINE>} else {<NEW_LINE>log.log("SM: serialised sk: " + DHTLog.getString2(d.getKey().getBytes()) + " expired");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List divs = (List) map.get("remote");<NEW_LINE>if (divs != null) {<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < divs.size(); i++) {<NEW_LINE>diversification d = diversification.deserialise(this, (Map) divs.get(i));<NEW_LINE>long time_left = d.getExpiry() - now;<NEW_LINE>if (time_left > 0) {<NEW_LINE>diversification existing = (diversification) remote_diversifications.put(d.getKey(), d);<NEW_LINE>if (existing != null) {<NEW_LINE>divRemoved(existing);<NEW_LINE>}<NEW_LINE>divAdded(d);<NEW_LINE>} else {<NEW_LINE>log.log("SM: serialised div: " + DHTLog.getString2(d.getKey().getBytes()) + " expired");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>storage_mon.exit();<NEW_LINE>}<NEW_LINE>} | long now = SystemTime.getCurrentTime(); |
968,663 | private VideoTranscodingSettings createVideoTranscodingSettings(MediaFile file, HttpServletRequest request) throws ServletRequestBindingException {<NEW_LINE>Integer existingWidth = file.getWidth();<NEW_LINE>Integer existingHeight = file.getHeight();<NEW_LINE>Integer maxBitRate = <MASK><NEW_LINE>int timeOffset = ServletRequestUtils.getIntParameter(request, "timeOffset", 0);<NEW_LINE>double defaultDuration = file.getDuration() == null ? Double.MAX_VALUE : file.getDuration() - timeOffset;<NEW_LINE>double duration = ServletRequestUtils.getDoubleParameter(request, "duration", defaultDuration);<NEW_LINE>Dimension dim = getRequestedVideoSize(request.getParameter("size"));<NEW_LINE>if (dim == null) {<NEW_LINE>dim = TranscodingService.getSuitableVideoSize(existingWidth, existingHeight, maxBitRate);<NEW_LINE>}<NEW_LINE>return new VideoTranscodingSettings(dim.width, dim.height, timeOffset, duration);<NEW_LINE>} | ServletRequestUtils.getIntParameter(request, "maxBitRate"); |
1,714,024 | private ParseResult<String> parseQuotedString(int startPosition, int endPosition) {<NEW_LINE>startPosition = trimLeftWhitespace(startPosition, endPosition);<NEW_LINE>endPosition = trimRightWhitespace(startPosition, endPosition);<NEW_LINE>if (!startsAndEndsWith(startPosition, endPosition, '"', '"')) {<NEW_LINE>logError("quoted-string", "Expected opening and closing '\"'", startPosition);<NEW_LINE>return ParseResult.error();<NEW_LINE>}<NEW_LINE>int stringStart = startPosition + 1;<NEW_LINE>int stringEnd = endPosition - 1;<NEW_LINE>int <MASK><NEW_LINE>if (stringTokenCount < 1) {<NEW_LINE>logError("quoted-string", "Invalid quoted-string", startPosition);<NEW_LINE>return ParseResult.error();<NEW_LINE>}<NEW_LINE>StringBuilder result = new StringBuilder();<NEW_LINE>for (int i = stringStart; i < stringEnd; i++) {<NEW_LINE>ParseResult<String> unescapedChar = parseUnescapedChar(i, i + 1);<NEW_LINE>if (unescapedChar.hasResult()) {<NEW_LINE>result.append(unescapedChar.result());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>ParseResult<String> escapedChar = parseEscapedChar(i, i + 2);<NEW_LINE>if (escapedChar.hasResult()) {<NEW_LINE>result.append(escapedChar.result());<NEW_LINE>++i;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>ParseResult<String> escapedUnicodeSequence = parseEscapedUnicodeSequence(i, i + 6);<NEW_LINE>if (escapedUnicodeSequence.hasResult()) {<NEW_LINE>result.append(escapedUnicodeSequence.result());<NEW_LINE>i += 5;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (input.charAt(i) == '\\') {<NEW_LINE>logError("quoted-string", "Unsupported escape sequence", i);<NEW_LINE>} else {<NEW_LINE>logError("quoted-string", "Unexpected character", i);<NEW_LINE>}<NEW_LINE>return ParseResult.error();<NEW_LINE>}<NEW_LINE>return ParseResult.success(result.toString());<NEW_LINE>} | stringTokenCount = charsInRange(stringStart, stringEnd); |
737,843 | public static void customize(Breakpoint b) {<NEW_LINE>JComponent c = getCustomizerComponent(b);<NEW_LINE>HelpCtx helpCtx = HelpCtx.findHelp(c);<NEW_LINE>if (helpCtx == null) {<NEW_LINE>// NOI18N<NEW_LINE>helpCtx = new HelpCtx("debug.add.breakpoint");<NEW_LINE>}<NEW_LINE>Controller cc;<NEW_LINE>if (c instanceof ControllerProvider) {<NEW_LINE>cc = ((ControllerProvider) c).getController();<NEW_LINE>} else {<NEW_LINE>cc = (Controller) c;<NEW_LINE>}<NEW_LINE>final Controller[] cPtr <MASK><NEW_LINE>final DialogDescriptor[] descriptorPtr = new DialogDescriptor[1];<NEW_LINE>final Dialog[] dialogPtr = new Dialog[1];<NEW_LINE>ActionListener buttonsActionListener = new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent ev) {<NEW_LINE>if (descriptorPtr[0].getValue() == DialogDescriptor.OK_OPTION) {<NEW_LINE>boolean ok = cPtr[0].ok();<NEW_LINE>if (ok) {<NEW_LINE>dialogPtr[0].setVisible(false);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>dialogPtr[0].setVisible(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>DialogDescriptor descriptor = new DialogDescriptor(c, // NOI18N<NEW_LINE>NbBundle.// NOI18N<NEW_LINE>getMessage(// NOI18N<NEW_LINE>ComponentBreakpointsActionsProvider.class, "CTL_ComponentBreakpoint_Customizer_Title"), true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, DialogDescriptor.DEFAULT_ALIGN, helpCtx, buttonsActionListener);<NEW_LINE>descriptor.setClosingOptions(new Object[] {});<NEW_LINE>Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);<NEW_LINE>d.pack();<NEW_LINE>descriptorPtr[0] = descriptor;<NEW_LINE>dialogPtr[0] = d;<NEW_LINE>d.setVisible(true);<NEW_LINE>} | = new Controller[] { cc }; |
386,019 | public static CronExpression valueOf(@NonNull String string) throws ParseException {<NEW_LINE>if (string.length() == 0) {<NEW_LINE>throw new ParseException("Cron expression is empty", -1);<NEW_LINE>}<NEW_LINE>if (string.charAt(0) == '@') {<NEW_LINE>// Parse predefined<NEW_LINE>final String substr = string.substring(1);<NEW_LINE>switch(substr) {<NEW_LINE>case "yearly":<NEW_LINE>return YEARLY;<NEW_LINE>case "annually":<NEW_LINE>return ANNUALLY;<NEW_LINE>case "monthly":<NEW_LINE>return MONTHLY;<NEW_LINE>case "weekly":<NEW_LINE>return WEEKLY;<NEW_LINE>case "daily":<NEW_LINE>return DAILY;<NEW_LINE>case "hourly":<NEW_LINE>return HOURLY;<NEW_LINE>}<NEW_LINE>throw new ParseException("Unknown pre-defined value " + substr, 1);<NEW_LINE>}<NEW_LINE>final String[] segments = split(string, ' ');<NEW_LINE>if (segments.length > 6) {<NEW_LINE>throw new ParseException("Unrecognized segments " + string, -1);<NEW_LINE>}<NEW_LINE>// Parse minute field<NEW_LINE>Field[<MASK><NEW_LINE>fields[0] = FieldType.MINUTE.parseField(segments[0]);<NEW_LINE>// Parse hour field<NEW_LINE>fields[1] = FieldType.HOUR_OF_DAY.parseField(segments[1]);<NEW_LINE>// Parse day-of-month field<NEW_LINE>fields[2] = FieldType.DAY_OF_MONTH.parseField(segments[2]);<NEW_LINE>// Parse month field<NEW_LINE>fields[3] = FieldType.MONTH.parseField(segments[3]);<NEW_LINE>// Parse day-of-week field<NEW_LINE>fields[4] = FieldType.DAY_OF_WEEK.parseField(segments[4]);<NEW_LINE>return new CronExpression(fields);<NEW_LINE>} | ] fields = new Field[6]; |
1,803,672 | private static TypeSignature toTypeSignature(GenericDataType type, Set<String> typeVariables) {<NEW_LINE>ImmutableList.Builder<TypeSignatureParameter> parameters = ImmutableList.builder();<NEW_LINE>if (type.getName().getValue().equalsIgnoreCase(StandardTypes.VARCHAR) && type.getArguments().isEmpty()) {<NEW_LINE>// We treat VARCHAR specially because currently, the unbounded VARCHAR type is modeled in the system as a VARCHAR(n) with a "magic" length<NEW_LINE>// TODO: Eventually, we should split the types into VARCHAR and VARCHAR(n)<NEW_LINE>return VarcharType.VARCHAR.getTypeSignature();<NEW_LINE>}<NEW_LINE>checkArgument(!typeVariables.contains(type.getName().getValue()), "Base type name cannot be a type variable");<NEW_LINE>for (DataTypeParameter parameter : type.getArguments()) {<NEW_LINE>if (parameter instanceof NumericParameter) {<NEW_LINE>String value = ((NumericParameter) parameter).getValue();<NEW_LINE>try {<NEW_LINE>parameters.add(numericParameter(<MASK><NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw semanticException(TYPE_MISMATCH, parameter, "Invalid type parameter: %s", value);<NEW_LINE>}<NEW_LINE>} else if (parameter instanceof TypeParameter) {<NEW_LINE>DataType value = ((TypeParameter) parameter).getValue();<NEW_LINE>if (value instanceof GenericDataType && ((GenericDataType) value).getArguments().isEmpty() && typeVariables.contains(((GenericDataType) value).getName().getValue())) {<NEW_LINE>parameters.add(typeVariable(((GenericDataType) value).getName().getValue()));<NEW_LINE>} else {<NEW_LINE>parameters.add(typeParameter(toTypeSignature(value, typeVariables)));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("Unsupported type parameter kind: " + parameter.getClass().getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new TypeSignature(canonicalize(type.getName()), parameters.build());<NEW_LINE>} | Long.parseLong(value))); |
692,763 | final DescribeFpgaImagesResult executeDescribeFpgaImages(DescribeFpgaImagesRequest describeFpgaImagesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeFpgaImagesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeFpgaImagesRequest> request = null;<NEW_LINE>Response<DescribeFpgaImagesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeFpgaImagesRequestMarshaller().marshall(super.beforeMarshalling(describeFpgaImagesRequest));<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, "DescribeFpgaImages");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeFpgaImagesResult> responseHandler = new StaxResponseHandler<DescribeFpgaImagesResult>(new DescribeFpgaImagesResultStaxUnmarshaller());<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, "EC2"); |
1,210,208 | public void checkAndDoUpdate() throws UserException {<NEW_LINE>Database database = Env.<MASK><NEW_LINE>if (database == null) {<NEW_LINE>if (!isCompleted()) {<NEW_LINE>String msg = "The database has been deleted. Change job state to cancelled";<NEW_LINE>LOG.warn(new LogBuilder(LogKey.SYNC_JOB, id).add("database", dbId).add("msg", msg).build());<NEW_LINE>cancel(MsgType.SCHEDULE_FAIL, msg);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (ChannelDescription channelDescription : channelDescriptions) {<NEW_LINE>Table table = database.getTableNullable(channelDescription.getTargetTable());<NEW_LINE>if (table == null) {<NEW_LINE>if (!isCompleted()) {<NEW_LINE>String msg = "The table has been deleted. Change job state to cancelled";<NEW_LINE>LOG.warn(new LogBuilder(LogKey.SYNC_JOB, id).add("dbId", dbId).add("table", channelDescription.getTargetTable()).add("msg", msg).build());<NEW_LINE>cancel(MsgType.SCHEDULE_FAIL, msg);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isNeedReschedule()) {<NEW_LINE>LOG.info(new LogBuilder(LogKey.SYNC_JOB, id).add("msg", "Job need to be scheduled").build());<NEW_LINE>updateState(JobState.PENDING, false);<NEW_LINE>}<NEW_LINE>} | getCurrentInternalCatalog().getDbNullable(dbId); |
513,561 | public static DescribeRegionsResponse unmarshall(DescribeRegionsResponse describeRegionsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeRegionsResponse.setRequestId(_ctx.stringValue("DescribeRegionsResponse.RequestId"));<NEW_LINE>describeRegionsResponse.setCode(_ctx.integerValue("DescribeRegionsResponse.Code"));<NEW_LINE>describeRegionsResponse.setMessage(_ctx.stringValue("DescribeRegionsResponse.Message"));<NEW_LINE>describeRegionsResponse.setSuccess(_ctx.booleanValue("DescribeRegionsResponse.Success"));<NEW_LINE>List<Region> regions = new ArrayList<Region>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeRegionsResponse.Regions.Length"); i++) {<NEW_LINE>Region region = new Region();<NEW_LINE>region.setRegionEndpoint(_ctx.stringValue("DescribeRegionsResponse.Regions[" + i + "].RegionEndpoint"));<NEW_LINE>region.setLocalName(_ctx.stringValue("DescribeRegionsResponse.Regions[" + i + "].LocalName"));<NEW_LINE>region.setRegionId(_ctx.stringValue<MASK><NEW_LINE>regions.add(region);<NEW_LINE>}<NEW_LINE>describeRegionsResponse.setRegions(regions);<NEW_LINE>return describeRegionsResponse;<NEW_LINE>} | ("DescribeRegionsResponse.Regions[" + i + "].RegionId")); |
1,160,784 | public Builder mergeFrom(io.kubernetes.client.proto.V1.ServiceAccountList other) {<NEW_LINE>if (other == io.kubernetes.client.proto.V1.ServiceAccountList.getDefaultInstance())<NEW_LINE>return this;<NEW_LINE>if (other.hasMetadata()) {<NEW_LINE>mergeMetadata(other.getMetadata());<NEW_LINE>}<NEW_LINE>if (itemsBuilder_ == null) {<NEW_LINE>if (!other.items_.isEmpty()) {<NEW_LINE>if (items_.isEmpty()) {<NEW_LINE>items_ = other.items_;<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>ensureItemsIsMutable();<NEW_LINE>items_.addAll(other.items_);<NEW_LINE>}<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!other.items_.isEmpty()) {<NEW_LINE>if (itemsBuilder_.isEmpty()) {<NEW_LINE>itemsBuilder_.dispose();<NEW_LINE>itemsBuilder_ = null;<NEW_LINE>items_ = other.items_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000002);<NEW_LINE>itemsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getItemsFieldBuilder() : null;<NEW_LINE>} else {<NEW_LINE>itemsBuilder_.addAllMessages(other.items_);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.mergeUnknownFields(other.unknownFields);<NEW_LINE>onChanged();<NEW_LINE>return this;<NEW_LINE>} | bitField0_ = (bitField0_ & ~0x00000002); |
632,417 | private void collapseChildren(int position) {<NEW_LINE>mVisibleComments.get(position).setExpanded(false);<NEW_LINE>int depth = mVisibleComments.get(position).getDepth();<NEW_LINE>int allChildrenSize = 0;<NEW_LINE>for (int i = position + 1; i < mVisibleComments.size(); i++) {<NEW_LINE>if (mVisibleComments.get(i).getDepth() > depth) {<NEW_LINE>allChildrenSize++;<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (allChildrenSize > 0) {<NEW_LINE>mVisibleComments.subList(position + 1, position + 1 + allChildrenSize).clear();<NEW_LINE>}<NEW_LINE>if (mIsSingleCommentThreadMode) {<NEW_LINE><MASK><NEW_LINE>if (mFullyCollapseComment) {<NEW_LINE>notifyItemChanged(position + 1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>notifyItemRangeRemoved(position + 1, allChildrenSize);<NEW_LINE>if (mFullyCollapseComment) {<NEW_LINE>notifyItemChanged(position);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | notifyItemRangeRemoved(position + 2, allChildrenSize); |
1,740,890 | private static AccessToken createAccessToken() {<NEW_LINE>// Generate a public/private key pair. This is used to protect the token<NEW_LINE>// from replay attacks. A client must prove possession of the private<NEW_LINE>// key in order to access the database using the token.<NEW_LINE>final KeyPair keyPair;<NEW_LINE>try {<NEW_LINE>keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();<NEW_LINE>} catch (NoSuchAlgorithmException noSuchAlgorithmException) {<NEW_LINE>// Not recovering if an RSA KeyPairGenerator is not installed<NEW_LINE>throw new RuntimeException(noSuchAlgorithmException);<NEW_LINE>}<NEW_LINE>// Request an access token from the OCI Identity Service. The token<NEW_LINE>// will identify the public key that is paired to the private key<NEW_LINE>String token = requestToken(keyPair.getPublic());<NEW_LINE>// Create an AccessToken object with the JWT string and the private key<NEW_LINE>return AccessToken.createJsonWebToken(token.toCharArray(<MASK><NEW_LINE>} | ), keyPair.getPrivate()); |
1,395,622 | // Search Jobs using custom rankings.<NEW_LINE>public static void searchCustomRankingJobs(String projectId, String tenantId) throws IOException {<NEW_LINE>// Initialize client that will be used to send requests. This client only needs to be created<NEW_LINE>// once, and can be reused for multiple requests. After completing all of your requests, call<NEW_LINE>// the "close" method on the client to safely clean up any remaining background resources.<NEW_LINE>try (JobServiceClient jobServiceClient = JobServiceClient.create()) {<NEW_LINE>TenantName parent = TenantName.of(projectId, tenantId);<NEW_LINE>String domain = "www.example.com";<NEW_LINE>String sessionId = "Hashed session identifier";<NEW_LINE>String userId = "Hashed user identifier";<NEW_LINE>RequestMetadata requestMetadata = RequestMetadata.newBuilder().setDomain(domain).setSessionId(sessionId).setUserId(userId).build();<NEW_LINE>SearchJobsRequest.CustomRankingInfo.ImportanceLevel importanceLevel = SearchJobsRequest.CustomRankingInfo.ImportanceLevel.EXTREME;<NEW_LINE>String rankingExpression = "(someFieldLong + 25) * 0.25";<NEW_LINE>SearchJobsRequest.CustomRankingInfo customRankingInfo = SearchJobsRequest.CustomRankingInfo.newBuilder().setImportanceLevel(importanceLevel).setRankingExpression(rankingExpression).build();<NEW_LINE>String orderBy = "custom_ranking desc";<NEW_LINE>SearchJobsRequest request = SearchJobsRequest.newBuilder().setParent(parent.toString()).setRequestMetadata(requestMetadata).setCustomRankingInfo(customRankingInfo).setOrderBy(orderBy).build();<NEW_LINE>for (SearchJobsResponse.MatchingJob responseItem : jobServiceClient.searchJobs(request).iterateAll()) {<NEW_LINE>System.out.format("Job summary: %s%n", responseItem.getJobSummary());<NEW_LINE>System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet());<NEW_LINE><MASK><NEW_LINE>System.out.format("Job name: %s%n", job.getName());<NEW_LINE>System.out.format("Job title: %s%n", job.getTitle());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Job job = responseItem.getJob(); |
1,013,275 | public List<String> checkForBadges(Profile authUser, HttpServletRequest req) {<NEW_LINE>List<String> badgelist = new ArrayList<String>();<NEW_LINE>if (authUser != null && !isAjaxRequest(req)) {<NEW_LINE>long oneYear = authUser.getTimestamp() + (365 * 24 * 60 * 60 * 1000);<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.ENTHUSIAST, authUser.getVotes() >= CONF.enthusiastIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.FRESHMAN, authUser.getVotes() >= CONF.freshmanIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.SCHOLAR, authUser.getVotes() >= CONF.scholarIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.TEACHER, authUser.getVotes() >= CONF.teacherIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.PROFESSOR, authUser.getVotes() >= CONF.professorIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.GEEK, authUser.getVotes() >= CONF.geekIfHasRep());<NEW_LINE>addBadgeOnce(authUser, Profile.Badge.SENIOR, (System.currentTimeMillis() - authUser<MASK><NEW_LINE>if (!StringUtils.isBlank(authUser.getNewbadges())) {<NEW_LINE>badgelist.addAll(Arrays.asList(authUser.getNewbadges().split(",")));<NEW_LINE>authUser.setNewbadges(null);<NEW_LINE>authUser.update();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return badgelist;<NEW_LINE>} | .getTimestamp()) >= oneYear); |
1,315,411 | public CommitTransactionRequest unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CommitTransactionRequest commitTransactionRequest = new CommitTransactionRequest();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("TransactionId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>commitTransactionRequest.setTransactionId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("CommitDigest", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>commitTransactionRequest.setCommitDigest(context.getUnmarshaller(java.nio.ByteBuffer.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return commitTransactionRequest;<NEW_LINE>} | class).unmarshall(context)); |
973,947 | // metas: us025b<NEW_LINE>@Override<NEW_LINE>public void createCashStatementLine(final I_C_Payment payment) {<NEW_LINE>final IBankStatementPaymentBL bankStatmentPaymentBL = Services.get(IBankStatementPaymentBL.class);<NEW_LINE>final I_C_BankStatement bs = getCreateCashStatement(payment);<NEW_LINE>final BankStatementId bankStatementId = BankStatementId.ofRepoId(bs.getC_BankStatement_ID());<NEW_LINE>final LocalDate statementDate = TimeUtil.asLocalDate(bs.getStatementDate());<NEW_LINE>final Money paymentAmt = extractPayAmt(payment);<NEW_LINE>final PaymentDirection paymentDirection = PaymentDirection.ofReceiptFlag(payment.isReceipt());<NEW_LINE>final Money <MASK><NEW_LINE>final BankStatementLineId bankStatementLineId = bankStatementDAO.createBankStatementLine(//<NEW_LINE>BankStatementLineCreateRequest.builder().bankStatementId(bankStatementId).orgId(OrgId.ofRepoId(bs.getAD_Org_ID())).bpartnerId(//<NEW_LINE>BPartnerId.ofRepoId(payment.getC_BPartner_ID())).statementLineDate(//<NEW_LINE>statementDate).statementAmt(statementAmt).trxAmt(//<NEW_LINE>statementAmt).build());<NEW_LINE>final I_C_BankStatement bankStatement = bankStatementDAO.getById(bankStatementId);<NEW_LINE>final I_C_BankStatementLine bankStatementLine = bankStatementDAO.getLineById(bankStatementLineId);<NEW_LINE>bankStatmentPaymentBL.linkSinglePayment(bankStatement, bankStatementLine, payment);<NEW_LINE>} | statementAmt = paymentDirection.convertPayAmtToStatementAmt(paymentAmt); |
982,716 | private void applyReturnTypeOverride(OperationContext context) {<NEW_LINE>ResolvedType returnType = context.alternateFor(context.getReturnType());<NEW_LINE>int httpStatusCode = httpStatusCode(context);<NEW_LINE>String message = message(context);<NEW_LINE>springfox.documentation.schema.ModelReference modelRef = null;<NEW_LINE>ViewProviderPlugin viewProvider = pluginsManager.viewProvider(context.getDocumentationContext().getDocumentationType());<NEW_LINE>ResponseContext responseContext = new ResponseContext(context.getDocumentationContext(), context);<NEW_LINE>if (!isVoid(returnType)) {<NEW_LINE>ModelContext modelContext = context.operationModelsBuilder().addReturn(returnType<MASK><NEW_LINE>Map<String, String> knownNames = new HashMap<>();<NEW_LINE>Optional.ofNullable(context.getKnownModels().get(modelContext.getParameterId())).orElse(new HashSet<>()).forEach(model -> knownNames.put(model.getId(), model.getName()));<NEW_LINE>modelRef = modelRefFactory(modelContext, enumTypeDeterminer, typeNameExtractor, knownNames).apply(returnType);<NEW_LINE>Set<MediaType> produces = new HashSet<>(context.produces());<NEW_LINE>if (produces.isEmpty()) {<NEW_LINE>produces.add(MediaType.ALL);<NEW_LINE>}<NEW_LINE>produces.forEach(mediaType -> responseContext.responseBuilder().representation(mediaType).apply(r -> r.model(m -> m.copyOf(modelSpecifications.create(modelContext, returnType)))));<NEW_LINE>}<NEW_LINE>springfox.documentation.service.ResponseMessage built = new springfox.documentation.builders.ResponseMessageBuilder().code(httpStatusCode).message(message).responseModel(modelRef).build();<NEW_LINE>responseContext.responseBuilder().description(message).code(String.valueOf(httpStatusCode));<NEW_LINE>context.operationBuilder().responseMessages(singleton(built));<NEW_LINE>context.operationBuilder().responses(Collections.singleton(documentationPlugins.response(responseContext)));<NEW_LINE>} | , viewProvider.viewFor(context)); |
929,686 | public String findCurrentLeader() {<NEW_LINE>Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS));<NEW_LINE>final StringFullResponseHolder responseHolder;<NEW_LINE>try {<NEW_LINE>responseHolder = go(makeRequest(HttpMethod.GET, leaderRequestPath));<NEW_LINE>} catch (Exception ex) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (responseHolder.getStatus().getCode() == 200) {<NEW_LINE>String leaderUrl = responseHolder.getContent();<NEW_LINE>// verify this is valid url<NEW_LINE>try {<NEW_LINE>URL validatedUrl = new URL(leaderUrl);<NEW_LINE>currentKnownLeader.set(leaderUrl);<NEW_LINE>// validatedUrl.toString() is returned instead of leaderUrl or else teamcity build fails because of breaking<NEW_LINE>// the rule of ignoring new URL(leaderUrl) object.<NEW_LINE>return validatedUrl.toString();<NEW_LINE>} catch (MalformedURLException ex) {<NEW_LINE>log.error(ex, "Received malformed leader url[%s].", leaderUrl);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new ISE("Couldn't find leader, failed response status is [%s] and content [%s].", responseHolder.getStatus().getCode(), responseHolder.getContent());<NEW_LINE>} | throw new ISE(ex, "Couldn't find leader."); |
907,280 | public static void main(String[] args) throws ParseException {<NEW_LINE>String date;<NEW_LINE>long time;<NEW_LINE>SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss.S");<NEW_LINE>long cpu = SysJMX.getCurrentThreadCPUnano();<NEW_LINE>for (int i = 0; i < 10000; i++) {<NEW_LINE>date = sdf.format(new Date(System.currentTimeMillis() + i));<NEW_LINE>}<NEW_LINE>cpu = SysJMX.getCurrentThreadCPUnano() - cpu;<NEW_LINE>System.out.println("SimpleDateFormat.format " + cpu / 1000000L + " ms");<NEW_LINE>cpu = SysJMX.getCurrentThreadCPUnano();<NEW_LINE>for (int i = 0; i < 10000; i++) {<NEW_LINE>date = DateUtil.timestamp(System.currentTimeMillis() + i);<NEW_LINE>}<NEW_LINE>cpu = SysJMX.getCurrentThreadCPUnano() - cpu;<NEW_LINE>System.out.println("DateUtil.format " + cpu / 1000000L + " ms");<NEW_LINE>sdf = new SimpleDateFormat("yyyyMMdd");<NEW_LINE>cpu = SysJMX.getCurrentThreadCPUnano();<NEW_LINE>for (int i = 0; i < 10000; i++) {<NEW_LINE>time = sdf.parse("20101123").getTime();<NEW_LINE>}<NEW_LINE>cpu = SysJMX.getCurrentThreadCPUnano() - cpu;<NEW_LINE>System.out.println(<MASK><NEW_LINE>cpu = SysJMX.getCurrentThreadCPUnano();<NEW_LINE>for (int i = 0; i < 10000; i++) {<NEW_LINE>time = DateUtil.yyyymmdd("20101123");<NEW_LINE>}<NEW_LINE>cpu = SysJMX.getCurrentThreadCPUnano() - cpu;<NEW_LINE>System.out.println("DateUtil.parse " + cpu / 1000000L + " ms");<NEW_LINE>} | "SimpleDateFormat.parse " + cpu / 1000000L + " ms"); |
1,131,299 | protected void doExecute(Task task, PutDataFrameAnalyticsAction.Request request, ActionListener<ExplainDataFrameAnalyticsAction.Response> listener) {<NEW_LINE>if (MachineLearningField.ML_API_FEATURE.check(licenseState) == false) {<NEW_LINE>listener.onFailure(LicenseUtils.newComplianceException(XPackField.MACHINE_LEARNING));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Since the data_frame_analyzer program will be so short-lived and use so little memory when run<NEW_LINE>// purely for memory estimation we are happy to run it on nodes that might not be ML nodes. This<NEW_LINE>// also helps with the case where there are no ML nodes in the cluster, but lazy ML nodes can be<NEW_LINE>// added. We know the ML plugin is enabled on the current node, because this code is in it!<NEW_LINE>DiscoveryNode localNode = clusterService.localNode();<NEW_LINE>boolean isMlNode = MachineLearning.isMlNode(localNode);<NEW_LINE>if (isMlNode || localNode.isMasterNode() || localNode.canContainData() || localNode.isIngestNode()) {<NEW_LINE>if (isMlNode == false) {<NEW_LINE>logger.debug("estimating data frame analytics memory on non-ML node");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>redirectToSuitableNode(request, listener);<NEW_LINE>}<NEW_LINE>} | explain(task, request, listener); |
276,051 | protected void perform(@Nonnull XDebugSession session, DataContext dataContext) {<NEW_LINE>Editor editor = dataContext.getData(CommonDataKeys.EDITOR);<NEW_LINE>if (editor == null || !(editor instanceof EditorEx)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int selectionStart = editor.getSelectionModel().getSelectionStart();<NEW_LINE>int selectionEnd = editor.getSelectionModel().getSelectionEnd();<NEW_LINE>String text;<NEW_LINE>TextRange range;<NEW_LINE>if (selectionStart != selectionEnd) {<NEW_LINE>range = new TextRange(selectionStart, selectionEnd);<NEW_LINE>text = editor.getDocument().getText(range);<NEW_LINE>} else {<NEW_LINE>XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator();<NEW_LINE>if (evaluator != null) {<NEW_LINE>ExpressionInfo expressionInfo = evaluator.getExpressionInfoAtOffset(session.getProject(), editor.getDocument(), selectionStart, true);<NEW_LINE>if (expressionInfo == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// todo check - is it wrong in case of not-null expressionInfo.second - copied (to console history document) text (text range) could be not correct statement?<NEW_LINE>range = expressionInfo.getTextRange();<NEW_LINE>text = XDebuggerEvaluateActionHandler.getExpressionText(expressionInfo, editor.getDocument());<NEW_LINE>} else {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (StringUtil.isEmptyOrSpaces(text)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ConsoleExecuteAction action = getConsoleExecuteAction(session);<NEW_LINE>if (action != null) {<NEW_LINE>action.execute(range<MASK><NEW_LINE>}<NEW_LINE>} | , text, (EditorEx) editor); |
1,644,850 | private void sendDocConversionRequestReceived(UploadedPresentation pres) {<NEW_LINE>if (!pres.isConversionStarted()) {<NEW_LINE>Map<String, Object> logData = new HashMap<String, Object>();<NEW_LINE>logData.put("podId", pres.getPodId());<NEW_LINE>logData.put("meetingId", pres.getMeetingId());<NEW_LINE>logData.put("presId", pres.getId());<NEW_LINE>logData.put("filename", pres.getName());<NEW_LINE>logData.put(<MASK><NEW_LINE>logData.put("authzToken", pres.getAuthzToken());<NEW_LINE>logData.put("logCode", "presentation_conversion_start");<NEW_LINE>logData.put("message", "Start presentation conversion.");<NEW_LINE>logData.put("isRemovable", pres.isRemovable());<NEW_LINE>Gson gson = new Gson();<NEW_LINE>String logStr = gson.toJson(logData);<NEW_LINE>log.info(" --analytics-- data={}", logStr);<NEW_LINE>pres.startConversion();<NEW_LINE>DocConversionRequestReceived progress = new DocConversionRequestReceived(pres.getPodId(), pres.getMeetingId(), pres.getId(), pres.getName(), pres.getAuthzToken(), pres.isDownloadable(), pres.isRemovable(), pres.isCurrent());<NEW_LINE>notifier.sendDocConversionProgress(progress);<NEW_LINE>}<NEW_LINE>} | "current", pres.isCurrent()); |
1,274,328 | public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) throws Exception {<NEW_LINE>String[] urlParts = checkSyntax(iRequest.getUrl(), 3, "Syntax error: class/<database>/<class-name>");<NEW_LINE>iRequest.getData().commandInfo = "Returns the information of a class in the schema";<NEW_LINE>iRequest.getData(<MASK><NEW_LINE>ODatabaseDocument db = null;<NEW_LINE>try {<NEW_LINE>db = getProfiledDatabaseInstance(iRequest);<NEW_LINE>if (db.getMetadata().getSchema().existsClass(urlParts[2])) {<NEW_LINE>final OClass cls = db.getMetadata().getSchema().getClass(urlParts[2]);<NEW_LINE>final StringWriter buffer = new StringWriter();<NEW_LINE>final OJSONWriter json = new OJSONWriter(buffer, OHttpResponse.JSON_FORMAT);<NEW_LINE>OServerCommandGetDatabase.exportClass(db, json, cls);<NEW_LINE>iResponse.send(OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, OHttpUtils.CONTENT_JSON, buffer.toString(), null);<NEW_LINE>} else<NEW_LINE>iResponse.send(OHttpUtils.STATUS_NOTFOUND_CODE, null, null, null, null);<NEW_LINE>} finally {<NEW_LINE>if (db != null)<NEW_LINE>db.close();<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ).commandDetail = urlParts[2]; |
1,152,405 | public void configure(MessagebusConfig config) {<NEW_LINE>RoutingSpec routing = new RoutingSpec();<NEW_LINE>for (int table = 0; table < config.routingtable().size(); table++) {<NEW_LINE>MessagebusConfig.Routingtable tableConfig = config.routingtable(table);<NEW_LINE>RoutingTableSpec tableSpec = new <MASK><NEW_LINE>for (int hop = 0; hop < tableConfig.hop().size(); hop++) {<NEW_LINE>MessagebusConfig.Routingtable.Hop hopConfig = tableConfig.hop(hop);<NEW_LINE>HopSpec hopSpec = new HopSpec(hopConfig.name(), hopConfig.selector());<NEW_LINE>for (int recipient = 0; recipient < hopConfig.recipient().size(); recipient++) {<NEW_LINE>hopSpec.addRecipient(hopConfig.recipient(recipient));<NEW_LINE>}<NEW_LINE>hopSpec.setIgnoreResult(hopConfig.ignoreresult());<NEW_LINE>tableSpec.addHop(hopSpec);<NEW_LINE>}<NEW_LINE>for (int route = 0; route < tableConfig.route().size(); route++) {<NEW_LINE>MessagebusConfig.Routingtable.Route routeConfig = tableConfig.route(route);<NEW_LINE>RouteSpec routeSpec = new RouteSpec(routeConfig.name());<NEW_LINE>for (int hop = 0; hop < routeConfig.hop().size(); hop++) {<NEW_LINE>routeSpec.addHop(routeConfig.hop(hop));<NEW_LINE>}<NEW_LINE>tableSpec.addRoute(routeSpec);<NEW_LINE>}<NEW_LINE>routing.addTable(tableSpec);<NEW_LINE>}<NEW_LINE>handler.setupRouting(routing);<NEW_LINE>} | RoutingTableSpec(tableConfig.protocol()); |
333,313 | String tag(String namespace, String local, int type, boolean localIsQname) {<NEW_LINE>String prefix = ns.get(namespace);<NEW_LINE>if (type != FAST && type != FASTATTR) {<NEW_LINE>if ((!localIsQname) && !XMLChar.isValidNCName(local))<NEW_LINE>return <MASK><NEW_LINE>if (namespace.equals(RDFNS)) {<NEW_LINE>// Description, ID, nodeID, about, aboutEach, aboutEachPrefix, li<NEW_LINE>// bagID parseType resource datatype RDF<NEW_LINE>if (badRDF.contains(local)) {<NEW_LINE>logger.warn("The URI rdf:" + local + " cannot be serialized in RDF/XML.");<NEW_LINE>throw new InvalidPropertyURIException("rdf:" + local);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean cookUp = false;<NEW_LINE>if (prefix == null) {<NEW_LINE>checkURI(namespace);<NEW_LINE>logger.warn("Internal error: unexpected QName URI: <" + namespace + ">. Fixing up with j.cook.up code.", new BrokenException("unexpected QName URI " + namespace));<NEW_LINE>cookUp = true;<NEW_LINE>} else if (prefix.length() == 0) {<NEW_LINE>if (type == ATTR || type == FASTATTR)<NEW_LINE>cookUp = true;<NEW_LINE>else<NEW_LINE>return local;<NEW_LINE>}<NEW_LINE>if (cookUp)<NEW_LINE>return cookUpAttribution(type, namespace, local);<NEW_LINE>return prefix + ":" + local;<NEW_LINE>} | splitTag(namespace + local, type); |
1,504,308 | public String completeIt(final DocumentTableFields docFields) {<NEW_LINE>final I_C_RfQResponse rfqResponse = extractRfQResponse(docFields);<NEW_LINE>final List<I_C_RfQResponseLine> rfqResponseLines = rfqDAO.retrieveResponseLines(rfqResponse);<NEW_LINE>validateBeforeComplete(rfqResponse, rfqResponseLines);<NEW_LINE>//<NEW_LINE>// Fire event: before complete<NEW_LINE>rfqEventDispacher.fireBeforeComplete(rfqResponse);<NEW_LINE>//<NEW_LINE>// Mark as complete<NEW_LINE>rfqResponse.setDocStatus(X_C_RfQResponse.DOCSTATUS_Completed);<NEW_LINE><MASK><NEW_LINE>rfqResponse.setProcessed(true);<NEW_LINE>InterfaceWrapperHelper.save(rfqResponse);<NEW_LINE>updateRfQResponseLinesStatus(rfqResponse, rfqResponseLines);<NEW_LINE>//<NEW_LINE>// Fire event: after complete<NEW_LINE>rfqEventDispacher.fireAfterComplete(rfqResponse);<NEW_LINE>// Make sure everything was saved<NEW_LINE>InterfaceWrapperHelper.save(rfqResponse);<NEW_LINE>return X_C_RfQResponse.DOCSTATUS_Completed;<NEW_LINE>} | rfqResponse.setDocAction(X_C_RfQResponse.DOCACTION_Close); |
758,726 | public void onResponse(Stream.Client stream, HeadersFrame frame) {<NEW_LINE>HttpExchange exchange = getHttpExchange();<NEW_LINE>if (exchange == null)<NEW_LINE>return;<NEW_LINE>HttpResponse httpResponse = exchange.getResponse();<NEW_LINE>MetaData.Response response = (MetaData.Response) frame.getMetaData();<NEW_LINE>httpResponse.version(response.getHttpVersion()).status(response.getStatus()).reason(response.getReason());<NEW_LINE>if (responseBegin(exchange)) {<NEW_LINE>HttpFields headers = response.getFields();<NEW_LINE>for (HttpField header : headers) {<NEW_LINE>if (!responseHeader(exchange, header))<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// TODO: add support for HttpMethod.CONNECT.<NEW_LINE>if (responseHeaders(exchange)) {<NEW_LINE>int status = response.getStatus();<NEW_LINE>boolean informational = HttpStatus.isInformational(status) && status != HttpStatus.SWITCHING_PROTOCOLS_101;<NEW_LINE>if (frame.isLast() || informational)<NEW_LINE>responseSuccess(exchange);<NEW_LINE>else<NEW_LINE>stream.demand();<NEW_LINE>} else {<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE><MASK><NEW_LINE>notifySuccess = frame.isLast();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | LOG.debug("stalling response processing, no demand after headers on {}", this); |
1,684,896 | public static void applyGamma(Buffer buffer, int depth, int stride, double gamma) {<NEW_LINE>if (gamma == 1.0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>switch(depth) {<NEW_LINE>case Frame.DEPTH_UBYTE:<NEW_LINE>flipCopyWithGamma(((ByteBuffer) buffer).asReadOnlyBuffer(), stride, (ByteBuffer) buffer, stride, false, gamma, false, 0);<NEW_LINE>break;<NEW_LINE>case Frame.DEPTH_BYTE:<NEW_LINE>flipCopyWithGamma(((ByteBuffer) buffer).asReadOnlyBuffer(), stride, (ByteBuffer) buffer, stride, <MASK><NEW_LINE>break;<NEW_LINE>case Frame.DEPTH_USHORT:<NEW_LINE>flipCopyWithGamma(((ShortBuffer) buffer).asReadOnlyBuffer(), stride, (ShortBuffer) buffer, stride, false, gamma, false, 0);<NEW_LINE>break;<NEW_LINE>case Frame.DEPTH_SHORT:<NEW_LINE>flipCopyWithGamma(((ShortBuffer) buffer).asReadOnlyBuffer(), stride, (ShortBuffer) buffer, stride, true, gamma, false, 0);<NEW_LINE>break;<NEW_LINE>case Frame.DEPTH_INT:<NEW_LINE>flipCopyWithGamma(((IntBuffer) buffer).asReadOnlyBuffer(), stride, (IntBuffer) buffer, stride, gamma, false, 0);<NEW_LINE>break;<NEW_LINE>case Frame.DEPTH_FLOAT:<NEW_LINE>flipCopyWithGamma(((FloatBuffer) buffer).asReadOnlyBuffer(), stride, (FloatBuffer) buffer, stride, gamma, false, 0);<NEW_LINE>break;<NEW_LINE>case Frame.DEPTH_DOUBLE:<NEW_LINE>flipCopyWithGamma(((DoubleBuffer) buffer).asReadOnlyBuffer(), stride, (DoubleBuffer) buffer, stride, gamma, false, 0);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>assert false;<NEW_LINE>}<NEW_LINE>} | true, gamma, false, 0); |
14,273 | public void loadJvmModel() {<NEW_LINE><MASK><NEW_LINE>JavaPlatformAdapter curJvm = (JavaPlatformAdapter) jvmModel.getSelectedItem();<NEW_LINE>String curPlatformName = null;<NEW_LINE>if (curJvm != null) {<NEW_LINE>curPlatformName = curJvm.getName();<NEW_LINE>} else {<NEW_LINE>curPlatformName = (String) tp.getJavaPlatform().getProperties().get(TomcatProperties.PLAT_PROP_ANT_NAME);<NEW_LINE>}<NEW_LINE>jvmModel.removeAllElements();<NEW_LINE>// feed the combo with sorted platform list<NEW_LINE>// NOI18N<NEW_LINE>JavaPlatform[] j2sePlatforms = jpm.getPlatforms(null, new Specification("J2SE", null));<NEW_LINE>JavaPlatformAdapter[] platformAdapters = new JavaPlatformAdapter[j2sePlatforms.length];<NEW_LINE>for (int i = 0; i < platformAdapters.length; i++) {<NEW_LINE>platformAdapters[i] = new JavaPlatformAdapter(j2sePlatforms[i]);<NEW_LINE>}<NEW_LINE>Arrays.sort(platformAdapters);<NEW_LINE>for (int i = 0; i < platformAdapters.length; i++) {<NEW_LINE>JavaPlatformAdapter platformAdapter = platformAdapters[i];<NEW_LINE>jvmModel.addElement(platformAdapter);<NEW_LINE>// try to set selected item<NEW_LINE>if (curPlatformName != null) {<NEW_LINE>if (curPlatformName.equals(platformAdapter.getName())) {<NEW_LINE>jvmModel.setSelectedItem(platformAdapter);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | JavaPlatformManager jpm = JavaPlatformManager.getDefault(); |
75,275 | private String buildPathFromHref(String parentPath, String href) throws UnsupportedEncodingException {<NEW_LINE>String scheme = parentPath.substring(0, parentPath.indexOf("://"));<NEW_LINE>String filename = parentPath.substring(scheme.length() + 3);<NEW_LINE>String userPwd = filename.substring(0, filename.indexOf('@'));<NEW_LINE>String username_enc = (userPwd.substring(0, userPwd.indexOf(":")));<NEW_LINE>String password_enc = (userPwd.substring(userPwd.indexOf(":") + 1));<NEW_LINE>String host = filename.substring(filename.indexOf('@') + 1);<NEW_LINE>int firstSlashPos = host.indexOf("/");<NEW_LINE>if (firstSlashPos >= 0) {<NEW_LINE>host = host.substring(0, firstSlashPos);<NEW_LINE>}<NEW_LINE>if (!href.startsWith("/"))<NEW_LINE>href = "/" + href;<NEW_LINE>return scheme + "://" + username_enc + ":" <MASK><NEW_LINE>} | + password_enc + "@" + host + href; |
1,558,950 | private void handle(CancelAddImageMsg msg) {<NEW_LINE>CancelDownloadImageReply reply = new CancelDownloadImageReply();<NEW_LINE>AddImageMsg amsg = msg.getMsg();<NEW_LINE>List<String> bsUuids = amsg.getBackupStorageUuids();<NEW_LINE>ImageInventory img = ImageInventory.valueOf(dbf.findByUuid(msg.getImageUuid(), ImageVO.class));<NEW_LINE>ErrorCodeList err = new ErrorCodeList();<NEW_LINE>new While<>(bsUuids).all((bsUuid, compl) -> {<NEW_LINE>CancelDownloadImageMsg cmsg = new CancelDownloadImageMsg();<NEW_LINE>cmsg.setImageInventory(img);<NEW_LINE>cmsg.setBackupStorageUuid(bsUuid);<NEW_LINE>cmsg.<MASK><NEW_LINE>bus.makeTargetServiceIdByResourceUuid(cmsg, BackupStorageConstant.SERVICE_ID, bsUuid);<NEW_LINE>bus.send(cmsg, new CloudBusCallBack(compl) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(MessageReply r) {<NEW_LINE>if (!r.isSuccess()) {<NEW_LINE>err.getCauses().add(r.getError());<NEW_LINE>}<NEW_LINE>compl.done();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}).run(new WhileDoneCompletion(msg) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void done(ErrorCodeList errorCodeList) {<NEW_LINE>if (!err.getCauses().isEmpty()) {<NEW_LINE>reply.setError(err.getCauses().get(0));<NEW_LINE>}<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | setCancellationApiId(msg.getCancellationApiId()); |
1,825,839 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "@name('table') create table MyTable(k string primary key, " + " avgone avg(int), avgtwo avg(int)," + " winone window(*) @type(SupportBean), wintwo window(*) @type(SupportBean)" + ");\n" + "into table MyTable select theString, " + " avg(intPrimitive) as avgone, avg(intPrimitive) as avgtwo," + " window(*) as winone, window(*) as wintwo " + "from SupportBean#keepall group by theString;\n" + "on SupportBean_S0 merge MyTable where p00 = k when matched then update set avgone.reset(), winone.reset();\n" + "on SupportBean_S1 merge MyTable where p10 = k when matched then update set avgtwo.reset(), wintwo.reset();\n";<NEW_LINE>env.compileDeploy(epl);<NEW_LINE>String[] propertyNames = "k,avgone,avgtwo,winone,wintwo".split(",");<NEW_LINE>SupportBean s0 = sendBean(env, "G1", 1);<NEW_LINE>SupportBean s1 = sendBean(env, "G2", 10);<NEW_LINE>SupportBean s2 = sendBean(env, "G2", 2);<NEW_LINE>SupportBean s3 = sendBean(env, "G1", 20);<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("table", propertyNames, new Object[][] { { "G1", 10.5d, 10.5d, new SupportBean[] { s0, s3 }, new SupportBean[] { s0, s3 } }, { "G2", 6d, 6d, new SupportBean[] { s1, s2 }, new SupportBean[] { s1, s2 } } });<NEW_LINE>env.milestone(0);<NEW_LINE>env.sendEventBean(new SupportBean_S0(0, "G2"));<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("table", propertyNames, new Object[][] { { "G1", 10.5d, 10.5d, new SupportBean[] { s0, s3 }, new SupportBean[] { s0, s3 } }, { "G2", null, 6d, null, new SupportBean[] { s1, s2 } } });<NEW_LINE>env.milestone(1);<NEW_LINE>env.sendEventBean(new SupportBean_S1(0, "G1"));<NEW_LINE>env.assertPropsPerRowIteratorAnyOrder("table", propertyNames, new Object[][] { { "G1", 10.5d, null, new SupportBean[] { s0, s3 }, null }, { "G2", null, 6d, null, new SupportBean[] <MASK><NEW_LINE>env.undeployAll();<NEW_LINE>} | { s1, s2 } } }); |
159,626 | public Object retrieve() {<NEW_LINE>IRoutingService routing = (IRoutingService) getContext().getAttributes().get(IRoutingService.class.getCanonicalName());<NEW_LINE>DatapathId srcDpid;<NEW_LINE>DatapathId dstDpid;<NEW_LINE>try {<NEW_LINE>srcDpid = DatapathId.of((String) getRequestAttributes().get("src-dpid"));<NEW_LINE>dstDpid = DatapathId.of((String) getRequestAttributes().get("dst-dpid"));<NEW_LINE>} catch (Exception e) {<NEW_LINE>return ImmutableMap.of("ERROR", "Could not parse source or destination DPID from URI");<NEW_LINE>}<NEW_LINE>log.debug("Asking for paths from {} to {}", srcDpid, dstDpid);<NEW_LINE>OFPort srcPort;<NEW_LINE>OFPort dstPort;<NEW_LINE>try {<NEW_LINE>srcPort = OFPort.of(Integer.parseInt((String) getRequestAttributes().get("src-port")));<NEW_LINE>dstPort = OFPort.of(Integer.parseInt((String) getRequestAttributes(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>return ImmutableMap.of("ERROR", "Could not parse source or destination port from URI");<NEW_LINE>}<NEW_LINE>log.debug("Asking for paths from {} to {}", srcPort, dstPort);<NEW_LINE>Path result = routing.getPath(srcDpid, srcPort, dstDpid, dstPort);<NEW_LINE>if (result != null) {<NEW_LINE>return JsonObjectWrapper.of(routing.getPath(srcDpid, srcPort, dstDpid, dstPort).getPath());<NEW_LINE>} else {<NEW_LINE>log.debug("ERROR! no path found");<NEW_LINE>return JsonObjectWrapper.of(ImmutableList.of());<NEW_LINE>}<NEW_LINE>} | ).get("dst-port"))); |
1,304,730 | public GenerateDataKeyResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GenerateDataKeyResult generateDataKeyResult = new GenerateDataKeyResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return generateDataKeyResult;<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("CiphertextBlob", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>generateDataKeyResult.setCiphertextBlob(context.getUnmarshaller(java.nio.ByteBuffer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Plaintext", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>generateDataKeyResult.setPlaintext(context.getUnmarshaller(java.nio.ByteBuffer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("KeyId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>generateDataKeyResult.setKeyId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return generateDataKeyResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,264,828 | static public MPrintFormat createFromReportView(Properties ctx, int AD_ReportView_ID, String ReportName) {<NEW_LINE>MClient company = MClient.get(ctx);<NEW_LINE>s_log.info("AD_ReportView_ID=" + AD_ReportView_ID + " - AD_Client_ID=" + company.get_ID() + " - " + ReportName);<NEW_LINE>MPrintFormat pf = new MPrintFormat(ctx, 0, null);<NEW_LINE>pf.setAD_ReportView_ID(AD_ReportView_ID);<NEW_LINE>// Get Info<NEW_LINE>String sql = "SELECT t.TableName," + " (SELECT COUNT(*) FROM AD_PrintFormat x WHERE x.AD_ReportView_ID=rv.AD_ReportView_ID AND x.AD_Client_ID=c.AD_Client_ID) AS Count," + " COALESCE (cpc.AD_PrintColor_ID, pc.AD_PrintColor_ID) AS AD_PrintColor_ID," + " COALESCE (cpf.AD_PrintFont_ID, pf.AD_PrintFont_ID) AS AD_PrintFont_ID," + " COALESCE (cpp.AD_PrintPaper_ID, pp.AD_PrintPaper_ID) AS AD_PrintPaper_ID," + " t.AD_Table_ID " + "FROM AD_ReportView rv" + " INNER JOIN AD_Table t ON (rv.AD_Table_ID=t.AD_Table_ID)," + " AD_Client c" + " LEFT OUTER JOIN AD_PrintColor cpc ON (cpc.AD_Client_ID=c.AD_Client_ID AND cpc.IsDefault='Y')" + " LEFT OUTER JOIN AD_PrintFont cpf ON (cpf.AD_Client_ID=c.AD_Client_ID AND cpf.IsDefault='Y')" + " LEFT OUTER JOIN AD_PrintPaper cpp ON (cpp.AD_Client_ID=c.AD_Client_ID AND cpp.IsDefault='Y')," + " AD_PrintColor pc, AD_PrintFont pf, AD_PrintPaper pp " + "WHERE rv.AD_ReportView_ID=? AND c.AD_Client_ID=?" + " AND pc.IsDefault='Y' AND pf.IsDefault='Y' AND pp.IsDefault='Y'";<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>boolean error = true;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql, null);<NEW_LINE>pstmt.setInt(1, AD_ReportView_ID);<NEW_LINE>pstmt.setInt(2, company.get_ID());<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>if (rs.next()) {<NEW_LINE>// Name<NEW_LINE>String name = ReportName;<NEW_LINE>if (name == null || name.length() == 0)<NEW_LINE>// TableName<NEW_LINE>name = rs.getString(1);<NEW_LINE>int count = rs.getInt(2);<NEW_LINE>if (count > 0)<NEW_LINE>name += "_" + count;<NEW_LINE>pf.setName(company.getValue() + " -> " + name);<NEW_LINE>//<NEW_LINE>pf.setAD_PrintColor_ID(rs.getInt(3));<NEW_LINE>pf.setAD_PrintFont_ID(rs.getInt(4));<NEW_LINE>pf.setAD_PrintPaper_ID(rs.getInt(5));<NEW_LINE>//<NEW_LINE>pf.setAD_Table_ID(rs.getInt(6));<NEW_LINE>error = false;<NEW_LINE>} else<NEW_LINE>s_log.log(Level.SEVERE, "Not found: AD_ReportView_ID=" + AD_ReportView_ID);<NEW_LINE>} catch (SQLException e) {<NEW_LINE>s_log.log(<MASK><NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>rs = null;<NEW_LINE>pstmt = null;<NEW_LINE>}<NEW_LINE>if (error)<NEW_LINE>return null;<NEW_LINE>// Save & complete<NEW_LINE>if (!pf.save())<NEW_LINE>return null;<NEW_LINE>// pf.dump();<NEW_LINE>pf.setItems(createItems(ctx, pf));<NEW_LINE>//<NEW_LINE>return pf;<NEW_LINE>} | Level.SEVERE, sql, e); |
295,509 | public LimitedScanResult<List<TransactionId>> scanTraceIndex(final String applicationName, Range range, int limit, boolean scanBackward) {<NEW_LINE>Objects.requireNonNull(applicationName, "applicationName");<NEW_LINE>Objects.requireNonNull(range, "range");<NEW_LINE>if (limit < 0) {<NEW_LINE>throw new IllegalArgumentException("negative limit:" + limit);<NEW_LINE>}<NEW_LINE>logger.debug("scanTraceIndex {}", range);<NEW_LINE>Scan scan = createScan(applicationName, range, scanBackward);<NEW_LINE>LastRowAccessor lastRowAccessor = new LastRowAccessor();<NEW_LINE>TableName applicationTraceIndexTableName = tableNameProvider.<MASK><NEW_LINE>List<List<TransactionId>> traceIndexList = hbaseOperations2.findParallel(applicationTraceIndexTableName, scan, traceIdRowKeyDistributor, limit, traceIndexMapper, lastRowAccessor, APPLICATION_TRACE_INDEX_NUM_PARTITIONS);<NEW_LINE>List<TransactionId> transactionIdSum = ListListUtils.toList(traceIndexList);<NEW_LINE>final long lastTime = getLastTime(range, limit, lastRowAccessor, transactionIdSum);<NEW_LINE>return new LimitedScanResult<>(lastTime, transactionIdSum);<NEW_LINE>} | getTableName(DESCRIPTOR.getTable()); |
1,814,404 | public String nextClosestTime(String time) {<NEW_LINE>int cur = 60 * Integer.parseInt(time.substring(0, 2));<NEW_LINE>cur += Integer.parseInt(time.substring(3));<NEW_LINE>Set<Integer> allowed = new HashSet();<NEW_LINE>for (char c : time.toCharArray()) {<NEW_LINE>if (c != ':') {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>cur = (cur + 1) % (24 * 60);<NEW_LINE>int[] digits = new int[] { cur / 60 / 10, cur / 60 % 10, cur % 60 / 10, cur % 60 % 10 };<NEW_LINE>search: {<NEW_LINE>for (int d : digits) {<NEW_LINE>if (!allowed.contains(d)) {<NEW_LINE>break search;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return String.format("%02d:%02d", cur / 60, cur % 60);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | allowed.add(c - '0'); |
467,149 | public I_M_ProductScalePrice retrieveOrCreateScalePrices(final int productPriceId, final BigDecimal qty, final boolean createNew, final String trxName) {<NEW_LINE>final PreparedStatement pstmt = <MASK><NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt.setInt(1, productPriceId);<NEW_LINE>pstmt.setBigDecimal(2, qty);<NEW_LINE>pstmt.setMaxRows(1);<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>if (rs.next()) {<NEW_LINE>logger.debug("Returning existing instance for M_ProductPrice " + productPriceId + " and quantity " + qty);<NEW_LINE>return new X_M_ProductScalePrice(Env.getCtx(), rs, trxName);<NEW_LINE>}<NEW_LINE>if (createNew) {<NEW_LINE>logger.debug("Returning new instance for M_ProductPrice " + productPriceId + " and quantity " + qty);<NEW_LINE>final I_M_ProductScalePrice newInstance = createScalePrice(trxName);<NEW_LINE>newInstance.setM_ProductPrice_ID(productPriceId);<NEW_LINE>newInstance.setQty(qty);<NEW_LINE>return newInstance;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new DBException(e, SQL_SCALEPRICE_FOR_QTY);<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>}<NEW_LINE>} | DB.prepareStatement(SQL_SCALEPRICE_FOR_QTY, trxName); |
1,266,684 | private void checkAuthAttributesNoDuplicates(final Map<String, List<AuthorizationAttribute>> allAttributes) throws UnableProcessException {<NEW_LINE>final String duplicatesErrMessage = allAttributes.entrySet().stream().map(entry -> {<NEW_LINE>final String property = entry.getKey();<NEW_LINE>final List<AuthorizationAttribute> attrs = entry.getValue();<NEW_LINE>final List<AuthorizationAttribute> duplicates = newArrayList(attrs);<NEW_LINE>final Set<AuthorizationAttribute> uniqueAttrs = newHashSet(attrs);<NEW_LINE><MASK><NEW_LINE>if (!duplicates.isEmpty()) {<NEW_LINE>final String duplicatesStr = duplicates.stream().distinct().map(attr -> String.format("%s:%s", attr.getDataType(), attr.getValue())).collect(Collectors.joining(", "));<NEW_LINE>final String err = String.format("authorization property '%s' contains duplicated attribute(s): %s", property, duplicatesStr);<NEW_LINE>return Optional.of(err);<NEW_LINE>} else {<NEW_LINE>return Optional.<String>empty();<NEW_LINE>}<NEW_LINE>}).filter(Optional::isPresent).map(Optional::get).collect(Collectors.joining("; "));<NEW_LINE>if (!Strings.isNullOrEmpty(duplicatesErrMessage)) {<NEW_LINE>throw new UnableProcessException(duplicatesErrMessage);<NEW_LINE>}<NEW_LINE>} | uniqueAttrs.forEach(duplicates::remove); |
1,619,051 | private void displayThreads(PrintStream out) throws DDRInteractiveCommandException {<NEW_LINE>try {<NEW_LINE>J9JavaVMPointer vm = J9RASHelper.<MASK><NEW_LINE>J9VMThreadPointer mainThread = vm.mainThread();<NEW_LINE>if (mainThread.notNull()) {<NEW_LINE>J9VMThreadPointer threadCursor = vm.mainThread();<NEW_LINE>do {<NEW_LINE>out.println(String.format("\t!stack 0x%08x\t!j9vmthread 0x%08x\t!j9thread 0x%08x\ttid 0x%x (%d) // (%s)", threadCursor.getAddress(), threadCursor.getAddress(), threadCursor.osThread().getAddress(), threadCursor.osThread().tid().longValue(), threadCursor.osThread().tid().longValue(), getThreadName(threadCursor)));<NEW_LINE>threadCursor = threadCursor.linkNext();<NEW_LINE>} while (!threadCursor.eq(mainThread));<NEW_LINE>}<NEW_LINE>} catch (CorruptDataException e) {<NEW_LINE>throw new DDRInteractiveCommandException(e);<NEW_LINE>}<NEW_LINE>} | getVM(DataType.getJ9RASPointer()); |
535,634 | public boolean enterExportNode(ExportNode exportNode) {<NEW_LINE>final ExportClauseNode exportClause = exportNode.getExportClause();<NEW_LINE>final FromNode from = exportNode.getFrom();<NEW_LINE>final Expression expression = exportNode.getExpression();<NEW_LINE>if (exportClause != null) {<NEW_LINE>for (ExportSpecifierNode esNode : exportClause.getExportSpecifiers()) {<NEW_LINE>IdentNode exported = esNode.getExportIdentifier();<NEW_LINE>IdentNode local = esNode.getIdentifier();<NEW_LINE>JsObjectImpl property = (JsObjectImpl) modelBuilder.getCurrentDeclarationFunction().getProperty(local.getName());<NEW_LINE>if (exported == null) {<NEW_LINE>if (property == null) {<NEW_LINE>property = createVariableFromImport<MASK><NEW_LINE>}<NEW_LINE>property.addOccurrence(getOffsetRange(local));<NEW_LINE>} else {<NEW_LINE>addOccurence(local, false);<NEW_LINE>property = createVariableFromImport(create(parserResult, exported));<NEW_LINE>}<NEW_LINE>if (from != null && property != null) {<NEW_LINE>TypeUsage type = new TypeUsage(local.getName(), local.getFinish());<NEW_LINE>property.addAssignment(type, local.getFinish());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (expression != null) {<NEW_LINE>addToPath(exportNode);<NEW_LINE>expression.accept(this);<NEW_LINE>removeFromPathTheLast();<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | (create(parserResult, local)); |
1,762,087 | private Expression<?> castIfNeeded(Type elementType, Expression<?> symb_value) {<NEW_LINE>// cast integer to real if needed<NEW_LINE>if ((TypeUtil.isFp32(elementType) || TypeUtil.isFp64(elementType)) && symb_value instanceof IntegerValue) {<NEW_LINE>IntegerValue intExpr = (IntegerValue) symb_value;<NEW_LINE>double concValue = intExpr<MASK><NEW_LINE>symb_value = new IntegerToRealCast(intExpr, concValue);<NEW_LINE>} else if ((TypeUtil.isBv32(elementType) || TypeUtil.isBv64(elementType)) && symb_value instanceof RealValue) {<NEW_LINE>RealValue realExpr = (RealValue) symb_value;<NEW_LINE>long concValue = realExpr.getConcreteValue().longValue();<NEW_LINE>symb_value = new RealToIntegerCast(realExpr, concValue);<NEW_LINE>}<NEW_LINE>return symb_value;<NEW_LINE>} | .getConcreteValue().doubleValue(); |
1,372,000 | private void editPost() {<NEW_LINE>if (!isSubmitting) {<NEW_LINE>isSubmitting = true;<NEW_LINE>Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_SHORT).show();<NEW_LINE>Map<String, String> params = new HashMap<>();<NEW_LINE>params.put(APIUtils.THING_ID_KEY, mFullName);<NEW_LINE>params.put(APIUtils.TEXT_KEY, contentEditText.getText().toString());<NEW_LINE>mOauthRetrofit.create(RedditAPI.class).editPostOrComment(APIUtils.getOAuthHeader(mAccessToken), params).enqueue(new Callback<String>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {<NEW_LINE>isSubmitting = false;<NEW_LINE>Toast.makeText(EditPostActivity.this, R.string.edit_success, <MASK><NEW_LINE>Intent returnIntent = new Intent();<NEW_LINE>setResult(RESULT_OK, returnIntent);<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {<NEW_LINE>isSubmitting = false;<NEW_LINE>Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | Toast.LENGTH_SHORT).show(); |
1,796,105 | final CreateDatasetGroupResult executeCreateDatasetGroup(CreateDatasetGroupRequest createDatasetGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createDatasetGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<CreateDatasetGroupRequest> request = null;<NEW_LINE>Response<CreateDatasetGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateDatasetGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createDatasetGroupRequest));<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, "Personalize");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateDatasetGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateDatasetGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateDatasetGroupResultJsonUnmarshaller());<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); |
750,418 | // end of run<NEW_LINE>private void processExternalFunction(Listing listing, ReferenceManager refMan, Reference[] extRefs, Function extFunc, Parameter[] params, String extFuncName) {<NEW_LINE>for (Reference extRef : extRefs) {<NEW_LINE>Address refAddr = extRef.getFromAddress();<NEW_LINE>String refMnemonic = listing.getCodeUnitAt(refAddr).getMnemonicString();<NEW_LINE>Function calledFromFunc = listing.getFunctionContaining(refAddr);<NEW_LINE>if (calledFromFunc == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if ((refMnemonic.equals(new String("JMP")) && (calledFromFunc.isThunk()))) {<NEW_LINE>// println(calledFromFunc.getName() + " is a thunk. Refs are:");<NEW_LINE>ReferenceIterator tempIter = refMan.getReferencesTo(calledFromFunc.getEntryPoint());<NEW_LINE>while (tempIter.hasNext()) {<NEW_LINE>Reference thunkRef = tempIter.next();<NEW_LINE>Address thunkRefAddr = thunkRef.getFromAddress();<NEW_LINE>String thunkRefMnemonic = listing.getCodeUnitAt(thunkRefAddr).getMnemonicString();<NEW_LINE>Function <MASK><NEW_LINE>if ((thunkRefMnemonic.equals(new String("CALL")) && (thunkRefFunc != null))) {<NEW_LINE>CodeUnitIterator cuIt = getCodeUnitsFromFunctionStartToRef(thunkRefFunc, thunkRefAddr);<NEW_LINE>if (checkEnoughPushes(cuIt, params.length)) {<NEW_LINE>CodeUnitIterator codeUnitsToRef = getCodeUnitsFromFunctionStartToRef(thunkRefFunc, thunkRefAddr);<NEW_LINE>propogateParams(params, codeUnitsToRef, extFunc.getName());<NEW_LINE>println("Processing external function: " + extFuncName + " at " + thunkRefAddr.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if ((refMnemonic.equals(new String("CALL")))) {<NEW_LINE>// not a thunk<NEW_LINE>CodeUnitIterator cuIt = getCodeUnitsFromFunctionStartToRef(calledFromFunc, refAddr);<NEW_LINE>if (checkEnoughPushes(cuIt, params.length)) {<NEW_LINE>CodeUnitIterator codeUnitsToRef = getCodeUnitsFromFunctionStartToRef(calledFromFunc, refAddr);<NEW_LINE>propogateParams(params, codeUnitsToRef, extFunc.getName());<NEW_LINE>println("Processing external function: " + extFuncName + " at " + refAddr.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// end of extRef loop<NEW_LINE>} | thunkRefFunc = listing.getFunctionContaining(thunkRefAddr); |
904,778 | public void renamePanel(AbstractParamPanel panel, String newPanelName) {<NEW_LINE>DefaultMutableTreeNode node = getTreeNodeFromPanelName(<MASK><NEW_LINE>DefaultMutableTreeNode newNode = getTreeNodeFromPanelName(newPanelName, true);<NEW_LINE>if (node != null && newNode == null) {<NEW_LINE>// TODO work out which of these lines are really necessary ;)<NEW_LINE>DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent();<NEW_LINE>node.setUserObject(newPanelName);<NEW_LINE>tablePanel.remove(panel.getName());<NEW_LINE>int index = parent.getIndex(node);<NEW_LINE>getTreeModel().removeNodeFromParent(node);<NEW_LINE>getTreeModel().insertNodeInto(node, parent, index);<NEW_LINE>if (panel == currentShownPanel) {<NEW_LINE>this.nameLastSelectedPanel = newPanelName;<NEW_LINE>this.currentShownPanel = null;<NEW_LINE>}<NEW_LINE>this.getPanelParam().remove(panel);<NEW_LINE>panel.setName(newPanelName);<NEW_LINE>tablePanel.put(newPanelName, panel);<NEW_LINE>this.getPanelParam().add(newPanelName, panel);<NEW_LINE>getTreeModel().nodeChanged(node);<NEW_LINE>getTreeModel().nodeChanged(node.getParent());<NEW_LINE>}<NEW_LINE>} | panel.getName(), true); |
448,990 | private static Map<Integer, Comparable[]> generateAllInputArrays(int largeArraySize) {<NEW_LINE>Map<Integer, Comparable[]> <MASK><NEW_LINE>Comparable[] arrayGaussianDistribution = Exercise35_NonuniformDistributions.generateGaussianDistributionArray(largeArraySize);<NEW_LINE>allInputArrays.put(0, arrayGaussianDistribution);<NEW_LINE>Comparable[] arrayPoissonDistribution = Exercise35_NonuniformDistributions.generatePoissonDistributionArray(largeArraySize);<NEW_LINE>allInputArrays.put(1, arrayPoissonDistribution);<NEW_LINE>Comparable[] arrayGeometricDistribution = Exercise35_NonuniformDistributions.generateGeometricDistributionArray(largeArraySize);<NEW_LINE>allInputArrays.put(2, arrayGeometricDistribution);<NEW_LINE>Comparable[] arrayDiscreteDistribution = Exercise35_NonuniformDistributions.generateDiscreteDistributionArray(largeArraySize);<NEW_LINE>allInputArrays.put(3, arrayDiscreteDistribution);<NEW_LINE>Comparable[] arrayHalfZeroHalfOneValues = Exercise36_NonuniformData.generateHalfZeroHalfOneValuesArray(largeArraySize);<NEW_LINE>allInputArrays.put(4, arrayHalfZeroHalfOneValues);<NEW_LINE>Comparable[] arrayHalfIncrementingValues = Exercise36_NonuniformData.generateHalfIncrementingValuesArray(largeArraySize);<NEW_LINE>allInputArrays.put(5, arrayHalfIncrementingValues);<NEW_LINE>Comparable[] arrayHalfZeroHalfRandomValues = Exercise36_NonuniformData.generateHalfZeroHalfRandomValuesArray(largeArraySize);<NEW_LINE>allInputArrays.put(6, arrayHalfZeroHalfRandomValues);<NEW_LINE>return allInputArrays;<NEW_LINE>} | allInputArrays = new HashMap<>(); |
647,246 | public okhttp3.Call listGroupPoliciesCall(String groupId, String prefix, String after, Integer amount, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/auth/groups/{groupId}/policies".replaceAll("\\{" + "groupId" + "\\}", localVarApiClient.escapeString(groupId.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (prefix != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("prefix", prefix));<NEW_LINE>}<NEW_LINE>if (after != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("after", after));<NEW_LINE>}<NEW_LINE>if (amount != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("amount", amount));<NEW_LINE>}<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "basic_auth", "cookie_auth", "jwt_token" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, <MASK><NEW_LINE>} | localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); |
1,289,338 | private void initUi() {<NEW_LINE>setSupportActionBar(toolbar);<NEW_LINE>appVersion.<MASK><NEW_LINE>linkChangelog.setDescription(ApplicationUtils.getAppVersion());<NEW_LINE>ArrayList<Contributor> contributors = new ArrayList<>(1);<NEW_LINE>Contributor calvin = new Contributor(getString(R.string.developer_calvin_name), getString(R.string.about_developer_calvin_description), R.drawable.calvin_profile);<NEW_LINE>calvin.setEmail(MAIL_CALVIN);<NEW_LINE>calvin.addSocial(getString(R.string.google_plus_link), GOOGLE_ABOUT_CALVIN);<NEW_LINE>calvin.addSocial(getString(R.string.github), GITHUB_CALVIN);<NEW_LINE>contributors.add(calvin);<NEW_LINE>ContributorsAdapter contributorsAdapter = new ContributorsAdapter(this, contributors, this);<NEW_LINE>rvContributors.setHasFixedSize(true);<NEW_LINE>rvContributors.setLayoutManager(new LinearLayoutManager(getApplicationContext()));<NEW_LINE>rvContributors.setAdapter(contributorsAdapter);<NEW_LINE>ArrayList<Contact> donaldContacts = new ArrayList<>();<NEW_LINE>donaldContacts.add(new Contact(TWITTER_ABOUT_DONALD, getString(R.string.twitter_link)));<NEW_LINE>donaldContacts.add(new Contact(GITHUB_DONALD, getString(R.string.github_link)));<NEW_LINE>aboutDonald.setupListeners(this, MAIL_DONALD, donaldContacts);<NEW_LINE>ArrayList<Contact> jiboContacts = new ArrayList<>();<NEW_LINE>jiboContacts.add(new Contact(TWITTER_ABOUT_GILBERT, getString(R.string.twitter_link)));<NEW_LINE>jiboContacts.add(new Contact(GITHUB_GILBERT, getString(R.string.github_link)));<NEW_LINE>aboutGilbert.setupListeners(this, MAIL_GILBERT, jiboContacts);<NEW_LINE>aboutGilbert.setOnClickListener(v -> emojiEasterEgg());<NEW_LINE>specialThanksPatryk.setMovementMethod(LinkMovementMethod.getInstance());<NEW_LINE>} | setText(ApplicationUtils.getAppVersion()); |
1,280,858 | void precheckMaxResultLimitOnLocalPartitions(String mapName) {<NEW_LINE>// check if feature is enabled<NEW_LINE>if (!isPreCheckEnabled) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// limit number of local partitions to check to keep runtime constant<NEW_LINE>PartitionIdSet localPartitions = mapServiceContext.getOrInitCachedMemberPartitions();<NEW_LINE>int partitionsToCheck = min(<MASK><NEW_LINE>if (partitionsToCheck == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// calculate size of local partitions<NEW_LINE>int localPartitionSize = getLocalPartitionSize(mapName, localPartitions, partitionsToCheck);<NEW_LINE>if (localPartitionSize == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// check local result size<NEW_LINE>long localResultLimit = getNodeResultLimit(partitionsToCheck);<NEW_LINE>if (localPartitionSize > localResultLimit * MAX_RESULT_LIMIT_FACTOR_FOR_PRECHECK) {<NEW_LINE>throw new QueryResultSizeExceededException(maxResultLimit, " Result size exceeded in local pre-check.");<NEW_LINE>}<NEW_LINE>} | localPartitions.size(), maxLocalPartitionsLimitForPreCheck); |
1,078,442 | protected void scheduleDoConnect(boolean immediate) {<NEW_LINE>long jitter = immediate ? 50 : Math.max(50, RECONNECT_DELAY_JITTER_MILLIS);<NEW_LINE>long delay = immediate ? 50 : <MASK><NEW_LINE>long maxDelay = immediate ? 51 : Math.max(delay + 1, Math.max(50, RECONNECT_DELAY_MAX_MILLIS));<NEW_LINE>RetryPolicy<Object> retryPolicy = RetryPolicy.builder().withJitter(Duration.ofMillis(jitter)).withDelay(Duration.ofMillis(delay)).withBackoff(Duration.ofMillis(delay), Duration.ofMillis(maxDelay)).handle(RuntimeException.class).onRetryScheduled((execution) -> LOG.fine("Re-connection scheduled in '" + execution.getDelay() + "' for: " + getClientUri())).onFailedAttempt((execution) -> LOG.fine("Re-connection attempt failed '" + execution.getAttemptCount() + "' for: " + getClientUri())).withMaxRetries(Integer.MAX_VALUE).build();<NEW_LINE>connectRetry = Failsafe.with(retryPolicy).with(executorService).runAsyncExecution((execution) -> {<NEW_LINE>LOG.fine("Connection attempt '" + (execution.getAttemptCount() + 1) + "' for: " + getClientUri());<NEW_LINE>boolean success = doConnect().get();<NEW_LINE>if (connectRetry.isCancelled()) {<NEW_LINE>execution.recordResult(null);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (success) {<NEW_LINE>onConnectionStatusChanged(ConnectionStatus.CONNECTED);<NEW_LINE>execution.recordResult(null);<NEW_LINE>} else {<NEW_LINE>// Cleanup resources ready for next connection attempt<NEW_LINE>doDisconnect();<NEW_LINE>execution.recordFailure(new RuntimeException("Connection attempt failed"));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | Math.max(50, RECONNECT_DELAY_INITIAL_MILLIS); |
1,851,682 | public static DescribeColumnsResponse unmarshall(DescribeColumnsResponse describeColumnsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeColumnsResponse.setRequestId(_ctx.stringValue("DescribeColumnsResponse.RequestId"));<NEW_LINE>describeColumnsResponse.setCurrentPage(_ctx.integerValue("DescribeColumnsResponse.CurrentPage"));<NEW_LINE>describeColumnsResponse.setPageSize(_ctx.integerValue("DescribeColumnsResponse.PageSize"));<NEW_LINE>describeColumnsResponse.setTotalCount(_ctx.integerValue("DescribeColumnsResponse.TotalCount"));<NEW_LINE>List<Column> items = new ArrayList<Column>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeColumnsResponse.Items.Length"); i++) {<NEW_LINE>Column column = new Column();<NEW_LINE>column.setCreationTime(_ctx.longValue("DescribeColumnsResponse.Items[" + i + "].CreationTime"));<NEW_LINE>column.setTableName(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].TableName"));<NEW_LINE>column.setDataType(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].DataType"));<NEW_LINE>column.setOdpsRiskLevelValue(_ctx.integerValue("DescribeColumnsResponse.Items[" + i + "].OdpsRiskLevelValue"));<NEW_LINE>column.setDepartName(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].DepartName"));<NEW_LINE>column.setInstanceId(_ctx.longValue("DescribeColumnsResponse.Items[" + i + "].InstanceId"));<NEW_LINE>column.setRiskLevelId(_ctx.longValue("DescribeColumnsResponse.Items[" + i + "].RiskLevelId"));<NEW_LINE>column.setRuleName(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].RuleName"));<NEW_LINE>column.setRuleId(_ctx.longValue("DescribeColumnsResponse.Items[" + i + "].RuleId"));<NEW_LINE>column.setSensitive(_ctx.booleanValue("DescribeColumnsResponse.Items[" + i + "].Sensitive"));<NEW_LINE>column.setSensLevelName(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].SensLevelName"));<NEW_LINE>column.setInstanceName(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].InstanceName"));<NEW_LINE>column.setRiskLevelName(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].RiskLevelName"));<NEW_LINE>column.setOdpsRiskLevelName(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].OdpsRiskLevelName"));<NEW_LINE>column.setName(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].Name"));<NEW_LINE>column.setTableId(_ctx.longValue("DescribeColumnsResponse.Items[" + i + "].TableId"));<NEW_LINE>column.setId(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].Id"));<NEW_LINE>column.setProductCode(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].ProductCode"));<NEW_LINE>column.setRevisionStatus(_ctx.longValue("DescribeColumnsResponse.Items[" + i + "].RevisionStatus"));<NEW_LINE>column.setRevisionId(_ctx.longValue<MASK><NEW_LINE>List<String> sampleList = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeColumnsResponse.Items[" + i + "].SampleList.Length"); j++) {<NEW_LINE>sampleList.add(_ctx.stringValue("DescribeColumnsResponse.Items[" + i + "].SampleList[" + j + "]"));<NEW_LINE>}<NEW_LINE>column.setSampleList(sampleList);<NEW_LINE>items.add(column);<NEW_LINE>}<NEW_LINE>describeColumnsResponse.setItems(items);<NEW_LINE>return describeColumnsResponse;<NEW_LINE>} | ("DescribeColumnsResponse.Items[" + i + "].RevisionId")); |
1,640,911 | private void visitName(NodeTraversal t, Node n, Node parent) {<NEW_LINE>String name = n.getString();<NEW_LINE>// Ignore anonymous functions<NEW_LINE>if (parent.isFunction() && name.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isExternVar(name, t)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// When the globalSymbolNamespace is used as a local variable name<NEW_LINE>// add suffix to avoid shadowing the namespace. Also add a suffix<NEW_LINE>// if a name starts with the name of the globalSymbolNamespace and<NEW_LINE>// the suffix.<NEW_LINE>Var var = t.getScope().getVar(name);<NEW_LINE>if (!var.isGlobal() && (name.equals(globalSymbolNamespace) || name.startsWith(globalSymbolNamespace + DISAMBIGUATION_SUFFIX))) {<NEW_LINE><MASK><NEW_LINE>compiler.reportChangeToEnclosingScope(n);<NEW_LINE>}<NEW_LINE>// We only care about global vars.<NEW_LINE>if (!(var.isGlobal() && isCrossModuleName(name))) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>replaceSymbol(n, name);<NEW_LINE>} | n.setString(name + DISAMBIGUATION_SUFFIX); |
828,873 | protected void runGroupSynchronization(MapMarkersGroup group) {<NEW_LINE>List<MapMarker> existingMarkers = new ArrayList<>();<NEW_LINE>List<MapMarker> groupMarkers = new ArrayList<<MASK><NEW_LINE>if (group.getType() == ItineraryType.FAVOURITES) {<NEW_LINE>syncFavouriteGroup(group, existingMarkers);<NEW_LINE>} else if (group.getType() == ItineraryType.TRACK) {<NEW_LINE>syncTrackGroup(group, existingMarkers);<NEW_LINE>} else if (group.getType() == ItineraryType.MARKERS) {<NEW_LINE>existingMarkers.addAll(markersDbHelper.getActiveMarkers());<NEW_LINE>existingMarkers.addAll(markersDbHelper.getMarkersHistory());<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Unsupported ItineraryType: " + group.getType());<NEW_LINE>}<NEW_LINE>updateGroupMarkers(group, groupMarkers, existingMarkers);<NEW_LINE>removeOldMarkersIfPresent(groupMarkers);<NEW_LINE>} | >(group.getMarkers()); |
698,333 | private void loadUri(Uri uri) {<NEW_LINE>showFloatingActionButton(false);<NEW_LINE>if (mTaskUri != null) {<NEW_LINE>mAppContext.getContentResolver().unregisterContentObserver(mObserver);<NEW_LINE>persistTask();<NEW_LINE>}<NEW_LINE>Uri oldUri = mTaskUri;<NEW_LINE>mTaskUri = uri;<NEW_LINE>if (uri != null) {<NEW_LINE>mContentSet = new ContentSet(uri);<NEW_LINE>mContentSet.<MASK><NEW_LINE>mAppContext.getContentResolver().registerContentObserver(uri, false, mObserver);<NEW_LINE>mContentSet.update(mAppContext, CONTENT_VALUE_MAPPER);<NEW_LINE>} else {<NEW_LINE>mContentSet = null;<NEW_LINE>if (mContent != null) {<NEW_LINE>mContent.removeAllViews();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if ((oldUri == null) != (uri == null)) {<NEW_LINE>ActivityCompat.invalidateOptionsMenu(getActivity());<NEW_LINE>}<NEW_LINE>mAppBar.setExpanded(true, false);<NEW_LINE>} | addOnChangeListener(this, null, true); |
1,407,874 | protected void updateProfileButton() {<NEW_LINE>View view = getView();<NEW_LINE>if (view == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>View profileButton = view.findViewById(R.id.profile_button);<NEW_LINE>if (profileButton != null && currentScreenType != null) {<NEW_LINE>int toolbarRes = currentScreenType.toolbarResId;<NEW_LINE>int iconColor = getActiveProfileColor();<NEW_LINE>int bgColor = ColorUtilities.getColorWithAlpha(iconColor, 0.1f);<NEW_LINE>int selectedColor = <MASK><NEW_LINE>if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {<NEW_LINE>int bgResId = 0;<NEW_LINE>int selectableResId = 0;<NEW_LINE>if (toolbarRes == R.layout.profile_preference_toolbar || toolbarRes == R.layout.profile_preference_toolbar_with_switch) {<NEW_LINE>bgResId = R.drawable.circle_background_light;<NEW_LINE>selectableResId = R.drawable.ripple_circle;<NEW_LINE>} else if (toolbarRes == R.layout.profile_preference_toolbar_big) {<NEW_LINE>bgResId = R.drawable.rectangle_rounded;<NEW_LINE>selectableResId = R.drawable.ripple_rectangle_rounded;<NEW_LINE>}<NEW_LINE>Drawable bgDrawable = getPaintedIcon(bgResId, bgColor);<NEW_LINE>Drawable selectable = getPaintedIcon(selectableResId, selectedColor);<NEW_LINE>Drawable[] layers = { bgDrawable, selectable };<NEW_LINE>AndroidUtils.setBackground(profileButton, new LayerDrawable(layers));<NEW_LINE>} else {<NEW_LINE>int bgResId = 0;<NEW_LINE>if (toolbarRes == R.layout.profile_preference_toolbar || toolbarRes == R.layout.profile_preference_toolbar_with_switch) {<NEW_LINE>bgResId = R.drawable.circle_background_light;<NEW_LINE>} else if (toolbarRes == R.layout.profile_preference_toolbar_big) {<NEW_LINE>bgResId = R.drawable.rectangle_rounded;<NEW_LINE>}<NEW_LINE>Drawable bgDrawable = getPaintedIcon(bgResId, bgColor);<NEW_LINE>AndroidUtils.setBackground(profileButton, bgDrawable);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ColorUtilities.getColorWithAlpha(iconColor, 0.3f); |
1,244,231 | final CreateConnectionResult executeCreateConnection(CreateConnectionRequest createConnectionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createConnectionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateConnectionRequest> request = null;<NEW_LINE>Response<CreateConnectionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateConnectionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createConnectionRequest));<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, "CloudWatch Events");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateConnection");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateConnectionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateConnectionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,442,918 | private boolean buildTree() {<NEW_LINE>InspectionProfile profile = myInspectionProfile;<NEW_LINE>boolean isGroupedBySeverity = myGlobalInspectionContext.getUIOptions().GROUP_BY_SEVERITY;<NEW_LINE>myGroups = new HashMap<HighlightDisplayLevel, Map<String, InspectionGroupNode>>();<NEW_LINE>final Map<String, Tools> tools = myGlobalInspectionContext.getTools();<NEW_LINE>boolean resultsFound = false;<NEW_LINE>for (Tools currentTools : tools.values()) {<NEW_LINE>InspectionToolWrapper defaultToolWrapper = currentTools.getDefaultState().getTool();<NEW_LINE>final HighlightDisplayKey key = HighlightDisplayKey.find(defaultToolWrapper.getShortName());<NEW_LINE>for (ScopeToolState state : currentTools.getTools()) {<NEW_LINE>InspectionToolWrapper toolWrapper = state.getTool();<NEW_LINE>if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) {<NEW_LINE>addTool(toolWrapper, ((InspectionProfileImpl) profile).getErrorLevel(key, state.getScope(<MASK><NEW_LINE>resultsFound = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return resultsFound;<NEW_LINE>} | myProject), myProject), isGroupedBySeverity); |
5,505 | private String assertContent(SubmitContext context, String content, String type) throws AssertionException {<NEW_LINE>if (token == null) {<NEW_LINE>token = "";<NEW_LINE>}<NEW_LINE>if (content == null) {<NEW_LINE>content = "";<NEW_LINE>}<NEW_LINE>String replToken = PropertyExpander.expandProperties(context, token);<NEW_LINE>if (replToken == null) {<NEW_LINE>replToken = "";<NEW_LINE>}<NEW_LINE>replToken = normalize(replToken);<NEW_LINE>content = normalize(content);<NEW_LINE>if (replToken.length() > 0) {<NEW_LINE>int ix = -1;<NEW_LINE>if (useRegEx) {<NEW_LINE>String tokenToUse = ignoreCase ? "(?i)" + replToken : replToken;<NEW_LINE>Pattern p = Pattern.compile(tokenToUse, Pattern.DOTALL);<NEW_LINE>Matcher m = p.matcher(content);<NEW_LINE>if (m.find()) {<NEW_LINE>ix = 0;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ix = ignoreCase ? content.toUpperCase().indexOf(replToken.toUpperCase()<MASK><NEW_LINE>}<NEW_LINE>if (ix == -1) {<NEW_LINE>throw new AssertionException(new AssertionError("Missing token [" + replToken + "] in " + type));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return type + " contains token [" + replToken + "]";<NEW_LINE>} | ) : content.indexOf(replToken); |
1,502,695 | public ResponseEntity<Void> deleteOrderWithHttpInfo(String orderId) throws RestClientException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'orderId' is set<NEW_LINE>if (orderId == null) {<NEW_LINE>throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'orderId' when calling deleteOrder");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>final Map<String, Object> uriVariables = new HashMap<String, Object>();<NEW_LINE><MASK><NEW_LINE>final MultiValueMap<String, String> localVarQueryParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final HttpHeaders localVarHeaderParams = new HttpHeaders();<NEW_LINE>final MultiValueMap<String, String> localVarCookieParams = new LinkedMultiValueMap<String, String>();<NEW_LINE>final MultiValueMap<String, Object> localVarFormParams = new LinkedMultiValueMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>ParameterizedTypeReference<Void> localReturnType = new ParameterizedTypeReference<Void>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI("/store/order/{order_id}", HttpMethod.DELETE, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType);<NEW_LINE>} | uriVariables.put("order_id", orderId); |
200,889 | protected AudioInputStream generateAudioStream(List<SelectedUnit> units) throws IOException {<NEW_LINE>// gather arguments for FDPSOLA processing:<NEW_LINE>// Datagram[][] datagrams = getDatagrams(units);<NEW_LINE>// Datagram[] rightContexts = getRightContexts(units);<NEW_LINE>// boolean[][] voicings = getVoicings(units);<NEW_LINE>// double[][] pscales = getPitchScales(units);<NEW_LINE>// double[][] tscales = getDurationScales(units);<NEW_LINE>// double[][] tscales = getPhoneBasedDurationScales(units);<NEW_LINE>List<Phone> realizedPhones = prosodyAnalyzer.getRealizedPhones();<NEW_LINE>Datagram[][] datagrams = getRealizedDatagrams(realizedPhones);<NEW_LINE>Datagram[] rightContexts = getRealizedRightContexts(realizedPhones);<NEW_LINE>boolean[][] voicings = getRealizedVoicings(realizedPhones);<NEW_LINE>double[][] tscales = getRealizedTimeScales(realizedPhones);<NEW_LINE>double[]<MASK><NEW_LINE>// process into audio stream:<NEW_LINE>DDSAudioInputStream stream = (new FDPSOLAProcessor()).processDecrufted(datagrams, rightContexts, audioformat, voicings, pscales, tscales);<NEW_LINE>// update durations from processed Datagrams:<NEW_LINE>// updateUnitDataDurations(units, datagrams);<NEW_LINE>updateRealizedUnitDataDurations(realizedPhones, datagrams);<NEW_LINE>return stream;<NEW_LINE>} | [] pscales = getRealizedPitchScales(realizedPhones); |
1,304,792 | final ModifyWorkspaceAccessPropertiesResult executeModifyWorkspaceAccessProperties(ModifyWorkspaceAccessPropertiesRequest modifyWorkspaceAccessPropertiesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyWorkspaceAccessPropertiesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyWorkspaceAccessPropertiesRequest> request = null;<NEW_LINE>Response<ModifyWorkspaceAccessPropertiesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyWorkspaceAccessPropertiesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(modifyWorkspaceAccessPropertiesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "WorkSpaces");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ModifyWorkspaceAccessProperties");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ModifyWorkspaceAccessPropertiesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ModifyWorkspaceAccessPropertiesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,448,151 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>* @see com.aptana.editor.js.parsing.ast.JSTreeWalker#visit(com.aptana.editor.js.parsing.ast.JSForInNode)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void visit(JSForInNode node) {<NEW_LINE>JSNode expression = (JSNode) node.getExpression();<NEW_LINE>JSNode initializer = (JSNode) node.getInitializer();<NEW_LINE>JSNode body = (JSNode) node.getBody();<NEW_LINE>// visit the 'for' keyword<NEW_LINE>int declarationEndOffset = node.getStartingOffset() + 2;<NEW_LINE>pushCommonDeclaration(node, declarationEndOffset, null);<NEW_LINE>// visit the elements in the parentheses<NEW_LINE>int openParen = locateCharForward(document, '(', node.getLeftParenthesis().getStart());<NEW_LINE>int closeParen = locateCharBackward(document, ')', node.<MASK><NEW_LINE>FormatterJSParenthesesNode parenthesesNode = new FormatterJSParenthesesNode(document, TypeBracket.LOOP_PARENTHESIS);<NEW_LINE>parenthesesNode.setBegin(createTextNode(document, openParen, openParen + 1));<NEW_LINE>push(parenthesesNode);<NEW_LINE>// push the expression<NEW_LINE>initializer.accept(this);<NEW_LINE>// add the 'in' node (it's between the initializer and the expression)<NEW_LINE>int inStart = node.getIn().getStart();<NEW_LINE>visitTextNode(inStart, inStart + 2, true, 1, 1, false);<NEW_LINE>// push the expression.<NEW_LINE>expression.accept(this);<NEW_LINE>// close the parentheses node.<NEW_LINE>checkedPop(parenthesesNode, closeParen);<NEW_LINE>parenthesesNode.setEnd(createTextNode(document, closeParen, closeParen + 1));<NEW_LINE>// in case we have a 'body', visit it.<NEW_LINE>body.accept(this);<NEW_LINE>} | getRightParenthesis().getStart()); |
739,592 | public ObjectNode detail(HttpServletRequest request) throws Exception {<NEW_LINE>String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID);<NEW_LINE>String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME);<NEW_LINE>NamingUtils.checkServiceNameFormat(serviceName);<NEW_LINE>String cluster = WebUtils.optional(request, CommonParams.CLUSTER_NAME, UtilsAndCommons.DEFAULT_CLUSTER_NAME);<NEW_LINE>String ip = WebUtils.required(request, "ip");<NEW_LINE>int port = Integer.parseInt(WebUtils.required(request, "port"));<NEW_LINE>com.alibaba.nacos.api.naming.pojo.Instance instance = getInstanceOperator().getInstance(namespaceId, serviceName, cluster, ip, port);<NEW_LINE>ObjectNode result = JacksonUtils.createEmptyJsonNode();<NEW_LINE><MASK><NEW_LINE>result.put("ip", ip);<NEW_LINE>result.put("port", port);<NEW_LINE>result.put("clusterName", cluster);<NEW_LINE>result.put("weight", instance.getWeight());<NEW_LINE>result.put("healthy", instance.isHealthy());<NEW_LINE>result.put("instanceId", instance.getInstanceId());<NEW_LINE>result.set(METADATA, JacksonUtils.transferToJsonNode(instance.getMetadata()));<NEW_LINE>return result;<NEW_LINE>} | result.put("service", serviceName); |
195,795 | private String addWorkflowStep(DotConnect dc, String schemeID, String stepName, String order, String resolved, String escalationEnabled) throws DotDataException, SQLException {<NEW_LINE>dc.setSQL("SELECT id FROM workflow_step WHERE scheme_id = ? AND name = '" + stepName + "'");<NEW_LINE>dc.addParam(schemeID);<NEW_LINE>List<Map<<MASK><NEW_LINE>results = dc.loadResults();<NEW_LINE>String stepID = null;<NEW_LINE>if (results != null && results.size() > 0) {<NEW_LINE>stepID = results.get(0).get("id");<NEW_LINE>} else {<NEW_LINE>stepID = UUIDGenerator.generateUuid();<NEW_LINE>dc.executeStatement(// id<NEW_LINE>"insert into workflow_step (id, name, scheme_id, my_order, resolved, escalation_enable, escalation_action, escalation_time) " + "values ('" + stepID + "'," + " '" + // name<NEW_LINE>stepName + "'," + " '" + // scheme_id<NEW_LINE>schemeID + "'," + " " + // my_order<NEW_LINE>order + "," + // resolved<NEW_LINE>resolved + "," + // escalation_enable<NEW_LINE>escalationEnabled + // escalation_action<NEW_LINE>"," + // escalation_time<NEW_LINE>" null," + " 0) ");<NEW_LINE>}<NEW_LINE>return stepID;<NEW_LINE>} | String, String>> results = null; |
1,001,960 | public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) throws Exception {<NEW_LINE>checkSyntax(iRequest.<MASK><NEW_LINE>iRequest.getData().commandInfo = "Import database";<NEW_LINE>try {<NEW_LINE>final String url = iRequest.getContent();<NEW_LINE>final String name = getDbName(url);<NEW_LINE>if (name != null) {<NEW_LINE>if (server.getContext().exists(name)) {<NEW_LINE>throw new ODatabaseException("Database named '" + name + "' already exists: ");<NEW_LINE>} else {<NEW_LINE>final URL uri = new URL(url);<NEW_LINE>final URLConnection conn = uri.openConnection();<NEW_LINE>conn.setRequestProperty("User-Agent", "OrientDB-Studio");<NEW_LINE>conn.setDefaultUseCaches(false);<NEW_LINE>server.getDatabases().networkRestore(name, conn.getInputStream(), () -> {<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>try (ODatabaseSession session = server.getDatabases().openNoAuthorization(name)) {<NEW_LINE>}<NEW_LINE>iResponse.send(OHttpUtils.STATUS_OK_CODE, OHttpUtils.STATUS_OK_DESCRIPTION, OHttpUtils.CONTENT_TEXT_PLAIN, null, null);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Could not find database name");<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getUrl(), 1, "Syntax error: installDatabase"); |
1,195,368 | public Void methodMissing(String name, Object argsObj) {<NEW_LINE>Object[] args = (Object[]) argsObj;<NEW_LINE>if (args.length == 1 && args[0] instanceof Class<?>) {<NEW_LINE>Class<? extends I> itemType = uncheckedCast(args[0]);<NEW_LINE>create(name, itemType);<NEW_LINE>} else if (args.length == 2 && args[0] instanceof Class<?> && args[1] instanceof Closure<?>) {<NEW_LINE>Class<? extends I> itemType = uncheckedCast(args[0]);<NEW_LINE>Closure<? super I> closure = uncheckedCast(args[1]);<NEW_LINE><MASK><NEW_LINE>} else if (args.length == 1 && args[0] instanceof Closure<?>) {<NEW_LINE>Closure<? super I> closure = uncheckedCast(args[0]);<NEW_LINE>named(name, closure);<NEW_LINE>} else {<NEW_LINE>throw new MissingMethodException(name, ModelMap.class, args);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | create(name, itemType, closure); |
521,810 | public <T> Optional<ArgumentBinder<T, WebSocketState>> findArgumentBinder(Argument<T> argument, WebSocketState source) {<NEW_LINE>Optional<ArgumentBinder<T, HttpRequest<?>>> argumentBinder = requestBinderRegistry.findArgumentBinder(argument, source.getOriginatingRequest());<NEW_LINE>if (argumentBinder.isPresent()) {<NEW_LINE>ArgumentBinder<T, HttpRequest<?>> adapted = argumentBinder.get();<NEW_LINE>boolean isParameterBinder = adapted instanceof AnnotatedArgumentBinder && ((AnnotatedArgumentBinder) adapted).getAnnotationType() == QueryValue.class;<NEW_LINE>if (!isParameterBinder) {<NEW_LINE>return Optional.of((context, source1) -> adapted.bind(context, source.getOriginatingRequest()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ArgumentBinder binder = byType.get(argument.getType());<NEW_LINE>if (binder != null) {<NEW_LINE>// noinspection unchecked<NEW_LINE>return Optional.of(binder);<NEW_LINE>} else {<NEW_LINE>ConvertibleValues<Object> uriVariables = source<MASK><NEW_LINE>if (uriVariables.contains(argument.getName())) {<NEW_LINE>return Optional.of((context, s) -> () -> uriVariables.get(argument.getName(), argument));<NEW_LINE>} else {<NEW_LINE>return Optional.of((context, s) -> (ArgumentBinder.BindingResult<T>) queryValueArgumentBinder.bind((ArgumentConversionContext<Object>) context, s.getOriginatingRequest()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getSession().getUriVariables(); |
1,822,106 | // using JAX-RS providers, users need to add dependencies for implementations, see pom for an example.<NEW_LINE>@Path("/errorCodeWithHeaderJAXRS")<NEW_LINE>@POST<NEW_LINE>@ApiResponses({ @ApiResponse(code = 200, response = MultiResponse200.class, message = ""), @ApiResponse(code = 400, response = MultiResponse400.class, message = ""), @ApiResponse(code = 500, response = MultiResponse500.class, message = "") })<NEW_LINE>@ResponseHeaders({ @ResponseHeader(name = "x-code", response = String.class) })<NEW_LINE>public javax.ws.rs.core.Response errorCodeWithHeaderJAXRS(MultiRequest request) {<NEW_LINE>javax.ws.rs.core.Response response;<NEW_LINE>if (request.getCode() == 400) {<NEW_LINE>MultiResponse400 r = new MultiResponse400();<NEW_LINE>r.setCode(request.getCode());<NEW_LINE>r.setMessage(request.getMessage());<NEW_LINE>// If got many types for different status code, we can only using InvocationException for failed error code like 400-500.<NEW_LINE>// The result for Failed Family(e.g. 400-500), can not set return value as target type directly or will give exception.<NEW_LINE>response = javax.ws.rs.core.Response.status(Status.BAD_REQUEST).entity(new InvocationException(Status.BAD_REQUEST, r)).header("x-code", "400").build();<NEW_LINE>} else if (request.getCode() == 500) {<NEW_LINE>MultiResponse500 r = new MultiResponse500();<NEW_LINE>r.setCode(request.getCode());<NEW_LINE>r.setMessage(request.getMessage());<NEW_LINE>response = javax.ws.rs.core.Response.status(Status.INTERNAL_SERVER_ERROR).entity(new InvocationException(Status.INTERNAL_SERVER_ERROR, r)).header("x-code", "500").build();<NEW_LINE>} else {<NEW_LINE>MultiResponse200 r = new MultiResponse200();<NEW_LINE>r.setCode(request.getCode());<NEW_LINE>r.setMessage(request.getMessage());<NEW_LINE>// If error code is OK family(like 200), we can use the target type.<NEW_LINE>response = javax.ws.rs.core.Response.status(Status.OK).entity(r).header(<MASK><NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | "x-code", "200").build(); |
1,337,760 | final ListRestoreJobsResult executeListRestoreJobs(ListRestoreJobsRequest listRestoreJobsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listRestoreJobsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListRestoreJobsRequest> request = null;<NEW_LINE>Response<ListRestoreJobsResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ListRestoreJobsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listRestoreJobsRequest));<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, "Backup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListRestoreJobs");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListRestoreJobsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListRestoreJobsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
330,229 | public float dragToProgress(float currentProgress, int baseW, int baseH, float dx, float dy) {<NEW_LINE>if (mOnSwipe == null || mOnSwipe.mAnchorId == null) {<NEW_LINE>WidgetState w = mState.values().stream().findFirst().get();<NEW_LINE>return -dy / w.mParentHeight;<NEW_LINE>}<NEW_LINE>WidgetState base = mState.get(mOnSwipe.mAnchorId);<NEW_LINE>float[] dir = mOnSwipe.getDirection();<NEW_LINE>float[] side = mOnSwipe.getSide();<NEW_LINE>float[] motionDpDt = new float[2];<NEW_LINE>base.interpolate(baseW, baseH, currentProgress, this);<NEW_LINE>base.mMotionControl.getDpDt(currentProgress, side[0], side[1], motionDpDt);<NEW_LINE>float drag = dx * Math.abs(dir[0]) / motionDpDt[0] + dy * Math.abs(dir[<MASK><NEW_LINE>// float change = (mOnSwipe.mDragVertical) ? dy / motionDpDt[1] : dx / motionDpDt[0];<NEW_LINE>return drag;<NEW_LINE>} | 1]) / motionDpDt[1]; |
221,495 | private static void runAssertionPartitionAddRemoveListener(RegressionEnvironment env, String eplContext, String contextName) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@name('ctx') @public " + eplContext, path);<NEW_LINE>env.compileDeploy("@name('s0') context " + contextName + " select count(*) from SupportBean", path);<NEW_LINE>EPContextPartitionService api = env<MASK><NEW_LINE>String depIdCtx = env.deploymentId("ctx");<NEW_LINE>SupportContextListener[] listeners = new SupportContextListener[3];<NEW_LINE>for (int i = 0; i < listeners.length; i++) {<NEW_LINE>listeners[i] = new SupportContextListener(env);<NEW_LINE>env.runtime().getContextPartitionService().addContextPartitionStateListener(depIdCtx, contextName, listeners[i]);<NEW_LINE>}<NEW_LINE>env.sendEventBean(new SupportBean_S0(1));<NEW_LINE>for (int i = 0; i < listeners.length; i++) {<NEW_LINE>listeners[i].assertAndReset(SupportContextListenUtil.eventPartitionInitTerm(depIdCtx, contextName, ContextStateEventContextPartitionAllocated.class));<NEW_LINE>}<NEW_LINE>api.removeContextPartitionStateListener(depIdCtx, contextName, listeners[0]);<NEW_LINE>env.sendEventBean(new SupportBean_S1(1));<NEW_LINE>listeners[0].assertNotInvoked();<NEW_LINE>listeners[1].assertAndReset(SupportContextListenUtil.eventPartitionInitTerm(depIdCtx, contextName, ContextStateEventContextPartitionDeallocated.class));<NEW_LINE>listeners[2].assertAndReset(SupportContextListenUtil.eventPartitionInitTerm(depIdCtx, contextName, ContextStateEventContextPartitionDeallocated.class));<NEW_LINE>Iterator<ContextPartitionStateListener> it = api.getContextPartitionStateListeners(depIdCtx, contextName);<NEW_LINE>assertSame(listeners[1], it.next());<NEW_LINE>assertSame(listeners[2], it.next());<NEW_LINE>assertFalse(it.hasNext());<NEW_LINE>api.removeContextPartitionStateListeners(depIdCtx, contextName);<NEW_LINE>assertFalse(api.getContextPartitionStateListeners(depIdCtx, contextName).hasNext());<NEW_LINE>env.sendEventBean(new SupportBean_S0(2));<NEW_LINE>env.sendEventBean(new SupportBean_S1(2));<NEW_LINE>for (int i = 0; i < listeners.length; i++) {<NEW_LINE>listeners[i].assertNotInvoked();<NEW_LINE>}<NEW_LINE>env.undeployAll();<NEW_LINE>} | .runtime().getContextPartitionService(); |
837,870 | private void updateSegmentLineageEntryToReverted(String tableNameWithType, SegmentLineage segmentLineage, String segmentLineageEntryId, LineageEntry lineageEntry) {<NEW_LINE>// Check that all segments from 'segmentsFrom' are in ONLINE state in the external view.<NEW_LINE>Set<<MASK><NEW_LINE>Preconditions.checkArgument(onlineSegments.containsAll(lineageEntry.getSegmentsFrom()), String.format("Failed to update the lineage to be 'REVERTED'. Not all segments from 'segmentFrom' are in ONLINE state " + "in the external view. (tableName = '%s', segmentsFrom = '%s', onlineSegments = '%s'", tableNameWithType, lineageEntry.getSegmentsFrom(), onlineSegments));<NEW_LINE>// Update lineage entry<NEW_LINE>segmentLineage.updateLineageEntry(segmentLineageEntryId, new LineageEntry(lineageEntry.getSegmentsFrom(), lineageEntry.getSegmentsTo(), LineageEntryState.REVERTED, System.currentTimeMillis()));<NEW_LINE>} | String> onlineSegments = getOnlineSegmentsFromExternalView(tableNameWithType); |
1,519,066 | protected void execute(Terminal terminal, OptionSet options) throws Exception {<NEW_LINE>if (subcommands.isEmpty()) {<NEW_LINE>throw new IllegalStateException("No subcommands configured");<NEW_LINE>}<NEW_LINE>// .values(...) returns an unmodifiable list<NEW_LINE>final List<String> args = new ArrayList<>(arguments.values(options));<NEW_LINE>if (args.isEmpty()) {<NEW_LINE>throw new UserException(ExitCodes.USAGE, "Missing command");<NEW_LINE>}<NEW_LINE>String <MASK><NEW_LINE>Command subcommand = subcommands.get(subcommandName);<NEW_LINE>if (subcommand == null) {<NEW_LINE>throw new UserException(ExitCodes.USAGE, "Unknown command [" + subcommandName + "]");<NEW_LINE>}<NEW_LINE>for (final KeyValuePair pair : this.settingOption.values(options)) {<NEW_LINE>args.add("-E" + pair);<NEW_LINE>}<NEW_LINE>subcommand.mainWithoutErrorHandling(args.toArray(new String[0]), terminal);<NEW_LINE>} | subcommandName = args.remove(0); |
1,557,324 | protected Handlers createHandlers(Config config) {<NEW_LINE>LoggingOptions loggingOptions = new LoggingOptions(config);<NEW_LINE>Tracer tracer = loggingOptions.getTracer();<NEW_LINE>NetworkOptions networkOptions = new NetworkOptions(config);<NEW_LINE>HttpClient.Factory clientFactory = networkOptions.getHttpClientFactory(tracer);<NEW_LINE>BaseServerOptions serverOptions = new BaseServerOptions(config);<NEW_LINE>SecretOptions secretOptions = new SecretOptions(config);<NEW_LINE>Secret secret = secretOptions.getRegistrationSecret();<NEW_LINE>SessionMapOptions sessionsOptions = new SessionMapOptions(config);<NEW_LINE>SessionMap sessions = sessionsOptions.getSessionMap();<NEW_LINE>NewSessionQueueOptions newSessionQueueOptions = new NewSessionQueueOptions(config);<NEW_LINE>URL sessionQueueUrl = <MASK><NEW_LINE>Duration sessionRequestTimeout = newSessionQueueOptions.getSessionRequestTimeout();<NEW_LINE>ClientConfig httpClientConfig = ClientConfig.defaultConfig().baseUrl(sessionQueueUrl).readTimeout(sessionRequestTimeout);<NEW_LINE>NewSessionQueue queue = new RemoteNewSessionQueue(tracer, clientFactory.createClient(httpClientConfig), secret);<NEW_LINE>DistributorOptions distributorOptions = new DistributorOptions(config);<NEW_LINE>URL distributorUrl = fromUri(distributorOptions.getDistributorUri());<NEW_LINE>Distributor distributor = new RemoteDistributor(tracer, clientFactory, distributorUrl, secret);<NEW_LINE>GraphqlHandler graphqlHandler = new GraphqlHandler(tracer, distributor, queue, serverOptions.getExternalUri(), getServerVersion());<NEW_LINE>Routable ui = new GridUiRoute();<NEW_LINE>Router router = new Router(tracer, clientFactory, sessions, queue, distributor);<NEW_LINE>Routable routerWithSpecChecks = router.with(networkOptions.getSpecComplianceChecks());<NEW_LINE>Routable route = Route.combine(ui, routerWithSpecChecks, Route.prefix("/wd/hub").to(combine(routerWithSpecChecks)), Route.options("/graphql").to(() -> graphqlHandler), Route.post("/graphql").to(() -> graphqlHandler));<NEW_LINE>UsernameAndPassword uap = secretOptions.getServerAuthentication();<NEW_LINE>if (uap != null) {<NEW_LINE>LOG.info("Requiring authentication to connect");<NEW_LINE>route = route.with(new BasicAuthenticationFilter(uap.username(), uap.password()));<NEW_LINE>}<NEW_LINE>HttpHandler readinessCheck = req -> {<NEW_LINE>boolean ready = router.isReady();<NEW_LINE>return new HttpResponse().setStatus(ready ? HTTP_OK : HTTP_UNAVAILABLE).setContent(Contents.utf8String("Router is " + ready));<NEW_LINE>};<NEW_LINE>// Since k8s doesn't make it easy to do an authenticated liveness probe, allow unauthenticated access to it.<NEW_LINE>Routable routeWithLiveness = Route.combine(route, get("/readyz").to(() -> readinessCheck));<NEW_LINE>return new Handlers(routeWithLiveness, new ProxyWebsocketsIntoGrid(clientFactory, sessions));<NEW_LINE>} | fromUri(newSessionQueueOptions.getSessionQueueUri()); |
1,502,501 | public int compareTo(Node other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.<MASK><NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetNodeId(), other.isSetNodeId());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetNodeId()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nodeId, other.nodeId);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetDomainId(), other.isSetDomainId());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetDomainId()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.domainId, other.domainId);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetHostname(), other.isSetHostname());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetHostname()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostname, other.hostname);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetPort(), other.isSetPort());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetPort()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.port, other.port);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | getClass().getName()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.