auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void replaceAtHead(K key, Chain expected, Chain replacement) { final Lock lock = heads.writeLock(); lock.lock(); try { while (true) { InternalChain chain = heads.get(key); if (chain == null) { if (expected.iterator().hasNext()) { return; } else { throw new IllegalArgumentException("Empty expected sequence"); } } else { try { if (chain.replace(expected, replacement)) { return; } else { evict(); } } finally { chain.close(); } } } } finally { lock.unlock(); } }

Target:
public void replaceAtHead(K key, Chain expected, Chain replacement) { final Lock lock = heads.writeLock(); lock.lock(); try { while (true) { InternalChain chain = heads.get(key); if (chain == null) { if (expected.isEmpty()) { throw new IllegalArgumentException("Empty expected sequence"); } else { return; } } else { try { if (chain.replace(expected, replacement)) { return; } else { evict(); } } finally { chain.close(); } } } } finally { lock.unlock(); } }
Source:
private TimeUnit validate(TimeUnit timeUnit) { switch (timeUnit) { case MICROSECOND: case MILLISECOND: case SECOND: case MINUTE: case HOUR: case DAY: case WEEK: case MONTH: case QUARTER: case YEAR: case ISOYEAR: return timeUnit; default: throw new RuntimeException(" Time unit " + timeUnit + "is not supported now."); } }

Target:
private TimeUnit validate(TimeUnit timeUnit) { switch (timeUnit) { case MICROSECOND: case MILLISECOND: case SECOND: case MINUTE: case HOUR: case DAY: case WEEK: case MONTH: case QUARTER: case YEAR: case ISOYEAR: return timeUnit; default: throw new RuntimeException("Time unit " + timeUnit + " is not supported for BigQuery."); } }
Source:
public void deleteBucket(String name) throws RepoException { Lock writeLock = this.rwLocks.get(name).writeLock(); writeLock.lock(); boolean rollback = false; boolean bucketDeletetion = false; Bucket bucket = new Bucket(name); try { sqlService.getConnection(); rollback = true; if (sqlService.getBucket(name) == null) throw new RepoException(RepoException.Type.BucketNotFound); if (Boolean.FALSE.equals(objectStore.bucketExists(bucket))) throw new RepoException("Bucket exists in database but not in object store: " + name); if (sqlService.listObjects(name, 0, 1, true, null).size() != 0) throw new RepoException(RepoException.Type.CantDeleteNonEmptyBucket); bucketDeletetion = objectStore.deleteBucket(bucket); if (Boolean.FALSE.equals(bucketDeletetion)) throw new RepoException("Unable to delete bucket in object store: " + name); if (sqlService.deleteBucket(name) == 0) throw new RepoException("Unable to delete bucket in database: " + name); sqlService.transactionCommit(); rollback = false; } catch (SQLException e) { throw new RepoException(e); } finally { if (rollback) { sqlRollback("bucket " + name); if (bucketDeletetion) { objectStore.createBucket(bucket); } } sqlReleaseConnection(); writeLock.unlock(); } }

Target:
public void deleteBucket(String name) throws RepoException { Lock writeLock = this.rwLocks.get(name).writeLock(); writeLock.lock(); boolean rollback = false; boolean bucketDeletion = false; Bucket bucket = new Bucket(name); try { sqlService.getConnection(); rollback = true; if (sqlService.getBucket(name) == null) throw new RepoException(RepoException.Type.BucketNotFound); if (Boolean.FALSE.equals(objectStore.bucketExists(bucket))) throw new RepoException("Bucket exists in database but not in object store: " + name); if (sqlService.listObjects(name, 0, 1, true, null).size() != 0) throw new RepoException(RepoException.Type.CantDeleteNonEmptyBucket); bucketDeletion = objectStore.deleteBucket(bucket); if (Boolean.FALSE.equals(bucketDeletion)) throw new RepoException("Unable to delete bucket in object store: " + name); if (sqlService.deleteBucket(name) == 0) throw new RepoException("Unable to delete bucket in database: " + name); sqlService.transactionCommit(); rollback = false; } catch (SQLException e) { throw new RepoException(e); } finally { if (rollback) { sqlRollback("bucket " + name); if (bucketDeletion) { objectStore.createBucket(bucket); } } sqlReleaseConnection(); writeLock.unlock(); } }
Source:
String escapedJson(final User user) { final LookupTranslator translator = new LookupTranslator(new String[][]{{"\"", "\\\""}}); final String rawJson = ServerMarshalling.toJSON(user); return translator.translate(rawJson); }

Target:
String escapedJson(final User user) { final String rawJson = ServerMarshalling.toJSON(user); return rawJson.replaceAll("\\\\\"","\\\\\\\\\"").replaceAll("\"","\\\\\""); }
Source:
protected boolean checkContractsAndGrantsSetupForNonEmptyNewAccountsList(SubAccountGlobal subAccountGlobal) { boolean success = true; boolean allAccountsAreForContractsAndGrants = true; boolean atLeastOneAccountIsForContractsAndGrants = false; for (SubAccountGlobalNewAccountDetail newAccountDetail : subAccountGlobal.getSubAccountGlobalNewAccountDetails()) { boolean currentAccountIsForContractsAndGrants = accountIsForContractsAndGrants(newAccountDetail); allAccountsAreForContractsAndGrants &= currentAccountIsForContractsAndGrants; atLeastOneAccountIsForContractsAndGrants |= currentAccountIsForContractsAndGrants; } if (!allAccountsAreForContractsAndGrants && atLeastOneAccountIsForContractsAndGrants) { putGlobalError(CUKFSKeyConstants.ERROR_DOCUMENT_SUB_ACCOUNT_GLOBAL_CG_AND_NON_CG_MIX); success = false; } else if (allAccountsAreForContractsAndGrants) { if (StringUtils.equals(KFSConstants.SubAccountType.COST_SHARE, subAccountGlobal.getNewSubAccountTypeCode())) { success &= checkCgCostSharingForNewAccounts(subAccountGlobal); } else if (StringUtils.equals(KFSConstants.SubAccountType.EXPENSE, subAccountGlobal.getNewSubAccountTypeCode())) { success &= checkIndirectCostRecoveryFieldsHaveValuesForCgExpenseAccounts(subAccountGlobal); success &= checkCgIcrRules(subAccountGlobal.getNewSubAccountTypeCode()); } } else { success &= checkCgFieldsAreEmptyForNonCgAccounts(subAccountGlobal); } return success; }

Target:
protected boolean checkContractsAndGrantsSetupForNonEmptyNewAccountsList(SubAccountGlobal subAccountGlobal) { boolean success = true; List<SubAccountGlobalNewAccountDetail> newAccountDetails = subAccountGlobal.getSubAccountGlobalNewAccountDetails(); int numberOfAccountsForContractsAndGrants = (int) newAccountDetails.stream() .filter(this::accountIsForContractsAndGrants) .count(); boolean allAccountsAreForContractsAndGrants = (numberOfAccountsForContractsAndGrants == newAccountDetails.size()); boolean noneOfAccountsAreForContractsAndGrants = (numberOfAccountsForContractsAndGrants == 0); if (allAccountsAreForContractsAndGrants) { if (StringUtils.equals(KFSConstants.SubAccountType.COST_SHARE, subAccountGlobal.getNewSubAccountTypeCode())) { success &= checkCgCostSharingForNewAccounts(subAccountGlobal); } else if (StringUtils.equals(KFSConstants.SubAccountType.EXPENSE, subAccountGlobal.getNewSubAccountTypeCode())) { success &= checkIndirectCostRecoveryFieldsHaveValuesForCgExpenseAccounts(subAccountGlobal); success &= checkCgIcrRules(subAccountGlobal.getNewSubAccountTypeCode()); } } else if (noneOfAccountsAreForContractsAndGrants) { success &= checkCgFieldsAreEmptyForNonCgAccounts(subAccountGlobal); } else { putGlobalError(CUKFSKeyConstants.ERROR_DOCUMENT_SUB_ACCOUNT_GLOBAL_CG_AND_NON_CG_MIX); success = false; } return success; }
Source:
protected void executeCommand() { AtomicInteger count = new AtomicInteger(1); List<ActionParametersBase> params = vdsIds.stream() .map(id -> new PersistentHostSetupNetworksParameters(id, vdsIds.size(), count.getAndIncrement())) .collect(Collectors.toList()); runInternalMultipleActions(ActionType.SyncAllHostNetworks, params); setSucceeded(true); }

Target:
protected void executeCommand() { if (outOfSyncHostsExist()) { AtomicInteger count = new AtomicInteger(1); List<ActionParametersBase> params = vdsIds.stream() .map(id -> new PersistentHostSetupNetworksParameters(id, vdsIds.size(), count.getAndIncrement())) .collect(Collectors.toList()); runInternalMultipleActions(ActionType.SyncAllHostNetworks, params); } setSucceeded(true); }
Source:
@Test public void testUnionPlan2() { CalciteAssert.model(JdbcTest.FOODMART_SCOTT_MODEL) .query("select \"store_name\" from \"foodmart\".\"store\"\n" + "union all\n" + "select ename from SCOTT.emp") .explainContains("PLAN=EnumerableUnion(all=[true])\n" + " JdbcToEnumerableConverter\n" + " JdbcProject(store_name=[$3])\n" + " JdbcTableScan(table=[[foodmart, store]])\n" + " JdbcToEnumerableConverter\n" + " JdbcProject(ENAME=[$1])\n" + " JdbcTableScan(table=[[SCOTT, EMP]])\n") .runs() .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.HSQLDB) .planHasSql("SELECT \"store_name\"\n" + "FROM \"foodmart\".\"store\"") .planHasSql("SELECT \"ENAME\"\n" + "FROM \"SCOTT\".\"EMP\""); }

Target:
@Test public void testUnionPlan2() { CalciteAssert.model(JdbcTest.FOODMART_SCOTT_MODEL) .query("select \"store_name\" from \"foodmart\".\"store\" where \"store_id\" < 10\n" + "union all\n" + "select ename from SCOTT.emp where empno > 10") .explainContains("PLAN=EnumerableUnion(all=[true])\n" + " JdbcToEnumerableConverter\n" + " JdbcProject(store_name=[$3])\n" + " JdbcFilter(condition=[<($0, 10)])\n" + " JdbcTableScan(table=[[foodmart, store]])\n" + " JdbcToEnumerableConverter\n" + " JdbcProject(ENAME=[$1])\n" + " JdbcFilter(condition=[>($0, 10)])\n" + " JdbcTableScan(table=[[SCOTT, EMP]])") .runs() .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.HSQLDB) .planHasSql("SELECT \"store_name\"\n" + "FROM \"foodmart\".\"store\"\n" + "WHERE \"store_id\" < 10") .planHasSql("SELECT \"ENAME\"\n" + "FROM \"SCOTT\".\"EMP\"\n" + "WHERE \"EMPNO\" > 10"); }
Source:
public ControlFlowEntry(int quark, LttngKernelTrace trace, String execName, int threadId, int parentThreadId, long startTime, long endTime) { super(quark, trace, execName, startTime, endTime); fThreadId = threadId; fParentThreadId = parentThreadId; }

Target:
public ControlFlowEntry(int quark, LttngKernelTrace trace, String execName, int threadId, int parentThreadId, long startTime, long endTime) { super(quark, trace, execName, startTime, endTime); fThreadId = threadId; fParentThreadId = parentThreadId; fThreadQuark = quark; }
Source:
static DownloadError createNetworkError(String networkErrorCause) { String networkErrorMessage = String.format( "Network error, cannot download file. Cause: %s", networkErrorCause ); return new DownloadError(DownloadError.Type.NETWORK_ERROR_CANNOT_DOWNLOAD_FILE, networkErrorMessage); }

Target:
static DownloadError createNetworkError(String networkErrorCause) { String networkErrorMessage = "Network error, cannot download file. Cause: " + networkErrorCause; return new DownloadError(DownloadError.Type.NETWORK_ERROR_CANNOT_DOWNLOAD_FILE, networkErrorMessage); }
Source:
public void checkSyncUpstreamsState(LoadBalancerRequestId loadBalancerRequestId, String singularityRequestId) { Retryer<BaragonRequestState> syncingRetryer = RetryerBuilder.<BaragonRequestState>newBuilder() .retryIfException() .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS)) .retryIfResult(baragonRequestStateIsWaiting) .build(); try { BaragonRequestState syncUpstreamsState = syncingRetryer.call(() -> lbClient.getState(loadBalancerRequestId).getLoadBalancerState()); if (syncUpstreamsState == BaragonRequestState.SUCCESS){ LOG.info("Syncing upstreams for singularity request is {}. Load balancer request id is {}.", singularityRequestId, syncUpstreamsState.name(), loadBalancerRequestId.toString()); } else { LOG.error("Syncing upstreams for singularity request is {}. Load balancer request id is {}.", singularityRequestId, syncUpstreamsState.name(), loadBalancerRequestId.toString()); } } catch (Exception e) { LOG.error("message", e); } }

Target:
private void checkSyncUpstreamsState(LoadBalancerRequestId loadBalancerRequestId, String singularityRequestId) { Retryer<SingularityLoadBalancerUpdate> syncingRetryer = RetryerBuilder.<SingularityLoadBalancerUpdate>newBuilder() .retryIfException() .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS)) .retryIfResult(IS_WAITING_STATE) .build(); try { LOG.info("Checking load balancer request to sync upstreams for service using a retryer until the request state is no longer waiting.", singularityRequestId); SingularityLoadBalancerUpdate syncUpstreamsState = syncingRetryer.call(() -> lbClient.getState(loadBalancerRequestId)); if (syncUpstreamsState.getLoadBalancerState() == BaragonRequestState.SUCCESS){ LOG.debug("Syncing upstreams for singularity request is {}.", singularityRequestId, syncUpstreamsState); } else { LOG.error("Syncing upstreams for singularity request is {}.", singularityRequestId, syncUpstreamsState); } } catch (Exception e) { LOG.error("Could not check sync upstream state for singularity request {}. ", singularityRequestId, e); } }
Source:
public boolean isIdentifiedBy(String variant) { return variant == null && this.variant == null || Objects.nonNull(this.variant) && this.variant.equals(variant); }

Target:
public boolean isIdentifiedBy(String variant) { return Objects.isNull(variant) && Objects.isNull(this.variant) || Objects.nonNull(this.variant) && this.variant.equals(variant); }
Source:
public void testDefaults() { assertRecordedDefaults(ConfigAssertions.recordDefaults(FileSessionPropertyManagerConfig.class) .setConfigFile(null)); }

Target:
public void testDefaults() { assertRecordedDefaults(recordDefaults(FileSessionPropertyManagerConfig.class) .setConfigFile(null)); }
Source:
private HttpServiceResponse handlePutStatus(HttpServiceRequest request, LedgerUnderreplicationManager ledgerUnderreplicationManager) throws Exception { Map<String, String> params = ObjectUtils.defaultIfNull(request.getParams(), Collections.emptyMap()); String enabled = params.get("enabled"); if (enabled == null) { return new HttpServiceResponse("Param 'enabled' not found in " + params, HttpServer.StatusCode.INTERNAL_ERROR); } if (Boolean.parseBoolean(enabled)) { if (!ledgerUnderreplicationManager.isLedgerReplicationEnabled()) { ledgerUnderreplicationManager.enableLedgerReplication(); } } else { if (ledgerUnderreplicationManager.isLedgerReplicationEnabled()) { ledgerUnderreplicationManager.disableLedgerReplication(); } } String body = JsonUtil.toJson(ImmutableMap.of("enabled", ledgerUnderreplicationManager.isLedgerReplicationEnabled())); return new HttpServiceResponse(body, HttpServer.StatusCode.OK); }

Target:
private HttpServiceResponse handlePutStatus(HttpServiceRequest request, LedgerUnderreplicationManager ledgerUnderreplicationManager) throws Exception { Map<String, String> params = ObjectUtils.defaultIfNull(request.getParams(), Collections.emptyMap()); String enabled = params.get("enabled"); if (enabled == null) { return new HttpServiceResponse("Param 'enabled' not found in " + params, HttpServer.StatusCode.BAD_REQUEST); } if (Boolean.parseBoolean(enabled)) { if (!ledgerUnderreplicationManager.isLedgerReplicationEnabled()) { ledgerUnderreplicationManager.enableLedgerReplication(); } } else { if (ledgerUnderreplicationManager.isLedgerReplicationEnabled()) { ledgerUnderreplicationManager.disableLedgerReplication(); } } String body = JsonUtil.toJson(ImmutableMap.of("enabled", ledgerUnderreplicationManager.isLedgerReplicationEnabled())); return new HttpServiceResponse(body, HttpServer.StatusCode.OK); }
Source:
private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (secondsVector.length < requiredVectorLength) { secondsVector = new long[requiredVectorLength]; nanosVector = new long[requiredVectorLength]; systemMemoryContext.setBytes(requiredVectorLength * 16); } }

Target:
private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (secondsVector.length < requiredVectorLength) { secondsVector = new long[requiredVectorLength]; nanosVector = new long[requiredVectorLength]; systemMemoryContext.setBytes(getRetainedSizeInBytes()); } }
Source:
protected void setConsumerBatchEnabled(boolean consumerBatchEnabled) { this.consumerBatchEnabled = consumerBatchEnabled; }

Target:
public void setConsumerBatchEnabled(boolean consumerBatchEnabled) { this.consumerBatchEnabled = consumerBatchEnabled; }
Source:
private String decodeAlarm(String value) { if (value == "tracker") { return null; } else if (value == "help me") { return Position.ALARM_SOS; } else if (value == "low battery") { return Position.ALARM_LOW_BATTERY; } else if (value == "stockade") { return Position.ALARM_GEOFENCE; } else if (value == "move") { return Position.ALARM_MOVEMENT; } else if (value == "speed") { return Position.ALARM_OVERSPEED; } return null; }

Target:
private String decodeAlarm(String value) { switch (value) { case "tracker": return null; case "help me": return Position.ALARM_SOS; case "low battery": return Position.ALARM_LOW_BATTERY; case "stockade": return Position.ALARM_GEOFENCE; case "move": return Position.ALARM_MOVEMENT; case "speed": return Position.ALARM_OVERSPEED; default: return null; } }
Source:
public void deleteProjects(List<Project> projects) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Project project : projects) { List<Project> result = queryService.queryByString(Project.class, "name:\"" + project.getName() + "\""); if (result.size() == 0) { LOGGER.warn("Project {1} does not exist.", project.getName()); } else { commit.addDelete(project); } deleteAllAssignmentsForProject(project); } persistService.commit(commit); revokePersistenceAccess(); }

Target:
public void deleteProjects(List<Project> projects) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Project project : projects) { List<Project> result = queryService.query(Project.class, QueryRequest.query("name", project.getName())); if (result.size() == 0) { LOGGER.warn("Project {1} does not exist.", project.getName()); } else { commit.addDelete(project); } deleteAllAssignmentsForProject(project); } persistService.commit(commit); revokePersistenceAccess(); }
Source:
public void scan() { for (HiddenFile file : hfList) { if (isStop()) { if (LOG.isDebugEnabled()) { LOG.debug("Scanner " + getName() + " stopping."); } return; } HttpMessage testMsg = sendHiddenFileRequest(file); if (testMsg == null) { continue; } int statusCode = testMsg.getResponseHeader().getStatusCode(); String responseBody = testMsg.getResponseBody().toString(); if (statusCode == HttpStatusCode.OK) { boolean matches = doesNotMatch(responseBody, file.getNotContent()) && doesMatch(responseBody, file.getContent()) && doesBinRegexMatch(responseBody, file.getBinRegex()); if (matches) { raiseAlert(testMsg, Alert.CONFIDENCE_HIGH, getRisk(), file); } if (!matches) { raiseAlert(testMsg, Alert.CONFIDENCE_LOW, getRisk(), file); } } else if (statusCode == HttpStatusCode.UNAUTHORIZED || statusCode == HttpStatusCode.FORBIDDEN) { raiseAlert(testMsg, Alert.CONFIDENCE_LOW, Alert.RISK_INFO, file); } } }

Target:
public void scan() { for (HiddenFile file : hfList) { if (isStop()) { if (LOG.isDebugEnabled()) { LOG.debug("Scanner " + getName() + " stopping."); } return; } HttpMessage testMsg = sendHiddenFileRequest(file); if (testMsg == null) { continue; } int statusCode = testMsg.getResponseHeader().getStatusCode(); if (statusCode == HttpStatusCode.OK) { String responseBody = testMsg.getResponseBody().toString(); boolean matches = doesNotMatch(responseBody, file.getNotContent()) && doesMatch(responseBody, file.getContent()) && doesBinaryMatch(responseBody, file.getBinary()); raiseAlert( testMsg, matches ? Alert.CONFIDENCE_HIGH : Alert.CONFIDENCE_LOW, getRisk(), file); } else if (statusCode == HttpStatusCode.UNAUTHORIZED || statusCode == HttpStatusCode.FORBIDDEN) { raiseAlert(testMsg, Alert.CONFIDENCE_LOW, Alert.RISK_INFO, file); } } }
Source:
public void fetchEndOffsetsShouldRethrowRuntimeExceptionAsStreamsException() { final Admin adminClient = EasyMock.createMock(AdminClient.class); EasyMock.expect(adminClient.listOffsets(EasyMock.anyObject())).andThrow(new RuntimeException()); replay(adminClient); assertThrows(StreamsException.class, () -> fetchEndOffsets(emptyList(), adminClient, 60_000L)); verify(adminClient); }

Target:
public void fetchEndOffsetsShouldRethrowRuntimeExceptionAsStreamsException() { final Admin adminClient = EasyMock.createMock(AdminClient.class); EasyMock.expect(adminClient.listOffsets(EasyMock.anyObject())).andThrow(new RuntimeException()); replay(adminClient); assertThrows(StreamsException.class, () -> fetchEndOffsets(emptyList(), adminClient)); verify(adminClient); }
Source:
public String getStatus(String sessionId, String jobId) throws TException { if (interpreterGroup == null) { return Status.UNKNOWN.name(); } synchronized (interpreterGroup) { List<Interpreter> interpreters = interpreterGroup.get(sessionId); if (interpreters == null) { return Status.UNKNOWN.name(); } for (Interpreter intp : interpreters) { if (((LazyOpenInterpreter) intp).isOpen()) { Job job = intp.getScheduler().getJob(jobId); if (job != null) { return job.getStatus().name(); } } } } return Status.UNKNOWN.name(); }

Target:
public String getStatus(String sessionId, String jobId) throws TException { if (interpreterGroup == null) { return Status.UNKNOWN.name(); } synchronized (interpreterGroup) { List<Interpreter> interpreters = interpreterGroup.get(sessionId); if (interpreters == null) { return Status.UNKNOWN.name(); } for (Interpreter intp : interpreters) { Scheduler scheduler = intp.getScheduler(); if (scheduler != null) { Job job = scheduler.getJob(jobId); if (job != null) { return job.getStatus().name(); } } } } return Status.UNKNOWN.name(); }
Source:
public boolean isEmpty() { return size - toRemove.size() == 0; }

Target:
public boolean isEmpty() { int amount = size - toRemove.size(); assert (amount >= 0); return amount == 0; }
Source:
public static void loadClasses(ClassLoader classLoader, String pathToJar) throws IOException, ClassNotFoundException { final URLClassLoader cl = ClassLoaderUtils.getURLClassLoader(classLoader); ClassLoaderUtils.addURLToURLClassLoader(cl, new URL[]{ new URL("jar:file:" + pathToJar + "!/") }); final JarFile jarFile = new JarFile(pathToJar); final Enumeration<JarEntry> e = jarFile.entries(); while (e.hasMoreElements()) { final JarEntry je = e.nextElement(); if (je.isDirectory() || !je.getName().endsWith(".class")) { continue; } String className = je.getName().substring(0, je.getName().length() - 6); className = className.replace('/', '.'); cl.loadClass(className); } }

Target:
public static void loadClasses(ClassLoader classLoader, String pathToJar) throws IOException, ClassNotFoundException { final URLClassLoader cl = ClassLoaderUtils.getURLClassLoader(classLoader); ClassLoaderUtils.addURLToURLClassLoader(cl, new URL[]{ new URL("jar:file:" + pathToJar + "!/") }); try (final JarFile jarFile = new JarFile(pathToJar)) { final Enumeration<JarEntry> e = jarFile.entries(); while (e.hasMoreElements()) { final JarEntry je = e.nextElement(); if (je.isDirectory() || !je.getName().endsWith(".class")) { continue; } String className = je.getName().substring(0, je.getName().length() - 6); className = className.replace('/', '.'); cl.loadClass(className); } } }
Source:
public void onBlockBreak(BlockBreakEvent e) { Talisman.checkFor(e, SlimefunItems.TALISMAN_CAVEMAN); }

Target:
public void onBlockBreak(BlockBreakEvent e) { if (e.getBlock().getType().name().endsWith("_ORE")) { Talisman.checkFor(e, SlimefunItems.TALISMAN_CAVEMAN); } }
Source:
private List<Project.NameKey> getAllParents(final Project.NameKey projectName) { final List<Project.NameKey> parents = new ArrayList<Project.NameKey>(); final ProjectState e = projectCache.get(projectName); if (e != null) { final Project.NameKey parentName = getParentName(e.getProject()); if (parentName != null) { parents.add(parentName); parents.addAll(getAllParents(parentName)); } } return parents; }

Target:
private List<Project.NameKey> getAllParents(final Project.NameKey projectName) { final List<Project.NameKey> parents = new ArrayList<Project.NameKey>(); Project.NameKey p = projectName; while (p != null) { final ProjectState e = projectCache.get(p); if (e == null) { break; } final Project.NameKey parentName = getParentName(e.getProject()); if (parentName != null) { parents.add(parentName); } p = parentName; } return parents; }
Source:
public void log(Event event) { if (System.nanoTime() - lastMCEventsPollNanos > MC_EVENTS_WINDOW_NANOS) { mcEvents.clear(); } else { mcEvents.offer(event); } if (eventListener != null) { eventListener.onEventLogged(event); } }

Target:
public void log(Event event) { if (System.nanoTime() - lastMCEventsPollNanos > MC_EVENTS_WINDOW_NANOS) { onMCEventWindowExceeded(); } else { mcEvents.offer(event); } if (eventListener != null) { eventListener.onEventLogged(event); } }
Source:
public void request(long n) { long _c; if (n == Long.MAX_VALUE) { _c = REQUESTED_UPDATER.getAndSet(this, Long.MAX_VALUE); } else { for (;;) { _c = requested; if (_c == Long.MAX_VALUE) { return; } if (REQUESTED_UPDATER.compareAndSet(this, _c, _c + n)) { break; } } } if (!emittingStarted) { return; } emit(_c); }

Target:
public void request(long n) { if (requested == Long.MAX_VALUE) { return; } long _c; if (n == Long.MAX_VALUE) { _c = REQUESTED_UPDATER.getAndSet(this, Long.MAX_VALUE); } else { _c = REQUESTED_UPDATER.getAndAdd(this, n); } if (!emittingStarted) { return; } emit(_c); }
Source:
@Override protected void onHandleWork(@NonNull Intent intent) { List<ReadingListPage> pagesToSave = ReadingListDbHelper.instance().getAllPagesToBeSaved(); List<ReadingListPage> pagesToUnsave = ReadingListDbHelper.instance().getAllPagesToBeUnsaved(); List<ReadingListPage> pagesToDelete = ReadingListDbHelper.instance().getAllPagesToBeDeleted(); boolean shouldSendSyncEvent = false; if (ReadingListSyncAdapter.inProgress()) { return; } try { for (ReadingListPage page : pagesToDelete) { deletePageContents(page); } for (ReadingListPage page : pagesToUnsave) { deletePageContents(page); } } catch (Exception e) { L.e("Error while deleting page: " + e.getMessage()); } finally { if (!pagesToDelete.isEmpty()) { ReadingListDbHelper.instance().purgeDeletedPages(); shouldSendSyncEvent = true; } if (!pagesToUnsave.isEmpty()) { ReadingListDbHelper.instance().resetUnsavedPageStatus(); shouldSendSyncEvent = true; } } int itemsTotal = pagesToSave.size(); if (itemsTotal > 0) { shouldSendSyncEvent = true; } int itemsSaved = 0; try { itemsSaved = savePages(pagesToSave); } finally { if (savedPageSyncNotification.isSyncPaused()) { savedPageSyncNotification.setNotificationPaused(getApplicationContext(), itemsTotal, itemsSaved); } else { savedPageSyncNotification.cancelNotification(getApplicationContext()); savedPageSyncNotification.setSyncCanceled(false); if (shouldSendSyncEvent) { sendSyncEvent(); } } } }

Target:
@Override protected void onHandleWork(@NonNull Intent intent) { if (ReadingListSyncAdapter.inProgress()) { return; } List<ReadingListPage> pagesToSave = ReadingListDbHelper.instance().getAllPagesToBeSaved(); List<ReadingListPage> pagesToUnsave = ReadingListDbHelper.instance().getAllPagesToBeUnsaved(); List<ReadingListPage> pagesToDelete = ReadingListDbHelper.instance().getAllPagesToBeDeleted(); boolean shouldSendSyncEvent = false; try { for (ReadingListPage page : pagesToDelete) { deletePageContents(page); } for (ReadingListPage page : pagesToUnsave) { deletePageContents(page); } } catch (Exception e) { L.e("Error while deleting page: " + e.getMessage()); } finally { if (!pagesToDelete.isEmpty()) { ReadingListDbHelper.instance().purgeDeletedPages(); shouldSendSyncEvent = true; } if (!pagesToUnsave.isEmpty()) { ReadingListDbHelper.instance().resetUnsavedPageStatus(); shouldSendSyncEvent = true; } } int itemsTotal = pagesToSave.size(); if (itemsTotal > 0) { shouldSendSyncEvent = true; } int itemsSaved = 0; try { itemsSaved = savePages(pagesToSave); } finally { if (savedPageSyncNotification.isSyncPaused()) { savedPageSyncNotification.setNotificationPaused(getApplicationContext(), itemsTotal, itemsSaved); } else { savedPageSyncNotification.cancelNotification(getApplicationContext()); savedPageSyncNotification.setSyncCanceled(false); if (shouldSendSyncEvent) { sendSyncEvent(); } } } }
Source:
public ClusterBasedJobCoordinator(Config coordinatorSystemConfig) { metrics = new MetricsRegistryMap(); CoordinatorStreamSystemConsumer coordinatorSystemConsumer = new CoordinatorStreamSystemConsumer(coordinatorSystemConfig, metrics); CoordinatorStreamSystemProducer coordinatorSystemProducer = new CoordinatorStreamSystemProducer(coordinatorSystemConfig, metrics); CoordinatorStream coordinatorStream = new CoordinatorStream(coordinatorSystemConfig, metrics, COORDINATOR_STREAM_SOURCE); coordinatorStream.startConsumer(); coordinatorStream.startProducer(); changelogPartitionManager = new ChangelogPartitionManager(coordinatorStream); jobModelManager = JobModelManager.apply(coordinatorStream, changelogPartitionManager.readPartitionMapping()); config = jobModelManager.jobModel().getConfig(); hasDurableStores = new StorageConfig(config).hasDurableStores(); state = new SamzaApplicationState(jobModelManager); systemAdmins = new SystemAdmins(config); partitionMonitor = getPartitionCountMonitor(config, systemAdmins); clusterManagerConfig = new ClusterManagerConfig(config); isJmxEnabled = clusterManagerConfig.getJmxEnabled(); jobCoordinatorSleepInterval = clusterManagerConfig.getJobCoordinatorSleepInterval(); containerProcessManager = new ContainerProcessManager(config, state, metrics); }

Target:
public ClusterBasedJobCoordinator(Config coordinatorSystemConfig) { metrics = new MetricsRegistryMap(); coordinatorStreamManager = new CoordinatorStreamManager(coordinatorSystemConfig, metrics); coordinatorStreamManager.register(getClass().getSimpleName()); coordinatorStreamManager.start(); coordinatorStreamManager.bootstrap(); changelogStreamManager = new ChangelogStreamManager(coordinatorStreamManager); jobModelManager = JobModelManager.apply(coordinatorStreamManager, changelogStreamManager.readPartitionMapping()); config = jobModelManager.jobModel().getConfig(); hasDurableStores = new StorageConfig(config).hasDurableStores(); state = new SamzaApplicationState(jobModelManager); systemAdmins = new SystemAdmins(config); partitionMonitor = getPartitionCountMonitor(config, systemAdmins); clusterManagerConfig = new ClusterManagerConfig(config); isJmxEnabled = clusterManagerConfig.getJmxEnabled(); jobCoordinatorSleepInterval = clusterManagerConfig.getJobCoordinatorSleepInterval(); containerProcessManager = new ContainerProcessManager(config, state, metrics); }
Source:
public void signal(String sessionId, SignalProperties props) throws OpenTokException , RequestException, InvalidArgumentException { if (sessionId == null || sessionId == "" ) { throw new InvalidArgumentException("Session string null or empty"); } try { this.client.signal(sessionId,null,props); } catch (Exception e) { throw e; } }

Target:
public void signal(String sessionId, SignalProperties props) throws OpenTokException , RequestException, InvalidArgumentException { if (sessionId == null || sessionId.isEmpty() ) { throw new InvalidArgumentException("Session string null or empty"); } try { this.client.signal(sessionId,null,props); } catch (Exception e) { throw e; } }
Source:
public VDS findProxyHost(boolean withRetries, Guid excludedHostId) { PMProxyOptions proxyOption = null; final Guid NO_VDS = Guid.Empty; int count; int retries = Math.max(Config.<Integer> getValue(ConfigValues.FindFenceProxyRetries), 1); int delayInMs = 1000 * Config.<Integer> getValue(ConfigValues.FindFenceProxyDelayBetweenRetriesInSec); VDS proxyHost = null; String pmProxyPreferences = (StringUtils.isEmpty(_vds.getPmProxyPreferences())) ? Config.<String> getValue(ConfigValues.FenceProxyDefaultPreferences) : _vds.getPmProxyPreferences(); String[] pmProxyOptions = pmProxyPreferences.split(","); for (String pmProxyOption : pmProxyOptions) { count = 0; proxyOption = getProxyOption(pmProxyOption); if (proxyOption == null) { log.error("Illegal value in PM Proxy Preferences string {}, skipped.", pmProxyOption); continue; } if (_vds.getId().equals(NO_VDS)) { proxyHost = getFenceProxy(true, false, proxyOption, excludedHostId); if (proxyHost == null) { proxyHost = getFenceProxy(false, false, proxyOption, excludedHostId); } } else { while (count < retries) { proxyHost = getFenceProxy(true, true, proxyOption, excludedHostId); if (proxyHost == null) { proxyHost = getFenceProxy(false, true, proxyOption, excludedHostId); } if (proxyHost != null) { break; } if (!withRetries) break; log.info("Attempt to find fence proxy host failed...", ++count); try { Thread.sleep(delayInMs); } catch (Exception e) { log.error(e.getMessage()); break; } } } if (proxyHost != null) { break; } } if (proxyHost == null) { log.error("Failed to run Power Management command on Host {}, no running proxy Host was found.", _vds.getName()); } else { logProxySelection(proxyHost.getName(), proxyOption.createLogEntry(proxyHost)); } return proxyHost; }

Target:
public VDS findProxyHost(boolean withRetries, Guid excludedHostId) { int retries = Math.max(Config.<Integer> getValue(ConfigValues.FindFenceProxyRetries), 1); int delayInMs = 1000 * Config.<Integer> getValue(ConfigValues.FindFenceProxyDelayBetweenRetriesInSec); VDS proxyHost = null; for (PMProxyOptions proxyOption : getPmProxyPreferences()) { proxyHost = getFenceProxy(false, proxyOption, excludedHostId); int count = 0; while (proxyHost == null && withRetries && count < retries) { log.info("Attempt to find fence proxy host failed...", ++count); try { Thread.sleep(delayInMs); } catch (Exception e) { log.error(e.getMessage()); } proxyHost = getFenceProxy(true, proxyOption, excludedHostId); if (proxyHost != null) { logProxySelection(proxyHost.getName(), proxyOption.createLogEntry(proxyHost)); } } } if (proxyHost == null) { log.error("Failed to run Power Management command on Host {}, no running proxy Host was found.", _vds.getName()); } return proxyHost; }
Source:
public RemoteServiceInstance(ICluster cluster, ServiceReference serviceReference) { this.serviceName = serviceReference.serviceName(); this.cluster = cluster; this.address = serviceReference.address(); this.memberId = serviceReference.memberId(); this.futures = new ConcurrentHashMap<>(); this.cluster.listen().subscribe(message -> handleReply(message)); }

Target:
public RemoteServiceInstance(ICluster cluster, ServiceReference serviceReference) { this.serviceName = serviceReference.serviceName(); this.cluster = cluster; this.address = serviceReference.address(); this.memberId = serviceReference.memberId(); }
Source:
public void sweepStrategyNothingDoesNotPersistAntything() { sweepQueue.enqueue(writeToDefaultCell(TABLE_NOTHING, TS), TS); sweepQueue.enqueue(writeToDefaultCell(TABLE_NOTHING, TS2), TS2); verify(kvs, times(0)).put(eq(TargetedSweepTableFactory.of().getSweepableCellsTable(null).getTableRef()), anyMap(), anyLong()); verify(kvs, times(0)).put(eq(TargetedSweepTableFactory.of().getSweepableTimestampsTable(null).getTableRef()), anyMap(), anyLong()); verify(kvs, times(0)).put(eq(TargetedSweepTableFactory.of().getSweepShardProgressTable(null).getTableRef()), anyMap(), anyLong()); }

Target:
public void sweepStrategyNothingDoesNotPersistAntything() { enqueueWrite(TABLE_NOTHING, TS); enqueueWrite(TABLE_NOTHING, TS2); verify(kvs, times(2)).put(any(TableReference.class), anyMap(), anyLong()); }
Source:
private void _setVdsmId(String vdsmid) { if (vdsmid == null) { throw new SoftError("Cannot acquire node id"); } log.infoFormat( "Host {0} reports unique id {1}", _vds.gethost_name(), vdsmid ); List<VDS> list = LinqUtils.filter( DbFacade.getInstance().getVdsDao().getAllWithUniqueId(vdsmid), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return !vds.getId().equals(_vds.getId()); } } ); if (!list.isEmpty()) { StringBuffer hosts = new StringBuffer(1024); for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getvds_name()); } log.errorFormat( "Host {0} reports duplicate unique id {1} of following hosts {2}", _vds.gethost_name(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", _vds.gethost_name(), hosts ) ); } log.infoFormat("Assigning unique id {0} to Host {1}", _vds.gethost_name(), vdsmid); _vds.setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); return null; } }); }

Target:
private void _setVdsmId(String vdsmid) { if (vdsmid == null) { throw new SoftError("Cannot acquire node id"); } log.infoFormat( "Host {0} reports unique id {1}", _vds.gethost_name(), vdsmid ); final List<VDS> list = LinqUtils.filter( DbFacade.getInstance().getVdsDao().getAllWithUniqueId(vdsmid), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return !vds.getId().equals(_vds.getId()); } } ); if (!list.isEmpty()) { final StringBuilder hosts = new StringBuilder(1024); for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getvds_name()); } log.errorFormat( "Host {0} reports duplicate unique id {1} of following hosts {2}", _vds.gethost_name(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", _vds.gethost_name(), hosts ) ); } log.infoFormat("Assigning unique id {0} to Host {1}", _vds.gethost_name(), vdsmid); _vds.setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); return null; } }); }
Source:
public String setLabel(String entityId, String type, String label, String language) throws RetryableException { String datatype = type.equals("property") ? "string" : null; EditRequest data = new EditRequest( datatype, ImmutableMap.of( "en", new Label( language, label + System.currentTimeMillis()))); try { URI uri = uris.edit(entityId, type, mapper.writeValueAsString(data)); log.debug("Editing entity using {}", uri); EditResponse result = checkApi(getJson(postWithToken(uri), EditResponse.class)); return result.getEntity().getId(); } catch (IOException e) { throw new RetryableException("Error adding page", e); } }

Target:
public String setLabel(String entityId, String type, String label, String language) throws RetryableException { String datatype = type.equals("property") ? "string" : null; EditRequest data = new EditRequest( datatype, ImmutableMap.of( language, new Label(language, label))); try { URI uri = uris.edit(entityId, type, mapper.writeValueAsString(data)); log.debug("Editing entity using {}", uri); EditResponse result = checkApi(getJson(postWithToken(uri), EditResponse.class)); return result.getEntity().getId(); } catch (IOException e) { throw new RetryableException("Error adding page", e); } }
Source:
private Optional<JavaFileScannerContext.Location> flowFromCaughtException(ExplodedGraph.Edge edge) { ProgramPoint programPoint = edge.parent.programPoint; if (((CFG.Block) programPoint.block).isCatchBlock() && programPoint.i == 0) { VariableTree catchVariable = ((VariableTree) programPoint.syntaxTree()); SymbolicValue.CaughtExceptionSymbolicValue caughtSv = ((SymbolicValue.CaughtExceptionSymbolicValue) edge.child.programState.getValue(catchVariable.symbol())); Type exceptionType = caughtSv.exception().exceptionType(); return Optional.of(location(edge.parent, String.format("%s is caught.", exceptionName(exceptionType)))); } return Optional.empty(); }

Target:
private Optional<JavaFileScannerContext.Location> flowFromCaughtException(ExplodedGraph.Edge edge) { ProgramPoint programPoint = edge.parent.programPoint; if (((CFG.Block) programPoint.block).isCatchBlock() && programPoint.i == 0) { VariableTree catchVariable = ((VariableTree) programPoint.syntaxTree()); SymbolicValue.CaughtExceptionSymbolicValue caughtSv = ((SymbolicValue.CaughtExceptionSymbolicValue) edge.child.programState.getValue(catchVariable.symbol())); Preconditions.checkNotNull(caughtSv, "Caught exception not found in program state"); Type exceptionType = caughtSv.exception().exceptionType(); return Optional.of(location(edge.parent, String.format("%s is caught.", exceptionName(exceptionType)))); } return Optional.empty(); }
Source:
Graphics() { init0(Font.getDefaultFont()); }

Target:
Graphics() { }
Source:
public HandlerStatus onRead() { src.flip(); try { while (src.hasRemaining()) { boolean trusted = isEndpointTrusted(); boolean complete = activeReader.readFrom(src, trusted); if (!complete) { break; } ClientMessage.Frame firstFrame = activeReader.getClientMessage().getStartFrame(); int flags = firstFrame.flags; if (ClientMessage.isFlagSet(flags, UNFRAGMENTED_MESSAGE)) { handleMessage(activeReader.getClientMessage()); } else if (!trusted) { throw new IllegalStateException( "Fragmented client messages are not allowed before the client is authenticated."); } else { ClientMessage message = activeReader.getClientMessage(); ClientMessage.ForwardFrameIterator frameIterator = message.frameIterator(); frameIterator.next(); ClientMessage.Frame startFrame = frameIterator.next(); long fragmentationId = Bits.readLongL(firstFrame.content, FRAGMENTATION_ID_OFFSET); if (ClientMessage.isFlagSet(flags, BEGIN_FRAGMENT_FLAG)) { builderBySessionIdMap.put(fragmentationId, new ClientMessage(startFrame, message.getEndFrame())); } else if (ClientMessage.isFlagSet(flags, END_FRAGMENT_FLAG)) { ClientMessage clientMessage = mergeIntoExistingClientMessage(fragmentationId); handleMessage(clientMessage); } else { mergeIntoExistingClientMessage(fragmentationId); } } activeReader = new ClientMessageReader(maxMessageLength); } return CLEAN; } finally { compactOrClear(src); } }

Target:
public HandlerStatus onRead() { src.flip(); try { while (src.hasRemaining()) { boolean trusted = isEndpointTrusted(); boolean complete = activeReader.readFrom(src, trusted); if (!complete) { break; } ClientMessage.Frame firstFrame = activeReader.getClientMessage().getStartFrame(); int flags = firstFrame.flags; if (ClientMessage.isFlagSet(flags, UNFRAGMENTED_MESSAGE)) { handleMessage(activeReader.getClientMessage()); } else if (!trusted) { throw new IllegalStateException( "Fragmented client messages are not allowed before the client is authenticated."); } else { ClientMessage message = activeReader.getClientMessage(); message.dropFragmentationFrame(); long fragmentationId = Bits.readLongL(firstFrame.content, FRAGMENTATION_ID_OFFSET); if (ClientMessage.isFlagSet(flags, BEGIN_FRAGMENT_FLAG)) { builderBySessionIdMap.put(fragmentationId, message); } else if (ClientMessage.isFlagSet(flags, END_FRAGMENT_FLAG)) { ClientMessage clientMessage = mergeIntoExistingClientMessage(fragmentationId); handleMessage(clientMessage); } else { mergeIntoExistingClientMessage(fragmentationId); } } activeReader = new ClientMessageReader(maxMessageLength); } return CLEAN; } finally { compactOrClear(src); } }
Source:
public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method jMethod = getJMethod(method); Class<?>[] types = getTypes(method); if (types.length == 0) { throw new IllegalArgumentException( "Methods that consumes representations must receive just one argument"); } Gson gson = getGson(); Object[] params = new Object[types.length]; String[] parameterNames = paramNameProvider.parameterNamesFor(jMethod); try { String content = getContentOfStream(inputStream); logger.debug("json retrieved: {}", content); JsonParser parser = new JsonParser(); JsonObject root = (JsonObject) parser.parse(content); for (int i = 0; i < types.length; i++) { String name = parameterNames[i]; JsonElement node = root.get(name); if (isWithoutRoot(types, node)) { params[i] = gson.fromJson(root, types[i]); logger.info("json without root deserialized"); } else if(node != null){ params[i] = gson.fromJson(node, types[i]); } logger.debug("json deserialized: {}", params[i]); } } catch (Exception e) { throw new ResultException("Unable to deserialize data", e); } return params; }

Target:
public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method jMethod = method.getMethod(); Class<?>[] types = getTypes(method); if (types.length == 0) { throw new IllegalArgumentException( "Methods that consumes representations must receive just one argument"); } Gson gson = getGson(); Object[] params = new Object[types.length]; String[] parameterNames = paramNameProvider.parameterNamesFor(jMethod); try { String content = getContentOfStream(inputStream); logger.debug("json retrieved: {}", content); JsonParser parser = new JsonParser(); JsonObject root = (JsonObject) parser.parse(content); for (int i = 0; i < types.length; i++) { String name = parameterNames[i]; JsonElement node = root.get(name); if (isWithoutRoot(types, node)) { params[i] = gson.fromJson(root, types[i]); logger.info("json without root deserialized"); } else if(node != null){ params[i] = gson.fromJson(node, types[i]); } logger.debug("json deserialized: {}", params[i]); } } catch (Exception e) { throw new ResultException("Unable to deserialize data", e); } return params; }
Source:
public void testMigrationIsNeededOnData() { Version diagramSplitVersion = DRepresentationContainerToDViewMigrationParticipant.MIGRATION_VERSION; URI uri = URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + PATH + SESSION_RESOURCE_NAME, true); Version loadedVersion = checkRepresentationFileMigrationStatus(uri, true); assertTrue("The list migration must be required on test data.", diagramSplitVersion.compareTo(loadedVersion) > 0); checkFileContainsDRepresentationContainer(uri, true, "Test data should contain a DRepresentationContainer."); }

Target:
public void testMigrationIsNeededOnData() { Version dRepresentationContainerRemovalVersion = DRepresentationContainerToDViewMigrationParticipant.MIGRATION_VERSION; URI uri = URI.createPlatformPluginURI(SiriusTestsPlugin.PLUGIN_ID + PATH + SESSION_RESOURCE_NAME, true); Version loadedVersion = checkRepresentationFileMigrationStatus(uri, true); assertTrue("The DRepresentationContainer removal migration must be required on test data.", dRepresentationContainerRemovalVersion.compareTo(loadedVersion) > 0); checkFileContainsDRepresentationContainer(uri, true, "Test data should contain a DRepresentationContainer."); }
Source:
public Map<Long, ILogData> read(Iterable<Long> addresses, @NonNull ReadOptions options) { if (!options.isClientCacheable()) { return fetchAll(addresses, options); } final Map<Long, ILogData> cachedData = readCache.getAllPresent(addresses); final Set<Long> addressesToFetch = Sets.difference( Sets.newHashSet(addresses), cachedData.keySet()); final Map<Long, ILogData> uncachedData = fetchAll(addressesToFetch, options); final List<Long> trimmedAddresses = filterTrimmedAddresses(uncachedData, options); trimmedAddresses.forEach(uncachedData::remove); final Map<Long, ILogData> result = uncachedData.entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> cacheLoadAndGet(readCache, entry.getKey(), entry.getValue(), options))); result.putAll(cachedData); if (!trimmedAddresses.isEmpty()) { if (!options.isIgnoreTrim()) { throw new TrimmedException(trimmedAddresses); } log.warn("read: ignoring trimmed addresses {}", trimmedAddresses); } return result; }

Target:
public Map<Long, ILogData> read(Iterable<Long> addresses, @NonNull ReadOptions options) { final Map<Long, ILogData> cachedData = readCache.getAllPresent(addresses); final Set<Long> addressesToFetch = Sets.difference( Sets.newHashSet(addresses), cachedData.keySet()); final Map<Long, ILogData> uncachedData = fetchAll(addressesToFetch, options); final List<Long> trimmedAddresses = filterTrimmedAddresses(uncachedData); trimmedAddresses.forEach(uncachedData::remove); final Map<Long, ILogData> result = uncachedData.entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> cacheLoadAndGet(readCache, entry.getKey(), entry.getValue(), options))); result.putAll(cachedData); if (!trimmedAddresses.isEmpty()) { if (!options.isIgnoreTrim()) { throw new TrimmedException(trimmedAddresses); } log.warn("read: ignoring trimmed addresses {}", trimmedAddresses); } return result; }
Source:
public void setBeginShark() { this.setShark(new LaserShark(Position.middlePosition(), START_SIZE, START_SPEED, START_DIRECTION)); System.out.println("begin shark"); }

Target:
public void setBeginShark() { this.setShark(new LaserShark(Position.middlePosition(), START_SIZE, START_SPEED, START_DIRECTION)); }