auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { PlayerList players = game.getState().getPlayerList(controller.getId()); for (UUID playerId : players) { Player player = game.getPlayer(playerId); if (player != null) { int landCount = game.getBattlefield().countAll(new FilterControlledLandPermanent(), player.getId(), game); if (landCount > 5) { TargetControlledPermanent target = new TargetControlledPermanent(5, 5, new FilterControlledLandPermanent("lands to keep"), true); if (target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game)) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), player.getId(), source.getSourceId(), game)) { if (permanent != null && !target.getTargets().contains(permanent.getId())) { permanent.sacrifice(source.getId(), game); } } } } else if (landCount < 5) { FilterLandPermanent filter = new FilterLandPermanent(); filter.add(new ControllerPredicate(TargetController.YOU)); int amount = 5 - landCount; TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterBasicLandCard()); if (player.searchLibrary(target, game)) { player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); } player.shuffleLibrary(source, game); } } } return true; } return false; }

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { PlayerList players = game.getState().getPlayersInRange(controller.getId(),game); for (UUID playerId : players) { Player player = game.getPlayer(playerId); if (player != null) { int landCount = game.getBattlefield().countAll(new FilterControlledLandPermanent(), player.getId(), game); if (landCount > 5) { TargetControlledPermanent target = new TargetControlledPermanent(5, 5, new FilterControlledLandPermanent("lands to keep"), true); if (target.choose(Outcome.Sacrifice, player.getId(), source.getSourceId(), game)) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledLandPermanent(), player.getId(), source.getSourceId(), game)) { if (permanent != null && !target.getTargets().contains(permanent.getId())) { permanent.sacrifice(source.getId(), game); } } } } else if (landCount < 5) { FilterLandPermanent filter = new FilterLandPermanent(); filter.add(new ControllerPredicate(TargetController.YOU)); int amount = 5 - landCount; TargetCardInLibrary target = new TargetCardInLibrary(0, amount, new FilterBasicLandCard()); if (player.searchLibrary(target, game)) { player.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null); } player.shuffleLibrary(source, game); } } } return true; } return false; }
Source:
public void setProperty(JMeterProperty property) { if (!(property instanceof StringProperty)) { super.setProperty(property); return; } final String propName = property.getName(); if (!"shareMode".equals(propName)) { super.setProperty(property); return; } final String propValue = property.getStringValue(); if (!propValue.contains(" ")) { super.setProperty(property); return; } try { ResourceBundle rb = (ResourceBundle) Introspector .getBeanInfo(this.getClass()) .getBeanDescriptor() .getValue(GenericTestBeanCustomizer.RESOURCE_BUNDLE); Optional<String> first = Arrays.stream(CSVDataSetBeanInfo.getShareTags()) .filter(resKey -> propValue.equals(rb.getString(resKey))) .findFirst(); if (first.isPresent()) { ((StringProperty) property).setValue(first.get()); } else { log.warn("Could not translate {}={} using Locale: {}", propName, propValue, rb.getLocale()); } } catch (IntrospectionException e) { log.error("Could not find BeanInfo; cannot translate shareMode entries", e); } super.setProperty(property); }

Target:
public void setProperty(JMeterProperty property) { if (!(property instanceof StringProperty)) { super.setProperty(property); return; } final String propName = property.getName(); if (!"shareMode".equals(propName)) { super.setProperty(property); return; } final String propValue = property.getStringValue(); if (propValue.contains(" ")) { try { final BeanInfo beanInfo = Introspector.getBeanInfo(this.getClass()); final ResourceBundle rb = (ResourceBundle) beanInfo.getBeanDescriptor().getValue(GenericTestBeanCustomizer.RESOURCE_BUNDLE); for (String resKey : CSVDataSetBeanInfo.getShareTags()) { if (propValue.equals(rb.getString(resKey))) { if (log.isDebugEnabled()) { log.debug("Converted {}={} to using Locale: {}", propName, propValue, resKey, rb.getLocale()); } ((StringProperty) property).setValue(resKey); super.setProperty(property); return; } } log.warn("Could not translate {}={} using Locale: {}", propName, propValue, rb.getLocale()); } catch (IntrospectionException e) { log.error("Could not find BeanInfo; cannot translate shareMode entries", e); } } super.setProperty(property); }
Source:
public void emptyPartitionOverrideTest() throws Exception { if (overrideEnabled) { metricRegistry = new MetricRegistry(); ClusterMap clusterManagerWithEmptyRecord = new HelixClusterManager(clusterMapConfig, hostname, new MockHelixManagerFactory(helixCluster, null, null), metricRegistry); Set<String> writableInClusterManager = new HashSet<>(); for (PartitionId partition : clusterManagerWithEmptyRecord.getWritablePartitionIds(null)) { String partitionStr = useComposite ? ((Partition) partition).toPathString() : ((AmbryPartition) partition).toPathString(); writableInClusterManager.add(partitionStr); } Set<String> writableInCluster = helixCluster.getWritablePartitions(); if (writableInCluster.isEmpty()) { writableInCluster = helixCluster.getAllWritablePartitions(); } assertEquals("Mismatch in writable partitions during initialization", writableInCluster, writableInClusterManager); } }

Target:
public void emptyPartitionOverrideTest() throws Exception { assumeTrue(overrideEnabled); metricRegistry = new MetricRegistry(); ClusterMap clusterManagerWithEmptyRecord = new HelixClusterManager(clusterMapConfig, hostname, new MockHelixManagerFactory(helixCluster, null, null), metricRegistry); Set<String> writableInClusterManager = new HashSet<>(); for (PartitionId partition : clusterManagerWithEmptyRecord.getWritablePartitionIds(null)) { String partitionStr = useComposite ? ((Partition) partition).toPathString() : ((AmbryPartition) partition).toPathString(); writableInClusterManager.add(partitionStr); } Set<String> writableInCluster = helixCluster.getWritablePartitions(); if (writableInCluster.isEmpty()) { writableInCluster = helixCluster.getAllWritablePartitions(); } assertEquals("Mismatch in writable partitions during initialization", writableInCluster, writableInClusterManager); }
Source:
public static void startKafkaStreamsAndWaitForRunningState(final KafkaStreams kafkaStreams, final long timeoutMs) { final CountDownLatch countDownLatch = new CountDownLatch(1); kafkaStreams.setStateListener((newState, oldState) -> { if (newState == KafkaStreams.State.RUNNING) { countDownLatch.countDown(); } }); kafkaStreams.start(); try { countDownLatch.await(timeoutMs, TimeUnit.MILLISECONDS); } catch (final InterruptedException interruptedException) { throw new AssertionError("KafkaStreams did not transit to RUNNING state within " + timeoutMs + " milli seconds."); } }

Target:
public static void startKafkaStreamsAndWaitForRunningState(final KafkaStreams kafkaStreams, final long timeoutMs) throws InterruptedException { final CountDownLatch countDownLatch = new CountDownLatch(1); kafkaStreams.setStateListener((newState, oldState) -> { if (newState == KafkaStreams.State.RUNNING) { countDownLatch.countDown(); } }); kafkaStreams.start(); assertThat( "KafkaStreams did not transit to RUNNING state within " + timeoutMs + " milli seconds.", countDownLatch.await(timeoutMs, TimeUnit.MILLISECONDS), equalTo(true)); }
Source:
private JsonObject parseStringToJson(String string) { InputStream inputStream = new ByteArrayInputStream(string.getBytes(StandardCharsets.UTF_8)); JsonReader jsonReader = Json.createReader(inputStream); JsonObject parsedObject = jsonReader.readObject(); jsonReader.close(); return parsedObject; }

Target:
private JsonObject parseStringToJson(String string) { StringReader reader = new StringReader(string); JsonReader jsonReader = Json.createReader(reader); JsonObject parsedObject = jsonReader.readObject(); jsonReader.close(); return parsedObject; }
Source:
@Override public String getUnderFSType() { LOG.debug("getUnderFSType"); return "b2"; }

Target:
public String getUnderFSType() { return "b2"; }
Source:
private GoogleCloudStorageDivolteFile(final String fileName) throws IOException { this.buffer = new AvroRecordBuffer[recordBufferSize]; this.inflightName = inflightDir + GCS_PATH_SEPARATOR_CHAR + fileName; this.inflightPartialName = inflightName + PART_CLASSIFIER; this.inflightNameEncoded = URLEncoder.encode(inflightName, URL_ENCODING); this.inflightPartialNameEncoded = inflightNameEncoded + PART_CLASSIFIER; this.publishNameEncoded = URLEncoder.encode(publishDir + GCS_PATH_SEPARATOR_CHAR + fileName, URL_ENCODING); final URL remoteFileUrl = uploadUrlFor(bucketEncoded, inflightNameEncoded); final HttpURLConnection connection = setupUrlConnection(POST, remoteFileUrl, true, AVRO_CONTENT_TYPE_HEADER); final OutputStream os = connection.getOutputStream(); avroTargetStream = new DynamicDelegatingOutputStream(); avroTargetStream.attachDelegate(os); writer = new DataFileWriter<GenericRecord>(new GenericDatumWriter<>(schema)).create(schema, avroTargetStream); writer.flush(); avroTargetStream.detachDelegate(); os.flush(); os.close(); final GcsObjectResponse response = parseResponse(GcsObjectResponse.class, connection); logger.debug("Google Cloud Storage upload response {}", response); partWritten = false; }

Target:
private GoogleCloudStorageDivolteFile(final String fileName) throws IOException { this.buffer = new AvroRecordBuffer[recordBufferSize]; this.inflightName = inflightDir + GCS_PATH_SEPARATOR_CHAR + fileName; this.inflightPartialName = inflightName + PART_CLASSIFIER; this.inflightNameEncoded = URLEncoder.encode(inflightName, URL_ENCODING); this.inflightPartialNameEncoded = inflightNameEncoded + PART_CLASSIFIER; this.publishNameEncoded = URLEncoder.encode(publishDir + GCS_PATH_SEPARATOR_CHAR + fileName, URL_ENCODING); final URL remoteFileUrl = uploadUrlFor(bucketEncoded, inflightNameEncoded); final HttpURLConnection connection = setupUrlConnection(POST, remoteFileUrl, true, AVRO_CONTENT_TYPE_HEADER); final OutputStream os = connection.getOutputStream(); avroTargetStream = new DynamicDelegatingOutputStream(); avroTargetStream.attachDelegate(os); try { writer = new DataFileWriter<GenericRecord>(new GenericDatumWriter<>(schema)).create(schema, avroTargetStream); writer.flush(); } finally { avroTargetStream.detachDelegate(); } os.close(); final GcsObjectResponse response = parseResponse(GcsObjectResponse.class, connection); logger.debug("Google Cloud Storage upload response {}", response); partWritten = false; }
Source:
public void testNoReconnectAfterEventSinkClose() throws Exception { List<String> results = new ArrayList<String>(); Client client = new ResteasyClientBuilder().connectionPoolSize(10).build(); WebTarget target = client.target(generateURL("/service/server-sent-events/closeAfterSent")); SseEventSourceImpl sourceImpl = (SseEventSourceImpl)SseEventSource.target(target).build(); sourceImpl.setAlwasyReconnect(false); try (SseEventSource source = sourceImpl) { source.register(event -> results.add(event.readData())); source.open(); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } Assert.assertEquals("Received unexpected events", "[thing1, thing2, thing3]", results.toString()); results.clear(); WebTarget target2 = client.target(generateURL("/service/server-sent-events/closeAfterSent")); SseEventSourceImpl sourceImpl2 = (SseEventSourceImpl)SseEventSource.target(target2).build(); sourceImpl2.setAlwasyReconnect(false); try (SseEventSource source = sourceImpl2) { source.register(event -> results.add(event.readData())); source.open(); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } Assert.assertEquals("Received unexpected events", "[thing1, thing2, thing3]", results.toString()); }

Target:
public void testNoReconnectAfterEventSinkClose() throws Exception { List<String> results = new ArrayList<String>(); Client client = new ResteasyClientBuilder().connectionPoolSize(10).build(); WebTarget target = client.target(generateURL("/service/server-sent-events/closeAfterSent")); SseEventSourceImpl sourceImpl = (SseEventSourceImpl)SseEventSource.target(target).build(); sourceImpl.setAlwasyReconnect(false); try (SseEventSource source = sourceImpl) { source.register(event -> results.add(event.readData())); source.open(); Thread.sleep(1000); } catch (InterruptedException e) { logger.info("Thread sleep interruped", e); } Assert.assertEquals("Received unexpected events", "[thing1, thing2, thing3]", results.toString()); results.clear(); WebTarget target2 = client.target(generateURL("/service/server-sent-events/closeAfterSent")); SseEventSourceImpl sourceImpl2 = (SseEventSourceImpl)SseEventSource.target(target2).build(); sourceImpl2.setAlwasyReconnect(false); try (SseEventSource source = sourceImpl2) { source.register(event -> results.add(event.readData())); source.open(); Thread.sleep(1000); } catch (InterruptedException e) { logger.info("Thread sleep interruped", e); } Assert.assertEquals("Received unexpected events", "[thing1, thing2, thing3]", results.toString()); }
Source:
public RequestBuilder setMergeVariables(Map mergeVariables) throws JsonProcessingException { params.put("merge_variables", objectMapper.writeValueAsString(mergeVariables)); return this; }

Target:
public RequestBuilder setMergeVariables(Map mergeVariables) throws ParsingException { try { params.put("merge_variables", objectMapper.writeValueAsString(mergeVariables)); return this; } catch (JsonProcessingException e) { throw new ParsingException(e); } }
Source:
public IntegrationFlowFunctionSupport(FunctionCatalog functionCatalog, FunctionInspector functionInspector, CompositeMessageConverterFactory messageConverterFactory, FunctionProperties functionProperties) { Assert.notNull(functionCatalog, "'functionCatalog' must not be null"); Assert.notNull(functionInspector, "'functionInspector' must not be null"); Assert.notNull(messageConverterFactory, "'messageConverterFactory' must not be null"); this.functionCatalog = functionCatalog; this.functionInspector = functionInspector; this.messageConverterFactory = messageConverterFactory; this.functionProperties = functionProperties; }

Target:
public IntegrationFlowFunctionSupport(FunctionCatalog functionCatalog, FunctionInspector functionInspector, CompositeMessageConverterFactory messageConverterFactory, FunctionProperties functionProperties) { Assert.notNull(functionCatalog, "'functionCatalog' must not be null"); Assert.notNull(functionInspector, "'functionInspector' must not be null"); Assert.notNull(messageConverterFactory, "'messageConverterFactory' must not be null"); Assert.notNull(functionProperties, "'functionProperties' must not be null"); this.functionCatalog = functionCatalog; this.functionInspector = functionInspector; this.messageConverterFactory = messageConverterFactory; this.functionProperties = functionProperties; }
Source:
public Iterable<Tree> children() { List<Tree> result = new ArrayList<>(); if(openParenToken != null) { result.add(openParenToken); } for (Tree tree : super.children()) { result.add(tree); } if(closeParenToken != null) { result.add(closeParenToken); } return result; }

Target:
public Iterable<Tree> children() { List<Tree> result = new ArrayList<>(); if(openParenToken != null) { result.add(openParenToken); } super.children().forEach(result::add); if (closeParenToken != null) { result.add(closeParenToken); } return result; }
Source:
public void init(IWorkbench workbench) { if (!getProfilingType().equals("generic")) { final IPreferenceStore store = new ScopedPreferenceStore( configScopeInstance, getPluginID()); setPreferenceStore(store); } else { setDescription("Profiling Preferences"); } }

Target:
public void init(IWorkbench workbench) { if (!getProfilingType().equals("generic")) { final IPreferenceStore store = new ScopedPreferenceStore( configScopeInstance, getProfilingType()); setPreferenceStore(store); } else { setDescription("Profiling Preferences"); } }
Source:
public List<Facility> getFacilitiesWhereUserIsAdmin(PerunSession sess, User user) throws InternalErrorException { try { return jdbc.query("select " + facilityMappingSelectQuery + " from facilities " + " left outer join authz on authz.facility_id=facilities.id " + " left outer join groups_members on groups_members.group_id=authz.authorized_group_id " + " left outer join members on members.id=groups_members.member_id " + " where (authz.user_id=? or members.user_id=?) and authz.role_id=(select id from roles where name=?) and authz.facility_id=facilities.id", FACILITY_MAPPER, user.getId(), user.getId(), Role.FACILITYADMIN.getRoleName()); } catch (RuntimeException e) { throw new InternalErrorException(e); } }

Target:
public List<Facility> getFacilitiesWhereUserIsAdmin(PerunSession sess, User user) throws InternalErrorException { try { return jdbc.query("select " + facilityMappingSelectQuery + " from facilities " + " left outer join authz on authz.facility_id=facilities.id " + " left outer join groups_members on groups_members.group_id=authz.authorized_group_id " + " left outer join members on members.id=groups_members.member_id " + " where (authz.user_id=? or members.user_id=?) and authz.role_id=(select id from roles where name=?) ", FACILITY_MAPPER, user.getId(), user.getId(), Role.FACILITYADMIN.getRoleName()); } catch (RuntimeException e) { throw new InternalErrorException(e); } }
Source:
public RunLengthBitPackingHybridEncoder(int bitWidth, int initialCapacity, int pageSize, ByteBufferAllocator allocator) { if (DEBUG) { LOG.debug(String.format("Encoding: RunLengthBitPackingHybridEncoder with " + "bithWidth: %d initialCapacity %d", bitWidth, initialCapacity)); } Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.allocator = allocator; this.baos = new CapacityByteArrayOutputStream(initialCapacity, pageSize, this.allocator); this.packBuffer = new byte[bitWidth]; this.bufferedValues = new int[8]; this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); reset(false); }

Target:
public RunLengthBitPackingHybridEncoder(int bitWidth, int initialCapacity, int pageSize, ByteBufferAllocator allocator) { if (DEBUG) { LOG.debug(String.format("Encoding: RunLengthBitPackingHybridEncoder with " + "bithWidth: %d initialCapacity %d", bitWidth, initialCapacity)); } Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.baos = new CapacityByteArrayOutputStream(initialCapacity, pageSize, allocator); this.packBuffer = new byte[bitWidth]; this.bufferedValues = new int[8]; this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); reset(false); }
Source:
public void testNonAdminUserRetrievingDocuments() throws Exception { final String projects = {"multi-tenancy-1", "multi-tenancy-2"}; final String userName = "nonadminuser"; String kibanaIndex = getKibanaIndex(KibanaIndexMode.SHARED_OPS, userName, false); givenDocumentIsIndexed(kibanaIndex, "config", "4.6.4", "myKibanaIndex"); givenUserIsNotClusterAdmin(userName); givenUserIsAdminForProjects(projects); whenGettingDocument(String.format("%s/config/4.6.4", kibanaIndex)); assertThatResponseIsSuccessful(); for (String project : projects) { whenGettingDocument(String.format("%s/_count", formatProjectIndexPattern(project, "uuid"))); assertThatResponseIsSuccessful(); } whenSearchingProjects(projects); assertThatResponseIsSuccessful(); whenGettingDocument(".operations.*/_count"); assertThatResponseIsForbidden(); whenGettingDocument(".kibana/config/4.6.4"); assertThatResponseIsSuccessful(); assertThatMessageEquals("myKibanaIndex"); }

Target:
public void testNonAdminUserRetrievingDocuments() throws Exception { final String projects = {"multi-tenancy-1", "multi-tenancy-2"}; final String userName = "nonadminuser"; String kibanaIndex = getKibanaIndex(KibanaIndexMode.SHARED_OPS, userName, false); givenDocumentIsIndexed(kibanaIndex, "config", OLD_KIBANA_VERSION, "myKibanaIndex"); givenUserIsNotClusterAdmin(userName); givenUserIsAdminForProjects(projects); whenGettingDocument(String.format("%s/config/%s", kibanaIndex, OLD_KIBANA_VERSION)); assertThatResponseIsSuccessful(); for (String project : projects) { whenGettingDocument(String.format("%s/_count", formatProjectIndexPattern(project, "uuid"))); assertThatResponseIsSuccessful(); } whenSearchingProjects(projects); assertThatResponseIsSuccessful(); whenGettingDocument(".operations.*/_count"); assertThatResponseIsForbidden(); whenGettingDocument(".kibana/config/" + OLD_KIBANA_VERSION); assertThatResponseIsSuccessful(); assertThatMessageEquals("myKibanaIndex"); }
Source:
void addOrderItem(List<SqlNode> orderByList, RexProgram program, RexFieldCollation field) { SqlNode node = toSql(program, field.left); SqlNode nullDirectionNode = null; if (field.getNullDirection() != RelFieldCollation.NullDirection.UNSPECIFIED) { final boolean first = field.getNullDirection() == RelFieldCollation.NullDirection.FIRST; nullDirectionNode = dialect.emulateNullDirection( node, first, field.getDirection().isDescending()); } if (nullDirectionNode != null) { orderByList.add(nullDirectionNode); switch (field.getDirection()) { case DESCENDING: case STRICTLY_DESCENDING: node = SqlStdOperatorTable.DESC.createCall(POS, node); } orderByList.add(node); } else { orderByList.add(toSql(program, field)); } }

Target:
private void addOrderItem(List<SqlNode> orderByList, RexProgram program, RexFieldCollation field) { SqlNode node = toSql(program, field.left); SqlNode nullDirectionNode = null; if (field.getNullDirection() != RelFieldCollation.NullDirection.UNSPECIFIED) { final boolean first = field.getNullDirection() == RelFieldCollation.NullDirection.FIRST; nullDirectionNode = dialect.emulateNullDirection( node, first, field.getDirection().isDescending()); } if (nullDirectionNode != null) { orderByList.add(nullDirectionNode); switch (field.getDirection()) { case DESCENDING: case STRICTLY_DESCENDING: node = SqlStdOperatorTable.DESC.createCall(POS, node); break; default: break; } orderByList.add(node); } else { orderByList.add(toSql(program, field)); } }
Source:
public String modifyIdentifierTargetURL(DvObject dvObject) throws Exception { String identifier = getIdentifier(dvObject); HashMap<String, String> metadata = new HashMap<>(); metadata.put("_target", getTargetUrl(dvObject)); try { ezidService.setMetadata(identifier, (metadata instanceof HashMap) ? (HashMap)metadata : new HashMap<>(metadata)); return identifier; } catch (EZIDException e) { logger.log(Level.WARNING, "modifyMetadata failed"); logger.log(Level.WARNING, "String {0}", e.toString()); logger.log(Level.WARNING, "localized message {0}", e.getLocalizedMessage()); logger.log(Level.WARNING, "cause", e.getCause()); logger.log(Level.WARNING, "message {0}", e.getMessage()); throw e; } }

Target:
public String modifyIdentifierTargetURL(DvObject dvObject) throws Exception { String identifier = getIdentifier(dvObject); HashMap<String, String> metadata = new HashMap<>(); metadata.put("_target", getTargetUrl(dvObject)); try { ezidService.setMetadata(identifier,metadata); return identifier; } catch (EZIDException e) { logger.log(Level.WARNING, "modifyMetadata failed"); logger.log(Level.WARNING, "String {0}", e.toString()); logger.log(Level.WARNING, "localized message {0}", e.getLocalizedMessage()); logger.log(Level.WARNING, "cause", e.getCause()); logger.log(Level.WARNING, "message {0}", e.getMessage()); throw e; } }
Source:
public int hashCode() { long bits = 1; bits = 31 * bits + Double.doubleToLongBits(getX1()); bits = 31 * bits + Double.doubleToLongBits(getY1()); bits = 31 * bits + Double.doubleToLongBits(getX2()); bits = 31 * bits + Double.doubleToLongBits(getY2()); final int b = (int) bits; return b; }

Target:
public int hashCode() { long bits = 1; bits = 31 * bits + Double.doubleToLongBits(getX1()); bits = 31 * bits + Double.doubleToLongBits(getY1()); bits = 31 * bits + Double.doubleToLongBits(getX2()); bits = 31 * bits + Double.doubleToLongBits(getY2()); final int b = (int) bits; return b ^ (b >> 31); }
Source:
private void createReplLoadCompleteAckTask() { if ((work.isIncrementalLoad() && !work.incrementalLoadTasksBuilder().hasMoreWork() && !work.hasBootstrapLoadTasks()) || (!work.isIncrementalLoad() && !work.hasBootstrapLoadTasks())) { AckWork replLoadAckWork = new AckWork( new Path(work.dumpDirectory, LOAD_ACKNOWLEDGEMENT.toString())); Task<AckWork> loadAckWorkTask = TaskFactory.get(replLoadAckWork, conf); if (childTasks.isEmpty()) { this.childTasks.add(loadAckWorkTask); } else { DAGTraversal.traverse(this.childTasks, new AddDependencyToLeaves(Collections.singletonList(loadAckWorkTask))); } } }

Target:
private void createReplLoadCompleteAckTask() { if ((work.isIncrementalLoad() && !work.incrementalLoadTasksBuilder().hasMoreWork() && !work.hasBootstrapLoadTasks()) || (!work.isIncrementalLoad() && !work.hasBootstrapLoadTasks())) { AckWork replLoadAckWork = new AckWork( new Path(work.dumpDirectory, LOAD_ACKNOWLEDGEMENT.toString())); Task<AckWork> loadAckWorkTask = TaskFactory.get(replLoadAckWork, conf); if (childTasks.isEmpty()) { childTasks.add(loadAckWorkTask); } else { DAGTraversal.traverse(childTasks, new AddDependencyToLeaves(Collections.singletonList(loadAckWorkTask))); } } }
Source:
boolean ready() { return true; }

Target:
public boolean ready() { return true; }
Source:
public static void resetStatics() { carrierName = "test1"; subscribableStatus = 1; isRunningOnMainThread = false; supportsADM = false; hasFCMLibrary = false; isGMSInstalledAndEnabled = false; hasHMSAvailability = false; hasHMSPushKitLibrary = false; hasHMSAGConnectLibrary = false; isHMSCoreInstalledAndEnabled = false; }

Target:
public static void resetStatics() { carrierName = "test1"; subscribableStatus = 1; supportsADM = false; hasFCMLibrary = false; isGMSInstalledAndEnabled = false; hasHMSAvailability = false; hasHMSPushKitLibrary = false; hasHMSAGConnectLibrary = false; isHMSCoreInstalledAndEnabled = false; }
Source:
public void setKeyBinding(int key, int action) { checkWidget(); int modifierValue = key & SWT.MODIFIER_MASK; int keyInt = key & SWT.KEY_MASK; char keyChar = (char)keyInt; if (Character.isDefined(keyInt) && Compatibility.isLetter(keyChar)) { char ch = Character.toUpperCase(keyChar); int newKey = ch | modifierValue; if (action == SWT.NULL) { keyActionMap.remove(new Integer(newKey)); } else { keyActionMap.put(new Integer(newKey), new Integer(action)); } ch = Character.toLowerCase(keyChar); newKey = ch | modifierValue; if (action == SWT.NULL) { keyActionMap.remove(new Integer(newKey)); } else { keyActionMap.put(new Integer(newKey), new Integer(action)); } } else { if (action == SWT.NULL) { keyActionMap.remove(new Integer(key)); } else { keyActionMap.put(new Integer(key), new Integer(action)); } } }

Target:
public void setKeyBinding(int key, int action) { checkWidget(); int modifierValue = key & SWT.MODIFIER_MASK; int keyInt = key & SWT.KEY_MASK; char keyChar = (char)keyInt; if (Character.isDefined(keyInt) && Compatibility.isLetter(keyChar)) { char ch = Character.toUpperCase(keyChar); int newKey = ch | modifierValue; if (action == SWT.NULL) { keyActionMap.remove(newKey); } else { keyActionMap.put(newKey, action); } ch = Character.toLowerCase(keyChar); newKey = ch | modifierValue; if (action == SWT.NULL) { keyActionMap.remove(newKey); } else { keyActionMap.put(newKey, action); } } else { if (action == SWT.NULL) { keyActionMap.remove(key); } else { keyActionMap.put(key, action); } } }
Source:
public URL asUrl() { return null; }

Target:
public URL asUrl() { try { return asPath().toUri().toURL(); } catch (MalformedURLException e) { return null; } }
Source:
public void mouseDown(MouseEvent e) { if (_dragState != DRAG_NONE || null == _timeProvider) { return; } int idx; if (1 == e.button) { int nameSpace = _timeProvider.getNameSpace(); if (nameSpace != 0) { if (isOverSplitLine(e.x)) { _dragState = DRAG_SPLIT_LINE; _dragX = _dragX0 = e.x; _time0bak = _timeProvider.getTime0(); _time1bak = _timeProvider.getTime1(); redraw(); return; } } idx = getItemIndexAtY(e.y); if (idx >= 0) { Item item = _data._expandedItems[idx]; if (item._hasChildren && e.x < nameSpace && e.x < MARGIN + (item.level + 1) * EXPAND_SIZE) { toggle(idx); } else { long hitTime = getTimeAtX(e.x); if (hitTime >= 0) { setCapture(true); _dragState = DRAG_TRACE_ITEM; _dragX = _dragX0 = e.x - nameSpace; _time0bak = _timeProvider.getTime0(); _time1bak = _timeProvider.getTime1(); } } selectItem(idx, false); fireSelectionChanged(); } else { selectItem(idx, false); redraw(); fireSelectionChanged(); } } else if (3 == e.button && _timeEventMenuListeners.isEmpty()) { if (_timeProvider.getTime0() == _timeProvider.getTime1() || getCtrlSize().x - _timeProvider.getNameSpace() <= 0) { return; } setCapture(true); _dragX = _dragX0 = Math.min(Math.max(e.x, _timeProvider.getNameSpace()), getCtrlSize().x - RIGHT_MARGIN); _dragState = DRAG_ZOOM; } }

Target:
public void mouseDown(MouseEvent e) { if (_dragState != DRAG_NONE || null == _timeProvider) { return; } int idx; if (1 == e.button) { int nameSpace = _timeProvider.getNameSpace(); if (nameSpace != 0) { if (isOverSplitLine(e.x)) { _dragState = DRAG_SPLIT_LINE; _dragX = _dragX0 = e.x; _time0bak = _timeProvider.getTime0(); _time1bak = _timeProvider.getTime1(); redraw(); return; } } idx = getItemIndexAtY(e.y); if (idx >= 0) { Item item = _data._expandedItems[idx]; if (item._hasChildren && e.x < nameSpace && e.x < MARGIN + (item.level + 1) * EXPAND_SIZE) { toggle(idx); } else { long hitTime = getTimeAtX(e.x); if (hitTime >= 0) { setCapture(true); _dragState = DRAG_TRACE_ITEM; _dragX = _dragX0 = e.x - nameSpace; _time0bak = _timeProvider.getTime0(); _time1bak = _timeProvider.getTime1(); } } selectItem(idx, false); fireSelectionChanged(); } else { selectItem(idx, false); redraw(); fireSelectionChanged(); } } else if (3 == e.button) { if (_timeProvider.getTime0() == _timeProvider.getTime1() || getCtrlSize().x - _timeProvider.getNameSpace() <= 0) { return; } setCapture(true); _dragX = _dragX0 = Math.min(Math.max(e.x, _timeProvider.getNameSpace()), getCtrlSize().x - RIGHT_MARGIN); _dragState = DRAG_ZOOM; } }
Source:
private void wakeUpConsumer() { if ( LockSupport.getBlocker( consumerThread ) != null ) { LockSupport.unpark( consumerThread ); } }

Target:
private void wakeUpConsumer() { LockSupport.unpark( consumerThread ); }
Source:
public void testEscapeComplexUri() throws Exception { final CountDownLatch latch = new CountDownLatch(1); HttpProviderFactory factory = mock(HttpProviderFactory.class); when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class)); RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url); Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner"); UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory); ReadFilter filter = new ReadFilter(); filter.setLinkUri(URI.create("metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-94ad-c38f32abba1f" + "%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698")); adapter.read(filter, new Callback<List<Data>>() { @Override public void onSuccess(List<Data> data) { latch.countDown(); } @Override public void onFailure(Exception e) { latch.countDown(); } }); latch.await(500, TimeUnit.MILLISECONDS); verify(factory).get(eq(new URL(url.toString() + "metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-94ad-c38f32abba1f" + "%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698"))); }

Target:
public void testEscapeComplexUri() throws Exception { final CountDownLatch latch = new CountDownLatch(1); HttpProviderFactory factory = mock(HttpProviderFactory.class); when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class)); RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url); Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner"); UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory); ReadFilter filter = new ReadFilter(); filter.setLinkUri(URI.create("metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-94ad-c38f32abba1f" + "%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698")); adapter.read(filter, new Callback<List<Data>>() { @Override public void onSuccess(List<Data> data) { latch.countDown(); } @Override public void onFailure(Exception e) { latch.countDown(); } }); latch.await(500, TimeUnit.MILLISECONDS); verify(factory).get(Mockito.argThat(new ObjectVarArgsMatcher(new URL(url.toString() + "metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-" + "94ad-c38f32abba1f%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698"), 60000))); }
Source:
public void initRepo() throws Exception { coreSession.removeChildren(coreSession.getRootDocument().getRef()); coreSession.save(); testFolder = coreSession.createDocumentModel("/", "Folder", "Folder"); testFolder.setPropertyValue("dc:title", "Folder"); testFolder = coreSession.createDocument(testFolder); coreSession.save(); testFolder = coreSession.getDocument(testFolder.getRef()); doc = coreSession.createDocumentModel("/Folder", "TestDoc", "DataSet"); doc.setPropertyValue("dc:title", "TestDoc"); doc = coreSession.createDocument(doc); coreSession.save(); doc = coreSession.getDocument(doc.getRef()); assertNotNull(doc.getPropertyValue("ds:fields")); assertEquals(0, ((Collection) doc.getPropertyValue("ds:fields")).size()); File fieldsAsJsonFile = FileUtils.getResourceFileFromContext("newFields.json"); assertNotNull(fieldsAsJsonFile); String fieldsDataAsJSon = org.apache.commons.io.FileUtils.readFileToString(fieldsAsJsonFile, UTF_8); fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\n", ""); fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\r", ""); OperationContext ctx = new OperationContext(coreSession); ctx.setInput(doc); OperationChain chain = new OperationChain("testChain"); chain.add(AddItemToListProperty.ID).set("xpath", "ds:fields").set("complexJsonProperties", fieldsDataAsJSon); doc = (DocumentModel) service.run(ctx, chain); List dbFields = (List) doc.getPropertyValue("ds:fields"); assertEquals(2, dbFields.size()); }

Target:
public void initRepo() throws Exception { coreSession.removeChildren(coreSession.getRootDocument().getRef()); coreSession.save(); testFolder = coreSession.createDocumentModel("/", "Folder", "Folder"); testFolder.setPropertyValue("dc:title", "Folder"); testFolder = coreSession.createDocument(testFolder); coreSession.save(); testFolder = coreSession.getDocument(testFolder.getRef()); doc = coreSession.createDocumentModel("/Folder", "TestDoc", "DataSet"); doc.setPropertyValue("dc:title", "TestDoc"); doc = coreSession.createDocument(doc); coreSession.save(); doc = coreSession.getDocument(doc.getRef()); List fields = (List) doc.getPropertyValue("ds:fields"); assertNotNull(fields); assertTrue(fields.isEmpty()); File fieldsAsJsonFile = FileUtils.getResourceFileFromContext("newFields.json"); assertNotNull(fieldsAsJsonFile); String fieldsDataAsJSon = org.apache.commons.io.FileUtils.readFileToString(fieldsAsJsonFile, UTF_8); fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\n", ""); fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\r", ""); OperationContext ctx = new OperationContext(coreSession); ctx.setInput(doc); OperationChain chain = new OperationChain("testChain"); chain.add(AddItemToListProperty.ID).set("xpath", "ds:fields").set("complexJsonProperties", fieldsDataAsJSon); doc = (DocumentModel) service.run(ctx, chain); List dbFields = (List) doc.getPropertyValue("ds:fields"); assertEquals(2, dbFields.size()); }
Source:
public void drawAnnotationTest() throws IOException, InterruptedException { GraphFactory<SequenceSegment> gf = FactoryProducer .getFactory("JGraphT"); Graph<SequenceSegment> graph; SequenceSegment v1; v1 = new SequenceSegment(new HashSet<Sequence>(Arrays.asList(s1, s2)), 0, 20, new SegmentEmpty(20)); v1.setUnifiedStart(0); v1.setUnifiedEnd(20); graph = gf.getGraph(); graph.addVertex(v1); BucketCache buckets = new BucketCache(1, graph); File file = new File( "./src/test/resources/data/test_annotations/simple_annotations.txt"); List<KnownMutation> parse = KnownMutationParser .parseKnownMutations(file); Sequence reference = graph.getSources().iterator().next().getSources() .iterator().next(); Map<SequenceSegment, List<KnownMutation>> annotations = KnownMutationMapper .mapAnnotations(graph, parse, reference); JFXPanel panel = new JFXPanel(); Platform.runLater(() -> { Group result = tileview.drawGraph(buckets.getSegments(0, 1), graph, annotations, 1); bookmark = (Circle) ((Group) result.getChildrenUnmodifiable().get(2)) .getChildrenUnmodifiable().get(0); vView1 = (VertexView) ((Group) result.getChildrenUnmodifiable() .get(0)).getChildrenUnmodifiable().get(0); }); Thread.sleep(1000); assertEquals(bookmark.getRadius(), Double.parseDouble(Settings.get("bookmark_radius")), 1e-10); }

Target:
public void drawAnnotationTest() throws IOException, InterruptedException { GraphFactory<SequenceSegment> gf = FactoryProducer .getFactory("JGraphT"); Graph<SequenceSegment> graph; SequenceSegment v1; v1 = new SequenceSegment(new HashSet<Sequence>(Arrays.asList(s1, s2)), 0, 20, new SegmentEmpty(20)); v1.setUnifiedStart(0); v1.setUnifiedEnd(20); graph = gf.getGraph(); graph.addVertex(v1); BucketCache buckets = new BucketCache(1, graph); File file = new File( "./src/test/resources/data/test_annotations/simple_annotations.txt"); List<KnownMutation> parse = KnownMutationParser .parseKnownMutations(file); Sequence reference = graph.getSources().iterator().next().getSources() .iterator().next(); Map<SequenceSegment, List<KnownMutation>> annotations = KnownMutationMapper .mapAnnotations(graph, parse, reference); JFXPanel panel = new JFXPanel(); Platform.runLater(() -> { Group result = tileview.drawGraph(buckets.getSegments(0, 1), graph, annotations, 1); bookmark = (Circle) ((Group) result.getChildrenUnmodifiable() .get(2)).getChildrenUnmodifiable().get(0); vertexView1 = (VertexView) ((Group) result .getChildrenUnmodifiable().get(0)) .getChildrenUnmodifiable().get(0); }); Thread.sleep(1000); assertEquals(bookmark.getRadius(), Double.parseDouble(Settings.get(RADIUS_SETTING)), 1e-10); }
Source:
public boolean poll(Timer timer) { maybeUpdateSubscriptionMetadata(); invokeCompletedOffsetCommitCallbacks(); if (subscriptions.partitionsAutoAssigned()) { if (protocol == null) { throw new IllegalStateException("User configure ConsumerConfig#PARTITION_ASSIGNMENT_STRATEGY_CONFIG to empty " + "while trying to subscribe for group protocol to auto assign partitions"); } pollHeartbeat(timer.currentTimeMs()); if (coordinatorUnknown() && !ensureCoordinatorReady(timer)) { return false; } if (rejoinNeededOrPending()) { if (subscriptions.hasPatternSubscription()) { if (this.metadata.timeToAllowUpdate(timer.currentTimeMs()) == 0) { this.metadata.requestUpdate(); } if (!client.ensureFreshMetadata(timer)) { return false; } maybeUpdateSubscriptionMetadata(); } if (!ensureActiveGroup(timer)) { return false; } } } else { if (metadata.updateRequested() && !client.hasReadyNodes(timer.currentTimeMs())) { client.awaitMetadataUpdate(timer); } } maybeAutoCommitOffsetsAsync(timer.currentTimeMs()); return true; }

Target:
public boolean poll(Timer timer) { maybeUpdateSubscriptionMetadata(); invokeCompletedOffsetCommitCallbacks(); if (subscriptions.partitionsAutoAssigned()) { if (protocol == null) { throw new IllegalStateException("User configured " + ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG + " to empty while trying to subscribe for group protocol to auto assign partitions"); } pollHeartbeat(timer.currentTimeMs()); if (coordinatorUnknown() && !ensureCoordinatorReady(timer)) { return false; } if (rejoinNeededOrPending()) { if (subscriptions.hasPatternSubscription()) { if (this.metadata.timeToAllowUpdate(timer.currentTimeMs()) == 0) { this.metadata.requestUpdate(); } if (!client.ensureFreshMetadata(timer)) { return false; } maybeUpdateSubscriptionMetadata(); } if (!ensureActiveGroup(timer)) { return false; } } } else { if (metadata.updateRequested() && !client.hasReadyNodes(timer.currentTimeMs())) { client.awaitMetadataUpdate(timer); } } maybeAutoCommitOffsetsAsync(timer.currentTimeMs()); return true; }
Source:
private MemoryImageBuilder createMemoryImageBuilder() { return FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion()) && getParameters().isSaveMemory() && isLiveSnapshotApplicable() ? new DefaultMemoryImageBuilder(getVm(), getStorageDomainIdForVmMemory(), getStoragePool(), this) : new NullableMemoryImageBuilder(); }

Target:
private MemoryImageBuilder createMemoryImageBuilder() { if (FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion()) && getParameters().isSaveMemory() && isLiveSnapshotApplicable()) { prepareForMemorySnapshot = true; return new DefaultMemoryImageBuilder(getVm(), getStorageDomainIdForVmMemory(), getStoragePool(), this); } else { return new NullableMemoryImageBuilder(); } }
Source:
private <T, R> ClientFuture<R> executeAsync0( String taskName, @Nullable T arg, ClientClusterGroupImpl clusterGrp, byte flags, long timeout ) throws ClientException { Collection<UUID> nodeIds = clusterGrp == cluster ? null : clusterGrp.nodeIds(); if (nodeIds != null && nodeIds.isEmpty()) throw new ClientException("Cluster group is empty."); while (true) { Consumer<PayloadOutputChannel> payloadWriter = ch -> { if (!ch.clientChannel().isFeatureSupported(ClientFeature.EXECUTE_TASK_BY_NAME)) { throw new ClientFeatureNotSupportedByServerException("Compute grid functionality for thin " + "client not supported by server node (" + ch.clientChannel().serverNodeId() + ')'); } try (BinaryRawWriterEx w = new BinaryWriterExImpl(marsh.context(), ch.out(), null, null)) { if (nodeIds == null) w.writeInt(0); else { w.writeInt(nodeIds.size()); for (UUID nodeId : nodeIds) w.writeUuid(nodeId); } w.writeByte(flags); w.writeLong(timeout); w.writeString(taskName); utils.writeObject(ch.out(), arg); } }; Function<PayloadInputChannel, T2<ClientChannel, Long>> payloadReader = ch -> new T2<>(ch.clientChannel(), ch.in().readLong()); T2<ClientChannel, Long> taskParams; try { taskParams = ch.service(COMPUTE_TASK_EXECUTE, payloadWriter, payloadReader); } catch (ClientServerError error) { throw new ClientException(error.getMessage()); } ClientComputeTask<Object> task = addTask(taskParams.get1(), taskParams.get2()); if (task == null) continue; task.fut.listen(f -> removeTask(task.ch, task.taskId)); return new ClientFutureImpl<>((IgniteInternalFuture<R>)task.fut); } }

Target:
private <T, R> Future<R> executeAsync0( String taskName, @Nullable T arg, ClientClusterGroupImpl clusterGrp, byte flags, long timeout ) throws ClientException { Collection<UUID> nodeIds = clusterGrp == cluster ? null : clusterGrp.nodeIds(); if (F.isEmpty(taskName)) throw new ClientException("Task name can't be null or empty."); if (nodeIds != null && nodeIds.isEmpty()) throw new ClientException("Cluster group is empty."); while (true) { Consumer<PayloadOutputChannel> payloadWriter = ch -> writeExecuteTaskRequest(ch, taskName, arg, nodeIds, flags, timeout); Function<PayloadInputChannel, T2<ClientChannel, Long>> payloadReader = ch -> new T2<>(ch.clientChannel(), ch.in().readLong()); T2<ClientChannel, Long> taskParams; try { taskParams = ch.service(COMPUTE_TASK_EXECUTE, payloadWriter, payloadReader); } catch (ClientServerError error) { throw new ClientException(error.getMessage()); } ClientComputeTask<Object> task = addTask(taskParams.get1(), taskParams.get2()); if (task == null) continue; task.fut.listen(f -> removeTask(task.ch, task.taskId)); return new ClientFutureImpl<>((GridFutureAdapter<R>)task.fut); } }
Source:
private void mergeLogs(MergedReftable mr) throws IOException { if (oldestReflogTimeMillis == Long.MAX_VALUE) { return; } try (LogCursor lc = mr.allLogs()) { while (lc.next()) { long updateIndex = lc.getUpdateIndex(); if (updateIndex > maxUpdateIndex || updateIndex < minUpdateIndex) { continue; } String refName = lc.getRefName(); ReflogEntry log = lc.getReflogEntry(); if (log == null) { if (includeDeletes) { writer.deleteLog(refName, updateIndex); } continue; } PersonIdent who = log.getWho(); if (who.getWhen().getTime() >= oldestReflogTimeMillis) { writer.writeLog( refName, updateIndex, who, log.getOldId(), log.getNewId(), log.getComment()); } } } }

Target:
private void mergeLogs(MergedReftable mr) throws IOException { if (expireOldestReflogTimeMillis == Long.MAX_VALUE) { return; } try (LogCursor lc = mr.allLogs()) { while (lc.next()) { long updateIndex = lc.getUpdateIndex(); if (updateIndex > expireMaxUpdateIndex || updateIndex < expireMinUpdateIndex) { continue; } String refName = lc.getRefName(); ReflogEntry log = lc.getReflogEntry(); if (log == null) { if (includeDeletes) { writer.deleteLog(refName, updateIndex); } continue; } PersonIdent who = log.getWho(); if (who.getWhen().getTime() >= expireOldestReflogTimeMillis) { writer.writeLog( refName, updateIndex, who, log.getOldId(), log.getNewId(), log.getComment()); } } } }
Source:
public ProcessExecution(Process process, String executable, Map<String, String> params, Map<String, String> hiddenParams) { notNull(process, "process"); this.executionsUri = notEmpty(process.getExecutionsLink(), "process executions link"); this.executable = notEmpty(executable, "executable"); this.params = notNull(params, "params"); this.hiddenParams = notNull(hiddenParams, "hiddenParams"); }

Target:
public ProcessExecution(Process process, String executable, Map<String, String> params, Map<String, String> hiddenParams) { notNull(process, "process"); this.executionsUri = notEmpty(process.getExecutionsLink(), "process executions link"); this.executable = executable; this.params = notNull(params, "params"); this.hiddenParams = notNull(hiddenParams, "hiddenParams"); if (!CollectionUtils.isEmpty(process.getExecutables()) && !process.getExecutables().contains(executable)) { throw new IllegalArgumentException("Executable " + executable + " not found in process executables."); } }
Source:
private boolean isExcludedUrl(HttpServletRequest request) { String servletPath = request.getServletPath(); for (String pattern : this.excludePatterns) { if (servletPath.matches(pattern)) { return true; } } return false; }

Target:
private boolean isExcludedUrl(HttpServletRequest request) { String servletPath = request.getServletPath(); for (Pattern pattern : this.excludePatterns) { if (pattern.matcher(servletPath).matches()) { return true; } } return false; }
Source:
public void retriesOnExceptionTillSuccess() throws Exception { final int count = 3; final int delay = 1000; final Take take = Mockito.mock(Take.class); Mockito.when(take.act(Mockito.any(Request.class))).thenThrow( new IOException() ).thenReturn(new RsText()); final long minTime = delay; final long startTime = System.currentTimeMillis(); new TkRetry(count, delay, take).act(new RqFake(RqMethod.GET)); MatcherAssert.assertThat( minTime, Matchers.lessThanOrEqualTo(System.currentTimeMillis() - startTime) ); }

Target:
public void retriesOnExceptionTillSuccess() throws Exception { final int count = 3; final int delay = 1000; final Take take = Mockito.mock(Take.class); Mockito.when(take.act(Mockito.any(Request.class))).thenThrow( new IOException() ).thenReturn(new RsText()); final long startTime = System.currentTimeMillis(); new TkRetry(count, delay, take).act(new RqFake(RqMethod.GET)); MatcherAssert.assertThat( new Long(delay), Matchers.lessThanOrEqualTo(System.currentTimeMillis() - startTime) ); }