auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setup() throws Exception { sslFactory = TestUtils.createSSLFactory(); SSLContext sslContext = sslFactory.createSSLContext(); sslSocketFactory = sslContext.getSocketFactory(); sslEchoServer = new SSLBlockingEchoServer(sslFactory, sslPort); sslEchoServer.start(); }

Target:
public void setup() throws Exception { }
Source:
public void testGenerateAmazonS3GetBucketRequestPrototype() throws IOException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Map<String,Object> testMap = new HashMap<>(); final Request requestEntry = RequestConverter.toRequest(Ds3ModelFixtures.getBucketRequest(), new Ds3DocSpecImpl( ImmutableMap.of(), ImmutableMap.of())); testMap.put("requestEntry", requestEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/RequestPrototype.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "LIBRARY_API ds3_error* ds3_get_bucket(const ds3_client* client, const ds3_request* request, ds3_list_bucket_result_response** response);"; assertEquals(expectedOutput, output); }

Target:
public void testGenerateAmazonS3GetBucketRequestPrototype() throws IOException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Map<String,Object> testMap = new HashMap<>(); final Request requestEntry = RequestConverter.toRequest(Ds3ModelFixtures.getBucketRequest(), new Ds3DocSpecEmptyImpl()); testMap.put("requestEntry", requestEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/RequestPrototype.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "LIBRARY_API ds3_error* ds3_get_bucket(const ds3_client* client, const ds3_request* request, ds3_list_bucket_result_response** response);"; assertEquals(expectedOutput, output); }
Source:
public boolean equals(Object o){ if (!(o instanceof SonarQubeServer)) return false; SonarQubeServer other = (SonarQubeServer)o; return Comparing.equal(getHostUrl(), other.getHostUrl()) && Comparing.equal(getServerId(), other.getServerId()) && Comparing.equal(getPassword(), other.getPassword()) && Comparing.equal(getToken(), other.getToken()) && Comparing.equal(getLogin(), other.getLogin()) && Comparing.equal(getName(), other.getName()) && Comparing.equal(enableProxy(), other.enableProxy()); }

Target:
public boolean equals(Object o){ if (!(o instanceof SonarQubeServer)) return false; SonarQubeServer other = (SonarQubeServer)o; return Comparing.equal(getHostUrl(), other.getHostUrl()) && Comparing.equal(getPassword(), other.getPassword()) && Comparing.equal(getToken(), other.getToken()) && Comparing.equal(getLogin(), other.getLogin()) && Comparing.equal(getName(), other.getName()) && Comparing.equal(enableProxy(), other.enableProxy()); }
Source:
public static boolean sameAnnotationValue(AnnotationValue av1, AnnotationValue av2) { return compareAnnotationValue(av1, av2) != 0; }

Target:
public static boolean sameAnnotationValue(AnnotationValue av1, AnnotationValue av2) { return compareAnnotationValue(av1, av2) == 0; }
Source:
private EEFTextDescription createEEFTextDescription(TextDescription textDescription) { EEFTextDescription eefTextDescription = EefFactory.eINSTANCE.createEEFTextDescription(); eefTextDescription.setIdentifier(textDescription.getIdentifier()); eefTextDescription.setValueExpression(textDescription.getValueExpression()); InitialOperation initialOperation = textDescription.getInitialOperation(); eefTextDescription.setEditExpression(getExpressionForOperation(initialOperation)); TextStyle textStyle = textDescription.getStyle(); if (textStyle != null) { EEFTextStyle eefTextStyle = EefFactory.eINSTANCE.createEEFTextStyle(); eefTextStyle.setBackgroundColorExpression(textStyle.getBackgroundColorExpression()); eefTextStyle.setForegroundColorExpression(textStyle.getForegroundColorExpression()); eefTextStyle.setFontNameExpression(textStyle.getFontNameExpression()); eefTextStyle.setFontSizeExpression(Integer.toString(textStyle.getFontSize())); int fontStyle = SWT.NORMAL; if (textStyle.isFontBold()) { fontStyle = fontStyle | SWT.BOLD; } if (textStyle.isFontItalic()) { fontStyle = fontStyle | SWT.ITALIC; } eefTextStyle.setFontStyleExpression(Integer.toString(fontStyle)); eefTextDescription.setStyle(eefTextStyle); } return eefTextDescription; }

Target:
private EEFTextDescription createEEFTextDescription(TextDescription textDescription) { EEFTextDescription eefTextDescription = EefFactory.eINSTANCE.createEEFTextDescription(); eefTextDescription.setIdentifier(textDescription.getIdentifier()); eefTextDescription.setValueExpression(textDescription.getValueExpression()); InitialOperation initialOperation = textDescription.getInitialOperation(); eefTextDescription.setEditExpression(getExpressionForOperation(initialOperation)); TextStyle textStyle = textDescription.getStyle(); if (textStyle != null) { EEFTextStyle eefTextStyle = EefFactory.eINSTANCE.createEEFTextStyle(); eefTextStyle.setBackgroundColorExpression(textStyle.getBackgroundColorExpression()); eefTextStyle.setForegroundColorExpression(textStyle.getForegroundColorExpression()); eefTextStyle.setFontNameExpression(textStyle.getFontNameExpression()); eefTextStyle.setFontSizeExpression(Integer.toString(textStyle.getFontSize())); int fontStyle = 0; if (textStyle.isFontBold()) { fontStyle = fontStyle | 1; } if (textStyle.isFontItalic()) { fontStyle = fontStyle | 2; } eefTextStyle.setFontStyleExpression(Integer.toString(fontStyle)); eefTextDescription.setStyle(eefTextStyle); } return eefTextDescription; }
Source:
public void start() { try { server.setHandler(new Dhis2RequestsHandler()); server.start(); } catch (Exception e) { LOGGER.error("Failed to start the Jetty server"); } }

Target:
public void start() { try { server.setHandler(new Dhis2RequestsHandler()); server.start(); } catch (Exception e) { LOGGER.error("Failed to start the Jetty server.", e); } }
Source:
public DefaultMultiFactorAuthenticationSupportingWebApplicationService(final String id, final String originalUrl, final String artifactId, final ResponseType responseType, final HttpClient httpClient, @NotNull final String authnMethod) { super(cleanupUrl(id), originalUrl, artifactId, httpClient); this.wrapperService = new SimpleWebApplicationServiceImpl(id, originalUrl, artifactId, responseType, httpClient); this.authenticationMethod = authnMethod; }

Target:
public DefaultMultiFactorAuthenticationSupportingWebApplicationService(final String id, final String originalUrl, final String artifactId, final ResponseType responseType, final HttpClient httpClient, @NotNull final String authnMethod) { super(cleanupUrl(id), originalUrl, artifactId, httpClient); this.wrapperService = new SimpleWebApplicationServiceImpl(id, httpClient); this.authenticationMethod = authnMethod; this.responseType = responseType; }
Source:
public Object execute() throws Exception { if (force) { System.out.println("testRecovery generate something to recovery"); if (tm == null) { System.out.println("Can not get transaction manager"); } else { DummyXAResource xa1 = new DummyXAResource(); DummyXAResource xa2 = new DummyXAResource(DummyXAResource.faultType.HALT); tm.begin(); Transaction transaction = tm.getTransaction(); transaction.enlistResource(xa1); transaction.enlistResource(xa2); tm.commit(); } } else { File file = new File("DummyXAResource/"); if (file.exists() && file.isDirectory() && file.listFiles().length > 0) { System.out.println("register the DummyXAResourceRecovery"); int currentCommits = DummyXAResource.getCommitRequests(); context.registerService(XAResourceRecovery.class, new DummyXAResourceRecovery(), null); System.out.println("testRecovery waiting ..."); while (DummyXAResource.getCommitRequests() == currentCommits) { Thread.sleep(1000); } System.out.println("testRecovery done"); } else { System.out.println("you should run this command with -f at first"); } } return null; }

Target:
public Object execute() throws Exception { if (force) { System.out.println("testRecovery generate something to recovery"); if (tm == null) { System.out.println("Can not get transaction manager"); } else { DummyXAResource xa = new DummyXAResource(DummyXAResource.faultType.HALT); Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("osgi:service/test"); Connection conn = null; Statement stmt = null; try { tm.begin(); Transaction transaction = tm.getTransaction(); transaction.enlistResource(xa); conn = ds.getConnection(); stmt = conn.createStatement(); stmt.execute("CREATE TABLE IF NOT EXISTS example ( id varchar(10), name varchar(32) )"); stmt.execute("insert into example values (1, 'recovery')"); tm.commit(); } catch (SQLException e) { System.out.println(e); tm.rollback(); } finally { stmt.close(); conn.close(); } } } else { File file = new File("DummyXAResource/"); if (file.exists() && file.isDirectory() && file.listFiles().length > 0) { int currentCommits = DummyXAResource.getCommitRequests(); System.out.println("current commitRequests of the DummyXAResource is " + currentCommits); System.out.println("query the database before recovery"); queryH2Database("select * from example"); System.out.println("register the DummyXAResourceRecovery"); context.registerService(XAResourceRecovery.class, new DummyXAResourceRecovery(), null); System.out.println("testRecovery waiting ..."); while (DummyXAResource.getCommitRequests() == currentCommits) { Thread.sleep(1000); } System.out.println("testRecovery done"); System.out.println("commitRequests of the DummyXAResource after recovery is " + DummyXAResource.getCommitRequests()); if (DummyXAResource.getCommitRequests() != currentCommits + 1) { System.err.println("RECOVERY the DummyXAResource could be WRONG !"); } System.out.println("reopen the database"); reopenH2Database(); System.out.println("query the database after recovery"); queryH2Database("select * from example"); } else { System.out.println("you should run this command with -f at first"); } } return null; }
Source:
private void caveAroundRay(GlowBlock block, Random random) { int radius = random.nextInt(2) + 2; final int bx = block.getX(); final int by = block.getY(); final int bz = block.getZ(); for (int x = bx - radius; x <= bx + radius; x++) { for (int y = by - radius; y <= by + radius; y++) { for (int z = bz - radius; z <= bz + radius; z++) { double distance = (bx - x) * (bx - x) + (by - y) * (by - y) + (bz - z) * (bz - z); if (distance < radius * radius) { GlowBlock pocket = block.getWorld().getBlockAt(x, y, z); pocket.setType(Material.AIR); } } } } }

Target:
private void caveAroundRay(GlowBlock block, Random random) { int radius = random.nextInt(2) + 2; final int blockX = block.getX(); final int blockY = block.getY(); final int blockZ = block.getZ(); for (int x = blockX - radius; x <= blockX + radius; x++) { for (int y = blockY - radius; y <= blockY + radius; y++) { for (int z = blockZ - radius; z <= blockZ + radius; z++) { double distanceSquared = (blockX - x) * (blockX - x) + (blockY - y) * (blockY - y) + (blockZ - z) * (blockZ - z); if (distanceSquared < radius * radius) { GlowBlock pocket = block.getWorld().getBlockAt(x, y, z); pocket.setType(Material.AIR); } } } } }
Source:
public KafkaFuture<Void> all() { try { return KafkaFuture.allOf(values().get().values().toArray(new KafkaFuture[0])); } catch (InterruptedException | ExecutionException e) { KafkaFutureImpl<Void> future = new KafkaFutureImpl<>(); future.completeExceptionally(e.getCause()); return future; } }

Target:
public KafkaFuture<Void> all() { return this.future.thenApply(new BaseFunction<Map<TopicPartition, Errors>, Void>() { @Override public Void apply(final Map<TopicPartition, Errors> topicPartitionErrorsMap) { List<TopicPartition> partitionsFailed = topicPartitionErrorsMap.entrySet() .stream() .filter(e -> e.getValue() != Errors.NONE) .map(Map.Entry::getKey) .collect(Collectors.toList()); for (Errors error : topicPartitionErrorsMap.values()) { if (error != Errors.NONE) { throw error.exception( "Failed altering consumer group offsets for the following partitions: " + partitionsFailed); } } return null; } }); }
Source:
public void shouldFetchSingleAvroMessage() throws IOException { Topic topic = topic() .withName("avro.fetch") .withValidation(true) .withMessageSchema(avroUser.getSchemaAsString()) .withContentType(AVRO).build(); operations.buildTopic(topic); wait.untilTopicDetailsAreCreated(topic.getName()); publisher.publish(topic.getQualifiedName(), avroUser.asBytes(), Response.Status.CREATED); List<String> previews = fetchPreviewsFromAllPartitions(topic.getQualifiedName(), 10, false); assertThat(previews).hasSize(1); assertThatJson(previews.get(0)) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo(avroUser.asJson()); }

Target:
public void shouldFetchSingleAvroMessage() throws IOException { Topic topic = topic() .withName("avro.fetch") .withValidation(true) .withMessageSchema(avroUser.getSchemaAsString()) .withContentType(AVRO).build(); operations.buildTopic(topic); wait.untilTopicDetailsAreCreated(topic.getName()); Response response = publisher.publish(topic.getQualifiedName(), avroUser.asBytes()); HermesAssertions.assertThat(response).hasStatus(CREATED); List<String> previews = fetchPreviewsFromAllPartitions(topic.getQualifiedName(), 10, false); assertThat(previews).hasSize(1); assertThatJson(previews.get(0)) .when(Option.IGNORING_EXTRA_FIELDS) .isEqualTo(avroUser.asJson()); }
Source:
private CertificationResultTestFunctionalityEntity getCertificationResultTestFunctionalityById(Long id) { CertificationResultTestFunctionalityEntity entity = null; Query query = entityManager.createQuery( "SELECT crtf " + "FROM CertificationResultTestFunctionalityEntity crtf " + "LEFT OUTER JOIN FETCH crtf.testFunctionality tf " + "JOIN FETCH tf.certificationEdition edition " + "where (NOT crtf.deleted = true) AND (crtf.id = :entityid) ", CertificationResultTestFunctionalityEntity.class ); query.setParameter("entityid", id); List<CertificationResultTestFunctionalityEntity> result = query.getResultList(); if (result.size() > 0){ entity = result.get(0); } return entity; }

Target:
private CertificationResultTestFunctionalityEntity getCertificationResultTestFunctionalityById(Long id) { CertificationResultTestFunctionalityEntity entity = null; Query query = entityManager.createQuery( "SELECT crtf " + "FROM CertificationResultTestFunctionalityEntity crtf " + "LEFT OUTER JOIN FETCH crtf.testFunctionality tf " + "JOIN FETCH tf.certificationEdition edition " + "WHERE (NOT crtf.deleted = true) " + "AND (crtf.id = :entityid) ", CertificationResultTestFunctionalityEntity.class ); query.setParameter("entityid", id); List<CertificationResultTestFunctionalityEntity> result = query.getResultList(); if (result.size() > 0){ entity = result.get(0); } return entity; }
Source:
public void execute(T t) { return; }

Target:
public void execute(T t) { }
Source:
public void addNewModelElements(EObject eObject, EReference eReference) { if (delegate == null) { return; } delegate.addNewModelElements(eObject, eReference, true); }

Target:
public void addNewModelElements(EObject eObject, EReference eReference) { addNewModelElements(eObject, eReference, true); }
Source:
private URI createURI(List<Integer> proxyPorts) { List<String> stripes = new ArrayList<>(); for (int proxyPort : proxyPorts) { String stripe = "localhost:" + proxyPort; stripes.add(stripe); } String uri = "terracotta://" + String.join(STRIPE_SEPARATOR, stripes); return URI.create(uri); }

Target:
private URI createURI(List<Integer> proxyPorts) { Optional<String> reduce = proxyPorts.stream() .map(port -> "localhost:" + port) .reduce((x1, x2) -> x1 + STRIPE_SEPARATOR + x2); String uri = "terracotta://" + reduce.get(); return URI.create(uri); }
Source:
public static File findIndex(final File samFile){ final File indexFile = lookForIndex(samFile); if(indexFile == null){ try { return lookForIndex(samFile.getCanonicalFile()); } catch (IOException e){ return null; } } else { return indexFile; } }

Target:
public static File findIndex(final File samFile) { final File indexFile = lookForIndex(samFile); if (indexFile == null) { return unsymlinkAndLookForIndex(samFile); } else { return indexFile; } }
Source:
public void testFixedPattern() { final Resource resource = KieServices.Factory.get().getResources().newClassPathResource("fixedPattern.xls", getClass()); final KieBuilder kbuilder = KieBaseUtil.getKieBuilderFromResources(true, resource); final KieContainer kcontainer = KieServices.Factory.get().newKieContainer(kbuilder.getKieModule().getReleaseId()); ksession = kcontainer.newKieSession(); final List<Long> list = new ArrayList<Long>(); ksession.setGlobal("list", list); ksession.insert(1L); ksession.insert(2); ksession.fireAllRules(); Assertions.assertThat(list.size()).isEqualTo(1); Assertions.assertThat((long) list.get(0)).isEqualTo(1L); }

Target:
public void testFixedPattern() { final Resource resource = KieServices.Factory.get().getResources().newClassPathResource("fixedPattern.xls", getClass()); final KieBuilder kbuilder = KieBaseUtil.getKieBuilderFromResources(true, resource); final KieContainer kcontainer = KieServices.Factory.get().newKieContainer(kbuilder.getKieModule().getReleaseId()); ksession = kcontainer.newKieSession(); final List<Long> list = new ArrayList<Long>(); ksession.setGlobal("list", list); ksession.insert(1L); ksession.insert(2); ksession.fireAllRules(); Assertions.assertThat(list).hasSize(1); Assertions.assertThat(list).first().isEqualTo(1L); }
Source:
public void create() { try { serviceLoader.load(PmHealthCheckManager.class); serviceLoader.load(EngineBackupAwarenessManager.class); serviceLoader.load(DataCenterCompatibilityChecker.class); serviceLoader.load(ResourceManager.class); serviceLoader.load(IrsProxyManager.class); serviceLoader.load(OvfDataUpdater.class); StoragePoolStatusHandler.init(); serviceLoader.load(GlusterJobsManager.class); try { log.info("Init VM custom properties utilities"); VmPropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of vm custom properties failed.", e); } try { log.info("Init device custom properties utilities"); DevicePropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of device custom properties failed.", e); } serviceLoader.load(SchedulingManager.class); sessionDataContainer.cleanupEngineSessionsOnStartup(); serviceLoader.load(HostDeviceManager.class); serviceLoader.load(DwhHeartBeat.class); if(Config.<Boolean> getValue(ConfigValues.AffinityRulesEnforcementManagerEnabled)) { serviceLoader.load(AffinityRulesEnforcementManager.class); } serviceLoader.load(CertificationValidityChecker.class); serviceLoader.load(HostUpdatesCheckerService.class); serviceLoader.load(IPTablesDeprecationNotifier.class); compensate(); } catch (Exception ex) { log.error("Failed to initialize backend", ex); throw ex; } }

Target:
public void create() { try { compensate(); serviceLoader.load(AsyncTaskManager.class); serviceLoader.load(CommandCoordinatorUtil.class); serviceLoader.load(CommandCallbacksPoller.class); serviceLoader.load(CommandEntityCleanupManager.class); serviceLoader.load(PmHealthCheckManager.class); serviceLoader.load(EngineBackupAwarenessManager.class); serviceLoader.load(DataCenterCompatibilityChecker.class); serviceLoader.load(ResourceManager.class); serviceLoader.load(IrsProxyManager.class); serviceLoader.load(OvfDataUpdater.class); StoragePoolStatusHandler.init(); serviceLoader.load(GlusterJobsManager.class); try { log.info("Init VM custom properties utilities"); VmPropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of vm custom properties failed.", e); } try { log.info("Init device custom properties utilities"); DevicePropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of device custom properties failed.", e); } serviceLoader.load(SchedulingManager.class); sessionDataContainer.cleanupEngineSessionsOnStartup(); serviceLoader.load(HostDeviceManager.class); serviceLoader.load(DwhHeartBeat.class); if(Config.<Boolean> getValue(ConfigValues.AffinityRulesEnforcementManagerEnabled)) { serviceLoader.load(AffinityRulesEnforcementManager.class); } serviceLoader.load(CertificationValidityChecker.class); serviceLoader.load(HostUpdatesCheckerService.class); serviceLoader.load(IPTablesDeprecationNotifier.class); } catch (Exception ex) { log.error("Failed to initialize backend", ex); throw ex; } }
Source:
public void onEnableStroke(){ CategorizedPoint cp = (CategorizedPoint) getLegend(); CategorizedPoint ra = cp; ra.setStrokeEnabled(strokeBox.isSelected()); UniqueSymbolPoint usp = new UniqueSymbolPoint(ra.getFallbackParameters()); if(cp.isOnVertex()){ usp.setOnVertex(); } else { usp.setOnCentroid(); } getPreview().setSymbol(usp.getSymbolizer()); TableModelInterval model = (TableModelInterval) getJTable().getModel(); model.fireTableDataChanged(); }

Target:
public void onEnableStroke(){ CategorizedPoint cp = (CategorizedPoint) getLegend(); cp.setStrokeEnabled(strokeBox.isSelected()); UniqueSymbolPoint usp = new UniqueSymbolPoint(cp.getFallbackParameters()); if(cp.isOnVertex()){ usp.setOnVertex(); } else { usp.setOnCentroid(); } if(cp.isStrokeEnabled()){ cp.setStrokeUom(Uom.fromString(uoms[lineUom.getSelectedIndex()].getKey())); usp.setStrokeUom(cp.getStrokeUom()); } usp.setSymbolUom(cp.getSymbolUom()); getPreview().setSymbol(usp.getSymbolizer()); TableModelInterval model = (TableModelInterval) getJTable().getModel(); model.fireTableDataChanged(); }
Source:
private Map<String, Object>[] createCheckpointsMap() { final List<Map<String, Object>> result = new ArrayList<>(); getParameters().getCheckpoints().forEach(checkpoint -> { Map<String, Object> params = new HashMap<>(); params.put("id", checkpoint.getId().toString()); params.put("created", checkpoint.getCreationDate().toString()); params.put(VdsProperties.vm_disks, createDisksMap(checkpoint.getDisks())); result.add(params); }); return result.toArray(new HashMap[0]); }

Target:
private HashMap[] createCheckpointsMap() { return getParameters().getCheckpoints().stream().map(checkpoint -> { Map<String, Object> params = new HashMap<>(); params.put("id", checkpoint.getId().toString()); params.put("created", checkpoint.getCreationDate().toString()); params.put(VdsProperties.vm_disks, createDisksMap(checkpoint.getDisks())); return params; }).toArray(HashMap[]::new); }
Source:
private void compareTime(CompareAssertionResult result) { if (compareTime < 0) { return; } long prevTime = -1; SampleResult prevResult = null; boolean success = true; StringBuilder buf = new StringBuilder(); for (SampleResult sResult : responses) { long currentTime = sResult.getTime(); if (prevTime != -1) { success = Math.abs(prevTime - currentTime) <= compareTime; prevResult = sResult; } if (!success) { result.setFailure(true); buf.setLength(0); appendResultDetails(buf, prevResult); buf.append(JMeterUtils.getResString("comparison_response_time")).append(prevTime); result.addToBaseResult(buf.toString()); buf.setLength(0); appendResultDetails(buf, sResult); buf.append(JMeterUtils.getResString("comparison_response_time")).append(currentTime); result.addToSecondaryResult(buf.toString()); result.setFailureMessage( JMeterUtils.getResString("comparison_differ_time") + compareTime + JMeterUtils.getResString("comparison_unit")); break; } prevResult = sResult; prevTime = currentTime; } }

Target:
private void compareTime(CompareAssertionResult result) { if (compareTime < 0) { return; } long prevTime = -1; SampleResult prevResult = null; boolean success = true; for (SampleResult sResult : responses) { long currentTime = sResult.getTime(); if (prevTime != -1) { success = Math.abs(prevTime - currentTime) <= compareTime; prevResult = sResult; } if (success) { prevResult = sResult; prevTime = currentTime; } else { result.setFailure(true); StringBuilder sb = new StringBuilder(); appendResultDetails(sb, prevResult); sb.append(JMeterUtils.getResString("comparison_response_time")).append(prevTime); result.addToBaseResult(sb.toString()); sb.setLength(0); appendResultDetails(sb, sResult); sb.append(JMeterUtils.getResString("comparison_response_time")).append(currentTime); result.addToSecondaryResult(sb.toString()); result.setFailureMessage( JMeterUtils.getResString("comparison_differ_time") + compareTime + JMeterUtils.getResString("comparison_unit")); break; } } }
Source:
public void testIncrementLong() { ITmfStateSystemBuilder ss = fStateSystem; int quark = ss.getQuarkAbsoluteAndAdd(DUMMY_STRING); ITmfStateValue value = ss.queryOngoingState(quark); assertEquals(TmfStateValue.nullValue(), value); long increment = 3; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment); value = ss.queryOngoingState(quark); assertEquals(TmfStateValue.newValueLong(increment), value); Long increment2 = 1000L; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment2); value = ss.queryOngoingState(quark); assertEquals(TmfStateValue.newValueLong(increment + increment2), value); Long increment3 = -500L; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment3); value = ss.queryOngoingState(quark); assertEquals(TmfStateValue.newValueLong(increment + increment2 + increment3), value); }

Target:
public void testIncrementLong() { ITmfStateSystemBuilder ss = fStateSystem; int quark = ss.getQuarkAbsoluteAndAdd(DUMMY_STRING); Object value = ss.queryOngoing(quark); assertNull(value); long increment = 3; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment); value = ss.queryOngoing(quark); assertNotNull(value); assertEquals(increment, (long) value); Long increment2 = 1000L; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment2); value = ss.queryOngoing(quark); assertNotNull(value); assertEquals(increment + increment2, (long) value); Long increment3 = -500L; StateSystemBuilderUtils.incrementAttributeLong(ss, START_TIME + TIME_INCREMENT, quark, increment3); value = ss.queryOngoing(quark); assertNotNull(value); assertEquals(increment + increment2 + increment3, (long) value); }
Source:
private static URI convertKeyToEncodedUri(String key) { try { URI unEncodedURI = new URI(key); return new URIBuilder().setPath(unEncodedURI.getRawPath()) .setScheme(unEncodedURI.getScheme()).build(); } catch (URISyntaxException e) { int i = e.getIndex(); String details; if (i >= 0) { details = " -- \"" + e.getInput().charAt(i) + "\""; } else { details = ""; } throw new AssertionError("Failed to encode key: " + key + ": " + e + details); } }

Target:
private static URI convertKeyToEncodedUri(String key) { try { Path p = new Path(key); URI unEncodedURI = p.toUri(); return new URIBuilder().setPath(unEncodedURI.getPath()) .setScheme(unEncodedURI.getScheme()).build(); } catch (URISyntaxException e) { int i = e.getIndex(); String details; if (i >= 0) { details = " -- \"" + e.getInput().charAt(i) + "\""; } else { details = ""; } throw new AssertionError("Failed to encode key: " + key + ": " + e + details); } }
Source:
public MultiTypeCodec codec() { Map<String, KryoRegistrar> kryoRegistrarMap = applicationContext.getBeansOfType(KryoRegistrar .class); return new PojoCodec(new ArrayList<>(kryoRegistrarMap.values())); }

Target:
public MultiTypeCodec<?> codec() { Map<String, KryoRegistrar> kryoRegistrarMap = applicationContext.getBeansOfType(KryoRegistrar .class); return new PojoCodec(new ArrayList<>(kryoRegistrarMap.values())); }
Source:
private void createAutoScaleGroup(Composite parent) { Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 1, false); final Button autoScaleDiagramCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT); autoScaleDiagramCheckBox.setText("Auto-Scale Diagram"); GridData data = new GridData(GridData.FILL, 0, true, false); autoScaleDiagramCheckBox.setLayoutData(data); autoScaleDiagramCheckBox.setSelection(this.autoScaleDiagram); autoScaleDiagramCheckBox.addSelectionListener(SelectionListener.widgetSelectedAdapter((evt) -> { this.autoScaleDiagram = autoScaleDiagramCheckBox.getSelection(); })); }

Target:
private void createAutoScaleGroup(Composite parent) { Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 1, false); final Button autoScaleDiagramCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT); autoScaleDiagramCheckBox.setText(Messages.AbstractExportRepresentationsAsImagesDialog_autoScaleDiagram); GridData data = new GridData(GridData.FILL, 0, true, false); autoScaleDiagramCheckBox.setLayoutData(data); autoScaleDiagramCheckBox.setSelection(this.autoScaleDiagram); autoScaleDiagramCheckBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { autoScaleDiagram = autoScaleDiagramCheckBox.getSelection(); } }); }
Source:
protected static void setUpConfigurationFiles(final HBaseTestingUtility testUtil) throws Exception { String absoluteDataPath = testUtil.getDataTestDir().toString(); Files.createDirectories(Paths.get(absoluteDataPath)); List<String> confs = Arrays.asList("/hbase-site.xml", "/hbase-site2.xml", "/hbase-site3.xml"); for (String conf : confs) { Path cnfPath = Paths.get("target/test-classes" + conf); Path newConfPath = Paths.get(absoluteDataPath + conf); if (!conf.equals("/hbase-site3.xml")) { Files.copy(cnfPath, newConfPath); } newCnfPathes.add(newConfPath); } testUtil.getConfiguration().addResource(testUtil.getDataTestDir("hbase-site.xml")); }

Target:
protected static void setUpConfigurationFiles(final HBaseTestingUtility testUtil) throws Exception { String absoluteDataPath = testUtil.getDataTestDir().toString(); Files.createDirectories(Paths.get(absoluteDataPath)); Path configFile = Paths.get("target", "test-classes", SERVER_CONFIG); configFileUnderTestDataDir = Paths.get(absoluteDataPath, SERVER_CONFIG); Files.copy(configFile, configFileUnderTestDataDir); Path overrideConfigFile = Paths.get("target", "test-classes", OVERRIDE_SERVER_CONFIG); overrideConfigFileUnderTestDataDir = Paths.get(absoluteDataPath, OVERRIDE_SERVER_CONFIG); Files.copy(overrideConfigFile, overrideConfigFileUnderTestDataDir); backupConfigFileUnderTestDataDir = Paths.get(absoluteDataPath, BACKUP_SERVER_CONFIG); testUtil.getConfiguration().addResource(testUtil.getDataTestDir(SERVER_CONFIG)); }
Source:
private List<JobView> jobViews() { JobViews views = new JobViews(new StaticJenkinsAPIs(), currentConfig()); List<JobView> jobs = new ArrayList<JobView>(); @SuppressWarnings("unchecked") List<ItemGroup<?>> groups = new ArrayList(filter(super.getItems(), AbstractFolder.class)); Pattern includePattern = Strings.isNullOrEmpty(currentConfig().getInclude()) ? null : Pattern.compile(currentConfig().getInclude()); Pattern excludePattern = Strings.isNullOrEmpty(currentConfig().getExclude()) ? null : Pattern.compile(currentConfig().getExclude()); for (ItemGroup<?> group : groups) { @SuppressWarnings("unchecked") List<Job<?, ?>> groupJobs = new ArrayList(filter(group.getItems(), Job.class)); for (Job<?, ?> job : groupJobs) { boolean shouldInclude = includePattern == null || includePattern.matcher(job.getRelativeNameFrom(group)).find(); boolean shouldExclude = excludePattern != null && excludePattern.matcher(job.getRelativeNameFrom(group)).find(); if (shouldInclude && !shouldExclude) { jobs.add(views.viewOf(job)); } } } @SuppressWarnings("unchecked") List<Job<?, ?>> projects = new ArrayList(filter(super.getItems(), Job.class)); Collections.sort(projects, currentConfig().getOrder()); for (Job project : projects) { jobs.add(views.viewOf(project)); } return jobs; }

Target:
private List<JobView> jobViews() { JobViews views = new JobViews(new StaticJenkinsAPIs(), currentConfig()); List<Job<?, ?>> projects = currentJobFilter().filterJobs(this.getItems()); Collections.sort(projects, currentConfig().getOrder()); List<JobView> jobs = new ArrayList<JobView>(projects.size()); for (Job project : projects) { jobs.add(views.viewOf(project)); } return jobs; }
Source:
public void removeSegments(Iterable<DataSegment> segments) { try { for (DataSegment segment : segments) { serverManager.dropSegment(segment); File segmentInfoCacheFile = new File(config.getSegmentInfoCacheDirectory(), segment.getIdentifier()); if (!segmentInfoCacheFile.delete()) { log.warn("Unable to delete segmentInfoCacheFile[%s]", segmentInfoCacheFile); } } announcer.unannounceSegments(segments); } catch (Exception e) { log.makeAlert("Failed to remove segments") .addData("segments", segments) .emit(); } }

Target:
public void removeSegments(Iterable<DataSegment> segments) { try { for (DataSegment segment : segments) { serverManager.dropSegment(segment); File segmentInfoCacheFile = new File(config.getSegmentInfoCacheDirectory(), segment.getIdentifier()); if (!segmentInfoCacheFile.delete()) { log.warn("Unable to delete segmentInfoCacheFile[%s]", segmentInfoCacheFile); } } announcer.unannounceSegments(segments); } catch (Exception e) { log.makeAlert(e, "Failed to remove segments") .addData("segments", segments) .emit(); } }
Source:
public void testValues() throws DatabaseEngineException { final Values values = values("id", "name") .rows(row(k(1), k("ana")), row(k(2), k("fred")), row(k(3), k("manuel")), row(k(4), k("rita"))); final List<Map<String, ResultColumn>> result = engine.query(values); final List<Integer> ids = result.stream() .map(row -> row.get("id").toInt()) .sorted() .collect(Collectors.toList()); final List<String> names = result.stream() .map(row -> row.get("name").toString()) .sorted() .collect(Collectors.toList()); assertEquals("id must be 1", new Integer(1), ids.get(0)); assertEquals("id must be 2", new Integer(2), ids.get(1)); assertEquals("id must be 3", new Integer(3), ids.get(2)); assertEquals("id must be 4", new Integer(4), ids.get(3)); assertEquals("name must be 'ana'", "ana", names.get(0)); assertEquals("name must be 'fred'", "fred", names.get(1)); assertEquals("name must be 'manuel'", "manuel", names.get(2)); assertEquals("name must be 'rita'", "rita", names.get(3)); }

Target:
public void testValues() throws DatabaseEngineException { final Values values = values("id", "name") .row(k(1), k("ana")) .row(k(2), k("fred")) .row(k(3), k("manuel")) .row(k(4), k("rita")); final List<Map<String, ResultColumn>> result = engine.query(values); final List<Integer> ids = result.stream() .map(row -> row.get("id").toInt()) .sorted() .collect(Collectors.toList()); final List<String> names = result.stream() .map(row -> row.get("name").toString()) .sorted() .collect(Collectors.toList()); assertEquals("id must be 1", new Integer(1), ids.get(0)); assertEquals("id must be 2", new Integer(2), ids.get(1)); assertEquals("id must be 3", new Integer(3), ids.get(2)); assertEquals("id must be 4", new Integer(4), ids.get(3)); assertEquals("name must be 'ana'", "ana", names.get(0)); assertEquals("name must be 'fred'", "fred", names.get(1)); assertEquals("name must be 'manuel'", "manuel", names.get(2)); assertEquals("name must be 'rita'", "rita", names.get(3)); }
Source:
public void init(final ProcessorContext context) { super.init(context); metrics = (StreamsMetricsImpl) context.metrics(); droppedRecordsSensor = droppedRecordsSensorOrSkippedRecordsSensor(Thread.currentThread().getName(), context.taskId().toString(), metrics); if (queryableName != null) { store = (TimestampedSerializedKeyValueStore<K, V>) context.getStateStore(queryableName); tupleForwarder = new TimestampedTupleForwarder<>( store, context, new TimestampedCacheFlushListener<>(context), sendOldValues); skippedIdempotentUpdatesSensor = skippedIdempotentUpdatesSensor(Thread.currentThread().getName(), context.taskId().toString(), ((InternalProcessorContext) context).currentNode().name(), metrics); } }

Target:
public void init(final ProcessorContext context) { super.init(context); metrics = (StreamsMetricsImpl) context.metrics(); droppedRecordsSensor = droppedRecordsSensorOrSkippedRecordsSensor(Thread.currentThread().getName(), context.taskId().toString(), metrics); if (queryableName != null) { final StateStore stateStore = context.getStateStore(queryableName); try { store = ((WrappedStateStore<MeteredTimestampedKeyValueStore<K, V>, K, V>) stateStore).wrapped(); } catch (final ClassCastException e) { throw new IllegalStateException("Unexpected store type: " + stateStore.getClass() + " for store: " + queryableName, e); } tupleForwarder = new TimestampedTupleForwarder<>( store, context, new TimestampedCacheFlushListener<>(context), sendOldValues); skippedIdempotentUpdatesSensor = skippedIdempotentUpdatesSensor( Thread.currentThread().getName(), context.taskId().toString(), ((InternalProcessorContext) context).currentNode().name(), metrics ); } }
Source:
public Statistics calc() { List<Double> copy; long count; synchronized (this) { copy = new ArrayList<Double>(this.samples); count = this.count; } double sum = 0; double decay = 1 - 1. / this.window; double sumSquares = 0; double weight = 0; double min = this.min; double max = this.max; for (Double value : copy) { value /= this.factor; if (value > max) { max = value; } if (value < min) { min = value; } sum = decay * sum + value; sumSquares = decay * sumSquares + value * value; weight = decay * weight + 1; } synchronized (this) { if (max > this.max) { this.max = max; } if (min < this.min) { this.min = min; } } double mean = weight > 0 ? sum / weight : 0.; double var = weight > 0 ? sumSquares / weight - mean * mean : 0.; double standardDeviation = var > 0 ? Math.sqrt(var) : 0; return new Statistics(count, min == Double.MAX_VALUE ? 0 : min, max, mean, standardDeviation); }

Target:
private Statistics calc() { List<Double> copy; long count; synchronized (this) { copy = new ArrayList<Double>(this.samples); count = this.count; } double sum = 0; double decay = 1 - 1. / this.window; double sumSquares = 0; double weight = 0; double min = this.min; double max = this.max; for (Double value : copy) { value /= this.factor; if (value > max) { max = value; } if (value < min) { min = value; } sum = decay * sum + value; sumSquares = decay * sumSquares + value * value; weight = decay * weight + 1; } synchronized (this) { if (max > this.max) { this.max = max; } if (min < this.min) { this.min = min; } } double mean = weight > 0 ? sum / weight : 0.; double var = weight > 0 ? sumSquares / weight - mean * mean : 0.; double standardDeviation = var > 0 ? Math.sqrt(var) : 0; return new Statistics(count, min == Double.MAX_VALUE ? 0 : min, max, mean, standardDeviation); }
Source:
public Map<SimpleInterval, Integer> getSimpleIntervalToIndexMap() { Map<SimpleInterval, Integer> intervalToIndexMap = new HashMap<>(); IntStream.range(0, counts.size()).forEach(i -> intervalToIndexMap.put(counts.get(i).getInterval(), i)); return intervalToIndexMap; }

Target:
public Map<SimpleInterval, Integer> getSimpleIntervalToIndexMap() { return IntStream.range(0, counts.size()).boxed() .collect(Collectors.toMap(i -> counts.get(i).getInterval(), i -> i)); }
Source:
protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (savedInstanceState == null){ try { fragment = new CourseOutlineFragment(); fragment.setTaskProcessCallback(this); if (courseData != null) { Bundle bundle = new Bundle(); bundle.putSerializable(Router.EXTRA_ENROLLMENT, courseData); bundle.putString(Router.EXTRA_COURSE_COMPONENT_ID, courseComponentId); if (getIntent() != null) { bundle.putString(Router.EXTRA_LAST_ACCESSED_ID , getIntent().getStringExtra(Router.EXTRA_LAST_ACCESSED_ID)); } fragment.setArguments(bundle); } fragment.setRetainInstance(true); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.fragment_container, fragment, CourseOutlineFragment.TAG); fragmentTransaction.disallowAddToBackStack(); fragmentTransaction.commit(); } catch (Exception e) { logger.error(e); } } else { fragment = (CourseOutlineFragment) getSupportFragmentManager().findFragmentByTag(CourseOutlineFragment.TAG); } if (!isOnCourseOutline()) { CourseComponent courseComponent = courseManager.getComponentById(courseData.getCourse().getId(), courseComponentId); String prefName = PrefManager.getPrefNameForLastAccessedBy(getProfile() .username, courseComponent.getCourseId()); final PrefManager prefManager = new PrefManager(MainApplication.instance(), prefName); prefManager.putLastAccessedSubsection(courseComponent.getId(), false); } }

Target:
protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (savedInstanceState == null){ try { fragment = new CourseOutlineFragment(); fragment.setTaskProcessCallback(this); if (courseData != null) { Bundle bundle = new Bundle(); bundle.putSerializable(Router.EXTRA_ENROLLMENT, courseData); bundle.putString(Router.EXTRA_COURSE_COMPONENT_ID, courseComponentId); bundle.putString(Router.EXTRA_LAST_ACCESSED_ID , getIntent().getStringExtra(Router.EXTRA_LAST_ACCESSED_ID)); fragment.setArguments(bundle); } fragment.setRetainInstance(true); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.fragment_container, fragment, CourseOutlineFragment.TAG); fragmentTransaction.disallowAddToBackStack(); fragmentTransaction.commit(); } catch (Exception e) { logger.error(e); } } else { fragment = (CourseOutlineFragment) getSupportFragmentManager().findFragmentByTag(CourseOutlineFragment.TAG); } if (!isOnCourseOutline()) { CourseComponent courseComponent = courseManager.getComponentById(courseData.getCourse().getId(), courseComponentId); String prefName = PrefManager.getPrefNameForLastAccessedBy(getProfile() .username, courseComponent.getCourseId()); final PrefManager prefManager = new PrefManager(MainApplication.instance(), prefName); prefManager.putLastAccessedSubsection(courseComponent.getId(), false); } }
Source:
public int getRetries() { final String retryString = this.getOptionValueWithDefault(RETRIES.getOpt(), DEFAULT_RETRIES).toString(); try { return Integer.parseInt(retryString); } catch (final NumberFormatException e) { System.err.printf("Error: Argument (%s) to '-r' was not a number\n", retryString); System.exit(1); } return -1; }

Target:
public int getRetries() throws BadArgumentException { final String retryString = this.getOptionValueWithDefault(RETRIES.getOpt(), DEFAULT_RETRIES).toString(); try { return Integer.parseInt(retryString); } catch (final NumberFormatException e) { throw new BadArgumentException("Argument to '-r' was not a number", e); } }
Source:
public void run() { while (!server.isStopped()) { long now = System.currentTimeMillis(); checkLowReplication(now); if (!rollLog.get()) { boolean periodic = false; for (RollController controller : wals.values()) { if (controller.needsPeriodicRoll(now)) { periodic = true; break; } } if (!periodic) { synchronized (rollLog) { try { if (!rollLog.get()) { rollLog.wait(this.threadWakeFrequency); } } catch (InterruptedException e) { } } continue; } } rollLock.lock(); try { for (Entry<WAL, RollController> entry : wals.entrySet()) { final WAL wal = entry.getKey(); RollController controller = entry.getValue(); if (controller.isRollRequested()) { LOG.debug("WAL " + wal + " roll requested"); } else if (controller.needsPeriodicRoll(now)) { LOG.debug("WAL " + wal + " roll period " + this.rollPeriod + "ms elapsed"); } else { continue; } final byte [][] regionsToFlush = controller.rollWal(now); if (regionsToFlush != null) { for (byte r: regionsToFlush) scheduleFlush(r); } } } catch (FailedLogCloseException e) { server.abort("Failed log close in log roller", e); } catch (java.net.ConnectException e) { server.abort("Failed log close in log roller", e); } catch (IOException ex) { LOG.fatal("Aborting", ex); server.abort("IOE in log roller", RemoteExceptionHandler.checkIOException(ex)); } catch (Exception ex) { final String msg = "Failed rolling WAL; aborting to recover edits!"; LOG.error(msg, ex); server.abort(msg, ex); } finally { try { rollLog.set(false); } finally { rollLock.unlock(); } } } LOG.info("LogRoller exiting."); }

Target:
public void run() { while (!server.isStopped()) { long now = EnvironmentEdgeManager.currentTime(); checkLowReplication(now); if (!rollLog.get()) { boolean periodic = false; for (RollController controller : wals.values()) { if (controller.needsPeriodicRoll(now)) { periodic = true; break; } } if (!periodic) { synchronized (rollLog) { try { if (!rollLog.get()) { rollLog.wait(this.threadWakeFrequency); } } catch (InterruptedException e) { } } continue; } } rollLock.lock(); try { for (Entry<WAL, RollController> entry : wals.entrySet()) { final WAL wal = entry.getKey(); RollController controller = entry.getValue(); if (controller.isRollRequested()) { LOG.debug("WAL " + wal + " roll requested"); } else if (controller.needsPeriodicRoll(now)) { LOG.debug("WAL " + wal + " roll period " + this.rollPeriod + "ms elapsed"); } else { continue; } final byte [][] regionsToFlush = controller.rollWal(now); if (regionsToFlush != null) { for (byte r: regionsToFlush) scheduleFlush(r); } } } catch (FailedLogCloseException e) { server.abort("Failed log close in log roller", e); } catch (java.net.ConnectException e) { server.abort("Failed log close in log roller", e); } catch (IOException ex) { LOG.fatal("Aborting", ex); server.abort("IOE in log roller", RemoteExceptionHandler.checkIOException(ex)); } catch (Exception ex) { final String msg = "Failed rolling WAL; aborting to recover edits!"; LOG.error(msg, ex); server.abort(msg, ex); } finally { try { rollLog.set(false); } finally { rollLock.unlock(); } } } LOG.info("LogRoller exiting."); }
Source:
public String toString() { return String.format("byte@0x%x=0x%x (%d)", Pointer.nativeValue(getPointer()), getValue(), getValue()); }

Target:
public String toString() { return String.format("byte@0x%1$x=0x%2$x (%2$d)", Pointer.nativeValue(getPointer()), getValue()); }
Source:
private boolean matchNamePattern(String value, String namePattern) { boolean match = true; if (value != null && StringUtils.isNotBlank(value)) { match = value.matches(namePattern); } return match; }

Target:
private boolean matchNamePattern(String value, String namePattern) { boolean match = true; if (StringUtils.isNotBlank(value)) { match = value.matches(namePattern); } return match; }
Source:
private static void handlePlatformJar(@NotNull PathsList classPath, @NotNull AndroidPlatform platform, @NotNull JavaArtifact artifact) { String androidJarPath = platform.getTarget().getPath(IAndroidTarget.ANDROID_JAR); for (String entry : classPath.getPathList()) { if (pathsEqual(androidJarPath, entry)) { classPath.remove(entry); } } List<String> mockableJars = ContainerUtil.newSmartList(); for (String path : classPath.getPathList()) { if (new File(toSystemDependentName(path)).getName().startsWith("mockable-")) { mockableJars.add(path); } } for (String mockableJar : mockableJars) { classPath.remove(mockableJar); } File mockableJar = getMockableJarFromModel(artifact); if (mockableJar != null) { classPath.addTail(mockableJar.getPath()); } else { for (String mockableJarPath : mockableJars) { if (mockableJarPath.endsWith("-" + platform.getApiLevel() + ".jar")) { classPath.addTail(mockableJarPath); return; } } throw new IllegalStateException(String.format("Could not find matching mockable platform jar. Found %d total mockable jars.", mockableJars.size())); } }

Target:
private static void handlePlatformJar(@NotNull PathsList classPath, @NotNull AndroidPlatform platform, @NotNull JavaArtifact artifact) { String androidJarPath = platform.getTarget().getPath(IAndroidTarget.ANDROID_JAR); for (String entry : classPath.getPathList()) { if (pathsEqual(androidJarPath, entry)) { classPath.remove(entry); } } List<String> mockableJars = ContainerUtil.newSmartList(); for (String path : classPath.getPathList()) { if (new File(toSystemDependentName(path)).getName().startsWith("mockable-")) { mockableJars.add(path); } } for (String mockableJar : mockableJars) { classPath.remove(mockableJar); } File mockableJar = getMockableJarFromModel(artifact); if (mockableJar != null) { classPath.addTail(mockableJar.getPath()); } else { for (String mockableJarPath : mockableJars) { if (mockableJarPath.endsWith("-" + platform.getApiLevel() + ".jar")) { classPath.addTail(mockableJarPath); return; } } throw new IllegalStateException(String.format("Could not find matching mockable platform jar. Mockable jars found: [%s].", Joiner.on(',').join(mockableJars))); } }