auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String getProjectName() throws Exception { String url = serverUrl + API_PROJECT_NAME + "?format=json" + "&key=" + projectKey; String http = client.getHttp(url, username, password); JSONArray jsonArray = (JSONArray) JSONSerializer.toJSON(http); if (jsonArray.size() != 1) { throw new Exception("Can't find project " + projectKey + ". Number of projects found: " + jsonArray.size()); } JSONObject obj = jsonArray.getJSONObject(0); return obj.getString("nm"); }

Target:
private String getProjectName() throws Exception { String url = serverUrl + API_PROJECT_NAME + encode(projectKey); String http = client.getHttp(url, username, password); JSONArray jsonArray = (JSONArray) JSONSerializer.toJSON(http); if (jsonArray.size() != 1) { throw new Exception("Can't find project " + projectKey + ". Number of projects found: " + jsonArray.size()); } JSONObject obj = jsonArray.getJSONObject(0); return obj.getString("nm"); }
Source:
public void shouldReturnNotEnrolledWhenProgramEnrollmentNotFoundForLookupByUuidAndProgramName() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_UUID, DEFAULT_UUID); lookupFields.put(PROGRAM_NAME, PROGRAM_ANOTHER_NAME); when(programEnrollmentService.getProgramEnrollmentByPatientUuid(eq(CONFIG_NAME), eq(DEFAULT_UUID))) .thenReturn(prepareProgramEnrollments()); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, BY_UUID_AMD_PROGRAM_NAME, lookupFields); verify(programEnrollmentService).getProgramEnrollmentByPatientUuid(eq(CONFIG_NAME), eq(DEFAULT_UUID)); assertEquals(false, ((ProgramEnrollment) object).isEnrolled()); assertEquals(ProgramEnrollment.NOT_ENROLLED, ((ProgramEnrollment) object).getEnrolledString()); }

Target:
public void shouldReturnNotEnrolledWhenProgramEnrollmentNotFoundForLookupByUuidAndProgramName() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_UUID, DEFAULT_UUID); lookupFields.put(PROGRAM_NAME, PROGRAM_ANOTHER_NAME); when(programEnrollmentService.getProgramEnrollmentByPatientUuid(eq(CONFIG_NAME), eq(DEFAULT_UUID))) .thenReturn(prepareProgramEnrollments()); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, BY_UUID_AMD_PROGRAM_NAME, lookupFields); verify(programEnrollmentService).getProgramEnrollmentByPatientUuid(eq(CONFIG_NAME), eq(DEFAULT_UUID)); assertTrue(object instanceof ProgramEnrollment); ProgramEnrollment actual = (ProgramEnrollment) object; assertFalse(actual.isEnrolled()); assertEquals(ProgramEnrollment.NOT_ENROLLED, actual.getEnrolledString()); assertNull(actual.getCurrentState()); }
Source:
public Component getListCellRendererComponent( JList<? extends CheckBoxJList.CheckboxListItem> list, CheckBoxJList.CheckboxListItem value, int index, boolean isSelected, boolean cellHasFocus) { setBackground(list.getBackground()); checkbox.setSelected(value.isChecked()); checkbox.setBackground(list.getBackground()); label.setText(value.getDisplayName()); if (value.hasIcon()) { label.setIcon(value.getIcon()); } setEnabled(list.isEnabled()); return this; }

Target:
public Component getListCellRendererComponent( JList<? extends CheckBoxJList.CheckboxListItem> list, CheckBoxJList.CheckboxListItem value, int index, boolean isSelected, boolean cellHasFocus) { setBackground(list.getBackground()); checkbox.setSelected(value.isChecked()); checkbox.setBackground(list.getBackground()); checkbox.setEnabled(list.isEnabled()); label.setText(value.getDisplayName()); label.setEnabled(list.isEnabled()); if (value.hasIcon()) { label.setIcon(value.getIcon()); } setEnabled(list.isEnabled()); return this; }
Source:
public void scenario9() throws IOException { final String idPublic = "/rest/anotherCollection/publicObj"; final String groups = "/rest/group"; final String fooGroup = groups + "/foo"; final String testObj = ingestObj("/rest/anotherCollection"); final String publicObj = ingestObj(idPublic); final String groupColl = ingestObj(groups); final HttpPut request = putObjMethod(fooGroup); setAuth(request, "fedoraAdmin"); final InputStream file = this.getClass().getResourceAsStream("/acls/09/group.ttl"); final InputStreamEntity fileEntity = new InputStreamEntity(file); request.setEntity(fileEntity); request.setHeader("Content-Type", "text/turtle;charset=UTF-8"); try (final CloseableHttpResponse response = execute(request)) { assertEquals("Didn't get a CREATED response!", CREATED.getStatusCode(), getStatus(response)); } final String acl9 = ingestAcl("fedoraAdmin", "/acls/09/acl.ttl", "/acls/09/authorization.ttl"); linkToAcl(testObj, acl9); logger.debug("Person1 can see object " + publicObj); final HttpGet requestGet = getObjMethod(idPublic); setAuth(requestGet, "person1"); try (final CloseableHttpResponse response = execute(requestGet)) { assertEquals(HttpStatus.SC_OK, getStatus(response)); } logger.debug("Person2 can see object " + publicObj); final HttpGet requestGet2 = getObjMethod(idPublic); setAuth(requestGet2, "person2"); try (final CloseableHttpResponse response = execute(requestGet2)) { assertEquals(HttpStatus.SC_OK, getStatus(response)); } logger.debug("Person3 user cannot see object " + publicObj); final HttpGet requestGet3 = getObjMethod(idPublic); setAuth(requestGet3, "person3"); try (final CloseableHttpResponse response = execute(requestGet3)) { assertEquals(HttpStatus.SC_FORBIDDEN, getStatus(response)); } }

Target:
public void scenario9() throws IOException { final String idPublic = "/rest/anotherCollection/publicObj"; final String groups = "/rest/group"; final String fooGroup = groups + "/foo"; final String testObj = ingestObj("/rest/anotherCollection"); final String publicObj = ingestObj(idPublic); final HttpPut request = putObjMethod(fooGroup); setAuth(request, "fedoraAdmin"); final InputStream file = this.getClass().getResourceAsStream("/acls/09/group.ttl"); final InputStreamEntity fileEntity = new InputStreamEntity(file); request.setEntity(fileEntity); request.setHeader("Content-Type", "text/turtle;charset=UTF-8"); assertEquals("Didn't get a CREATED response!", CREATED.getStatusCode(), getStatus(request)); final String acl9 = ingestAcl("fedoraAdmin", "/acls/09/acl.ttl", "/acls/09/authorization.ttl"); linkToAcl(testObj, acl9); logger.debug("Person1 can see object " + publicObj); final HttpGet requestGet1 = getObjMethod(idPublic); setAuth(requestGet1, "person1"); assertEquals(HttpStatus.SC_OK, getStatus(requestGet1)); logger.debug("Person2 can see object " + publicObj); final HttpGet requestGet2 = getObjMethod(idPublic); setAuth(requestGet2, "person2"); assertEquals(HttpStatus.SC_OK, getStatus(requestGet2)); logger.debug("Person3 user cannot see object " + publicObj); final HttpGet requestGet3 = getObjMethod(idPublic); setAuth(requestGet3, "person3"); assertEquals(HttpStatus.SC_FORBIDDEN, getStatus(requestGet3)); }
Source:
public void messageTrackedAndRemovedWhenClientLeaves() throws Exception { Assert.assertThat(activeMessageHandler.getTrackedClients().count(), is(0L)); storeProxy.getAndAppend(42L, createPayload(42L)); Map<Long, EhcacheEntityResponse> responses = activeMessageHandler.getTrackedResponsesForSegment(11, activeMessageHandler.getTrackedClients().findFirst().get()); assertThat(responses).hasSize(1); assertThat(activeEntity.getConnectedClients()).hasSize(1); service.stop(); activeEntity.notifyDestroyed(activeMessageHandler.getTrackedClients().iterator().next()); waitForPredicate(e -> activeEntity.getConnectedClients().size() > 0, 2000); Assert.assertThat(activeMessageHandler.getTrackedClients().count(), is(0L)); }

Target:
public void messageTrackedAndRemovedWhenClientLeaves() throws Exception { assertThat(activeMessageHandler.getTrackedClients().count()).isZero(); storeProxy.getAndAppend(42L, createPayload(42L)); Map<Long, EhcacheEntityResponse> responses = activeMessageHandler.getTrackedResponsesForSegment(KEY_ENDS_UP_IN_SEGMENT_11, activeMessageHandler.getTrackedClients().findFirst().get()); assertThat(responses).hasSize(1); assertThat(activeEntity.getConnectedClients()).hasSize(1); service.stop(); activeEntity.notifyDestroyed(activeMessageHandler.getTrackedClients().iterator().next()); waitForPredicate(e -> activeEntity.getConnectedClients().size() > 0, 2000); assertThat(activeMessageHandler.getTrackedClients().count()).isZero(); }
Source:
private static Allele determineReferenceAlleleGivenReferenceBase(final List<VariantContext> VCs, final Locatable loc, final Byte refBase) { final Allele refAllele = GATKVariantContextUtils.determineReferenceAllele(VCs, loc); if ( refAllele == null ) { return (refBase == null ? null : Allele.create(refBase, true)); } return refAllele; }

Target:
private static Allele determineReferenceAlleleGivenReferenceBase(final List<VariantContext> VCs, final Locatable loc, final Byte refBase) { final Allele refAllele = GATKVariantContextUtils.determineReferenceAllele(VCs, loc); if ( refAllele == null ) { if (refBase == null) { return null; } else { return Allele.create(refBase, true); } } else { return refAllele; } }
Source:
public static void cleanup() { Integer level = LEVEL.get(); fireMethodCalled( level, "cleanup", null, null ); if ( level.intValue() == 1 ) { MAPPING.set( null ); LEVEL.set( null ); } else { LEVEL.set( level.intValue() - 1 ); } }

Target:
public static void cleanup() { Integer level = LEVEL.get(); fireMethodCalled( level, "cleanup", null, null ); if ( level == 1 ) { MAPPING.set( null ); LEVEL.set( null ); } else { LEVEL.set( level - 1 ); } }
Source:
private void injectAccountAndContainerUsingAccountAndContainerUri(RestRequest restRequest, RestRequestMetricsGroup metricsGroup) throws RestServiceException { String[] slashFields = parseInput(restRequest.getPath()); String accountName = slashFields[2]; Account targetAccount = accountService.getAccountByName(accountName); if (targetAccount == null) { frontendMetrics.unrecognizedAccountNameCount.inc(); throw new RestServiceException("Account cannot be found for accountName=" + accountName + " in put request with account and container headers.", RestServiceErrorCode.InvalidAccount); } ensureAccountNameMatch(targetAccount, restRequest); String containerName = slashFields[3]; Container targetContainer = targetAccount.getContainerByName(containerName); if (targetContainer == null) { frontendMetrics.unrecognizedContainerNameCount.inc(); throw new RestServiceException( "Container cannot be found for accountName=" + accountName + " and containerName=" + containerName + " in put request with account and container headers.", RestServiceErrorCode.InvalidContainer); } setTargetAccountAndContainerInRestRequest(restRequest, targetAccount, targetContainer, metricsGroup); }

Target:
private void injectAccountAndContainerUsingAccountAndContainerUri(RestRequest restRequest, RestRequestMetricsGroup metricsGroup) throws RestServiceException { NamedBlobPath namedBlobPath = RestUtils.parseInput(RestUtils.getRequestPath(restRequest).getOperationOrBlobId(false)); String accountName = namedBlobPath.getAccountName(); Account targetAccount = accountService.getAccountByName(accountName); if (targetAccount == null) { frontendMetrics.unrecognizedAccountNameCount.inc(); throw new RestServiceException("Account cannot be found for accountName=" + accountName + " in put request with account and container headers.", RestServiceErrorCode.InvalidAccount); } ensureAccountNameMatch(targetAccount, restRequest); String containerName = namedBlobPath.getContainerName(); Container targetContainer = targetAccount.getContainerByName(containerName); if (targetContainer == null) { frontendMetrics.unrecognizedContainerNameCount.inc(); throw new RestServiceException( "Container cannot be found for accountName=" + accountName + " and containerName=" + containerName + " in put request with account and container headers.", RestServiceErrorCode.InvalidContainer); } setTargetAccountAndContainerInRestRequest(restRequest, targetAccount, targetContainer, metricsGroup); }
Source:
public void eventsShouldBeStreamedOnTimeout() throws InterruptedException { final long timeout = TimeUnit.SECONDS.toMillis(1); final PartitionData pd = new PartitionData(null, 100L); for (int i = 0; i < 100; ++i) { pd.addEventFromKafka(i + 100L + 1, "test".getBytes()); } SortedMap<Long, byte[]> data = pd.takeEventsToStream(currentTimeMillis(), 1000, timeout); assertNull(data); assertEquals(0, pd.getKeepAliveInARow()); Thread.sleep(timeout); data = pd.takeEventsToStream(currentTimeMillis(), 1000, timeout); assertNotNull(data); assertEquals(100, data.size()); for (int i = 100; i < 200; ++i) { pd.addEventFromKafka(i + 100L + 1, "test".getBytes()); } data = pd.takeEventsToStream(currentTimeMillis(), 1000, timeout); assertNull(data); assertEquals(0, pd.getKeepAliveInARow()); Thread.sleep(timeout); data = pd.takeEventsToStream(currentTimeMillis(), 1000, timeout); assertNotNull(data); assertEquals(100, data.size()); }

Target:
public void eventsShouldBeStreamedOnTimeout() throws InterruptedException { final long timeout = TimeUnit.SECONDS.toMillis(1); final PartitionData pd = new PartitionData(null, 100L); for (int i = 0; i < 100; ++i) { pd.addEventFromKafka(i + 100L + 1, "test".getBytes(UTF_8)); } SortedMap<Long, byte[]> data = pd.takeEventsToStream(currentTimeMillis(), 1000, timeout); assertNull(data); assertEquals(0, pd.getKeepAliveInARow()); Thread.sleep(timeout); data = pd.takeEventsToStream(currentTimeMillis(), 1000, timeout); assertNotNull(data); assertEquals(100, data.size()); for (int i = 100; i < 200; ++i) { pd.addEventFromKafka(i + 100L + 1, "test".getBytes(UTF_8)); } data = pd.takeEventsToStream(currentTimeMillis(), 1000, timeout); assertNull(data); assertEquals(0, pd.getKeepAliveInARow()); Thread.sleep(timeout); data = pd.takeEventsToStream(currentTimeMillis(), 1000, timeout); assertNotNull(data); assertEquals(100, data.size()); }
Source:
public void appendSeries(String namePrefix, String name, String nameSuffix, String[] columns, Object[][] points) { if (hasSeriesData) pointsJson.append(','); hasSeriesData = true; final DateTime timestamp = new DateTime(); pointsJson.append("{\"name\":\"").append(namePrefix).append(name).append(nameSuffix).append("\",\"fields\":{"); Object[] row = points[0]; for (int j = 1; j < row.length; j++) { if (j > 1) pointsJson.append(','); Object value = row[j]; pointsJson.append("\"" + columns[j] + "\":"); if (value instanceof String) { pointsJson.append('"').append(value).append('"'); } else if ((value instanceof Collection) && ((Collection<?>) value).size() < 1) { pointsJson.append("null"); } else if (value instanceof Double && Double.isInfinite((double) value)) { pointsJson.append("null"); } else if (value instanceof Float && Float.isInfinite((float) value)) { pointsJson.append("null"); } else { pointsJson.append(value); } } pointsJson.append("},"); pointsJson.append("\"timestamp\": \"" + timestamp + "\" }"); }

Target:
public void appendSeries(String namePrefix, String name, String nameSuffix, String[] columns, Object[][] points) { if (hasSeriesData) pointsJson.append(','); hasSeriesData = true; final DateTime timestamp = new DateTime(); pointsJson.append("{\"measurement\":\"").append(namePrefix).append(name).append(nameSuffix).append("\",\"fields\":{"); Object[] row = points[0]; for (int j = 1; j < row.length; j++) { if (j > 1) { pointsJson.append(','); } Object value = row[j]; pointsJson.append("\"" + columns[j] + "\":"); if (value instanceof String) { pointsJson.append('"').append(value).append('"'); } else if ((value instanceof Collection) && ((Collection<?>) value).size() < 1) { pointsJson.append("null"); } else if (value instanceof Double && Double.isInfinite((double) value)) { pointsJson.append("null"); } else if (value instanceof Float && Float.isInfinite((float) value)) { pointsJson.append("null"); } else { pointsJson.append(value); } } pointsJson.append("},"); pointsJson.append("\"timestamp\": \"" + timestamp + "\" }"); }
Source:
void classNameSource() { String testClassName = "com.unknown.package.ClassByName"; JavaClassSource source = new JavaClassSource(testClassName); assertThat(source.getClassName()).isEqualTo(testClassName); assertThat(source.getPosition()).isEmpty(); }

Target:
void classNameSource() { String testClassName = "com.unknown.mypackage.ClassByName"; JavaClassSource source = new JavaClassSource(testClassName); assertThat(source.getClassName()).isEqualTo(testClassName); assertThat(source.getPosition()).isEmpty(); }
Source:
private DateTime extractFrom(HttpServletRequest request) { DateTime now = clock.now(); DateTime from = dateTimeParser.parse(getParameter(request, "from"), now); return from; }

Target:
private DateTime extractFrom(HttpServletRequest request) { DateTime now = clock.now(); DateTime from = dateTimeParser.parse(getParameter(request, FROM_PARAM), now); return from; }
Source:
private void checkExpression(Tree tree, SymbolicValue leftOp, SymbolicValue rightOp) { switch (tree.kind()) { case MULTIPLY: case MULTIPLY_ASSIGNMENT: handleMultiply(leftOp, rightOp); break; case PLUS: case PLUS_ASSIGNMENT: case MINUS: case MINUS_ASSIGNMENT: handlePlusMinus(leftOp, rightOp); break; case DIVIDE: case DIVIDE_ASSIGNMENT: case REMAINDER: case REMAINDER_ASSIGNMENT: if (isZero(rightOp)) { reportIssue(tree); } else { handleDivide(tree.kind(), leftOp, rightOp); } break; default: } }

Target:
private void checkExpression(Tree tree, SymbolicValue leftOp, SymbolicValue rightOp) { switch (tree.kind()) { case MULTIPLY: case MULTIPLY_ASSIGNMENT: handleMultiply(leftOp, rightOp); break; case PLUS: case PLUS_ASSIGNMENT: case MINUS: case MINUS_ASSIGNMENT: handlePlusMinus(leftOp, rightOp); break; case DIVIDE: case DIVIDE_ASSIGNMENT: case REMAINDER: case REMAINDER_ASSIGNMENT: handleDivide(tree, leftOp, rightOp); break; default: } }
Source:
private void setSocketHostname(SSLSocket sslSocket, String hostname) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { boolean ret = false; try { Method method = sslSocket.getClass().getMethod("setHostname", String.class); method.invoke(sslSocket, hostname); ret = true; } catch (NoSuchMethodException ex) { } catch (InvocationTargetException ex) { } catch (IllegalAccessException ex) { } if (!ret && LOG_ENABLED) { LogUtils.i(TAG, "setHostname isn't available for this socket."); } } }

Target:
private void setSocketHostname(SSLSocket sslSocket, String hostname) { try { Method method = sslSocket.getClass().getMethod("setHostname", String.class); method.invoke(sslSocket, hostname); return; } catch (NoSuchMethodException ex) { } catch (InvocationTargetException ex) { } catch (IllegalAccessException ex) { } if (LOG_ENABLED) { LogUtils.i(TAG, "setHostname isn't available for this socket."); } }
Source:
public static EntityManager getEntityManager() throws ApplicationSettingsException { if (factory == null) { String connectionProperties = "DriverClassName=" + readServerProperties(REPLICACATALOG_JDBC_DRIVER) + "," + "Url=" + readServerProperties(REPLICACATALOG_JDBC_URL) + "?autoReconnect=true," + "Username=" + readServerProperties(REPLICACATALOG_JDBC_USER) + "," + "Password=" + readServerProperties(REPLICACATALOG_JDBC_PWD) + ",validationQuery=" + readServerProperties(REPLICACATALOG_VALIDATION_QUERY); System.out.println(connectionProperties); Map<String, String> properties = new HashMap<>(); properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource"); properties.put("openjpa.ConnectionProperties", connectionProperties); properties.put("openjpa.DynamicEnhancementAgent", "true"); properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported"); properties.put("openjpa.RemoteCommitProvider","sjvm"); properties.put("openjpa.Log","DefaultLevel=TRACE, Runtime=TRACE, Tool=TRACE, SQL=TRACE"); properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)"); properties.put("openjpa.jdbc.QuerySQLCache", "false"); properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72," + " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true"); factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties); } dataCatEntityManager = factory.createEntityManager(); return dataCatEntityManager; }

Target:
public static EntityManager getEntityManager() throws ApplicationSettingsException { if (factory == null) { String connectionProperties = "DriverClassName=" + readServerProperties(REPLICACATALOG_JDBC_DRIVER) + "," + "Url=" + readServerProperties(REPLICACATALOG_JDBC_URL) + "?autoReconnect=true," + "Username=" + readServerProperties(REPLICACATALOG_JDBC_USER) + "," + "Password=" + readServerProperties(REPLICACATALOG_JDBC_PWD) + ",validationQuery=" + readServerProperties(REPLICACATALOG_VALIDATION_QUERY); System.out.println(connectionProperties); Map<String, String> properties = new HashMap<>(); properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource"); properties.put("openjpa.ConnectionProperties", connectionProperties); properties.put("openjpa.DynamicEnhancementAgent", "true"); properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported"); properties.put("openjpa.RemoteCommitProvider","sjvm"); properties.put("openjpa.Log","DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO"); properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)"); properties.put("openjpa.jdbc.QuerySQLCache", "false"); properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72," + " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true"); factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties); } dataCatEntityManager = factory.createEntityManager(); return dataCatEntityManager; }
Source:
public void setButtonType(int buttonType) { if (buttonType == mButtonType) { return; } mButtonType = buttonType; mTextView.setText(getButtonTextResId(buttonType)); if (buttonType == BUTTON_RETRY) { mImageView.setImageResource(0); Resources resources = mImageView.getContext().getResources(); Drawable drawable = resources.getDrawable(getButtonIconResId(buttonType)); drawable = DrawableCompat.wrap(drawable); DrawableCompat.setTint(drawable, resources.getColor(R.color.blue_medium)); mImageView.setImageDrawable(drawable); } else { mImageView.setImageResource(getButtonIconResId(buttonType)); } }

Target:
public void setButtonType(int buttonType) { if (buttonType == mButtonType) { return; } mButtonType = buttonType; mTextView.setText(getButtonTextResId(buttonType)); mImageView.setImageResource(getButtonIconResId(buttonType)); }
Source:
private Map<String, String> getStatusXml(Connection connection) throws SQLException { Map<String, String> result = new HashMap<>(); PreparedStatement getStatusXml = connection.prepareStatement("SELECT s.runName, s.xml FROM Status AS s WHERE s.xml IS NOT NULL"); ResultSet rs = getStatusXml.executeQuery(); while (rs.next()) { String key = rs.getString("runName"); String value = rs.getString("xml"); result.put(key, value); } return result; }

Target:
private Map<String, String> getStatusXml(Connection connection) throws SQLException { Map<String, String> result = new HashMap<>(); PreparedStatement getStatusXml = connection.prepareStatement("SELECT s.runName, s.xml FROM Status AS s WHERE s.xml IS NOT NULL"); ResultSet rs = getStatusXml.executeQuery(); try { while (rs.next()) { String key = rs.getString("runName"); String value = rs.getString("xml"); result.put(key, value); } } finally { getStatusXml.close(); rs.close(); } return result; }
Source:
public void registerServer(LoadBalanceZookeeperConf configuration, int pqsPort, String zookeeperConnectString, String pqsHost) throws Exception { this.client = CuratorFrameworkFactory.newClient(zookeeperConnectString, new ExponentialBackoffRetry(1000,10)); this.client.start(); HostAndPort hostAndPort = HostAndPort.fromParts(pqsHost,pqsPort); String path = configuration.getFullPathToNode(hostAndPort); String node = hostAndPort.toString(); this.client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(path ,node.getBytes(StandardCharsets.UTF_8)); Stat stat = this.client.setACL().withACL(configuration.getAcls()).forPath(path); if (stat != null) { LOG.info(" node created with right ACL"); } else { LOG.error("could not create node with right ACL. So, system would exit now."); System.exit(-1); } }

Target:
public void registerServer(LoadBalanceZookeeperConf configuration, int pqsPort, String zookeeperConnectString, String pqsHost) throws Exception { this.client = CuratorFrameworkFactory.newClient(zookeeperConnectString, new ExponentialBackoffRetry(1000,10)); this.client.start(); HostAndPort hostAndPort = HostAndPort.fromParts(pqsHost,pqsPort); String path = configuration.getFullPathToNode(hostAndPort); String node = hostAndPort.toString(); this.client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(path ,node.getBytes(StandardCharsets.UTF_8)); Stat stat = this.client.setACL().withACL(configuration.getAcls()).forPath(path); if (stat != null) { LOG.info(" node created with right ACL"); } else { LOG.error("could not create node with right ACL. So, system would exit now."); throw new RuntimeException(" Unable to connect to Zookeeper"); } }
Source:
int computeNumTasks() { final int maxParallelism = Math.min(JvmUtils.getRuntimeInfo().getAvailableProcessors(), parallelism); final int utilizationEstimate = getPool().getRunningThreadCount() + getPool().getQueuedSubmissionCount(); final int computedParallelism = Math.min(maxParallelism, getPool().getParallelism() - utilizationEstimate); final int computedOptimalParallelism = Math.min( (int) Math.floor((double) sequences.size() / 2.0), computedParallelism - 1 ); return computedOptimalParallelism; }

Target:
private int computeNumTasks() { final int runningThreadCount = getPool().getRunningThreadCount(); final int submissionCount = getPool().getQueuedSubmissionCount(); final int maxParallelism = Math.min(parallelism, getPool().getParallelism()); final int utilizationEstimate = runningThreadCount + submissionCount - 1; final int computedParallelismForUtilization = maxParallelism - utilizationEstimate; final int computedParallelismForSequences = (int) Math.floor(Math.sqrt(sequences.size())); final int computedOptimalParallelism = Math.min( computedParallelismForSequences, computedParallelismForUtilization - 1 ); final int computedNumParallelTasks = Math.max(computedOptimalParallelism, 1); LOG.debug("Computed parallel tasks: [%s]; ForkJoinPool details - sequence parallelism: [%s] " + "active threads: [%s] running threads: [%s] queued submissions: [%s] queued tasks: [%s] " + "pool parallelism: [%s] pool size: [%s] steal count: [%s]", computedNumParallelTasks, parallelism, getPool().getActiveThreadCount(), runningThreadCount, submissionCount, getPool().getQueuedTaskCount(), getPool().getParallelism(), getPool().getPoolSize(), getPool().getStealCount() ); return computedNumParallelTasks; }
Source:
public void testOpenUdpEncapsulationSocketCallsSetSocketOwner() throws Exception { int localport = findUnusedPort(); IpSecUdpEncapResponse udpEncapResp = mIpSecService.openUdpEncapsulationSocket(localport, new Binder()); verify(mMockNetd).ipSecSetSocketOwner(anyObject(), eq(Os.getuid())); mIpSecService.closeUdpEncapsulationSocket(udpEncapResp.resourceId); }

Target:
public void testOpenUdpEncapsulationSocketCallsSetSocketOwner() throws Exception { IpSecUdpEncapResponse udpEncapResp = mIpSecService.openUdpEncapsulationSocket(0, new Binder()); verify(mMockNetd).ipSecSetSocketOwner(anyObject(), eq(Os.getuid())); mIpSecService.closeUdpEncapsulationSocket(udpEncapResp.resourceId); }
Source:
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { sessionAirdResource = new UIResource(designerProject, SESSION_FILE); localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); diagramToPaste = localSession.getLocalSessionBrowser().perCategory().selectViewpoint(VIEWPOINT_NAME).selectRepresentation(REPRESENTATION_DESCRIPTION_NAME) .selectRepresentationInstance(DIAGRAM_INSTANCE_TO_PASTE, UIDiagramRepresentation.class).open(); diagramToCopy = localSession.getLocalSessionBrowser().perCategory().selectViewpoint(VIEWPOINT_NAME).selectRepresentation(REPRESENTATION_DESCRIPTION_NAME) .selectRepresentationInstance(DIAGRAM_INSTANCE_TO_COPY, UIDiagramRepresentation.class).open(); }

Target:
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { sessionAirdResource = new UIResource(designerProject, SESSION_FILE); localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); diagramToPaste = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_DESCRIPTION_NAME, DIAGRAM_INSTANCE_TO_PASTE, DDiagram.class); diagramToCopy = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_DESCRIPTION_NAME, DIAGRAM_INSTANCE_TO_COPY, DDiagram.class); }
Source:
public Mono<Key> createKey(String name, KeyType keyType) { return withContext(context -> createKey(name, keyType, Context.NONE)) .flatMap(keyResponse -> Mono.justOrEmpty(keyResponse.value())); }

Target:
public Mono<Key> createKey(String name, KeyType keyType) { return withContext(context -> createKey(name, keyType, context)) .flatMap(FluxUtil::toMono); }
Source:
public Element getSingleChild(String name) { checkNotRemoved(); requireNonNull(name, "Non-null child name required."); for (Element child : asElements(delegate.getChildNodes())) { if (name.equals(child.getName())) { if (child.hasSibling(name)) { throw new XMLTreeException( "Element " + name + " has found more than one child with the name " + name); } return child; } } return null; }

Target:
public Element getSingleChild(String name) { checkNotRemoved(); requireNonNull(name, "Non-null child name required."); for (Element child : asElements(delegate.getChildNodes())) { if (name.equals(child.getName())) { if (child.hasSibling(name)) { throw new XMLTreeException( "Element " + name + " has more than one child with the name " + name); } return child; } } return null; }
Source:
public Response threatCatalogue() { ThreatModelingUtils tmu = new ThreatModelingUtils(this.repository); return Response.ok(tmu.getThreatCatalogue()).build(); }

Target:
public List<Threat> threatCatalogue() { ThreatModelingUtils tmu = new ThreatModelingUtils(this.repository); return tmu.getThreatCatalogue(); }
Source:
public void addHook(TrainingHook trainingHook) { }

Target:
public void addHook(TrainingHook trainingHook) { throw new UnsupportedOperationException(); }
Source:
public void throw_exception_if_no_field_by_given_index() { @SuppressWarnings("MagicNumber") final TestMessageField field = new TestMessageField(256); field.getValue(stringValue); }

Target:
public void throw_exception_if_no_field_by_given_index() { final TestMessageField field = new TestMessageField(Integer.MAX_VALUE); field.getValue(stringValue); }
Source:
public List<N> getAllParents(N node) { if (_tree.containsVertex(node) == false) return null; if (isRoot(node)) return null; List<N> parents = new ArrayList<>(); N child = node; N parent; while ((parent = getParent(child)) != null) { parents.add(parent); child = parent; } return new ImmutableList.Builder<N>().addAll(parents).build(); }

Target:
public List<N> getAllParents(N node) { if (!_tree.containsVertex(node)) return null; if (isRoot(node)) return null; List<N> parents = new ArrayList<>(); N child = node; N parent; while ((parent = getParent(child)) != null) { parents.add(parent); child = parent; } return new ImmutableList.Builder<N>().addAll(parents).build(); }
Source:
private void createProxyControls(final Composite proxyComp) { Label lblConnection = new Label(proxyComp, SWT.WRAP); lblConnection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); lblConnection.setText(Messages.JSchConnectionPage_SelectConnection); fProxyConnectionWidget = new RemoteConnectionWidget(proxyComp, SWT.NONE, null, 0, null); Label lblCommand = new Label(proxyComp, SWT.WRAP); lblCommand.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); lblCommand.setText(Messages.JSchConnectionPage_SelectCommand); fProxyCommandText = new Text(proxyComp, SWT.BORDER); fProxyCommandText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Link link = new Link(proxyComp, SWT.WRAP); final GridData linkLayoutData = new GridData(GridData.FILL_HORIZONTAL); link.setLayoutData(linkLayoutData); final String PREFS_PAGE_ID_NET_PROXY = "org.eclipse.ui.net.NetPreferences"; link.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), PREFS_PAGE_ID_NET_PROXY, new String[] { PREFS_PAGE_ID_NET_PROXY }, null); dlg.open(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); linkLayoutData.widthHint = 400; link.setText(Messages.JSchConnectionPage_Help); }

Target:
private void createProxyControls(final Composite proxyComp) { Label lblConnection = new Label(proxyComp, SWT.WRAP); lblConnection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); lblConnection.setText(Messages.JSchConnectionPage_SelectConnection); fProxyConnectionWidget = new RemoteConnectionWidget(proxyComp, SWT.NONE, null, 0, null); Label lblCommand = new Label(proxyComp, SWT.WRAP); lblCommand.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); lblCommand.setText(Messages.JSchConnectionPage_SelectCommand); fProxyCommandText = new Text(proxyComp, SWT.BORDER); fProxyCommandText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Link link = new Link(proxyComp, SWT.WRAP); final GridData linkLayoutData = new GridData(GridData.FILL_HORIZONTAL); link.setLayoutData(linkLayoutData); link.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), PREFS_PAGE_ID_NET_PROXY, new String[] { PREFS_PAGE_ID_NET_PROXY }, null); dlg.open(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); linkLayoutData.widthHint = 400; link.setText(Messages.JSchConnectionPage_Help); }
Source:
private SslSessionData getSslSessionData() { SslSessionData sslSessionData = (SslSessionData)_session.getValue(SslSessionData.ATTR); if (sslSessionData == null) { String cipherSuite = _session.getCipherSuite(); int keySize = SslContextFactory.deduceKeyLength(cipherSuite); X509Certificate[] certs = getCertChain(_request.getHttpChannel().getConnector(), _session); byte[] bytes = _session.getId(); String idStr = TypeUtil.toHexString(bytes); sslSessionData = new SslSessionData(keySize, certs, idStr); _session.putValue(SslSessionData.ATTR, sslSessionData); } return sslSessionData; }

Target:
private SslSessionData getSslSessionData() { String key = SslSessionData.class.getName(); SslSessionData sslSessionData = (SslSessionData)_session.getValue(key); if (sslSessionData == null) { String cipherSuite = _session.getCipherSuite(); int keySize = SslContextFactory.deduceKeyLength(cipherSuite); X509Certificate[] certs = getCertChain(_request.getHttpChannel().getConnector(), _session); byte[] bytes = _session.getId(); String idStr = TypeUtil.toHexString(bytes); sslSessionData = new SslSessionData(keySize, certs, idStr); _session.putValue(key, sslSessionData); } return sslSessionData; }
Source:
private ProcessHandler startTestProcess(TestExecutionContext context) { File suiteFile = createSuite(context); if (suiteFile == null) { throw new RuntimeException("Can't create TestNG suite xml file."); } JavaParameters parameters = new JavaParameters(); parameters.setJavaExecutable(System.getProperty("java.home") + "/bin/java"); parameters.setMainClassName("org.testng.CheTestNGLauncher"); String outputDirectory = getOutputDirectory(context); parameters.getParametersList().add("-d", outputDirectory); parameters.setWorkingDirectory(workspacePath + context.getProjectPath()); List<String> classPath = new ArrayList<>(); List<String> resolvedClassPaths = getResolvedClassPaths(context); classPath.addAll(resolvedClassPaths); classPath.add(ClasspathUtil.getJarPathForClass(org.testng.CheTestNG.class)); classPath.add(ClasspathUtil.getJarPathForClass(JCommander.class)); parameters.getClassPath().addAll(classPath); parameters.getParametersList().add("-suiteFile", suiteFile.getAbsolutePath()); if (context.isDebugModeEnable()) { generateDebuggerPort(); parameters.getVmParameters().add("-Xdebug"); parameters .getVmParameters() .add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + getDebugPort()); } CommandLine command = parameters.createCommand(); try { return new ProcessHandler(command.createProcess()); } catch (ExecutionException e) { LOG.error("Can't run TestNG JVM", e); } return null; }

Target:
private ProcessHandler startTestProcess(TestExecutionContext context) throws ExecutionException { File suiteFile = createSuite(context); if (suiteFile == null) { throw new RuntimeException("Can't create TestNG suite xml file."); } JavaParameters parameters = new JavaParameters(); parameters.setJavaExecutable(System.getProperty("java.home") + "/bin/java"); parameters.setMainClassName("org.testng.CheTestNGLauncher"); String outputDirectory = getOutputDirectory(context); parameters.getParametersList().add("-d", outputDirectory); parameters.setWorkingDirectory(workspacePath + context.getProjectPath()); List<String> classPath = new ArrayList<>(); List<String> resolvedClassPaths = getResolvedClassPaths(context); classPath.addAll(resolvedClassPaths); classPath.add(ClasspathUtil.getJarPathForClass(org.testng.CheTestNG.class)); classPath.add(ClasspathUtil.getJarPathForClass(JCommander.class)); parameters.getClassPath().addAll(classPath); parameters.getParametersList().add("-suiteFile", suiteFile.getAbsolutePath()); if (context.isDebugModeEnable()) { generateDebuggerPort(); parameters.getVmParameters().add("-Xdebug"); parameters .getVmParameters() .add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + getDebugPort()); } CommandLine command = parameters.createCommand(); return new ProcessHandler(command.createProcess()); }
Source:
private CompletableFuture<CorfuInterClusterReplicationServerNode> startDiscoveryService(ServerContext serverContext) throws InterruptedException { log.info("Start Discovery Service."); CompletableFuture<CorfuInterClusterReplicationServerNode> discoveryServiceCallback = new CompletableFuture<>(); this.clusterManagerAdapter = buildClusterManagerAdapter(serverContext.getPluginConfigFilePath()); replicationDiscoveryService = new CorfuReplicationDiscoveryService(serverContext, clusterManagerAdapter, discoveryServiceCallback);; return discoveryServiceCallback; }

Target:
private CompletableFuture<CorfuInterClusterReplicationServerNode> startDiscoveryService(ServerContext serverContext) { log.info("Start Discovery Service."); CompletableFuture<CorfuInterClusterReplicationServerNode> discoveryServiceCallback = new CompletableFuture<>(); this.clusterManagerAdapter = buildClusterManagerAdapter(serverContext.getPluginConfigFilePath()); replicationDiscoveryService = new CorfuReplicationDiscoveryService(serverContext, clusterManagerAdapter, discoveryServiceCallback); replicationDiscoveryService.start(); return discoveryServiceCallback; }
Source:
public static void respond(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res) { res.setHeader("Access-Control-Allow-Origin", Configuration.getInstance().getStringProperty(CoreConfig.CORS_ALLOWED_ORIGINS)); if (res.getContent() != null) { setContentLength(res, res.getContent().readableBytes()); } ChannelFuture f = ctx.getChannel().write(res); if (req == null || !isKeepAlive(req)) { f.addListener(ChannelFutureListener.CLOSE); } }

Target:
public static void respond(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res) { if (CORS_ENABLED) { res.setHeader("Access-Control-Allow-Origin", CORS_ALLOWED_ORIGINS); } if (res.getContent() != null) { setContentLength(res, res.getContent().readableBytes()); } ChannelFuture f = ctx.getChannel().write(res); if (req == null || !isKeepAlive(req)) { f.addListener(ChannelFutureListener.CLOSE); } }
Source:
protected void operations(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { Map<String, String> changedHandles = Maps.filterEntries(handles, new Predicate<Entry<String, String>>() { @Override public boolean apply(Entry<String, String> entry) { return !entry.getKey().equals(entry.getValue()); } }); if (changedHandles.isEmpty()) { return; } try { refactorMetaContextHandles(changedHandles, monitor); TasksUiPlugin.getTaskActivityMonitor().reloadActivityTime(); } finally { monitor.done(); } }

Target:
protected void operations(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { Map<String, String> changedHandles = handles.entrySet() .stream() .filter(e -> !e.getKey().equals(e.getValue())) .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); if (changedHandles.isEmpty()) { return; } try { refactorMetaContextHandles(changedHandles, monitor); TasksUiPlugin.getTaskActivityMonitor().reloadActivityTime(); } finally { monitor.done(); } }
Source:
public static WatchDog map(VmWatchdog entity, WatchDog template) { WatchDog model = template == null ? new WatchDog() : template; model.setAction(entity.getAction() == null ? null : entity.getAction().name().toLowerCase()); model.setId(entity.getId().toString()); model.setModel(entity.getModel() == null ? null : entity.getModel().name()); return model; }

Target:
public static WatchDog map(VmWatchdog entity, WatchDog template) { WatchDog model = template == null ? new WatchDog() : template; if (entity.getAction() != null) { WatchdogAction action = map(entity.getAction(), null); if (action != null) { model.setAction(action.name().toLowerCase()); } } if (entity.getModel() != null) { WatchdogModel wdModel = map(entity.getModel(), null); if (wdModel != null) { model.setModel(wdModel.name().toLowerCase()); } } model.setId(entity.getId().toString()); return model; }
Source:
public boolean equals( Value value ) { if ( value instanceof org.neo4j.values.storable.UTF8StringValue ) { return Arrays.equals( bytes, ((org.neo4j.values.storable.UTF8StringValue) value).bytes ); } else { return super.equals( value ); } }

Target:
public boolean equals( Value value ) { if ( value instanceof UTF8StringValue ) { return Arrays.equals( bytes, ((org.neo4j.values.storable.UTF8StringValue) value).bytes ); } else { return super.equals( value ); } }
Source:
private List<String> splitToLength(String text, int subStringSize) { List<String> substrings = new ArrayList<String>(text.length() + subStringSize -1 / subStringSize); for (int idx = 0; idx < text.length(); idx += subStringSize) { String substring = text.substring(idx, Math.min(text.length(), idx + subStringSize)); substrings.add(substring); } return substrings; }

Target:
private List<String> splitToLength(String text, int subStringSize) { List<String> substrings = new ArrayList<String>((text.length() + subStringSize -1) / subStringSize); for (int idx = 0; idx < text.length(); idx += subStringSize) { String substring = text.substring(idx, Math.min(text.length(), idx + subStringSize)); substrings.add(substring); } return substrings; }
Source:
private void showSyncOptionDialogWhenLogout() { if (ReadingListDbHelper.instance().getRandomPage() != null) { ReadingListCheckSetupStatusTask checkSetupStatusTask = new ReadingListCheckSetupStatusTask() { @Override public void onFinish(@Nullable Void result) { Prefs.setReadingListsLastSyncTime(null); ReadingListSyncBehaviorDialogs.removeExistListsDialog(getActivity(), () -> logoutAndShowMessage()); } @Override public void onCatch(Throwable caught) { logoutAndShowMessage(); } }; checkSetupStatusTask.execute(); } else { logoutAndShowMessage(); } }

Target:
private void showSyncOptionDialogWhenLogout() { if (ReadingListDbHelper.instance().getRandomPage() != null) { ReadingListCheckSetupStatusTask checkSetupStatusTask = new ReadingListCheckSetupStatusTask() { @Override public void onFinish(@Nullable Void result) { if (!isAdded()) { return; } Prefs.setReadingListsLastSyncTime(null); ReadingListSyncBehaviorDialogs.removeExistListsDialog(getActivity(), () -> logoutAndShowMessage()); } @Override public void onCatch(Throwable caught) { if (!isAdded()) { return; } logoutAndShowMessage(); } }; checkSetupStatusTask.execute(); } else { logoutAndShowMessage(); } }
Source:
static Scheduler callRequireNonNull(Callable<Scheduler> s) { try { return ObjectHelper.requireNonNull(s.call(), "Scheduler Callable result can't be null"); } catch (Throwable ex) { throw ExceptionHelper.wrapOrThrow(ex); } }

Target:
static Scheduler callRequireNonNull(Callable<Scheduler> s) { try { Scheduler scheduler = s.call(); if (scheduler == null) { throw new NullPointerException("Scheduler Callable returned null"); } return scheduler; } catch (Throwable ex) { throw Exceptions.propagate(ex); } }
Source:
public void testParallelNoThrottle() throws Exception { final int numThreads = 50; final LearnerSyncThrottler throttler = new LearnerSyncThrottler(numThreads, syncType); ExecutorService threadPool = Executors.newFixedThreadPool(numThreads); final CountDownLatch threadStartLatch = new CountDownLatch(numThreads); final CountDownLatch syncProgressLatch = new CountDownLatch(numThreads); List<Future<Boolean>> results = new ArrayList<Future<Boolean>>(numThreads); for (int i = 0; i < numThreads; i++) { results.add(threadPool.submit(new Callable<Boolean>() { @Override public Boolean call() { threadStartLatch.countDown(); try { threadStartLatch.await(); throttler.beginSync(false); syncProgressLatch.countDown(); syncProgressLatch.await(); throttler.endSync(); } catch (Exception e) { return false; } return true; } })); } for (Future<Boolean> result : results) { Assert.assertTrue(result.get()); } }

Target:
public void testParallelNoThrottle() { final int numThreads = 50; final LearnerSyncThrottler throttler = new LearnerSyncThrottler(numThreads, syncType); ExecutorService threadPool = Executors.newFixedThreadPool(numThreads); final CountDownLatch threadStartLatch = new CountDownLatch(numThreads); final CountDownLatch syncProgressLatch = new CountDownLatch(numThreads); List<Future<Boolean>> results = new ArrayList<Future<Boolean>>(numThreads); for (int i = 0; i < numThreads; i++) { results.add(threadPool.submit(new Callable<Boolean>() { @Override public Boolean call() { threadStartLatch.countDown(); try { threadStartLatch.await(); throttler.beginSync(false); syncProgressLatch.countDown(); syncProgressLatch.await(); throttler.endSync(); } catch (Exception e) { return false; } return true; } })); } try { for (Future<Boolean> result : results) { Assert.assertTrue(result.get()); } } catch (Exception e){ } finally { threadPool.shutdown(); } }
Source:
protected final void assignArguments(List<?> args, Env e) { for (int i=0; i< Math.min(args.size(),parameters.size()); i++) { Class argClass = args.get(i) != null ? args.get(i).getClass() : Object.class; e.declareVariable(argClass, parameters.get(i)); e.setLocalVariable(parameters.get(i), args.get(i)); } }

Target:
protected final void assignArguments(List<?> args, Env e) { for (int i=0; i< Math.min(args.size(),parameters.size()); i++) { e.declareVariable(Object.class, parameters.get(i)); e.setLocalVariable(parameters.get(i), args.get(i)); } }
Source:
protected boolean isAlternativePresent(final String alternative) { if (alternatives == null) { return false; } for (String alt : alternatives) { if (alt.equals(alternative)) { return true; } } return false; }

Target:
private boolean isAlternativePresent(final String alternative) { if (alternatives == null) { return false; } for (String alt : alternatives) { if (alt.equals(alternative)) { return true; } } return false; }