idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
884,071 | public GetTagsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetTagsResult getTagsResult = new GetTagsResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getTagsResult;<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("tags", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getTagsResult.setTags(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getTagsResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,069,549 | public void write(org.apache.thrift.protocol.TProtocol prot, partition_configuration struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>java.util.BitSet optionals = new java.util.BitSet();<NEW_LINE>if (struct.isSetPid()) {<NEW_LINE>optionals.set(0);<NEW_LINE>}<NEW_LINE>if (struct.isSetBallot()) {<NEW_LINE>optionals.set(1);<NEW_LINE>}<NEW_LINE>if (struct.isSetMax_replica_count()) {<NEW_LINE>optionals.set(2);<NEW_LINE>}<NEW_LINE>if (struct.isSetPrimary()) {<NEW_LINE>optionals.set(3);<NEW_LINE>}<NEW_LINE>if (struct.isSetSecondaries()) {<NEW_LINE>optionals.set(4);<NEW_LINE>}<NEW_LINE>if (struct.isSetLast_drops()) {<NEW_LINE>optionals.set(5);<NEW_LINE>}<NEW_LINE>if (struct.isSetLast_committed_decree()) {<NEW_LINE>optionals.set(6);<NEW_LINE>}<NEW_LINE>oprot.writeBitSet(optionals, 7);<NEW_LINE>if (struct.isSetPid()) {<NEW_LINE>struct.pid.write(oprot);<NEW_LINE>}<NEW_LINE>if (struct.isSetBallot()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (struct.isSetMax_replica_count()) {<NEW_LINE>oprot.writeI32(struct.max_replica_count);<NEW_LINE>}<NEW_LINE>if (struct.isSetPrimary()) {<NEW_LINE>struct.primary.write(oprot);<NEW_LINE>}<NEW_LINE>if (struct.isSetSecondaries()) {<NEW_LINE>{<NEW_LINE>oprot.writeI32(struct.secondaries.size());<NEW_LINE>for (rpc_address _iter8 : struct.secondaries) {<NEW_LINE>_iter8.write(oprot);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (struct.isSetLast_drops()) {<NEW_LINE>{<NEW_LINE>oprot.writeI32(struct.last_drops.size());<NEW_LINE>for (rpc_address _iter9 : struct.last_drops) {<NEW_LINE>_iter9.write(oprot);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (struct.isSetLast_committed_decree()) {<NEW_LINE>oprot.writeI64(struct.last_committed_decree);<NEW_LINE>}<NEW_LINE>} | oprot.writeI64(struct.ballot); |
316,788 | // PK83345 Start<NEW_LINE>protected void commonInitializationFinally(List extensionFactories) {<NEW_LINE>// PM62909 , Specification Topic :: Web Application Deployment, Initialize Filters before Startup Servlets<NEW_LINE>if (com.ibm.ws.webcontainer.osgi.WebContainer.isServerStopping())<NEW_LINE>return;<NEW_LINE>if (initFilterBeforeServletInit) {<NEW_LINE>try {<NEW_LINE>if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))<NEW_LINE>logger.logp(Level.FINE, CLASS_NAME, "commonInitializationFinally", "initFilterBeforeServletInit set");<NEW_LINE>initializeFilterManager();<NEW_LINE>} catch (Throwable th) {<NEW_LINE>logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.initializing.filters", th);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// PM62909 End<NEW_LINE>try {<NEW_LINE>doLoadOnStartupActions();<NEW_LINE>} catch (Throwable th) {<NEW_LINE>// pk435011<NEW_LINE>logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.while.initializing.servlets", new Object[] { th });<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>initializeTargetMappings();<NEW_LINE>} catch (Throwable th) {<NEW_LINE>// pk435011<NEW_LINE>logger.logp(Level.SEVERE, CLASS_NAME, "commonInitializationFinally", "error.while.initializing.target.mappings", th);<NEW_LINE>}<NEW_LINE>if (!initFilterBeforeServletInit) {<NEW_LINE>// PM62909<NEW_LINE>try {<NEW_LINE>// initialize filter manager<NEW_LINE>// keeping old implementation for now<NEW_LINE>initializeFilterManager();<NEW_LINE>} catch (Throwable th) {<NEW_LINE>// pk435011<NEW_LINE>logger.logp(Level.SEVERE, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | CLASS_NAME, "commonInitializationFinally", "error.initializing.filters", th); |
35,668 | public MergeStatus merge(TicketModel ticket) {<NEW_LINE>PersonIdent committer = new PersonIdent(user.getDisplayName(), StringUtils.isEmpty(user.emailAddress) ? (user.username + "@gitblit") : user.emailAddress);<NEW_LINE>Patchset patchset = ticket.getCurrentPatchset();<NEW_LINE>String message = MessageFormat.format("Merged #{0,number,0} \"{1}\"", ticket.number, ticket.title);<NEW_LINE>Ref oldRef = null;<NEW_LINE>try {<NEW_LINE>oldRef = getRepository().getRef(ticket.mergeTo);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.error("failed to get ref for " + ticket.mergeTo, e);<NEW_LINE>}<NEW_LINE>MergeResult mergeResult = JGitUtils.merge(getRepository(), patchset.tip, ticket.mergeTo, getRepositoryModel().mergeType, committer, message);<NEW_LINE>if (StringUtils.isEmpty(mergeResult.sha)) {<NEW_LINE>LOGGER.error("FAILED to merge {} to {} ({})", new Object[] { patchset, ticket.mergeTo, mergeResult<MASK><NEW_LINE>return mergeResult.status;<NEW_LINE>}<NEW_LINE>Change change = new Change(user.username);<NEW_LINE>change.setField(Field.status, Status.Merged);<NEW_LINE>change.setField(Field.mergeSha, mergeResult.sha);<NEW_LINE>change.setField(Field.mergeTo, ticket.mergeTo);<NEW_LINE>if (StringUtils.isEmpty(ticket.responsible)) {<NEW_LINE>// unassigned tickets are assigned to the closer<NEW_LINE>change.setField(Field.responsible, user.username);<NEW_LINE>}<NEW_LINE>long ticketId = ticket.number;<NEW_LINE>ticket = ticketService.updateTicket(repository, ticket.number, change);<NEW_LINE>if (ticket != null) {<NEW_LINE>ticketNotifier.queueMailing(ticket);<NEW_LINE>if (oldRef != null) {<NEW_LINE>ReceiveCommand cmd = new ReceiveCommand(oldRef.getObjectId(), ObjectId.fromString(mergeResult.sha), oldRef.getName());<NEW_LINE>cmd.setResult(Result.OK);<NEW_LINE>List<ReceiveCommand> commands = Arrays.asList(cmd);<NEW_LINE>logRefChange(commands);<NEW_LINE>updateIncrementalPushTags(commands);<NEW_LINE>updateGitblitRefLog(commands);<NEW_LINE>}<NEW_LINE>// call patchset hooks<NEW_LINE>for (PatchsetHook hook : gitblit.getExtensions(PatchsetHook.class)) {<NEW_LINE>try {<NEW_LINE>hook.onMergePatchset(ticket);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Failed to execute extension", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return mergeResult.status;<NEW_LINE>} else {<NEW_LINE>LOGGER.error("FAILED to resolve ticket {} by merge from web ui", ticketId);<NEW_LINE>}<NEW_LINE>return mergeResult.status;<NEW_LINE>} | .status.name() }); |
1,844,053 | final ListArtifactsResult executeListArtifacts(ListArtifactsRequest listArtifactsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listArtifactsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListArtifactsRequest> request = null;<NEW_LINE>Response<ListArtifactsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListArtifactsRequestProtocolMarshaller(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, "Device Farm");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListArtifacts");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListArtifactsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListArtifactsResultJsonUnmarshaller());<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(listArtifactsRequest)); |
1,168,315 | private void childLock(final MenuItem item) {<NEW_LINE>AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.CustomAlertDialogTheme);<NEW_LINE>builder.setTitle(R.string.action_mode_child_lock);<NEW_LINE>builder.setMessage(R.string.action_mode_dialog_message_lock);<NEW_LINE>builder.setIcon(R.drawable.ic_lock_outline_blue_24dp);<NEW_LINE>LayoutInflater inflater = getLayoutInflater();<NEW_LINE>@SuppressLint("InflateParams")<NEW_LINE>final View inputView = inflater.inflate(R.layout.edit_text_for_dialog, null, false);<NEW_LINE>final EditText input = inputView.findViewById(R.id.etForDialog);<NEW_LINE>input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);<NEW_LINE>final MainActivity mainActivity = this;<NEW_LINE>String saved_pass = preferenceRepository.get().getStringPreference("passwd");<NEW_LINE>if (!saved_pass.isEmpty()) {<NEW_LINE>saved_pass = new String(Base64.decode(saved_pass, 16));<NEW_LINE>input.setText(saved_pass);<NEW_LINE>input.setSelection(saved_pass.length());<NEW_LINE>}<NEW_LINE>builder.setView(inputView);<NEW_LINE>builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> {<NEW_LINE>if (input.getText().toString().equals("debug")) {<NEW_LINE><MASK><NEW_LINE>Toast.makeText(getApplicationContext(), "Debug mode " + TopFragment.debug, Toast.LENGTH_LONG).show();<NEW_LINE>} else if (!input.getText().toString().trim().isEmpty()) {<NEW_LINE>String pass = Base64.encodeToString((input.getText().toString() + "-l-o-c-k-e-d").getBytes(), 16);<NEW_LINE>preferenceRepository.get().setStringPreference("passwd", pass);<NEW_LINE>Toast.makeText(getApplicationContext(), getText(R.string.action_mode_dialog_locked), Toast.LENGTH_SHORT).show();<NEW_LINE>item.setIcon(R.drawable.ic_lock_white_24dp);<NEW_LINE>childLockActive = true;<NEW_LINE>DrawerLayout mDrawerLayout = mainActivity.findViewById(R.id.drawer_layout);<NEW_LINE>mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>builder.setNegativeButton(R.string.cancel, (dialogInterface, i) -> dialogInterface.cancel());<NEW_LINE>builder.show();<NEW_LINE>} | TopFragment.debug = !TopFragment.debug; |
677,723 | protected void afterObjectNew(String desc) {<NEW_LINE>if (loc.getWhere() == Where.AFTER) {<NEW_LINE>String extName = desc.replace('/', '.');<NEW_LINE>if (matches(loc.getClazz(), extName)) {<NEW_LINE>Type instType = Type.getObjectType(desc);<NEW_LINE>addExtraTypeInfo(om.getSelfParameter(), Type.getObjectType(className));<NEW_LINE>addExtraTypeInfo(om.getReturnParameter(), instType);<NEW_LINE>ValidationResult vr = validateArguments(om, actionArgTypes, new Type<MASK><NEW_LINE>if (vr.isValid()) {<NEW_LINE>int returnValIndex = -1;<NEW_LINE>Label l = levelCheck(om, bcn.getClassName(true));<NEW_LINE>if (om.getReturnParameter() != -1) {<NEW_LINE>asm.dupValue(instType);<NEW_LINE>returnValIndex = storeAsNew();<NEW_LINE>}<NEW_LINE>loadArguments(constArg(vr.getArgIdx(0), extName), localVarArg(om.getReturnParameter(), instType, returnValIndex), constArg(om.getClassNameParameter(), className.replace('/', '.')), constArg(om.getMethodParameter(), getName(om.isMethodFqn())), selfArg(om.getSelfParameter(), Type.getObjectType(className)));<NEW_LINE>invokeBTraceAction(asm, om);<NEW_LINE>if (l != null) {<NEW_LINE>mv.visitLabel(l);<NEW_LINE>insertFrameSameStack(l);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | [] { Constants.STRING_TYPE }); |
555,569 | private SourcePath requireSharedLibrary(BuildTarget target, ActionGraphBuilder graphBuilder, CellPathResolver cellRoots, ProjectFilesystem filesystem, CxxPlatform cxxPlatform, Optional<ImmutableMap<BuildTarget, Version>> selectedVersions, PrebuiltCxxLibraryDescriptionArg args) {<NEW_LINE>// If the shared library is prebuilt, just return a reference to it.<NEW_LINE>PrebuiltCxxLibraryPaths <MASK><NEW_LINE>Optional<SourcePath> sharedLibraryPath = paths.getSharedLibrary(filesystem, graphBuilder, cellRoots, cxxPlatform, selectedVersions);<NEW_LINE>if (sharedLibraryPath.isPresent()) {<NEW_LINE>return sharedLibraryPath.get();<NEW_LINE>}<NEW_LINE>// Otherwise, generate it's build rule.<NEW_LINE>CxxLink sharedLibrary = (CxxLink) graphBuilder.requireRule(target.withAppendedFlavors(cxxPlatform.getFlavor(), Type.SHARED.getFlavor()));<NEW_LINE>return sharedLibrary.getSourcePathToOutput();<NEW_LINE>} | paths = getPaths(target, args); |
1,439,476 | protected EntityTypesMap retrieveEntityTypesMap() {<NEW_LINE>final List<EntityTypeEntry> entries = new ArrayList<>(50);<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>final String sql = "SELECT * FROM AD_EntityType WHERE IsActive=? ORDER BY AD_EntityType_ID";<NEW_LINE>final Object[] sqlParams <MASK><NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql, ITrx.TRXNAME_None);<NEW_LINE>DB.setParameters(pstmt, sqlParams);<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>while (rs.next()) {<NEW_LINE>final EntityTypeEntry entry = loadEntityTypeEntry(rs);<NEW_LINE>entries.add(entry);<NEW_LINE>}<NEW_LINE>return EntityTypesMap.of(entries);<NEW_LINE>} catch (final SQLException e) {<NEW_LINE>throw new DBException(e, sql, sqlParams);<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>rs = null;<NEW_LINE>pstmt = null;<NEW_LINE>}<NEW_LINE>} | = new Object[] { true }; |
188,846 | private static boolean decodePointVar(byte[] p, int pOff, boolean negate, PointExt r) {<NEW_LINE>byte[] py = copy(p, pOff, POINT_BYTES);<NEW_LINE>if (!checkPointVar(py)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int x_0 = (py[POINT_BYTES - 1] & 0x80) >>> 7;<NEW_LINE>py[POINT_BYTES - 1] &= 0x7F;<NEW_LINE>F.decode(py, 0, r.y);<NEW_LINE>int[] u = F.create();<NEW_LINE>int[] v = F.create();<NEW_LINE>F.sqr(r.y, u);<NEW_LINE>F.mul(u, -C_d, v);<NEW_LINE>F.negate(u, u);<NEW_LINE>F.addOne(u);<NEW_LINE>F.addOne(v);<NEW_LINE>if (!F.sqrtRatioVar(u, v, r.x)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>F.normalize(r.x);<NEW_LINE>if (x_0 == 1 && F.isZeroVar(r.x)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (negate ^ (x_0 != (r.x[0] & 1))) {<NEW_LINE>F.negate(<MASK><NEW_LINE>}<NEW_LINE>pointExtendXY(r);<NEW_LINE>return true;<NEW_LINE>} | r.x, r.x); |
797,651 | protected Pair<JavaRDD<String>, JavaRDD<String>> splitNewDataToTrainTest(JavaRDD<String> newData) {<NEW_LINE>// Rough approximation; assumes timestamps are fairly evenly distributed<NEW_LINE>StatCounter maxMin = newData.mapToDouble(line -> MLFunctions.TO_TIMESTAMP_FN.call(line).doubleValue()).stats();<NEW_LINE>long minTime = (long) maxMin.min();<NEW_LINE>long maxTime = (long) maxMin.max();<NEW_LINE>log.info("New data timestamp range: {} - {}", minTime, maxTime);<NEW_LINE>long approxTestTrainBoundary = (long) (maxTime - getTestFraction() * (maxTime - minTime));<NEW_LINE>log.info("Splitting at timestamp {}", approxTestTrainBoundary);<NEW_LINE>JavaRDD<String> newTrainData = newData.filter(line -> MLFunctions.TO_TIMESTAMP_FN.call(line) < approxTestTrainBoundary);<NEW_LINE>JavaRDD<String> testData = newData.filter(line -> MLFunctions.TO_TIMESTAMP_FN<MASK><NEW_LINE>return new Pair<>(newTrainData, testData);<NEW_LINE>} | .call(line) >= approxTestTrainBoundary); |
1,276,125 | public void writeTo(Object t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {<NEW_LINE>MessageBodyWriter jaxbWriter = this.providers.getMessageBodyWriter(type, genericType, annotations, MediaType.APPLICATION_XML_TYPE);<NEW_LINE>ByteArrayOutputStream os = new ByteArrayOutputStream();<NEW_LINE>// mediaType =<NEW_LINE>// MediaTypeUtils.setDefaultCharsetOnMediaTypeHeader(httpHeaders,<NEW_LINE>// mediaType);<NEW_LINE>jaxbWriter.writeTo(t, type, genericType, annotations, MediaType.APPLICATION_XML_TYPE, httpHeaders, os);<NEW_LINE>try {<NEW_LINE>Method m = ProviderUtils.getMethod("com.ibm.json.xml.XMLToJSONTransformer", "transform", new Class<?>[] { InputStream.class, OutputStream.class });<NEW_LINE>ReflectUtil.invoke(m, null, new Object[] { new ByteArrayInputStream(os.<MASK><NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw new WebApplicationException(e);<NEW_LINE>}<NEW_LINE>} | toByteArray()), entityStream }); |
1,688,038 | static void data(EntityManager em) {<NEW_LINE>// Set up database<NEW_LINE>// ---------------<NEW_LINE>Language english = new Language("English");<NEW_LINE><MASK><NEW_LINE>Actor umaThurman = new Actor("Uma", "Thurman");<NEW_LINE>Actor davidCarradine = new Actor("David", "Carradine");<NEW_LINE>Actor darylHannah = new Actor("Daryl", "Hannah");<NEW_LINE>Actor michaelAngarano = new Actor("Michael", "Angarano");<NEW_LINE>Actor reeceThompson = new Actor("Reece", "Thompson");<NEW_LINE>Film killBill = new Film(Title.of("Kill Bill"), english, 111, Year.of(2015));<NEW_LINE>Film meerjungfrauen = new Film(Title.of("Meerjungfrauen ticken anders"), german, 89, Year.of(2017));<NEW_LINE>killBill.actors.addAll(Arrays.asList(umaThurman, davidCarradine, darylHannah));<NEW_LINE>meerjungfrauen.actors.addAll(Arrays.asList(umaThurman, michaelAngarano, reeceThompson));<NEW_LINE>em.persist(english);<NEW_LINE>em.persist(german);<NEW_LINE>em.persist(umaThurman);<NEW_LINE>em.persist(davidCarradine);<NEW_LINE>em.persist(darylHannah);<NEW_LINE>em.persist(michaelAngarano);<NEW_LINE>em.persist(reeceThompson);<NEW_LINE>em.persist(killBill);<NEW_LINE>em.persist(meerjungfrauen);<NEW_LINE>em.flush();<NEW_LINE>} | Language german = new Language("German"); |
1,450,788 | private static EventType resolveOrCreateType(EPTypeClass clazz, StatementCompileTimeServices services) {<NEW_LINE>services.getEventTypeCompileTimeResolver();<NEW_LINE>// find module-own type<NEW_LINE>Collection<EventType> moduleTypes = services.getEventTypeCompileTimeRegistry().getNewTypesAdded();<NEW_LINE>for (EventType eventType : moduleTypes) {<NEW_LINE>if (matches(eventType, clazz)) {<NEW_LINE>return eventType;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// find path types<NEW_LINE>PathRegistry<String, EventType> pathRegistry = services.getEventTypeCompileTimeResolver().getPath();<NEW_LINE>List<EventType> <MASK><NEW_LINE>pathRegistry.traverse(eventType -> {<NEW_LINE>if (matches(eventType, clazz)) {<NEW_LINE>found.add(eventType);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (found.size() > 1) {<NEW_LINE>throw new EPException("Found multiple parent types in path for classs '" + clazz + "'");<NEW_LINE>}<NEW_LINE>if (!found.isEmpty()) {<NEW_LINE>return found.get(0);<NEW_LINE>}<NEW_LINE>return services.getBeanEventTypeFactoryPrivate().getCreateBeanType(clazz, false);<NEW_LINE>} | found = new ArrayList<>(); |
815,925 | private <T> Page<T> sortAndPage(Integer pageNum, Integer pageSize, String sortField, Sort.Direction sortType, List<T> defectBaseVoList) {<NEW_LINE>if (StringUtils.isEmpty(sortField)) {<NEW_LINE>sortField = "createTime";<NEW_LINE>}<NEW_LINE>if (null == sortType) {<NEW_LINE>sortType = Sort.Direction.ASC;<NEW_LINE>}<NEW_LINE>ListSortUtil.sort(defectBaseVoList, sortField, sortType.name());<NEW_LINE>int total = defectBaseVoList.size();<NEW_LINE>pageNum = pageNum == null || pageNum - 1 < 0 ? 0 : pageNum - 1;<NEW_LINE>int pageSizeNum = 10;<NEW_LINE>if (pageSize != null && pageSize >= 0) {<NEW_LINE>pageSizeNum = pageSize;<NEW_LINE>}<NEW_LINE>int totalPageNum = 0;<NEW_LINE>if (total > 0) {<NEW_LINE>totalPageNum = (total + pageSizeNum - 1) / pageSizeNum;<NEW_LINE>}<NEW_LINE>int subListBeginIdx = pageNum * pageSizeNum;<NEW_LINE>int subListEndIdx = subListBeginIdx + pageSizeNum;<NEW_LINE>if (subListBeginIdx > total) {<NEW_LINE>subListBeginIdx = 0;<NEW_LINE>}<NEW_LINE>defectBaseVoList = defectBaseVoList.subList(subListBeginIdx, subListEndIdx > total ? total : subListEndIdx);<NEW_LINE>return new Page<>(total, pageNum + <MASK><NEW_LINE>} | 1, pageSizeNum, totalPageNum, defectBaseVoList); |
1,302,162 | public Request<PutAccessPointPolicyForObjectLambdaRequest> marshall(PutAccessPointPolicyForObjectLambdaRequest putAccessPointPolicyForObjectLambdaRequest) {<NEW_LINE>if (putAccessPointPolicyForObjectLambdaRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<PutAccessPointPolicyForObjectLambdaRequest> request = new DefaultRequest<PutAccessPointPolicyForObjectLambdaRequest>(putAccessPointPolicyForObjectLambdaRequest, "AWSS3Control");<NEW_LINE>request.setHttpMethod(HttpMethodName.PUT);<NEW_LINE>if (putAccessPointPolicyForObjectLambdaRequest.getAccountId() != null) {<NEW_LINE>request.addHeader("x-amz-account-id", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>String uriResourcePath = "/v20180820/accesspointforobjectlambda/{name}/policy";<NEW_LINE>uriResourcePath = com.amazonaws.transform.PathMarshallers.NON_GREEDY.marshall(uriResourcePath, "name", putAccessPointPolicyForObjectLambdaRequest.getName());<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>XMLWriter xmlWriter = new XMLWriter(stringWriter, "http://awss3control.amazonaws.com/doc/2018-08-20/");<NEW_LINE>xmlWriter.startElement("PutAccessPointPolicyForObjectLambdaRequest");<NEW_LINE>if (putAccessPointPolicyForObjectLambdaRequest != null) {<NEW_LINE>if (putAccessPointPolicyForObjectLambdaRequest.getPolicy() != null) {<NEW_LINE>xmlWriter.startElement("Policy").value(putAccessPointPolicyForObjectLambdaRequest.getPolicy()).endElement();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>xmlWriter.endElement();<NEW_LINE>request.setContent(new StringInputStream(stringWriter.getBuffer().toString()));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(stringWriter.getBuffer().toString().getBytes(UTF8).length));<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/xml");<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to XML: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (putAccessPointPolicyForObjectLambdaRequest.getAccountId())); |
1,774,926 | public Attachment addAttachment(final String assetId, final AttachmentSummary attSummary) throws IOException, BadVersionException, RequestFailureException {<NEW_LINE>final Attachment attach = attSummary.getAttachment();<NEW_LINE>final String name = attSummary.getName();<NEW_LINE>// Info about the attachment goes into the URL<NEW_LINE>String urlString <MASK><NEW_LINE>if (attach.getType() != null) {<NEW_LINE>urlString = urlString + "&type=" + attach.getType().toString();<NEW_LINE>}<NEW_LINE>HttpURLConnection connection = createHttpURLConnectionToMassive(urlString);<NEW_LINE>if (attSummary.getURL() == null) {<NEW_LINE>writeMultiPart(assetId, attSummary, connection);<NEW_LINE>} else {<NEW_LINE>writeSinglePart(assetId, attSummary, connection);<NEW_LINE>}<NEW_LINE>ByteArrayOutputStream baos = new ByteArrayOutputStream();<NEW_LINE>testResponseCode(connection);<NEW_LINE>InputStream is = connection.getInputStream();<NEW_LINE>int len = 0;<NEW_LINE>while ((len = is.read()) != -1) {<NEW_LINE>baos.write((byte) len);<NEW_LINE>}<NEW_LINE>is.close();<NEW_LINE>baos.close();<NEW_LINE>Attachment attachment = JSONAssetConverter.readValue(new ByteArrayInputStream(baos.toByteArray()), Attachment.class);<NEW_LINE>return attachment;<NEW_LINE>} | = "/assets/" + assetId + "/attachments?name=" + name; |
1,155,969 | private SmsMessage updateMessageStatus(Context context, Uri messageUri, byte[] pdu, String format) {<NEW_LINE>SmsMessage message = SmsMessage.createFromPdu(pdu);<NEW_LINE>if (message == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Create a "status/#" URL and use it to update the<NEW_LINE>// message's status in the database.<NEW_LINE>Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), messageUri, ID_PROJECTION, null, null, null);<NEW_LINE>if (cursor == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (cursor.moveToFirst()) {<NEW_LINE>int messageId = cursor.getInt(0);<NEW_LINE>Uri updateUri = ContentUris.withAppendedId(STATUS_URI, messageId);<NEW_LINE>int status = message.getStatus();<NEW_LINE>boolean isStatusReport = message.isStatusReportMessage();<NEW_LINE>ContentValues contentValues = new ContentValues(2);<NEW_LINE>log("updateMessageStatus: msgUrl=" + messageUri + ", status=" + status + ", isStatusReport=" + isStatusReport);<NEW_LINE>contentValues.<MASK><NEW_LINE>contentValues.put(Inbox.DATE_SENT, System.currentTimeMillis());<NEW_LINE>SqliteWrapper.update(context, context.getContentResolver(), updateUri, contentValues, null, null);<NEW_LINE>} else {<NEW_LINE>error("Can't find message for status update: " + messageUri);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>cursor.close();<NEW_LINE>}<NEW_LINE>return message;<NEW_LINE>} | put(Sms.STATUS, status); |
685,456 | public Expression implement(RexToLixTranslator translator, RexCall call, List<Expression> translatedOperands) {<NEW_LINE>switch(call.getOperands().size()) {<NEW_LINE>case 1:<NEW_LINE>switch(call.getType().getSqlTypeName()) {<NEW_LINE>case BIGINT:<NEW_LINE>case INTEGER:<NEW_LINE>case SMALLINT:<NEW_LINE>case TINYINT:<NEW_LINE>return translatedOperands.get(0);<NEW_LINE>default:<NEW_LINE>return super.implement(translator, call, translatedOperands);<NEW_LINE>}<NEW_LINE>case 2:<NEW_LINE>final Type type;<NEW_LINE>final Method floorMethod;<NEW_LINE>Expression operand = translatedOperands.get(0);<NEW_LINE>switch(call.getType().getSqlTypeName()) {<NEW_LINE>case TIMESTAMP_WITH_LOCAL_TIME_ZONE:<NEW_LINE>operand = Expressions.call(BuiltInMethod.TIMESTAMP_WITH_LOCAL_TIME_ZONE_TO_TIMESTAMP.method, operand, Expressions.call(BuiltInMethod.TIME_ZONE.method, translator.getRoot()));<NEW_LINE>// fall through<NEW_LINE>case TIMESTAMP:<NEW_LINE>type = long.class;<NEW_LINE>floorMethod = timestampMethod;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>type = int.class;<NEW_LINE>floorMethod = dateMethod;<NEW_LINE>}<NEW_LINE>final ConstantExpression tur = (ConstantExpression) translatedOperands.get(1);<NEW_LINE>final TimeUnitRange timeUnitRange = (TimeUnitRange) tur.value;<NEW_LINE>switch(timeUnitRange) {<NEW_LINE>case YEAR:<NEW_LINE>case MONTH:<NEW_LINE>return Expressions.call(floorMethod, tur, call(operand, type, TimeUnit.DAY));<NEW_LINE>case NANOSECOND:<NEW_LINE>default:<NEW_LINE>return call(<MASK><NEW_LINE>}<NEW_LINE>default:<NEW_LINE>throw new AssertionError();<NEW_LINE>}<NEW_LINE>} | operand, type, timeUnitRange.startUnit); |
1,605,480 | protected List<PortForwardingStruct> makePortForwardingStruct(List<VmNicInventory> nics, boolean releaseVmNicInfo, L3NetworkInventory l3) {<NEW_LINE>VmNicInventory nic = null;<NEW_LINE>for (VmNicInventory inv : nics) {<NEW_LINE>if (VmNicHelper.getL3Uuids(inv).contains(l3.getUuid())) {<NEW_LINE>nic = inv;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SimpleQuery<PortForwardingRuleVO> q = dbf.createQuery(PortForwardingRuleVO.class);<NEW_LINE>q.add(PortForwardingRuleVO_.vmNicUuid, SimpleQuery.Op.EQ, nic.getUuid());<NEW_LINE>List<PortForwardingRuleVO> pfvos = q.list();<NEW_LINE>if (pfvos.isEmpty()) {<NEW_LINE>// having port forwarding service but no rules applied yet<NEW_LINE>return new ArrayList<PortForwardingStruct>();<NEW_LINE>}<NEW_LINE>List<PortForwardingStruct> rules = new ArrayList<PortForwardingStruct>();<NEW_LINE>for (PortForwardingRuleVO pfvo : pfvos) {<NEW_LINE>VipVO vipvo = dbf.findByUuid(pfvo.getVipUuid(), VipVO.class);<NEW_LINE>L3NetworkVO l3vo = dbf.findByUuid(vipvo.<MASK><NEW_LINE>PortForwardingStruct struct = new PortForwardingStruct();<NEW_LINE>struct.setRule(PortForwardingRuleInventory.valueOf(pfvo));<NEW_LINE>struct.setVip(VipInventory.valueOf(vipvo));<NEW_LINE>struct.setGuestIp(nic.getIp());<NEW_LINE>struct.setGuestMac(nic.getMac());<NEW_LINE>struct.setGuestL3Network(l3);<NEW_LINE>struct.setSnatInboundTraffic(PortForwardingGlobalConfig.SNAT_INBOUND_TRAFFIC.value(Boolean.class));<NEW_LINE>struct.setVipL3Network(L3NetworkInventory.valueOf(l3vo));<NEW_LINE>struct.setReleaseVmNicInfoWhenDetaching(releaseVmNicInfo);<NEW_LINE>struct.setReleaseVip(false);<NEW_LINE>rules.add(struct);<NEW_LINE>}<NEW_LINE>return rules;<NEW_LINE>} | getL3NetworkUuid(), L3NetworkVO.class); |
903,486 | public void renameCodeSnippets() {<NEW_LINE>// BEGIN: com.azure.storage.file.datalake.DataLakeFileAsyncClient.rename#String-String<NEW_LINE>DataLakeFileAsyncClient renamedClient = client.rename(<MASK><NEW_LINE>System.out.println("Directory Client has been renamed");<NEW_LINE>// END: com.azure.storage.file.datalake.DataLakeFileAsyncClient.rename#String-String<NEW_LINE>// BEGIN: com.azure.storage.file.datalake.DataLakeFileAsyncClient.renameWithResponse#String-String-DataLakeRequestConditions-DataLakeRequestConditions<NEW_LINE>DataLakeRequestConditions sourceRequestConditions = new DataLakeRequestConditions().setLeaseId(leaseId);<NEW_LINE>DataLakeRequestConditions destinationRequestConditions = new DataLakeRequestConditions();<NEW_LINE>DataLakeFileAsyncClient newRenamedClient = client.renameWithResponse(fileSystemName, destinationPath, sourceRequestConditions, destinationRequestConditions).block().getValue();<NEW_LINE>System.out.println("Directory Client has been renamed");<NEW_LINE>// END: com.azure.storage.file.datalake.DataLakeFileAsyncClient.renameWithResponse#String-String-DataLakeRequestConditions-DataLakeRequestConditions<NEW_LINE>} | fileSystemName, destinationPath).block(); |
471,998 | public DataRecord deserialize(final DataInput source, @NonNegative final long recordID, final SirixDeweyID deweyID, final PageReadOnlyTrx pageReadTrx) throws IOException {<NEW_LINE>final byte[] nspBytes = new byte[source.readInt()];<NEW_LINE>source.readFully(nspBytes);<NEW_LINE>final byte[] prefixBytes = new byte[source.readInt()];<NEW_LINE>source.readFully(prefixBytes);<NEW_LINE>final byte[] localNameBytes = new byte[source.readInt()];<NEW_LINE>source.readFully(localNameBytes);<NEW_LINE>final QNm name = new QNm(new String(nspBytes, Constants.DEFAULT_ENCODING), new String(prefixBytes, Constants.DEFAULT_ENCODING), new String(localNameBytes, Constants.DEFAULT_ENCODING));<NEW_LINE>final int keySize = source.readInt();<NEW_LINE>final Set<Long> nodeKeys = new HashSet<>(keySize);<NEW_LINE>for (int i = 0; i < keySize; i++) {<NEW_LINE>nodeKeys.<MASK><NEW_LINE>}<NEW_LINE>// Node delegate.<NEW_LINE>final NodeDelegate nodeDel = deserializeNodeDelegateWithoutIDs(source, recordID, pageReadTrx);<NEW_LINE>final long leftChild = getVarLong(source);<NEW_LINE>final long rightChild = getVarLong(source);<NEW_LINE>final boolean isChanged = source.readBoolean();<NEW_LINE>final RBNode<QNm, NodeReferences> node = new RBNode<>(name, new NodeReferences(nodeKeys), nodeDel);<NEW_LINE>node.setLeftChildKey(leftChild);<NEW_LINE>node.setRightChildKey(rightChild);<NEW_LINE>node.setChanged(isChanged);<NEW_LINE>return node;<NEW_LINE>} | add(source.readLong()); |
1,082,338 | public synchronized LinearRegressionModelState modelState() {<NEW_LINE>Map<Integer, Double> detailCompleteness = new HashMap<>();<NEW_LINE>for (Map.Entry<Integer, AtomicInteger> entry : INDICES.entrySet()) {<NEW_LINE>detailCompleteness.put(entry.getKey(), Math.min((double) entry.getValue().get() / numObservationsPerUtilBucket, 1.0));<NEW_LINE>}<NEW_LINE>Map<Integer, Integer> usedLeaderToFollowerRatio = new HashMap<>();<NEW_LINE>Map<Integer, Integer> usedLeaderBytesInToBytesOutRatio = new HashMap<>();<NEW_LINE>Map<ModelCoefficient, Double> coefficientFromAvailableData = new HashMap<>(COEFFICIENTS);<NEW_LINE>OLSMultipleLinearRegression regression = new OLSMultipleLinearRegression();<NEW_LINE>regression.setNoIntercept(true);<NEW_LINE>boolean ignoreLeaderBytesOutRate = !isLeaderBytesInAndOutRatioDiverseEnough();<NEW_LINE>double[][] sampleBytesRateData = aggregateSampleBytesRateData(ignoreLeaderBytesOutRate);<NEW_LINE>int leaderBytesInIndex = 0;<NEW_LINE>int leaderBytesOutIndex = 1;<NEW_LINE>int followerBytesInIndex = ignoreLeaderBytesOutRate ? 1 : 2;<NEW_LINE>for (double[] sampleBytesRateDatum : sampleBytesRateData) {<NEW_LINE>int leaderToFollowerRatio = sampleBytesRateDatum[followerBytesInIndex] == 0.0 ? 10000000 : (int) ((sampleBytesRateDatum[leaderBytesInIndex] / sampleBytesRateDatum[followerBytesInIndex]) * 10);<NEW_LINE>int count = usedLeaderToFollowerRatio.getOrDefault(leaderToFollowerRatio, 0);<NEW_LINE>usedLeaderToFollowerRatio.put(leaderToFollowerRatio, count + 1);<NEW_LINE>if (!ignoreLeaderBytesOutRate) {<NEW_LINE>int leaderBytesInToBytesOutRatio = sampleBytesRateDatum[leaderBytesOutIndex] == 0.0 ? 10000000 : (int) ((sampleBytesRateDatum[leaderBytesInIndex] / sampleBytesRateDatum[leaderBytesOutIndex]) * 10);<NEW_LINE>count = <MASK><NEW_LINE>usedLeaderBytesInToBytesOutRatio.put(leaderBytesInToBytesOutRatio, count + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>regression.newSampleData(aggregateSampleCpuUtilData(), sampleBytesRateData);<NEW_LINE>double[] parameters = regression.estimateRegressionParameters();<NEW_LINE>coefficientFromAvailableData.put(ModelCoefficient.LEADER_BYTES_IN, parameters[leaderBytesInIndex]);<NEW_LINE>if (!ignoreLeaderBytesOutRate) {<NEW_LINE>coefficientFromAvailableData.put(ModelCoefficient.LEADER_BYTES_OUT, parameters[leaderBytesOutIndex]);<NEW_LINE>}<NEW_LINE>coefficientFromAvailableData.put(ModelCoefficient.FOLLOWER_BYTES_IN, parameters[followerBytesInIndex]);<NEW_LINE>return new LinearRegressionModelState(detailCompleteness, coefficientFromAvailableData, OBSERVED_LEADER_TO_FOLLOWER_BYTES_RATIO, OBSERVED_LEADER_BYTES_IN_TO_BYTES_OUT_RATIO, usedLeaderToFollowerRatio, usedLeaderBytesInToBytesOutRatio, CPU_UTIL_ESTIMATION_ERROR_STATS);<NEW_LINE>} | usedLeaderBytesInToBytesOutRatio.getOrDefault(leaderBytesInToBytesOutRatio, 0); |
472,561 | public MOrder createPOForVendor(int bPartnerId, MOrder salesOrder) {<NEW_LINE>MOrder purchaseOrder = new MOrder(getCtx(), 0, get_TrxName());<NEW_LINE>purchaseOrder.setClientOrg(salesOrder.getAD_Client_ID(), salesOrder.getAD_Org_ID());<NEW_LINE>purchaseOrder.setIsSOTrx(false);<NEW_LINE>purchaseOrder.setC_DocTypeTarget_ID();<NEW_LINE>//<NEW_LINE>purchaseOrder.setDescription(salesOrder.getDescription());<NEW_LINE>purchaseOrder.setPOReference(salesOrder.getDocumentNo());<NEW_LINE>purchaseOrder.setPriorityRule(salesOrder.getPriorityRule());<NEW_LINE>purchaseOrder.setSalesRep_ID(salesOrder.getSalesRep_ID());<NEW_LINE>purchaseOrder.setM_Warehouse_ID(salesOrder.getM_Warehouse_ID());<NEW_LINE>// Set Vendor<NEW_LINE>MBPartner vendor = new MBPartner(getCtx(), bPartnerId, get_TrxName());<NEW_LINE>purchaseOrder.setBPartner(vendor);<NEW_LINE>// Drop Ship<NEW_LINE>if (!Util.isEmpty(getIsDropShip())) {<NEW_LINE>purchaseOrder.setIsDropShip(getIsDropShip().equals("Y"));<NEW_LINE>if (salesOrder.isDropShip() && salesOrder.getDropShip_BPartner_ID() != 0) {<NEW_LINE>purchaseOrder.<MASK><NEW_LINE>purchaseOrder.setDropShip_Location_ID(salesOrder.getDropShip_Location_ID());<NEW_LINE>purchaseOrder.setDropShip_User_ID(salesOrder.getDropShip_User_ID());<NEW_LINE>} else {<NEW_LINE>purchaseOrder.setDropShip_BPartner_ID(salesOrder.getC_BPartner_ID());<NEW_LINE>purchaseOrder.setDropShip_Location_ID(salesOrder.getC_BPartner_Location_ID());<NEW_LINE>purchaseOrder.setDropShip_User_ID(salesOrder.getAD_User_ID());<NEW_LINE>}<NEW_LINE>// get default drop ship warehouse<NEW_LINE>MOrgInfo orginfo = MOrgInfo.get(getCtx(), purchaseOrder.getAD_Org_ID(), get_TrxName());<NEW_LINE>if (orginfo.getDropShip_Warehouse_ID() != 0)<NEW_LINE>purchaseOrder.setM_Warehouse_ID(orginfo.getDropShip_Warehouse_ID());<NEW_LINE>else<NEW_LINE>log.log(Level.SEVERE, "Must specify drop ship warehouse in org info.");<NEW_LINE>}<NEW_LINE>// References<NEW_LINE>purchaseOrder.setC_Activity_ID(salesOrder.getC_Activity_ID());<NEW_LINE>purchaseOrder.setC_Campaign_ID(salesOrder.getC_Campaign_ID());<NEW_LINE>purchaseOrder.setC_Project_ID(salesOrder.getC_Project_ID());<NEW_LINE>purchaseOrder.setUser1_ID(salesOrder.getUser1_ID());<NEW_LINE>purchaseOrder.setUser2_ID(salesOrder.getUser2_ID());<NEW_LINE>purchaseOrder.setUser3_ID(salesOrder.getUser3_ID());<NEW_LINE>purchaseOrder.setUser4_ID(salesOrder.getUser4_ID());<NEW_LINE>//<NEW_LINE>purchaseOrder.saveEx();<NEW_LINE>return purchaseOrder;<NEW_LINE>} | setDropShip_BPartner_ID(salesOrder.getDropShip_BPartner_ID()); |
729,356 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {<NEW_LINE>HttpServletRequest httpRequest = (HttpServletRequest) request;<NEW_LINE>HttpServletResponse httpResponse = (HttpServletResponse) response;<NEW_LINE>if (super.shouldFilter(httpRequest, httpResponse)) {<NEW_LINE>for (ConfiguredHeader header : _configuredHeaders) {<NEW_LINE>if (header.isDate()) {<NEW_LINE>long headerValue = System.currentTimeMillis() + header.getMsOffset();<NEW_LINE>if (header.isAdd()) {<NEW_LINE>httpResponse.addDateHeader(<MASK><NEW_LINE>} else {<NEW_LINE>httpResponse.setDateHeader(header.getName(), headerValue);<NEW_LINE>}<NEW_LINE>} else // constant header value<NEW_LINE>{<NEW_LINE>if (header.isAdd()) {<NEW_LINE>httpResponse.addHeader(header.getName(), header.getValue());<NEW_LINE>} else {<NEW_LINE>httpResponse.setHeader(header.getName(), header.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>chain.doFilter(request, response);<NEW_LINE>} | header.getName(), headerValue); |
361,547 | private void writeArray(ArrayIndex lhs, ReferenceExpressionPair readResult, Scope scope) {<NEW_LINE><MASK><NEW_LINE>IntegerValue symb_index = new IntegerConstant(lhs.getArrayIndex());<NEW_LINE>Object conc_array;<NEW_LINE>try {<NEW_LINE>conc_array = arrayReference.getObject(scope);<NEW_LINE>} catch (CodeUnderTestException e) {<NEW_LINE>throw new EvosuiteError(e);<NEW_LINE>}<NEW_LINE>Type arrayType = Type.getType(conc_array.getClass());<NEW_LINE>Type elementType = arrayType.getElementType();<NEW_LINE>if (TypeUtil.isValue(elementType) || elementType.equals(Type.getType(String.class))) {<NEW_LINE>Expression<?> symb_value = readResult.getExpression();<NEW_LINE>String array_name = arrayReference.getName();<NEW_LINE>ReferenceExpression symb_array = symb_references.get(array_name);<NEW_LINE>// NOTE (ilebrero): we only want to update the symbolic environment outside the SUT.<NEW_LINE>// if (symb_value instanceof IntegerValue) {<NEW_LINE>// env.heap.arrayStore(conc_array, symb_array, symb_index, new IntegerConstant(((IntegerValue) symb_value).getConcreteValue()));<NEW_LINE>// } else if (symb_value instanceof RealValue) {<NEW_LINE>// env.heap.arrayStore(conc_array, symb_array, symb_index, new RealConstant(((RealValue) symb_value).getConcreteValue()));<NEW_LINE>// } else if (symb_value instanceof StringValue) {<NEW_LINE>// env.heap.array_store(conc_array, symb_array, conc_index, (StringValue) symb_value);<NEW_LINE>// }<NEW_LINE>} else { | ArrayReference arrayReference = lhs.getArray(); |
1,700,018 | public final List<? extends FileBasedSource<T>> split(long desiredBundleSizeBytes, PipelineOptions options) throws Exception {<NEW_LINE>// This implementation of method split is provided to simplify subclasses. Here we<NEW_LINE>// split a FileBasedSource based on a file pattern to FileBasedSources based on full single<NEW_LINE>// files. For files that can be efficiently seeked, we further split FileBasedSources based on<NEW_LINE>// those files to FileBasedSources based on sub ranges of single files.<NEW_LINE>String fileOrPattern = fileOrPatternSpec.get();<NEW_LINE>if (mode == Mode.FILEPATTERN) {<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>List<Metadata> expandedFiles = FileSystems.match(fileOrPattern, emptyMatchTreatment).metadata();<NEW_LINE>List<FileBasedSource<T>> splitResults = new ArrayList<>(expandedFiles.size());<NEW_LINE>for (Metadata metadata : expandedFiles) {<NEW_LINE>FileBasedSource<T> split = createForSubrangeOfFile(metadata, 0, metadata.sizeBytes());<NEW_LINE>verify(split.getMode() == Mode.SINGLE_FILE_OR_SUBRANGE, "%s.createForSubrangeOfFile must return a source in mode %s", split, Mode.SINGLE_FILE_OR_SUBRANGE);<NEW_LINE>// The split is NOT in FILEPATTERN mode, so we can call its split without fear<NEW_LINE>// of recursion. This will break a single file into multiple splits when the file is<NEW_LINE>// splittable and larger than the desired bundle size.<NEW_LINE>splitResults.addAll(split.split(desiredBundleSizeBytes, options));<NEW_LINE>}<NEW_LINE>LOG.info("Splitting filepattern {} into bundles of size {} took {} ms " + "and produced {} files and {} bundles", fileOrPattern, desiredBundleSizeBytes, System.currentTimeMillis() - startTime, expandedFiles.size(<MASK><NEW_LINE>return splitResults;<NEW_LINE>} else {<NEW_LINE>if (isSplittable()) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>List<FileBasedSource<T>> splits = (List<FileBasedSource<T>>) super.split(desiredBundleSizeBytes, options);<NEW_LINE>return splits;<NEW_LINE>} else {<NEW_LINE>LOG.debug("The source for file {} is not split into sub-range based sources since " + "the file is not seekable", fileOrPattern);<NEW_LINE>return ImmutableList.of(this);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), splitResults.size()); |
991,858 | // The tested deployment exceptions cause FFDC so we have to allow for this.<NEW_LINE>@AllowedFFDC()<NEW_LINE>public void launchHealth40Tck() throws Exception {<NEW_LINE>String protocol = "http";<NEW_LINE>String host = server.getHostname();<NEW_LINE>String port = Integer.toString(server.getPort(PortType.WC_defaulthost));<NEW_LINE>Map<String, String> additionalProps = new HashMap<>();<NEW_LINE>additionalProps.put("test.url", protocol + <MASK><NEW_LINE>MvnUtils.runTCKMvnCmd(server, "io.openliberty.microprofile.health.4.0.internal_fat_tck", this.getClass() + ":launchHealth40Tck", additionalProps);<NEW_LINE>Map<String, String> resultInfo = MvnUtils.getResultInfo(server);<NEW_LINE>resultInfo.put("results_type", "MicroProfile");<NEW_LINE>resultInfo.put("feature_name", "Health");<NEW_LINE>resultInfo.put("feature_version", "4.0");<NEW_LINE>MvnUtils.preparePublicationFile(resultInfo);<NEW_LINE>} | "://" + host + ":" + port); |
1,072,605 | public static FFICIF apiCreateCIFVar(int abi, int nfixedargs, FFIType rtype, FFIType... atypes) {<NEW_LINE>// These CIFs will never be deallocated, use the allocator directly to ignore them when detecting memory leaks.<NEW_LINE>MemoryAllocator allocator = MemoryUtil.getAllocator();<NEW_LINE>PointerBuffer pArgTypes = PointerBuffer.create(allocator.malloc(atypes.length <MASK><NEW_LINE>for (int i = 0; i < atypes.length; i++) {<NEW_LINE>pArgTypes.put(i, atypes[i]);<NEW_LINE>}<NEW_LINE>FFICIF cif = FFICIF.create(allocator.malloc(FFICIF.SIZEOF));<NEW_LINE>int errcode = ffi_prep_cif_var(cif, abi, nfixedargs, rtype, pArgTypes);<NEW_LINE>if (errcode != FFI_OK) {<NEW_LINE>throw new IllegalStateException("Failed to prepare libffi var CIF: " + errcode);<NEW_LINE>}<NEW_LINE>return cif;<NEW_LINE>} | * POINTER_SIZE), atypes.length); |
602,297 | private byte[] genMetabitsData() throws IOException {<NEW_LINE>// the metabits is now prefixed by a long specifying the lastTxReleaseTime<NEW_LINE>// used to free the deferedFree allocations. This is used to determine<NEW_LINE>// which commitRecord to access to process the nextbatch of deferred<NEW_LINE>// frees.<NEW_LINE>// the cDefaultMetaBitsSize is also written since this can now be<NEW_LINE>// parameterized.<NEW_LINE>final int len = 4 * (cMetaHdrFields + m_allocSizes.length + m_metaBits.length);<NEW_LINE>final byte[] buf = new byte[len];<NEW_LINE>final FixedOutputStream str = new FixedOutputStream(buf);<NEW_LINE>try {<NEW_LINE>str.writeInt(m_metaBitsAddr > 0 ? cVersionDemispace : cVersion);<NEW_LINE>str.writeLong(m_lastDeferredReleaseTime);<NEW_LINE>str.writeInt(cDefaultMetaBitsSize);<NEW_LINE>str.writeInt(m_allocSizes.length);<NEW_LINE>str.writeLong(m_storageStatsAddr);<NEW_LINE>// Let's reserve ourselves some space<NEW_LINE>for (int i = 0; i < cReservedMetaBits; i++) {<NEW_LINE>str.writeInt(0);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < m_allocSizes.length; i++) {<NEW_LINE>str.writeInt(m_allocSizes[i]);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < m_metaBits.length; i++) {<NEW_LINE>str<MASK><NEW_LINE>}<NEW_LINE>str.flush();<NEW_LINE>} finally {<NEW_LINE>str.close();<NEW_LINE>}<NEW_LINE>return buf;<NEW_LINE>} | .writeInt(m_metaBits[i]); |
179,608 | public static ConfigItem parseFromMap(Map<String, Object> map) {<NEW_LINE>ConfigItem configItem = new ConfigItem();<NEW_LINE>configItem.setType((String) map.get(CONFIG_ITEM_TYPE));<NEW_LINE>Object enabled = map.get(ENABLED_KEY);<NEW_LINE>if (enabled != null) {<NEW_LINE>configItem.setEnabled(Boolean.parseBoolean(enabled.toString()));<NEW_LINE>}<NEW_LINE>Object addresses = map.get(ADDRESSES_KEY);<NEW_LINE>if (addresses != null && List.class.isAssignableFrom(addresses.getClass())) {<NEW_LINE>configItem.setAddresses(((List<Object>) addresses).stream().map(String::valueOf).collect<MASK><NEW_LINE>}<NEW_LINE>Object providerAddresses = map.get(PROVIDER_ADDRESSES_KEY);<NEW_LINE>if (providerAddresses != null && List.class.isAssignableFrom(providerAddresses.getClass())) {<NEW_LINE>configItem.setProviderAddresses(((List<Object>) providerAddresses).stream().map(String::valueOf).collect(Collectors.toList()));<NEW_LINE>}<NEW_LINE>Object services = map.get(SERVICES_KEY);<NEW_LINE>if (services != null && List.class.isAssignableFrom(services.getClass())) {<NEW_LINE>configItem.setServices(((List<Object>) services).stream().map(String::valueOf).collect(Collectors.toList()));<NEW_LINE>}<NEW_LINE>Object applications = map.get(APPLICATIONS_KEY);<NEW_LINE>if (applications != null && List.class.isAssignableFrom(applications.getClass())) {<NEW_LINE>configItem.setApplications(((List<Object>) applications).stream().map(String::valueOf).collect(Collectors.toList()));<NEW_LINE>}<NEW_LINE>Object parameters = map.get(PARAMETERS_KEY);<NEW_LINE>if (parameters != null && Map.class.isAssignableFrom(parameters.getClass())) {<NEW_LINE>configItem.setParameters(((Map<String, Object>) parameters).entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().toString())));<NEW_LINE>}<NEW_LINE>configItem.setSide((String) map.get(SIDE_KEY));<NEW_LINE>return configItem;<NEW_LINE>} | (Collectors.toList())); |
1,681,568 | ActionResult<WrapOutId> execute(String appDictFlag, String appInfoFlag, String path0, String path1, JsonElement jsonElement) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>ActionResult<WrapOutId> result = new ActionResult<>();<NEW_LINE><MASK><NEW_LINE>AppInfo appInfo = business.getAppInfoFactory().pick(appInfoFlag);<NEW_LINE>if (null == appInfo) {<NEW_LINE>throw new ExceptionAppInfoNotExist(appInfoFlag);<NEW_LINE>}<NEW_LINE>String id = business.getAppDictFactory().getWithAppInfoWithUniqueName(appInfo.getId(), appDictFlag);<NEW_LINE>if (StringUtils.isEmpty(id)) {<NEW_LINE>throw new ExceptionAppDictNotExist(appInfoFlag);<NEW_LINE>}<NEW_LINE>AppDict dict = emc.find(id, AppDict.class);<NEW_LINE>this.update(business, dict, jsonElement, path0, path1);<NEW_LINE>emc.commit();<NEW_LINE>WrapOutId wrap = new WrapOutId(dict.getId());<NEW_LINE>result.setData(wrap);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | Business business = new Business(emc); |
723,060 | public DescribeIdentityResult describeIdentity(DescribeIdentityRequest describeIdentityRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeIdentityRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeIdentityRequest> request = null;<NEW_LINE>Response<DescribeIdentityResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new <MASK><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<DescribeIdentityResult, JsonUnmarshallerContext> unmarshaller = new DescribeIdentityResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<DescribeIdentityResult> responseHandler = new JsonResponseHandler<DescribeIdentityResult>(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>} | DescribeIdentityRequestMarshaller().marshall(describeIdentityRequest); |
1,701,098 | 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, "fis");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<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 = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
965,663 | public ApiResponse<Void> createUserWithHttpInfo(User body) throws ApiException {<NEW_LINE>Object localVarPostBody = body;<NEW_LINE>// verify the required parameter 'body' is set<NEW_LINE>if (body == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'body' when calling createUser");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/user";<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new <MASK><NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = {};<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[] {};<NEW_LINE>return apiClient.invokeAPI("UserApi.createUser", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null, false);<NEW_LINE>} | HashMap<String, String>(); |
991,035 | public ArrayList<Byte> retreiveBuffer() throws IOException {<NEW_LINE>int totalIntSamples = totalBytes / 2;<NEW_LINE>Log.v(TAG, "Fetching samples : " + totalIntSamples + ", split : " + commandsProto.DATA_SPLITTING);<NEW_LINE>ArrayList<Byte> listData = new ArrayList<>();<NEW_LINE>for (int i = 0; i < (totalIntSamples / commandsProto.DATA_SPLITTING); i++) {<NEW_LINE>packetHandler.sendByte(commandsProto.ADC);<NEW_LINE>packetHandler.sendByte(commandsProto.GET_CAPTURE_CHANNEL);<NEW_LINE>packetHandler.sendByte(0);<NEW_LINE>packetHandler.sendInt(commandsProto.DATA_SPLITTING);<NEW_LINE>packetHandler.<MASK><NEW_LINE>int remaining = commandsProto.DATA_SPLITTING * 2 + 1;<NEW_LINE>// reading in single go, change if create communication problem<NEW_LINE>byte[] data = new byte[remaining];<NEW_LINE>packetHandler.read(data, remaining);<NEW_LINE>for (int j = 0; j < data.length - 1; j++) listData.add(data[j]);<NEW_LINE>}<NEW_LINE>if ((totalIntSamples % commandsProto.DATA_SPLITTING) != 0) {<NEW_LINE>packetHandler.sendByte(commandsProto.ADC);<NEW_LINE>packetHandler.sendByte(commandsProto.GET_CAPTURE_CHANNEL);<NEW_LINE>packetHandler.sendByte(0);<NEW_LINE>packetHandler.sendInt(totalIntSamples % commandsProto.DATA_SPLITTING);<NEW_LINE>packetHandler.sendInt(totalIntSamples - totalIntSamples % commandsProto.DATA_SPLITTING);<NEW_LINE>int remaining = 2 * (totalIntSamples % commandsProto.DATA_SPLITTING) + 1;<NEW_LINE>byte[] data = new byte[remaining];<NEW_LINE>packetHandler.read(data, remaining);<NEW_LINE>for (int j = 0; j < data.length - 1; j++) listData.add(data[j]);<NEW_LINE>}<NEW_LINE>Log.v(TAG, "Final Pass : length = " + listData.size());<NEW_LINE>return listData;<NEW_LINE>} | sendInt(i * commandsProto.DATA_SPLITTING); |
814,786 | private void renderCrossbar(BannerBlockEntity bannerBlockEntity, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) {<NEW_LINE>matrixStack.push();<NEW_LINE>BlockState blockState = bannerBlockEntity.getCachedState();<NEW_LINE>matrixStack.translate(0.5D, -0.1666666716337204D, 0.5D);<NEW_LINE>float h = -blockState.get(WallBannerBlock.FACING).asRotation();<NEW_LINE>matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(h));<NEW_LINE>matrixStack.translate(0.0D, -0.3125D, -0.4375D);<NEW_LINE>matrixStack.push();<NEW_LINE>matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F);<NEW_LINE>VertexConsumer vertexConsumer = ModelLoader.BANNER_BASE.<MASK><NEW_LINE>this.crossbar.render(matrixStack, vertexConsumer, i, j);<NEW_LINE>matrixStack.pop();<NEW_LINE>matrixStack.pop();<NEW_LINE>} | getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntitySolid); |
1,798,017 | private void handle(APICreateL3NetworkMsg msg) {<NEW_LINE>SimpleQuery<L2NetworkVO> query = dbf.createQuery(L2NetworkVO.class);<NEW_LINE>query.select(L2NetworkVO_.zoneUuid);<NEW_LINE>query.add(L2NetworkVO_.uuid, Op.EQ, msg.getL2NetworkUuid());<NEW_LINE>String zoneUuid = query.findValue();<NEW_LINE>assert zoneUuid != null;<NEW_LINE>L3NetworkVO vo = new L3NetworkVO();<NEW_LINE>if (msg.getResourceUuid() != null) {<NEW_LINE>vo.setUuid(msg.getResourceUuid());<NEW_LINE>} else {<NEW_LINE>vo.setUuid(Platform.getUuid());<NEW_LINE>}<NEW_LINE>vo.setDescription(msg.getDescription());<NEW_LINE>vo.setDnsDomain(msg.getDnsDomain());<NEW_LINE>vo.setL2NetworkUuid(msg.getL2NetworkUuid());<NEW_LINE>vo.setName(msg.getName());<NEW_LINE>vo.setSystem(msg.isSystem());<NEW_LINE>vo.setZoneUuid(zoneUuid);<NEW_LINE>vo.setState(L3NetworkState.Enabled);<NEW_LINE>vo.setCategory(L3NetworkCategory.valueOf(msg.getCategory()));<NEW_LINE>if (msg.getIpVersion() != null) {<NEW_LINE>vo.setIpVersion(msg.getIpVersion());<NEW_LINE>} else {<NEW_LINE>vo.setIpVersion(IPv6Constants.IPv4);<NEW_LINE>}<NEW_LINE>L3NetworkFactory factory = getL3NetworkFactory(L3NetworkType.valueOf(msg.getType()));<NEW_LINE>L3NetworkInventory inv = new SQLBatchWithReturn<L3NetworkInventory>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected L3NetworkInventory scripts() {<NEW_LINE>vo.setAccountUuid(msg.getSession().getAccountUuid());<NEW_LINE>L3NetworkInventory inv = <MASK><NEW_LINE>tagMgr.createTagsFromAPICreateMessage(msg, vo.getUuid(), L3NetworkVO.class.getSimpleName());<NEW_LINE>return inv;<NEW_LINE>}<NEW_LINE>}.execute();<NEW_LINE>APICreateL3NetworkEvent evt = new APICreateL3NetworkEvent(msg.getId());<NEW_LINE>evt.setInventory(inv);<NEW_LINE>logger.debug(String.format("Successfully created L3Network[name:%s, uuid:%s]", inv.getName(), inv.getUuid()));<NEW_LINE>bus.publish(evt);<NEW_LINE>} | factory.createL3Network(vo, msg); |
379,817 | public JsonNode digest(final JsonNode schema) {<NEW_LINE>final ObjectNode ret = FACTORY.objectNode();<NEW_LINE>final ArrayNode properties = FACTORY.arrayNode();<NEW_LINE>final ArrayNode patternProperties = FACTORY.arrayNode();<NEW_LINE>ret.put(keyword, true);<NEW_LINE>ret.set("properties", properties);<NEW_LINE>ret.set("patternProperties", patternProperties);<NEW_LINE>if (schema.get(keyword).asBoolean(true))<NEW_LINE>return ret;<NEW_LINE>ret.put(keyword, false);<NEW_LINE>List<String> list;<NEW_LINE>list = Lists.newArrayList(schema.path("properties").fieldNames());<NEW_LINE>Collections.sort(list);<NEW_LINE>for (final String s : <MASK><NEW_LINE>list = Lists.newArrayList(schema.path("patternProperties").fieldNames());<NEW_LINE>Collections.sort(list);<NEW_LINE>for (final String s : list) patternProperties.add(s);<NEW_LINE>return ret;<NEW_LINE>} | list) properties.add(s); |
1,363,670 | final DeleteEventSubscriptionResult executeDeleteEventSubscription(DeleteEventSubscriptionRequest deleteEventSubscriptionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteEventSubscriptionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteEventSubscriptionRequest> request = null;<NEW_LINE>Response<DeleteEventSubscriptionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteEventSubscriptionRequestMarshaller().marshall(super.beforeMarshalling(deleteEventSubscriptionRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Redshift");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteEventSubscription");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteEventSubscriptionResult> responseHandler = new StaxResponseHandler<DeleteEventSubscriptionResult>(new DeleteEventSubscriptionResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,839,842 | private static void changeLanguageWithUndo(@Nonnull Project project, @Nonnull Language t, @Nonnull VirtualFile[] sortedFiles, @Nonnull PerFileMappings<Language> mappings) throws UnexpectedUndoException {<NEW_LINE>ReadonlyStatusHandler.OperationStatus status = ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(Arrays.asList(sortedFiles));<NEW_LINE>if (status.hasReadonlyFiles())<NEW_LINE>return;<NEW_LINE>final Set<VirtualFile> matchedExtensions = new LinkedHashSet<>();<NEW_LINE>final Map<VirtualFile, Language> oldMapping = new HashMap<>();<NEW_LINE>for (VirtualFile file : sortedFiles) {<NEW_LINE>oldMapping.put(file<MASK><NEW_LINE>if (ScratchUtil.hasMatchingExtension(project, file)) {<NEW_LINE>matchedExtensions.add(file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>BasicUndoableAction action = new BasicUndoableAction(sortedFiles) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void undo() {<NEW_LINE>for (VirtualFile file : sortedFiles) {<NEW_LINE>mappings.setMapping(file, oldMapping.get(file));<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void redo() {<NEW_LINE>for (VirtualFile file : sortedFiles) {<NEW_LINE>mappings.setMapping(file, t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>action.redo();<NEW_LINE>UndoManager.getInstance(project).undoableActionPerformed(action);<NEW_LINE>for (VirtualFile file : matchedExtensions) {<NEW_LINE>try {<NEW_LINE>ScratchUtil.updateFileExtension(project, file);<NEW_LINE>} catch (IOException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , mappings.getMapping(file)); |
359,422 | // remoteFilePath must be a file(not dir) and does not contain checksum<NEW_LINE>public Status download(String remoteFilePath, String localFilePath) {<NEW_LINE>// 0. list to get to full name(with checksum)<NEW_LINE>List<RemoteFile> remoteFiles = Lists.newArrayList();<NEW_LINE>Status status = storage.list(remoteFilePath + "*", remoteFiles);<NEW_LINE>if (!status.ok()) {<NEW_LINE>return status;<NEW_LINE>}<NEW_LINE>if (remoteFiles.size() != 1) {<NEW_LINE>return new Status(ErrCode.COMMON_ERROR, "Expected one file with path: " + remoteFilePath + ". get: " + remoteFiles.size());<NEW_LINE>}<NEW_LINE>if (!remoteFiles.get(0).isFile()) {<NEW_LINE>return new Status(ErrCode.COMMON_ERROR, "Expected file with path: " + remoteFilePath + ". but get dir");<NEW_LINE>}<NEW_LINE>String remoteFilePathWithChecksum = replaceFileNameWithChecksumFileName(remoteFilePath, remoteFiles.get(0).getName());<NEW_LINE>LOG.debug("get download filename with checksum: " + remoteFilePathWithChecksum);<NEW_LINE>// 1. get checksum from remote file name<NEW_LINE>Pair<String, String> pair = decodeFileNameWithChecksum(remoteFilePathWithChecksum);<NEW_LINE>if (pair == null) {<NEW_LINE>return new Status(ErrCode.COMMON_ERROR, "file name should contains checksum: " + remoteFilePathWithChecksum);<NEW_LINE>}<NEW_LINE>if (!remoteFilePath.endsWith(pair.first)) {<NEW_LINE>return new Status(ErrCode.COMMON_ERROR, "File does not exist: " + remoteFilePath);<NEW_LINE>}<NEW_LINE>String md5sum = pair.second;<NEW_LINE>// 2. download<NEW_LINE>status = storage.downloadWithFileSize(remoteFilePathWithChecksum, localFilePath, remoteFiles.get(0).getSize());<NEW_LINE>if (!status.ok()) {<NEW_LINE>return status;<NEW_LINE>}<NEW_LINE>// 3. verify checksum<NEW_LINE>String localMd5sum = null;<NEW_LINE>try {<NEW_LINE>localMd5sum = DigestUtils.md5Hex(new FileInputStream(localFilePath));<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>return new Status(ErrCode.NOT_FOUND, "file " + localFilePath + " does not exist");<NEW_LINE>} catch (IOException e) {<NEW_LINE>return new Status(<MASK><NEW_LINE>}<NEW_LINE>if (!localMd5sum.equals(md5sum)) {<NEW_LINE>return new Status(ErrCode.BAD_FILE, "md5sum does not equal. local: " + localMd5sum + ", remote: " + md5sum);<NEW_LINE>}<NEW_LINE>return Status.OK;<NEW_LINE>} | ErrCode.COMMON_ERROR, "failed to get md5sum of file: " + localFilePath); |
1,769,769 | private void copyToDestDir(List<ProjectIconInfo> prjInfoList) {<NEW_LINE>FileSet fs = null;<NEW_LINE>for (Iterator<ProjectIconInfo> iter = prjInfoList.iterator(); iter.hasNext(); ) {<NEW_LINE>fs = new FileSet();<NEW_LINE>log("Setting basedir for fileset: " + baseDir, Project.MSG_VERBOSE);<NEW_LINE>ProjectIconInfo prjIconInfo = iter.next();<NEW_LINE>fs.setDir(new File(baseDir, prjIconInfo.prjPath));<NEW_LINE>int numFilesToCopy = prjIconInfo.matchingIcons.size() + prjIconInfo.notmatchingIcons.size();<NEW_LINE>for (Iterator<ImageInfo> matchInfoIter = prjIconInfo.matchingIcons.iterator(); matchInfoIter.hasNext(); ) {<NEW_LINE>ImageInfo info = matchInfoIter.next();<NEW_LINE>log("Adding file to matching fileset: " + info.getPath(), Project.MSG_VERBOSE);<NEW_LINE>fs.<MASK><NEW_LINE>}<NEW_LINE>for (Iterator<ImageInfo> notmatchInfoIter = prjIconInfo.notmatchingIcons.iterator(); notmatchInfoIter.hasNext(); ) {<NEW_LINE>ImageInfo info = notmatchInfoIter.next();<NEW_LINE>log("Adding file to notmatching fileset: " + info.getPath(), Project.MSG_VERBOSE);<NEW_LINE>fs.setIncludes(info.getPath());<NEW_LINE>}<NEW_LINE>if (numFilesToCopy > 0) {<NEW_LINE>Copy copy = (Copy) getProject().createTask("copy");<NEW_LINE>copy.addFileset(fs);<NEW_LINE>File dest = new File(destDir, prjIconInfo.prjPath);<NEW_LINE>dest.mkdir();<NEW_LINE>copy.setTodir(dest);<NEW_LINE>copy.init();<NEW_LINE>copy.setLocation(getLocation());<NEW_LINE>copy.execute();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | setIncludes(info.getPath()); |
1,157,985 | protected void initChannel(SocketChannel ch) throws Exception {<NEW_LINE>// If channel handler implementations are not annotated with @Sharable, Netty creates a new instance of every class<NEW_LINE>// in the pipeline for every connection.<NEW_LINE>// i.e. if there are a 1000 active connections there will be a 1000 NettyMessageProcessor instances.<NEW_LINE>ChannelPipeline pipeline = ch.pipeline();<NEW_LINE>// connection stats handler to track connection related metrics<NEW_LINE>pipeline.addLast("connectionStatsHandler", connectionStatsHandler);<NEW_LINE>// if SSL is enabled, add an SslHandler before the HTTP codec<NEW_LINE>if (sslFactory != null) {<NEW_LINE>InetSocketAddress peerAddress = ch.remoteAddress();<NEW_LINE>String peerHost = peerAddress.getHostName();<NEW_LINE>int peerPort = peerAddress.getPort();<NEW_LINE>SslHandler sslHandler = new SslHandler(sslFactory.createSSLEngine(peerHost, peerPort, SSLFactory.Mode.SERVER));<NEW_LINE>pipeline.addLast("sslHandler", sslHandler);<NEW_LINE>}<NEW_LINE>// for http encoding/decoding.<NEW_LINE>pipeline.addLast("codec", // for health check request handling<NEW_LINE>new HttpServerCodec(nettyConfig.nettyServerMaxInitialLineLength, nettyConfig.nettyServerMaxHeaderSize, nettyConfig.nettyServerMaxChunkSize)).addLast("healthCheckHandler", // for public access logging<NEW_LINE>new HealthCheckHandler(restServerState, nettyMetrics)).addLast("publicAccessLogHandler", // for detecting connections that have been idle too long - probably because of an error.<NEW_LINE>new PublicAccessLogHandler(publicAccessLogger, nettyMetrics)).addLast("idleStateHandler", // for safe writing of chunks for responses<NEW_LINE>new IdleStateHandler(0, 0, nettyConfig.nettyServerIdleTimeSeconds)).addLast("chunker", new ChunkedWriteHandler());<NEW_LINE>if (addedChannelHandlers != null) {<NEW_LINE>pipeline.addLast(addedChannelHandlers.toArray<MASK><NEW_LINE>}<NEW_LINE>// custom processing class that interfaces with a RestRequestService.<NEW_LINE>pipeline.addLast("processor", new NettyMessageProcessor(nettyMetrics, nettyConfig, performanceConfig, requestHandler));<NEW_LINE>} | (new ChannelHandler[0])); |
1,438,344 | public static Collection<RegressionExecution> executions() {<NEW_LINE>ArrayList<RegressionExecution> execs = new ArrayList<>();<NEW_LINE>execs.add(new ContextKeySegmentedPatternFilter());<NEW_LINE>execs.add(new ContextKeySegmentedJoinRemoveStream());<NEW_LINE>execs.add(new ContextKeySegmentedSelector());<NEW_LINE>execs.add(new ContextKeySegmentedLargeNumberPartitions());<NEW_LINE>execs.add(new ContextKeySegmentedAdditionalFilters());<NEW_LINE>execs.add(new ContextKeySegmentedMultiStatementFilterCount());<NEW_LINE>execs.add(new ContextKeySegmentedSubtype());<NEW_LINE>execs.add(new ContextKeySegmentedJoinMultitypeMultifield());<NEW_LINE>execs<MASK><NEW_LINE>execs.add(new ContextKeySegmentedPrior());<NEW_LINE>execs.add(new ContextKeySegmentedSubqueryFiltered());<NEW_LINE>execs.add(new ContextKeySegmentedJoin());<NEW_LINE>execs.add(new ContextKeySegmentedPattern());<NEW_LINE>execs.add(new ContextKeySegmentedPatternSceneTwo());<NEW_LINE>execs.add(new ContextKeySegmentedViewSceneOne());<NEW_LINE>execs.add(new ContextKeySegmentedViewSceneTwo());<NEW_LINE>execs.add(new ContextKeySegmentedJoinWhereClauseOnPartitionKey());<NEW_LINE>execs.add(new ContextKeySegmentedNullSingleKey());<NEW_LINE>execs.add(new ContextKeySegmentedNullKeyMultiKey());<NEW_LINE>execs.add(new ContextKeySegmentedInvalid());<NEW_LINE>execs.add(new ContextKeySegmentedTermByFilter());<NEW_LINE>execs.add(new ContextKeySegmentedMatchRecognize());<NEW_LINE>execs.add(new ContextKeySegmentedMultikeyWArrayOfPrimitive());<NEW_LINE>execs.add(new ContextKeySegmentedMultikeyWArrayTwoField());<NEW_LINE>execs.add(new ContextKeySegmentedWInitTermEndEvent());<NEW_LINE>execs.add(new ContextKeySegmentedWPatternFireWhenAllocated());<NEW_LINE>execs.add(new ContextKeySegmentedWInitTermPatternAsName());<NEW_LINE>execs.add(new ContextKeySegmentedTermEventSelect());<NEW_LINE>return execs;<NEW_LINE>} | .add(new ContextKeySegmentedSubselectPrevPrior()); |
849,014 | public static void main(String[] argv) throws Exception {<NEW_LINE>if (argv.length < 2) {<NEW_LINE>System.err.println("Usage: " + CheckMessages.class.getName() + " <plugin descriptor xml> <bug description xml> [<bug description xml>...]");<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>String pluginDescriptor = argv[0];<NEW_LINE>try {<NEW_LINE>CheckMessages checkMessages = new CheckMessages(pluginDescriptor);<NEW_LINE>for (int i = 1; i < argv.length; ++i) {<NEW_LINE>String messagesFile = argv[i];<NEW_LINE>System.<MASK><NEW_LINE>checkMessages.checkMessages(new XMLFile(messagesFile));<NEW_LINE>}<NEW_LINE>} catch (DocumentException e) {<NEW_LINE>System.err.println("Could not verify messages files: " + e.getMessage());<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>System.out.println("Messages files look OK!");<NEW_LINE>} | out.println("Checking messages file " + messagesFile); |
1,748,131 | private void prepareStyles() {<NEW_LINE>StyledDocument doc = textPane.getStyledDocument();<NEW_LINE>Map<String, Color> keyWordColorMap = owlEditorKit.getWorkspace().getKeyWordColorMap();<NEW_LINE>for (String keyWord : keyWordColorMap.keySet()) {<NEW_LINE>Style s = doc.addStyle(keyWord, null);<NEW_LINE>Color color = keyWordColorMap.get(keyWord);<NEW_LINE>StyleConstants.setForeground(s, color);<NEW_LINE>StyleConstants.setBold(s, true);<NEW_LINE>}<NEW_LINE>plainStyle = doc.addStyle("PLAIN_STYLE", null);<NEW_LINE>StyleConstants.setItalic(plainStyle, false);<NEW_LINE>StyleConstants.setSpaceAbove(plainStyle, 0);<NEW_LINE>boldStyle = doc.addStyle("BOLD_STYLE", null);<NEW_LINE>StyleConstants.setBold(boldStyle, true);<NEW_LINE>nonBoldStyle = doc.addStyle("NON_BOLD_STYLE", null);<NEW_LINE>StyleConstants.setBold(nonBoldStyle, false);<NEW_LINE>selectionForeground = doc.addStyle("SEL_FG_STYPE", null);<NEW_LINE>// we know that it is possible for SELECTION_FOREGROUND to be null<NEW_LINE>// and an exception here means that Protege doesn't start<NEW_LINE>if (selectionForeground != null && SELECTION_FOREGROUND != null) {<NEW_LINE>StyleConstants.setForeground(selectionForeground, SELECTION_FOREGROUND);<NEW_LINE>}<NEW_LINE>foreground = doc.addStyle("FG_STYLE", null);<NEW_LINE>if (foreground != null && FOREGROUND != null) {<NEW_LINE>StyleConstants.setForeground(foreground, FOREGROUND);<NEW_LINE>}<NEW_LINE>linkStyle = doc.addStyle("LINK_STYLE", null);<NEW_LINE>StyleConstants.setForeground(linkStyle, Color.BLUE);<NEW_LINE>StyleConstants.setUnderline(linkStyle, true);<NEW_LINE>inconsistentClassStyle = doc.addStyle("INCONSISTENT_CLASS_STYLE", null);<NEW_LINE>StyleConstants.setForeground(inconsistentClassStyle, Color.RED);<NEW_LINE>focusedEntityStyle = doc.addStyle("FOCUSED_ENTITY_STYLE", null);<NEW_LINE>StyleConstants.setForeground(focusedEntityStyle, Color.BLACK);<NEW_LINE>StyleConstants.setBackground(focusedEntityStyle, new Color(220, 220, 250));<NEW_LINE>ontologyURIStyle = doc.addStyle("ONTOLOGY_URI_STYLE", null);<NEW_LINE>StyleConstants.setForeground(ontologyURIStyle, Color.GRAY);<NEW_LINE>commentedOutStyle = <MASK><NEW_LINE>StyleConstants.setForeground(commentedOutStyle, Color.GRAY);<NEW_LINE>StyleConstants.setItalic(commentedOutStyle, true);<NEW_LINE>feintStyle = doc.addStyle("FEINT_STYLE", null);<NEW_LINE>StyleConstants.setForeground(feintStyle, Color.GRAY);<NEW_LINE>strikeOutStyle = doc.addStyle("STRIKE_OUT", null);<NEW_LINE>StyleConstants.setStrikeThrough(strikeOutStyle, true);<NEW_LINE>StyleConstants.setBold(strikeOutStyle, false);<NEW_LINE>fontSizeStyle = doc.addStyle("FONT_SIZE", null);<NEW_LINE>StyleConstants.setFontSize(fontSizeStyle, 40);<NEW_LINE>} | doc.addStyle("COMMENTED_OUT_STYLE", null); |
477,204 | public CompletableFuture<Void> clearBacklog() {<NEW_LINE>CompletableFuture<Void> future = new CompletableFuture<>();<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("[{}][{} -> {}] Backlog size before clearing: {}", topicName, localCluster, remoteCluster, cursor.getNumberOfEntriesInBacklog(false));<NEW_LINE>}<NEW_LINE>cursor.asyncClearBacklog(new ClearBacklogCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void clearBacklogComplete(Object ctx) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("[{}][{} -> {}] Backlog size after clearing: {}", topicName, localCluster, remoteCluster<MASK><NEW_LINE>}<NEW_LINE>future.complete(null);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void clearBacklogFailed(ManagedLedgerException exception, Object ctx) {<NEW_LINE>log.error("[{}][{} -> {}] Failed to clear backlog", topicName, localCluster, remoteCluster, exception);<NEW_LINE>future.completeExceptionally(exception);<NEW_LINE>}<NEW_LINE>}, null);<NEW_LINE>return future;<NEW_LINE>} | , cursor.getNumberOfEntriesInBacklog(false)); |
1,475,072 | // test attempts to propagate active transaction to 2 threads at once<NEW_LINE>@AllowedFFDC("java.lang.IllegalStateException")<NEW_LINE>@Test<NEW_LINE>public void testTransactionContextPropagation() throws Exception {<NEW_LINE>// propagates ThreadContext.TRANSACTION<NEW_LINE>ManagedExecutor executor = appTxExecutor;<NEW_LINE>// valid to propagate empty transaction context<NEW_LINE>CompletableFuture<Integer> cf1 = executor.newIncompleteFuture();<NEW_LINE>CompletableFuture<Integer> cf2 = cf1.thenApply(i -> {<NEW_LINE>try {<NEW_LINE>return tx.getStatus();<NEW_LINE>} catch (SystemException x) {<NEW_LINE>throw new CompletionException(x);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>tx.begin();<NEW_LINE>try {<NEW_LINE>cf1.complete(50);<NEW_LINE>assertEquals(Integer.valueOf(Status.STATUS_NO_TRANSACTION), cf2.get());<NEW_LINE>assertEquals(Status.STATUS_ACTIVE, tx.getStatus());<NEW_LINE>Future<?> f = executor.submit(() -> System.out.println("Should not be able to submit this task."));<NEW_LINE>try {<NEW_LINE>f.<MASK><NEW_LINE>} catch (ExecutionException x) {<NEW_LINE>if (// Active transaction cannot be propagated to 2 threads at once<NEW_LINE>!(x.getCause() instanceof IllegalStateException))<NEW_LINE>throw x;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (tx.getStatus() == Status.STATUS_ACTIVE)<NEW_LINE>tx.commit();<NEW_LINE>else<NEW_LINE>tx.rollback();<NEW_LINE>}<NEW_LINE>// valid to propagate empty transaction context<NEW_LINE>CompletableFuture<String> cf3 = cf2.thenApplyAsync(i -> "done");<NEW_LINE>assertEquals("done", cf3.get(TIMEOUT_MIN, TimeUnit.MINUTES));<NEW_LINE>} | get(TIMEOUT_MIN, TimeUnit.MINUTES); |
568,360 | private void compressSize() {<NEW_LINE>compressSize = true;<NEW_LINE>LayoutInflater inflater = getLayoutInflater();<NEW_LINE>View dialogLayout = inflater.inflate(R.layout.dialog_compresssize, null);<NEW_LINE>TextView title = dialogLayout.findViewById(R.id.compress_title);<NEW_LINE>title.setBackgroundColor(getPrimaryColor());<NEW_LINE>SeekBar percentsize = dialogLayout.findViewById(R.id.seekBar);<NEW_LINE>percentsize.getThumb().setColorFilter(getAccentColor(), PorterDuff.Mode.SRC_IN);<NEW_LINE>percentsize.setProgress(0);<NEW_LINE>final TextView percent = dialogLayout.findViewById(R.id.textview2);<NEW_LINE>percentsize.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {<NEW_LINE>// options of compress by size from 5% to 9;<NEW_LINE>int progress1 = 95 - progress;<NEW_LINE>progress1 = progress1 - progress1 % 5;<NEW_LINE>percent.setText(progress1 + "%");<NEW_LINE>percentagecompress = progress1;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onStartTrackingTouch(SeekBar seekBar) {<NEW_LINE>// do nothing<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onStopTrackingTouch(SeekBar seekBar) {<NEW_LINE>// do nothing<NEW_LINE>}<NEW_LINE>});<NEW_LINE>AlertDialog.Builder alert = new AlertDialog.Builder(this);<NEW_LINE>// this is set the view from XML inside AlertDialog<NEW_LINE>alert.setView(dialogLayout);<NEW_LINE>alert.setNegativeButton(getResources().getString(R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int which) {<NEW_LINE>compressSize = false;<NEW_LINE>dialog.cancel();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>alert.setPositiveButton(getResources().getString(R.string.set), new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int which) {<NEW_LINE>new SaveCompressedImage().execute(getString(R.string.size));<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>});<NEW_LINE><MASK><NEW_LINE>dialog.show();<NEW_LINE>} | AlertDialog dialog = alert.create(); |
1,794,117 | public void multiRemove(final ReadableArray keys, final Callback callback) {<NEW_LINE>if (keys.size() == 0) {<NEW_LINE>callback.invoke();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void doInBackgroundGuarded(Void... params) {<NEW_LINE>if (!ensureDatabase()) {<NEW_LINE>callback.invoke(AsyncStorageErrorUtil.getDBError(null));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WritableMap error = null;<NEW_LINE>try {<NEW_LINE>mReactDatabaseSupplier.get().beginTransaction();<NEW_LINE>for (int keyStart = 0; keyStart < keys.size(); keyStart += MAX_SQL_KEYS) {<NEW_LINE>int keyCount = Math.min(keys.size() - keyStart, MAX_SQL_KEYS);<NEW_LINE>mReactDatabaseSupplier.get().delete(ReactDatabaseSupplier.TABLE_CATALYST, AsyncLocalStorageUtil.buildKeySelection(keyCount), AsyncLocalStorageUtil.buildKeySelectionArgs(keys, keyStart, keyCount));<NEW_LINE>}<NEW_LINE>mReactDatabaseSupplier.get().setTransactionSuccessful();<NEW_LINE>} catch (Exception e) {<NEW_LINE>FLog.w(ReactConstants.TAG, e.getMessage(), e);<NEW_LINE>error = AsyncStorageErrorUtil.getError(null, e.getMessage());<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>mReactDatabaseSupplier.get().endTransaction();<NEW_LINE>} catch (Exception e) {<NEW_LINE>FLog.w(ReactConstants.TAG, <MASK><NEW_LINE>if (error == null) {<NEW_LINE>error = AsyncStorageErrorUtil.getError(null, e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (error != null) {<NEW_LINE>callback.invoke(error);<NEW_LINE>} else {<NEW_LINE>callback.invoke();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}.executeOnExecutor(executor);<NEW_LINE>} | e.getMessage(), e); |
314,449 | private CompositeData readCompositeData(Object value, CompositeType ct) throws ConversionException {<NEW_LINE>Set<String> keys = ct.keySet();<NEW_LINE>if (!(value instanceof JSONObject)) {<NEW_LINE>throwConversionException("readCompositeData() expects a JSONObject.", value);<NEW_LINE>}<NEW_LINE>JSONObject json = (JSONObject) value;<NEW_LINE>int size = keys.size();<NEW_LINE>if (size != json.size()) {<NEW_LINE>throwConversionException("readCompositeData() expects the same number of entries as in the type.", json);<NEW_LINE>}<NEW_LINE>String[] names = new String[size];<NEW_LINE>Object[] values = new Object[size];<NEW_LINE>int i = 0;<NEW_LINE>for (String key : keys) {<NEW_LINE>names[i] = key;<NEW_LINE>values[i++] = readOpenData(json.get(key)<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return new CompositeDataSupport(ct, names, values);<NEW_LINE>} catch (OpenDataException e) {<NEW_LINE>// Should never happen. All names/values are constructed based<NEW_LINE>// on the open type.<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | , ct.getType(key)); |
1,094,636 | // -------------------------------------------------------------------------<NEW_LINE>@Override<NEW_LINE>public Function<Double, Double> differentiate(Function<Double, Double> function, Function<Double, Boolean> domain) {<NEW_LINE><MASK><NEW_LINE>ArgChecker.notNull(domain, "domain");<NEW_LINE>return new Function<Double, Double>() {<NEW_LINE><NEW_LINE>@SuppressWarnings("synthetic-access")<NEW_LINE>@Override<NEW_LINE>public Double apply(Double x) {<NEW_LINE>ArgChecker.notNull(x, "x");<NEW_LINE>ArgChecker.isTrue(domain.apply(x), "point {} is not in the function domain", x.toString());<NEW_LINE>if (!domain.apply(x + threeEps)) {<NEW_LINE>if (!domain.apply(x - threeEps)) {<NEW_LINE>throw new IllegalArgumentException("cannot get derivative at point " + x.toString());<NEW_LINE>}<NEW_LINE>return (-function.apply(x - threeEps) + 4d * function.apply(x - twoEps) - 5d * function.apply(x - eps) + 2d * function.apply(x)) / epsSqr;<NEW_LINE>} else {<NEW_LINE>if (!domain.apply(x - eps)) {<NEW_LINE>return (-function.apply(x + threeEps) + 4d * function.apply(x + twoEps) - 5d * function.apply(x + eps) + 2d * function.apply(x)) / epsSqr;<NEW_LINE>}<NEW_LINE>return (function.apply(x + eps) + function.apply(x - eps) - 2d * function.apply(x)) / epsSqr;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | ArgChecker.notNull(function, "function"); |
1,849,606 | final UpdateOrganizationConfigurationResult executeUpdateOrganizationConfiguration(UpdateOrganizationConfigurationRequest updateOrganizationConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateOrganizationConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateOrganizationConfigurationRequest> request = null;<NEW_LINE>Response<UpdateOrganizationConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateOrganizationConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateOrganizationConfigurationRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SecurityHub");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateOrganizationConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateOrganizationConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateOrganizationConfigurationResultJsonUnmarshaller());<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.endEvent(Field.RequestMarshallTime); |
1,510,552 | public static UpdatePrometheusAlertRuleResponse unmarshall(UpdatePrometheusAlertRuleResponse updatePrometheusAlertRuleResponse, UnmarshallerContext _ctx) {<NEW_LINE>updatePrometheusAlertRuleResponse.setRequestId(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.RequestId"));<NEW_LINE>PrometheusAlertRule prometheusAlertRule = new PrometheusAlertRule();<NEW_LINE>prometheusAlertRule.setStatus(_ctx.integerValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Status"));<NEW_LINE>prometheusAlertRule.setType(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Type"));<NEW_LINE>prometheusAlertRule.setNotifyType(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.NotifyType"));<NEW_LINE>prometheusAlertRule.setExpression(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Expression"));<NEW_LINE>prometheusAlertRule.setMessage(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Message"));<NEW_LINE>prometheusAlertRule.setDuration<MASK><NEW_LINE>prometheusAlertRule.setDispatchRuleId(_ctx.longValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.DispatchRuleId"));<NEW_LINE>prometheusAlertRule.setAlertName(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.AlertName"));<NEW_LINE>prometheusAlertRule.setAlertId(_ctx.longValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.AlertId"));<NEW_LINE>prometheusAlertRule.setClusterId(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.ClusterId"));<NEW_LINE>List<Label> labels = new ArrayList<Label>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Labels.Length"); i++) {<NEW_LINE>Label label = new Label();<NEW_LINE>label.setName(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Labels[" + i + "].Name"));<NEW_LINE>label.setValue(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Labels[" + i + "].Value"));<NEW_LINE>labels.add(label);<NEW_LINE>}<NEW_LINE>prometheusAlertRule.setLabels(labels);<NEW_LINE>List<Annotation> annotations = new ArrayList<Annotation>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Annotations.Length"); i++) {<NEW_LINE>Annotation annotation = new Annotation();<NEW_LINE>annotation.setName(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Annotations[" + i + "].Name"));<NEW_LINE>annotation.setValue(_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Annotations[" + i + "].Value"));<NEW_LINE>annotations.add(annotation);<NEW_LINE>}<NEW_LINE>prometheusAlertRule.setAnnotations(annotations);<NEW_LINE>updatePrometheusAlertRuleResponse.setPrometheusAlertRule(prometheusAlertRule);<NEW_LINE>return updatePrometheusAlertRuleResponse;<NEW_LINE>} | (_ctx.stringValue("UpdatePrometheusAlertRuleResponse.PrometheusAlertRule.Duration")); |
1,500,235 | public void callAsync(KrollObject krollObject, HashMap args) {<NEW_LINE>// Validate.<NEW_LINE>if (args == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Fetch selected date "value". Property won't be defined if user canceled out.<NEW_LINE>Object objectValue = args.get(TiC.PROPERTY_VALUE);<NEW_LINE>if (!(objectValue instanceof Date)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Date dateValue = (Date) objectValue;<NEW_LINE>// Make sure selected date does not exceed min/max bounds. (Should never happen.)<NEW_LINE>if ((this.picker.minDate != null) && dateValue.before(this.picker.minDate)) {<NEW_LINE>dateValue = this.picker.minDate;<NEW_LINE>} else if ((this.picker.maxDate != null) && dateValue.after(this.picker.maxDate)) {<NEW_LINE>dateValue = this.picker.maxDate;<NEW_LINE>}<NEW_LINE>// Show selected date in text field.<NEW_LINE>this.picker.setValue(dateValue);<NEW_LINE>// Fire a "change" event.<NEW_LINE>KrollDict data = new KrollDict();<NEW_LINE>data.<MASK><NEW_LINE>this.picker.fireEvent(TiC.EVENT_CHANGE, data);<NEW_LINE>} | put(TiC.PROPERTY_VALUE, dateValue); |
995,286 | public void scan(int index, GradPair left, GradPair right) {<NEW_LINE>if (numClass == 2 || multiClassMultiTree) {<NEW_LINE>((BinaryGradPair) left).plusBy(gradients[index], hessians[index]);<NEW_LINE>((BinaryGradPair) right).subtractBy(gradients[index], hessians[index]);<NEW_LINE>} else if (!fullHessian) {<NEW_LINE>MultiGradPair leftMulti = (MultiGradPair) left;<NEW_LINE>double[] leftGrad = leftMulti.getGrad();<NEW_LINE>double[] leftHess = leftMulti.getHess();<NEW_LINE>MultiGradPair rightMulti = (MultiGradPair) right;<NEW_LINE>double[] rightGrad = rightMulti.getGrad();<NEW_LINE>double[] rightHess = rightMulti.getHess();<NEW_LINE>int offset = index * numClass;<NEW_LINE>for (int i = 0; i < numClass; i++) {<NEW_LINE>leftGrad[i] += gradients[offset + i];<NEW_LINE>leftHess[i] += hessians[offset + i];<NEW_LINE>rightGrad[i<MASK><NEW_LINE>rightHess[i] -= hessians[offset + i];<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>MultiGradPair leftMulti = (MultiGradPair) left;<NEW_LINE>double[] leftGrad = leftMulti.getGrad();<NEW_LINE>double[] leftHess = leftMulti.getHess();<NEW_LINE>MultiGradPair rightMulti = (MultiGradPair) right;<NEW_LINE>double[] rightGrad = rightMulti.getGrad();<NEW_LINE>double[] rightHess = rightMulti.getHess();<NEW_LINE>int gradOffset = index * leftGrad.length;<NEW_LINE>int hessOffset = index * leftHess.length;<NEW_LINE>for (int i = 0; i < leftGrad.length; i++) {<NEW_LINE>leftGrad[i] += gradients[gradOffset + i];<NEW_LINE>rightGrad[i] -= gradients[gradOffset + i];<NEW_LINE>}<NEW_LINE>for (int i = 0; i < leftHess.length; i++) {<NEW_LINE>leftHess[i] += hessians[hessOffset + i];<NEW_LINE>rightHess[i] -= hessians[hessOffset + i];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] -= gradients[offset + i]; |
604,490 | private static String[] substituteEnv(Format format, String[] envp) {<NEW_LINE>if (envp == null || envp.length == 0 || format == null) {<NEW_LINE>return envp;<NEW_LINE>}<NEW_LINE>String[] ret = new String[envp.length];<NEW_LINE>StringBuffer adder = new StringBuffer();<NEW_LINE>for (int i = 0; i < envp.length; i++) {<NEW_LINE>ret[i] = envp[i];<NEW_LINE>if (ret[i] == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>int idx = ret[i].indexOf('=');<NEW_LINE>if (idx < 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String val = ret[i<MASK><NEW_LINE>String key = ret[i].substring(0, idx);<NEW_LINE>adder.append(key).append('=').append(format.format(val));<NEW_LINE>ret[i] = adder.toString();<NEW_LINE>adder.setLength(0);<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | ].substring(idx + 1); |
883,629 | public UseCase unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UseCase useCase = new UseCase();<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("UseCaseId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>useCase.setUseCaseId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("UseCaseArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>useCase.setUseCaseArn(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("UseCaseType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>useCase.setUseCaseType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return useCase;<NEW_LINE>} | class).unmarshall(context)); |
116,343 | private static void initializeInterface(Configuration c, String ifaceName, @Nullable String vrfName, SnapshotRuntimeData snapshotRuntimeData, Warnings w) {<NEW_LINE>// Either use the provided runtime data to get the interface speed, or else default to guessing<NEW_LINE>// based on name.<NEW_LINE>Optional<InterfaceRuntimeData> runtimeData = Optional.ofNullable(c.getHostname()).map(snapshotRuntimeData::getRuntimeData).map(d -> d.getInterface(ifaceName));<NEW_LINE>double guessedBandwidth = ifaceName.equals(LOOPBACK_INTERFACE_NAME) ? DEFAULT_LOOPBACK_BANDWIDTH : DEFAULT_PORT_BANDWIDTH;<NEW_LINE>double bandwidth = runtimeData.map(InterfaceRuntimeData::getBandwidth).filter(bw -> validateBandwidth(bw, ifaceName, w)).orElse(guessedBandwidth);<NEW_LINE>Interface.builder().setName(ifaceName).setOwner(c).setVrf(getOrCreateVrf(c, vrfName)).setBandwidth(bandwidth).setMtu(ifaceName.equals(LOOPBACK_INTERFACE_NAME) ? DEFAULT_LOOPBACK_MTU : DEFAULT_PORT_MTU).setType(<MASK><NEW_LINE>} | InterfaceType.UNKNOWN).build(); |
1,581,879 | public boolean handleResponseError(BackOffer backOffer, RespT resp) {<NEW_LINE>if (resp == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>PDError error = getError.apply(resp);<NEW_LINE>if (error != null) {<NEW_LINE>switch(error.getErrorType()) {<NEW_LINE>case PD_ERROR:<NEW_LINE>backOffer.doBackOff(BackOffFunction.BackOffFuncType.BoPDRPC, new GrpcException(error.toString()));<NEW_LINE>client.updateLeader();<NEW_LINE>return true;<NEW_LINE>case REGION_PEER_NOT_ELECTED:<NEW_LINE>logger.<MASK><NEW_LINE>backOffer.doBackOff(BackOffFunction.BackOffFuncType.BoPDRPC, new GrpcException(error.toString()));<NEW_LINE>return true;<NEW_LINE>default:<NEW_LINE>throw new TiClientInternalException("Unknown error type encountered: " + error);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | debug(error.getMessage()); |
1,145,654 | protected Entry<String, List<Double>> createOutputDoubleValues(Collection<Map<String, Object>> ruleResults) {<NEW_LINE>Map<String, List<Double>> <MASK><NEW_LINE>for (Map<String, Object> ruleResult : ruleResults) {<NEW_LINE>for (Entry<String, Object> entry : ruleResult.entrySet()) {<NEW_LINE>if (distinctOutputDoubleValues.containsKey(entry.getKey()) && distinctOutputDoubleValues.get(entry.getKey()) != null) {<NEW_LINE>distinctOutputDoubleValues.get(entry.getKey()).add((Double) entry.getValue());<NEW_LINE>} else {<NEW_LINE>List<Double> valuesList = new ArrayList<>();<NEW_LINE>valuesList.add((Double) entry.getValue());<NEW_LINE>distinctOutputDoubleValues.put(entry.getKey(), valuesList);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// get first entry<NEW_LINE>Entry<String, List<Double>> firstEntry = null;<NEW_LINE>if (!distinctOutputDoubleValues.isEmpty()) {<NEW_LINE>firstEntry = distinctOutputDoubleValues.entrySet().iterator().next();<NEW_LINE>}<NEW_LINE>return firstEntry;<NEW_LINE>} | distinctOutputDoubleValues = new HashMap<>(); |
1,575,116 | public static GetSettingsResponse fromXContent(XContentParser parser) throws IOException {<NEW_LINE>HashMap<String, Settings> indexToSettings = new HashMap<>();<NEW_LINE>HashMap<String, Settings> <MASK><NEW_LINE>if (parser.currentToken() == null) {<NEW_LINE>parser.nextToken();<NEW_LINE>}<NEW_LINE>XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser);<NEW_LINE>parser.nextToken();<NEW_LINE>while (parser.isClosed() == false) {<NEW_LINE>if (parser.currentToken() == XContentParser.Token.START_OBJECT) {<NEW_LINE>// we must assume this is an index entry<NEW_LINE>parseIndexEntry(parser, indexToSettings, indexToDefaultSettings);<NEW_LINE>} else if (parser.currentToken() == XContentParser.Token.START_ARRAY) {<NEW_LINE>parser.skipChildren();<NEW_LINE>} else {<NEW_LINE>parser.nextToken();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ImmutableOpenMap<String, Settings> settingsMap = ImmutableOpenMap.<String, Settings>builder().putAllFromMap(indexToSettings).build();<NEW_LINE>ImmutableOpenMap<String, Settings> defaultSettingsMap = ImmutableOpenMap.<String, Settings>builder().putAllFromMap(indexToDefaultSettings).build();<NEW_LINE>return new GetSettingsResponse(settingsMap, defaultSettingsMap);<NEW_LINE>} | indexToDefaultSettings = new HashMap<>(); |
78,074 | public RepositoryNameIdPair unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>RepositoryNameIdPair repositoryNameIdPair = new RepositoryNameIdPair();<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 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("repositoryName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>repositoryNameIdPair.setRepositoryName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("repositoryId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>repositoryNameIdPair.setRepositoryId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return repositoryNameIdPair;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
863,304 | protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {<NEW_LINE>final int count = Common.normalise(req.getParameter("queries"));<NEW_LINE>final World[] worlds = new World[count];<NEW_LINE>// Fetch some rows from the database.<NEW_LINE>try (Connection conn = dataSource.getConnection()) {<NEW_LINE>Common.modifySQLConnectionSettings(conn);<NEW_LINE>try (PreparedStatement statement = conn.prepareStatement(DB_QUERY, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {<NEW_LINE>// Run the query the number of times requested.<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>final int id = Common.getRandom();<NEW_LINE><MASK><NEW_LINE>try (ResultSet results = statement.executeQuery()) {<NEW_LINE>results.next();<NEW_LINE>worlds[i] = new World(id, results.getInt("randomNumber"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (SQLException sqlex) {<NEW_LINE>throw new ServletException(sqlex);<NEW_LINE>}<NEW_LINE>// Set content type to JSON<NEW_LINE>res.setHeader(Common.HEADER_CONTENT_TYPE, Common.CONTENT_TYPE_JSON);<NEW_LINE>// Write JSON encoded message to the response.<NEW_LINE>Common.MAPPER.writeValue(res.getOutputStream(), worlds);<NEW_LINE>} | statement.setInt(1, id); |
1,755,253 | void submitFeedback() {<NEW_LINE>if (dialogFeedbackBinding.feedbackItemEditText.getText().toString().equals("")) {<NEW_LINE>dialogFeedbackBinding.feedbackItemEditText.setError(getContext().getString(R.string.enter_description));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String appVersion = <MASK><NEW_LINE>String androidVersion = dialogFeedbackBinding.androidVersionCheckbox.isChecked() ? DeviceInfoUtil.getAndroidVersion() : null;<NEW_LINE>String apiLevel = dialogFeedbackBinding.apiLevelCheckbox.isChecked() ? DeviceInfoUtil.getAPILevel() : null;<NEW_LINE>String deviceManufacturer = dialogFeedbackBinding.deviceManufacturerCheckbox.isChecked() ? DeviceInfoUtil.getDeviceManufacturer() : null;<NEW_LINE>String deviceModel = dialogFeedbackBinding.deviceModelCheckbox.isChecked() ? DeviceInfoUtil.getDeviceModel() : null;<NEW_LINE>String deviceName = dialogFeedbackBinding.deviceNameCheckbox.isChecked() ? DeviceInfoUtil.getDevice() : null;<NEW_LINE>String networkType = dialogFeedbackBinding.networkTypeCheckbox.isChecked() ? DeviceInfoUtil.getConnectionType(getContext()).toString() : null;<NEW_LINE>Feedback feedback = new Feedback(appVersion, apiLevel, dialogFeedbackBinding.feedbackItemEditText.getText().toString(), androidVersion, deviceModel, deviceManufacturer, deviceName, networkType);<NEW_LINE>onFeedbackSubmitCallback.onFeedbackSubmit(feedback);<NEW_LINE>dismiss();<NEW_LINE>} | ConfigUtils.getVersionNameWithSha(getContext()); |
193,832 | private void readerLookup(MediaType mediaType, RuntimeType runtimeType, List<MediaType> mt, List<MessageBodyReader<?>> ret, List<ResourceReader> goodTypeReaders) {<NEW_LINE>if (goodTypeReaders != null && !goodTypeReaders.isEmpty()) {<NEW_LINE>List<ResourceReader> mediaTypeMatchingReaders = new ArrayList<>(goodTypeReaders.size());<NEW_LINE>for (int i = 0; i < goodTypeReaders.size(); i++) {<NEW_LINE>ResourceReader goodTypeReader = goodTypeReaders.get(i);<NEW_LINE>if (!goodTypeReader.matchesRuntimeType(runtimeType)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>MediaType match = MediaTypeHelper.getFirstMatch(mt, goodTypeReader.mediaTypes());<NEW_LINE>if (match != null || mediaType == null) {<NEW_LINE>mediaTypeMatchingReaders.add(goodTypeReader);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mediaTypeMatchingReaders.sort(ResourceReader.ResourceReaderComparator.INSTANCE);<NEW_LINE>for (ResourceReader mediaTypeMatchingReader : mediaTypeMatchingReaders) {<NEW_LINE>ret.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | add(mediaTypeMatchingReader.instance()); |
1,287,263 | public Predicate generate(Predicate originalPredicate) {<NEW_LINE>if (generated) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>generated = true;<NEW_LINE>if (!intersected) {<NEW_LINE>return originalPredicate;<NEW_LINE>}<NEW_LINE>if (isNullnessCheck()) {<NEW_LINE>return new EqualPredicate(attribute, NULL);<NEW_LINE>}<NEW_LINE>assert from != NULL && to != NULL;<NEW_LINE>if (from == null) {<NEW_LINE>return new GreaterLessPredicate(<MASK><NEW_LINE>} else if (to == null) {<NEW_LINE>return new GreaterLessPredicate(attribute, from, fromInclusive, false);<NEW_LINE>} else if (from == to || Comparables.compare(from, to) == 0) {<NEW_LINE>// If from equals to, the predicate may be satisfiable only if<NEW_LINE>// both bounds are inclusive.<NEW_LINE>assert fromInclusive && toInclusive;<NEW_LINE>return new EqualPredicate(attribute, from);<NEW_LINE>} else if (fromInclusive && toInclusive) {<NEW_LINE>return new BetweenPredicate(attribute, from, to);<NEW_LINE>} else {<NEW_LINE>return new BoundedRangePredicate(attribute, from, fromInclusive, to, toInclusive);<NEW_LINE>}<NEW_LINE>} | attribute, to, toInclusive, true); |
1,602,926 | /*<NEW_LINE>* Provided that m is of a type that implements interface java.util.Map:<NEW_LINE>* <ul><NEW_LINE>* <li>Given a call m.containsKey(k), ensures that k is @KeyFor("m") in the thenStore of the transfer result.<NEW_LINE>* <li>Given a call m.put(k, ...), ensures that k is @KeyFor("m") in the thenStore and elseStore of the transfer result.<NEW_LINE>* </ul><NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public TransferResult<KeyForValue, KeyForStore> visitMethodInvocation(MethodInvocationNode node, TransferInput<KeyForValue, KeyForStore> in) {<NEW_LINE>TransferResult<KeyForValue, KeyForStore> result = super.visitMethodInvocation(node, in);<NEW_LINE>KeyForAnnotatedTypeFactory factory = <MASK><NEW_LINE>if (factory.isMapContainsKey(node) || factory.isMapPut(node)) {<NEW_LINE>Node receiver = node.getTarget().getReceiver();<NEW_LINE>JavaExpression receiverJe = JavaExpression.fromNode(receiver);<NEW_LINE>String mapName = receiverJe.toString();<NEW_LINE>JavaExpression keyExpr = JavaExpression.fromNode(node.getArgument(0));<NEW_LINE>LinkedHashSet<String> keyForMaps = new LinkedHashSet<>();<NEW_LINE>keyForMaps.add(mapName);<NEW_LINE>final KeyForValue previousKeyValue = in.getValueOfSubNode(node.getArgument(0));<NEW_LINE>if (previousKeyValue != null) {<NEW_LINE>for (AnnotationMirror prevAm : previousKeyValue.getAnnotations()) {<NEW_LINE>if (prevAm != null && factory.areSameByClass(prevAm, KeyFor.class)) {<NEW_LINE>keyForMaps.addAll(getKeys(prevAm));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>AnnotationMirror am = factory.createKeyForAnnotationMirrorWithValue(keyForMaps);<NEW_LINE>if (factory.isMapContainsKey(node)) {<NEW_LINE>// method is Map.containsKey<NEW_LINE>result.getThenStore().insertValue(keyExpr, am);<NEW_LINE>} else {<NEW_LINE>// method is Map.put<NEW_LINE>result.getThenStore().insertValue(keyExpr, am);<NEW_LINE>result.getElseStore().insertValue(keyExpr, am);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (KeyForAnnotatedTypeFactory) analysis.getTypeFactory(); |
83,408 | final DescribeIdentityResult executeDescribeIdentity(DescribeIdentityRequest describeIdentityRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeIdentityRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeIdentityRequest> request = null;<NEW_LINE>Response<DescribeIdentityResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeIdentityRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeIdentityRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeIdentity");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeIdentityResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeIdentityResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "Cognito Identity"); |
1,640,031 | public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {<NEW_LINE>String filterText = null;<NEW_LINE>final InstanceOperations instanceOps = shellState.getAccumuloClient().instanceOperations();<NEW_LINE>final boolean paginate = !cl.<MASK><NEW_LINE>Stream<String> activeCompactionStream;<NEW_LINE>if (cl.hasOption(tserverOption.getOpt())) {<NEW_LINE>activeCompactionStream = ActiveCompactionHelper.activeCompactionsForServer(cl.getOptionValue(tserverOption.getOpt()), instanceOps);<NEW_LINE>} else {<NEW_LINE>activeCompactionStream = ActiveCompactionHelper.stream(instanceOps);<NEW_LINE>}<NEW_LINE>if (cl.hasOption(filterOption.getOpt())) {<NEW_LINE>filterText = ".*" + cl.getOptionValue(filterOption.getOpt()) + ".*";<NEW_LINE>}<NEW_LINE>if (filterText != null) {<NEW_LINE>activeCompactionStream = activeCompactionStream.filter(Pattern.compile(filterText).asMatchPredicate());<NEW_LINE>}<NEW_LINE>activeCompactionStream = ActiveCompactionHelper.appendHeader(activeCompactionStream);<NEW_LINE>shellState.printLines(activeCompactionStream.iterator(), paginate);<NEW_LINE>return 0;<NEW_LINE>} | hasOption(disablePaginationOpt.getOpt()); |
516,325 | public StartTaskContactResult startTaskContact(StartTaskContactRequest startTaskContactRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startTaskContactRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StartTaskContactRequest> request = null;<NEW_LINE>Response<StartTaskContactResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartTaskContactRequestMarshaller().marshall(startTaskContactRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>Unmarshaller<StartTaskContactResult, JsonUnmarshallerContext> unmarshaller = new StartTaskContactResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<StartTaskContactResult> responseHandler = new JsonResponseHandler<StartTaskContactResult>(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>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,107,027 | private byte[][] computeRecipientsField(byte[] seed) throws GeneralSecurityException, IOException {<NEW_LINE>byte[][] recipientsField = new byte[policy.getNumberOfRecipients()][];<NEW_LINE>Iterator<PublicKeyRecipient> it = policy.getRecipientsIterator();<NEW_LINE>int i = 0;<NEW_LINE>while (it.hasNext()) {<NEW_LINE>PublicKeyRecipient recipient = it.next();<NEW_LINE>X509Certificate certificate = recipient.getX509();<NEW_LINE>int permission = recipient.getPermission().getPermissionBytesForPublicKey();<NEW_LINE>byte[] pkcs7input = new byte[24];<NEW_LINE>byte one = (byte) (permission);<NEW_LINE>byte two = (byte) (permission >>> 8);<NEW_LINE>byte three = (byte) (permission >>> 16);<NEW_LINE>byte four = (byte) (permission >>> 24);<NEW_LINE>// put this seed in the pkcs7 input<NEW_LINE>System.arraycopy(seed, 0, pkcs7input, 0, 20);<NEW_LINE>pkcs7input[20] = four;<NEW_LINE>pkcs7input[21] = three;<NEW_LINE>pkcs7input[22] = two;<NEW_LINE>pkcs7input[23] = one;<NEW_LINE>ASN1Primitive <MASK><NEW_LINE>ByteArrayOutputStream baos = new ByteArrayOutputStream();<NEW_LINE>ASN1OutputStream k = ASN1OutputStream.create(baos, ASN1Encoding.DER);<NEW_LINE>k.writeObject(obj);<NEW_LINE>recipientsField[i] = baos.toByteArray();<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>return recipientsField;<NEW_LINE>} | obj = createDERForRecipient(pkcs7input, certificate); |
187,256 | protected static int unsignedOneSidedGallopingIntersect2by2(final CharBuffer smallSet, final int smallLength, final CharBuffer largeSet, final int largeLength, final char[] buffer) {<NEW_LINE>if (0 == smallLength) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int k1 = 0;<NEW_LINE>int k2 = 0;<NEW_LINE>int pos = 0;<NEW_LINE>char s1 = largeSet.get(k1);<NEW_LINE>char s2 = smallSet.get(k2);<NEW_LINE>while (true) {<NEW_LINE>if (s1 < s2) {<NEW_LINE>k1 = advanceUntil(largeSet, k1, largeLength, s2);<NEW_LINE>if (k1 == largeLength) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (s2 < s1) {<NEW_LINE>++k2;<NEW_LINE>if (k2 == smallLength) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>s2 = smallSet.get(k2);<NEW_LINE>} else {<NEW_LINE>// (set2.get(k2) == set1.get(k1))<NEW_LINE>buffer[pos++] = s2;<NEW_LINE>++k2;<NEW_LINE>if (k2 == smallLength) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>s2 = smallSet.get(k2);<NEW_LINE>k1 = advanceUntil(largeSet, k1, largeLength, s2);<NEW_LINE>if (k1 == largeLength) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>s1 = largeSet.get(k1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return pos;<NEW_LINE>} | s1 = largeSet.get(k1); |
1,238,235 | public com.squareup.okhttp.Call orderClosePositionCall(String symbol, Double price, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/order/closePosition";<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (symbol != null)<NEW_LINE>localVarFormParams.put("symbol", symbol);<NEW_LINE>if (price != null)<NEW_LINE>localVarFormParams.put("price", price);<NEW_LINE>final String[] localVarAccepts = { "application/json", "application/xml", "text/xml", "application/javascript", "text/javascript" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null)<NEW_LINE><MASK><NEW_LINE>final String[] localVarContentTypes = { "application/json", "application/x-www-form-urlencoded" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>if (progressListener != null) {<NEW_LINE>apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {<NEW_LINE>com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());<NEW_LINE>return originalResponse.newBuilder().body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>String[] localVarAuthNames = new String[] { "apiExpires", "apiKey", "apiSignature" };<NEW_LINE>return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);<NEW_LINE>} | localVarHeaderParams.put("Accept", localVarAccept); |
795,790 | // ---------------//<NEW_LINE>// mouseReleased //<NEW_LINE>// ---------------//<NEW_LINE>@Override<NEW_LINE>public void mouseReleased(MouseEvent e) {<NEW_LINE>if (mouseMonitor == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (isRezoomWanted(e)) {<NEW_LINE>updateSize(e);<NEW_LINE>mouseMonitor.rectangleZoomed(rect, RELEASING);<NEW_LINE>} else if (isDragWanted(e)) {<NEW_LINE>Rectangle vr = component.getVisibleRect();<NEW_LINE>rawRect.setBounds(vr.x + (vr.width / 2), vr.y + (vr.height / 2), 0, 0);<NEW_LINE>normalize();<NEW_LINE>} else if (isAdditionWanted(e)) {<NEW_LINE>if (isContextWanted(e)) {<NEW_LINE>mouseMonitor.contextAdded(getCenter(), RELEASING);<NEW_LINE>} else {<NEW_LINE>mouseMonitor.pointAdded(getCenter(), RELEASING);<NEW_LINE>}<NEW_LINE>} else if (rect != null) {<NEW_LINE>if (isContextWanted(e)) {<NEW_LINE>mouseMonitor.contextSelected(getCenter(), RELEASING);<NEW_LINE>} else if ((rect.width != 0) && (rect.height != 0)) {<NEW_LINE>updateSize(e);<NEW_LINE>mouseMonitor.rectangleSelected(rect, RELEASING);<NEW_LINE>} else {<NEW_LINE>mouseMonitor.pointSelected(getCenter(), RELEASING);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>e.getComponent().<MASK><NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.warn("Error in mouseReleased " + ex, ex);<NEW_LINE>}<NEW_LINE>} | setCursor(Cursor.getDefaultCursor()); |
117,301 | public void handleNotification(Notification notification) {<NEW_LINE>super.handleNotification(notification);<NEW_LINE><MASK><NEW_LINE>UIStage uiStage = sandbox.getUIStage();<NEW_LINE>switch(notification.getName()) {<NEW_LINE>case UIBasicItemProperties.TAGS_BUTTON_CLICKED:<NEW_LINE>viewComponent.show(uiStage);<NEW_LINE>break;<NEW_LINE>case MsgAPI.ITEM_SELECTION_CHANGED:<NEW_LINE>Set<Entity> selection = notification.getBody();<NEW_LINE>if (selection.size() == 1) {<NEW_LINE>setObservable(selection.iterator().next());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case MsgAPI.EMPTY_SPACE_CLICKED:<NEW_LINE>setObservable(null);<NEW_LINE>break;<NEW_LINE>case TagsDialog.LIST_CHANGED:<NEW_LINE>viewComponent.updateView();<NEW_LINE>MainItemComponent mainItemComponent = observable.getComponent(MainItemComponent.class);<NEW_LINE>mainItemComponent.tags = viewComponent.getTags();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | Sandbox sandbox = Sandbox.getInstance(); |
361,001 | public void processElement(@Element Row in, OutputReceiver<KV<ByteString, Iterable<Mutation>>> out, ProcessContext c) {<NEW_LINE>DataTokenizationOptions options = c.getPipelineOptions().as(DataTokenizationOptions.class);<NEW_LINE>// Mapping every field in provided Row to Mutation.SetCell, which will create/update<NEW_LINE>// cell content with provided data<NEW_LINE>Set<Mutation> mutations = // Ignoring key field, otherwise it will be added as regular column<NEW_LINE>schema.getFields().stream().map(Schema.Field::getName).filter(fieldName -> !Objects.equals(fieldName, options.getBigTableKeyColumnName())).map(fieldName -> Pair.of(fieldName, in.getString(fieldName))).map(pair -> Mutation.newBuilder().setSetCell(Mutation.SetCell.newBuilder().setFamilyName(options.getBigTableColumnFamilyName()).setColumnQualifier(ByteString.copyFrom(pair.getKey(), StandardCharsets.UTF_8)).setValue(ByteString.copyFrom(pair.getValue(), StandardCharsets.UTF_8)).setTimestampMicros(System.currentTimeMillis() * 1000).build()).build()).collect(Collectors.toSet());<NEW_LINE>// Converting key value to BigTable format<NEW_LINE>String columnName = in.getString(options.getBigTableKeyColumnName());<NEW_LINE>if (columnName != null) {<NEW_LINE>ByteString key = ByteString.copyFrom(columnName, StandardCharsets.UTF_8);<NEW_LINE>out.output(KV<MASK><NEW_LINE>}<NEW_LINE>} | .of(key, mutations)); |
648,209 | public InstrumentedMethod createInstrumentedMethod(MethodModel benchmarkMethod) throws InvalidBenchmarkException {<NEW_LINE>if (!benchmarkMethod.parameterTypes().isEmpty()) {<NEW_LINE>throw new InvalidBenchmarkException(<MASK><NEW_LINE>}<NEW_LINE>if (!benchmarkMethod.returnType().isPresent() || !benchmarkMethod.returnType().get().equals("double")) {<NEW_LINE>throw new InvalidBenchmarkException("Arbitrary measurement methods must have a return type of double: " + benchmarkMethod.name());<NEW_LINE>}<NEW_LINE>// Static technically doesn't hurt anything, but it's just the completely wrong idea<NEW_LINE>if (Modifier.isStatic(benchmarkMethod.modifiers())) {<NEW_LINE>throw new InvalidBenchmarkException("Arbitrary measurement methods must not be static: " + benchmarkMethod.name());<NEW_LINE>}<NEW_LINE>if (!Modifier.isPublic(benchmarkMethod.modifiers())) {<NEW_LINE>throw new InvalidBenchmarkException("Arbitrary measurement methods must be public: " + benchmarkMethod.name());<NEW_LINE>}<NEW_LINE>return new ArbitraryMeasurementInstrumentedMethod(benchmarkMethod);<NEW_LINE>} | "Arbitrary measurement methods should take no parameters: " + benchmarkMethod.name()); |
56,572 | protected void visitClass(int version, int access, String name, String signature, String superName, String[] interfaceNames) {<NEW_LINE>String methodName = "visitClass";<NEW_LINE>String useExternalName = getExternalName();<NEW_LINE>if (this.logParms != null) {<NEW_LINE>this.logParms[1] = name;<NEW_LINE>logger.logp(Level.FINER, CLASS_NAME, methodName, "[ {0} ] [ {1} ] External name [ {2} ]", logParms);<NEW_LINE>}<NEW_LINE>if (!name.equals(useExternalName)) {<NEW_LINE>if (logParms != null) {<NEW_LINE>logger.logp(Level.FINER, CLASS_NAME, methodName, "[ {0} ] [ {1} ] RETURN External name [ {2} ] does not match", logParms);<NEW_LINE>}<NEW_LINE>throw VISIT_ENDED_CLASS_MISMATCH;<NEW_LINE>}<NEW_LINE>if (logParms != null) {<NEW_LINE>logger.logp(Level.FINER, CLASS_NAME, methodName, "[ {0} ] [ {1} ] External name match; continuing", logParms);<NEW_LINE>}<NEW_LINE>this.classInfo = getInfoStore().createClassInfo(name, fixName(superName), access, fixNames(interfaceNames));<NEW_LINE>if (logParms != null) {<NEW_LINE>logParms[2] <MASK><NEW_LINE>logger.logp(Level.FINER, CLASS_NAME, methodName, "[ {0} ] [ {1} ] RETURN Move to class [ {2} ]", logParms);<NEW_LINE>}<NEW_LINE>} | = this.classInfo.getHashText(); |
295,576 | private void submit(final List<BatchItem> batch, final EventType eventType, final boolean delete) throws EventPublishingException, InternalNakadiException {<NEW_LINE>final Timeline activeTimeline = timelineService.getActiveTimeline(eventType);<NEW_LINE>final String topic = activeTimeline.getTopic();<NEW_LINE>final Span publishingSpan = TracingService.buildNewSpan("publishing_to_kafka").withTag(Tags.MESSAGE_BUS_DESTINATION.getKey(), topic).start();<NEW_LINE>try (Closeable ignored = TracingService.activateSpan(publishingSpan)) {<NEW_LINE>timelineService.getTopicRepository(eventType).syncPostBatch(topic, batch, eventType.getName(), delete);<NEW_LINE>} catch (final EventPublishingException epe) {<NEW_LINE>publishingSpan.log(epe.getMessage());<NEW_LINE>throw epe;<NEW_LINE>} catch (final IOException ioe) {<NEW_LINE><MASK><NEW_LINE>} finally {<NEW_LINE>publishingSpan.finish();<NEW_LINE>}<NEW_LINE>} | throw new InternalNakadiException("Error closing active span scope", ioe); |
499,989 | private void sendRequest(Request request, RequestContext requestContext, Map<String, String> wireAttrs, TransportCallback<StreamResponse> callback) {<NEW_LINE>final TransportCallback<StreamResponse> decoratedCallback = decorateUserCallback(request, callback);<NEW_LINE>final NettyClientState state = _state.get();<NEW_LINE>if (state != NettyClientState.RUNNING) {<NEW_LINE>decoratedCallback.onResponse(TransportResponseImpl.error(new IllegalStateException("Client is not running")));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final long <MASK><NEW_LINE>// Timeout ensures the request callback is always invoked and is cancelled before the<NEW_LINE>// responsibility of invoking the callback is handed over to the pipeline.<NEW_LINE>final Timeout<None> timeout = new Timeout<>(_scheduler, resolvedRequestTimeout, TimeUnit.MILLISECONDS, None.none());<NEW_LINE>timeout.addTimeoutTask(() -> decoratedCallback.onResponse(TransportResponseImpl.error(new TimeoutException("Exceeded request timeout of " + resolvedRequestTimeout + "ms"))));<NEW_LINE>// resolve address<NEW_LINE>final SocketAddress address;<NEW_LINE>try {<NEW_LINE>TimingContextUtil.markTiming(requestContext, TIMING_KEY);<NEW_LINE>address = resolveAddress(request, requestContext);<NEW_LINE>TimingContextUtil.markTiming(requestContext, TIMING_KEY);<NEW_LINE>} catch (Exception e) {<NEW_LINE>decoratedCallback.onResponse(TransportResponseImpl.error(e));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Serialize wire attributes<NEW_LINE>final Request requestWithWireAttrHeaders;<NEW_LINE>if (request instanceof StreamRequest) {<NEW_LINE>requestWithWireAttrHeaders = buildRequestWithWireAttributes((StreamRequest) request, wireAttrs);<NEW_LINE>} else {<NEW_LINE>MessageType.setMessageType(MessageType.Type.REST, wireAttrs);<NEW_LINE>requestWithWireAttrHeaders = buildRequestWithWireAttributes((RestRequest) request, wireAttrs);<NEW_LINE>}<NEW_LINE>// Gets channel pool<NEW_LINE>final AsyncPool<Channel> pool;<NEW_LINE>try {<NEW_LINE>pool = getChannelPoolManagerPerRequest(requestWithWireAttrHeaders).getPoolForAddress(address);<NEW_LINE>} catch (IllegalStateException e) {<NEW_LINE>decoratedCallback.onResponse(TransportResponseImpl.error(e));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Saves protocol version in request context<NEW_LINE>requestContext.putLocalAttr(R2Constants.HTTP_PROTOCOL_VERSION, _protocolVersion);<NEW_LINE>final Cancellable pendingGet = pool.get(new ChannelPoolGetCallback(pool, requestWithWireAttrHeaders, requestContext, decoratedCallback, timeout, resolvedRequestTimeout, _streamingTimeout));<NEW_LINE>if (pendingGet != null) {<NEW_LINE>timeout.addTimeoutTask(pendingGet::cancel);<NEW_LINE>}<NEW_LINE>} | resolvedRequestTimeout = resolveRequestTimeout(requestContext, _requestTimeout); |
105,410 | private void printPostInstallStepsDebian(File serviceFile) {<NEW_LINE>System.out.println(INTENSITY_BOLD + "Ubuntu/Debian Linux system detected (SystemV):" + INTENSITY_NORMAL);<NEW_LINE>System.out.println(" To install the service:");<NEW_LINE>System.out.println(" $ ln -s " + serviceFile.getPath() + " /etc/init.d/");<NEW_LINE>System.out.println("");<NEW_LINE>System.out.println(" To start the service when the machine is rebooted:");<NEW_LINE>System.out.println(" $ update-rc.d " + serviceFile.getName() + " defaults");<NEW_LINE>System.out.println("");<NEW_LINE><MASK><NEW_LINE>System.out.println(" $ update-rc.d -f " + serviceFile.getName() + " remove");<NEW_LINE>System.out.println("");<NEW_LINE>System.out.println(" To start the service:");<NEW_LINE>System.out.println(" $ /etc/init.d/" + serviceFile.getName() + " start");<NEW_LINE>System.out.println("");<NEW_LINE>System.out.println(" To stop the service:");<NEW_LINE>System.out.println(" $ /etc/init.d/" + serviceFile.getName() + " stop");<NEW_LINE>System.out.println("");<NEW_LINE>System.out.println(" To uninstall the service:");<NEW_LINE>System.out.println(" $ rm /etc/init.d/" + serviceFile.getName());<NEW_LINE>} | System.out.println(" To disable starting the service when the machine is rebooted:"); |
585,133 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void initializeDefaultPreferences() {<NEW_LINE>IPreferenceStore store = GroovyPlugin.getDefault().getPreferenceStore();<NEW_LINE>store.setDefault(PreferenceConstants.GROOVY_FORMATTER_MULTILINE_INDENTATION, PreferenceConstants.DEFAULT_INDENT_MULTILINE);<NEW_LINE>store.setDefault(PreferenceConstants.GROOVY_FORMATTER_BRACES_START, PreferenceConstants.SAME);<NEW_LINE>store.setDefault(<MASK><NEW_LINE>store.setDefault(PreferenceConstants.GROOVY_FORMATTER_MAX_LINELENGTH, PreferenceConstants.DEFAULT_MAX_LINE_LEN);<NEW_LINE>store.setDefault(PreferenceConstants.GROOVY_FORMATTER_LONG_LIST_LENGTH, PreferenceConstants.DEFAULT_LONG_LIST_LENGTH);<NEW_LINE>store.setDefault(PreferenceConstants.GROOVY_FORMATTER_REMOVE_UNNECESSARY_SEMICOLONS, false);<NEW_LINE>} | PreferenceConstants.GROOVY_FORMATTER_BRACES_END, PreferenceConstants.NEXT); |
1,476,062 | private void updateGradleVersionsFile() {<NEW_LINE>File file = getVersionCacheFile();<NEW_LINE>if (file.isFile()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>file<MASK><NEW_LINE>Bundle bundle = Platform.getBundle(IConstants.PLUGIN_ID);<NEW_LINE>URL url = FileLocator.find(bundle, new org.eclipse.core.runtime.Path(GRADLE_VERSIONS));<NEW_LINE>if (url != null) {<NEW_LINE>try (InputStream is = url.openStream();<NEW_LINE>InputStreamReader isr = new InputStreamReader(is);<NEW_LINE>BufferedReader br = new BufferedReader(isr);<NEW_LINE>FileOutputStream os = new FileOutputStream(file.getAbsolutePath())) {<NEW_LINE>br.lines().forEach(l -> {<NEW_LINE>try {<NEW_LINE>os.write(l.getBytes(StandardCharsets.UTF_8));<NEW_LINE>os.write("\n".getBytes(StandardCharsets.UTF_8));<NEW_LINE>} catch (IOException e) {<NEW_LINE>JavaLanguageServerPlugin.logException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (IOException e) {<NEW_LINE>JavaLanguageServerPlugin.logException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getParentFile().mkdirs(); |
1,258,702 | public static void addEncodingToMediaType(MediaType mediaType, io.swagger.v3.oas.annotations.media.Encoding encoding, JsonView jsonViewAnnotation) {<NEW_LINE>if (encoding == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(encoding.name())) {<NEW_LINE>Encoding encodingObject = new Encoding();<NEW_LINE>if (StringUtils.isNotBlank(encoding.contentType())) {<NEW_LINE>encodingObject.setContentType(encoding.contentType());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(encoding.style())) {<NEW_LINE>encodingObject.setStyle(Encoding.StyleEnum.valueOf<MASK><NEW_LINE>}<NEW_LINE>if (encoding.explode()) {<NEW_LINE>encodingObject.setExplode(encoding.explode());<NEW_LINE>}<NEW_LINE>if (encoding.allowReserved()) {<NEW_LINE>encodingObject.setAllowReserved(encoding.allowReserved());<NEW_LINE>}<NEW_LINE>if (encoding.headers() != null) {<NEW_LINE>getHeaders(encoding.headers(), jsonViewAnnotation).ifPresent(encodingObject::headers);<NEW_LINE>}<NEW_LINE>if (encoding.extensions() != null && encoding.extensions().length > 0) {<NEW_LINE>Map<String, Object> extensions = AnnotationsUtils.getExtensions(encoding.extensions());<NEW_LINE>if (extensions != null) {<NEW_LINE>extensions.forEach(encodingObject::addExtension);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mediaType.addEncoding(encoding.name(), encodingObject);<NEW_LINE>}<NEW_LINE>} | (encoding.style())); |
1,332,147 | protected Change save() throws Expression.ExpressionException, ArithmeticException, NumberFormatException {<NEW_LINE>double x = xField.setPrecision(14).getDouble();<NEW_LINE>double y = yField.setPrecision(14).getDouble();<NEW_LINE>double z = zField.setPrecision(14).getDouble();<NEW_LINE>float yaw = yawField.setPrecision(11).getFloat();<NEW_LINE>float pitch = pitchField.<MASK><NEW_LINE>float roll = rollField.setPrecision(11).getFloat();<NEW_LINE>SPTimeline timeline = guiPathing.getMod().getCurrentTimeline();<NEW_LINE>Change positionChange = timeline.updatePositionKeyframe(time, x, y, z, yaw, pitch, roll);<NEW_LINE>if (interpolationPanel.getSettingsPanel() == null) {<NEW_LINE>// The last keyframe doesn't have interpolator settings because there is no segment following it<NEW_LINE>return positionChange;<NEW_LINE>}<NEW_LINE>Interpolator interpolator = interpolationPanel.getSettingsPanel().createInterpolator();<NEW_LINE>if (interpolationPanel.getInterpolatorType() == InterpolatorType.DEFAULT) {<NEW_LINE>return CombinedChange.createFromApplied(positionChange, timeline.setInterpolatorToDefault(time), timeline.setDefaultInterpolator(interpolator));<NEW_LINE>} else {<NEW_LINE>return CombinedChange.createFromApplied(positionChange, timeline.setInterpolator(time, interpolator));<NEW_LINE>}<NEW_LINE>} | setPrecision(11).getFloat(); |
1,153,154 | private void drawImageOverlay(Graphics g) {<NEW_LINE>int width, height;<NEW_LINE>g.setColor(IMAGE_OVERLAY_COLOR);<NEW_LINE>// left vertical non cropped part<NEW_LINE>width = this.cropZoneRect.x - this.imageRect.x;<NEW_LINE>if (width > 0) {<NEW_LINE>g.fillRect(this.imageRect.x, this.imageRect.y, width, this.imageRect.height);<NEW_LINE>}<NEW_LINE>// right vertical non cropped<NEW_LINE>width = this.imageRect.x + this.imageRect.width - (this.cropZoneRect.x + this.cropZoneRect.width);<NEW_LINE>if (width > 0) {<NEW_LINE>g.fillRect(this.cropZoneRect.x + this.cropZoneRect.width, this.imageRect.y, <MASK><NEW_LINE>}<NEW_LINE>// Top horizontal non croppped part<NEW_LINE>height = this.cropZoneRect.y - this.imageRect.y;<NEW_LINE>if (height > 0) {<NEW_LINE>g.fillRect(this.cropZoneRect.x, this.imageRect.y, this.cropZoneRect.width, height);<NEW_LINE>}<NEW_LINE>// Bottom horizontal non croppped part<NEW_LINE>height = (this.imageRect.y + this.imageRect.height) - (this.cropZoneRect.y + this.cropZoneRect.height);<NEW_LINE>if (height > 0) {<NEW_LINE>g.fillRect(this.cropZoneRect.x, this.cropZoneRect.y + this.cropZoneRect.height, this.cropZoneRect.width, height);<NEW_LINE>}<NEW_LINE>} | width, this.imageRect.height); |
1,602,832 | public static long LLVMDIBuilderCreateModule(@NativeType("LLVMDIBuilderRef") long Builder, @NativeType("LLVMMetadataRef") long ParentScope, @NativeType("char const *") CharSequence Name, @NativeType("char const *") CharSequence ConfigMacros, @NativeType("char const *") CharSequence IncludePath, @NativeType("char const *") CharSequence APINotesFile) {<NEW_LINE>MemoryStack stack = stackGet();<NEW_LINE>int stackPointer = stack.getPointer();<NEW_LINE>try {<NEW_LINE>int NameEncodedLength = stack.nUTF8(Name, false);<NEW_LINE>long NameEncoded = stack.getPointerAddress();<NEW_LINE>int ConfigMacrosEncodedLength = stack.nUTF8(ConfigMacros, false);<NEW_LINE>long ConfigMacrosEncoded = stack.getPointerAddress();<NEW_LINE>int IncludePathEncodedLength = stack.nUTF8(IncludePath, false);<NEW_LINE>long IncludePathEncoded = stack.getPointerAddress();<NEW_LINE>int APINotesFileEncodedLength = stack.nUTF8(APINotesFile, false);<NEW_LINE>long APINotesFileEncoded = stack.getPointerAddress();<NEW_LINE>return nLLVMDIBuilderCreateModule(Builder, ParentScope, NameEncoded, NameEncodedLength, ConfigMacrosEncoded, ConfigMacrosEncodedLength, <MASK><NEW_LINE>} finally {<NEW_LINE>stack.setPointer(stackPointer);<NEW_LINE>}<NEW_LINE>} | IncludePathEncoded, IncludePathEncodedLength, APINotesFileEncoded, APINotesFileEncodedLength); |
122,254 | public void show(Activity activity) {<NEW_LINE>int hourToShow = settings.getStreamSleepTimerHour();<NEW_LINE>int minuteToShow = settings.getStreamSleepTimerMinute();<NEW_LINE>if (isRunning && sleepTimerProgressMinutes > 0) {<NEW_LINE>hourToShow = sleepTimerProgressMinutes / 60;<NEW_LINE>minuteToShow = sleepTimerProgressMinutes % 60;<NEW_LINE>}<NEW_LINE>DialogService.getSleepTimerDialog(activity, isRunning, (dialog, which) -> {<NEW_LINE>View customView = dialog.getCustomView();<NEW_LINE>if (customView == null)<NEW_LINE>return;<NEW_LINE>MaterialNumberPicker hourPicker = customView.findViewById(R.id.hourPicker);<NEW_LINE>MaterialNumberPicker minPicker = customView.findViewById(R.id.minutePicker);<NEW_LINE>int hour = hourPicker.getValue()<MASK><NEW_LINE>if (isRunning) {<NEW_LINE>sleepTimerProgressMinutes = hour * 60 + minute;<NEW_LINE>} else {<NEW_LINE>start(hour, minute);<NEW_LINE>}<NEW_LINE>}, (dialog, which) -> {<NEW_LINE>if (isRunning) {<NEW_LINE>stop();<NEW_LINE>}<NEW_LINE>}, hourToShow, minuteToShow).show();<NEW_LINE>} | , minute = minPicker.getValue(); |
1,185,509 | public void run() {<NEW_LINE>Runtime.getRuntime().addShutdownHook(new Thread(() -> {<NEW_LINE>// Use stderr here since the LOG may has been reset by its JVM shutdown hook.<NEW_LINE>if (NodeServer.this.runner != null) {<NEW_LINE>LOG.warn("*** shutting down gRPC server since JVM is shutting down");<NEW_LINE>NodeServer.this.cleanup(null);<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>// prepare python environment<NEW_LINE>prepareRuntimeEnv(mlContext);<NEW_LINE>Future runnerFuture = null;<NEW_LINE>try {<NEW_LINE>// 1. start GRPC server<NEW_LINE>this.server = ServerBuilder.forPort(0).addService(new NodeServiceImpl()).build();<NEW_LINE>this.server.start();<NEW_LINE>LOG.info("node (" + getDisplayName() + <MASK><NEW_LINE>// 2. start Node<NEW_LINE>runnerFuture = startMLRunner();<NEW_LINE>boolean exit = false;<NEW_LINE>// exit the loop for following conditions:<NEW_LINE>// successfully executed the python script<NEW_LINE>// AM asks to stop<NEW_LINE>// idle for certain amount of time<NEW_LINE>while (!exit && runner.getResultStatus() != ExecutionStatus.SUCCEED) {<NEW_LINE>if (runnerFuture.isDone()) {<NEW_LINE>if (idleStart == Long.MAX_VALUE) {<NEW_LINE>idleStart = System.currentTimeMillis();<NEW_LINE>}<NEW_LINE>long duration = System.currentTimeMillis() - idleStart;<NEW_LINE>if (duration > idleTimeout) {<NEW_LINE>throw new MLException(String.format("%s has been idle for %d seconds", mlContext.getIdentity(), duration / 1000));<NEW_LINE>}<NEW_LINE>Thread.sleep(1000);<NEW_LINE>} else {<NEW_LINE>idleStart = Long.MAX_VALUE;<NEW_LINE>runnerService.awaitTermination(10, TimeUnit.SECONDS);<NEW_LINE>}<NEW_LINE>switch(getAmCommand()) {<NEW_LINE>case STOP:<NEW_LINE>stopMLRunner(runnerFuture);<NEW_LINE>setAmCommand(AMCommand.NOPE);<NEW_LINE>exit = true;<NEW_LINE>break;<NEW_LINE>case RESTART:<NEW_LINE>stopMLRunner(runnerFuture);<NEW_LINE>runnerFuture = startMLRunner();<NEW_LINE>setAmCommand(AMCommand.NOPE);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>LOG.error(mlContext.getIdentity() + " node server interrupted");<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("Error to run node service {}.", e.getMessage());<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>} finally {<NEW_LINE>cleanup(runnerFuture);<NEW_LINE>}<NEW_LINE>} | ") server started, listening on " + server.getPort()); |
805,634 | protected Object objectClone(Object object) {<NEW_LINE>// Fastpath for our commonly used classes<NEW_LINE>if (object instanceof FreezableClass)<NEW_LINE>return ((<MASK><NEW_LINE>else if (object instanceof PublicCloneable)<NEW_LINE>return ((PublicCloneable<?>) object).clone();<NEW_LINE>else if (object instanceof LinkedList)<NEW_LINE>return ((LinkedList<?>) object).clone();<NEW_LINE>else if (object instanceof ArrayList)<NEW_LINE>return ((ArrayList<?>) object).clone();<NEW_LINE>try {<NEW_LINE>Method cloneMethod = cloneMethodCache.get(object);<NEW_LINE>if (cloneMethod == null) {<NEW_LINE>log.warning("'" + object + "' of class " + object.getClass() + " is Cloneable, but has no clone method - will use the same instance in all requests");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return cloneMethod.invoke(object);<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>log.warning("'" + object + "' of class " + object.getClass() + " is Cloneable, but clone method cannot be accessed - will use the same instance in all requests");<NEW_LINE>return null;<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>throw new RuntimeException("Exception cloning '" + object + "'", e);<NEW_LINE>}<NEW_LINE>} | FreezableClass) object).clone(); |
973,733 | static void printUsage() {<NEW_LINE>ContextConfigurator defaults = ContextConfigurator.systemDefaults();<NEW_LINE>System.err.println("Usage: java -jar fitnesse.jar [-vpdrlfeoaicblh]");<NEW_LINE>System.err.<MASK><NEW_LINE>System.err.println("\t-d <working directory> {" + defaults.get(ROOT_PATH) + "}");<NEW_LINE>System.err.println("\t-r <page root directory> {" + defaults.get(ROOT_DIRECTORY) + "}");<NEW_LINE>System.err.println("\t-l <log directory> {no logging}");<NEW_LINE>System.err.println("\t-f <config properties file> {" + defaults.get(CONFIG_FILE) + "}");<NEW_LINE>System.err.println("\t-e <days> {" + defaults.get(VERSIONS_CONTROLLER_DAYS) + "} Number of days before page versions expire");<NEW_LINE>System.err.println("\t-o omit updates");<NEW_LINE>System.err.println("\t-a {user:pwd | user-file-name} enable authentication.");<NEW_LINE>System.err.println("\t-i Install only, then quit.");<NEW_LINE>System.err.println("\t-c <command> execute single command.");<NEW_LINE>System.err.println("\t-b <filename> redirect command output.");<NEW_LINE>System.err.println("\t-v {off} Verbose logging");<NEW_LINE>System.err.println("\t-lh {off} Only bind to loopback interface (localhost only access)");<NEW_LINE>} | println("\t-p <port number> {" + DEFAULT_PORT + "}"); |
643,511 | public static Object adaptType(Object value) {<NEW_LINE>// we must convert types (to comply to JDBC)<NEW_LINE>if (value instanceof LocalTime) {<NEW_LINE>// -> java.sql.Time<NEW_LINE>LocalTime time = (LocalTime) value;<NEW_LINE>return Time.valueOf(time);<NEW_LINE>} else if (value instanceof LocalDate) {<NEW_LINE>// -> java.sql.Date<NEW_LINE>LocalDate date = (LocalDate) value;<NEW_LINE>return java.sql.Date.valueOf(date);<NEW_LINE>} else if (value instanceof Instant) {<NEW_LINE>// -> java.sql.Timestamp<NEW_LINE>Instant timestamp = (Instant) value;<NEW_LINE>return Timestamp.from(timestamp);<NEW_LINE>} else if (value instanceof Buffer) {<NEW_LINE>// -> java.sql.Blob<NEW_LINE>Buffer blob = (Buffer) value;<NEW_LINE>return blob.getBytes();<NEW_LINE>} else if (value instanceof ByteString) {<NEW_LINE>// -> java.sql.Blob<NEW_LINE>return ((<MASK><NEW_LINE>} else if (value instanceof Duration) {<NEW_LINE>// -> java.sql.Blob<NEW_LINE>Duration duration = (Duration) value;<NEW_LINE>return Time.valueOf(LocalTime.parse(TextConvertorImpl.toString(duration)));<NEW_LINE>}<NEW_LINE>return value;<NEW_LINE>} | ByteString) value).getBytes(); |
672,891 | public void addFriendsToFriendGroup(MethodCall methodCall, final MethodChannel.Result result) {<NEW_LINE>String groupName = CommonUtil.getParam(methodCall, result, "groupName");<NEW_LINE>List<String> userIDList = CommonUtil.getParam(methodCall, result, "userIDList");<NEW_LINE>V2TIMManager.getFriendshipManager().addFriendsToFriendGroup(groupName, userIDList, new V2TIMValueCallback<List<V2TIMFriendOperationResult>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(int i, String s) {<NEW_LINE>CommonUtil.returnError(result, i, s);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(List<V2TIMFriendOperationResult> v2TIMFriendOperationResults) {<NEW_LINE>LinkedList<HashMap<String, Object>> list = new LinkedList<HashMap<String, Object>>();<NEW_LINE>for (int i = 0; i < v2TIMFriendOperationResults.size(); i++) {<NEW_LINE>list.add(CommonUtil.convertV2TIMFriendOperationResultToMap(<MASK><NEW_LINE>}<NEW_LINE>CommonUtil.returnSuccess(result, list);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | v2TIMFriendOperationResults.get(i))); |
1,422,652 | public final MapEntryContext namedArg() throws RecognitionException {<NEW_LINE>MapEntryContext _localctx = new MapEntryContext(_ctx, getState());<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>setState(1618);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>switch(_input.LA(1)) {<NEW_LINE>case StringLiteral:<NEW_LINE>case GStringBegin:<NEW_LINE>case AS:<NEW_LINE>case DEF:<NEW_LINE>case IN:<NEW_LINE>case TRAIT:<NEW_LINE>case THREADSAFE:<NEW_LINE>case VAR:<NEW_LINE>case BuiltInPrimitiveType:<NEW_LINE>case ABSTRACT:<NEW_LINE>case ASSERT:<NEW_LINE>case BREAK:<NEW_LINE>case CASE:<NEW_LINE>case CATCH:<NEW_LINE>case CLASS:<NEW_LINE>case CONST:<NEW_LINE>case CONTINUE:<NEW_LINE>case DEFAULT:<NEW_LINE>case DO:<NEW_LINE>case ELSE:<NEW_LINE>case ENUM:<NEW_LINE>case EXTENDS:<NEW_LINE>case FINAL:<NEW_LINE>case FINALLY:<NEW_LINE>case FOR:<NEW_LINE>case IF:<NEW_LINE>case GOTO:<NEW_LINE>case IMPLEMENTS:<NEW_LINE>case IMPORT:<NEW_LINE>case INSTANCEOF:<NEW_LINE>case INTERFACE:<NEW_LINE>case NATIVE:<NEW_LINE>case NEW:<NEW_LINE>case PACKAGE:<NEW_LINE>case PRIVATE:<NEW_LINE>case PROTECTED:<NEW_LINE>case PUBLIC:<NEW_LINE>case RETURN:<NEW_LINE>case STATIC:<NEW_LINE>case STRICTFP:<NEW_LINE>case SUPER:<NEW_LINE>case SWITCH:<NEW_LINE>case SYNCHRONIZED:<NEW_LINE>case THIS:<NEW_LINE>case THROW:<NEW_LINE>case THROWS:<NEW_LINE>case TRANSIENT:<NEW_LINE>case TRY:<NEW_LINE>case VOID:<NEW_LINE>case VOLATILE:<NEW_LINE>case WHILE:<NEW_LINE>case IntegerLiteral:<NEW_LINE>case FloatingPointLiteral:<NEW_LINE>case BooleanLiteral:<NEW_LINE>case NullLiteral:<NEW_LINE>case CapitalizedIdentifier:<NEW_LINE>case Identifier:<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(1608);<NEW_LINE>namedArgLabel();<NEW_LINE>setState(1609);<NEW_LINE>match(COLON);<NEW_LINE>setState(1610);<NEW_LINE>nls();<NEW_LINE>setState(1611);<NEW_LINE>expression(0);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case MUL:<NEW_LINE>enterOuterAlt(_localctx, 2);<NEW_LINE>{<NEW_LINE>setState(1613);<NEW_LINE>match(MUL);<NEW_LINE>setState(1614);<NEW_LINE>match(COLON);<NEW_LINE>setState(1615);<NEW_LINE>nls();<NEW_LINE>setState(1616);<NEW_LINE>expression(0);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new NoViableAltException(this);<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | enterRule(_localctx, 270, RULE_namedArg); |
1,655,936 | public boolean relocateLeadership(TopicPartition tp, int sourceBrokerId, int destinationBrokerId) {<NEW_LINE>// Sanity check to see if the source replica is the leader.<NEW_LINE>Replica sourceReplica = _partitionsByTopicPartition.get(tp).replica(sourceBrokerId);<NEW_LINE>if (!sourceReplica.isLeader()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Sanity check to see if the destination replica is a follower.<NEW_LINE>Replica destinationReplica = _partitionsByTopicPartition.get(tp).replica(destinationBrokerId);<NEW_LINE>if (destinationReplica.isLeader()) {<NEW_LINE>throw new IllegalArgumentException("Cannot relocate leadership of partition " + tp + "from broker " + sourceBrokerId + " to broker " + destinationBrokerId + " because the destination replica is a leader.");<NEW_LINE>}<NEW_LINE>// Transfer the leadership load (whole outbound network and a fraction of CPU load) of source replica to the<NEW_LINE>// destination replica.<NEW_LINE>// (1) Remove and get the outbound network load and a fraction of CPU load associated with leadership from the<NEW_LINE>// given replica.<NEW_LINE>// (2) Add the outbound network load and CPU load associated with leadership to the given replica.<NEW_LINE>//<NEW_LINE>// Remove the load from the source rack.<NEW_LINE>Rack rack = <MASK><NEW_LINE>AggregatedMetricValues leadershipLoadDelta = rack.makeFollower(sourceBrokerId, tp);<NEW_LINE>// Add the load to the destination rack.<NEW_LINE>rack = broker(destinationBrokerId).rack();<NEW_LINE>rack.makeLeader(destinationBrokerId, tp, leadershipLoadDelta);<NEW_LINE>// Update the leader and list of followers of the partition.<NEW_LINE>Partition partition = _partitionsByTopicPartition.get(tp);<NEW_LINE>partition.relocateLeadership(destinationReplica);<NEW_LINE>return true;<NEW_LINE>} | broker(sourceBrokerId).rack(); |
1,404,555 | S3ClientSettings refine(RepositoryMetaData metadata) {<NEW_LINE>final Settings repoSettings = metadata.settings();<NEW_LINE>// Normalize settings to placeholder client settings prefix so that we can use the affix settings directly<NEW_LINE>final Settings normalizedSettings = Settings.builder().put(repoSettings).normalizePrefix(PREFIX + PLACEHOLDER_CLIENT + '.').build();<NEW_LINE>final String newEndpoint = getRepoSettingOrDefault(ENDPOINT_SETTING, normalizedSettings, endpoint);<NEW_LINE>final Protocol newProtocol = <MASK><NEW_LINE>final String newProxyHost = getRepoSettingOrDefault(PROXY_HOST_SETTING, normalizedSettings, proxyHost);<NEW_LINE>final int newProxyPort = getRepoSettingOrDefault(PROXY_PORT_SETTING, normalizedSettings, proxyPort);<NEW_LINE>final int newReadTimeoutMillis = Math.toIntExact(getRepoSettingOrDefault(READ_TIMEOUT_SETTING, normalizedSettings, TimeValue.timeValueMillis(readTimeoutMillis)).millis());<NEW_LINE>final int newMaxRetries = getRepoSettingOrDefault(MAX_RETRIES_SETTING, normalizedSettings, maxRetries);<NEW_LINE>final boolean newThrottleRetries = getRepoSettingOrDefault(USE_THROTTLE_RETRIES_SETTING, normalizedSettings, throttleRetries);<NEW_LINE>final S3BasicCredentials newCredentials;<NEW_LINE>if (checkDeprecatedCredentials(repoSettings)) {<NEW_LINE>newCredentials = loadDeprecatedCredentials(repoSettings);<NEW_LINE>} else {<NEW_LINE>newCredentials = credentials;<NEW_LINE>}<NEW_LINE>if (Objects.equals(endpoint, newEndpoint) && protocol == newProtocol && Objects.equals(proxyHost, newProxyHost) && proxyPort == newProxyPort && newReadTimeoutMillis == readTimeoutMillis && maxRetries == newMaxRetries && newThrottleRetries == throttleRetries && Objects.equals(credentials, newCredentials)) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>return new S3ClientSettings(newCredentials, newEndpoint, newProtocol, newProxyHost, newProxyPort, proxyUsername, proxyPassword, newReadTimeoutMillis, newMaxRetries, newThrottleRetries);<NEW_LINE>} | getRepoSettingOrDefault(PROTOCOL_SETTING, normalizedSettings, protocol); |
1,074,179 | public void unremoveSystem(SystemInfo system, PageRef pageRef) {<NEW_LINE>// Re-insert system in sheet<NEW_LINE>// Where to re-insert removed system<NEW_LINE>final int index = system.getId() - 1;<NEW_LINE>systems.add(index, system);<NEW_LINE>// Re-insert page?<NEW_LINE>final Page page = system.getPage();<NEW_LINE>if (pageRef != null) {<NEW_LINE>sheet.addPage(page.getId() - 1, page);<NEW_LINE>final <MASK><NEW_LINE>stub.addPageRef(pageRef.getId() - 1, pageRef);<NEW_LINE>}<NEW_LINE>// Re-insert system into containing page<NEW_LINE>page.unremoveSystem(system);<NEW_LINE>// Update ID for each following system<NEW_LINE>for (int i = index + 1; i < systems.size(); i++) {<NEW_LINE>SystemInfo s = systems.get(i);<NEW_LINE>s.setId(i + 1);<NEW_LINE>}<NEW_LINE>} | SheetStub stub = sheet.getStub(); |
389,390 | final ResetDistributionCacheResult executeResetDistributionCache(ResetDistributionCacheRequest resetDistributionCacheRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(resetDistributionCacheRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ResetDistributionCacheRequest> request = null;<NEW_LINE>Response<ResetDistributionCacheResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ResetDistributionCacheRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(resetDistributionCacheRequest));<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, "Lightsail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ResetDistributionCache");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ResetDistributionCacheResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ResetDistributionCacheResultJsonUnmarshaller());<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); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.