auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void executeQuery(Ignite ignite, Query<Cache.Entry<Integer, Integer>> q, boolean init) { IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache( new CacheConfiguration<Integer, Integer>() .setName(CACHE_NAME + CACHE_INDEX.incrementAndGet()) .setCacheMode(CacheMode.PARTITIONED) ); if (init) cache.put(primaryKey(grid(SRV), cache.getName()), 100); Integer key = primaryKey(grid(SRV), cache.getName()); try (QueryCursor<Cache.Entry<Integer, Integer>> cur = cache.query(q)) { if (!init) cache.put(key, 100); cur.getAll(); } catch (Exception e) { if (init) throw e; fail(e.getMessage()); } <START> if (!init) { <END> assertEquals(Integer.valueOf(100), cache.get(key)); } }</code><technical_language>I cache.get(key) == 100 true in case</technical_language>

Target:
private void executeQuery(Ignite ignite, Query<Cache.Entry<Integer, Integer>> q, boolean init) throws IgniteCheckedException { IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache( new CacheConfiguration<Integer, Integer>() .setName(CACHE_NAME + CACHE_INDEX.incrementAndGet()) .setCacheMode(CacheMode.PARTITIONED) ); Integer key = primaryKey(grid(SRV).cache(cache.getName())); if (init) cache.put(key, 100); try (QueryCursor<Cache.Entry<Integer, Integer>> cur = cache.query(q)) { if (!init) { try { cache.put(key, 100); } catch (Exception e) { fail(e.getMessage()); } } cur.getAll(); } assertEquals(Integer.valueOf(100), cache.get(key)); }
Source:
<code>private Optional<org.atlasapi.content.Clip> transformClip(Clip inputClip) { try { return Optional.of((org.atlasapi.content.Clip) apply(inputClip)); } catch(NullPointerException e) { <START> log.warn("Unable to process Clip of: " <END> + java.util.Objects.toString(inputClip.getClipOf(), "unspecified")); return Optional.empty(); } }</code><technical_language>Exceptions formatted placeholders, i.e., log.warn("Unable process {}", java.util.Objects.toString(...)). Note call arg.toString() automatically, conversion necessary well</technical_language>

Target:
private Optional<org.atlasapi.content.Clip> transformClip(Clip inputClip) { try { return Optional.of((org.atlasapi.content.Clip) apply(inputClip)); } catch(NullPointerException e) { log.warn("Unable to process Clip of: '{}'", inputClip.getClipOf()); return Optional.empty(); } }
Source:
<code>private static MessageInfo getMessageInfo(StoreKey id, List<MessageInfo> messageInfos, boolean deleteMsg) { MessageInfo toRet = null; for (MessageInfo messageInfo : messageInfos) { if (messageInfo.getStoreKey().equals(id)) { <START> if ((deleteMsg && messageInfo.isDeleted()) || (!deleteMsg && !messageInfo.isDeleted())) { <END> toRet = messageInfo; break; } } } return toRet; }</code><technical_language>if(deleteMsg == messageInfo.isDeleted())</technical_language>

Target:
private static MessageInfo getMessageInfo(StoreKey id, List<MessageInfo> messageInfos, boolean deleteMsg) { MessageInfo toRet = null; for (MessageInfo messageInfo : messageInfos) { if (messageInfo.getStoreKey().equals(id)) { if (deleteMsg == messageInfo.isDeleted()) { toRet = messageInfo; break; } } } return toRet; }
Source:
<code>private synchronized void acquireWakeLock() { int lockLevel = boundActivity.getWakeLockLevel(); <START> if (lockLevel != CommCareTask.DONT_WAKELOCK) { <END> if (wakelock != null) { if (wakelock.isHeld()) { wakelock.release(); } } PowerManager pm = (PowerManager)boundActivity.getSystemService(Context.POWER_SERVICE); wakelock = pm.newWakeLock(lockLevel, "CommCareLock"); wakelock.acquire(); } }</code><technical_language>100% this intersect wakelock levels request power manager</technical_language>

Target:
private synchronized void acquireWakeLock() { int lockLevel = boundActivity.getWakeLockLevel(); if (lockLevel != CommCareTask.DONT_WAKELOCK) { releaseWakeLock(); PowerManager pm = (PowerManager)boundActivity.getSystemService(Context.POWER_SERVICE); wakelock = pm.newWakeLock(lockLevel, "CommCareLock"); wakelock.acquire(); } }
Source:
<code>public List<TagDto> getAllTags() { List<TagDto> allTags = new ArrayList<TagDto>(); if (commonDataService.getWebClientProperties().isTagsStoreAvailable()) { <START> List<TagEntity> tags = new ArrayList<TagEntity>(entityManager.createQuery("select te from TagEntity as te").getResultList()); <END> if (!tags.isEmpty()) { for (TagEntity tagEntity : tags) { allTags.add(new TagDto(tagEntity.getName(), tagEntity.getDescription())); } } } return allTags; }</code><technical_language>( List < TagEntity > ) entityManager.createQuery(... enough , iterate below</technical_language>

Target:
public List<TagDto> getAllTags() { List<TagDto> allTags = new ArrayList<TagDto>(); if (commonDataService.getWebClientProperties().isTagsStoreAvailable()) { List<TagEntity> tags = entityManager.createQuery("select te from TagEntity as te").getResultList(); if (!tags.isEmpty()) { for (TagEntity tagEntity : tags) { allTags.add(new TagDto(tagEntity.getName(), tagEntity.getDescription())); } } } return allTags; }
Source:
<code>public static Activity createInstance(DeviceAnonymized deviceAnonymized, ZoneId timeZone, LocalDateTime startTime, LocalDateTime endTime, Optional<String> app) { <START> return new Activity(Objects.requireNonNull(deviceAnonymized), timeZone, startTime, endTime, app); <END> }</code><technical_language>is put this requireNonNull in constructor instead</technical_language>

Target:
public static Activity createInstance(DeviceAnonymized deviceAnonymized, ZoneId timeZone, LocalDateTime startTime, LocalDateTime endTime, Optional<String> app) { return new Activity(deviceAnonymized, timeZone, startTime, endTime, app); }
Source:
<code>List<CallableProcedure> compileProcedure( Class<?> procDefinition, Optional<String> warning, boolean fullAccess ) throws KernelException { try { List<Method> procedureMethods = Arrays.stream( procDefinition.getDeclaredMethods() ) .filter( m -> m.isAnnotationPresent( Procedure.class ) ) .collect( Collectors.toList() ); if ( procedureMethods.isEmpty() ) { return emptyList(); } MethodHandle constructor = constructor( procDefinition ); ArrayList<CallableProcedure> out = new ArrayList<>( procedureMethods.size() ); for ( Method method : procedureMethods ) { String valueName = method.getAnnotation( Procedure.class ).value(); String definedName = method.getAnnotation( Procedure.class ).name(); QualifiedName procName = extractName( procDefinition, method, valueName, definedName ); if ( !(fullAccess || config.whiteListed( procName.toString() )) ) { <START> log.warn( String.format( "The procedure '%s' is not white listed.", procName.toString() ) ); <END> } else { out.add( compileProcedure( procDefinition, constructor, method, warning, fullAccess, procName ) ); } } out.sort( Comparator.comparing( a -> a.signature().name().toString() ) ); return out; } catch ( KernelException e ) { throw e; } catch ( Exception e ) { throw new ProcedureException( Status.Procedure.ProcedureRegistrationFailed, e, "Failed to compile procedure defined in `%s`: %s", procDefinition.getSimpleName(), e.getMessage() ); } }</code><technical_language>whitelisted is word. consider lines of procedure '%s' is whitelist loaded</technical_language>

Target:
List<CallableProcedure> compileProcedure( Class<?> procDefinition, Optional<String> warning, boolean fullAccess ) throws KernelException { try { List<Method> procedureMethods = Arrays.stream( procDefinition.getDeclaredMethods() ) .filter( m -> m.isAnnotationPresent( Procedure.class ) ) .collect( Collectors.toList() ); if ( procedureMethods.isEmpty() ) { return emptyList(); } MethodHandle constructor = constructor( procDefinition ); ArrayList<CallableProcedure> out = new ArrayList<>( procedureMethods.size() ); for ( Method method : procedureMethods ) { String valueName = method.getAnnotation( Procedure.class ).value(); String definedName = method.getAnnotation( Procedure.class ).name(); QualifiedName procName = extractName( procDefinition, method, valueName, definedName ); if ( fullAccess || config.isWhitelisted( procName.toString() ) ) { out.add( compileProcedure( procDefinition, constructor, method, warning, fullAccess, procName ) ); } else { log.warn( String.format( "The procedure '%s' is not on the whitelist and won't be loaded.", procName.toString() ) ); } } out.sort( Comparator.comparing( a -> a.signature().name().toString() ) ); return out; } catch ( KernelException e ) { throw e; } catch ( Exception e ) { throw new ProcedureException( Status.Procedure.ProcedureRegistrationFailed, e, "Failed to compile procedure defined in `%s`: %s", procDefinition.getSimpleName(), e.getMessage() ); } }
Source:
<code>public void setupFTPServer() { createNewFile(FTP_DIRECTORY + File.separator + DOWNLOAD_FILE_NAME); createNewFile(DEVICE_DOWNLOAD_DIRECTORY + File.separator + UPLOAD_FILE_NAME); <START> TEST_FTP_SERVER = new FTPServer(USER_NAME, PASSWORD, FTP_DIRECTORY, FTP_PORT); <END> TEST_FTP_SERVER.startFTP(); TEST_SFTP_SERVER = new SFTPServer(USER_NAME, PASSWORD, SFTP_DIRECTORY, SFTP_PORT); TEST_SFTP_SERVER.startSFTP(); }</code><technical_language>is server instance named in Uppercase</technical_language>

Target:
public void setupFTPServer() { testFtpServer = new FTPTestServer(Constants.USER_NAME, Constants.PASSWORD, ftpDirectory, Constants.FTP_PORT); testFtpServer.startFTP(); testSftpServer = new SFTPTestServer(Constants.USER_NAME, Constants.PASSWORD, sftpDirectory, Constants.SFTP_PORT); testSftpServer.startSFTP(); }
Source:
<code>public void init() { logger.entering(); <START> (new File(outputFolder)).mkdirs(); END> (new File(outputFolder, "sources")).mkdir(); (new File(outputFolder, "html")).mkdir(); (new File(outputFolder, "screenshots")).mkdir(); logger.exiting(); }</code><technical_language>do need handle negative scenario? i.e.. outputFolder directory is created</technical_language>

Target:
public void init() { logger.entering(); (new File(outputFolder, "sources")).mkdir(); (new File(outputFolder, "html")).mkdir(); (new File(outputFolder, "screenshots")).mkdir(); logger.exiting(); }
Source:
<code>public CalibratedPredictiveModel(Classifier wrappedPredictiveModel, PoolAdjacentViolatorsModel PAVFunction) { <START> Preconditions.checkArgument(!(wrappedPredictiveModel instanceof CalibratedPredictiveModel)); <END> this.wrappedPredictiveModel = wrappedPredictiveModel; this.pavFunction = PAVFunction; }</code><technical_language>a over-cautious, a reason do a double-wrapped PM</technical_language>

Target:
public CalibratedPredictiveModel(Classifier wrappedPredictiveModel, PoolAdjacentViolatorsModel PAVFunction) { this.wrappedPredictiveModel = wrappedPredictiveModel; this.pavFunction = PAVFunction; }
Source:
<code>public void shouldReportErrorWhenFailExecWithVerbose() { runBuild(exec("not-not-not-exist", true, "-a", "-bb"), Failed); <START> System.out.println("console = " + console); <END> }</code><technical_language>Is assert missing here</technical_language>

Target:
public void shouldReportErrorWhenFailExecWithVerbose() { runBuild(exec("not-not-not-exist", map("verbose", "true"), "-a", "-bb"), Failed); assertThat(console.output(), containsString("[go] Failed to run not-not-not-exist -a -bb")); }
Source:
<code>public Set<String> getFreeVariables() { Set<String> freeVars = objectExpr.getFreeVariables(); <START> freeVars.add(this.methodName); <END> for (Expression arg : args) { freeVars.addAll(arg.getFreeVariables()); } return freeVars; }</code><technical_language>methodName is a free variable--it is conceptually more a field</technical_language>

Target:
public Set<String> getFreeVariables() { Set<String> freeVars = objectExpr.getFreeVariables(); for (Expression arg : args) { freeVars.addAll(arg.getFreeVariables()); } return freeVars; }
Source:
<code>private void publishSegments( StreamAppenderatorDriver driver, TransactionalSegmentPublisher publisher, Supplier<Committer> committerSupplier, String sequenceName ) { final ListenableFuture<SegmentsAndMetadata> publishFuture = driver.publish( publisher, committerSupplier.get(), Collections.singletonList(sequenceName) ); <START> final SettableFuture<SegmentsAndMetadata> handoffDoneFuture = SettableFuture.create(); <END> Futures.addCallback(publishFuture, new FutureCallback<SegmentsAndMetadata>() { @Override public void onSuccess(@Nullable SegmentsAndMetadata result) { final ListenableFuture<SegmentsAndMetadata> handoffFuture = driver.registerHandoff(result); Futures.addCallback(handoffFuture, new FutureCallback<SegmentsAndMetadata>() { @Override public void onSuccess(@Nullable SegmentsAndMetadata result) { handoffDoneFuture.set(result); } @Override public void onFailure(Throwable t) { handoffDoneFuture.setException(t); } }); } @Override public void onFailure(Throwable t) { handoffDoneFuture.setException(t); } }); pendingHandoffs.add(handoffDoneFuture); }</code><technical_language>this boilerplate extracted in some method</technical_language>

Target:
private void publishSegments( StreamAppenderatorDriver driver, TransactionalSegmentPublisher publisher, Supplier<Committer> committerSupplier, String sequenceName ) { final ListenableFuture<SegmentsAndMetadata> publishFuture = driver.publish( publisher, committerSupplier.get(), Collections.singletonList(sequenceName) ); pendingHandoffs.add(ListenableFutures.transformAsync(publishFuture, driver::registerHandoff)); }
Source:
<code>private void sendError(HttpResponseStatus status, String errorMsg) { StringBuilder msg = new StringBuilder("Failure: ").append(status); if (errorMsg != null) { msg.append(errorMsg); } FullHttpResponse response = <START> new DefaultFullHttpResponse(HTTP_1_1, status, Unpooled.copiedBuffer(msg, CharsetUtil.UTF_8)); <END> response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain; charset=UTF-8"); if (ctx.channel().isActive()) { logger.trace("Sending error response to the client", msg); ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } else { logger.error("Could not send error to client on channel because channel is inactive", ctx.channel()); nettyMetrics.fallbackErrorSendingError.inc(); } }</code><technical_language>move construction of msg response if clause in else case. curious though, check write atomic, if writeAndFlush() is called channel active</technical_language>

Target:
private void sendError(HttpResponseStatus status, String errorMsg) { if (ctx.channel().isActive()) { StringBuilder msg = new StringBuilder("Failure: ").append(status); if (errorMsg != null) { msg.append(errorMsg); } FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, status, Unpooled.copiedBuffer(msg, CharsetUtil.UTF_8)); response.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain; charset=UTF-8"); logger.trace("Sending error response to the client", msg); ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } else { logger.error("Could not send error to client on channel because channel is inactive", ctx.channel()); nettyMetrics.fallbackErrorSendingError.inc(); } }
Source:
<code>public void showModal() { super.showModal(); getGlassElement().getStyle().setZIndex(2000); getElement().getStyle().setZIndex(2001); <START> <END> Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { center(); } }); }</code><technical_language>This implies if FileSystemDialog launches a modal, obscure it. verify prompts launched FileSystemDialog (e.g. for new folder names overwriting files) visible/usable this change</technical_language>

Target:
public void showModal() { super.showModal(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { center(); } }); }
Source:
<code>public void iterableTest() { for (String string : ImmutableSet.<String>emptyUsingEquality()) { <START> throw new RuntimeException("empty HashTable has iterated"); <END> } int N = 10000; HashTable<String, Integer> t = range(0, N).foldLeft((ht, i) -> ht.put(Integer.toString(i), i), HashTable.emptyUsingEquality()); int sum = 0; for (Pair<String, Integer> i : t) { assertEquals(Integer.toString(i.right), i.left); sum += i.right; } assertEquals(N * (N - 1) / 2, sum); }</code><technical_language>I a fail assertion for kinds of things</technical_language>

Target:
public void iterableTest() { for (Pair<String, String> string : HashTable.<String, String>emptyUsingEquality()) { fail("Empty Hashtable Iterated"); } int N = 10000; HashTable<String, Integer> t = range(0, N).foldLeft((ht, i) -> ht.put(Integer.toString(i), i), HashTable.emptyUsingEquality()); int sum = 0; for (Pair<String, Integer> i : t) { assertEquals(Integer.toString(i.right), i.left); sum += i.right; } assertEquals(N * (N - 1) / 2, sum); }
Source:
<code>public CasAuthentication(final CasAuthenticator authenticator, final String ticket, final Assertion assertion) { super(authenticator.getAuthMethod(), new CasUserIdentity(assertion, authenticator.getRoleAttribute())); <START> assert ticket != null : "Ticket cannot be null"; <END> assert authenticator != null : "CasAuthenticator cannot be null"; this.authenticator = authenticator; this.ticket = ticket; }</code><technical_language>switch CommonUtils asserts</technical_language>

Target:
public CasAuthentication(final CasAuthenticator authenticator, final String ticket, final Assertion assertion) { super(authenticator.getAuthMethod(), new CasUserIdentity(assertion, authenticator.getRoleAttribute())); CommonUtils.assertNotNull(ticket, "Ticket cannot be null"); CommonUtils.assertNotNull(authenticator, "CasAuthenticator cannot be null"); this.authenticator = authenticator; this.ticket = ticket; }
Source:
<code>private String getDocker0Ip(Launcher launcher, String image) throws IOException, InterruptedException { ArgumentListBuilder args = dockerCommand() .add("run", "--rm") .add("--entrypoint") .add("/bin/true") .add("alpine:3.2"); int status = launcher.launch() .envs(getEnvVars()) .cmds(args) .stdout(TaskListener.NULL).quiet(!verbose).stderr(listener.getLogger()).join(); if (status != 0) { throw new RuntimeException("Failed to run docker image "+image); } NetworkInterface docker0 = NetworkInterface.getByName("docker0"); if (docker0 != null) { for (InterfaceAddress address : docker0.getInterfaceAddresses()) { InetAddress inetAddress = address.getAddress(); if (inetAddress != null && inetAddress instanceof Inet4Address) { return inetAddress.getHostAddress(); } } } args = dockerCommand() .add("run", "--tty", "--rm") .add("--entrypoint") .add("/sbin/ip") .add("alpine:3.2") .add("route"); ByteArrayOutputStream out = new ByteArrayOutputStream(); status = launcher.launch() .envs(getEnvVars()) .cmds(args) .stdout(out).quiet(!verbose).stderr(listener.getLogger()).join(); if (status != 0) { throw new RuntimeException("Failed to retrieve Docker daemon bridge IP"); } String route = out.toString("UTF-8").trim(); <START> if (route.indexOf("default") == -1){ <END> throw new RuntimeException("Default IP does not exist"); } String dockerhost = route.substring(route.indexOf("default")) .split(" ")[2]; return dockerhost; }</code><technical_language>do: if (!route.contains("default")) { ....</technical_language>

Target:
private String getDocker0Ip(Launcher launcher, String image) throws IOException, InterruptedException { ArgumentListBuilder args = dockerCommand() .add("run", "--rm") .add("--entrypoint") .add("/bin/true") .add("alpine:3.2"); int status = launcher.launch() .envs(getEnvVars()) .cmds(args) .stdout(TaskListener.NULL).quiet(!verbose).stderr(listener.getLogger()).join(); if (status != 0) { throw new RuntimeException("Failed to run docker image "+image); } NetworkInterface docker0 = NetworkInterface.getByName("docker0"); if (docker0 != null) { for (InterfaceAddress address : docker0.getInterfaceAddresses()) { InetAddress inetAddress = address.getAddress(); if (inetAddress != null && inetAddress instanceof Inet4Address) { return inetAddress.getHostAddress(); } } } args = dockerCommand() .add("run", "--tty", "--rm") .add("--entrypoint") .add("/sbin/ip") .add("alpine:3.2") .add("route"); ByteArrayOutputStream out = new ByteArrayOutputStream(); status = launcher.launch() .envs(getEnvVars()) .cmds(args) .stdout(out).quiet(!verbose).stderr(listener.getLogger()).join(); if (status != 0) { throw new RuntimeException("Failed to retrieve Docker daemon bridge IP"); } String route = out.toString("UTF-8").trim(); if (!route.contains("default")) { throw new RuntimeException("Default IP does not exist"); } String dockerhost = route.substring(route.indexOf("default")) .split(" ")[2]; return dockerhost; }
Source:
<code>private Optional<CloudflareZone> getCloudflareZone(String edgeCacheDNS) throws CloudflareClientException { <START> List<CloudflareZone> zones = cf.getAllZones(); <END> String[] domainTokens = edgeCacheDNS.split("\\."); String baseDomain = String.format("%s.%s", domainTokens[domainTokens.length - 2], domainTokens[domainTokens.length - 1]); return zones.stream() .filter(z -> z.getName().equals(baseDomain)) .findAny(); }</code><technical_language>expensive is this call? this cached all</technical_language>

Target:
private Optional<CloudflareZone> getCloudflareZone(String edgeCacheDNS) throws CloudflareClientException { String baseDomain = getBaseDomain(edgeCacheDNS); return Optional.ofNullable(cf.getZone(baseDomain)); }
Source:
<code>protected IntegrationFlowDefinition<?> buildFlow() { <START> return from((MessageSource<?>) () -> new GenericMessage<>("flowAdapterMessage"), <END> e -> e.poller(p -> p .trigger(ctx -> this.nextExecutionTime.getAndSet(null)))) .channel(MessageChannels.queue("flowAdapterOutput")); }</code><technical_language>I if rename fromSupplier(). yeah... remove from(Supplier) altogether. Breaking change, agreed, choice. I find this explicit casting style more annoying removed method. WDYT</technical_language>

Target:
protected IntegrationFlowDefinition<?> buildFlow() { return from(() -> new GenericMessage<>("flowAdapterMessage"), e -> e.poller(p -> p .trigger(ctx -> this.nextExecutionTime.getAndSet(null)))) .channel(MessageChannels.queue("flowAdapterOutput")); }
Source:
<code><START> public void testCreateInvoiceAndRetrieveInvoicePdf() throws Exception { <END> final Account accountData = TestUtils.createRandomAccount(); PDDocument pdDocument = null; try { final Account account = recurlyClient.createAccount(accountData); final Adjustment a = new Adjustment(); a.setUnitAmountInCents(150); a.setCurrency(CURRENCY); final Adjustment createdA = recurlyClient.createAccountAdjustment(accountData.getAccountCode(), a); final Invoice invoiceData = new Invoice(); invoiceData.setCollectionMethod("manual"); invoiceData.setLineItems(null); final Invoice invoice = recurlyClient.postAccountInvoice(accountData.getAccountCode(), invoiceData); Assert.assertNotNull(invoice); byte[] pdfBytes = recurlyClient.getInvoicePdf(invoice.getInvoiceNumber()); Assert.assertNotNull(pdfBytes); pdDocument = PDDocument.load(pdfBytes); String pdfString = new PDFTextStripper().getText(pdDocument); Assert.assertNotNull(pdfString); Assert.assertTrue(pdfString.contains("Invoice # " + invoice.getInvoiceNumber())); Assert.assertTrue(pdfString.contains("Subtotal $" + 1.5)); final Invoice closedInvoice = recurlyClient.markInvoiceSuccessful(invoice.getInvoiceNumber()); Assert.assertEquals(closedInvoice.getState(), "collected", "Invoice not closed successfully"); } finally { if (pdDocument != null) { pdDocument.close(); } recurlyClient.closeAccount(accountData.getAccountCode()); } }</code><technical_language>Is for enterprise users</technical_language>

Target:
public void testCreateInvoiceAndRetrieveInvoicePdf() throws Exception { final Account accountData = TestUtils.createRandomAccount(); PDDocument pdDocument = null; try { final Account account = recurlyClient.createAccount(accountData); final Adjustment a = new Adjustment(); a.setUnitAmountInCents(150); a.setCurrency(CURRENCY); final Adjustment createdA = recurlyClient.createAccountAdjustment(accountData.getAccountCode(), a); final Invoice invoiceData = new Invoice(); invoiceData.setCollectionMethod("manual"); invoiceData.setLineItems(null); final Invoice invoice = recurlyClient.postAccountInvoice(accountData.getAccountCode(), invoiceData); Assert.assertNotNull(invoice); InputStream pdfInputStream = recurlyClient.getInvoicePdf(invoice.getInvoiceNumber()); Assert.assertNotNull(pdfInputStream); pdDocument = PDDocument.load(pdfInputStream); String pdfString = new PDFTextStripper().getText(pdDocument); Assert.assertNotNull(pdfString); Assert.assertTrue(pdfString.contains("Invoice # " + invoice.getInvoiceNumber())); Assert.assertTrue(pdfString.contains("Subtotal $" + 1.5)); final Invoice closedInvoice = recurlyClient.markInvoiceSuccessful(invoice.getInvoiceNumber()); Assert.assertEquals(closedInvoice.getState(), "collected", "Invoice not closed successfully"); } finally { if (pdDocument != null) { pdDocument.close(); } recurlyClient.closeAccount(accountData.getAccountCode()); } }
Source:
<code>public static File getFilePluginLocation(DockstoreWebserviceConfiguration configuration) { String userHome = System.getProperty("user.home"); String filename = userHome + File.separator + ".dockstore" + File.separator + "language-plugins"; filename = StringUtils.isEmpty(configuration.getLanguagePluginLocation()) ? filename : configuration.getLanguagePluginLocation(); <START> System.out.println("File plugin path set to:" + filename); <END> return new File(filename); }</code><technical_language>LOG</technical_language>

Target:
public static File getFilePluginLocation(DockstoreWebserviceConfiguration configuration) { String userHome = System.getProperty("user.home"); String filename = userHome + File.separator + ".dockstore" + File.separator + "language-plugins"; filename = StringUtils.isEmpty(configuration.getLanguagePluginLocation()) ? filename : configuration.getLanguagePluginLocation(); LOG.info("File plugin path set to:" + filename); return new File(filename); }
Source:
<code>public ByteBuf decrypt(ByteBuf toDecrypt, SecretKeySpec key) throws GeneralSecurityException { try { <START> Cipher decrypter = Cipher.getInstance(GCM_CRYPTO_INSTANCE, "BC"); <END> byte[] iv = deserializeIV(new ByteBufInputStream(toDecrypt)); decrypter.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv)); ByteBuf decryptedContent = ByteBufAllocator.DEFAULT.heapBuffer(decrypter.getOutputSize(toDecrypt.readableBytes())); if (toDecrypt.hasArray()) { int n = decrypter.doFinal(toDecrypt.array(), toDecrypt.arrayOffset() + toDecrypt.readerIndex(), toDecrypt.readableBytes(), decryptedContent.array(), decryptedContent.arrayOffset() + decryptedContent.writerIndex()); toDecrypt.readerIndex(toDecrypt.readerIndex() + toDecrypt.readableBytes()); decryptedContent.writerIndex(decryptedContent.writerIndex() + n); } else { byte[] toDecryptArray = new byte[toDecrypt.readableBytes()]; toDecrypt.readBytes(toDecryptArray); int n = decrypter.doFinal(toDecryptArray, 0, toDecryptArray.length, decryptedContent.array(), decryptedContent.arrayOffset() + decryptedContent.writerIndex()); decryptedContent.writerIndex(decryptedContent.writerIndex() + n); } return decryptedContent; } catch (Exception e) { throw new GeneralSecurityException("Exception thrown while decrypting data", e); } }</code><technical_language>question here, heap buffers</technical_language>

Target:
public ByteBuf decrypt(ByteBuf toDecrypt, SecretKeySpec key) throws GeneralSecurityException { try { Cipher decrypter = Cipher.getInstance(GCM_CRYPTO_INSTANCE, "BC"); byte[] iv = deserializeIV(new ByteBufInputStream(toDecrypt)); decrypter.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv)); int outputSize = decrypter.getOutputSize(toDecrypt.readableBytes()); ByteBuf decryptedContent = ByteBufAllocator.DEFAULT.heapBuffer(outputSize); ByteBuffer toDecryptBuffer = toDecrypt.nioBuffer(); ByteBuffer decryptedContentBuffer = decryptedContent.nioBuffer(0, outputSize); int n = decrypter.doFinal(toDecryptBuffer, decryptedContentBuffer); toDecrypt.readerIndex(toDecrypt.readerIndex() + toDecrypt.readableBytes()); decryptedContent.writerIndex(decryptedContent.writerIndex() + n); return decryptedContent; } catch (Exception e) { throw new GeneralSecurityException("Exception thrown while decrypting data", e); } }
Source:
<code>int getMessageInfoAndMetadataListSize() { if (messageInfoList == null) { return Integer.BYTES; } int size = Integer.BYTES; ListIterator<MessageInfo> infoListIterator = messageInfoList.listIterator(); ListIterator<MessageMetadata> metadataListIterator = messageMetadataList.listIterator(); while (infoListIterator.hasNext()) { MessageInfo messageInfo = infoListIterator.next(); MessageMetadata messageMetadata = metadataListIterator.next(); size += messageInfo.getStoreKey().sizeInBytes(); size += Long.BYTES; size += Long.BYTES; size += 1; switch (version) { case VERSION_1: break; case VERSION_2: size += 1; if (messageInfo.getCrc() != null) { size += Long.BYTES; } break; case VERSION_3: size += 1; if (messageInfo.getCrc() != null) { size += Long.BYTES; } size += Short.BYTES; size += Short.BYTES; size += Long.BYTES; break; case VERSION_4: size += 1; if (messageInfo.getCrc() != null) { size += Long.BYTES; } size += Short.BYTES; size += Short.BYTES; size += Long.BYTES; if (messageMetadata != null) { <START> size += Integer.BYTES; <END> size += messageMetadata.sizeInBytes(); } else { size += Integer.BYTES; } break; default: throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } } return size; }</code><technical_language>move this line if loop ignore else block</technical_language>

Target:
int getMessageInfoAndMetadataListSize() { if (messageInfoList == null) { return Integer.BYTES; } int size = Integer.BYTES; ListIterator<MessageInfo> infoListIterator = messageInfoList.listIterator(); ListIterator<MessageMetadata> metadataListIterator = messageMetadataList.listIterator(); while (infoListIterator.hasNext()) { MessageInfo messageInfo = infoListIterator.next(); MessageMetadata messageMetadata = metadataListIterator.next(); size += messageInfo.getStoreKey().sizeInBytes(); size += Long.BYTES; size += Long.BYTES; size += 1; if (version < VERSION_1 || version > VERSION_4) { throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } if (version > VERSION_1) { size += 1; if (messageInfo.getCrc() != null) { size += Long.BYTES; } } if (version > VERSION_2) { size += Short.BYTES; size += Short.BYTES; size += Long.BYTES; } if (version > VERSION_3) { size += Byte.BYTES; if (messageMetadata != null) { size += messageMetadata.sizeInBytes(); } } } return size; }
Source:
<code>public boolean apply(ObjectPlayer<Controllable> input, Game game) { Controllable object = input.getObject(); UUID playerId = input.getPlayerId(); switch (controller) { case YOU: if (object.getControllerId().equals(playerId)) { return true; } break; case OPPONENT: if (!object.getControllerId().equals(playerId) && game.getPlayer(playerId).hasOpponent(object.getControllerId(), game)) { return true; } break; case NOT_YOU: if (!object.getControllerId().equals(playerId)) { return true; } break; case ACTIVE: if (object.getControllerId().equals(game.getActivePlayerId())) { <START> return true; <END> } case ANY: return true; } return false; }</code><technical_language>break; statement is missing</technical_language>

Target:
public boolean apply(ObjectPlayer<Controllable> input, Game game) { Controllable object = input.getObject(); UUID playerId = input.getPlayerId(); switch (controller) { case YOU: if (object.getControllerId().equals(playerId)) { return true; } break; case OPPONENT: if (!object.getControllerId().equals(playerId) && game.getPlayer(playerId).hasOpponent(object.getControllerId(), game)) { return true; } break; case NOT_YOU: if (!object.getControllerId().equals(playerId)) { return true; } break; case ACTIVE: if (object.getControllerId().equals(game.getActivePlayerId())) { return true; } break; case ANY: return true; } return false; }
Source:
<code>private SymbolStatsEstimate buildSymbolStatistics(List<Object> values, Session session, Type type) { if (values.isEmpty()) { return new SymbolStatsEstimate(NaN, NaN, NaN, NaN, 0.0); } List<Object> nonNullValues = values.stream() .filter(Objects::nonNull) .collect(toImmutableList()); if (nonNullValues.isEmpty()) { <START> return new SymbolStatsEstimate(NaN, NaN, 1.0, 0.0, 0.0); <END> } double[] valuesAsDoubles = nonNullValues.stream() .map(value -> toStatsRepresentation(metadata, session, type, value)) .filter(OptionalDouble::isPresent) .mapToDouble(OptionalDouble::getAsDouble) .toArray(); double lowValue = DoubleStream.of(valuesAsDoubles).min().orElse(Double.NEGATIVE_INFINITY); double highValue = DoubleStream.of(valuesAsDoubles).max().orElse(Double.POSITIVE_INFINITY); double valuesCount = values.size(); double nonNullValuesCount = nonNullValues.size(); long distinctValuesCount = nonNullValues.stream().distinct().count(); return SymbolStatsEstimate.builder() .setNullsFraction((valuesCount - nonNullValuesCount) / valuesCount) .setLowValue(lowValue) .setHighValue(highValue) .setDistinctValuesCount(distinctValuesCount) .build(); }</code><technical_language>average row size is NaN</technical_language>

Target:
private SymbolStatsEstimate buildSymbolStatistics(List<Object> values, Session session, Type type) { List<Object> nonNullValues = values.stream() .filter(Objects::nonNull) .collect(toImmutableList()); if (nonNullValues.isEmpty()) { return SymbolStatsEstimate.zero(); } double[] valuesAsDoubles = nonNullValues.stream() .map(value -> toStatsRepresentation(metadata, session, type, value)) .filter(OptionalDouble::isPresent) .mapToDouble(OptionalDouble::getAsDouble) .toArray(); double lowValue = DoubleStream.of(valuesAsDoubles).min().orElse(Double.NEGATIVE_INFINITY); double highValue = DoubleStream.of(valuesAsDoubles).max().orElse(Double.POSITIVE_INFINITY); double valuesCount = values.size(); double nonNullValuesCount = nonNullValues.size(); long distinctValuesCount = nonNullValues.stream().distinct().count(); return SymbolStatsEstimate.builder() .setNullsFraction((valuesCount - nonNullValuesCount) / valuesCount) .setLowValue(lowValue) .setHighValue(highValue) .setDistinctValuesCount(distinctValuesCount) .build(); }
Source:
<code>DiskManager(DiskId disk, List<ReplicaId> replicas, StoreConfig storeConfig, DiskManagerConfig diskManagerConfig, ScheduledExecutorService scheduler, StorageManagerMetrics metrics, StoreMetrics storeMainMetrics, StoreMetrics storeUnderCompactionMetrics, StoreKeyFactory keyFactory, MessageStoreRecovery recovery, MessageStoreHardDelete hardDelete, ReplicaStatusDelegate replicaStatusDelegate, List<String> stoppedReplicas, Time time) { this.disk = disk; this.metrics = metrics; this.time = time; diskIOScheduler = new DiskIOScheduler(getThrottlers(storeConfig, time)); longLivedTaskScheduler = Utils.newScheduler(1, true); diskSpaceAllocator = new DiskSpaceAllocator(diskManagerConfig.diskManagerEnableSegmentPooling, new File(disk.getMountPath(), diskManagerConfig.diskManagerReserveFileDirName), diskManagerConfig.diskManagerRequiredSwapSegmentsPerSize, metrics); <START> this.stoppedReplicas = stoppedReplicas == null ? new ArrayList<>() : stoppedReplicas; <END> for (ReplicaId replica : replicas) { if (disk.equals(replica.getDiskId())) { BlobStore store = new BlobStore(replica, storeConfig, scheduler, longLivedTaskScheduler, diskIOScheduler, diskSpaceAllocator, storeMainMetrics, storeUnderCompactionMetrics, keyFactory, recovery, hardDelete, replicaStatusDelegate, time); stores.put(replica.getPartitionId(), store); } } compactionManager = new CompactionManager(disk.getMountPath(), storeConfig, stores.values(), metrics, time); }</code><technical_language>Collections.emptyList() well</technical_language>

Target:
DiskManager(DiskId disk, List<ReplicaId> replicas, StoreConfig storeConfig, DiskManagerConfig diskManagerConfig, ScheduledExecutorService scheduler, StorageManagerMetrics metrics, StoreMetrics storeMainMetrics, StoreMetrics storeUnderCompactionMetrics, StoreKeyFactory keyFactory, MessageStoreRecovery recovery, MessageStoreHardDelete hardDelete, ReplicaStatusDelegate replicaStatusDelegate, List<String> stoppedReplicas, Time time) { this.disk = disk; this.metrics = metrics; this.time = time; diskIOScheduler = new DiskIOScheduler(getThrottlers(storeConfig, time)); longLivedTaskScheduler = Utils.newScheduler(1, true); diskSpaceAllocator = new DiskSpaceAllocator(diskManagerConfig.diskManagerEnableSegmentPooling, new File(disk.getMountPath(), diskManagerConfig.diskManagerReserveFileDirName), diskManagerConfig.diskManagerRequiredSwapSegmentsPerSize, metrics); this.replicaStatusDelegate = replicaStatusDelegate; this.stoppedReplicas = stoppedReplicas; for (ReplicaId replica : replicas) { if (disk.equals(replica.getDiskId())) { BlobStore store = new BlobStore(replica, storeConfig, scheduler, longLivedTaskScheduler, diskIOScheduler, diskSpaceAllocator, storeMainMetrics, storeUnderCompactionMetrics, keyFactory, recovery, hardDelete, replicaStatusDelegate, time); stores.put(replica.getPartitionId(), store); partitionToReplicaMap.put(replica.getPartitionId(), replica); } } compactionManager = new CompactionManager(disk.getMountPath(), storeConfig, stores.values(), metrics, time); }
Source:
<code>public static void fastCompleteSpan(Map<String, String> metadata) { popCurrentSpan() .filter(openSpan -> currentTrace.get().isObservable()) .map(openSpan -> toSpan(openSpan, metadata)) .ifPresent(span -> { <START> for (SpanObserver observer : observersList) { <END> observer.consume(span); } }); }</code><technical_language>turn this for loop a function</technical_language>

Target:
public static void fastCompleteSpan(Map<String, String> metadata) { popCurrentSpan() .filter(openSpan -> currentTrace.get().isObservable()) .map(openSpan -> toSpan(openSpan, metadata)) .ifPresent(Tracer::notifyObservers); }
Source:
<code>private String txtElapsedTime(long seconds) { long hours = 0; long minutes = 0; if (seconds >= 3600) { hours = seconds / 3600; seconds -= hours * 3600; } if (seconds >= 60) { minutes = seconds / 60; seconds -= minutes * 60; } StringBuilder s = new StringBuilder(); if (hours > 0) { s.append(hours).append(" ").append(resources.getString(R.string.metrics_hours)); } if (minutes > 0) { if (hours > 0) s.append(" "); if (hours > 0 || seconds > 0) <START> s.append(minutes).append(" ").append(resources.getString(R.string.metrics_meters)); <END> else s.append(minutes).append(" ").append(resources.getString(R.string.metrics_min)); } if (seconds > 0) { if (hours > 0 || minutes > 0) s.append(" "); s.append(seconds).append(" ").append(resources.getString(R.string.metrics_sec)); } return s.toString(); }</code><technical_language>code is written write out 1h 3m 4s 3 min "m" is short for min (which is short for minutes :)</technical_language>

Target:
private String txtElapsedTime(long seconds) { long hours = 0; long minutes = 0; if (seconds >= 3600) { hours = seconds / 3600; seconds -= hours * 3600; } if (seconds >= 60) { minutes = seconds / 60; seconds -= minutes * 60; } StringBuilder s = new StringBuilder(); if (hours > 0) { s.append(hours).append(" ").append(resources.getString(R.string.metrics_elapsed_h)); } if (minutes > 0) { if (hours > 0) s.append(" "); if (hours > 0 || seconds > 0) s.append(minutes).append(" ").append(resources.getString(R.string.metrics_elapsed_m)); else s.append(minutes).append(" ").append(resources.getString(R.string.metrics_elapsed_min)); } if (seconds > 0) { if (hours > 0 || minutes > 0) s.append(" "); s.append(seconds).append(" ").append(resources.getString(R.string.metrics_elapsed_s)); } return s.toString(); }
Source:
<code>public void testNormallyEnabledMercurialRepository() throws IllegalAccessException, InvocationTargetException, ForbiddenSymlinkException, InstantiationException, NoSuchMethodException, IOException { File root = new File(repository.getSourceRoot(), "mercurial"); env.setSourceRoot(root.getAbsolutePath()); <START> assertNotNull("should get MercurialRepository", <END> RepositoryFactory.getRepository(root)); }</code><technical_language>nit: message describes assertion</technical_language>

Target:
public void testNormallyEnabledMercurialRepository() throws IllegalAccessException, InvocationTargetException, ForbiddenSymlinkException, InstantiationException, NoSuchMethodException, IOException { File root = new File(repository.getSourceRoot(), "mercurial"); env.setSourceRoot(root.getAbsolutePath()); assertNotNull("should get repository for mercurial/", RepositoryFactory.getRepository(root)); List<Class<? extends Repository>> clazzes = RepositoryFactory.getRepositoryClasses(); assertTrue("should contain MercurialRepository", clazzes.contains(MercurialRepository.class)); }
Source:
<code>private void logCompactionChoice(String tableToCompact, long maxSweptAfterCompact) { if (maxSweptAfterCompact > 0) { log.info("Choosing to compact {}, because it was swept milliseconds after the last compaction", tableToCompact, maxSweptAfterCompact); } else { log.info("All swept tables have been compacted after the last sweep. Choosing to compact anyway - " + "this may be a no-op. It was last compacted milliseconds after it was last swept.", tableToCompact, <START> -maxSweptAfterCompact); <END> } }</code><technical_language>Math.abs()</technical_language>

Target:
private void logCompactionChoice(String tableToCompact, long maxSweptAfterCompact) { if (maxSweptAfterCompact > 0) { log.info("Choosing to compact {}, because it was swept milliseconds after the last compaction", tableToCompact, maxSweptAfterCompact); } else { log.info("All swept tables have been compacted after the last sweep. Choosing to compact anyway - " + "this may be a no-op. It was last compacted milliseconds after it was last swept.", tableToCompact, Math.abs(maxSweptAfterCompact)); } }
Source:
<code>public void notifyChange(ModelChangeNotification notification) { if (notification.getRawNotification().isTouch()) { return; } if (EAttribute.class.isInstance(notification.getStructuralFeature())) { return; } boolean relevantChange = false; EObject iterateEObject = rootEObject; for (final EReference eReference : getDomainModelEReferencePath()) { relevantChange |= eReference.equals(notification.getStructuralFeature()) && iterateEObject == notification.getNotifier(); <START> iterateEObject = (EObject) iterateEObject.eGet(eReference); <END> } relevantChange |= getDomainModelEFeature().equals(notification.getStructuralFeature()) && lastResolvedEObject == notification.getNotifier(); if (relevantChange) { cleanDiagnostic(getDomainModelEFeature().equals(notification.getStructuralFeature()), notification); resolve(rootEObject, false); final List<DomainModelReferenceChangeListener> copyOfChangeListeners = new ArrayList<DomainModelReferenceChangeListener>( getChangeListener()); for (final DomainModelReferenceChangeListener listener : copyOfChangeListeners) { listener.notifyChange(); } } }</code><technical_language>resolvement work</technical_language>

Target:
public void notifyChange(ModelChangeNotification notification) { if (notification.getRawNotification().isTouch()) { return; } if (EAttribute.class.isInstance(notification.getStructuralFeature())) { return; } boolean relevantChange = false; EObject iterateEObject = rootEObject; for (final EReference eReference : getDomainModelEReferencePath()) { relevantChange |= eReference.equals(notification.getStructuralFeature()) && iterateEObject == notification.getNotifier(); if (relevantChange) { break; } iterateEObject = (EObject) iterateEObject.eGet(eReference); } relevantChange |= notification.getStructuralFeature().equals(getDomainModelEFeature()) && lastResolvedEObject == notification.getNotifier(); if (relevantChange) { cleanDiagnostic(getDomainModelEFeature().equals(notification.getStructuralFeature()), notification); resolve(rootEObject, false); final List<DomainModelReferenceChangeListener> copyOfChangeListeners = new ArrayList<DomainModelReferenceChangeListener>( getChangeListener()); for (final DomainModelReferenceChangeListener listener : copyOfChangeListeners) { listener.notifyChange(); } } }
Source:
<code>public static void combineState( BooleanDistinctState state, BooleanDistinctState otherState) { int combinedValue; int firstVal = state.getInt(); int secondVal = otherState.getInt(); if (firstVal == 3 || secondVal == 3) { combinedValue = 3; } else if (firstVal == 0) { combinedValue = secondVal; } else if (secondVal == 0) { combinedValue = firstVal; } else if (firstVal == secondVal) { combinedValue = firstVal; } else { combinedValue = 3; } <START> state.setInt(combinedValue); <END> }</code><technical_language>state.setInt( state.getInt() | combinedValue.getInt() )</technical_language>

Target:
public static void combineState(BooleanDistinctState state, BooleanDistinctState otherState) { state.setByte((byte) (state.getByte() | otherState.getByte())); }
Source:
<code>public void clickOnAuthorizeBtn() { waitAuthorizeBtn(); <START> new WebDriverWait(seleniumWebDriver, 10) <END> .until(ExpectedConditions.elementToBeClickable(authorizeBtn)); authorizeBtn.click(); }</code><technical_language>timeout constant</technical_language>

Target:
public void clickOnAuthorizeBtn() { waitAuthorizeBtn(); new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC) .until(ExpectedConditions.elementToBeClickable(authorizeBtn)); authorizeBtn.click(); }
Source:
<code>public ExecutionAttemptID(JobID jobId, ExecutionVertexID executionVertexId, int attemptNumber) { Preconditions.checkState(attemptNumber >= 0); <START> this.jobId = jobId; <END> this.executionVertexId = Preconditions.checkNotNull(executionVertexId); this.attemptNumber = attemptNumber; }</code><technical_language>need check null</technical_language>

Target:
public ExecutionAttemptID(JobID jobId, ExecutionVertexID executionVertexId, int attemptNumber) { Preconditions.checkState(attemptNumber >= 0); this.jobId = Preconditions.checkNotNull(jobId); this.executionVertexId = Preconditions.checkNotNull(executionVertexId); this.attemptNumber = attemptNumber; }
Source:
<code>public DistinctCountHLLAggregationFunction(List<String> arguments) { super(arguments.get(0)); int numExpressions = arguments.size(); <START> Preconditions .checkArgument(numExpressions <= 2 && numExpressions >= 1, "DistinctCountHLL expects 1 or 2 arguments, got: ", numExpressions); <END> if (arguments.size() == 2) { _log2M = Integer.valueOf(arguments.get(1).replace("'", "")); } else { _log2M = DEFAULT_LOG2M; } }</code><technical_language>suggestion Preconditions .checkArgument(numExpressions <= 2 && numExpressions >= 1, "DistinctCountHLL expects 1 2 arguments, got: %s", numExpressions);</technical_language>

Target:
public DistinctCountHLLAggregationFunction(List<String> arguments) { super(arguments.get(0)); int numExpressions = arguments.size(); Preconditions .checkArgument(numExpressions <= 2 && numExpressions >= 1, "DistinctCountHLL expects 1 or 2 arguments, got: %s", numExpressions); if (arguments.size() == 2) { _log2m = Integer.valueOf(arguments.get(1).replace("'", "")); } else { _log2m = CommonConstants.Helix.DEFAULT_HYPERLOGLOG_LOG2M; } }
Source:
<code>public int compare(Session session, PlanNodeCostEstimate left, PlanNodeCostEstimate right) <START> { <END> requireNonNull(session, "session can not be null"); requireNonNull(left, "left can not be null"); requireNonNull(right, "right can not be null"); checkArgument(!left.hasUnknownComponents() && !right.hasUnknownComponents(), "cannot compare unknown costs"); double leftCost = left.getCpuCost() * cpuWeight + left.getMemoryCost() * memoryWeight + left.getNetworkCost() * networkWeight; double rightCost = right.getCpuCost() * cpuWeight + right.getMemoryCost() * memoryWeight + right.getNetworkCost() * networkWeight; return Double.compare(leftCost, rightCost); }</code><technical_language>do need session</technical_language>

Target:
public int compare(Session session, PlanNodeCostEstimate left, PlanNodeCostEstimate right) { requireNonNull(session, "session is null"); requireNonNull(left, "left is null"); requireNonNull(right, "right is null"); checkArgument(!left.hasUnknownComponents() && !right.hasUnknownComponents(), "cannot compare unknown costs"); double leftCost = left.getCpuCost() * cpuWeight + left.getMemoryCost() * memoryWeight + left.getNetworkCost() * networkWeight; double rightCost = right.getCpuCost() * cpuWeight + right.getMemoryCost() * memoryWeight + right.getNetworkCost() * networkWeight; return Double.compare(leftCost, rightCost); }