idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,270,631 | public DvmObject<?> toReflectedMethod(BaseVM vm, DvmClass dvmClass, DvmMethod dvmMethod) {<NEW_LINE>try {<NEW_LINE>Class<?> clazz = classLoader.<MASK><NEW_LINE>List<Class<?>> classes = new ArrayList<>(10);<NEW_LINE>ProxyUtils.parseMethodArgs(dvmMethod, classes, clazz.getClassLoader());<NEW_LINE>Class<?>[] types = classes.toArray(new Class[0]);<NEW_LINE>Member method = ProxyUtils.matchMethodTypes(clazz, dvmMethod.getMethodName(), types, dvmMethod.isStatic());<NEW_LINE>if (method instanceof Method) {<NEW_LINE>return ProxyDvmObject.createObject(vm, new ProxyReflectedMethod((Method) method));<NEW_LINE>} else {<NEW_LINE>return ProxyDvmObject.createObject(vm, new ProxyReflectedConstructor((Constructor<?>) method));<NEW_LINE>}<NEW_LINE>} catch (ClassNotFoundException | NoSuchMethodException e) {<NEW_LINE>log.warn("toReflectedMethod", e);<NEW_LINE>}<NEW_LINE>return super.toReflectedMethod(vm, dvmClass, dvmMethod);<NEW_LINE>} | loadClass(dvmClass.getName()); |
1,758,817 | private void measure(HttpServletResponse httpResponse, HttpServletRequest httpReq, Duration duration, PageConfig config) {<NEW_LINE>String category;<NEW_LINE>category = getCategory(httpReq, config);<NEW_LINE>Timer categoryTimer = Timer.builder("requests.latency").tags("category", category, "code", String.valueOf(httpResponse.getStatus())).register(Metrics.getPrometheusRegistry());<NEW_LINE>categoryTimer.record(duration);<NEW_LINE>SearchHelper helper = (SearchHelper) config.getRequestAttribute(SearchHelper.REQUEST_ATTR);<NEW_LINE><MASK><NEW_LINE>if (helper != null && registry != null) {<NEW_LINE>if (helper.getHits() == null || helper.getHits().length == 0) {<NEW_LINE>Timer.builder("search.latency").tags("category", "ui", "outcome", "empty").register(registry).record(duration);<NEW_LINE>} else {<NEW_LINE>Timer.builder("search.latency").tags("category", "ui", "outcome", "success").register(registry).record(duration);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | MeterRegistry registry = Metrics.getRegistry(); |
299,579 | public AndroidDeployInfo readDeployInfoProtoForTarget(Label target, BuildResultHelper buildResultHelper, Predicate<String> pathFilter) throws GetDeployInfoException {<NEW_LINE>ImmutableList<File> deployInfoFiles;<NEW_LINE>try {<NEW_LINE>deployInfoFiles = BlazeArtifact.getLocalFiles(buildResultHelper.getBuildArtifactsForTarget(target, pathFilter));<NEW_LINE>} catch (GetArtifactsException e) {<NEW_LINE>throw new GetDeployInfoException(e.getMessage());<NEW_LINE>}<NEW_LINE>if (deployInfoFiles.isEmpty()) {<NEW_LINE>Logger log = Logger.getInstance(BlazeApkDeployInfoProtoHelper.class.getName());<NEW_LINE>try {<NEW_LINE>ParsedBepOutput bepOutput = buildResultHelper.getBuildOutput();<NEW_LINE>log.warn("Local execroot: " + bepOutput.getLocalExecRoot());<NEW_LINE>log.warn("All output artifacts:");<NEW_LINE>for (OutputArtifact outputArtifact : bepOutput.getAllOutputArtifacts(path -> true)) {<NEW_LINE>log.warn(outputArtifact.getKey() + " -> " + outputArtifact.getRelativePath());<NEW_LINE>}<NEW_LINE>log.warn("All local artifacts for " + target + ":");<NEW_LINE>List<OutputArtifact> allBuildArtifacts = buildResultHelper.getBuildArtifactsForTarget(target, path -> true);<NEW_LINE>List<File> allLocalFiles = BlazeArtifact.getLocalFiles(allBuildArtifacts);<NEW_LINE>for (File file : allLocalFiles) {<NEW_LINE>String path = file.getPath();<NEW_LINE>log.warn(path);<NEW_LINE>if (pathFilter.test(path)) {<NEW_LINE>log.warn("Note: " + path + " passes pathFilter but was not recognized!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (GetArtifactsException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>throw new GetDeployInfoException("No deploy info proto artifact found. Was android_deploy_info in the output groups?");<NEW_LINE>}<NEW_LINE>if (deployInfoFiles.size() > 1) {<NEW_LINE>throw new GetDeployInfoException("More than one deploy info proto artifact found: " + deployInfoFiles.stream().map(File::getPath).collect(Collectors.joining(", ", "[", "]")));<NEW_LINE>}<NEW_LINE>try (InputStream inputStream = new FileInputStream(deployInfoFiles.get(0))) {<NEW_LINE>return AndroidDeployInfo.parseFrom(inputStream);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new GetDeployInfoException(e.getMessage());<NEW_LINE>}<NEW_LINE>} | log.warn("Error occured when gathering logs:", e); |
1,748,898 | public static long CreateWindowEx(@NativeType("DWORD") int dwExStyle, @Nullable @NativeType("LPCTSTR") CharSequence lpClassName, @Nullable @NativeType("LPCTSTR") CharSequence lpWindowName, @NativeType("DWORD") int dwStyle, int x, int y, int nWidth, int nHeight, @NativeType("HWND") long hWndParent, @NativeType("HMENU") long hMenu, @NativeType("HINSTANCE") long hInstance, @NativeType("LPVOID") long lpParam) {<NEW_LINE>MemoryStack stack = stackGet();<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>stack.nUTF16Safe(lpClassName, true);<NEW_LINE>long lpClassNameEncoded = lpClassName == null ? NULL : stack.getPointerAddress();<NEW_LINE>stack.nUTF16Safe(lpWindowName, true);<NEW_LINE>long lpWindowNameEncoded = lpWindowName == null ? NULL : stack.getPointerAddress();<NEW_LINE>return nCreateWindowEx(dwExStyle, lpClassNameEncoded, lpWindowNameEncoded, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);<NEW_LINE>} finally {<NEW_LINE>stack.setPointer(stackPointer);<NEW_LINE>}<NEW_LINE>} | int stackPointer = stack.getPointer(); |
1,657,762 | public Publisher<Collection<ServiceDiscovererEvent<R>>> discover(final U ignoredAddress) {<NEW_LINE>return newGroup.filter(new Predicate<PSDE>() {<NEW_LINE><NEW_LINE>// Use a mutable Count to avoid boxing-unboxing and put on each call.<NEW_LINE>private final Map<R, MutableInt> addressCount = new HashMap<>();<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean test(PSDE evt) {<NEW_LINE>if (EXPIRED.equals(evt.status())) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>MutableInt counter = addressCount.computeIfAbsent(evt.address()<MASK><NEW_LINE>boolean acceptEvent;<NEW_LINE>if (UNAVAILABLE.equals(evt.status())) {<NEW_LINE>acceptEvent = --counter.value == 0;<NEW_LINE>if (acceptEvent) {<NEW_LINE>// If address is unavailable and no more add events are pending stop tracking and<NEW_LINE>// close partition.<NEW_LINE>addressCount.remove(evt.address());<NEW_LINE>if (addressCount.isEmpty()) {<NEW_LINE>// closeNow will subscribe to closeAsync() so we do not have to here.<NEW_LINE>partition.closeNow();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>acceptEvent = ++counter.value == 1;<NEW_LINE>}<NEW_LINE>return acceptEvent;<NEW_LINE>}<NEW_LINE>}).beforeFinally(partition::closeNow).map(Collections::singletonList);<NEW_LINE>} | , __ -> new MutableInt()); |
895,846 | public final ConstantContext constant() throws RecognitionException {<NEW_LINE>ConstantContext _localctx = new ConstantContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 540, RULE_constant);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>setState(5527);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>switch(getInterpreter().adaptivePredict(_input, 805, _ctx)) {<NEW_LINE>case 1:<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(5515);<NEW_LINE>stringLiteral();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>enterOuterAlt(_localctx, 2);<NEW_LINE>{<NEW_LINE>setState(5516);<NEW_LINE>decimalLiteral();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>enterOuterAlt(_localctx, 3);<NEW_LINE>{<NEW_LINE>setState(5517);<NEW_LINE>match(MINUS);<NEW_LINE>setState(5518);<NEW_LINE>decimalLiteral();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>enterOuterAlt(_localctx, 4);<NEW_LINE>{<NEW_LINE>setState(5519);<NEW_LINE>hexadecimalLiteral();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>enterOuterAlt(_localctx, 5);<NEW_LINE>{<NEW_LINE>setState(5520);<NEW_LINE>booleanLiteral();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 6:<NEW_LINE>enterOuterAlt(_localctx, 6);<NEW_LINE>{<NEW_LINE>setState(5521);<NEW_LINE>match(REAL_LITERAL);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 7:<NEW_LINE>enterOuterAlt(_localctx, 7);<NEW_LINE>{<NEW_LINE>setState(5522);<NEW_LINE>match(BIT_STRING);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case 8:<NEW_LINE>enterOuterAlt(_localctx, 8);<NEW_LINE>{<NEW_LINE>setState(5524);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (_la == NOT) {<NEW_LINE>{<NEW_LINE>setState(5523);<NEW_LINE>match(NOT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(5526);<NEW_LINE>((ConstantContext) _localctx).nullLiteral = _input.LT(1);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (!(_la == NULL_LITERAL || _la == NULL_SPEC_LITERAL)) {<NEW_LINE>((ConstantContext) _localctx).nullLiteral = (Token) _errHandler.recoverInline(this);<NEW_LINE>} else {<NEW_LINE>if (_input.LA(1) == Token.EOF)<NEW_LINE>matchedEOF = true;<NEW_LINE>_errHandler.reportMatch(this);<NEW_LINE>consume();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE><MASK><NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _errHandler.reportError(this, re); |
1,834,624 | Query applyExecutionState(ExecutionStateGlobalOverride state) {<NEW_LINE>if (state == null || !state.hasValues()) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>if (state.timerange().isPresent() || state.query().isPresent() || !state.searchTypes().isEmpty() || !state.keepSearchTypes().isEmpty()) {<NEW_LINE>final Builder builder = toBuilder();<NEW_LINE>if (state.timerange().isPresent() || state.query().isPresent()) {<NEW_LINE>final GlobalOverride.Builder globalOverrideBuilder = globalOverride().map(GlobalOverride::toBuilder).orElseGet(GlobalOverride::builder);<NEW_LINE>state.timerange().ifPresent(timeRange -> {<NEW_LINE>globalOverrideBuilder.timerange(timeRange);<NEW_LINE>builder.timerange(timeRange);<NEW_LINE>});<NEW_LINE>state.query().ifPresent(query -> {<NEW_LINE>globalOverrideBuilder.query(query);<NEW_LINE>builder.query(query);<NEW_LINE>});<NEW_LINE>builder.globalOverride(globalOverrideBuilder.build());<NEW_LINE>}<NEW_LINE>if (!state.searchTypes().isEmpty() || !state.keepSearchTypes().isEmpty()) {<NEW_LINE>final Set<SearchType> searchTypesToKeep = !state.keepSearchTypes().isEmpty() ? filterForWhiteListFromState(searchTypes(<MASK><NEW_LINE>final Set<SearchType> searchTypesWithOverrides = applyAvailableOverrides(state, searchTypesToKeep);<NEW_LINE>builder.searchTypes(ImmutableSet.copyOf(searchTypesWithOverrides));<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | ), state) : searchTypes(); |
869,064 | final UpdateDomainNameResult executeUpdateDomainName(UpdateDomainNameRequest updateDomainNameRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateDomainNameRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateDomainNameRequest> request = null;<NEW_LINE>Response<UpdateDomainNameResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateDomainNameRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateDomainNameRequest));<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, "ApiGatewayV2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateDomainName");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateDomainNameResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateDomainNameResultJsonUnmarshaller());<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.ADVANCED_CONFIG, advancedConfig); |
1,707,889 | private VoiceStateData saveOrRemoveVoiceState(long guildId, VoiceStateData voiceState) {<NEW_LINE>Long2 voiceStateId = new Long2(guildId, voiceState.userId().asLong());<NEW_LINE>GuildContent guildContent = computeGuildContent(guildId);<NEW_LINE>if (voiceState.channelId().isPresent()) {<NEW_LINE>guildContent.voiceStateIds.add(voiceStateId);<NEW_LINE>computeChannelContent(voiceState.channelId().get().asLong()).voiceStateIds.add(voiceStateId);<NEW_LINE>return voiceStates.put(voiceStateId, ImmutableVoiceStateData.copyOf(voiceState).withGuildId(guildId).withMember(Possible.absent()));<NEW_LINE>} else {<NEW_LINE>guildContent.voiceStateIds.remove(voiceStateId);<NEW_LINE>VoiceStateData <MASK><NEW_LINE>if (old != null && old.channelId().isPresent()) {<NEW_LINE>computeChannelContent(old.channelId().get().asLong()).voiceStateIds.remove(voiceStateId);<NEW_LINE>}<NEW_LINE>return old;<NEW_LINE>}<NEW_LINE>} | old = voiceStates.remove(voiceStateId); |
811,906 | public OResultSet executeSimple(OCommandContext ctx) {<NEW_LINE>OInternalResultSet rs = new OInternalResultSet();<NEW_LINE>ODatabaseSession db = (ODatabaseSession) ctx.getDatabase();<NEW_LINE>OSecurityInternal security = ((ODatabaseInternal) db).getSharedContext().getSecurity();<NEW_LINE>ORole role = db.getMetadata().getSecurity().getRole(name.getStringValue());<NEW_LINE>if (role == null) {<NEW_LINE>throw new OCommandExecutionException("role not found: " + name.getStringValue());<NEW_LINE>}<NEW_LINE>for (Op op : operations) {<NEW_LINE>OResultInternal result = new OResultInternal();<NEW_LINE>result.setProperty("operation", "alter role");<NEW_LINE>result.setProperty("name", name.getStringValue());<NEW_LINE>result.setProperty("resource", op.resource.toString());<NEW_LINE>if (op.type == Op.TYPE_ADD) {<NEW_LINE>OSecurityPolicyImpl policy = security.getSecurityPolicy(db, op.policyName.getStringValue());<NEW_LINE><MASK><NEW_LINE>result.setProperty("policyName", op.policyName.getStringValue());<NEW_LINE>try {<NEW_LINE>security.setSecurityPolicy(db, role, op.resource.toString(), policy);<NEW_LINE>result.setProperty("result", "OK");<NEW_LINE>} catch (Exception e) {<NEW_LINE>result.setProperty("result", "failure");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>result.setProperty("operation", "REMOVE POLICY");<NEW_LINE>try {<NEW_LINE>security.removeSecurityPolicy(db, role, op.resource.toString());<NEW_LINE>result.setProperty("result", "OK");<NEW_LINE>} catch (Exception e) {<NEW_LINE>result.setProperty("result", "failure");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>rs.add(result);<NEW_LINE>}<NEW_LINE>return rs;<NEW_LINE>} | result.setProperty("operation", "ADD POLICY"); |
425,399 | void fillArray(final char[] array) {<NEW_LINE>int pos = 0;<NEW_LINE>if (BufferUtil.isBackedBySimpleArray(bitmap)) {<NEW_LINE>long[] b = bitmap.array();<NEW_LINE>int base = 0;<NEW_LINE>for (int k = 0; k < b.length; ++k) {<NEW_LINE>long bitset = b[k];<NEW_LINE>while (bitset != 0) {<NEW_LINE>array[pos++] = (char) (base + numberOfTrailingZeros(bitset));<NEW_LINE>bitset &= (bitset - 1);<NEW_LINE>}<NEW_LINE>base += 64;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>int len <MASK><NEW_LINE>int base = 0;<NEW_LINE>for (int k = 0; k < len; ++k) {<NEW_LINE>long bitset = bitmap.get(k);<NEW_LINE>while (bitset != 0) {<NEW_LINE>array[pos++] = (char) (base + numberOfLeadingZeros(bitset));<NEW_LINE>bitset &= (bitset - 1);<NEW_LINE>}<NEW_LINE>base += 64;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = this.bitmap.limit(); |
181,850 | public boolean process(Person person, long time) {<NEW_LINE>ThreadLocal<ExpressionProcessor> expProcessor = getExpProcessor();<NEW_LINE>if (expProcessor.get() != null) {<NEW_LINE>value = expProcessor.get().evaluate(person, time);<NEW_LINE>} else if (range != null) {<NEW_LINE>value = person.rand(range.low, <MASK><NEW_LINE>} else if (seriesData != null) {<NEW_LINE>String[] items = seriesData.split(" ");<NEW_LINE>TimeSeriesData data = new TimeSeriesData(items.length, period);<NEW_LINE>for (int i = 0; i < items.length; i++) {<NEW_LINE>try {<NEW_LINE>data.addValue(Double.parseDouble(items[i]));<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>throw new RuntimeException("unable to parse \"" + items[i] + "\" in SetAttribute state for \"" + attribute + "\"", nfe);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>value = data;<NEW_LINE>} else if (distribution != null) {<NEW_LINE>value = distribution.generate(person);<NEW_LINE>} else if (valueCode != null) {<NEW_LINE>value = valueCode;<NEW_LINE>} else if (valueAttribute != null) {<NEW_LINE>// the module is setting an attribute to be the value of an existing attribute<NEW_LINE>if (person.attributes.containsKey(valueAttribute)) {<NEW_LINE>value = person.attributes.get(valueAttribute);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (value != null) {<NEW_LINE>person.attributes.put(attribute, value);<NEW_LINE>} else if (person.attributes.containsKey(attribute)) {<NEW_LINE>// intentionally clear out the variable<NEW_LINE>person.attributes.remove(attribute);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | range.high, range.decimals); |
1,762,093 | private Handler<Promise<Object>> executeHandler(final Optional<AuthenticationService> authenticationService, final ServerWebSocket websocket, final String payload, final Optional<User> user, final Collection<String> noAuthApiMethods) {<NEW_LINE>return future -> {<NEW_LINE>final String json = payload.trim();<NEW_LINE>if (!json.isEmpty() && json.charAt(0) == '{') {<NEW_LINE>try {<NEW_LINE>handleSingleRequest(authenticationService, websocket, user, future, getRequest(payload), noAuthApiMethods);<NEW_LINE>} catch (final IllegalArgumentException | DecodeException e) {<NEW_LINE>LOG.debug("Error mapping json to WebSocketRpcRequest", e);<NEW_LINE>future.complete(new JsonRpcErrorResponse(null, JsonRpcError.INVALID_REQUEST));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else if (json.length() == 0) {<NEW_LINE>future.complete(errorResponse(null, INVALID_REQUEST));<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>final <MASK><NEW_LINE>if (jsonArray.size() < 1) {<NEW_LINE>future.complete(errorResponse(null, INVALID_REQUEST));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// handle batch request<NEW_LINE>LOG.debug("batch request size {}", jsonArray.size());<NEW_LINE>handleJsonBatchRequest(authenticationService, websocket, jsonArray, user, noAuthApiMethods);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | JsonArray jsonArray = new JsonArray(json); |
1,263,853 | private static void tryAssertsVariant(RegressionEnvironment env, String stmtText, EPStatementObjectModel model, String typeName) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>// Attach listener to feed<NEW_LINE>if (model != null) {<NEW_LINE>model.setAnnotations(Arrays.asList(AnnotationPart.nameAnnotation("fl"), new AnnotationPart("public")));<NEW_LINE>env.compileDeploy(model, path);<NEW_LINE>} else {<NEW_LINE>env.compileDeploy("@name('fl') @public " + stmtText, path);<NEW_LINE>}<NEW_LINE>env.addListener("fl");<NEW_LINE>// send event for joins to match on<NEW_LINE>env.sendEventBean(new SupportBean_A("myId"));<NEW_LINE>// Attach delta statement to statement and add listener<NEW_LINE>stmtText = "@name('rld') select MIN(delta) as minD, max(delta) as maxD " + "from " + typeName + "#time(60)";<NEW_LINE>env.compileDeploy(stmtText, path).addListener("rld");<NEW_LINE>// Attach prodict statement to statement and add listener<NEW_LINE>stmtText = "@name('rlp') select min(product) as minP, max(product) as maxP " + "from " + typeName + "#time(60)";<NEW_LINE>env.compileDeploy(stmtText, path).addListener("rlp");<NEW_LINE>// Set the time to 0 seconds<NEW_LINE>env.advanceTime(0);<NEW_LINE>// send events<NEW_LINE>sendEvent(env, 20, 10);<NEW_LINE>assertReceivedFeed(env, 10, 200);<NEW_LINE>assertReceivedMinMax(env, 10, 10, 200, 200);<NEW_LINE>sendEvent(env, 50, 25);<NEW_LINE>assertReceivedFeed(env, 25, 25 * 50);<NEW_LINE>assertReceivedMinMax(env, 10, 25, 200, 1250);<NEW_LINE><MASK><NEW_LINE>assertReceivedFeed(env, 3, 2 * 5);<NEW_LINE>assertReceivedMinMax(env, 3, 25, 10, 1250);<NEW_LINE>// Set the time to 10 seconds<NEW_LINE>env.advanceTime(10 * 1000);<NEW_LINE>sendEvent(env, 13, 1);<NEW_LINE>assertReceivedFeed(env, 12, 13);<NEW_LINE>assertReceivedMinMax(env, 3, 25, 10, 1250);<NEW_LINE>// Set the time to 61 seconds<NEW_LINE>env.advanceTime(61 * 1000);<NEW_LINE>assertReceivedMinMax(env, 12, 12, 13, 13);<NEW_LINE>} | sendEvent(env, 5, 2); |
691,103 | static StringBuilder extractQueryParams(AnnotatedMethod method) throws SecurityException {<NEW_LINE>// append query parameters<NEW_LINE>StringBuilder querySubString = new StringBuilder();<NEW_LINE>int parameterIndex = 0;<NEW_LINE>for (Annotation[] paramAnns : method.getParameterAnnotations()) {<NEW_LINE>for (Annotation ann : paramAnns) {<NEW_LINE>if (Objects.equals(ann.annotationType(), QueryParam.class)) {<NEW_LINE>querySubString.append(((QueryParam) ann).value());<NEW_LINE>querySubString.append(',');<NEW_LINE>}<NEW_LINE>if (Objects.equals(ann.annotationType(), BeanParam.class)) {<NEW_LINE>Class<?> beanParamType = method.getParameterTypes()[parameterIndex];<NEW_LINE>Field[] fields = beanParamType.getFields();<NEW_LINE>for (Field field : fields) {<NEW_LINE>QueryParam queryParam = <MASK><NEW_LINE>if (queryParam != null) {<NEW_LINE>querySubString.append(queryParam.value());<NEW_LINE>querySubString.append(',');<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Method[] beanMethods = beanParamType.getMethods();<NEW_LINE>for (Method beanMethod : beanMethods) {<NEW_LINE>QueryParam queryParam = beanMethod.getAnnotation(QueryParam.class);<NEW_LINE>if (queryParam != null) {<NEW_LINE>querySubString.append(queryParam.value());<NEW_LINE>querySubString.append(',');<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>parameterIndex++;<NEW_LINE>}<NEW_LINE>return querySubString;<NEW_LINE>} | field.getAnnotation(QueryParam.class); |
1,583,171 | @DELETE<NEW_LINE>@Path("{name}")<NEW_LINE>public Response deleteSecretSeries(@Auth AutomationClient automationClient, @PathParam("name") String name) {<NEW_LINE>Secret secret = secretController.getSecretByName(name).orElseThrow(() -> new NotFoundException("Secret series not found."));<NEW_LINE>// Get the groups for this secret so they can be restored manually if necessary<NEW_LINE>Set<String> groups = aclDAO.getGroupsFor(secret).stream().map(Group::getName).collect(toSet());<NEW_LINE>secretDAO.deleteSecretsByName(name);<NEW_LINE>// Record the deletion in the audit log<NEW_LINE>Map<String, String> extraInfo = new HashMap<>();<NEW_LINE>extraInfo.put("groups", groups.toString());<NEW_LINE>extraInfo.put("current version", secret.getVersion().toString());<NEW_LINE>auditLog.recordEvent(new Event(Instant.now(), EventTag.SECRET_DELETE, automationClient.getName(), name, extraInfo));<NEW_LINE>return Response<MASK><NEW_LINE>} | .noContent().build(); |
107,291 | final DescribeAcceleratorTypesResult executeDescribeAcceleratorTypes(DescribeAcceleratorTypesRequest describeAcceleratorTypesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAcceleratorTypesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAcceleratorTypesRequest> request = null;<NEW_LINE>Response<DescribeAcceleratorTypesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAcceleratorTypesRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Elastic Inference");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAcceleratorTypes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAcceleratorTypesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeAcceleratorTypesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(describeAcceleratorTypesRequest)); |
1,676,584 | public boolean visit(SQLReplaceStatement x) {<NEW_LINE>print0(ucase ? "MERGE INTO " : "merge into ");<NEW_LINE><MASK><NEW_LINE>List<SQLExpr> columns = x.getColumns();<NEW_LINE>if (columns.size() > 0) {<NEW_LINE>print0(ucase ? " KEY (" : " key (");<NEW_LINE>for (int i = 0, size = columns.size(); i < size; ++i) {<NEW_LINE>if (i != 0) {<NEW_LINE>print0(", ");<NEW_LINE>}<NEW_LINE>SQLExpr columnn = columns.get(i);<NEW_LINE>printExpr(columnn, parameterized);<NEW_LINE>}<NEW_LINE>print(')');<NEW_LINE>}<NEW_LINE>List<SQLInsertStatement.ValuesClause> valuesClauseList = x.getValuesList();<NEW_LINE>if (valuesClauseList.size() != 0) {<NEW_LINE>println();<NEW_LINE>print0(ucase ? "VALUES " : "values ");<NEW_LINE>int size = valuesClauseList.size();<NEW_LINE>if (size == 0) {<NEW_LINE>print0("()");<NEW_LINE>} else {<NEW_LINE>for (int i = 0; i < size; ++i) {<NEW_LINE>if (i != 0) {<NEW_LINE>print0(", ");<NEW_LINE>}<NEW_LINE>visit(valuesClauseList.get(i));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SQLQueryExpr query = x.getQuery();<NEW_LINE>if (query != null) {<NEW_LINE>visit(query);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | printTableSourceExpr(x.getTableName()); |
637,774 | final GetProtectionStatusResult executeGetProtectionStatus(GetProtectionStatusRequest getProtectionStatusRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getProtectionStatusRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetProtectionStatusRequest> request = null;<NEW_LINE>Response<GetProtectionStatusResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetProtectionStatusRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getProtectionStatusRequest));<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, "FMS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetProtectionStatus");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetProtectionStatusResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new GetProtectionStatusResultJsonUnmarshaller()); |
119,485 | final DeleteWorldTemplateResult executeDeleteWorldTemplate(DeleteWorldTemplateRequest deleteWorldTemplateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteWorldTemplateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteWorldTemplateRequest> request = null;<NEW_LINE>Response<DeleteWorldTemplateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteWorldTemplateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteWorldTemplateRequest));<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, "RoboMaker");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWorldTemplate");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteWorldTemplateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new DeleteWorldTemplateResultJsonUnmarshaller()); |
1,713,571 | private void reap() {<NEW_LINE>try (Stream<Path> stream = Files.list(inputDir)) {<NEW_LINE>final List<Path> inputFiles = stream.filter(p -> p.getFileName().toString().endsWith(".cmd")).collect(Collectors.toList());<NEW_LINE>for (Path inputFile : inputFiles) {<NEW_LINE>System.out.println("Process file: " + inputFile);<NEW_LINE>String line = Files.readString(inputFile);<NEW_LINE>System.out.println("Running command: " + line);<NEW_LINE>String[] <MASK><NEW_LINE>Process process = Runtime.getRuntime().exec(command);<NEW_LINE>int ret = process.waitFor();<NEW_LINE>System.out.print("Stdout: ");<NEW_LINE>process.getInputStream().transferTo(System.out);<NEW_LINE>System.out.print("\nStderr: ");<NEW_LINE>process.getErrorStream().transferTo(System.out);<NEW_LINE>// end the stream<NEW_LINE>System.out.println();<NEW_LINE>if (ret != 0) {<NEW_LINE>logFailure("Command [" + line + "] failed with exit code " + ret, null);<NEW_LINE>} else {<NEW_LINE>delete(inputFile);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logFailure("Failed to reap inputs", e);<NEW_LINE>}<NEW_LINE>} | command = line.split(" "); |
897,157 | public DeleteThingGroupResult deleteThingGroup(DeleteThingGroupRequest deleteThingGroupRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteThingGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteThingGroupRequest> request = null;<NEW_LINE>Response<DeleteThingGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteThingGroupRequestMarshaller().marshall(deleteThingGroupRequest);<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<DeleteThingGroupResult, <MASK><NEW_LINE>JsonResponseHandler<DeleteThingGroupResult> responseHandler = new JsonResponseHandler<DeleteThingGroupResult>(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 DeleteThingGroupResultJsonUnmarshaller(); |
424,290 | public synchronized void join(UUID userId) {<NEW_LINE>UUID playerId = userPlayerMap.get(userId);<NEW_LINE>if (playerId == null) {<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>managerFactory.userManager().getUser(userId).ifPresent(user -> logger.debug(user.getName() + " shows tournament panel tournamentId: " + tournament.getId()));<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (tournamentSessions.containsKey(playerId)) {<NEW_LINE>logger.debug("player reopened tournament panel userId: " + userId + " tournamentId: " + tournament.getId());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// first join of player<NEW_LINE>TournamentSession tournamentSession = new TournamentSession(managerFactory, tournament, userId, tableId, playerId);<NEW_LINE>tournamentSessions.put(playerId, tournamentSession);<NEW_LINE>Optional<User> _user = managerFactory.userManager().getUser(userId);<NEW_LINE>if (_user.isPresent()) {<NEW_LINE>User user = _user.get();<NEW_LINE>user.addTournament(playerId, tournament.getId());<NEW_LINE>TournamentPlayer player = tournament.getPlayer(playerId);<NEW_LINE>player.setJoined();<NEW_LINE>logger.debug("player " + player.getPlayer().getName() + <MASK><NEW_LINE>managerFactory.chatManager().broadcast(chatId, "", player.getPlayer().getLogName() + " has joined the tournament", MessageColor.BLACK, true, null, MessageType.STATUS, null);<NEW_LINE>checkStart();<NEW_LINE>} else {<NEW_LINE>logger.error("User not found userId: " + userId + " tournamentId: " + tournament.getId());<NEW_LINE>}<NEW_LINE>} | " - client has joined tournament " + tournament.getId()); |
1,627,571 | private void process(File[] files, File outputRoot, File outputDir, LinkedHashMap<File, ArrayList<Entry>> dirToEntries, int depth) {<NEW_LINE>// Store empty entries for every directory.<NEW_LINE>for (File file : files) {<NEW_LINE>File dir = file.getParentFile();<NEW_LINE>ArrayList<Entry> entries = dirToEntries.get(dir);<NEW_LINE>if (entries == null) {<NEW_LINE>entries = new ArrayList();<NEW_LINE>dirToEntries.put(dir, entries);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (File file : files) {<NEW_LINE>if (file.isFile()) {<NEW_LINE>if (inputRegex.size > 0) {<NEW_LINE>boolean found = false;<NEW_LINE>for (Pattern pattern : inputRegex) {<NEW_LINE>if (pattern.matcher(file.getName()).matches()) {<NEW_LINE>found = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!found)<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>File dir = file.getParentFile();<NEW_LINE>if (inputFilter != null && !inputFilter.accept(dir, file.getName()))<NEW_LINE>continue;<NEW_LINE><MASK><NEW_LINE>if (outputSuffix != null)<NEW_LINE>outputName = outputName.replaceAll("(.*)\\..*", "$1") + outputSuffix;<NEW_LINE>Entry entry = new Entry();<NEW_LINE>entry.depth = depth;<NEW_LINE>entry.inputFile = file;<NEW_LINE>entry.outputDir = outputDir;<NEW_LINE>if (flattenOutput) {<NEW_LINE>entry.outputFile = new File(outputRoot, outputName);<NEW_LINE>} else {<NEW_LINE>entry.outputFile = new File(outputDir, outputName);<NEW_LINE>}<NEW_LINE>dirToEntries.get(dir).add(entry);<NEW_LINE>}<NEW_LINE>if (recursive && file.isDirectory()) {<NEW_LINE>File subdir = outputDir.getPath().length() == 0 ? new File(file.getName()) : new File(outputDir, file.getName());<NEW_LINE>process(file.listFiles(inputFilter), outputRoot, subdir, dirToEntries, depth + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String outputName = file.getName(); |
821,082 | private BTChipOutput finalizeInput(String outputAddress, String amount, String fees, String changePath) throws BTChipException {<NEW_LINE>resolvePath(changePath);<NEW_LINE>ByteArrayOutputStream data = new ByteArrayOutputStream();<NEW_LINE>byte[] path = BIP32Utils.splitPath(changePath);<NEW_LINE>data.write(outputAddress.length());<NEW_LINE>BufferUtils.writeBuffer(data, outputAddress.getBytes());<NEW_LINE>BufferUtils.writeUint64BE(data, CoinFormatUtils.toSatoshi(amount));<NEW_LINE>BufferUtils.writeUint64BE(data<MASK><NEW_LINE>BufferUtils.writeBuffer(data, path);<NEW_LINE>byte[] response = exchangeApdu(BTCHIP_CLA, BTCHIP_INS_HASH_INPUT_FINALIZE, (byte) 0x02, (byte) 0x00, data.toByteArray(), OK);<NEW_LINE>return convertResponseToOutput(response);<NEW_LINE>} | , CoinFormatUtils.toSatoshi(fees)); |
609,230 | void init(EsInputSplit esSplit, Configuration cfg, Progressable progressable) {<NEW_LINE>// get a copy to override the host/port<NEW_LINE>Settings settings = HadoopSettingsManager.loadFrom(cfg).copy().load(esSplit.getPartition().getSerializedSettings());<NEW_LINE>if (log.isTraceEnabled()) {<NEW_LINE>log.trace(String.format("Init shard reader from cfg %s", HadoopCfgUtils.asProperties(cfg)));<NEW_LINE>log.trace(String.format("Init shard reader w/ settings %s", settings));<NEW_LINE>}<NEW_LINE>this.esSplit = esSplit;<NEW_LINE>// initialize mapping/ scroll reader<NEW_LINE>InitializationUtils.setValueReaderIfNotSet(settings, WritableValueReader.class, log);<NEW_LINE>InitializationUtils.setUserProviderIfNotSet(settings, HadoopUserProvider.class, log);<NEW_LINE><MASK><NEW_LINE>PartitionReader partitionReader = RestService.createReader(settings, part, log);<NEW_LINE>this.scrollReader = partitionReader.scrollReader;<NEW_LINE>this.client = partitionReader.client;<NEW_LINE>this.queryBuilder = partitionReader.queryBuilder;<NEW_LINE>this.progressable = progressable;<NEW_LINE>// in Hadoop-like envs (Spark) the progressable might be null and thus the heart-beat is not needed<NEW_LINE>if (progressable != null) {<NEW_LINE>beat = new HeartBeat(progressable, cfg, settings.getHeartBeatLead(), log);<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(String.format("Initializing RecordReader for [%s]", esSplit));<NEW_LINE>}<NEW_LINE>} | PartitionDefinition part = esSplit.getPartition(); |
776,305 | public void handleImageFileUpload(FileUploadEvent event) {<NEW_LINE>logger.fine("handleImageFileUpload clicked");<NEW_LINE>UploadedFile uploadedFile = event.getFile();<NEW_LINE>try {<NEW_LINE>updateDatasetThumbnailCommand = new UpdateDatasetThumbnailCommand(dvRequestService.getDataverseRequest(), dataset, UpdateDatasetThumbnailCommand.UserIntent.setNonDatasetFileAsThumbnail, null, uploadedFile.getInputStream());<NEW_LINE>} catch (IOException ex) {<NEW_LINE>String error = "Unexpected error while uploading file.";<NEW_LINE>logger.warning("Problem uploading dataset thumbnail to dataset id " + dataset.getId() + ". " + error + " . Exception: " + ex);<NEW_LINE>updateDatasetThumbnailCommand = null;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File file = null;<NEW_LINE>try {<NEW_LINE>file = FileUtil.inputStreamToFile(uploadedFile.getInputStream());<NEW_LINE>} catch (IOException ex) {<NEW_LINE>Logger.getLogger(DatasetWidgetsPage.class.getName()).log(Level.SEVERE, null, ex);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String base64image = ImageThumbConverter.generateImageThumbnailFromFileAsBase64(file, ImageThumbConverter.DEFAULT_DATASETLOGO_SIZE);<NEW_LINE>if (base64image != null) {<NEW_LINE>datasetThumbnail = new DatasetThumbnail(base64image, datasetFileThumbnailToSwitchTo);<NEW_LINE>} else {<NEW_LINE>Logger.getLogger(DatasetWidgetsPage.class.getName()).<MASK><NEW_LINE>}<NEW_LINE>} | log(Level.SEVERE, "Failed to produce a thumbnail from the uploaded dataset logo."); |
985,613 | public void decryptDeterministically(DeterministicAeadDecryptRequest request, StreamObserver<DeterministicAeadDecryptResponse> responseObserver) {<NEW_LINE>DeterministicAeadDecryptResponse response;<NEW_LINE>try {<NEW_LINE>KeysetHandle keysetHandle = CleartextKeysetHandle.read(BinaryKeysetReader.withBytes(request.getKeyset().toByteArray()));<NEW_LINE>DeterministicAead daead = keysetHandle.getPrimitive(DeterministicAead.class);<NEW_LINE>byte[] plaintext = daead.decryptDeterministically(request.getCiphertext().toByteArray(), request.getAssociatedData().toByteArray());<NEW_LINE>response = DeterministicAeadDecryptResponse.newBuilder().setPlaintext(ByteString.copyFrom(plaintext)).build();<NEW_LINE>} catch (GeneralSecurityException | InvalidProtocolBufferException e) {<NEW_LINE>response = DeterministicAeadDecryptResponse.newBuilder().setErr(e.toString()).build();<NEW_LINE>} catch (IOException e) {<NEW_LINE>responseObserver.onError(Status.UNKNOWN.withDescription(e.getMessage<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>responseObserver.onNext(response);<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>} | ()).asException()); |
1,428,577 | private void save(ServerMatrix matrix, Path matrixPath, FileSystem fs, List<Integer> partIds, PSMatrixSaveContext saveContext, int startPos, int endPos, PSMatrixFilesMeta dataFilesMeta) throws IOException {<NEW_LINE>Path destFile = new Path(matrixPath, ModelFilesUtils.fileName(partIds.get(startPos)));<NEW_LINE>Path tmpDestFile = HdfsUtil.toTmpPath(destFile);<NEW_LINE>if (fs.exists(tmpDestFile)) {<NEW_LINE>fs.delete(tmpDestFile, true);<NEW_LINE>}<NEW_LINE>FSDataOutputStream out = fs.create(tmpDestFile, true, conf.getInt(AngelConf.ANGEL_PS_IO_FILE_BUFFER_SIZE, AngelConf.DEFAULT_ANGEL_PS_IO_FILE_BUFFER_SIZE));<NEW_LINE>long streamPos = 0;<NEW_LINE>ServerPartition partition;<NEW_LINE>for (int i = startPos; i < endPos; i++) {<NEW_LINE>LOG.info("Write partition " + partIds.get(i) + " of matrix " + matrix.getName() + " to " + tmpDestFile);<NEW_LINE>streamPos = out.getPos();<NEW_LINE>partition = matrix.getPartition(partIds.get(i));<NEW_LINE>PartitionKey partKey = partition.getPartitionKey();<NEW_LINE>MatrixPartitionMeta partMeta;<NEW_LINE>long startCol = 0;<NEW_LINE>long endCol = 0;<NEW_LINE>if (useRange) {<NEW_LINE>startCol = partKey.getStartCol();<NEW_LINE>endCol = partKey.getEndCol();<NEW_LINE>}<NEW_LINE>partMeta = new MatrixPartitionMeta(partKey.getPartitionId(), partKey.getStartRow(), partKey.getEndRow(), startCol, endCol, partition.getElemNum(), destFile.getName(), streamPos, 0);<NEW_LINE>save(partition, partMeta, saveContext, out);<NEW_LINE>partMeta.setLength(out.getPos() - streamPos);<NEW_LINE>dataFilesMeta.addPartitionMeta(partIds.get(i), partMeta);<NEW_LINE>}<NEW_LINE>out.flush();<NEW_LINE>out.close();<NEW_LINE>HdfsUtil.<MASK><NEW_LINE>} | rename(tmpDestFile, destFile, fs); |
670,236 | public UiFsModel resourceResourceIdGet(String resourceId, String cookie, String ifNoneMatch, String downloadURIValidity, String fields, Integer length, Integer offset, List<String> option, String sort) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'resourceId' is set<NEW_LINE>if (resourceId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'resourceId' when calling resourceResourceIdGet");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/resource/{resourceId}".replaceAll("\\{" + "resourceId" + "\\}", apiClient.escapeString(resourceId.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new <MASK><NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "downloadURIValidity", downloadURIValidity));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "fields", fields));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "length", length));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "option", option));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));<NEW_LINE>if (cookie != null)<NEW_LINE>localVarHeaderParams.put("cookie", apiClient.parameterToString(cookie));<NEW_LINE>if (ifNoneMatch != null)<NEW_LINE>localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));<NEW_LINE>final String[] localVarAccepts = { "application/json;charset=utf-8" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "bearerAuth" };<NEW_LINE>GenericType<UiFsModel> localVarReturnType = new GenericType<UiFsModel>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | HashMap<String, Object>(); |
877,914 | // LIBERTY - NEW METHOD<NEW_LINE>@Override<NEW_LINE>public ModuleMetaData createModuleMetaData(ExtendedModuleInfo moduleInfo) throws MetaDataException {<NEW_LINE>WebModuleInfo webModule = (WebModuleInfo) moduleInfo;<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "createModuleMetaData: " + webModule.getName() + " " + webModule.getContextRoot());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>com.ibm.wsspi.adaptable.module.Container webModuleContainer = webModule.getContainer();<NEW_LINE>WebAppConfiguration appConfig = webModuleContainer.adapt(WebAppConfiguration.class);<NEW_LINE><MASK><NEW_LINE>String j2eeModuleName = appConfig.getJ2EEModuleName();<NEW_LINE>WebModuleMetaDataImpl wmmd = (WebModuleMetaDataImpl) appConfig.getMetaData();<NEW_LINE>wmmd.setJ2EEName(j2eeNameFactory.create(appName, j2eeModuleName, null));<NEW_LINE>appConfig.setWebApp(createWebApp(moduleInfo, appConfig));<NEW_LINE>return wmmd;<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Throwable cause = e.getCause();<NEW_LINE>MetaDataException m;<NEW_LINE>if ((cause != null) && (cause instanceof MetaDataException)) {<NEW_LINE>m = (MetaDataException) cause;<NEW_LINE>// don't log a FFDC here as we already logged an exception<NEW_LINE>} else if (instance.get() == null) {<NEW_LINE>// The web container is deactivated, let the upstream call handle this<NEW_LINE>m = new MetaDataException(e);<NEW_LINE>} else {<NEW_LINE>m = new MetaDataException(e);<NEW_LINE>// this throws the exception<NEW_LINE>FFDCWrapper.processException(e, getClass().getName(), "createModuleMetaData", new Object[] { webModule, this });<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {<NEW_LINE>Tr.event(tc, "createModuleMetaData: " + webModule.getName() + "; " + e);<NEW_LINE>}<NEW_LINE>throw m;<NEW_LINE>}<NEW_LINE>} | String appName = appConfig.getApplicationName(); |
960,818 | final TransferInputDeviceResult executeTransferInputDevice(TransferInputDeviceRequest transferInputDeviceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(transferInputDeviceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<TransferInputDeviceRequest> request = null;<NEW_LINE>Response<TransferInputDeviceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TransferInputDeviceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(transferInputDeviceRequest));<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, "MediaLive");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TransferInputDevice");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TransferInputDeviceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TransferInputDeviceResultJsonUnmarshaller());<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); |
739,626 | public static boolean checkJsonCompliance(String sourceJson, String matchJson) {<NEW_LINE>boolean isMatch = false;<NEW_LINE>try {<NEW_LINE>boolean isSourceJsonIsArray = false;<NEW_LINE>boolean isMatchJsonIsArray = false;<NEW_LINE>JSONValidator sourceValidator = JSONValidator.from(sourceJson);<NEW_LINE>JSONValidator matchValidator = JSONValidator.from(matchJson);<NEW_LINE>String sourceType = sourceValidator.getType().name();<NEW_LINE>String matchType = matchValidator.getType().name();<NEW_LINE>if (StringUtils.equalsIgnoreCase(sourceType, "array") && StringUtils.equalsIgnoreCase(matchType, "array")) {<NEW_LINE>isSourceJsonIsArray = true;<NEW_LINE>isMatchJsonIsArray = true;<NEW_LINE>} else if (StringUtils.equalsIgnoreCase(sourceType, "array")) {<NEW_LINE>isSourceJsonIsArray = true;<NEW_LINE>} else if (StringUtils.equalsIgnoreCase(matchType, "array")) {<NEW_LINE>isMatchJsonIsArray = true;<NEW_LINE>}<NEW_LINE>if (isSourceJsonIsArray && isMatchJsonIsArray) {<NEW_LINE>JSONArray sourceArr = JSONArray.parseArray(sourceJson);<NEW_LINE>JSONArray compArr = JSONArray.parseArray(matchJson);<NEW_LINE>isMatch = checkJsonArrayCompliance(sourceArr, compArr);<NEW_LINE>} else if (isSourceJsonIsArray && !isMatchJsonIsArray) {<NEW_LINE>JSONArray sourceArr = JSONArray.parseArray(sourceJson);<NEW_LINE>JSONObject compObj = JSONObject.parseObject(matchJson);<NEW_LINE><MASK><NEW_LINE>} else if (!isSourceJsonIsArray && !isMatchJsonIsArray) {<NEW_LINE>JSONObject sourceObj = JSONObject.parseObject(sourceJson);<NEW_LINE>JSONObject compObj = JSONObject.parseObject(matchJson);<NEW_LINE>isMatch = checkJsonObjCompliance(sourceObj, compObj);<NEW_LINE>} else {<NEW_LINE>isMatch = false;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>return isMatch;<NEW_LINE>} | isMatch = checkJsonArrayContainsObj(sourceArr, compObj); |
1,775,191 | public Object calculate(Context ctx) {<NEW_LINE>ArrayList<Number> num <MASK><NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("gcd" + mm.getMessage("function.missingParam"));<NEW_LINE>} else if (param.isLeaf()) {<NEW_LINE>Object result = param.getLeafExpression().calculate(ctx);<NEW_LINE>if (result != null && result instanceof Number) {<NEW_LINE>num.add((Number) result);<NEW_LINE>} else if (result != null && result instanceof Sequence) {<NEW_LINE>int n = ((Sequence) result).length();<NEW_LINE>for (int i = 1; i <= n; i++) {<NEW_LINE>Object tmp = ((Sequence) result).get(i);<NEW_LINE>if (tmp != null && tmp instanceof Number) {<NEW_LINE>num.add((Number) tmp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>int size = param.getSubSize();<NEW_LINE>for (int j = 0; j < size; j++) {<NEW_LINE>IParam subj = param.getSub(j);<NEW_LINE>if (subj != null) {<NEW_LINE>Object result = subj.getLeafExpression().calculate(ctx);<NEW_LINE>if (result != null && result instanceof Number) {<NEW_LINE>num.add((Number) result);<NEW_LINE>} else if (result != null && result instanceof Sequence) {<NEW_LINE>int n = ((Sequence) result).length();<NEW_LINE>for (int i = 1; i <= n; i++) {<NEW_LINE>Object tmp = ((Sequence) result).get(i);<NEW_LINE>if (tmp != null && tmp instanceof Number) {<NEW_LINE>num.add((Number) tmp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int k = num.size();<NEW_LINE>Number[] nums = new Number[k];<NEW_LINE>num.toArray(nums);<NEW_LINE>return new Long(gcd(nums, k));<NEW_LINE>} | = new ArrayList<Number>(); |
1,454,840 | public Request<UntagResourceRequest> marshall(UntagResourceRequest untagResourceRequest) {<NEW_LINE>if (untagResourceRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(UntagResourceRequest)");<NEW_LINE>}<NEW_LINE>Request<UntagResourceRequest> request = new DefaultRequest<UntagResourceRequest>(untagResourceRequest, "AWSKinesisVideo");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/UntagResource";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (untagResourceRequest.getResourceARN() != null) {<NEW_LINE>String resourceARN = untagResourceRequest.getResourceARN();<NEW_LINE>jsonWriter.name("ResourceARN");<NEW_LINE>jsonWriter.value(resourceARN);<NEW_LINE>}<NEW_LINE>if (untagResourceRequest.getTagKeyList() != null) {<NEW_LINE>java.util.List<String> tagKeyList = untagResourceRequest.getTagKeyList();<NEW_LINE>jsonWriter.name("TagKeyList");<NEW_LINE>jsonWriter.beginArray();<NEW_LINE>for (String tagKeyListItem : tagKeyList) {<NEW_LINE>if (tagKeyListItem != null) {<NEW_LINE>jsonWriter.value(tagKeyListItem);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>jsonWriter.endArray();<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | request.addHeader("Content-Type", "application/x-amz-json-1.0"); |
649,770 | protected void unsetResourceAdapter(ServiceReference<ApplicationRecycleContext> ref) {<NEW_LINE>final String methodName = "unsetResourceAdapter";<NEW_LINE>final <MASK><NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.entry(tc, methodName, "Entry Count: " + ++JCAMBeanRuntime.counterUnsetResourceAdapter);<NEW_LINE>synchronized (this) {<NEW_LINE>// ////////////////////Variables from ServiceReference<ResourceFactory> //////////////////////<NEW_LINE>final String name = (String) ref.getProperty("config.displayId");<NEW_LINE>// Get a reference to the ResourceAdapterMBeanImpl needed to be unregistered<NEW_LINE>ResourceAdapterMBeanImpl raMBean = resourceAdapters.get(name);<NEW_LINE>// Get a reference to the ResourceAdapterModuleMBeanImpl needed to be unregistered<NEW_LINE>ResourceAdapterModuleMBeanImpl ramMBean = resourceAdapterModules.get(name);<NEW_LINE>if (raMBean == null || ramMBean == null) {<NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.exit(tc, methodName, "Short Exit. No MBeans were unregistered.");<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>// Update the ConcurrentHashMap<NEW_LINE>this.resourceAdapters.remove(raMBean.getName());<NEW_LINE>// Unregister ResourceAdapterMBean<NEW_LINE>raMBean.unregister();<NEW_LINE>// Update the ConcurrentHashMap<NEW_LINE>this.resourceAdapterModules.remove(ramMBean.getName());<NEW_LINE>// Unregister ResourceAdapterModuleMBean<NEW_LINE>ramMBean.unregister();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (trace && tc.isEntryEnabled())<NEW_LINE>Tr.exit(tc, methodName);<NEW_LINE>} | boolean trace = TraceComponent.isAnyTracingEnabled(); |
32,170 | private static void assertEventProps(RegressionEnvironment env, EventBean eventBean, String currSymbol, String prev0Symbol, Double prev0Price, String prev1Symbol, Double prev1Price, String prev2Symbol, Double prev2Price, String prevTail0Symbol, Double prevTail0Price, String prevTail1Symbol, Double prevTail1Price, Long prevCount, Object[] prevWindow) {<NEW_LINE>assertEquals(currSymbol, eventBean.get("currSymbol"));<NEW_LINE>assertEquals(prev0Symbol<MASK><NEW_LINE>assertEquals(prev0Price, eventBean.get("prev0Price"));<NEW_LINE>assertEquals(prev1Symbol, eventBean.get("prev1Symbol"));<NEW_LINE>assertEquals(prev1Price, eventBean.get("prev1Price"));<NEW_LINE>assertEquals(prev2Symbol, eventBean.get("prev2Symbol"));<NEW_LINE>assertEquals(prev2Price, eventBean.get("prev2Price"));<NEW_LINE>assertEquals(prevTail0Symbol, eventBean.get("prevTail0Symbol"));<NEW_LINE>assertEquals(prevTail0Price, eventBean.get("prevTail0Price"));<NEW_LINE>assertEquals(prevTail1Symbol, eventBean.get("prevTail1Symbol"));<NEW_LINE>assertEquals(prevTail1Price, eventBean.get("prevTail1Price"));<NEW_LINE>assertEquals(prevCount, eventBean.get("prevCountPrice"));<NEW_LINE>EPAssertionUtil.assertEqualsExactOrder((Object[]) eventBean.get("prevWindowPrice"), prevWindow);<NEW_LINE>env.listenerReset("s0");<NEW_LINE>} | , eventBean.get("prev0Symbol")); |
1,767,098 | final DescribeApplicationResult executeDescribeApplication(DescribeApplicationRequest describeApplicationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeApplicationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeApplicationRequest> request = null;<NEW_LINE>Response<DescribeApplicationResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DescribeApplicationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeApplicationRequest));<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, "IoTFleetHub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeApplication");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeApplicationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeApplicationResultJsonUnmarshaller());<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); |
1,294,337 | public static byte[] serialize(Descriptors.Descriptor descriptor) {<NEW_LINE>byte[] schemaDataBytes;<NEW_LINE>try {<NEW_LINE>Map<String, FileDescriptorProto> fileDescriptorProtoCache = new HashMap<>();<NEW_LINE>// recursively cache all FileDescriptorProto<NEW_LINE>serializeFileDescriptor(<MASK><NEW_LINE>// extract root message path<NEW_LINE>String rootMessageTypeName = descriptor.getFullName();<NEW_LINE>String rootFileDescriptorName = descriptor.getFile().getFullName();<NEW_LINE>// build FileDescriptorSet, this is equal to < protoc --include_imports --descriptor_set_out ><NEW_LINE>byte[] fileDescriptorSet = FileDescriptorSet.newBuilder().addAllFile(fileDescriptorProtoCache.values()).build().toByteArray();<NEW_LINE>// serialize to bytes<NEW_LINE>ProtobufNativeSchemaData schemaData = ProtobufNativeSchemaData.builder().fileDescriptorSet(fileDescriptorSet).rootFileDescriptorName(rootFileDescriptorName).rootMessageTypeName(rootMessageTypeName).build();<NEW_LINE>schemaDataBytes = new ObjectMapper().writeValueAsBytes(schemaData);<NEW_LINE>logger.debug("descriptor '{}' serialized to '{}'.", descriptor.getFullName(), schemaDataBytes);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>throw new SchemaSerializationException(e);<NEW_LINE>}<NEW_LINE>return schemaDataBytes;<NEW_LINE>} | descriptor.getFile(), fileDescriptorProtoCache); |
225,531 | @Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Path("/v2/segments")<NEW_LINE>@Authenticate(AccessType.CREATE)<NEW_LINE>@ApiOperation(value = "Upload a segment", notes = "Upload a segment as json")<NEW_LINE>@ApiResponses(value = { @ApiResponse(code = 200, message = "Successfully uploaded segment"), @ApiResponse(code = 410, message = "Segment to refresh is deleted"), @ApiResponse(code = 500, message = "Internal error") })<NEW_LINE>public // endpoint in how it moves the segment to a Pinot-determined final directory.<NEW_LINE>void uploadSegmentAsJsonV2(String segmentJsonStr, @ApiParam(value = "Name of the table") @QueryParam(FileUploadDownloadClient.QueryParameters.TABLE_NAME) String tableName, @ApiParam(value = "Type of the table") @QueryParam(FileUploadDownloadClient.QueryParameters.TABLE_TYPE) @DefaultValue("OFFLINE") String tableType, @ApiParam(value = "Whether to enable parallel push protection") @DefaultValue("false") @QueryParam(FileUploadDownloadClient.QueryParameters.ENABLE_PARALLEL_PUSH_PROTECTION) boolean enableParallelPushProtection, @ApiParam(value = "Whether to refresh if the segment already exists") @DefaultValue("true") @QueryParam(FileUploadDownloadClient.QueryParameters.ALLOW_REFRESH) boolean allowRefresh, @Context HttpHeaders headers, @Context Request request, @Suspended final AsyncResponse asyncResponse) {<NEW_LINE>try {<NEW_LINE>asyncResponse.resume(uploadSegment(tableName, TableType.valueOf(tableType.toUpperCase()), null, enableParallelPushProtection, headers<MASK><NEW_LINE>} catch (Throwable t) {<NEW_LINE>asyncResponse.resume(t);<NEW_LINE>}<NEW_LINE>} | , request, true, allowRefresh)); |
1,401,742 | public AppInstanceSummary unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AppInstanceSummary appInstanceSummary = new AppInstanceSummary();<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("AppInstanceArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>appInstanceSummary.setAppInstanceArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>appInstanceSummary.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Metadata", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>appInstanceSummary.setMetadata(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return appInstanceSummary;<NEW_LINE>} | class).unmarshall(context)); |
525,424 | // GEN-LAST:event_bnTestConfigureActionPerformed<NEW_LINE>@Override<NEW_LINE>@Messages({ "GlobalSettingsPanel.validationerrMsg.mustConfigure=Configure the database to enable this module." })<NEW_LINE>public void load() {<NEW_LINE>tbOops.setText("");<NEW_LINE>enableButtonSubComponents(false);<NEW_LINE>CentralRepoDbChoice selectedChoice = CentralRepoDbManager.getSavedDbChoice();<NEW_LINE>// NON-NLS<NEW_LINE>cbUseCentralRepo.setSelected(CentralRepoDbUtil.allowUseOfCentralRepository());<NEW_LINE>lbDbPlatformValue.setText(selectedChoice.getTitle());<NEW_LINE>CentralRepoPlatforms selectedDb = selectedChoice.getDbPlatform();<NEW_LINE>if (selectedChoice == null || selectedDb == CentralRepoPlatforms.DISABLED) {<NEW_LINE>lbDbNameValue.setText("");<NEW_LINE>lbDbLocationValue.setText("");<NEW_LINE>tbOops.<MASK><NEW_LINE>} else {<NEW_LINE>enableButtonSubComponents(cbUseCentralRepo.isSelected());<NEW_LINE>if (selectedDb == CentralRepoPlatforms.POSTGRESQL) {<NEW_LINE>try {<NEW_LINE>PostgresCentralRepoSettings dbSettingsPg = new PostgresCentralRepoSettings();<NEW_LINE>lbDbNameValue.setText(dbSettingsPg.getDbName());<NEW_LINE>lbDbLocationValue.setText(dbSettingsPg.getHost());<NEW_LINE>} catch (CentralRepoException e) {<NEW_LINE>logger.log(Level.WARNING, "Unable to load settings into global panel for postgres settings", e);<NEW_LINE>}<NEW_LINE>} else if (selectedDb == CentralRepoPlatforms.SQLITE) {<NEW_LINE>SqliteCentralRepoSettings dbSettingsSqlite = new SqliteCentralRepoSettings();<NEW_LINE>lbDbNameValue.setText(dbSettingsSqlite.getDbName());<NEW_LINE>lbDbLocationValue.setText(dbSettingsSqlite.getDbDirectory());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | setText(Bundle.GlobalSettingsPanel_validationerrMsg_mustConfigure()); |
1,422,382 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null) {<NEW_LINE>player.revealCards(player.getName() + "'s hand", player.getHand(), game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Set<Card> chosenCards = new HashSet<>();<NEW_LINE>chooseCardForColor(ObjectColor.WHITE, chosenCards, player, game, source);<NEW_LINE>chooseCardForColor(ObjectColor.BLUE, chosenCards, player, game, source);<NEW_LINE>chooseCardForColor(ObjectColor.BLACK, chosenCards, player, game, source);<NEW_LINE>chooseCardForColor(ObjectColor.RED, chosenCards, player, game, source);<NEW_LINE>chooseCardForColor(ObjectColor.GREEN, chosenCards, player, game, source);<NEW_LINE>chosenCards.addAll(player.getHand().getCards(StaticFilters.FILTER_CARD_LAND, game));<NEW_LINE>Cards cards = player.getHand().copy();<NEW_LINE>cards.removeIf(chosenCards.stream().map(MageItem::getId).collect(Collectors.toSet())::contains);<NEW_LINE>player.discard(<MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | cards, false, source, game); |
484,767 | public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {<NEW_LINE>final String tableName = OptUtil.getTableOpt(cl, shellState);<NEW_LINE>final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);<NEW_LINE>final Range range = getRange(cl, interpeter);<NEW_LINE>final Authorizations <MASK><NEW_LINE>final Text startRow = range.getStartKey() == null ? null : range.getStartKey().getRow();<NEW_LINE>final Text endRow = range.getEndKey() == null ? null : range.getEndKey().getRow();<NEW_LINE>try {<NEW_LINE>final Text max = shellState.getAccumuloClient().tableOperations().getMaxRow(tableName, auths, startRow, range.isStartKeyInclusive(), endRow, range.isEndKeyInclusive());<NEW_LINE>if (max != null) {<NEW_LINE>shellState.getWriter().println(max);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.debug("Could not get shell state.", e);<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | auths = getAuths(cl, shellState); |
295,695 | public Object callWriteReplace(final Object object) {<NEW_LINE>if (object == null) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>final Class<? extends Object> objectType = object.getClass();<NEW_LINE>final Method writeReplaceMethod = getRRMethod(objectType, "writeReplace");<NEW_LINE>if (writeReplaceMethod != null) {<NEW_LINE>ErrorWritingException ex = null;<NEW_LINE>try {<NEW_LINE>Object replaced = writeReplaceMethod.invoke(object);<NEW_LINE>if (replaced != null && !object.getClass().equals(replaced.getClass())) {<NEW_LINE>// call further writeReplace methods on replaced<NEW_LINE>replaced = callWriteReplace(replaced);<NEW_LINE>}<NEW_LINE>return replaced;<NEW_LINE>} catch (final IllegalAccessException e) {<NEW_LINE>ex = new ObjectAccessException("Cannot access method", e);<NEW_LINE>} catch (final InvocationTargetException e) {<NEW_LINE>ex = new ConversionException(<MASK><NEW_LINE>} catch (final ErrorWritingException e) {<NEW_LINE>ex = e;<NEW_LINE>}<NEW_LINE>ex.add("method", objectType.getName() + ".writeReplace()");<NEW_LINE>throw ex;<NEW_LINE>} else {<NEW_LINE>return object;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Failed calling method", e.getTargetException()); |
699,789 | public ReturnT<Map<String, Object>> chartInfo() {<NEW_LINE>// process<NEW_LINE>List<String> triggerDayList = new ArrayList<String>();<NEW_LINE>List<Integer> triggerDayCountRunningList = new ArrayList<Integer>();<NEW_LINE>List<Integer> triggerDayCountSucList = new ArrayList<Integer>();<NEW_LINE>List<Integer> triggerDayCountFailList = new ArrayList<Integer>();<NEW_LINE>int triggerCountRunningTotal = 0;<NEW_LINE>int triggerCountSucTotal = 0;<NEW_LINE>int triggerCountFailTotal = 0;<NEW_LINE>List<JobLogReport> logReportList = jobLogReportMapper.queryLogReport(DateUtil.addDays(new Date(), -<MASK><NEW_LINE>if (logReportList != null && logReportList.size() > 0) {<NEW_LINE>for (JobLogReport item : logReportList) {<NEW_LINE>String day = DateUtil.formatDate(item.getTriggerDay());<NEW_LINE>int triggerDayCountRunning = item.getRunningCount();<NEW_LINE>int triggerDayCountSuc = item.getSucCount();<NEW_LINE>int triggerDayCountFail = item.getFailCount();<NEW_LINE>triggerDayList.add(day);<NEW_LINE>triggerDayCountRunningList.add(triggerDayCountRunning);<NEW_LINE>triggerDayCountSucList.add(triggerDayCountSuc);<NEW_LINE>triggerDayCountFailList.add(triggerDayCountFail);<NEW_LINE>triggerCountRunningTotal += triggerDayCountRunning;<NEW_LINE>triggerCountSucTotal += triggerDayCountSuc;<NEW_LINE>triggerCountFailTotal += triggerDayCountFail;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int i = -6; i <= 0; i++) {<NEW_LINE>triggerDayList.add(DateUtil.formatDate(DateUtil.addDays(new Date(), i)));<NEW_LINE>triggerDayCountRunningList.add(0);<NEW_LINE>triggerDayCountSucList.add(0);<NEW_LINE>triggerDayCountFailList.add(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Map<String, Object> result = new HashMap<>();<NEW_LINE>result.put("triggerDayList", triggerDayList);<NEW_LINE>result.put("triggerDayCountRunningList", triggerDayCountRunningList);<NEW_LINE>result.put("triggerDayCountSucList", triggerDayCountSucList);<NEW_LINE>result.put("triggerDayCountFailList", triggerDayCountFailList);<NEW_LINE>result.put("triggerCountRunningTotal", triggerCountRunningTotal);<NEW_LINE>result.put("triggerCountSucTotal", triggerCountSucTotal);<NEW_LINE>result.put("triggerCountFailTotal", triggerCountFailTotal);<NEW_LINE>return new ReturnT<>(result);<NEW_LINE>} | 7), new Date()); |
1,737,128 | final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(untagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UntagResourceRequest> request = null;<NEW_LINE>Response<UntagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Application Insights");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UntagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
180,289 | protected void doInit() {<NEW_LINE>if (ConfigDataMode.isMasterMode()) {<NEW_LINE>SysTableUtil.getInstance().prepareCdcSysTables();<NEW_LINE>// init storage check scheduler<NEW_LINE>final int checkStorageChangeInterval = 2000;<NEW_LINE>checkStorageChangeExecutor.scheduleWithFixedDelay(() -> {<NEW_LINE>try {<NEW_LINE>if (!ExecUtils.hasLeadership(null)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>synchronized (CdcManager.this) {<NEW_LINE>checkStorageChange();<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>MetaDbLogUtil.META_DB_LOG.error(t);<NEW_LINE>logger.error("something goes wrong when do storage check for cdc db.", t);<NEW_LINE>}<NEW_LINE>}, checkStorageChangeInterval * 3, checkStorageChangeInterval, TimeUnit.MILLISECONDS);<NEW_LINE>// init command scanner<NEW_LINE>final int commandScanInterval = 2000;<NEW_LINE>final <MASK><NEW_LINE>commandScanner.init();<NEW_LINE>commandScanExecutor.scheduleWithFixedDelay(() -> {<NEW_LINE>try {<NEW_LINE>commandScanner.scan();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>MetaDbLogUtil.META_DB_LOG.error(t);<NEW_LINE>logger.error("something goes wrong when do storage check for cdc db.", t);<NEW_LINE>}<NEW_LINE>}, commandScanInterval * 3, commandScanInterval, TimeUnit.MILLISECONDS);<NEW_LINE>}<NEW_LINE>} | CommandScanner commandScanner = new CommandScanner(this); |
14,623 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "@JsonSchema(dynamic=true) @public @buseventtype create json schema SensorEvent();\n" + "@name('s0') select entityID? as entityId, temperature? as temperature, status? as status, \n" + "\tentityName? as entityName, vt? as vt, flags? as flags from SensorEvent;\n" + "@name('s1') select entityName?.english as englishEntityName from SensorEvent";<NEW_LINE>env.compileDeploy(epl).addListener("s0").addListener("s1");<NEW_LINE>String json = "{\n" + " \"entityID\":\"cd9f930e\",\n" + " \"temperature\" : 70,\n" + " \"status\" : true,\n" + " \"entityName\":{\n" + " \"english\":\"Cooling Water Temperature\"\n" + " },\n" + " \"vt\":[\"2014-08-20T15:30:23.524Z\"],\n" + " \"flags\" : null\n" + "}";<NEW_LINE>env.sendEventJson(json, "SensorEvent");<NEW_LINE>env.assertPropsNew("s0", "entityId,temperature,status,entityName,vt,flags".split(","), new Object[] { "cd9f930e", 70, true, Collections.singletonMap("english", "Cooling Water Temperature"), new Object[<MASK><NEW_LINE>env.assertPropsNew("s1", "englishEntityName".split(","), new Object[] { "Cooling Water Temperature" });<NEW_LINE>env.assertThat(() -> {<NEW_LINE>EventSenderJson sender = (EventSenderJson) env.runtime().getEventService().getEventSender("SensorEvent");<NEW_LINE>sender.parse(json);<NEW_LINE>});<NEW_LINE>env.undeployAll();<NEW_LINE>} | ] { "2014-08-20T15:30:23.524Z" }, null }); |
224,937 | public boolean isSupported(final Path file, final Type type) {<NEW_LINE>if (file.isRoot()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>switch(type) {<NEW_LINE>case download:<NEW_LINE>{<NEW_LINE>if (file.isDirectory()) {<NEW_LINE>if (SDSNodeIdProvider.isEncrypted(containerService.getContainer(file))) {<NEW_LINE>log.warn(String.format("Not supported for file %s in encrypted room", file));<NEW_LINE>// In encrypted rooms only files can be shared<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final Acl.Role role = SDSPermissionsFeature.DOWNLOAD_SHARE_ROLE;<NEW_LINE>final boolean found = new SDSPermissionsFeature(session, nodeid).containsRole(file, role);<NEW_LINE>if (!found) {<NEW_LINE>log.warn(String.format<MASK><NEW_LINE>}<NEW_LINE>return found;<NEW_LINE>}<NEW_LINE>case upload:<NEW_LINE>{<NEW_LINE>// An upload account can be created for directories and rooms only<NEW_LINE>if (!file.isDirectory()) {<NEW_LINE>log.warn(String.format("Not supported for file %s", file));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final Acl.Role role = SDSPermissionsFeature.UPLOAD_SHARE_ROLE;<NEW_LINE>final boolean found = new SDSPermissionsFeature(session, nodeid).containsRole(file, role);<NEW_LINE>if (!found) {<NEW_LINE>log.warn(String.format("Not supported for file %s with missing role %s", file, role));<NEW_LINE>}<NEW_LINE>return found;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ("Not supported for file %s with missing role %s", file, role)); |
874,391 | protected void animHeight(HMBase base) {<NEW_LINE>if (keyframes == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Keyframe[] frameArray = new Keyframe[keyframes.size()];<NEW_LINE>for (int i = 0; i < keyframes.size(); i++) {<NEW_LINE>KeyFrame <MASK><NEW_LINE>Keyframe frame = Keyframe.ofInt(kf.percent, (int) HummerStyleUtils.convertNumber(kf.value));<NEW_LINE>frameArray[i] = frame;<NEW_LINE>}<NEW_LINE>PropertyValuesHolder frameHolder = PropertyValuesHolder.ofKeyframe("height", frameArray);<NEW_LINE>ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(new AnimViewWrapper(base), frameHolder);<NEW_LINE>animator = anim;<NEW_LINE>anim.setDuration(HummerAnimationUtils.getAnimDuration(duration));<NEW_LINE>anim.setRepeatCount(repeatCount);<NEW_LINE>anim.setStartDelay(HummerAnimationUtils.getAnimDelay(delay));<NEW_LINE>anim.setInterpolator(HummerAnimationUtils.getInterpolator(easing));<NEW_LINE>anim.addListener(animatorListener);<NEW_LINE>anim.start();<NEW_LINE>} | kf = keyframes.get(i); |
614,074 | private static void joinChat() throws NotInitializedException {<NEW_LINE>if (chatroom == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!initialized) {<NEW_LINE>establishConnection();<NEW_LINE>if (!initialized) {<NEW_LINE>throw new NotInitializedException();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>chat = new MultiUserChat(connection, chatroom);<NEW_LINE>try {<NEW_LINE>if (chatpassword != null) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>chat.join(chatnickname);<NEW_LINE>}<NEW_LINE>logger.info("Successfuly joined chat '{}' with nickname '{}'.", chatroom, chatnickname);<NEW_LINE>} catch (XMPPException e) {<NEW_LINE>logger.error("Could not join chat '{}' with nickname '{}': {}", chatroom, chatnickname, e.getMessage());<NEW_LINE>} catch (SmackException e) {<NEW_LINE>logger.error("Could not join chat '{}' with nickname '{}': {}", chatroom, chatnickname, e.getMessage());<NEW_LINE>}<NEW_LINE>} | chat.join(chatnickname, chatpassword); |
168,981 | private void openDownloadDialog() {<NEW_LINE>disposables.add(ExtractorHelper.getStreamInfo(currentServiceId, currentUrl, true).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(result -> {<NEW_LINE>final List<VideoStream> sortedVideoStreams = ListHelper.getSortedStreamVideosList(this, result.getVideoStreams(), result.getVideoOnlyStreams(), false, false);<NEW_LINE>final int selectedVideoStreamIndex = ListHelper.getDefaultResolutionIndex(this, sortedVideoStreams);<NEW_LINE>final FragmentManager fm = getSupportFragmentManager();<NEW_LINE>final DownloadDialog downloadDialog = DownloadDialog.newInstance(result);<NEW_LINE>downloadDialog.setVideoStreams(sortedVideoStreams);<NEW_LINE>downloadDialog.setAudioStreams(result.getAudioStreams());<NEW_LINE>downloadDialog.setSelectedVideoStream(selectedVideoStreamIndex);<NEW_LINE>downloadDialog.setOnDismissListener(dialog -> finish());<NEW_LINE>downloadDialog.show(fm, "downloadDialog");<NEW_LINE>fm.executePendingTransactions();<NEW_LINE>}, <MASK><NEW_LINE>} | throwable -> showUnsupportedUrlDialog(currentUrl))); |
1,139,947 | public void fillCompletionVariants(final CompletionParameters parameters, CompletionResultSet result) {<NEW_LINE>PsiFile file = parameters.getOriginalFile();<NEW_LINE>final TextFieldWithAutoCompletionListProvider<T> provider = file.getUserData(KEY);<NEW_LINE>if (provider == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String adv = provider.getAdvertisement();<NEW_LINE>if (adv == null) {<NEW_LINE>final String <MASK><NEW_LINE>if (shortcut != null) {<NEW_LINE>adv = provider.getQuickDocHotKeyAdvertisement(shortcut);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (adv != null) {<NEW_LINE>result.addLookupAdvertisement(adv);<NEW_LINE>}<NEW_LINE>final String prefix = provider.getPrefix(parameters);<NEW_LINE>if (prefix == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (parameters.getInvocationCount() == 0 && !file.getUserData(AUTO_POPUP_KEY)) {<NEW_LINE>// is autopopup<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final PrefixMatcher prefixMatcher = provider.createPrefixMatcher(prefix);<NEW_LINE>if (prefixMatcher != null) {<NEW_LINE>result = result.withPrefixMatcher(prefixMatcher);<NEW_LINE>}<NEW_LINE>Collection<T> items = provider.getItems(prefix, true, parameters);<NEW_LINE>addCompletionElements(result, provider, items, -10000);<NEW_LINE>Future<Collection<T>> future = ApplicationManager.getApplication().executeOnPooledThread(new Callable<Collection<T>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Collection<T> call() {<NEW_LINE>return provider.getItems(prefix, false, parameters);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>while (true) {<NEW_LINE>try {<NEW_LINE>Collection<T> tasks = future.get(100, TimeUnit.MILLISECONDS);<NEW_LINE>if (tasks != null) {<NEW_LINE>addCompletionElements(result, provider, tasks, 0);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (ProcessCanceledException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Exception ignore) {<NEW_LINE>}<NEW_LINE>ProgressManager.checkCanceled();<NEW_LINE>}<NEW_LINE>} | shortcut = getActionShortcut(IdeActions.ACTION_QUICK_JAVADOC); |
649,590 | public static InstantiateVmFromNewCreatedStruct fromMessage(InstantiateNewCreatedVmInstanceMsg msg) {<NEW_LINE>InstantiateVmFromNewCreatedStruct struct = new InstantiateVmFromNewCreatedStruct();<NEW_LINE>struct.setDataDiskOfferingUuids(msg.getDataDiskOfferingUuids());<NEW_LINE>struct.setDataVolumeTemplateUuids(msg.getDataVolumeTemplateUuids());<NEW_LINE>struct.setDataVolumeFromTemplateSystemTags(msg.getDataVolumeFromTemplateSystemTags());<NEW_LINE>struct.setL3NetworkUuids(msg.getL3NetworkUuids());<NEW_LINE>struct.setRootDiskOfferingUuid(msg.getRootDiskOfferingUuid());<NEW_LINE>struct.setPrimaryStorageUuidForRootVolume(msg.getPrimaryStorageUuidForRootVolume());<NEW_LINE>struct.<MASK><NEW_LINE>struct.strategy = VmCreationStrategy.valueOf(msg.getStrategy());<NEW_LINE>struct.setRootVolumeSystemTags(msg.getRootVolumeSystemTags());<NEW_LINE>struct.setDataVolumeSystemTags(msg.getDataVolumeSystemTags());<NEW_LINE>struct.setRequiredHostUuid(msg.getHostUuid());<NEW_LINE>struct.setSoftAvoidHostUuids(msg.getSoftAvoidHostUuids());<NEW_LINE>struct.setAvoidHostUuids(msg.getAvoidHostUuids());<NEW_LINE>return struct;<NEW_LINE>} | setPrimaryStorageUuidForDataVolume(msg.getPrimaryStorageUuidForDataVolume()); |
399,668 | public static TransformGroup drawCone(double x, double y, double z, double r, double h, String imageURL) {<NEW_LINE>Appearance appearance = createAppearance();<NEW_LINE>// Load an image from the file<NEW_LINE>TextureLoader loader;<NEW_LINE>try {<NEW_LINE>loader = new TextureLoader(imageURL<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("Could not read from the file '" + imageURL + "'");<NEW_LINE>}<NEW_LINE>Texture texture = loader.getTexture();<NEW_LINE>texture.setBoundaryModeS(Texture.WRAP);<NEW_LINE>texture.setBoundaryModeT(Texture.WRAP);<NEW_LINE>texture.setBoundaryColor(new Color4f(0.0f, 1.0f, 0.0f, 0.0f));<NEW_LINE>// Set up the texture attributes<NEW_LINE>TextureAttributes textureAttributes = new TextureAttributes();<NEW_LINE>textureAttributes.setTextureMode(TextureAttributes.REPLACE);<NEW_LINE>appearance.setTexture(texture);<NEW_LINE>appearance.setTextureAttributes(textureAttributes);<NEW_LINE>Cone cone = new Cone(scaleWidth(r), scaleHeight(h), primitiveflags, NUM_DIVISIONS, NUM_DIVISIONS, appearance);<NEW_LINE>return drawPrimitive(cone, x, y, z);<NEW_LINE>} | , "RGBA", new Container()); |
523,772 | protected List<Element> expand(List<Element> tokens, String s, int type) {<NEW_LINE>if (tokens == null)<NEW_LINE>throw new NullPointerException("Received null argument");<NEW_LINE>if (tokens.isEmpty())<NEW_LINE>throw new IllegalArgumentException("Received empty list");<NEW_LINE>// Expand the list of potential multi-token words.<NEW_LINE>// First, try to find longest entries in database, then shorter.<NEW_LINE>List<Element> expanded = new ArrayList<Element>();<NEW_LINE>ArrayList<Element> match = new ArrayList<Element>(tokens);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>String multiword = null;<NEW_LINE>while (!match.isEmpty()) {<NEW_LINE>sb.setLength(0);<NEW_LINE>Iterator<Element> it = match.iterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>sb.append(MaryDomUtils.tokenText((Element) it.next()));<NEW_LINE>sb.append(" ");<NEW_LINE>}<NEW_LINE>String lookup = sb.toString().trim();<NEW_LINE>logger.debug("Looking up multiword in dictionary: `" + lookup + "'");<NEW_LINE>if (multiWordDict.containsKey(lookup)) {<NEW_LINE>multiword = lookup;<NEW_LINE>// OK, found a match<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// remove last in list<NEW_LINE>match.remove(match.size() - 1);<NEW_LINE>}<NEW_LINE>if (multiword != null) {<NEW_LINE>// found a multiWordDict entry<NEW_LINE>expanded.addAll(dictionaryExpandMultiWord(match, multiword));<NEW_LINE>logger.debug("Have found multiword in dictionary: `" + multiword + "'");<NEW_LINE>}<NEW_LINE>if (logger.getLevel().equals(Level.DEBUG)) {<NEW_LINE>StringBuilder logBuf = new StringBuilder();<NEW_LINE>for (Iterator<Element> it = expanded.iterator(); it.hasNext(); ) {<NEW_LINE>Element elt = (Element) it.next();<NEW_LINE>if (elt.getTagName().equals(MaryXML.TOKEN)) {<NEW_LINE>logBuf.append(MaryDomUtils.tokenText(elt));<NEW_LINE>} else {<NEW_LINE>logBuf.append(elt.getTagName());<NEW_LINE>}<NEW_LINE>logBuf.append(" ");<NEW_LINE>}<NEW_LINE>logger.debug(<MASK><NEW_LINE>}<NEW_LINE>if (!expanded.isEmpty())<NEW_LINE>replaceTokens(match, expanded);<NEW_LINE>return expanded;<NEW_LINE>} | "Expanded multiword: " + logBuf.toString()); |
1,208,624 | public void marshall(AwsS3BucketBucketLifecycleConfigurationRulesDetails awsS3BucketBucketLifecycleConfigurationRulesDetails, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (awsS3BucketBucketLifecycleConfigurationRulesDetails == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getAbortIncompleteMultipartUpload(), ABORTINCOMPLETEMULTIPARTUPLOAD_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getExpirationDate(), EXPIRATIONDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getExpirationInDays(), EXPIRATIONINDAYS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getExpiredObjectDeleteMarker(), EXPIREDOBJECTDELETEMARKER_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getFilter(), FILTER_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getID(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getNoncurrentVersionExpirationInDays(), NONCURRENTVERSIONEXPIRATIONINDAYS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getPrefix(), PREFIX_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsS3BucketBucketLifecycleConfigurationRulesDetails.getTransitions(), TRANSITIONS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | awsS3BucketBucketLifecycleConfigurationRulesDetails.getNoncurrentVersionTransitions(), NONCURRENTVERSIONTRANSITIONS_BINDING); |
1,834,970 | static public MPrintFormat createFromTable(Properties ctx, int AD_Table_ID, int AD_PrintFormat_ID) {<NEW_LINE>MClient company = MClient.get(ctx);<NEW_LINE>s_log.info("AD_Table_ID=" + AD_Table_ID + " - AD_Client_ID=" + company.get_ID());<NEW_LINE>MPrintFormat pf = new MPrintFormat(ctx, AD_PrintFormat_ID, null);<NEW_LINE>pf.setAD_Table_ID(AD_Table_ID);<NEW_LINE>// Get Info<NEW_LINE>// 1<NEW_LINE>String // 1<NEW_LINE>sql = // 3<NEW_LINE>"SELECT TableName," + " (SELECT COUNT(*) FROM AD_PrintFormat x WHERE x.AD_Table_ID=t.AD_Table_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 " + "FROM AD_Table t, 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')," + // #1/2<NEW_LINE>" AD_PrintColor pc, AD_PrintFont pf, AD_PrintPaper pp " + "WHERE t.AD_Table_ID=? AND c.AD_Client_ID=?" + " AND pc.IsDefault='Y' AND pf.IsDefault='Y' AND pp.IsDefault='Y'";<NEW_LINE>boolean error = true;<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql, null);<NEW_LINE>pstmt.setInt(1, AD_Table_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 TableName = rs.getString(1);<NEW_LINE>String ColumnName = TableName + "_ID";<NEW_LINE>String s = ColumnName;<NEW_LINE>if (!ColumnName.equals("T_Report_ID")) {<NEW_LINE>s = Msg.translate(ctx, ColumnName);<NEW_LINE>if (// not found<NEW_LINE>ColumnName.equals(s))<NEW_LINE>s = Msg.translate(ctx, TableName);<NEW_LINE>}<NEW_LINE>int count = rs.getInt(2);<NEW_LINE>if (count > 0)<NEW_LINE>s += "_" + (count + 1);<NEW_LINE>pf.setName(company.getValue() + " -> " + s);<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>error = false;<NEW_LINE>} else<NEW_LINE>s_log.log(<MASK><NEW_LINE>} catch (SQLException e) {<NEW_LINE>s_log.log(Level.SEVERE, sql, e);<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, "No info found " + AD_Table_ID); |
677,624 | public INDArray activate(boolean training, LayerWorkspaceMgr workspaceMgr) {<NEW_LINE>INDArray input = this.input;<NEW_LINE>if (input.rank() != 3)<NEW_LINE>throw new UnsupportedOperationException("Input must be rank 3. Got input with rank " + input.rank() + " " + layerId());<NEW_LINE>INDArray b = getParamWithNoise(<MASK><NEW_LINE>INDArray W = getParamWithNoise(DefaultParamInitializer.WEIGHT_KEY, training, workspaceMgr);<NEW_LINE>applyDropOutIfNecessary(training, workspaceMgr);<NEW_LINE>if (layerConf().getRnnDataFormat() == RNNFormat.NWC) {<NEW_LINE>input = input.permute(0, 2, 1);<NEW_LINE>}<NEW_LINE>INDArray input2d = TimeSeriesUtils.reshape3dTo2d(input.castTo(W.dataType()), workspaceMgr, ArrayType.FF_WORKING_MEM);<NEW_LINE>INDArray act2d = layerConf().getActivationFn().getActivation(input2d.mmul(W).addiRowVector(b), training);<NEW_LINE>if (maskArray != null) {<NEW_LINE>if (!maskArray.isColumnVectorOrScalar() || Arrays.equals(maskArray.shape(), act2d.shape())) {<NEW_LINE>// Per output masking<NEW_LINE>act2d.muli(maskArray.castTo(act2d.dataType()));<NEW_LINE>} else {<NEW_LINE>// Per time step masking<NEW_LINE>act2d.muliColumnVector(maskArray.castTo(act2d.dataType()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>INDArray ret = TimeSeriesUtils.reshape2dTo3d(act2d, input.size(0), workspaceMgr, ArrayType.ACTIVATIONS);<NEW_LINE>if (layerConf().getRnnDataFormat() == RNNFormat.NWC) {<NEW_LINE>ret = ret.permute(0, 2, 1);<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | DefaultParamInitializer.BIAS_KEY, training, workspaceMgr); |
820,650 | public void startJob() {<NEW_LINE><MASK><NEW_LINE>AbstractFile currentFolder = mainFrame.getActivePanel().getCurrentFolder();<NEW_LINE>// Resolves destination folder<NEW_LINE>PathUtils.ResolvedDestination resolvedDest = PathUtils.resolveDestination(enteredPath, currentFolder, currentFolder);<NEW_LINE>// The path entered doesn't correspond to any existing folder<NEW_LINE>if (resolvedDest == null) {<NEW_LINE>InformationDialog.showErrorDialog(mainFrame, Translator.get("invalid_path", enteredPath));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Checks if the directory already exists and reports the error if that's the case<NEW_LINE>DestinationType destinationType = resolvedDest.getDestinationType();<NEW_LINE>if (destinationType == DestinationType.EXISTING_FOLDER) {<NEW_LINE>InformationDialog.showErrorDialog(mainFrame, Translator.get("directory_already_exists", enteredPath));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Don't check for existing regular files, MkdirJob will take of it and popup a FileCollisionDialog<NEW_LINE>AbstractFile destFile = resolvedDest.getDestinationFile();<NEW_LINE>FileSet fileSet = new FileSet(destFile.getParent());<NEW_LINE>// Job's FileSet needs to contain at least one file<NEW_LINE>fileSet.add(destFile);<NEW_LINE>ProgressDialog progressDialog = new ProgressDialog(mainFrame, getTitle());<NEW_LINE>MkdirJob job;<NEW_LINE>if (mkfileMode)<NEW_LINE>job = new MkdirJob(progressDialog, mainFrame, fileSet, allocateSpaceCheckBox.isSelected() ? allocateSpaceChooser.getValue() : -1);<NEW_LINE>else<NEW_LINE>job = new MkdirJob(progressDialog, mainFrame, fileSet);<NEW_LINE>progressDialog.start(job);<NEW_LINE>} | String enteredPath = pathField.getText(); |
479,646 | protected void drawIcon(Graphics graphics) {<NEW_LINE>if (!isIconVisible()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>graphics.pushState();<NEW_LINE>graphics.setLineWidth(1);<NEW_LINE>graphics.setForegroundColor(isEnabled() ? ColorConstants.black : ColorConstants.gray);<NEW_LINE>Point pt = getIconOrigin();<NEW_LINE><MASK><NEW_LINE>path.addRectangle(pt.x, pt.y, 11, 11);<NEW_LINE>path.moveTo(pt.x - 0.2f, pt.y);<NEW_LINE>path.lineTo(pt.x + 3.2f, pt.y - 3);<NEW_LINE>path.moveTo(pt.x + 11, pt.y);<NEW_LINE>path.lineTo(pt.x + 14, pt.y - 3);<NEW_LINE>path.moveTo(pt.x + 11.2f, pt.y + 11);<NEW_LINE>path.lineTo(pt.x + 14.2f, pt.y + 8);<NEW_LINE>path.moveTo(pt.x + 3, pt.y - 2.8f);<NEW_LINE>path.lineTo(pt.x + 14.3f, pt.y - 2.8f);<NEW_LINE>path.moveTo(pt.x + 14, pt.y - 3);<NEW_LINE>path.lineTo(pt.x + 14, pt.y + 8.2f);<NEW_LINE>graphics.drawPath(path);<NEW_LINE>path.dispose();<NEW_LINE>graphics.popState();<NEW_LINE>} | Path path = new Path(null); |
1,798,057 | public void enterScope(NodeTraversal t) {<NEW_LINE>Node n = t.getCurrentNode();<NEW_LINE>Scope scope = t.getScope();<NEW_LINE>Node root = scope.getRootNode();<NEW_LINE>if (root.isFunction()) {<NEW_LINE>String propName = getPrototypePropertyNameFromRValue(n);<NEW_LINE>if (propName != null) {<NEW_LINE>symbolStack.push(new NameContext(getNameInfoForName(propName, PROPERTY), scope));<NEW_LINE>} else if (isGlobalFunctionDeclaration(t, n)) {<NEW_LINE><MASK><NEW_LINE>String name = parent.isName() ? parent.getString() : /* VAR */<NEW_LINE>n.getFirstChild().getString();<NEW_LINE>symbolStack.push(new NameContext(getNameInfoForName(name, VAR), scope.getClosestHoistScope()));<NEW_LINE>} else {<NEW_LINE>// NOTE(nicksantos): We use the same anonymous node for all<NEW_LINE>// functions that do not have reasonable names. I can't remember<NEW_LINE>// at the moment why we do this. I think it's because anonymous<NEW_LINE>// nodes can never have in-edges. They're just there as a placeholder<NEW_LINE>// for scope information, and do not matter in the edge propagation.<NEW_LINE>symbolStack.push(new NameContext(anonymousNode, scope));<NEW_LINE>}<NEW_LINE>} else if (t.inGlobalScope()) {<NEW_LINE>symbolStack.push(new NameContext(globalNode, scope));<NEW_LINE>} else {<NEW_LINE>// TODO(moz): It's not yet clear if we need another kind of NameContext for block scopes<NEW_LINE>// in ES6, use anonymous node for now and investigate later.<NEW_LINE>checkState(NodeUtil.createsBlockScope(root) || root.isModuleBody(), scope);<NEW_LINE>symbolStack.push(new NameContext(anonymousNode, scope));<NEW_LINE>}<NEW_LINE>} | Node parent = n.getParent(); |
1,676,164 | public JsonBean<?> push(String target, String secretKey, String mode, List<SelectedResource> resources) {<NEW_LINE>notBlank(target, TARGET_IS_REQUIRED);<NEW_LINE>notBlank(secretKey, SECRET_KEY_IS_REQUIRED);<NEW_LINE>ByteArrayOutputStream baos = new ByteArrayOutputStream();<NEW_LINE>try {<NEW_LINE>download(null, resources, baos);<NEW_LINE>} catch (IOException e) {<NEW_LINE>return new JsonBean<>(-1, e.getMessage());<NEW_LINE>}<NEW_LINE>byte[<MASK><NEW_LINE>long timestamp = System.currentTimeMillis();<NEW_LINE>RestTemplate restTemplate = new RestTemplate();<NEW_LINE>MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();<NEW_LINE>param.add("timestamp", timestamp);<NEW_LINE>param.add("mode", mode);<NEW_LINE>param.add("sign", SignUtils.sign(timestamp, secretKey, mode, bytes));<NEW_LINE>param.add("file", new InputStreamResource(new ByteArrayInputStream(bytes)) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getFilename() {<NEW_LINE>return "magic-api.zip";<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public long contentLength() {<NEW_LINE>return bytes.length;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>HttpHeaders headers = new HttpHeaders();<NEW_LINE>headers.setContentType(MediaType.MULTIPART_FORM_DATA);<NEW_LINE>return restTemplate.postForObject(target, new HttpEntity<>(param, headers), JsonBean.class);<NEW_LINE>} | ] bytes = baos.toByteArray(); |
1,045,801 | public static void serialize(final LocalDate value, final JsonWriter sw) {<NEW_LINE>final int year = value.getYear();<NEW_LINE>if (year < 0) {<NEW_LINE>throw new SerializationException("Negative dates are not supported.");<NEW_LINE>} else if (year > 9999) {<NEW_LINE>sw.writeByte(JsonWriter.QUOTE);<NEW_LINE>NumberConverter.serialize(year, sw);<NEW_LINE>sw.writeByte((byte) '-');<NEW_LINE>NumberConverter.serialize(value.getMonthOfYear(), sw);<NEW_LINE>sw.writeByte((byte) '-');<NEW_LINE>NumberConverter.serialize(value.getDayOfMonth(), sw);<NEW_LINE>sw.writeByte(JsonWriter.QUOTE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final byte[] buf = sw.ensureCapacity(12);<NEW_LINE>final int pos = sw.size();<NEW_LINE>buf[pos] = '"';<NEW_LINE>NumberConverter.write4(year, buf, pos + 1);<NEW_LINE>buf[pos + 5] = '-';<NEW_LINE>NumberConverter.write2(value.getMonthOfYear(), buf, pos + 6);<NEW_LINE><MASK><NEW_LINE>NumberConverter.write2(value.getDayOfMonth(), buf, pos + 9);<NEW_LINE>buf[pos + 11] = '"';<NEW_LINE>sw.advance(12);<NEW_LINE>} | buf[pos + 8] = '-'; |
542,230 | private void processAssertion(SampleResult result, Assertion assertion) {<NEW_LINE>AssertionResult assertionResult;<NEW_LINE>try {<NEW_LINE>assertionResult = assertion.getResult(result);<NEW_LINE>} catch (AssertionError e) {<NEW_LINE>log.debug("Error processing Assertion.", e);<NEW_LINE>assertionResult = new AssertionResult("Assertion failed! See log file (debug level, only).");<NEW_LINE>assertionResult.setFailure(true);<NEW_LINE>assertionResult.setFailureMessage(e.toString());<NEW_LINE>} catch (JMeterError e) {<NEW_LINE>log.error("Error processing Assertion.", e);<NEW_LINE>assertionResult = new AssertionResult("Assertion failed! See log file.");<NEW_LINE>assertionResult.setError(true);<NEW_LINE>assertionResult.setFailureMessage(e.toString());<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Exception processing Assertion.", e);<NEW_LINE>assertionResult = new AssertionResult("Assertion failed! See log file.");<NEW_LINE>assertionResult.setError(true);<NEW_LINE>assertionResult.setFailureMessage(e.toString());<NEW_LINE>}<NEW_LINE>result.setSuccessful(result.isSuccessful() && !(assertionResult.isError() <MASK><NEW_LINE>result.addAssertionResult(assertionResult);<NEW_LINE>} | || assertionResult.isFailure())); |
1,190,376 | protected Problem preCheck(CompilationController info) throws IOException {<NEW_LINE>// fire operation start on the registered progress listeners (4 steps)<NEW_LINE>fireProgressListenerStart(refactoring.PRE_CHECK, 4);<NEW_LINE>Problem preCheckProblem = null;<NEW_LINE>info.toPhase(JavaSource.Phase.RESOLVED);<NEW_LINE>Element el = treePathHandle.resolveElement(info);<NEW_LINE>TreePathHandle sourceType = refactoring.getSourceType();<NEW_LINE>// check whether the element is valid<NEW_LINE>Problem result = isElementAvail(sourceType, info);<NEW_LINE>if (result != null) {<NEW_LINE>// fatal error -> don't continue with further checks<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>result = JavaPluginUtils.isSourceElement(el, info);<NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>refactoring.setClassName(sourceType.resolveElement(info).getSimpleName().toString());<NEW_LINE>// increase progress (step 1)<NEW_LINE>fireProgressListenerStep();<NEW_LINE>// #1 - check if the class is an inner class<NEW_LINE>// RefObject declCls = (RefObject) sourceType.refImmediateComposite();<NEW_LINE>if (el instanceof TypeElement) {<NEW_LINE>if (((TypeElement) el).getNestingKind() == NestingKind.ANONYMOUS) {<NEW_LINE>// fatal error -> return<NEW_LINE>// NOI18N<NEW_LINE>preCheckProblem = new Problem(true, NbBundle.getMessage<MASK><NEW_LINE>return preCheckProblem;<NEW_LINE>}<NEW_LINE>if (!((TypeElement) el).getNestingKind().isNested()) {<NEW_LINE>// fatal error -> return<NEW_LINE>// NOI18N<NEW_LINE>preCheckProblem = new Problem(true, NbBundle.getMessage(InnerToOuterRefactoringPlugin.class, "ERR_InnerToOuter_MustBeInnerClass"));<NEW_LINE>return preCheckProblem;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// NOI18N<NEW_LINE>preCheckProblem = new Problem(true, NbBundle.getMessage(InnerToOuterRefactoringPlugin.class, "ERR_InnerToOuter_MustBeInnerClass"));<NEW_LINE>return preCheckProblem;<NEW_LINE>}<NEW_LINE>// increase progress (step 2)<NEW_LINE>fireProgressListenerStep();<NEW_LINE>fireProgressListenerStop();<NEW_LINE>return preCheckProblem;<NEW_LINE>} | (InnerToOuterRefactoringPlugin.class, "ERR_InnerToOuter_Anonymous")); |
1,428,419 | public void print() {<NEW_LINE>log.info(m_info.toString());<NEW_LINE>if (m_layout == null)<NEW_LINE>layout();<NEW_LINE>// Paper Attributes: media-printable-area, orientation-requested, media<NEW_LINE>PrintRequestAttributeSet prats = m_layout.getPaper().getPrintRequestAttributeSet();<NEW_LINE>// add: copies, job-name, priority<NEW_LINE>if (m_info.isDocumentCopy() || m_info.getCopies() < 1)<NEW_LINE>prats.add(new Copies(1));<NEW_LINE>else<NEW_LINE>prats.add(new Copies(m_info.getCopies()));<NEW_LINE>Locale locale = Language.getLoginLanguage().getLocale();<NEW_LINE>prats.add(new JobName(m_printFormat.getName(), locale));<NEW_LINE>JobPriority priority = PrintUtil.getJobPriority(m_layout.getNumberOfPages(), m_info.getCopies(), true);<NEW_LINE>// check for directly set priority<NEW_LINE>if (m_priority > 0 && m_priority <= 100)<NEW_LINE>priority = new JobPriority(m_priority);<NEW_LINE>prats.add(priority);<NEW_LINE>try {<NEW_LINE>// PrinterJob<NEW_LINE>PrinterJob job = <MASK><NEW_LINE>// job.getPrintService().addPrintServiceAttributeListener(this);<NEW_LINE>// no copy<NEW_LINE>job.setPageable(m_layout.getPageable(false));<NEW_LINE>// Dialog<NEW_LINE>try {<NEW_LINE>if (m_info.isWithDialog() && !job.printDialog(prats))<NEW_LINE>return;<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.log(Level.WARNING, "Operating System Print Issue, check & try again", e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// submit<NEW_LINE>boolean printCopy = m_info.isDocumentCopy() && m_info.getCopies() > 1;<NEW_LINE>ArchiveEngine.get().archive(m_layout, m_info);<NEW_LINE>PrintUtil.print(job, prats, false, !m_info.isAsync() || printCopy);<NEW_LINE>// Document: Print Copies<NEW_LINE>if (printCopy) {<NEW_LINE>log.info("Copy " + (m_info.getCopies() - 1));<NEW_LINE>prats.add(new Copies(m_info.getCopies() - 1));<NEW_LINE>job = getPrinterJob(m_info.getPrinterName());<NEW_LINE>// job.getPrintService().addPrintServiceAttributeListener(this);<NEW_LINE>// Copy<NEW_LINE>job.setPageable(m_layout.getPageable(true));<NEW_LINE>PrintUtil.print(job, prats, false, false);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.log(Level.SEVERE, "", e);<NEW_LINE>}<NEW_LINE>} | getPrinterJob(m_info.getPrinterName()); |
1,411,069 | public static DescribeContactPointsResponse unmarshall(DescribeContactPointsResponse describeContactPointsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeContactPointsResponse.setRequestId(_ctx.stringValue("DescribeContactPointsResponse.RequestId"));<NEW_LINE>List<ContactPoint> contactPoints = new ArrayList<ContactPoint>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeContactPointsResponse.ContactPoints.Length"); i++) {<NEW_LINE>ContactPoint contactPoint = new ContactPoint();<NEW_LINE>contactPoint.setDataCenterId(_ctx.stringValue("DescribeContactPointsResponse.ContactPoints[" + i + "].DataCenterId"));<NEW_LINE>contactPoint.setPort(_ctx.integerValue("DescribeContactPointsResponse.ContactPoints[" + i + "].Port"));<NEW_LINE>List<String> privateAddresses = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeContactPointsResponse.ContactPoints[" + i + "].PrivateAddresses.Length"); j++) {<NEW_LINE>privateAddresses.add(_ctx.stringValue("DescribeContactPointsResponse.ContactPoints[" + i + "].PrivateAddresses[" + j + "]"));<NEW_LINE>}<NEW_LINE>contactPoint.setPrivateAddresses(privateAddresses);<NEW_LINE>List<String> publicAddresses <MASK><NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeContactPointsResponse.ContactPoints[" + i + "].PublicAddresses.Length"); j++) {<NEW_LINE>publicAddresses.add(_ctx.stringValue("DescribeContactPointsResponse.ContactPoints[" + i + "].PublicAddresses[" + j + "]"));<NEW_LINE>}<NEW_LINE>contactPoint.setPublicAddresses(publicAddresses);<NEW_LINE>contactPoints.add(contactPoint);<NEW_LINE>}<NEW_LINE>describeContactPointsResponse.setContactPoints(contactPoints);<NEW_LINE>return describeContactPointsResponse;<NEW_LINE>} | = new ArrayList<String>(); |
597,476 | protected void printSpecialsNormal(String text, User user, MutableAttributeSet style, TagEmotes emotes, boolean ignoreLinks, boolean containsBits, java.util.List<Match> highlightMatches, java.util.List<Match> replacements, String replacement, MsgTags tags) {<NEW_LINE>// Where stuff was found<NEW_LINE>TreeMap<Integer, Integer> ranges = new TreeMap<>();<NEW_LINE>// The style of the stuff (basicially metadata)<NEW_LINE>HashMap<Integer, MutableAttributeSet> rangesStyle = new HashMap<>();<NEW_LINE>if (tags != null && tags.isReply() && text.startsWith("@")) {<NEW_LINE>Pair<User, String> replyData = getReplyData(tags);<NEW_LINE>if (replyData.value != null) {<NEW_LINE>ranges.put(0, 0);<NEW_LINE>rangesStyle.put(0, styles.reply(replyData.value, tags.getReplyParentMsgId()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>applyReplacements(text, <MASK><NEW_LINE>if (!ignoreLinks) {<NEW_LINE>findLinks(text, ranges, rangesStyle, styles.isEnabled(Setting.LINKS_CUSTOM_COLOR) ? style : styles.standard());<NEW_LINE>}<NEW_LINE>if (styles.isEnabled(Setting.EMOTICONS_ENABLED)) {<NEW_LINE>findEmoticons(text, user, ranges, rangesStyle, emotes);<NEW_LINE>if (containsBits) {<NEW_LINE>findBits(main.emoticons.getCheerEmotes(), text, ranges, rangesStyle, user);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (styles.isEnabled(Setting.MENTIONS)) {<NEW_LINE>findMentions(text, ranges, rangesStyle, style, Setting.MENTIONS);<NEW_LINE>}<NEW_LINE>// Actually output it<NEW_LINE>printSpecials(user, text, style, ranges, rangesStyle, highlightMatches);<NEW_LINE>} | replacements, replacement, ranges, rangesStyle); |
514,881 | private String inferStringValue(Scope scope, Node node) {<NEW_LINE>if (node == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>switch(node.getToken()) {<NEW_LINE>case STRING_KEY:<NEW_LINE>case STRINGLIT:<NEW_LINE>case TEMPLATELIT:<NEW_LINE>case TEMPLATELIT_STRING:<NEW_LINE>return NodeUtil.getStringValue(node);<NEW_LINE>case NAME:<NEW_LINE>if (scope == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String name = node.getString();<NEW_LINE>Var var = scope.getVar(name);<NEW_LINE>if (var == null || !var.isConst()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Node initialValue = var.getInitialValue();<NEW_LINE>return inferStringValue(var.getScope(), initialValue);<NEW_LINE>case GETPROP:<NEW_LINE>JSType type = node.getJSType();<NEW_LINE>if (type == null || !type.isEnumElementType()) {<NEW_LINE>// For simplicity, only support enums. The JS style guide requires enums to be<NEW_LINE>// effectively immutable and all enum items should be statically known.<NEW_LINE>// See go/js-style#features-objects-enums.<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Node enumSource = type.toMaybeEnumElementType().getEnumType().getSource();<NEW_LINE>if (enumSource == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (!enumSource.isObjectLit() && !enumSource.isClassMembers()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return inferStringValue(null, NodeUtil.getFirstPropMatchingKey(enumSource<MASK><NEW_LINE>default:<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | , node.getString())); |
29,240 | protected void postProcessOutputChannel(MessageChannel outputChannel, ExtendedProducerProperties<KinesisProducerProperties> producerProperties) {<NEW_LINE>if (outputChannel instanceof InterceptableChannel && producerProperties.isPartitioned()) {<NEW_LINE>((InterceptableChannel) outputChannel).addInterceptor(0, new ChannelInterceptor() {<NEW_LINE><NEW_LINE>private final PartitionKeyExtractorStrategy partitionKeyExtractorStrategy;<NEW_LINE><NEW_LINE>{<NEW_LINE>if (StringUtils.hasText(producerProperties.getPartitionKeyExtractorName())) {<NEW_LINE>this.partitionKeyExtractorStrategy = getBeanFactory().getBean(producerProperties.<MASK><NEW_LINE>} else {<NEW_LINE>this.partitionKeyExtractorStrategy = (message) -> producerProperties.getPartitionKeyExpression().getValue(KinesisMessageChannelBinder.this.evaluationContext, message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Message<?> preSend(Message<?> message, MessageChannel channel) {<NEW_LINE>Object partitionKey = this.partitionKeyExtractorStrategy.extractKey(message);<NEW_LINE>return MessageBuilder.fromMessage(message).setHeader(BinderHeaders.PARTITION_OVERRIDE, partitionKey).build();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | getPartitionKeyExtractorName(), PartitionKeyExtractorStrategy.class); |
640,759 | public void updateZoomRectangleSelection(MouseEvent e, boolean hZoom, boolean vZoom, Rectangle2D scaledDataArea) {<NEW_LINE>if (hZoom && vZoom) {<NEW_LINE>// selected rectangle shouldn't extend outside the data area...<NEW_LINE>double xMax = Math.min(e.getX(), scaledDataArea.getMaxX());<NEW_LINE>double yMax = Math.min(e.getY(), scaledDataArea.getMaxY());<NEW_LINE>zoomRectangle = new Rectangle2D.Double(zoomPoint.getX(), zoomPoint.getY(), xMax - zoomPoint.getX(), yMax - zoomPoint.getY());<NEW_LINE>} else if (hZoom) {<NEW_LINE>double xMax = Math.min(e.getX(), scaledDataArea.getMaxX());<NEW_LINE>zoomRectangle = new Rectangle2D.Double(zoomPoint.getX(), scaledDataArea.getMinY(), xMax - zoomPoint.getX(), scaledDataArea.getHeight());<NEW_LINE>} else if (vZoom) {<NEW_LINE>double yMax = Math.min(e.getY(), scaledDataArea.getMaxY());<NEW_LINE>zoomRectangle = new Rectangle2D.Double(scaledDataArea.getMinX(), zoomPoint.getY(), scaledDataArea.getWidth(), <MASK><NEW_LINE>}<NEW_LINE>} | yMax - zoomPoint.getY()); |
941,369 | public void execute() {<NEW_LINE>try {<NEW_LINE>if (getValue("srcfile") == null) {<NEW_LINE>throw new InstantiationException("You need to choose a sourcefile");<NEW_LINE>}<NEW_LINE>File src = (File) getValue("srcfile");<NEW_LINE>if (getValue("destfile") == null) {<NEW_LINE>throw new InstantiationException("You need to choose a destination file");<NEW_LINE>}<NEW_LINE>File dest = (File) getValue("destfile");<NEW_LINE>pagecountinsertedpages = 0;<NEW_LINE>pagecountrotatedpages = 0;<NEW_LINE>pagecount = 0;<NEW_LINE>PdfReader reader = new PdfReader(src.getAbsolutePath());<NEW_LINE>PdfStamper stp = new PdfStamper(reader, new FileOutputStream(dest));<NEW_LINE>PdfWriter writer = stp.getWriter();<NEW_LINE>ArrayList<PdfDictionary> pageInh = new ArrayList<>();<NEW_LINE>PdfDictionary catalog = reader.getCatalog();<NEW_LINE>PdfDictionary rootPages = catalog.getAsDict(PdfName.PAGES);<NEW_LINE>iteratePages(rootPages, reader, pageInh, 0, writer);<NEW_LINE>if (((pagecount) % 2) == 1) {<NEW_LINE>appendemptypageatend(reader, writer);<NEW_LINE>this.pagecountinsertedpages++;<NEW_LINE>}<NEW_LINE>stp.close();<NEW_LINE>System.out.println("In " + dest.getAbsolutePath() + " pages= " + pagecount + " inserted pages=" + this.getPagecountinsertedpages() + " rotated pages=" + this.getPagecountrotatedpages());<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | e.printStackTrace(System.out); |
1,293,447 | final ListSkillsStoreSkillsByCategoryResult executeListSkillsStoreSkillsByCategory(ListSkillsStoreSkillsByCategoryRequest listSkillsStoreSkillsByCategoryRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listSkillsStoreSkillsByCategoryRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListSkillsStoreSkillsByCategoryRequest> request = null;<NEW_LINE>Response<ListSkillsStoreSkillsByCategoryResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListSkillsStoreSkillsByCategoryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listSkillsStoreSkillsByCategoryRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Alexa For Business");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSkillsStoreSkillsByCategory");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListSkillsStoreSkillsByCategoryResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new ListSkillsStoreSkillsByCategoryResultJsonUnmarshaller()); |
837,434 | public void open(Map<String, Object> stormConf, TopologyContext context, SpoutOutputCollector newCollector) {<NEW_LINE>int numTasks = context.getComponentTasks(context.getThisComponentId()).size();<NEW_LINE>// Pre-condition: the number of tasks is equal to the number of files to read<NEW_LINE>if (paths.length != numTasks) {<NEW_LINE>throw new RuntimeException(String.format("Number of HDFS files %d not equal to number of tasks %d", paths.length, numTasks));<NEW_LINE>}<NEW_LINE>this.collector = newCollector;<NEW_LINE>try {<NEW_LINE>int index = context.getThisTaskIndex();<NEW_LINE>String path = paths[index];<NEW_LINE>// read file from HDFS<NEW_LINE>br = new BufferedReader(HdfsHelper.getHdfsStreamReader(path), 1024 * 1024);<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Clean stuff if any exceptions<NEW_LINE>try {<NEW_LINE>// Close the outmost is enough<NEW_LINE>if (br != null) {<NEW_LINE>br.close();<NEW_LINE>}<NEW_LINE>} catch (IOException e1) {<NEW_LINE>throw new RuntimeException("Unable to close stream reader", e1);<NEW_LINE>}<NEW_LINE>// Here we should not close the FileSystem explicitly<NEW_LINE>// Since different threads in a process may use a shared object in HDFS,<NEW_LINE>// if we close the FileSystem here, it will close the shared object, and other threads<NEW_LINE>// reading data by using this shared object will throw Exception"<NEW_LINE>// The FileSystem will be closed automatically when the process dies (the topology is killed)<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new RuntimeException("Failed to access the HDFS", e); |
1,638,034 | private Num calcPivotPoint(List<Integer> barsOfPreviousPeriod) {<NEW_LINE>if (barsOfPreviousPeriod.isEmpty())<NEW_LINE>return NaN;<NEW_LINE>Bar bar = getBarSeries().getBar(barsOfPreviousPeriod.get(0));<NEW_LINE>Num open = getBarSeries().getBar(barsOfPreviousPeriod.get(barsOfPreviousPeriod.size() - 1)).getOpenPrice();<NEW_LINE>Num close = bar.getClosePrice();<NEW_LINE><MASK><NEW_LINE>Num low = bar.getLowPrice();<NEW_LINE>for (int i : barsOfPreviousPeriod) {<NEW_LINE>high = (getBarSeries().getBar(i).getHighPrice()).max(high);<NEW_LINE>low = (getBarSeries().getBar(i).getLowPrice()).min(low);<NEW_LINE>}<NEW_LINE>Num x;<NEW_LINE>if (close.isLessThan(open)) {<NEW_LINE>x = high.plus(two.multipliedBy(low)).plus(close);<NEW_LINE>} else if (close.isGreaterThan(open)) {<NEW_LINE>x = two.multipliedBy(high).plus(low).plus(close);<NEW_LINE>} else {<NEW_LINE>x = high.plus(low).plus(two.multipliedBy(close));<NEW_LINE>}<NEW_LINE>return x.dividedBy(numOf(4));<NEW_LINE>} | Num high = bar.getHighPrice(); |
221,234 | protected void onLoad() {<NEW_LINE>super.onLoad();<NEW_LINE>releaseOnUnload_.add(tabPanel_.addBeforeSelectionHandler(beforeSelectionEvent -> {<NEW_LINE>if (clearing_)<NEW_LINE>return;<NEW_LINE>if (getSelectedIndex() >= 0) {<NEW_LINE>int unselectedTab = getSelectedIndex();<NEW_LINE>if (unselectedTab < tabs_.size()) {<NEW_LINE>WorkbenchTab lastTab = tabs_.get(unselectedTab);<NEW_LINE>lastTab.onBeforeUnselected();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int selectedTab = beforeSelectionEvent.getItem().intValue();<NEW_LINE>if (selectedTab < tabs_.size()) {<NEW_LINE>WorkbenchTab <MASK><NEW_LINE>tab.onBeforeSelected();<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>releaseOnUnload_.add(tabPanel_.addSelectionHandler(selectionEvent -> {<NEW_LINE>if (clearing_)<NEW_LINE>return;<NEW_LINE>WorkbenchTab pane = tabs_.get(selectionEvent.getSelectedItem().intValue());<NEW_LINE>pane.onSelected();<NEW_LINE>}));<NEW_LINE>int selectedIndex = tabPanel_.getSelectedIndex();<NEW_LINE>if (selectedIndex >= 0) {<NEW_LINE>WorkbenchTab tab = tabs_.get(selectedIndex);<NEW_LINE>tab.onBeforeSelected();<NEW_LINE>tab.onSelected();<NEW_LINE>}<NEW_LINE>} | tab = tabs_.get(selectedTab); |
1,687,554 | public static String formatMenuLabel(ImageResource icon, String label, boolean html, String shortcut, Integer iconOffsetY, ImageResource rightImage, String rightImageDesc, String styleName) {<NEW_LINE>StringBuilder text = new StringBuilder();<NEW_LINE>int topOffset = -2;<NEW_LINE>if (iconOffsetY != null)<NEW_LINE>topOffset += iconOffsetY;<NEW_LINE>text.append("<table role=\"presentation\"");<NEW_LINE>if (label != null) {<NEW_LINE>text.append("id=\"" + ElementIds.idFromLabel(label) + "_command\" ");<NEW_LINE>}<NEW_LINE>if (styleName != null) {<NEW_LINE>text.append("class='" + styleName + "' ");<NEW_LINE>}<NEW_LINE>text.append("border=0 cellpadding=0 cellspacing=0 width='100%'><tr>");<NEW_LINE>text.append("<td width=\"25\" style=\"vertical-align: top\">" + "<div style=\"width: 25px; margin-top: " + topOffset + "px; margin-bottom: -10px\">");<NEW_LINE>if (icon != null) {<NEW_LINE>SafeHtml imageHtml = createMenuImageHtml(icon);<NEW_LINE>text.append(imageHtml.asString());<NEW_LINE>} else {<NEW_LINE>text.append("<br/>");<NEW_LINE>}<NEW_LINE>text.append("</div></td>");<NEW_LINE>label = StringUtil.notNull(label);<NEW_LINE>if (!html)<NEW_LINE>label = DomUtils.textToHtml(label);<NEW_LINE>text.append("<td>" + label + "</td>");<NEW_LINE>if (rightImage != null) {<NEW_LINE>SafeHtml <MASK><NEW_LINE>text.append("<td align=right width=\"25\"><div style=\"width: 25px; float: right; margin-top: -7px; margin-bottom: -10px;\">" + imageHtml.asString() + "</div></td>");<NEW_LINE>} else if (shortcut != null) {<NEW_LINE>text.append("<td align=right nowrap> " + shortcut + "</td>");<NEW_LINE>}<NEW_LINE>text.append("</tr></table>");<NEW_LINE>return text.toString();<NEW_LINE>} | imageHtml = createRightImageHtml(rightImage, rightImageDesc); |
1,280,952 | public FingerTree<V, A> cons(final A a) {<NEW_LINE>final Measured<V<MASK><NEW_LINE>final V measure = m.sum(m.measure(a), v);<NEW_LINE>final MakeTree<V, A> mk = mkTree(m);<NEW_LINE>return prefix.match(one -> new Deep<>(m, measure, mk.two(a, one.value()), middle, suffix), two -> new Deep<>(m, measure, mk.three(a, two.values()._1(), two.values()._2()), middle, suffix), three -> new Deep<>(m, measure, mk.four(a, three.values()._1(), three.values()._2(), three.values()._3()), middle, suffix), four -> new Deep<>(m, measure, mk.two(a, four.values()._1()), middle.cons(mk.node3(four.values()._2(), four.values()._3(), four.values()._4())), suffix));<NEW_LINE>} | , A> m = measured(); |
1,031,388 | public static CompIntIntVector mergeSparseIntCompVector(IndexGetParam param, List<PartitionGetResult> partResults) {<NEW_LINE>Map<PartitionKey, PartitionGetResult> partKeyToResultMap = mapPartKeyToResult(partResults);<NEW_LINE>List<PartitionKey> partKeys = getSortedPartKeys(param.matrixId, param.getRowId());<NEW_LINE>MatrixMeta meta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(param.matrixId);<NEW_LINE>int dim = (int) meta.getColNum();<NEW_LINE>int subDim = (int) meta.getBlockColNum();<NEW_LINE>int size = partKeys.size();<NEW_LINE>IntIntVector[] splitVecs = new IntIntVector[size];<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>if (param.getPartKeyToIndexesMap().containsKey(partKeys.get(i))) {<NEW_LINE>int[] values = ((IndexPartGetIntResult) partKeyToResultMap.get(partKeys.get(i))).getValues();<NEW_LINE>int[] indices = param.getPartKeyToIndexesMap().get(partKeys.get(i));<NEW_LINE>transformIndices(indices, partKeys.get(i));<NEW_LINE>splitVecs[i] = VFactory.sparseIntVector(subDim, indices, values);<NEW_LINE>} else {<NEW_LINE>splitVecs[i] = VFactory.sparseIntVector(subDim, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CompIntIntVector vector = VFactory.compIntIntVector(dim, splitVecs, subDim);<NEW_LINE>vector.setMatrixId(param.getMatrixId());<NEW_LINE>vector.<MASK><NEW_LINE>return vector;<NEW_LINE>} | setRowId(param.getRowId()); |
350,495 | public GetOrderResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetOrderResult getOrderResult = new GetOrderResult();<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 getOrderResult;<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("Order", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getOrderResult.setOrder(OrderJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getOrderResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
456,685 | public ODeleteEdgeStatement copy() {<NEW_LINE>ODeleteEdgeStatement result = null;<NEW_LINE>try {<NEW_LINE>result = getClass().getConstructor(Integer.TYPE).newInstance(-1);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>result.className = className == null <MASK><NEW_LINE>result.targetClusterName = targetClusterName == null ? null : targetClusterName.copy();<NEW_LINE>result.rid = rid == null ? null : rid.copy();<NEW_LINE>result.rids = rids == null ? null : rids.stream().map(x -> x.copy()).collect(Collectors.toList());<NEW_LINE>result.leftExpression = leftExpression == null ? null : leftExpression.copy();<NEW_LINE>result.rightExpression = rightExpression == null ? null : rightExpression.copy();<NEW_LINE>result.whereClause = whereClause == null ? null : whereClause.copy();<NEW_LINE>result.limit = limit == null ? null : limit.copy();<NEW_LINE>result.batch = batch == null ? null : batch.copy();<NEW_LINE>return result;<NEW_LINE>} | ? null : className.copy(); |
1,422,444 | public IRubyObject rationalize(ThreadContext context, IRubyObject[] args) {<NEW_LINE>if (f_negative_p(context, this)) {<NEW_LINE>return f_negate(context, f_abs(context, this).rationalize(context, args));<NEW_LINE>}<NEW_LINE>final Ruby runtime = context.runtime;<NEW_LINE>IRubyObject eps, a, b;<NEW_LINE>if (args.length != 0) {<NEW_LINE>eps = f_abs(context, args[0]);<NEW_LINE>a = f_sub(context, this, eps);<NEW_LINE>b = f_add(context, this, eps);<NEW_LINE>} else {<NEW_LINE>long[] exp = new long[1];<NEW_LINE>// float_decode_internal<NEW_LINE>double <MASK><NEW_LINE>f = ldexp(f, DBL_MANT_DIG);<NEW_LINE>long n = exp[0] - DBL_MANT_DIG;<NEW_LINE>RubyInteger rf = RubyBignum.newBignorm(runtime, f);<NEW_LINE>RubyFixnum rn = RubyFixnum.newFixnum(runtime, n);<NEW_LINE>if (rf.isZero() || fix2int(rn) >= 0) {<NEW_LINE>return RubyRational.newRationalRaw(runtime, rf.op_lshift(context, rn));<NEW_LINE>}<NEW_LINE>final RubyFixnum one = RubyFixnum.one(runtime);<NEW_LINE>RubyInteger den;<NEW_LINE>RubyInteger two_times_f = (RubyInteger) rf.op_mul(context, 2);<NEW_LINE>den = (RubyInteger) one.op_lshift(context, RubyFixnum.one(runtime).op_minus(context, n));<NEW_LINE>a = RubyRational.newRationalRaw(runtime, two_times_f.op_minus(context, 1), den);<NEW_LINE>b = RubyRational.newRationalRaw(runtime, two_times_f.op_plus(context, 1), den);<NEW_LINE>}<NEW_LINE>if (sites(context).op_equal.call(context, a, a, b).isTrue())<NEW_LINE>return f_to_r(context, this);<NEW_LINE>IRubyObject[] ans = nurat_rationalize_internal(context, a, b);<NEW_LINE>return RubyRational.newRationalRaw(runtime, ans[0], ans[1]);<NEW_LINE>} | f = frexp(value, exp); |
1,386,277 | private void autoAssignMappings() {<NEW_LINE>DBSObjectContainer objectContainer = chooseEntityContainer();<NEW_LINE>if (objectContainer == null) {<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>java.util.List<DBSObject> containerObjects = new ArrayList<>();<NEW_LINE>try {<NEW_LINE>getWizard().getContainer().run(true, true, mon -> {<NEW_LINE>try {<NEW_LINE>Collection<? extends DBSObject> children = objectContainer.getChildren(new DefaultProgressMonitor(mon));<NEW_LINE>if (children != null) {<NEW_LINE>containerObjects.addAll(children);<NEW_LINE>}<NEW_LINE>} catch (DBException e) {<NEW_LINE>throw new InvocationTargetException(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>DBWorkbench.getPlatformUI().showError(DTUIMessages.database_producer_page_input_objects_title_assign_error, DTUIMessages.database_producer_page_input_objects_message_error_reading_container_objects, e);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>if (CommonUtils.isEmpty(containerObjects)) {<NEW_LINE>setMessage(DTUIMessages.database_producer_page_input_objects_error_message_auto_assign_failed, WARNING);<NEW_LINE>} else {<NEW_LINE>autoAssignMappings(containerObjects);<NEW_LINE>}<NEW_LINE>} | setMessage(DTUIMessages.database_producer_page_input_objects_error_message_auto_assign_failed, WARNING); |
510,512 | public void rebuild(int index, int count) {<NEW_LINE>if (count != 0) {<NEW_LINE>int startOffset = (index == 0) ? -1 : getView(<MASK><NEW_LINE>int viewCount = getViewCount();<NEW_LINE>int endIndex = Math.min(index + count, viewCount);<NEW_LINE>int endOffset = (endIndex == viewCount) ? -1 : getView(endIndex).getStartOffset();<NEW_LINE>boolean loggable = LOG.isLoggable(Level.FINE);<NEW_LINE>long tm = 0;<NEW_LINE>if (loggable) {<NEW_LINE>tm = System.currentTimeMillis();<NEW_LINE>}<NEW_LINE>reloadChildren(index, count, startOffset, endOffset);<NEW_LINE>if (loggable) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.// NOI18N<NEW_LINE>fine(// NOI18N<NEW_LINE>"GapBoxView.rebuild(): " + (System.currentTimeMillis() - tm) + "ms; index=" + index + // NOI18N<NEW_LINE>", count=" + count + ", <" + startOffset + ", " + // NOI18N<NEW_LINE>endOffset + ">\n");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | index - 1).getEndOffset(); |
940,678 | public Status addLearners(final String groupId, final Configuration conf, final List<PeerId> learners) {<NEW_LINE>checkLearnersOpParams(groupId, conf, learners);<NEW_LINE>final PeerId leaderId = new PeerId();<NEW_LINE>final Status st = getLeader(groupId, conf, leaderId);<NEW_LINE>if (!st.isOk()) {<NEW_LINE>return st;<NEW_LINE>}<NEW_LINE>if (!this.cliClientService.connect(leaderId.getEndpoint())) {<NEW_LINE>return new Status(-1, "Fail to init channel to leader %s", leaderId);<NEW_LINE>}<NEW_LINE>final //<NEW_LINE>AddLearnersRequest.Builder //<NEW_LINE>rb = //<NEW_LINE>AddLearnersRequest.newBuilder().//<NEW_LINE>setGroupId(groupId).setLeaderId(leaderId.toString());<NEW_LINE>for (final PeerId peer : learners) {<NEW_LINE>rb.addLearners(peer.toString());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final Message result = this.cliClientService.addLearners(leaderId.getEndpoint(), rb.build(), null).get();<NEW_LINE>return processLearnersOpResponse(<MASK><NEW_LINE>} catch (final Exception e) {<NEW_LINE>return new Status(-1, e.getMessage());<NEW_LINE>}<NEW_LINE>} | groupId, result, "adding learners: %s", learners); |
1,246,015 | public void run(RegressionEnvironment env) {<NEW_LINE>AtomicInteger milestone = new AtomicInteger();<NEW_LINE>String epl = "@name('s0') select sum(intPrimitive) as si, window(sa.intPrimitive) as wi from SupportBean#length(2) as sa";<NEW_LINE>env.compileDeploy(epl).addListener("s0");<NEW_LINE>String[] fields = "si,wi".split(",");<NEW_LINE>env.sendEventBean(<MASK><NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 1, intArray(1) });<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("E2", 2));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 3, intArray(1, 2) });<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("E3", 3));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 5, intArray(2, 3) });<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.undeployAll();<NEW_LINE>epl = "@name('s0') select sum(intPrimitive) as si, window(sa.intPrimitive) as wi from SupportBean#keepall as sa group by theString";<NEW_LINE>env.compileDeploy(epl).addListener("s0");<NEW_LINE>env.sendEventBean(new SupportBean("E1", 1));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 1, intArray(1) });<NEW_LINE>env.sendEventBean(new SupportBean("E2", 2));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 2, intArray(2) });<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("E2", 3));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 5, intArray(2, 3) });<NEW_LINE>env.sendEventBean(new SupportBean("E1", 4));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 5, intArray(1, 4) });<NEW_LINE>env.undeployAll();<NEW_LINE>} | new SupportBean("E1", 1)); |
1,796,429 | private DataType applyAbstractPointerMsType(AbstractPointerMsType type) {<NEW_LINE>MsTypeApplier underlyingApplier = applicator.getTypeApplier(type.getUnderlyingRecordNumber());<NEW_LINE>if (underlyingApplier instanceof ProcedureTypeApplier) {<NEW_LINE>isFunctionPointer = true;<NEW_LINE>}<NEW_LINE>// DataType underlyingType = underlyingApplier.getCycleBreakType(); // out 20191211<NEW_LINE>DataType underlyingType = underlyingApplier.getCycleBreakType();<NEW_LINE>if (underlyingType == null) {<NEW_LINE>// TODO: we have seen underlyingTypeApplier is for NoTypeApplier for VtShapeMsType<NEW_LINE>// Figure it out, and perhaps create an applier that creates a structure or something?<NEW_LINE>underlyingType = applicator.getPdbPrimitiveTypeApplicator().getVoidType();<NEW_LINE>applicator.appendLogMsg("PDB Warning: No type conversion for " + underlyingApplier.getMsType().toString() + " as underlying type for pointer. Using void.");<NEW_LINE>}<NEW_LINE>int size = type<MASK><NEW_LINE>if (size == applicator.getDataOrganization().getPointerSize()) {<NEW_LINE>// Use default<NEW_LINE>size = -1;<NEW_LINE>}<NEW_LINE>Pointer pointer = new PointerDataType(underlyingType, size, applicator.getDataTypeManager());<NEW_LINE>return pointer;<NEW_LINE>} | .getSize().intValueExact(); |
1,153,694 | public static QuantileDigest fromByteBuffer(ByteBuffer byteBuffer) {<NEW_LINE>double maxError = byteBuffer.getDouble();<NEW_LINE>double alpha = byteBuffer.getDouble();<NEW_LINE>QuantileDigest quantileDigest = new QuantileDigest(maxError, alpha);<NEW_LINE>quantileDigest._landmarkInSeconds = byteBuffer.getLong();<NEW_LINE>quantileDigest._min = byteBuffer.getLong();<NEW_LINE>quantileDigest._max = byteBuffer.getLong();<NEW_LINE>int numNodes = byteBuffer.getInt();<NEW_LINE>quantileDigest._totalNodeCount = numNodes;<NEW_LINE>if (numNodes == 0) {<NEW_LINE>return quantileDigest;<NEW_LINE>}<NEW_LINE>Stack<Node> stack = new Stack<>();<NEW_LINE>for (int i = 0; i < numNodes; i++) {<NEW_LINE>int flags = byteBuffer.get();<NEW_LINE>int level = byteBuffer.get() & 0xFF;<NEW_LINE>long bits = byteBuffer.getLong();<NEW_LINE>double weightedCount = byteBuffer.getDouble();<NEW_LINE>Node node = new Node(bits, level, weightedCount);<NEW_LINE>if ((flags & Flags.HAS_RIGHT) != 0) {<NEW_LINE>node._right = stack.pop();<NEW_LINE>}<NEW_LINE>if ((flags & Flags.HAS_LEFT) != 0) {<NEW_LINE>node._left = stack.pop();<NEW_LINE>}<NEW_LINE>stack.push(node);<NEW_LINE>quantileDigest._weightedCount += weightedCount;<NEW_LINE>if (node._weightedCount >= ZERO_WEIGHT_THRESHOLD) {<NEW_LINE>quantileDigest._nonZeroNodeCount++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>checkState(stack.<MASK><NEW_LINE>quantileDigest._root = stack.pop();<NEW_LINE>return quantileDigest;<NEW_LINE>} | size() == 1, "Tree is corrupted, expecting a single root node"); |
269,325 | final DescribeAssociationExecutionsResult executeDescribeAssociationExecutions(DescribeAssociationExecutionsRequest describeAssociationExecutionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAssociationExecutionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAssociationExecutionsRequest> request = null;<NEW_LINE>Response<DescribeAssociationExecutionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAssociationExecutionsRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SSM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAssociationExecutions");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAssociationExecutionsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeAssociationExecutionsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(describeAssociationExecutionsRequest)); |
1,665,308 | void connect(SocketAddressProvider remoteAddressProvider, boolean reconnect, PipelineFactory pipelineFactory) {<NEW_LINE>Objects.requireNonNull(remoteAddressProvider, "remoteAddress");<NEW_LINE>final <MASK><NEW_LINE>Timer channelTimer = createTimer("Pinpoint-PinpointClientHandler-Timer");<NEW_LINE>final ChannelHandler writeTimeout = new WriteTimeoutHandler(channelTimer, 3000, TimeUnit.MILLISECONDS);<NEW_LINE>pipeline.addLast("writeTimeout", writeTimeout);<NEW_LINE>this.pinpointClientHandler = this.clientHandlerFactory.newClientHandler(connectionFactory, remoteAddressProvider, channelTimer, reconnect);<NEW_LINE>if (pinpointClientHandler instanceof SimpleChannelHandler) {<NEW_LINE>pipeline.addLast("socketHandler", (SimpleChannelHandler) this.pinpointClientHandler);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("invalid pinpointClientHandler");<NEW_LINE>}<NEW_LINE>final SocketAddress remoteAddress = remoteAddressProvider.resolve();<NEW_LINE>this.connectFuture = connect0(remoteAddress, pipeline);<NEW_LINE>} | ChannelPipeline pipeline = pipelineFactory.newPipeline(); |
292,599 | public CostModelManager optimizeCostModel() {<NEW_LINE>List<TreeNode> treeNodeList = TreeNodeUtils.buildTreeNodeListFromLeaf(this.getTreeLeaf());<NEW_LINE>CostGraph costGraph = CostUtils.buildCostGraph(this.getTreeLeaf(), this.labelManager);<NEW_LINE>NodeLabelManager nodeLabelManager = new NodeLabelManager();<NEW_LINE>NodeLabelList previousNodeLabel = null;<NEW_LINE>for (TreeNode treeNode : treeNodeList) {<NEW_LINE>NodeLabelList nodeLabelList = NodeLabelList.buildNodeLabel(previousNodeLabel, treeNode, schema);<NEW_LINE>nodeLabelManager.addNodeLabelList(nodeLabelList);<NEW_LINE>previousNodeLabel = nodeLabelList;<NEW_LINE>}<NEW_LINE>int pathIndex = this.getQueryConfig().getInt(CompilerConstant.QUERY_COSTMODEL_PLAN_PATH, -1);<NEW_LINE>List<CostPath<MASK><NEW_LINE>CostPath useCostPath;<NEW_LINE>if (pathIndex < 0 || pathIndex >= costPathList.size()) {<NEW_LINE>CostDataStatistics costDataStatistics = CostDataStatistics.getInstance();<NEW_LINE>List<Double> stepCountList = costDataStatistics.computeStepCountList(nodeLabelManager, treeNodeList);<NEW_LINE>List<Double> shuffleThresholdList = Lists.newArrayList(1.0);<NEW_LINE>for (int i = 1; i < stepCountList.size(); i++) {<NEW_LINE>shuffleThresholdList.add(1.5);<NEW_LINE>}<NEW_LINE>useCostPath = costGraph.computePath(stepCountList, shuffleThresholdList);<NEW_LINE>} else {<NEW_LINE>useCostPath = costPathList.get(pathIndex);<NEW_LINE>logger.info("Use specify cost path " + useCostPath.toString());<NEW_LINE>}<NEW_LINE>return new CostModelManager(costGraph, useCostPath);<NEW_LINE>} | > costPathList = costGraph.getCostPathList(); |
364,214 | protected void onRun() throws Exception {<NEW_LINE>SignalServiceAccountManager accountManager = ApplicationDependencies.getSignalServiceAccountManager();<NEW_LINE>StorageKey storageServiceKey = SignalStore.storageService().getOrCreateStorageKey();<NEW_LINE>Log.i(TAG, "Retrieving manifest...");<NEW_LINE>Optional<SignalStorageManifest> manifest = accountManager.getStorageManifest(storageServiceKey);<NEW_LINE>if (!manifest.isPresent()) {<NEW_LINE>Log.w(TAG, "Manifest did not exist or was undecryptable (bad key). Not restoring. Force-pushing.");<NEW_LINE>ApplicationDependencies.getJobManager().add(new StorageForcePushJob());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Log.i(TAG, "Resetting the local manifest to an empty state so that it will sync later.");<NEW_LINE>SignalStore.storageService().setManifest(SignalStorageManifest.EMPTY);<NEW_LINE>Optional<StorageId> accountId = manifest.get().getAccountStorageId();<NEW_LINE>if (!accountId.isPresent()) {<NEW_LINE>Log.w(TAG, "Manifest had no account record! Not restoring.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Log.i(TAG, "Retrieving account record...");<NEW_LINE>List<SignalStorageRecord> records = accountManager.readStorageRecords(storageServiceKey, Collections.singletonList(accountId.get()));<NEW_LINE>SignalStorageRecord record = records.size() > 0 ? records.get(0) : null;<NEW_LINE>if (record == null) {<NEW_LINE>Log.w(TAG, "Could not find account record, even though we had an ID! Not restoring.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SignalAccountRecord accountRecord = record.getAccount().orElse(null);<NEW_LINE>if (accountRecord == null) {<NEW_LINE>Log.w(TAG, "The storage record didn't actually have an account on it! Not restoring.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Log.i(TAG, "Applying changes locally...");<NEW_LINE>SignalDatabase.getRawDatabase().beginTransaction();<NEW_LINE>try {<NEW_LINE>StorageSyncHelper.applyAccountStorageSyncUpdates(context, Recipient.self(), accountRecord, false);<NEW_LINE>SignalDatabase.getRawDatabase().setTransactionSuccessful();<NEW_LINE>} finally {<NEW_LINE>SignalDatabase.getRawDatabase().endTransaction();<NEW_LINE>}<NEW_LINE>JobManager jobManager = ApplicationDependencies.getJobManager();<NEW_LINE>if (accountRecord.getAvatarUrlPath().isPresent()) {<NEW_LINE>Log.i(TAG, "Fetching avatar...");<NEW_LINE>Optional<JobTracker.JobState> state = jobManager.runSynchronously(new RetrieveProfileAvatarJob(Recipient.self(), accountRecord.getAvatarUrlPath().get()), LIFESPAN / 2);<NEW_LINE>if (state.isPresent()) {<NEW_LINE>Log.i(TAG, "Avatar retrieved successfully. " + state.get());<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Log.i(TAG, "No avatar present. Not fetching.");<NEW_LINE>}<NEW_LINE>Log.i(TAG, "Refreshing attributes...");<NEW_LINE>Optional<JobTracker.JobState> state = jobManager.runSynchronously(new RefreshAttributesJob(), LIFESPAN / 2);<NEW_LINE>if (state.isPresent()) {<NEW_LINE>Log.i(TAG, "Attributes refreshed successfully. " + state.get());<NEW_LINE>} else {<NEW_LINE>Log.w(TAG, "Attribute refresh did not complete in time (or otherwise failed).");<NEW_LINE>}<NEW_LINE>} | Log.w(TAG, "Avatar retrieval did not complete in time (or otherwise failed)."); |
821,648 | public void execute() throws BuildException {<NEW_LINE>if (skip) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (source == null) {<NEW_LINE>log("source attribute is required but was not set");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// attempt to parse the url<NEW_LINE>URL sourceURL;<NEW_LINE>try {<NEW_LINE>sourceURL = URLUtil.parseURL(source);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>log(String.format("Invalid schema source provided: %s", source));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// if url is a file, ensure it exists<NEW_LINE>if (URLUtil.parseProtocol(sourceURL.toString()) == URLProtocol.FILE) {<NEW_LINE>File sourceFile = new File(sourceURL.getFile());<NEW_LINE>if (!sourceFile.exists()) {<NEW_LINE>log(sourceFile.getAbsolutePath() + " cannot be found");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (targetDirectory == null) {<NEW_LINE>log("targetDirectory attribute is required but was not set");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ClassLoader extendedClassloader = buildExtendedClassloader();<NEW_LINE>Thread.currentThread().setContextClassLoader(extendedClassloader);<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>Jsonschema2Pojo.generate(this, ruleLogger);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new BuildException("Error generating classes from JSON Schema file(s) " + source, e);<NEW_LINE>}<NEW_LINE>} | RuleLogger ruleLogger = new AntRuleLogger(this); |
809,426 | private // If so, restart the TManagerClientService with the new TManagerLocation<NEW_LINE>void startTManagerChecker() {<NEW_LINE>final int checkIntervalSec = TypeUtils.getInteger(sinkConfig.get(KEY_TMANAGER_LOCATION_CHECK_INTERVAL_SEC));<NEW_LINE>Runnable runnable = new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>TopologyManager.TManagerLocation location = (TopologyManager.TManagerLocation) <MASK><NEW_LINE>if (location != null) {<NEW_LINE>if (currentTManagerLocation == null || !location.equals(currentTManagerLocation)) {<NEW_LINE>LOG.info("Update current TManagerLocation to: " + location);<NEW_LINE>currentTManagerLocation = location;<NEW_LINE>tManagerClientService.updateTManagerLocation(currentTManagerLocation);<NEW_LINE>tManagerClientService.startNewPrimaryClient();<NEW_LINE>// Update Metrics<NEW_LINE>sinkContext.exportCountMetric(TMANAGER_LOCATION_UPDATE_COUNT, 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Schedule itself in future<NEW_LINE>tManagerLocationStarter.schedule(this, checkIntervalSec, TimeUnit.SECONDS);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>// First Entry<NEW_LINE>tManagerLocationStarter.schedule(runnable, checkIntervalSec, TimeUnit.SECONDS);<NEW_LINE>LOG.info("TManagerChecker started with interval: " + checkIntervalSec);<NEW_LINE>} | SingletonRegistry.INSTANCE.getSingleton(TMANAGER_LOCATION_BEAN_NAME); |
1,255,954 | // -------------------------------------------------------------------------<NEW_LINE>@Override<NEW_LINE>public ResolvedFixedCouponBond resolve(ReferenceData refData) {<NEW_LINE>Schedule adjustedSchedule = accrualSchedule.createSchedule(refData);<NEW_LINE>Schedule unadjustedSchedule = adjustedSchedule.toUnadjusted();<NEW_LINE>DateAdjuster exCouponPeriodAdjuster = exCouponPeriod.resolve(refData);<NEW_LINE>ImmutableList.Builder<FixedCouponBondPaymentPeriod> accrualPeriods = ImmutableList.builder();<NEW_LINE>for (int i = 0; i < adjustedSchedule.size(); i++) {<NEW_LINE>SchedulePeriod period = adjustedSchedule.getPeriod(i);<NEW_LINE>SchedulePeriod unadjustedPeriod = unadjustedSchedule.getPeriod(i);<NEW_LINE>accrualPeriods.add(FixedCouponBondPaymentPeriod.builder().unadjustedStartDate(period.getUnadjustedStartDate()).unadjustedEndDate(period.getUnadjustedEndDate()).startDate(period.getStartDate()).endDate(period.getEndDate()).detachmentDate(exCouponPeriodAdjuster.adjust(period.getEndDate())).notional(notional).currency(currency).fixedRate(fixedRate).yearFraction(unadjustedPeriod.yearFraction(dayCount, unadjustedSchedule)).build());<NEW_LINE>}<NEW_LINE>ImmutableList<FixedCouponBondPaymentPeriod> periodicPayments = accrualPeriods.build();<NEW_LINE>FixedCouponBondPaymentPeriod lastPeriod = periodicPayments.get(<MASK><NEW_LINE>Payment nominalPayment = Payment.of(CurrencyAmount.of(currency, notional), lastPeriod.getPaymentDate());<NEW_LINE>return ResolvedFixedCouponBond.builder().securityId(securityId).legalEntityId(legalEntityId).nominalPayment(nominalPayment).periodicPayments(ImmutableList.copyOf(periodicPayments)).frequency(accrualSchedule.getFrequency()).rollConvention(accrualSchedule.calculatedRollConvention()).fixedRate(fixedRate).dayCount(dayCount).yieldConvention(yieldConvention).settlementDateOffset(settlementDateOffset).build();<NEW_LINE>} | periodicPayments.size() - 1); |
1,575,960 | private Optional<RepresentationModel<?>> doWithReferencedProperty(RootResourceInformation resourceInformation, Serializable id, String propertyPath, Function<ReferencedProperty, RepresentationModel<?>> handler, HttpMethod method) throws Exception {<NEW_LINE>ResourceMetadata metadata = resourceInformation.getResourceMetadata();<NEW_LINE>PropertyAwareResourceMapping mapping = metadata.getProperty(propertyPath);<NEW_LINE>if (mapping == null || !mapping.isExported()) {<NEW_LINE>throw new ResourceNotFoundException();<NEW_LINE>}<NEW_LINE>PersistentProperty<?<MASK><NEW_LINE>resourceInformation.verifySupportedMethod(method, property);<NEW_LINE>RepositoryInvoker invoker = resourceInformation.getInvoker();<NEW_LINE>Optional<Object> domainObj = invoker.invokeFindById(id);<NEW_LINE>domainObj.orElseThrow(() -> new ResourceNotFoundException());<NEW_LINE>return domainObj.map(it -> {<NEW_LINE>PersistentPropertyAccessor<?> accessor = property.getOwner().getPropertyAccessor(it);<NEW_LINE>return handler.apply(new ReferencedProperty(property, accessor.getProperty(property), accessor));<NEW_LINE>});<NEW_LINE>} | > property = mapping.getProperty(); |
1,504,608 | public static LocalPredictor loadLocalPredictor(String modelPath, TableSchema inputSchema) throws Exception {<NEW_LINE>Map<Long, List<Row>> rows = readPipelineModelRowsFromCsvFile(modelPath, LegacyModelExporterUtils.PIPELINE_MODEL_SCHEMA);<NEW_LINE>Preconditions.checkState(rows.containsKey(-1L), "can't find meta in model.");<NEW_LINE>String meta = (String) rows.get(-1L).get(0).getField(1);<NEW_LINE>PipelineStageBase[] transformers = constructPipelineStagesFromMeta(meta, 0L);<NEW_LINE>String[] modelSchemaStr = JsonConverter.fromJson(JsonPath.read(meta, "$.schema").toString(), String[].class);<NEW_LINE>LocalPredictor predictor = null;<NEW_LINE>TableSchema schema = inputSchema;<NEW_LINE>for (int i = 0; i < transformers.length; i++) {<NEW_LINE>PipelineStageBase transformer = transformers[i];<NEW_LINE>LocalPredictor localPredictor;<NEW_LINE>if (transformer instanceof MapModel) {<NEW_LINE>MapModel<?> mapModel = (MapModel) transformer;<NEW_LINE>ModelMapper mapper = mapModel.mapperBuilder.apply(TableUtil.schemaStr2Schema(modelSchemaStr[i]), schema, mapModel.getParams());<NEW_LINE>CsvParser csvParser = new CsvParser(TableUtil.getColTypes(modelSchemaStr[i]), "^", '\'');<NEW_LINE>List<Row> modelRows = rows.get((long) i);<NEW_LINE>int s = modelRows.size();<NEW_LINE>for (int j = 0; j < s; j++) {<NEW_LINE>Row r = modelRows.get(j);<NEW_LINE>r = csvParser.parse((String) r.getField(1)).f1;<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>mapper.loadModel(modelRows);<NEW_LINE>localPredictor = new LocalPredictor(mapper);<NEW_LINE>} else {<NEW_LINE>localPredictor = ((LocalPredictable) transformer).collectLocalPredictor(schema);<NEW_LINE>}<NEW_LINE>schema = localPredictor.getOutputSchema();<NEW_LINE>if (predictor == null) {<NEW_LINE>predictor = localPredictor;<NEW_LINE>} else {<NEW_LINE>predictor.merge(localPredictor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return predictor;<NEW_LINE>} | modelRows.set(j, r); |
534,067 | private boolean checkJoinRequest(JoinRequest joinRequest, ServerConnection connection) {<NEW_LINE>if (checkIfJoinRequestFromAnExistingMember(joinRequest, connection)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>final InternalHotRestartService hotRestartService = node.getNodeExtension().getInternalHotRestartService();<NEW_LINE><MASK><NEW_LINE>UUID targetUuid = joinRequest.getUuid();<NEW_LINE>if (hotRestartService.isMemberExcluded(target, targetUuid)) {<NEW_LINE>logger.fine("cannot join " + target + " because it is excluded in cluster start.");<NEW_LINE>hotRestartService.notifyExcludedMember(target);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (joinRequest.getExcludedMemberUuids().contains(clusterService.getThisUuid())) {<NEW_LINE>logger.warning("cannot join " + target + " since this node is excluded in its list...");<NEW_LINE>hotRestartService.handleExcludedMemberUuids(target, joinRequest.getExcludedMemberUuids());<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return checkClusterStateBeforeJoin(target, targetUuid);<NEW_LINE>} | Address target = joinRequest.getAddress(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.