auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean isAnyErrorChild(long taskId) { return handle.createQuery( "select parent_id from tasks" + " where id in (" + "select max(t.id) from tasks t join task_details td on t.id=td.id" + " where parent_id = :parentId group by td.full_name" + ") and (" + "state = " + TaskStateCode.ERROR.get() + " or state = " + TaskStateCode.GROUP_ERROR.get() + ") limit 1" ) .bind("parentId", taskId) .mapTo(Long.class) .first() != null; }

Target:
public boolean isAnyErrorChild(long taskId) { return handle.createQuery( "select parent_id from tasks" + " where id in (" + "select max(t.id) from tasks t join task_details td on t.id = td.id" + " where parent_id = :parentId" + " group by td.full_name" + ") and (" + "state = " + TaskStateCode.ERROR.get() + " or state = " + TaskStateCode.GROUP_ERROR.get() + ") limit 1" ) .bind("parentId", taskId) .mapTo(Long.class) .first() != null; }
Source:
public List<Account> getNewAccounts(long updatedSince) throws SQLException { return accountDao.getNewAccounts(updatedSince); }

Target:
public Collection<Account> getNewAccounts(long updatedSince) throws SQLException { return accountDao.getNewAccounts(updatedSince); }
Source:
protected Call enqueue(Request request, okhttp3.Callback requestCallback) { Context context = ButterApplication.getAppContext(); PackageInfo pInfo; String versionName = "0.0.0"; try { pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); versionName = pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } request = request .newBuilder().removeHeader("User-Agent") .addHeader("User-Agent", String.format( "Mozilla/5.0 (Linux; U; Android %s; %s; %s Build/%s) AppleWebkit/534.30 (KHTML, like Gecko) PT/%s", Build.VERSION.RELEASE, LocaleUtils.getCurrentAsString(), Build.MODEL, Build.DISPLAY, versionName)).build(); Call call = super.enqueue(request, requestCallback); synchronized (ongoingCalls) { ongoingCalls.add(call); } return call; }

Target:
protected Call enqueue(Request request, okhttp3.Callback requestCallback) { Context context = ButterApplication.getAppContext(); PackageInfo pInfo; String versionName = "0.0.0"; try { pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); versionName = pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } request = request .newBuilder().removeHeader("User-Agent") .addHeader("User-Agent", String.format( "Mozilla/5.0 (Linux; U; Android %s; %s; %s Build/%s) AppleWebkit/534.30 (KHTML, like Gecko) PT/%s", Build.VERSION.RELEASE, LocaleUtils.getCurrentAsString(), Build.MODEL, Build.DISPLAY, versionName)).build(); return super.enqueue(request, requestCallback); }
Source:
private void onAddAddressesToClipboard(Address[] addresses){ if(mMessage != null){ try{ String addressesToCopy = ""; for(Address addressTemp : addresses){ addressesToCopy += addressTemp.getAddress() + " "; } addressesToCopy = addressesToCopy.substring(0,addressesToCopy.length()-1); ClipboardManager.getInstance(mContext).setText("addresses", addressesToCopy); Toast.makeText(mContext, R.string.copy_address_to_clipboard, Toast.LENGTH_LONG).show(); } catch (Exception e){ Log.e(K9.LOG_TAG, "Couldn't add addresses to clipboard"); } } }

Target:
private void onAddAddressesToClipboard(Address[] addresses){ StringBuilder addressesToCopy = new StringBuilder(); for(Address addressTemp : addresses){ addressesToCopy.append(addressTemp.getAddress() + " "); } addressesToCopy = addressesToCopy.deleteCharAt(addressesToCopy.length()-1); ClipboardManager.getInstance(mContext).setText("addresses", addressesToCopy.toString()); Toast.makeText(mContext, createMessage(addresses.length), Toast.LENGTH_LONG).show(); }
Source:
public void checkContainers() { if ( currentCandidates.size() == 0 ) { currentCandidates.addAll(getCandidates()); } int count = 0; Iterator<String> iterator = currentCandidates.iterator(); while ( iterator.hasNext() ) { if ( count++ >= maxPerInterval ) { LOG.info("Stopping at " + maxPerInterval); break; } String containerPath = iterator.next(); iterator.remove(); ByteBuffer path = ByteBuffer.wrap(containerPath.getBytes()); Request request = new Request(null, 0, 0, ZooDefs.OpCode.deleteContainer, path, null); try { LOG.info("Attempting to delete candidate container: " + containerPath); requestProcessor.processRequest(request); } catch (Exception e) { LOG.error("Could not delete container: " + containerPath, e); } } }

Target:
public void checkContainers() throws InterruptedException { long minIntervalMs = getMinIntervalMs(); for (String containerPath : getCandidates()) { long startMs = Time.currentElapsedTime(); ByteBuffer path = ByteBuffer.wrap(containerPath.getBytes()); Request request = new Request(null, 0, 0, ZooDefs.OpCode.deleteContainer, path, null); try { LOG.info("Attempting to delete candidate container: %s", containerPath); requestProcessor.processRequest(request); } catch (Exception e) { LOG.error(String.format("Could not delete container: %s" , containerPath), e); } long elapsedMs = Time.currentElapsedTime() - startMs; long waitMs = minIntervalMs - elapsedMs; if (waitMs > 0) { Thread.sleep(waitMs); } } }
Source:
public List<ActionValueObjectResponseDto> getActionValueObjectResponseDto() { return this.actionValueObjectResponseDtoList; }

Target:
public List<ActionResponseDto> getActionValueObjectResponseDto() { return new ArrayList<ActionResponseDto>(this.actionValueObjectResponseDtoList); }
Source:
public void testBlogAndArticleAreNotIndexedInDraftStatus() throws Exception { Transaction tx = fullTextSession.beginTransaction(); List<Blog> blogEntries = getBlogEntries(); assertThat( blogEntries ).as( "Blog is explicit intercepted" ).excludes( blog ); assertThat( blogEntries ).as( "Article is inherently intercepted" ).excludes( article ); tx.commit(); }

Target:
public void testBlogAndArticleAreNotIndexedInDraftStatus() throws Exception { Transaction tx = fullTextSession.beginTransaction(); List<Blog> blogEntries = getBlogEntries(); assertThat( blogEntries ).as( "Blog is explicitly intercepted" ).excludes( blog ); assertThat( blogEntries ).as( "Article is inherently intercepted" ).excludes( article ); tx.commit(); }
Source:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + ((fPattern == null) ? 0 : fPattern.hashCode()); result = prime * result + ((fRegex == null) ? 0 : fRegex.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + ((fRegex == null) ? 0 : fRegex.hashCode()); return result; }
Source:
private void deleteSelfFromLambdaEvents(User user) { lambdaEventDAO.findByUser(user).stream() .filter(lambdaEvent -> lambdaEvent.getUser() == user) .forEach(lambdaEvent -> lambdaEvent.setUser(null)); }

Target:
private void deleteSelfFromLambdaEvents(User user) { lambdaEventDAO.findByUser(user).stream().forEach(lambdaEvent -> lambdaEvent.setUser(null)); }
Source:
public void should_fail_if_no_methods_are_expected_and_methods_are_available() { TreeSet<String> expectedMethods = newTreeSet("publicMethod", "protectedMethod", "privateMethod", "finalize", "wait", "equals", "toString", "hashCode", "getClass", "clone", "notify", "notifyAll"); BigDecimal javaVersion = new BigDecimal(System.getProperty("java.specification.version")); if (javaVersion.compareTo(new BigDecimal("14")) < 0) { expectedMethods.add("registerNatives"); } assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> classes.assertHasMethods(someInfo(), actual)) .withMessage(format(shouldNotHaveMethods(actual, false, expectedMethods).create())); }

Target:
public void should_fail_if_no_methods_are_expected_and_methods_are_available() { SortedSet<String> expectedMethods = newTreeSet("publicMethod", "protectedMethod", "privateMethod", "finalize", "wait", "equals", "toString", "hashCode", "getClass", "clone", "notify", "notifyAll"); if (isJavaVersionBefore14()) { expectedMethods.add("registerNatives"); } assertThatAssertionErrorIsThrownBy(() -> classes.assertHasMethods(someInfo(), actual)) .withMessage(format(shouldNotHaveMethods(actual, false, expectedMethods).create())); }
Source:
public String toString() { return "Alert{" + "name=" + name + ", expression=" + expression + ", cronEntry=" + cronEntry + ", enabled=" + enabled + ", missingDataNotificationEnabled=" + missingDataNotificationEnabled + ", notifications=" + notifications + ", triggers=" + triggers + ", owner=" + owner + '}'; }

Target:
public String toString() { return "Alert{" + "name=" + name + ", expression=" + expression + ", cronEntry=" + cronEntry + ", enabled=" + enabled + ", missingDataNotificationEnabled=" + missingDataNotificationEnabled + ", notifications=" + notifications + ", triggers=" + triggers + ", owner=" + owner + ", shared=" + shared + '}'; }
Source:
public TextTrackScore( Format format, Parameters parameters, int trackFormatSupport, @Nullable String selectedAudioLanguage) { isWithinRendererCapabilities = isSupported(trackFormatSupport, false); int maskedSelectionFlags = format.selectionFlags & ~parameters.disabledTextTrackSelectionFlags; isDefault = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0; isForced = (maskedSelectionFlags & C.SELECTION_FLAG_FORCED) != 0; preferredLanguageScore = getFormatLanguageScore(format, parameters.preferredTextLanguage); selectedAudioLanguageScore = getFormatLanguageScore(format, selectedAudioLanguage); trackHasNoLanguage = formatHasNoLanguage(format); selectUndeterminedTextLanguage = parameters.selectUndeterminedTextLanguage; stringDefinesNoLang = stringDefinesNoLanguage(selectedAudioLanguage); }

Target:
public TextTrackScore( Format format, Parameters parameters, int trackFormatSupport, @Nullable String selectedAudioLanguage) { isWithinRendererCapabilities = isSupported(trackFormatSupport, false); int maskedSelectionFlags = format.selectionFlags & ~parameters.disabledTextTrackSelectionFlags; isDefault = (maskedSelectionFlags & C.SELECTION_FLAG_DEFAULT) != 0; isForced = (maskedSelectionFlags & C.SELECTION_FLAG_FORCED) != 0; preferredLanguageScore = getFormatLanguageScore(format, parameters.preferredTextLanguage); selectedAudioLanguageScore = getFormatLanguageScore(format, selectedAudioLanguage); trackHasNoLanguage = formatHasNoLanguage(format); hasLanguageMatch = preferredLanguageScore > 0 || (parameters.selectUndeterminedTextLanguage && trackHasNoLanguage); hasSelectedAudioLanguageMatch = (selectedAudioLanguageScore > 0) || (trackHasNoLanguage && stringDefinesNoLanguage(selectedAudioLanguage)); isWithinConstraints = (hasLanguageMatch || isDefault || (isForced && hasSelectedAudioLanguageMatch)); }
Source:
public Map<String, String> getDefaults() { Map<String, String> allDefaults = new HashMap(); allDefaults.putAll(defaults); allDefaults.putAll(logLoadableOptions.getDefaults()); return allDefaults; }

Target:
public Map<String, String> getDefaults() { Map<String, String> allDefaults = new LinkedHashMap(super.getDefaults()); allDefaults.putAll(logLoadableOptions.getDefaults()); allDefaults.put(INCLUDE_PARAMETER_VALUES, Boolean.FALSE.toString()); return allDefaults; }
Source:
private void initMessageBusListeners() { _messageBus.subscribe(DomainManager.MESSAGE_ADD_DOMAIN_EVENT, new MessageSubscriber() { @Override public void onPublishMessage(String senderAddress, String subject, Object args) { Long domainId = (Long) args; Domain domain = _domainDao.findById(domainId); try { _domainDao.acquireInLockTable(domain.getId()); List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll(); for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { HostVO host = findNuageVspHost(nuageVspDevice.getHostId()); SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), true, false); _agentMgr.easySend(host.getId(), cmd); } } catch (Exception e) { s_logger.error(e.getMessage()); } finally { _domainDao.releaseFromLockTable(domain.getId()); } } }); _messageBus.subscribe(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT, new MessageSubscriber() { @Override public void onPublishMessage(String senderAddress, String subject, Object args) { DomainVO domain = (DomainVO) args; try { List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll(); for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { HostVO host = findNuageVspHost(nuageVspDevice.getHostId()); SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), false, true); _agentMgr.easySend(host.getId(), cmd); } } catch (Exception e) { s_logger.error(e.getMessage()); } } }); }

Target:
private void initMessageBusListeners() { _messageBus.subscribe(DomainManager.MESSAGE_ADD_DOMAIN_EVENT, new MessageSubscriber() { @Override public void onPublishMessage(String senderAddress, String subject, Object args) { Long domainId = (Long) args; Domain domain = _domainDao.findById(domainId); try { _domainDao.acquireInLockTable(domain.getId()); List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll(); for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { HostVO host = findNuageVspHost(nuageVspDevice.getHostId()); SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), true, false); _agentMgr.easySend(host.getId(), cmd); } } finally { _domainDao.releaseFromLockTable(domain.getId()); } } }); _messageBus.subscribe(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT, new MessageSubscriber() { @Override public void onPublishMessage(String senderAddress, String subject, Object args) { DomainVO domain = (DomainVO) args; List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll(); for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { HostVO host = findNuageVspHost(nuageVspDevice.getHostId()); SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), false, true); _agentMgr.easySend(host.getId(), cmd); } } }); }
Source:
public static InputStream getFileInputStream(String filepath, SecretKeySpec symetricKey) { final File file = new File(filepath); InputStream is; try { is = new FileInputStream(file); if (symetricKey != null) { Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, symetricKey); is = new BufferedInputStream(new CipherInputStream(is, cipher)); } return is; } catch (FileNotFoundException e) { Log.e(TAG, "Cannot find " + file.getName()); e.printStackTrace(); return null; } catch (InvalidKeyException | NoSuchPaddingException | NoSuchAlgorithmException e) { e.printStackTrace(); throw new RuntimeException(e); } }

Target:
public static InputStream getFileInputStream(String filepath, SecretKeySpec symetricKey) throws FileNotFoundException{ final File file = new File(filepath); InputStream is; try { is = new FileInputStream(file); if (symetricKey != null) { Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, symetricKey); is = new BufferedInputStream(new CipherInputStream(is, cipher)); } return is; } catch (InvalidKeyException | NoSuchPaddingException | NoSuchAlgorithmException e) { e.printStackTrace(); throw new RuntimeException(e); } }
Source:
public Events list() { if (isFiltered()) { return mapCollection(getBackendCollection(VdcQueryType.GetEventMessages, new GetEventMessagesParameters())); } else { return mapCollection(getBackendCollection()); } }

Target:
public Events list() { if (isFiltered()) { return mapCollection(getBackendCollection(VdcQueryType.GetAllEventMessages, new GetEventMessagesParameters())); } else { return mapCollection(getBackendCollection()); } }
Source:
public void mocking_inner_classes_with_wrong_outer_instance() { try { mock(InnerClass.class, withSettings().useConstructor().outerInstance("foo").defaultAnswer(CALLS_REAL_METHODS)); fail(); } catch (MockitoException e) { assertThat(e).hasMessage("Unable to create mock instance of type 'InnerClass'"); assertThat(e.getCause()).hasMessageContaining("Please ensure that it has a constructor that matches these arguments: [foo]"); } }

Target:
public void mocking_inner_classes_with_wrong_outer_instance() { try { mock(InnerClass.class, withSettings().useConstructor().outerInstance(123).defaultAnswer(CALLS_REAL_METHODS)); fail(); } catch (MockitoException e) { assertThat(e).hasMessage("Unable to create mock instance of type 'InnerClass'"); assertThat(e.getCause()).hasMessageContaining( "Please ensure that the target class has a 0-arg constructor" + " and that it's indeed an inner class of the passed instance of type java.lang.Integer"); } }
Source:
public void attachContainerStdinUnsupported() throws Exception { DockerClient dockerClient = dockerRule.getClient(); Assume.assumeFalse("does not support stdin attach", getFactoryType().supportsStdinAttach()); expectedException.expect(UnsupportedOperationException.class); String snippet = "hello world"; CreateContainerResponse container = dockerClient.createContainerCmd(DEFAULT_IMAGE) .withCmd("echo", snippet) .withTty(false) .withAttachStdin(true) .withAttachStdout(true) .withAttachStderr(true) .exec(); LOG.info("Created container: {}", container.toString()); assertThat(container.getId(), not(is(emptyString()))); AttachContainerTestCallback callback = new AttachContainerTestCallback() { @Override public void onNext(Frame frame) { assertThat(frame.getStreamType(), equalTo(StreamType.STDOUT)); super.onNext(frame); } }; InputStream stdin = new ByteArrayInputStream("".getBytes()); dockerClient.attachContainerCmd(container.getId()) .withStdErr(true) .withStdOut(true) .withFollowStream(true) .withLogs(true) .withStdIn(stdin) .exec(callback); callback.awaitCompletion(30, TimeUnit.SECONDS); callback.close(); }

Target:
public void attachContainerStdinUnsupported() throws Exception { DockerClient dockerClient = dockerRule.getClient(); Assume.assumeFalse("does not support stdin attach", getFactoryType().supportsStdinAttach()); expectedException.expect(UnsupportedOperationException.class); String snippet = "hello world"; CreateContainerResponse container = dockerClient.createContainerCmd(DEFAULT_IMAGE) .withCmd("echo", snippet) .withTty(false) .withAttachStdin(true) .withAttachStdout(true) .withAttachStderr(true) .exec(); LOG.info("Created container: {}", container.toString()); assertThat(container.getId(), not(is(emptyString()))); AttachContainerTestCallback callback = new AttachContainerTestCallback() { @Override public void onNext(Frame frame) { assertThat(frame.getStreamType(), equalTo(StreamType.STDOUT)); super.onNext(frame); } }; InputStream stdin = new ByteArrayInputStream("".getBytes()); dockerClient.attachContainerCmd(container.getId()) .withStdErr(true) .withStdOut(true) .withFollowStream(true) .withLogs(true) .withStdIn(stdin) .exec(callback); assertFalse("Processing of the response is not expected to be started" + " because `attachContainerCmd` with stdin is not supported", callback.awaitStarted(5, SECONDS)); dockerClient.startContainerCmd(container.getId()).exec(); callback.awaitCompletion(30, TimeUnit.SECONDS); callback.close(); }
Source:
public static void init() { if (Display.getCurrent() != null && Display.getCurrent().getThread() == Thread.currentThread()) { fail("SWTBot test needs to run in a non-UI thread. Make sure that \"Run in UI thread\" is unchecked in your launch configuration or" + " that useUIThread is set to false in the pom.xml"); } Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new NullAppender()); fBot = new SWTWorkbenchBot(); SWTBotUtil.closeView("welcome", fBot); SWTBotUtil.switchToTracingPerspective(); SWTBotUtil.waitForJobs(); }

Target:
public static void init() { SWTBotUtil.checkNonUIThread(); Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new NullAppender()); fBot = new SWTWorkbenchBot(); SWTBotUtil.closeView("welcome", fBot); SWTBotUtil.switchToTracingPerspective(); SWTBotUtil.waitForJobs(); }
Source:
private static void kill() throws Exception { String twillId = verifyTwillId(); TwillController controller = twillRunner.lookup(FLUO_APP_NAME, RunIds.fromString(twillId)); if ((controller != null) && controller.isRunning()) { System.out.print("Killing Fluo instance " + getAppInfo()+ "..."); controller.kill(); System.out.println("DONE"); deleteZkData(); } else { System.out.println("WARNING - " + existsButNotRunningMsg()); } }

Target:
private static void kill() throws Exception { String twillId = verifyTwillId(); TwillController controller = twillRunner.lookup(FLUO_APP_NAME, RunIds.fromString(twillId)); if (controller != null) { System.out.print("Killing Fluo instance " + getAppInfo()+ "..."); controller.kill(); System.out.println("DONE"); } else { logExistsButNotRunning(); } deleteZkData(); }
Source:
protected Subject login(String username, String password, String realmName) throws LoginException { CallbackHandler handler = this.getCallbackHandler(username, password); LoginContext ctx = new LoginContext(realmName, handler); ctx.login(); return ctx.getSubject(); }

Target:
protected Subject login(String username, String password, String realmName) throws LoginException { CallbackHandler handler = getCallbackHandler(username, password); LoginContext ctx = new LoginContext(realmName, handler); ctx.login(); return ctx.getSubject(); }
Source:
public void remove() { active = false; world.getEntityManager().unregister(this); server.getEntityIdManager().deallocate(this); DestroyEntitiesMessage message = new DestroyEntitiesMessage(Arrays.asList(id)); for (GlowPlayer player : getWorld().getRawPlayers()) { player.getSession().send(message); } }

Target:
public void remove() { active = false; world.getEntityManager().unregister(this); server.getEntityIdManager().deallocate(this); }
Source:
public Set<Product> getProvidedProducts() { return this.providedProducts; }

Target:
public Collection<Product> getProvidedProducts() { return new SetView<>(this.providedProducts); }
Source:
private List<?> mapToFormatLineType(final List<String> genVals, final VCFHeaderLineType genValType) { if (genValType == VCFHeaderLineType.String) { return genVals; } final List<Object> genRealTypeVals = new ArrayList<>(genVals.size()); final Function<String, Object> mapperFunc = getMapperFunction(genValType); genVals.forEach(genVal -> { if (!genVal.equals(VCFConstants.MISSING_VALUE_v4)) { genRealTypeVals.add(mapperFunc.apply(genVal)); } }); return genRealTypeVals; }

Target:
private List<?> mapToFormatLineType(final List<String> genVals, final VCFHeaderLineType genValType) { final List<Object> genRealTypeVals = new ArrayList<>(genVals.size()); final Function<String, Object> mapperFunc = getMapperFunction(genValType); genVals.forEach(genVal -> genRealTypeVals.add( !genVal.equals(VCFConstants.MISSING_VALUE_v4) ? mapperFunc.apply(genVal) : null)); return genRealTypeVals; }
Source:
public static TimedOperation initThread() { if (!trackTime) { return NOOP_TIMED_OPERATION; } return startOperation(TimedOperationCategory.UNACCOUNTED); }

Target:
public static void initThread() { if (!trackTime) { return; } startOperation(TimedOperationCategory.UNACCOUNTED); }
Source:
private static DetailAST getLastLambdaToken(DetailAST lambda) { DetailAST node = lambda.getLastChild(); while (node.getLastChild() != null) { node = node.getLastChild(); } return node; }

Target:
private static DetailAST getLastLambdaToken(DetailAST lambda) { DetailAST node = lambda; do { node = node.getLastChild(); } while (node.getLastChild() != null); return node; }
Source:
public void store() throws WrongPermissionException, NotFileException, IOException, CannotCreateFileException { setProperty(ConfigFile.CONFIG_VERSION_PROPERTY, Integer.toString(CURRENT_CONFIG_VERSION)); try { new OutputStreamFile(storageFile.getPath(), null, Existence.MAY_EXIST, ChangePermission.NOCHANGE, false); } catch (FileAlreadyExistsException | NoSuchFileException | CannotChangePermissionException e) { throw new AssertionError(e); } File tmpOut = File.createTempFile("jackserver-" + storageFile.getName(), ".tmp", storageFile.getParentFile()); try { if (!(tmpOut.setExecutable(false, false) && tmpOut.setWritable(false, false) && tmpOut.setReadable(false, false) && tmpOut.setWritable(true, true) && tmpOut.setReadable(true, true))) { throw new IOException("Failed to set permissions of '" + tmpOut.getPath() + "'"); } try (Writer writer = new OutputStreamWriter(new FileOutputStream(tmpOut), CONFIG_CHARSET)) { store(writer, ""); } if (!tmpOut.renameTo(storageFile)) { throw new IOException("failed to rename temp config file '" + tmpOut); } tmpOut = null; } finally { if (tmpOut != null) { if (!tmpOut.delete()) { logger.log(Level.SEVERE, "Failed to delete temp file '" + tmpOut.getPath() + "'"); } } } }

Target:
public void store() throws WrongPermissionException, NotFileException, IOException, CannotCreateFileException { setProperty(ConfigFile.CONFIG_VERSION_PROPERTY, Integer.toString(CURRENT_CONFIG_VERSION)); new OutputStreamFile(storageFile.getPath(), null); File tmpOut = File.createTempFile("jackserver-" + storageFile.getName(), ".tmp", storageFile.getParentFile()); try { if (!(tmpOut.setExecutable(false, false) && tmpOut.setWritable(false, false) && tmpOut.setReadable(false, false) && tmpOut.setWritable(true, true) && tmpOut.setReadable(true, true))) { throw new IOException("Failed to set permissions of '" + tmpOut.getPath() + "'"); } try (Writer writer = new OutputStreamWriter(new FileOutputStream(tmpOut), CONFIG_CHARSET)) { store(writer, ""); } if (!tmpOut.renameTo(storageFile)) { throw new IOException("failed to rename temp config file '" + tmpOut); } tmpOut = null; } finally { if (tmpOut != null) { if (!tmpOut.delete()) { logger.log(Level.SEVERE, "Failed to delete temp file '" + tmpOut.getPath() + "'"); } } } }
Source:
protected static Comment fillCommentEntity(JsonNode jn, Comment comment) { optionalSet(jn, COMMENT_PARENT_ID_FIELD, comment::setParentId); optionalSet(jn, COMMENT_TEXT_FIELD, comment::setText); optionalSet(jn, COMMENT_CREATION_DATE_FIELD, s -> comment.setCreationDate(s == null ? null : Instant.parse(s))); optionalSet(jn, COMMENT_MODIFICATION_DATE_FIELD, s -> comment.setModificationDate(s == null ? null : Instant.parse(s))); if (jn.has(EXTERNAL_ENTITY_ID_FIELD) || jn.has(EXTERNAL_ENTITY_ORIGIN_FIELD) || jn.has(EXTERNAL_ENTITY)) { ExternalEntity externalEntity = (ExternalEntity) comment; optionalSet(jn, EXTERNAL_ENTITY_ID_FIELD, externalEntity::setEntityId); optionalSet(jn, EXTERNAL_ENTITY_ORIGIN_FIELD, externalEntity::setOrigin); optionalSet(jn, EXTERNAL_ENTITY, externalEntity::setEntity); } return comment; }

Target:
protected static Comment fillCommentEntity(JsonNode jn, Comment comment) { setIfExist(jn, COMMENT_PARENT_ID_FIELD, comment::setParentId); setIfExist(jn, COMMENT_TEXT_FIELD, comment::setText); setIfExist(jn, COMMENT_CREATION_DATE_FIELD, s -> comment.setCreationDate(s == null ? null : Instant.parse(s))); setIfExist(jn, COMMENT_MODIFICATION_DATE_FIELD, s -> comment.setModificationDate(s == null ? null : Instant.parse(s))); if (jn.has(EXTERNAL_ENTITY_ID_FIELD) || jn.has(EXTERNAL_ENTITY_ORIGIN_FIELD) || jn.has(EXTERNAL_ENTITY)) { ExternalEntity externalEntity = (ExternalEntity) comment; setIfExist(jn, EXTERNAL_ENTITY_ID_FIELD, externalEntity::setEntityId); setIfExist(jn, EXTERNAL_ENTITY_ORIGIN_FIELD, externalEntity::setOrigin); setIfExist(jn, EXTERNAL_ENTITY, externalEntity::setEntity); } return comment; }
Source:
public TagMeasurementFilter(String meterNameRegex, String tagNameRegex, String tagValueRegex) { if (meterNameRegex != null && !meterNameRegex.isEmpty() && !meterNameRegex.equals(".*")) { meterNamePattern = Pattern.compile(meterNameRegex); } else { meterNamePattern = null; } if (tagNameRegex != null && !tagNameRegex.isEmpty() && !tagNameRegex.equals(".*")) { tagNamePattern = Pattern.compile(tagNameRegex); } else { tagNamePattern = null; } if (tagValueRegex != null && !tagValueRegex.isEmpty() && !tagValueRegex.equals(".*")) { tagValuePattern = Pattern.compile(tagValueRegex); } else { tagValuePattern = null; } }

Target:
public TagMeasurementFilter(String meterNameRegex, String tagNameRegex, String tagValueRegex) { meterNamePattern = regexToPatternOrNull(meterNameRegex); tagNamePattern = regexToPatternOrNull(tagNameRegex); tagValuePattern = regexToPatternOrNull(tagValueRegex); }
Source:
private Class<?> load(String className, ClassLoader... cl) throws ClassNotFoundException { final Class<?> clazz = loadSimpleType(className); if (clazz != null) { LOG.trace("Loaded class: as simple type -> {}", className, clazz); return clazz; } for (ClassLoader loader : cl) { LOG.trace("Attempting to load class: using classloader: {}", className, cl); try { Class<?> answer = Class.forName(className, false, loader); if (LOG.isTraceEnabled()) { LOG.trace("Loaded class: using classloader: -> {}", new Object[]{className, cl, answer}); } return answer; } catch (ClassNotFoundException e) { LOG.trace("Class not found: using classloader: {}", className, cl); } } return Class.forName(className, false, FALLBACK_CLASS_LOADER); }

Target:
private Class<?> load(String className, ClassLoader... cl) throws ClassNotFoundException { final Class<?> clazz = loadSimpleType(className); if (clazz != null) { LOG.trace("Loaded class: as simple type -> {}", className, clazz); return clazz; } for (ClassLoader loader : cl) { LOG.trace("Attempting to load class: using classloader: {}", className, cl); try { Class<?> answer = Class.forName(className, false, loader); if (LOG.isTraceEnabled()) { LOG.trace("Loaded class: using classloader: -> {}", className, cl, answer); } return answer; } catch (ClassNotFoundException e) { LOG.trace("Class not found: using classloader: {}", className, cl); } } return Class.forName(className, false, FALLBACK_CLASS_LOADER); }
Source:
public Object getValue(Session session) { if (opType != OpTypes.LIKE) { return super.getValue(session); } Object leftValue = nodes[LEFT].getValue(session); Object rightValue = nodes[RIGHT].getValue(session); Object escapeValue = (!hasEscape() || nodes[ESCAPE] == null) ? null : nodes[ESCAPE].getValue( session); if (likeObject.isVariable) { synchronized (likeObject) { likeObject.setPattern(session, rightValue, escapeValue, hasEscape() && (nodes[ESCAPE] != null)); return likeObject.compare(session, leftValue); } } return likeObject.compare(session, leftValue); }

Target:
public Object getValue(Session session) { if (opType != OpTypes.LIKE) { return super.getValue(session); } Object leftValue = nodes[LEFT].getValue(session); Object rightValue = nodes[RIGHT].getValue(session); Object escapeValue = (nodes.length < TERNARY || nodes[ESCAPE] == null) ? null : nodes[ESCAPE].getValue( session); if (likeObject.isVariable) { synchronized (likeObject) { likeObject.setPattern(session, rightValue, escapeValue, (nodes.length == TERNARY) && (nodes[ESCAPE] != null)); return likeObject.compare(session, leftValue); } } return likeObject.compare(session, leftValue); }
Source:
public void testGenerateAdditions() throws Exception { Entity testEntity = ImmutableEntity.builder() .entityType("test") .specializationOf(URI.create("http://example/entity")) .putAdditions("pred1", new String[]{"value1", "value2"}).build(); Entity testEntity2 = ImmutableEntity.builder() .entityType("test") .specializationOf(URI.create("http://example/entity")) .putAdditions("pred2", new String[]{"value3", "value4"}).build(); Entity[] testEntities = new Entity[2]; testEntities[0] = testEntity; testEntities[1] = testEntity2; GenerateRdfPatchFromJsonLdEntity generateRdfPatchFromJsonLdEntity = new GenerateRdfPatchFromJsonLdEntity(testEntities); MyTestRdfPatchSerializer myTestRdfPatchSerializer = new MyTestRdfPatchSerializer(); generateRdfPatchFromJsonLdEntity.generateAdditions(myTestRdfPatchSerializer); assertThat(myTestRdfPatchSerializer.results, is("+ http://example/entity pred1 value1\n" + "+ http://example/entity pred1 value2\n" + "+ http://example/entity pred2 value3\n" + "+ http://example/entity pred2 value4\n")); }

Target:
public void testGenerateAdditions() throws Exception { Entity testEntity = createAdditionEntity("test", "http://example/entity", "pred1", new String[]{"value1", "value2"}); Entity testEntity2 = createAdditionEntity("test", "http://example/entity", "pred2", new String[]{"value3", "value4"}); Entity[] testEntities = new Entity[2]; testEntities[0] = testEntity; testEntities[1] = testEntity2; GenerateRdfPatchFromJsonLdEntity generateRdfPatchFromJsonLdEntity = new GenerateRdfPatchFromJsonLdEntity(testEntities); MyTestRdfPatchSerializer basicRdfPatchSerializer = new MyTestRdfPatchSerializer(); generateRdfPatchFromJsonLdEntity.generateAdditions(basicRdfPatchSerializer); assertThat(basicRdfPatchSerializer.getResults(), is("+<http://example/entity> " + "<<LINK_0>> " + "\"\"value1\"\"^^<<LINK_1>> .\\n" + "+<http://example/entity> <<LINK_0>> " + "\"\"value2\"\"^^<<LINK_1>> .\\n" + "+<http://example/entity> <<LINK_2>> " + "\"\"value3\"\"^^<<LINK_1>> .\\n" + "+<http://example/entity> <<LINK_2>> " + "\"\"value4\"\"^^<<LINK_1>> .\\n")); }
Source:
public AwsTargetGroup(AwsLoadBalancerScheme scheme, int port) { this.port = port; this.name = getTargetGroupName(port, scheme); this.instanceIds = new HashSet<>(); }

Target:
public AwsTargetGroup(AwsLoadBalancerScheme scheme, int port) { this.port = port; this.name = getTargetGroupName(port, scheme); }
Source:
public static void main(String[] args) { ShufflingBasedStatisticalSignificance sig = new ShufflingBasedStatisticalSignificance(10000, new Random()); EvaluationRecord e1 = new EvaluationRecord(); EvaluationRecord e2 = new EvaluationRecord(); e1.incrementGold(); sig.addInstance(e1, e2); sig.runSignificanceTest(); logger.info(String.valueOf(sig.precisionSignificance())); logger.info(String.valueOf(sig.recallSignificance())); logger.info(String.valueOf(sig.f1Significance())); }

Target:
public static void main(String[] args) { ShufflingBasedStatisticalSignificance sig = new ShufflingBasedStatisticalSignificance(10000, new Random()); EvaluationRecord e1 = new EvaluationRecord(); EvaluationRecord e2 = new EvaluationRecord(); e1.incrementGold(); sig.addInstance(e1, e2); sig.runSignificanceTest(); System.out.println(sig.precisionSignificance()); System.out.println(sig.recallSignificance()); System.out.println(sig.f1Significance()); }
Source:
private void tryToUpdateParseForAppUpgrade(Context context){ PrefManager.AppInfoPrefManager pmanager = new PrefManager.AppInfoPrefManager(context); Long preVersion = pmanager.getAppVersionCode(); boolean hadNotification = pmanager.isNotificationEnabled(); int curVersion = PropertyUtil.getManifestVersionCode(context); if ( preVersion < curVersion ){ ParseInstallation installation = ParseInstallation.getCurrentInstallation(); String android_id = Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID); installation.put("UniqueId",android_id); if ( hadNotification ) { pmanager.setAppUpgradeNeedSyncWithParse(true); } installation.saveInBackground(); } pmanager.setAppVersionCode(curVersion); pmanager.setNotificationEnabled(true); }

Target:
private void tryToUpdateParseForAppUpgrade(Context context){ PrefManager.AppInfoPrefManager pmanager = new PrefManager.AppInfoPrefManager(context); Long previousVersion = pmanager.getAppVersionCode(); boolean hadNotification = pmanager.isNotificationEnabled(); int curVersion = PropertyUtil.getManifestVersionCode(context); if ( previousVersion < curVersion ){ ParseInstallation installation = ParseInstallation.getCurrentInstallation(); String android_id = Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID); installation.put("UniqueId",android_id); if ( hadNotification ) { pmanager.setAppUpgradeNeedSyncWithParse(true); } installation.saveInBackground(); } pmanager.setAppVersionCode(curVersion); pmanager.setNotificationEnabled(true); }
Source:
private LineDecoderIterator getLineDecoderIterator(T task) { final OffsetDateTime fromDate = OffsetDateTime.ofInstant(task.getFromDate().toInstant(), ZoneId.systemDefault()); final OffsetDateTime toDate = task.getToDate().isPresent() ? OffsetDateTime.ofInstant(task.getToDate().get().toInstant(), ZoneId.systemDefault()) : OffsetDateTime.now(); List<MarketoUtils.DateRange> dateRanges = MarketoUtils.sliceRange(fromDate, toDate, MARKETO_MAX_RANGE_EXTRACT); final Iterator<MarketoUtils.DateRange> iterator = dateRanges.iterator(); return new LineDecoderIterator(iterator, task); }

Target:
private LineDecoderIterator getLineDecoderIterator(T task) { final OffsetDateTime fromDate = OffsetDateTime.ofInstant(task.getFromDate().toInstant(), ZoneOffset.UTC); final OffsetDateTime toDate = task.getToDate().isPresent() ? OffsetDateTime.ofInstant(task.getToDate().get().toInstant(), ZoneOffset.UTC) : OffsetDateTime.now(ZoneOffset.UTC); List<MarketoUtils.DateRange> dateRanges = MarketoUtils.sliceRange(fromDate, toDate, MARKETO_MAX_RANGE_EXTRACT); final Iterator<MarketoUtils.DateRange> iterator = dateRanges.iterator(); return new LineDecoderIterator(iterator, task); }
Source:
public boolean tryRename(String newName) { try { if (renameHandler == null) { return false; } return renameHandler.apply(this, newName); } catch (Exception e) { throw handleErrorInCallback(e, "renameHandler"); } }

Target:
public boolean tryRename(String newName) { try { if (!canRename()) { return false; } return renameHandler.apply(this, newName); } catch (Exception e) { throw handleErrorInCallback(e, "renameHandler"); } }
Source:
public boolean isKieContainerUpdateDuringRolloutAllowed(ConfigMap cm, KieServerState newState) { KieServerState state = (KieServerState) xs.fromXML(cm.getData().get(CFG_MAP_DATA_KEY)); for (KieContainerResource container : state.getContainers()) { if (container.getStatus().equals(KieContainerStatus.STARTED) && !newState.getContainers().stream() .noneMatch(c -> c.getContainerId().equals(container.getContainerId()) && c.getStatus().equals(KieContainerStatus.STOPPED))) { logger.warn("Non KieServer process updated KieServerState during DC rollout for STOPPING containers."); return true; } } logger.warn("Non KieServer process updates KieServerState during DC rollout is prohibited!"); return false; }

Target:
public boolean isKieContainerUpdateDuringRolloutAllowed(ConfigMap cm, KieServerState newState) { KieServerState state = (KieServerState) xs.fromXML(cm.getData().get(CFG_MAP_DATA_KEY)); for (KieContainerResource container : state.getContainers()) { if (container.getStatus().equals(KieContainerStatus.STARTED) && newState.getContainers().stream() .anyMatch(c -> c.getContainerId().equals(container.getContainerId()) && c.getStatus().equals(KieContainerStatus.STOPPED))) { logger.warn("Non KieServer process updated KieServerState during DC rollout for STOPPING containers."); return true; } } logger.warn("Non KieServer process updates KieServerState during DC rollout is prohibited!"); return false; }
Source:
private List<WorkflowAction> filterActionsCollection(final List<WorkflowAction> actions, final Role role) throws DotDataException { final List<WorkflowAction> permissionables = new ArrayList<>(actions); if (permissionables.isEmpty()) { return permissionables; } final Iterator<WorkflowAction> iterator = permissionables.iterator(); while (iterator.hasNext()) { final WorkflowAction wa = iterator.next(); if (!permissionAPI.doesRoleHavePermission(wa, PermissionAPI.PERMISSION_USE, role)) { iterator.remove(); } } return permissionables; }

Target:
private List<WorkflowAction> filterActionsCollection(final List<WorkflowAction> actions, final Role role) throws DotDataException { final List<WorkflowAction> permissionables = new ArrayList<>(actions); if (permissionables.isEmpty()) { return permissionables; } final Iterator<WorkflowAction> workflowActionIterator = permissionables.iterator(); while (workflowActionIterator.hasNext()) { final WorkflowAction wa = workflowActionIterator.next(); if (!permissionAPI.doesRoleHavePermission(wa, PermissionAPI.PERMISSION_USE, role)) { workflowActionIterator.remove(); } } return permissionables; }
Source:
private void loadApns(SQLiteDatabase db, XmlPullParser parser) { if (parser != null) { try { db.beginTransaction(); while (parser.getEventType() != XmlPullParser.END_DOCUMENT) { XmlUtils.nextElement(parser); ContentValues row = getRow(parser); if (row == null) { if (parser.getName() == null) { continue; } else { throw new XmlPullParserException("Expected 'apn' tag", parser, null); } } insertAddingDefaults(db, CARRIERS_TABLE, row); } db.setTransactionSuccessful(); } catch (XmlPullParserException e) { Log.e(TAG, "Got XmlPullParserException while loading apns.", e); } catch (IOException e) { Log.e(TAG, "Got IOException while loading apns.", e); } catch (SQLException e) { Log.e(TAG, "Got SQLException while loading apns.", e); } finally { db.endTransaction(); } } }

Target:
private void loadApns(SQLiteDatabase db, XmlPullParser parser) { if (parser != null) { try { db.beginTransaction(); while (true) { XmlUtils.nextElement(parser); if (parser.getEventType() != XmlPullParser.END_DOCUMENT) { ContentValues row = getRow(parser); if (row == null) { throw new XmlPullParserException("Expected 'apn' tag", parser, null); } insertAddingDefaults(db, CARRIERS_TABLE, row); } else { break; } } db.setTransactionSuccessful(); } catch (XmlPullParserException e) { Log.e(TAG, "Got XmlPullParserException while loading apns.", e); } catch (IOException e) { Log.e(TAG, "Got IOException while loading apns.", e); } catch (SQLException e) { Log.e(TAG, "Got SQLException while loading apns.", e); } finally { db.endTransaction(); } } }
Source:
private void addEmail() { Handler returnHandler = new Handler() { @Override public void handleMessage(Message message) { if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) { Bundle data = message.getData(); String email = data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL); if (email.length() > 0 && mEmailEdit.getText().length() > 0 && email.equals(mEmailEdit.getText().toString())) { notifyUser(getString(R.string.create_key_email_already_exists_text)); return; } for (EmailAdapter.ViewModel model : mAdditionalEmailModels) { if (email.equals(model.email)) { notifyUser(getString(R.string.create_key_email_already_exists_text)); return; } } mEmailAdapter.add( data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL) ); } } }; Messenger messenger = new Messenger(returnHandler); AddEmailDialogFragment addEmailDialog = AddEmailDialogFragment.newInstance(messenger); addEmailDialog.show(getActivity().getSupportFragmentManager(), "addEmailDialog"); }

Target:
private void addEmail() { Handler returnHandler = new Handler() { @Override public void handleMessage(Message message) { if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) { Bundle data = message.getData(); String email = data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL); if (email.length() > 0 && mEmailEdit.getText().length() > 0 && email.equals(mEmailEdit.getText().toString())) { Notify.create(getActivity(), getString(R.string.create_key_email_already_exists_text), Notify.LENGTH_LONG, Notify.Style.ERROR).show(); return; } for (EmailAdapter.ViewModel model : mAdditionalEmailModels) { if (email.equals(model.email)) { Notify.create(getActivity(), getString(R.string.create_key_email_already_exists_text), Notify.LENGTH_LONG, Notify.Style.ERROR).show(); return; } } mEmailAdapter.add(email); } } }; Messenger messenger = new Messenger(returnHandler); AddEmailDialogFragment addEmailDialog = AddEmailDialogFragment.newInstance(messenger); addEmailDialog.show(getActivity().getSupportFragmentManager(), "addEmailDialog"); }
Source:
public void handleData(ITmfEvent event) { super.handleData(event); if (event != null) { if (!(event instanceof ITmfLostEvent)) { long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fHistogram.countEvent(getNbRead(), timestamp); } else { ITmfLostEvent lostEvents = (ITmfLostEvent) event; fHistogram.addLostEvents(lostEvents.getTimeRange(), ((Long) event.getContent().getField(LOST_EVENTS_FIELD).getValue()).intValue()); } } }

Target:
public void handleData(ITmfEvent event) { super.handleData(event); if (event != null) { if (!(event instanceof ITmfLostEvent)) { long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fHistogram.countEvent(getNbRead(), timestamp); } else { ITmfLostEvent lostEvents = (ITmfLostEvent) event; fHistogram.addLostEvents(lostEvents.getTimeRange(), (int)lostEvents.getNbLostEvents()); } } }
Source:
public ServiceNotAvailableException(String message, Throwable cause) { super(message, cause); this.serviceHint = Optional.empty(); this.serviceHintUrl = Optional.empty(); }

Target:
public ServiceNotAvailableException(String message, Throwable cause) { super(message, cause); this.serviceHint = Optional.empty(); }
Source:
public void testCargoTomlIsNotStudentFile() { assertFalse(policy.isStudentSourceFile(Paths.get("src/Cargo.toml"))); }

Target:
public void testCargoTomlIsNotStudentFile() { assertFalse(policy.isStudentSourceFile(Paths.get("src", "Cargo.toml"))); }
Source:
private List<PhoneBookWriter.User> readUsers(FilterPredicate filter, boolean useOtherFiltering, boolean useBloomFilter) throws IOException { FileDecryptionProperties fileDecryptionProperties = null; if (isEncrypted) { DecryptionKeyRetriever decryptionKeyRetrieverMock = mock(DecryptionKeyRetriever.class); when(decryptionKeyRetrieverMock.getKey(FOOTER_ENCRYPTION_KEY_ID.getBytes(StandardCharsets.UTF_8))) .thenReturn(FOOTER_ENCRYPTION_KEY); when(decryptionKeyRetrieverMock.getKey(COLUMN_ENCRYPTION_KEY1_ID.getBytes(StandardCharsets.UTF_8))) .thenReturn(COLUMN_ENCRYPTION_KEY1); when(decryptionKeyRetrieverMock.getKey(COLUMN_ENCRYPTION_KEY2_ID.getBytes(StandardCharsets.UTF_8))) .thenReturn(COLUMN_ENCRYPTION_KEY2); fileDecryptionProperties = FileDecryptionProperties.builder() .withKeyRetriever(decryptionKeyRetrieverMock) .build(); } return PhoneBookWriter.readUsers(ParquetReader.builder(new GroupReadSupport(), file) .withFilter(FilterCompat.get(filter)) .withDecryption(fileDecryptionProperties) .useDictionaryFilter(useOtherFiltering) .useStatsFilter(useOtherFiltering) .useRecordFilter(useOtherFiltering) .useBloomFilter(useBloomFilter) .useColumnIndexFilter(useOtherFiltering)); }

Target:
private List<PhoneBookWriter.User> readUsers(FilterPredicate filter, boolean useOtherFiltering, boolean useBloomFilter) throws IOException { FileDecryptionProperties fileDecryptionProperties = null; if (isEncrypted) { DecryptionKeyRetrieverMock decryptionKeyRetrieverMock = new DecryptionKeyRetrieverMock() .putKey(FOOTER_ENCRYPTION_KEY_ID, FOOTER_ENCRYPTION_KEY) .putKey(COLUMN_ENCRYPTION_KEY1_ID, COLUMN_ENCRYPTION_KEY1) .putKey(COLUMN_ENCRYPTION_KEY2_ID, COLUMN_ENCRYPTION_KEY2); fileDecryptionProperties = FileDecryptionProperties.builder() .withKeyRetriever(decryptionKeyRetrieverMock) .build(); } return PhoneBookWriter.readUsers(ParquetReader.builder(new GroupReadSupport(), file) .withFilter(FilterCompat.get(filter)) .withDecryption(fileDecryptionProperties) .useDictionaryFilter(useOtherFiltering) .useStatsFilter(useOtherFiltering) .useRecordFilter(useOtherFiltering) .useBloomFilter(useBloomFilter) .useColumnIndexFilter(useOtherFiltering)); }
Source:
public Collection<byte[]> getTxChanges() { Collection<byte[]> txChanges = new TreeSet<byte[]>(UnsignedBytes.lexicographicalComparator()); if (conflictLevel != TxConstants.ConflictDetection.NONE) { for (ActionChange change : changeSet) { txChanges.add(getChangeKey(change.getRow(), change.getFamily(), change.getQualifier())); } } return txChanges; }

Target:
public Collection<byte[]> getTxChanges() { if (conflictLevel == TxConstants.ConflictDetection.NONE) { return Collections.emptyList(); } Collection<byte[]> txChanges = new TreeSet<byte[]>(UnsignedBytes.lexicographicalComparator()); for (ActionChange change : changeSet) { txChanges.add(getChangeKey(change.getRow(), change.getFamily(), change.getQualifier())); } return txChanges; }
Source:
public void setShowFilterControls(boolean showFilterControls) { this.showFilterControls = showFilterControls; }

Target:
public void setShowFilterControls(boolean showFilterControls) { this.showFilterControls = showFilterControls; if (filterComposite != null) { Object filterCompositeLayoutData = filterComposite.getLayoutData(); if (filterCompositeLayoutData instanceof GridData) { ((GridData) filterCompositeLayoutData).exclude = !isShowFilterControls(); } else if (filterCompositeLayoutData instanceof RowData) { ((RowData) filterCompositeLayoutData).exclude = !isShowFilterControls(); } filterComposite.setVisible(isShowFilterControls()); layout(); } }