auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String processPositionRequest() { final List<Object> positions = _fileProcessors.values().stream() .map(fileProcessor -> { final FilePositionKey key = fileProcessor.getPositionKey(); final FilePositionValue value = fileProcessor.getPositionValue(); return ImmutableMap.of("key", key, "value", value); }) .collect(Collectors.toList()); return JsonUtils.toJson(positions); }

Target:
private String processPositionRequest() { final List<Object> positions = _fileProcessors.values().stream() .map(processor -> ImmutableMap.of("key", processor.getPositionKey(), "value", processor.getPositionValue())) .collect(Collectors.toList()); return JsonUtils.toJson(positions); }
Source:
public boolean isEmitter(final String wireComponentPid) { requireNonNull(wireComponentPid, wireMessages.wireComponentPidNonNull()); final BundleContext context = FrameworkUtil.getBundle(WireHelperServiceImpl.class).getBundleContext(); final ServiceReference<?>[] refs = ServiceUtil.getServiceReferences(context, WireComponent.class, null); try { for (final ServiceReference<?> ref : refs) { final WireComponent wc = (WireComponent) context.getService(ref); if (ref.getProperty(KURA_SERVICE_PID).equals(wireComponentPid) && wc instanceof WireEmitter) { return true; } } } finally { ServiceUtil.ungetServiceReferences(context, refs); } return false; }

Target:
public boolean isEmitter(final String wireComponentPid) { requireNonNull(wireComponentPid, wireMessages.wireComponentPidNonNull()); final BundleContext context = FrameworkUtil.getBundle(WireHelperServiceImpl.class).getBundleContext(); final ServiceReference<?>[] refs = ServiceUtil.getServiceReferences(context, WireComponent.class, null); try { for (final ServiceReference<?> ref : refs) { if (ref.getProperty(KURA_SERVICE_PID).equals(wireComponentPid) && context.getService(ref) instanceof WireEmitter) { return true; } } } finally { ServiceUtil.ungetServiceReferences(context, refs); } return false; }
Source:
private static String readMapping() throws IOException, ParseException { JSONParser parser = new JSONParser(); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); InputStream inputStream = classloader.getResourceAsStream("mapping.json"); String mapping = IOUtils.toString(inputStream, "UTF-8"); Object object = parser.parse(mapping); JSONObject jsonObject = (JSONObject) object; return jsonObject.toJSONString(); }

Target:
private static String readMapping() throws ParseException { JSONParser parser = new JSONParser(); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); try (InputStream inputStream = classloader.getResourceAsStream("mapping.json")) { String mapping = IOUtils.toString(inputStream, "UTF-8"); Object object = parser.parse(mapping); JSONObject jsonObject = (JSONObject) object; return jsonObject.toJSONString(); } catch (IOException e) { logger.error(e); return ""; } }
Source:
public static Boolean isGz(String fName) { if (Strings.isNullOrEmpty(fName)) { return false; } return fName.endsWith(GZ_SUFFIX) && fName.length() > GZ_SUFFIX.length(); }

Target:
public static boolean isGz(String fName) { if (Strings.isNullOrEmpty(fName)) { return false; } return fName.endsWith(GZ_SUFFIX) && fName.length() > GZ_SUFFIX.length(); }
Source:
public void testupdateQueryWithParameters() { TestOutputOperator outputOperator = setupForOutputOperatorTest(); outputOperator.input.setup(tpc); outputOperator.setup(context); outputOperator.activate(context); UUID id = UUID.randomUUID(); TestPojo testPojo = new TestPojo(id, 20, "Laura", true, 10, 2.0, new HashSet<Integer>(), new ArrayList<Integer>(), null, new Date(System.currentTimeMillis())); outputOperator.beginWindow(0); outputOperator.input.process(testPojo); outputOperator.endWindow(); Assert.assertEquals("rows in db", 1, outputOperator.getNumOfEventsInStore()); String updateLastName = "Laurel"; String updateQuery = "update " + KEYSPACE + "." + TABLE_NAME + " set lastname='" + updateLastName + "' where id=?"; List<FieldInfo> fieldInfos = Lists.newArrayList(); fieldInfos.add(new FieldInfo("id", "id", null)); outputOperator.setQuery(updateQuery); outputOperator.setFieldInfos(fieldInfos); outputOperator.setup(context); outputOperator.activate(context); outputOperator.beginWindow(1); outputOperator.input.process(testPojo); outputOperator.endWindow(); String recordsQuery = "SELECT * from " + TABLE_NAME + ";"; ResultSet resultSetRecords = session.execute(recordsQuery); for (Row row : resultSetRecords) { Assert.assertEquals("Updated last name", updateLastName, row.getString("lastname")); } }

Target:
public void testupdateQueryWithParameters() throws InterruptedException { UUID id = UUID.fromString("94ab597c-a5ff-4997-8343-68993d446b14"); System.out.println(id); TestPojo testPojo = new TestPojo(id, 20, "Laura", true, 10, 2.0, new HashSet<Integer>(), new ArrayList<Integer>(), null, new Date(System.currentTimeMillis())); String insert = "INSERT INTO " + KEYSPACE + "." + TABLE_NAME + " (ID, age, lastname, test, floatValue, doubleValue)" + " VALUES (94ab597c-a5ff-4997-8343-68993d446b14, 20, 'Laura', true, 10, 2.0);"; session.execute(insert); String recordsQuery = "SELECT * from " + TABLE_NAME + ";"; ResultSet resultSetRecords = session.execute(recordsQuery); Row row = resultSetRecords.iterator().next(); Assert.assertEquals("Updated last name", "Laura", row.getString("lastname")); Thread.sleep(1000); String updateLastName = "Laurel"; String updateQuery = "update " + KEYSPACE + "." + TABLE_NAME + " set lastname='" + updateLastName + "' where id=?"; List<FieldInfo> fieldInfos = Lists.newArrayList(); fieldInfos.add(new FieldInfo("id", "id", null)); TestOutputOperator outputOperator = setupForOutputOperatorTest(); outputOperator.setQuery(updateQuery); outputOperator.setFieldInfos(fieldInfos); outputOperator.setup(context); outputOperator.input.setup(tpc); outputOperator.activate(context); outputOperator.beginWindow(1); outputOperator.input.process(testPojo); outputOperator.endWindow(); recordsQuery = "SELECT * from " + TABLE_NAME + ";"; resultSetRecords = session.execute(recordsQuery); row = resultSetRecords.iterator().next(); Assert.assertEquals("Updated last name", updateLastName, row.getString("lastname")); }
Source:
public void step_execution_time_is_measured() throws Throwable { Long duration = 1234L; TestStep step = new PickleTestStep("uri", mock(PickleStep.class), definitionMatch); when(bus.getTime()) .thenReturn(0L) .thenReturn(1234L); Result result = step.run(bus, language, scenario, false); assertEquals(duration, result.getDuration()); }

Target:
public void step_execution_time_is_measured() throws Throwable { Long duration = 1234L; TestStep step = new PickleTestStep("uri", mock(PickleStep.class), definitionMatch); when(bus.getTime()).thenReturn(0l, 1234l); when(bus.getTime()) .thenReturn(0L) .thenReturn(1234L); Result result = step.run(bus, language, scenario, false); assertEquals(duration, result.getDuration()); }
Source:
public void addRecords(List<CheckstyleRecord> newRecords, String filename) { if (!newRecords.isEmpty()) { newRecords.sort(new PositionOrderComparator()); final List<CheckstyleRecord> popped = records.put(filename, newRecords); if (popped != null) { final List<CheckstyleRecord> diff = produceDiff(popped, newRecords); if (diff.isEmpty()) { records.remove(filename); } else { records.put(filename, diff); } } } }

Target:
public void addRecords(List<CheckstyleRecord> newRecords, String filename) { if (!newRecords.isEmpty()) { if (threadingMode == ThreadingMode.SINGLE) { addNewRecords(newRecords, filename); } else { asyncTasks.add(CompletableFuture.runAsync(() -> { addNewRecords(newRecords, filename); })); } } }
Source:
public boolean isTestingData(String email){ boolean isTestingAccount = false; if(email.contains("tmt")){ isTestingAccount = true; } return isTestingAccount; }

Target:
public boolean isTestingData(String email){ boolean isTestingAccount = false; if(email.endsWith(".tmt")){ isTestingAccount = true; } return isTestingAccount; }
Source:
private boolean promptUser(PromptBehavior prompt) { return prompt == PromptBehavior.Always || prompt == PromptBehavior.REFRESH_SESSION || PromptBehavior.FORCE_PROMPT == prompt; }

Target:
private boolean promptUser(PromptBehavior prompt) { return prompt == PromptBehavior.Always || prompt == PromptBehavior.REFRESH_SESSION || prompt == PromptBehavior.FORCE_PROMPT; }
Source:
public ImmutableSet<E> getSubgraphContaining(E element, ImmutableSet<E> endPoints) { final ImmutableSet.Builder<E> builder = ImmutableSet.builder(); builder.addAll(graph.getSubgraphContaining(element, endPoints)); return builder.build(); }

Target:
public ImmutableSet<E> getSubgraphContaining(E element, ImmutableSet<E> endPoints) { return ImmutableSet.copyOf(graph.getSubgraphContaining(element, endPoints)); }
Source:
public void notifyRemoteServersOfCorruption() { corruptionNotifiers.forEach(this::submitTask); }

Target:
public void notifyRemoteServersOfCorruption() { corruptionNotifiers.forEach(this::reportCorruptionToRemote); }
Source:
public void testBuilderAppend() { CallerContext.Builder builder = new CallerContext.Builder("context1"); CallerContext context = builder.append("context2").append("key3", "value3", ":").build(); Assert.assertEquals(true, context.getContext().contains(CallerContext.ITEM_SEPARATOR)); String[] items = context.getContext().split(CallerContext.ITEM_SEPARATOR); Assert.assertEquals(3, items.length); Assert.assertEquals(true, items[2].equals("key3:value3")); }

Target:
public void testBuilderAppend() { Configuration conf = new Configuration(); conf.set(HADOOP_CALLER_CONTEXT_SEPARATOR_KEY, "$"); CallerContext.Builder builder = new CallerContext.Builder(null, conf); CallerContext context = builder.append("context1") .append("context2").append("key3", "value3").build(); Assert.assertEquals(true, context.getContext().contains("$")); String[] items = context.getContext().split("\\$"); Assert.assertEquals(3, items.length); Assert.assertEquals("key3:value3", items[2]); builder.append("$$"); Assert.assertEquals("context1$context2$key3:value3$$$", builder.build().getContext()); }
Source:
public SolrLoggerUsageEventListener() { solrLoggerService = new DSpace().getServiceManager().getServiceByName("solrLoggerService", SolrLoggerService.class); }

Target:
public SolrLoggerUsageEventListener() { solrLoggerService = StatisticsServiceFactory.getInstance().getSolrLoggerService(); }
Source:
public Response updateState(NodeState state) throws WebApplicationException { requireNonNull(state, "state is null"); switch (state) { case SHUTTING_DOWN: shutdownHandler.requestShutdown(); return Response.ok().build(); case CANCELLING_SHUTDOWN: shutdownHandler.requestCancelShutdown(); return Response.ok().build(); case ACTIVE: case INACTIVE: throw new WebApplicationException(Response .status(BAD_REQUEST) .type(MediaType.TEXT_PLAIN) .entity(format("Invalid state transition to %s", state)) .build()); default: return Response.status(BAD_REQUEST) .type(TEXT_PLAIN) .entity(format("Invalid state %s", state)) .build(); } }

Target:
public Response updateState(NodeState state) throws WebApplicationException { requireNonNull(state, "state is null"); switch (state) { case SHUTTING_DOWN: synchronized (shutdownHandler) { shutdownHandler.requestShutdown(); } return Response.ok().build(); case ACTIVE: synchronized (shutdownHandler) { if (shutdownHandler.isShutdownRequested()) { shutdownHandler.cancelShutdown(); return Response.ok().build(); } } throw new WebApplicationException(Response .status(BAD_REQUEST) .type(MediaType.TEXT_PLAIN) .entity(format("Invalid state transition to %s", state)) .build()); case INACTIVE: throw new WebApplicationException(Response .status(BAD_REQUEST) .type(MediaType.TEXT_PLAIN) .entity(format("Invalid state transition to %s", state)) .build()); default: return Response.status(BAD_REQUEST) .type(TEXT_PLAIN) .entity(format("Invalid state %s", state)) .build(); } }
Source:
static List<StartIdentifiedAtlasDbTransactionResponse> split(StartTransactionResponseV4 batchedResponse) { LockImmutableTimestampResponse immutableTsAndLock = batchedResponse.immutableTimestamp(); long[] startTimestamps = batchedResponse.timestamps().stream().toArray(); int partition = batchedResponse.timestamps().partition(); List<LockImmutableTimestampResponse> immutableTsAndLocks = LockTokenShare.share(immutableTsAndLock.getLock(), startTimestamps.length).stream() .map(token -> LockImmutableTimestampResponse.of(immutableTsAndLock.getImmutableTimestamp(), token)) .collect(Collectors.toList()); return IntStream.range(0, startTimestamps.length) .mapToObj(i -> StartIdentifiedAtlasDbTransactionResponse.of( immutableTsAndLocks.get(i), TimestampAndPartition.of(startTimestamps[i], partition) )) .collect(Collectors.toList()); }

Target:
static List<StartIdentifiedAtlasDbTransactionResponse> split(StartTransactionResponseV4 batchedResponse) { LockImmutableTimestampResponse immutableTsAndLock = batchedResponse.immutableTimestamp(); PartitionedTimestamps partitionedTimestamps = batchedResponse.timestamps(); int partition = partitionedTimestamps.partition(); Stream<LockImmutableTimestampResponse> immutableTsAndLocks = LockTokenShare.share(immutableTsAndLock.getLock(), partitionedTimestamps.count()).stream() .map(token -> LockImmutableTimestampResponse.of(immutableTsAndLock.getImmutableTimestamp(), token)); Stream<TimestampAndPartition> timestampAndPartitions = partitionedTimestamps.stream() .mapToObj(timestamp -> TimestampAndPartition.of(timestamp, partition)); return Streams.zip(immutableTsAndLocks, timestampAndPartitions, StartIdentifiedAtlasDbTransactionResponse::of) .collect(Collectors.toList()); }
Source:
private void registerBuiltinLFS() { Class<?> lfs; try { lfs = Class.forName("org.eclipse.jgit.lfs.BuiltinLFS"); if (lfs != null) { lfs.getMethod("register").invoke(null); } } catch (ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e1) { } }

Target:
private void registerBuiltinLFS() { Class<?> lfs; try { lfs = Class.forName("org.eclipse.jgit.lfs.BuiltinLFS"); if (lfs != null) { lfs.getMethod("register").invoke(null); } } catch (ClassNotFoundException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e1) { logWarning(CoreText.Activator_noBuiltinLfsSupportDetected, e1); } }
Source:
public Object toObject(byte[] bytes, int offset, int length, @SuppressWarnings("rawtypes") PDataType actualType, SortOrder sortOrder, Integer maxLength, Integer scale) { if (!actualType.isCoercibleTo(this)) { throwConstraintViolationException(actualType, this); } if (length == 0) { return null; } return getPhoenixJson(bytes, offset, length); }

Target:
public Object toObject(byte[] bytes, int offset, int length, @SuppressWarnings("rawtypes") PDataType actualType, SortOrder sortOrder, Integer maxLength, Integer scale) { Object object = PVarchar.INSTANCE.toObject(bytes, offset, length, actualType, sortOrder, maxLength, scale); return object == null ? object : getPhoenixJson(object.toString()); }
Source:
public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Integer tryTimeout, Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) { this.retryPolicyType = retryPolicyType == null ? RetryPolicyType.EXPONENTIAL : retryPolicyType; if (maxTries != null) { Utility.assertInBounds("maxRetries", maxTries, 1, Integer.MAX_VALUE); this.maxTries = maxTries; } else { this.maxTries = 4; } if (tryTimeout != null) { Utility.assertInBounds("getTryTimeout", tryTimeout, 1, Integer.MAX_VALUE); this.tryTimeout = tryTimeout; } else { this.tryTimeout = Integer.MAX_VALUE; } if ((retryDelayInMs == null && maxRetryDelayInMs != null) || (retryDelayInMs != null && maxRetryDelayInMs == null)) { throw logger.logExceptionAsError( new IllegalArgumentException("Both retryDelay and maxRetryDelay must be null or neither can be null")); } if (retryDelayInMs != null) { Utility.assertInBounds("getMaxRetryDelayInMs", maxRetryDelayInMs, 1, Long.MAX_VALUE); Utility.assertInBounds("getRetryDelayInMs", retryDelayInMs, 1, maxRetryDelayInMs); this.maxRetryDelayInMs = maxRetryDelayInMs; this.retryDelayInMs = retryDelayInMs; } else { switch (this.retryPolicyType) { case EXPONENTIAL: this.retryDelayInMs = TimeUnit.SECONDS.toMillis(4); break; case FIXED: this.retryDelayInMs = TimeUnit.SECONDS.toMillis(30); break; default: throw logger.logExceptionAsError(new IllegalArgumentException("Invalid 'RetryPolicyType'.")); } this.maxRetryDelayInMs = TimeUnit.SECONDS.toMillis(120); } this.secondaryHost = secondaryHost; }

Target:
public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Integer tryTimeout, Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) { this.retryPolicyType = retryPolicyType == null ? RetryPolicyType.EXPONENTIAL : retryPolicyType; if (maxTries != null) { Utility.assertInBounds("maxRetries", maxTries, 1, Integer.MAX_VALUE); this.maxTries = maxTries; } else { this.maxTries = 4; } if (tryTimeout != null) { Utility.assertInBounds("tryTimeout", tryTimeout, 1, Integer.MAX_VALUE); this.tryTimeout = tryTimeout; } else { this.tryTimeout = Integer.MAX_VALUE; } if ((retryDelayInMs == null && maxRetryDelayInMs != null) || (retryDelayInMs != null && maxRetryDelayInMs == null)) { throw logger.logExceptionAsError( new IllegalArgumentException("Both retryDelay and maxRetryDelay must be null or neither can be null")); } if (retryDelayInMs != null) { Utility.assertInBounds("maxRetryDelayInMs", maxRetryDelayInMs, 1, Long.MAX_VALUE); Utility.assertInBounds("retryDelayInMs", retryDelayInMs, 1, maxRetryDelayInMs); this.maxRetryDelayInMs = maxRetryDelayInMs; this.retryDelayInMs = retryDelayInMs; } else { switch (this.retryPolicyType) { case EXPONENTIAL: this.retryDelayInMs = TimeUnit.SECONDS.toMillis(4); break; case FIXED: this.retryDelayInMs = TimeUnit.SECONDS.toMillis(30); break; default: throw logger.logExceptionAsError(new IllegalArgumentException("Invalid 'RetryPolicyType'.")); } this.maxRetryDelayInMs = TimeUnit.SECONDS.toMillis(120); } this.secondaryHost = secondaryHost; }
Source:
public Object[][] intersectionTestCases() { final CRAIEntry basic = craiEntryForIntersectionTests(1, 1, 10); final CRAIEntry overlapBasic = craiEntryForIntersectionTests(1, 5, 10); final CRAIEntry insideBasic = craiEntryForIntersectionTests(1, 3, 5); final CRAIEntry otherSeq1 = craiEntryForIntersectionTests(2, 1, 10); final CRAIEntry otherSeq2 = craiEntryForIntersectionTests(2, 2, 10); final CRAIEntry zerospan = craiEntryForIntersectionTests(1, 1, 0); final CRAIEntry unmapped = craiEntryForIntersectionTests(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX, 1, 2); final CRAIEntry multi = craiEntryForIntersectionTests(ReferenceContext.MULTIPLE_REFERENCE_ID, 1, 2); return new Object[][]{ {basic, basic, true}, {basic, overlapBasic, true}, {basic, insideBasic, true}, {basic, otherSeq1, false}, {basic, otherSeq2, false}, {otherSeq1, otherSeq2, true}, {basic, zerospan, false}, {zerospan, zerospan, false}, {basic, unmapped, false}, {basic, multi, false}, {unmapped, multi, false}, {unmapped, unmapped, false}, {multi, multi, false}, }; }

Target:
public Object[][] intersectionTestCases() { final CRAIEntry basic = craiEntryForIntersectionTests(1, 1, 10); final CRAIEntry overlapBasic = craiEntryForIntersectionTests(1, 5, 10); final CRAIEntry insideBasic = craiEntryForIntersectionTests(1, 3, 5); final CRAIEntry otherSeq1 = craiEntryForIntersectionTests(2, 1, 10); final CRAIEntry otherSeq2 = craiEntryForIntersectionTests(2, 2, 10); final CRAIEntry zerospan = craiEntryForIntersectionTests(1, 1, 0); final CRAIEntry unmapped = craiEntryForIntersectionTests(ReferenceContext.UNMAPPED_UNPLACED_ID, 1, 2); return new Object[][]{ {basic, basic, true}, {basic, overlapBasic, true}, {basic, insideBasic, true}, {basic, otherSeq1, false}, {basic, otherSeq2, false}, {otherSeq1, otherSeq2, true}, {basic, zerospan, false}, {zerospan, zerospan, false}, {basic, unmapped, false}, {unmapped, unmapped, false}, }; }
Source:
public boolean isDone() { lockHandlers(); return future.isDone(); }

Target:
public boolean isDone() { freezeHandlers(); return future.isDone(); }
Source:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { if (!vm.getMigrationSupport().limitsMigration()) { Map<Guid, VDS> candidateHosts = new HashMap<>(); for (VDS host: hosts) { candidateHosts.put(host.getId(), host); } Set<Guid> allowedHosts = new HashSet<>(); if (vm.getMigrationSupport().allowsMigration() || vm.getRunOnVds() == null) { allowedHosts.addAll(vm.getDedicatedVmForVdsList()); } else { allowedHosts.add(vm.getRunOnVds()); } if (vm.getDedicatedVmForVdsList().size() > 0) { for (Iterator<Map.Entry<Guid, VDS>> it = candidateHosts.entrySet().iterator(); it.hasNext();) { Guid candidateGuid = it.next().getKey(); if (!allowedHosts.contains(candidateGuid)) { it.remove(); } } } return new ArrayList<>(candidateHosts.values()); } else { return hosts; } }

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { if (vm.getRunOnVds() == null || vm.getMigrationSupport().limitsMigration()) { Map<Guid, VDS> candidateHosts = new HashMap<>(); for (VDS host: hosts) { candidateHosts.put(host.getId(), host); } Set<Guid> allowedHosts = new HashSet<>(); if (vm.getMigrationSupport().allowsMigration() || vm.getRunOnVds() == null) { allowedHosts.addAll(vm.getDedicatedVmForVdsList()); } else { allowedHosts.add(vm.getRunOnVds()); } if (vm.getDedicatedVmForVdsList().size() > 0) { for (Iterator<Map.Entry<Guid, VDS>> it = candidateHosts.entrySet().iterator(); it.hasNext();) { Guid candidateGuid = it.next().getKey(); if (!allowedHosts.contains(candidateGuid)) { it.remove(); } } } return new ArrayList<>(candidateHosts.values()); } else { return hosts; } }
Source:
public byte[] get() { byte[] byteArray = null; synchronized (this) { byteArray = freeBuffers.poll(); if (byteArray == null && numBuffersInUse < maxBuffersInUse) { byteArray = new byte[bufferSize]; } if (byteArray != null) { numBuffersInUse++; return byteArray; } } try { byteArray = freeBuffers.take(); synchronized (this) { numBuffersInUse++; return byteArray; } } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } }

Target:
public byte[] get() { isPossibleToIssueNewBuffer(); byte[] byteArray = null; synchronized (this) { byteArray = freeBuffers.poll(); if (byteArray == null && isPossibleToIssueNewBuffer()) { byteArray = new byte[bufferSize]; } if (byteArray != null) { numBuffersInUse++; return byteArray; } } try { byteArray = freeBuffers.take(); synchronized (this) { numBuffersInUse++; return byteArray; } } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } }
Source:
public static network map(Network model, network template) { network entity = template != null ? template : new network(); if (model.isSetId()) { entity.setId(new Guid(model.getId())); } if (model.isSetName()) { entity.setname(model.getName()); } if (model.isSetDescription()) { entity.setdescription(model.getDescription()); } if (model.isSetStatus()) { entity.setStatus(map(NetworkStatus.fromValue(model.getStatus().getState()), null)); } if (model.isSetDataCenter() && model.getDataCenter().isSetId()) { entity.setstorage_pool_id(new Guid(model.getDataCenter().getId())); } if (model.isSetIp()) { if (model.getIp().isSetAddress()) { entity.setaddr(model.getIp().getAddress()); } if (model.getIp().isSetNetmask()) { entity.setsubnet(model.getIp().getNetmask()); } if (model.getIp().isSetGateway()) { entity.setgateway(model.getIp().getGateway()); } } if (model.isSetVlan() && model.getVlan().getId()!=null) { try { entity.setvlan_id(model.getVlan().getId()); } catch (NumberFormatException e) { } } if (model.isSetStp()) { entity.setstp(model.isStp()); } if (model.isSetDisplay()) { entity.setis_display(model.isDisplay()); } if (model.isSetUsages()) { entity.setVmNetwork(model.getUsages().contains(Usage.VM_NETWORK)); entity.setis_display(model.getUsages().contains(Usage.DISPLAY)); } return entity; }

Target:
public static network map(Network model, network template) { network entity = template != null ? template : new network(); if (model.isSetId()) { entity.setId(new Guid(model.getId())); } if (model.isSetName()) { entity.setname(model.getName()); } if (model.isSetDescription()) { entity.setdescription(model.getDescription()); } if (model.isSetStatus()) { entity.setStatus(map(NetworkStatus.fromValue(model.getStatus().getState()), null)); } if (model.isSetDataCenter() && model.getDataCenter().isSetId()) { entity.setstorage_pool_id(new Guid(model.getDataCenter().getId())); } if (model.isSetIp()) { if (model.getIp().isSetAddress()) { entity.setaddr(model.getIp().getAddress()); } if (model.getIp().isSetNetmask()) { entity.setsubnet(model.getIp().getNetmask()); } if (model.getIp().isSetGateway()) { entity.setgateway(model.getIp().getGateway()); } } if (model.isSetVlan() && model.getVlan().getId()!=null) { try { entity.setvlan_id(model.getVlan().getId()); } catch (NumberFormatException e) { } } if (model.isSetStp()) { entity.setstp(model.isStp()); } if (model.isSetUsages()) { List<NetworkUsage> networkUsages = new ArrayList<NetworkUsage>(); for (String usage : model.getUsages().getUsages()) { networkUsages.add(map(usage,null)); } entity.setis_display(networkUsages.contains(NetworkUsage.DISPLAY)); if (model.isSetDisplay()) { entity.setis_display(model.isDisplay()); } else { entity.setVmNetwork(networkUsages.contains(NetworkUsage.VM)); } } return entity; }
Source:
private void checkClusterAdditionalFeaturesSupported(VDSGroup cluster, VDS vds) { Set<SupportedAdditionalClusterFeature> clusterSupportedFeatures = clusterFeatureDao.getSupportedFeaturesByClusterId(cluster.getId()); Set<String> hostSupportedFeatures = hostFeatureDao.getSupportedHostFeaturesByHostId(vds.getId()); for (SupportedAdditionalClusterFeature feature : clusterSupportedFeatures) { if (feature.isEnabled() && !hostSupportedFeatures.contains(feature.getFeature().getName())) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("{UnSupportedFeature", feature.getFeature().getName()); reportNonOperationReason(NonOperationalReason.HOST_FEATURES_INCOMPATIBILE_WITH_CLUSTER, customLogValues); return; } } return; }

Target:
private void checkClusterAdditionalFeaturesSupported(VDSGroup cluster, VDS vds) { Set<SupportedAdditionalClusterFeature> clusterSupportedFeatures = clusterFeatureDao.getSupportedFeaturesByClusterId(cluster.getId()); Set<String> hostSupportedFeatures = hostFeatureDao.getSupportedHostFeaturesByHostId(vds.getId()); for (SupportedAdditionalClusterFeature feature : clusterSupportedFeatures) { if (feature.isEnabled() && !hostSupportedFeatures.contains(feature.getFeature().getName())) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("UnSupportedFeature", feature.getFeature().getName()); reportNonOperationReason(NonOperationalReason.HOST_FEATURES_INCOMPATIBILE_WITH_CLUSTER, customLogValues); return; } } return; }
Source:
private static void upgradeFrom2_9_0(XMLConfiguration config) { String old_key_name = ".markocurrences"; String new_key_name = ".markoccurrences"; config.getKeys() .forEachRemaining( key -> { if (key.endsWith(old_key_name)) { config.setProperty( key.replace(old_key_name, new_key_name), config.getProperty(key)); config.clearProperty(key); } }); }

Target:
static void upgradeFrom2_9_0(XMLConfiguration config) { String oldKeyName = ".markocurrences"; String newKeyName = ".markoccurrences"; config.getKeys() .forEachRemaining( key -> { if (key.endsWith(oldKeyName)) { config.setProperty( key.replace(oldKeyName, newKeyName), config.getProperty(key)); config.clearProperty(key); } }); }
Source:
public Work find(String workId, State state) { return lookup(workId).filter((work) -> { State workState = work.getWorkInstanceState(); return state == null ? (workState == State.SCHEDULED || workState == State.RUNNING) : workState == state; }).orElse(null); }

Target:
public Work find(String workId, State state) { return lookup(workId).filter(work -> workHasState(work, state)).orElse(null); }
Source:
public void saveGlobalProperty_shouldFailIfDefaultLocaleNotInAllowedLocaleList() { String localeList = "fr"; assertThat("localeList contains default locale but should not for this test case", localeList, not(containsString(LocaleUtility.getDefaultLocale().toString()))); expectedException.expect(APIException.class); expectedException.expectMessage("is not in allowed locales list"); adminService.saveGlobalProperty( new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE, localeList)); }

Target:
public void saveGlobalProperty_shouldFailIfDefaultLocaleNotInAllowedLocaleList() { Locale defaultLocale = new Locale("fr"); expectedException.expect(APIException.class); expectedException.expectMessage("is not in allowed locales list"); adminService.saveGlobalProperty( new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE, defaultLocale.toString())); }
Source:
public static JGitConfigServerTestData prepareClonedGitRepository(Collection<String> additionalProperties, Class... sources) throws Exception { String remoteUri = ConfigServerTestUtils.prepareLocalRepo(); File remoteRepoDir = ResourceUtils.getFile(remoteUri); Git remoteGit = Git.open(remoteRepoDir.getAbsoluteFile()); remoteGit.checkout().setName("master").call(); File clonedRepoDir = new File("target/repos/cloned"); if(clonedRepoDir.exists()) { FileUtils.deleteDirectory(clonedRepoDir); }else{ clonedRepoDir.mkdirs(); } Git clonedGit = Git.cloneRepository() .setURI( "file://" + remoteRepoDir.getAbsolutePath() ) .setDirectory( clonedRepoDir ) .setBranch("master") .setCloneAllBranches(true) .call(); String[] properties = additionalProperties.toArray(new String[0]); properties = ArrayUtils.add(properties, "spring.cloud.config.server.git.uri:" + "file://" + clonedRepoDir.getAbsolutePath()); ConfigurableApplicationContext context = new SpringApplicationBuilder(sources).web(WebApplicationType.NONE) .properties(properties) .run(); JGitEnvironmentRepository repository = context.getBean(JGitEnvironmentRepository.class); return new JGitConfigServerTestData( new JGitConfigServerTestData.LocalGit(remoteGit, remoteRepoDir), new JGitConfigServerTestData.LocalGit(clonedGit, clonedRepoDir), repository, context); }

Target:
public static JGitConfigServerTestData prepareClonedGitRepository(Collection<String> additionalProperties, Class... sources) throws Exception { String remoteUri = ConfigServerTestUtils.prepareLocalRepo(); File remoteRepoDir = ResourceUtils.getFile(remoteUri); Git remoteGit = Git.open(remoteRepoDir.getAbsoluteFile()); remoteGit.checkout().setName("master").call(); File clonedRepoDir = new File("target/repos/cloned"); if(clonedRepoDir.exists()) { FileSystemUtils.deleteRecursively(clonedRepoDir); } else { clonedRepoDir.mkdirs(); } Git clonedGit = Git.cloneRepository() .setURI( "file://" + remoteRepoDir.getAbsolutePath() ) .setDirectory( clonedRepoDir ) .setBranch("master") .setCloneAllBranches(true) .call(); Collection<String> properties = new ArrayList<>(additionalProperties); properties.add("spring.cloud.config.server.git.uri:" + "file://" + clonedRepoDir.getAbsolutePath()); ConfigurableApplicationContext context = new SpringApplicationBuilder(sources).web(WebApplicationType.NONE) .properties(properties.toArray(new String[0])) .run(); JGitEnvironmentRepository repository = context.getBean(JGitEnvironmentRepository.class); return new JGitConfigServerTestData( new JGitConfigServerTestData.LocalGit(remoteGit, remoteRepoDir), new JGitConfigServerTestData.LocalGit(clonedGit, clonedRepoDir), repository, context); }
Source:
public Response statusByDate(@PathParam("date") String date) throws Exception { JSONObject object = new JSONObject(); List<BackupMetadata> metadataLinkedList = this.completedBkups.locate(date); if (metadataLinkedList != null && !metadataLinkedList.isEmpty()) { BackupMetadata bkupMetadata = metadataLinkedList.get(0); if (bkupMetadata == null ) { object.put("Snapshotstatus", false); } else { if (!bkupMetadata.getStatus().equals(Status.FINISHED) ){ object.put("Snapshotstatus", false); } else { object.put("Snapshotstatus", true); } } String token = bkupMetadata.getToken(); if (token != null && !token.isEmpty()) { object.put("token", bkupMetadata.getToken()); } else { object.put("token", "not available"); } if (bkupMetadata.getStart() != null) { object.put("starttime", DateUtil.formatyyyyMMddHHmm(bkupMetadata.getStart())); } else { object.put("starttime", "not available"); } if (bkupMetadata.getCompleted() != null) { object.put("completetime", DateUtil.formatyyyyMMddHHmm(bkupMetadata.getCompleted())); } else { object.put("completetime", "not_available"); } } else { object.put("Snapshotstatus", false); String token = SystemUtils.getDataFromUrl("http://localhost:8080/Priam/REST/v1/cassconfig/get_token"); if (token != null && !token.isEmpty()) { object.put("token", token); } else { object.put("token", "not available"); } } return Response.ok(object.toString(), MediaType.APPLICATION_JSON).build(); }

Target:
public Response statusByDate(@PathParam("date") String date) throws Exception { JSONObject object = new JSONObject(); List<BackupMetadata> metadataLinkedList = this.completedBkups.locate(date); if (metadataLinkedList != null && !metadataLinkedList.isEmpty()) { BackupMetadata bkupMetadata = metadataLinkedList.get(0); object.put("Snapshotstatus", bkupMetadata.getStatus().equals(Status.FINISHED)); String token = bkupMetadata.getToken(); if (token != null && !token.isEmpty()) { object.put("token", bkupMetadata.getToken()); } else { object.put("token", "not available"); } if (bkupMetadata.getStart() != null) { object.put("starttime", DateUtil.formatyyyyMMddHHmm(bkupMetadata.getStart())); } else { object.put("starttime", "not available"); } if (bkupMetadata.getCompleted() != null) { object.put("completetime", DateUtil.formatyyyyMMddHHmm(bkupMetadata.getCompleted())); } else { object.put("completetime", "not_available"); } } else { object.put("Snapshotstatus", false); String token = SystemUtils.getDataFromUrl("http://localhost:8080/Priam/REST/v1/cassconfig/get_token"); if (token != null && !token.isEmpty()) { object.put("token", token); } else { object.put("token", "not available"); } } return Response.ok(object.toString(), MediaType.APPLICATION_JSON).build(); }
Source:
private SearchResponse runSearch(String filename, String content) throws IOException { logger.info(" -> Testing if file has been indexed correctly{}.", filename, content == null ? "" : " and contains [" + content + "]"); String fullQuery = "+file.filename:\"" + filename + "\""; if (content != null) { fullQuery += " +content:" + content; } SearchResponse response = elasticsearchClient.search("fscrawler_test_all_documents", null, fullQuery, 10, "*"); assertThat(response.getHits().getTotal(), is(1L)); return response; }

Target:
private SearchResponse runSearch(String filename, String content) throws IOException { logger.info(" -> Testing if file has been indexed correctly{}.", filename, content == null ? "" : " and contains [" + content + "]"); String fullQuery = "+file.filename:\"" + filename + "\""; if (content != null) { fullQuery += " +content:" + content; } SearchResponse response = elasticsearchClient.search("fscrawler_test_all_documents", null, fullQuery, 10, null); assertThat(response.getHits().getTotal(), is(1L)); return response; }
Source:
public int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) { int tableSize = computeTableSize(inputLength); Arrays.fill(table, 0, tableSize, 0); long inputAddress = ARRAY_BYTE_BASE_OFFSET + inputOffset; long outputAddress = ARRAY_BYTE_BASE_OFFSET + outputOffset; return Lz4RawCompressor.compress(input, inputAddress, inputLength, output, outputAddress, maxOutputLength, table, tableSize); }

Target:
public int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) { long inputAddress = ARRAY_BYTE_BASE_OFFSET + inputOffset; long outputAddress = ARRAY_BYTE_BASE_OFFSET + outputOffset; return Lz4RawCompressor.compress(input, inputAddress, inputLength, output, outputAddress, maxOutputLength, table); }
Source:
void submitPutBlobOperation(BlobProperties blobProperties, byte[] userMetaData, ReadableStreamChannel channel, FutureResult<String> futureResult, Callback<String> callback) { try { PutOperation putOperation = new PutOperation(routerConfig, routerMetrics, clusterMap, responseHandler, blobProperties, userMetaData, channel, futureResult, callback, time); putOperations.add(putOperation); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.operationAbortCount.inc(); routerMetrics.putBlobErrorCount.inc(); routerMetrics.countError(e); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }

Target:
void submitPutBlobOperation(BlobProperties blobProperties, byte[] userMetaData, ReadableStreamChannel channel, FutureResult<String> futureResult, Callback<String> callback) { try { PutOperation putOperation = new PutOperation(routerConfig, routerMetrics, clusterMap, responseHandler, blobProperties, userMetaData, channel, futureResult, callback, time); putOperations.add(putOperation); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.putBlobErrorCount.inc(); routerMetrics.countError(e); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }
Source:
public float computeDistanceToOut(Transform xf, Vec2 p, int childIndex, Vec2 normalOut) { float xfqc = xf.q.c; float xfqs = xf.q.s; float xfpx = xf.p.x; float xfpy = xf.p.y; float v1x = (xfqc * m_vertex1.x - xfqs * m_vertex1.y) + xfpx; float v1y = xfqs * m_vertex1.x + xfqc * m_vertex1.y + xfpy; float v2x = (xfqc * m_vertex2.x - xfqs * m_vertex2.y) + xfpx; float v2y = xfqs * m_vertex2.x + xfqc * m_vertex2.y + xfpy; float dx = p.x - v1x; float dy = p.y - v1y; float sx = v2x - v1x; float sy = v2y - v1y; float ds = dx * sx + dy * sy; if (ds > 0) { float s2 = sx * sx + sy * sy; if (ds > s2) { dx = p.x - v2x; dy = p.y - v2y; } else { dx -= ds / s2 * sx; dy -= ds / s2 * sy; } } float d1 = JBoxUtils.sqrt(dx * dx + dy * dy); if (d1 > 0) { normalOut.x = 1 / d1 * dx; normalOut.y = 1 / d1 * dy; } else { normalOut.x = 0; normalOut.y = 0; } return d1; }

Target:
public float computeDistanceToOut(Transform xf, Vec2 p, int childIndex, Vec2 normalOut) { float xfqc = xf.q.c; float xfqs = xf.q.s; float xfpx = xf.p.x; float xfpy = xf.p.y; float v1x = (xfqc * m_vertex1.x - xfqs * m_vertex1.y) + xfpx; float v1y = (xfqs * m_vertex1.x + xfqc * m_vertex1.y) + xfpy; float v2x = (xfqc * m_vertex2.x - xfqs * m_vertex2.y) + xfpx; float v2y = xfqs * m_vertex2.x + xfqc * m_vertex2.y + xfpy; float dx = p.x - v1x; float dy = p.y - v1y; float sx = v2x - v1x; float sy = v2y - v1y; float ds = dx * sx + dy * sy; if (ds > 0) { float s2 = sx * sx + sy * sy; if (ds > s2) { dx = p.x - v2x; dy = p.y - v2y; } else { dx -= ds / s2 * sx; dy -= ds / s2 * sy; } } float d1 = JBoxUtils.sqrt(dx * dx + dy * dy); if (d1 > 0) { normalOut.x = 1 / d1 * dx; normalOut.y = 1 / d1 * dy; } else { normalOut.x = 0; normalOut.y = 0; } return d1; }
Source:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int magic = in.readInt(); int fileVersionNumber = in.readInt(); if (magic != MAGIC_NUMBER) { fileVersionNumber = 0; } long lsb = in.readLong(); long msb = in.readLong(); worldUid = new UUID(msb, lsb); cx = in.readInt(); cz = in.readInt(); if (fileVersionNumber == CURRENT_VERSION) { int size; AtomicIntegerArray data = this.data = new AtomicIntegerArray(size = in.readInt()); worldHeight = size / PAGE_SIZE; for (int i = 0; i < size; i++) { data.set(i, in.readInt()); } } else { boolean[][][] st = (boolean[][][]) in.readObject(); int wh; this.data = new AtomicIntegerArray((wh = worldHeight = st[0][0].length) * PAGE_SIZE); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { for (int y = 0; y < wh; y++) { set(x, y, z, st[x][z][y]); } } } } if (fileVersionNumber < 5) { fixArray(); dirty = true; } }

Target:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { int magic = in.readInt(); int fileVersionNumber = in.readInt(); if (magic != MAGIC_NUMBER) { fileVersionNumber = 0; } long lsb = in.readLong(); long msb = in.readLong(); worldUid = new UUID(msb, lsb); cx = in.readInt(); cz = in.readInt(); if (fileVersionNumber == CURRENT_VERSION) { int size; AtomicIntegerArray data = this.data = new AtomicIntegerArray(size = in.readInt()); if ((size % PAGE_SIZE) != 0) throw new InvalidObjectException("Illegal data length"); worldHeight = size / PAGE_SIZE; for (int i = 0; i < size; i++) { data.set(i, in.readInt()); } } else { boolean[][][] st = (boolean[][][]) in.readObject(); int wh; this.data = new AtomicIntegerArray((wh = worldHeight = st[0][0].length) * PAGE_SIZE); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { for (int y = 0; y < wh; y++) { set(x, y, z, st[x][z][y]); } } } } if (fileVersionNumber < 5) { fixArray(); dirty = true; } }
Source:
protected void parseAsYaml(String fileURI, InputStream inputStream) { Map<String, Object> parsed = getYamlParser().load(inputStream); cache.put(fileURI, parsed); }

Target:
protected void parseAsYaml(String fileURI, InputStream inputStream) { Map<String, Object> parsed = new Yaml().load(inputStream); cache.put(fileURI, parsed); }
Source:
public QuotaBalanceVO findLaterBalanceEntry(final Long accountId, final Long domainId, final Date afterThis) { return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaBalanceVO>() { @Override public QuotaBalanceVO doInTransaction(final TransactionStatus status) { List<QuotaBalanceVO> quotaBalanceEntries = new ArrayList<>(); Filter filter = new Filter(QuotaBalanceVO.class, "updatedOn", true, 0L, 1L); SearchCriteria<QuotaBalanceVO> sc = createSearchCriteria(); sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId); sc.addAnd("creditsId", SearchCriteria.Op.EQ, 0); sc.addAnd("updatedOn", SearchCriteria.Op.GT, afterThis); quotaBalanceEntries = search(sc, filter); return quotaBalanceEntries.size() > 0 ? quotaBalanceEntries.get(0) : null; } }); }

Target:
public QuotaBalanceVO findLaterBalanceEntry(final Long accountId, final Long domainId, final Date afterThis) { return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<QuotaBalanceVO>() { @Override public QuotaBalanceVO doInTransaction(final TransactionStatus status) { List<QuotaBalanceVO> quotaBalanceEntries = new ArrayList<>(); Filter filter = new Filter(QuotaBalanceVO.class, "updatedOn", true, 0L, 1L); QueryBuilder<QuotaBalanceVO> qb = QueryBuilder.create(QuotaBalanceVO.class); qb.and(qb.entity().getAccountId(), SearchCriteria.Op.EQ, accountId); qb.and(qb.entity().getDomainId(), SearchCriteria.Op.EQ, domainId); qb.and(qb.entity().getCreditsId(), SearchCriteria.Op.EQ, 0); qb.and(qb.entity().getUpdatedOn(), SearchCriteria.Op.GT, afterThis); quotaBalanceEntries = search(qb.create(), filter); return quotaBalanceEntries.size() > 0 ? quotaBalanceEntries.get(0) : null; } }); }
Source:
public void invoke(KafkaTransactionState transaction, IN next, Context context) throws FlinkKafkaException { checkErroneous(); Long timestamp = context.timestamp(); int[] partitions = getPartitions(transaction); int partitionIndex; try { partitionIndex = KeyGroupRangeAssignment .assignKeyToParallelOperator(keySelector.getKey(next), partitions.length, partitions.length); } catch (Exception e) { throw new RuntimeException("Fail to assign a partition number to record"); } ProducerRecord<byte[], byte[]> record = new ProducerRecord<>( defaultTopicId, partitionIndex, timestamp, null, kafkaSerializer.serializeRecord(next, timestamp)); pendingRecords.incrementAndGet(); transaction.getProducer().send(record, callback); }

Target:
public void invoke(KafkaTransactionState transaction, IN next, Context context) throws FlinkKafkaException { checkErroneous(); Long timestamp = context.timestamp(); int[] partitions = getPartitions(transaction); int partitionIndex; try { partitionIndex = KeyGroupRangeAssignment .assignKeyToParallelOperator(keySelector.getKey(next), partitions.length, partitions.length); } catch (Exception e) { throw new RuntimeException("Fail to assign a partition number to record", e); } ProducerRecord<byte[], byte[]> record = new ProducerRecord<>( defaultTopicId, partitionIndex, timestamp, null, kafkaSerializer.serializeRecord(next, timestamp)); pendingRecords.incrementAndGet(); transaction.getProducer().send(record, callback); }
Source:
public boolean eval(Row row) { Object metricVal = row.getRaw(aggregationName); if (metricVal == null || value == null) { return metricVal == null && value == null; } return HavingSpecMetricComparator.compare(row, aggregationName, value, aggregators) == 0; }

Target:
public boolean eval(Row row) { Object metricVal = row.getRaw(aggregationName); if (metricVal == null || value == null) { return metricVal == null && value == null; } return HavingSpecMetricComparator.compare(aggregationName, value, aggregators, metricVal) == 0; }
Source:
public PriorPaymentControlResult priorCall(final PaymentControlContext paymentControlContext, final Iterable<PluginProperty> pluginProperties) throws PaymentControlApiException { final TransactionType transactionType = paymentControlContext.getTransactionType(); Preconditions.checkArgument(paymentControlContext.getPaymentApiType() == PaymentApiType.PAYMENT_TRANSACTION); Preconditions.checkArgument(transactionType == TransactionType.PURCHASE || transactionType == TransactionType.REFUND || transactionType == TransactionType.CHARGEBACK); final InternalCallContext internalContext = internalCallContextFactory.createInternalCallContext(paymentControlContext.getAccountId(), paymentControlContext); switch (transactionType) { case PURCHASE: return (paymentControlContext.getPaymentMethodId() != null) ? getPluginPurchaseResult(paymentControlContext, pluginProperties, internalContext) : new DefaultPriorPaymentControlResult(true); case REFUND: return getPluginRefundResult(paymentControlContext, pluginProperties, internalContext); case CHARGEBACK: return new DefaultPriorPaymentControlResult(false, paymentControlContext.getAmount()); default: throw new IllegalStateException("Unexpected transactionType " + transactionType); } }

Target:
public PriorPaymentControlResult priorCall(final PaymentControlContext paymentControlContext, final Iterable<PluginProperty> pluginProperties) throws PaymentControlApiException { final TransactionType transactionType = paymentControlContext.getTransactionType(); Preconditions.checkArgument(paymentControlContext.getPaymentApiType() == PaymentApiType.PAYMENT_TRANSACTION); Preconditions.checkArgument(transactionType == TransactionType.PURCHASE || transactionType == TransactionType.REFUND || transactionType == TransactionType.CHARGEBACK); final InternalCallContext internalContext = internalCallContextFactory.createInternalCallContext(paymentControlContext.getAccountId(), paymentControlContext); switch (transactionType) { case PURCHASE: return getPluginPurchaseResult(paymentControlContext, pluginProperties, internalContext); case REFUND: return getPluginRefundResult(paymentControlContext, pluginProperties, internalContext); case CHARGEBACK: return new DefaultPriorPaymentControlResult(false, paymentControlContext.getAmount()); default: throw new IllegalStateException("Unexpected transactionType " + transactionType); } }
Source:
public long getFilePageId( long pageRef ) { long filePageId = UnsafeUtil.getLong( offFilePageId( pageRef ) ) >>> 24; return filePageId == MAX_FILE_PAGE_ID ? PageCursor.UNBOUND_PAGE_ID : filePageId; }

Target:
public long getFilePageId( long pageRef ) { long filePageId = UnsafeUtil.getLong( offFilePageId( pageRef ) ) >>> SHIFT_FILE_PAGE_ID; return filePageId == MAX_FILE_PAGE_ID ? PageCursor.UNBOUND_PAGE_ID : filePageId; }
Source:
public ListOffsetsResultInfo(long offset, long timestamp, Optional<Integer> leaderEpoch) { this.offset = offset; this.timestamp = timestamp; this.leaderEpoch = leaderEpoch; }

Target:
ListOffsetsResultInfo(long offset, long timestamp, Optional<Integer> leaderEpoch) { this.offset = offset; this.timestamp = timestamp; this.leaderEpoch = leaderEpoch; }