auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public TaskStats getTaskStats() { final List<Group> groupList = new ArrayList<>(); final int numEventProcessors = groupAllocationTable.getKeys().size(); for (final EventProcessor ep : groupAllocationTable.getKeys()) { groupList.addAll(groupAllocationTable.getValue(ep)); } double totalLoad = 0.0; final Map<String, GroupStats> groupStatsMap = new HashMap<>(); for (final Group group : groupList) { groupStatsMap.put( group.getGroupId(), GroupStats.newBuilder() .setGroupLoad(group.getLoad()) .setAppId(group.getApplicationInfo().getApplicationId()) .setGroupQueryNum(group.getQueries().size()) .build()); totalLoad += group.getLoad(); } final double taskCpuLoad = totalLoad / numEventProcessors; return TaskStats.newBuilder() .setTaskLoad(taskCpuLoad) .setGroupStatsMap(groupStatsMap) .build(); }

Target:
public TaskStats getTaskStats() { final List<EventProcessor> epList = new ArrayList<>(groupAllocationTable.getKeys()); final int numEventProcessors = epList.size(); final List<Group> groupList = new ArrayList<>(); for (final EventProcessor ep : epList) { groupList.addAll(groupAllocationTable.getValue(ep)); } double totalLoad = 0.0; final Map<String, GroupStats> groupStatsMap = new HashMap<>(); for (final Group group : groupList) { groupStatsMap.put( group.getGroupId(), GroupStats.newBuilder() .setGroupLoad(group.getLoad()) .setAppId(group.getApplicationInfo().getApplicationId()) .setGroupQueryNum(group.getQueries().size()) .build()); totalLoad += group.getLoad(); } final double taskCpuLoad = totalLoad / numEventProcessors; return TaskStats.newBuilder() .setTaskLoad(taskCpuLoad) .setGroupStatsMap(groupStatsMap) .build(); }
Source:
private static CompletableFuture<IMessage> receiveAsyncWrapper(IMessageReceiver receiver, Duration serverWaitTime) { try { return receiver.receiveAsync(serverWaitTime); } catch (Throwable t) { CompletableFuture<IMessage> excetionalFuture = new CompletableFuture<IMessage>(); excetionalFuture.completeExceptionally(t); return excetionalFuture; } }

Target:
private static CompletableFuture<IMessage> receiveAsyncWrapper(IMessageReceiver receiver, Duration serverWaitTime) { try { return receiver.receiveAsync(serverWaitTime); } catch (Throwable t) { CompletableFuture<IMessage> exceptionalFuture = new CompletableFuture<IMessage>(); exceptionalFuture.completeExceptionally(t); return exceptionalFuture; } }
Source:
public void remove() { throw new UnsupportedOperationException(); }

Target:
public void remove() { throw new UnsupportedOperationException( "This iterable is immutable and cannot remove anything" ); }
Source:
public void close() { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } }

Target:
public void close() { try { connection.close(); } catch (SQLException e) { LOG.warning("SQL exception while closing JDBC Connection:" + e.getMessage()); } }
Source:
private void loadContainers(final IDockerConnection connection) { final Job loadContainersJob = new Job(DVMessages .getFormattedString("ContainersLoadJob.msg", connection.getUri())) { @Override protected IStatus run(final IProgressMonitor monitor) { connection.getContainers(true); return Status.OK_STATUS; } }; loadContainersJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { Display.getDefault().asyncExec(() -> { viewer.refresh(); }); } }); loadContainersJob.schedule(); }

Target:
private void loadContainers(final IDockerConnection connection) { final Job loadContainersJob = new Job(DVMessages .getFormattedString("ContainersLoadJob.msg", connection.getUri())) { @Override protected IStatus run(final IProgressMonitor monitor) { connection.getContainers(true); Display.getDefault().asyncExec(() -> { viewer.refresh(); }); return Status.OK_STATUS; } }; loadContainersJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { } }); loadContainersJob.schedule(); }
Source:
private static HttpResponse postRequestToOpenTsdb(MetricServiceAppConfiguration config, String jsonQueryString) throws IOException { String postUrl = String.format("%s/api/query", config.getMetricServiceConfig().getOpenTsdbUrl()); log.info("POSTing JSON to URL: {}", postUrl); DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost postRequest = new HttpPost(postUrl); log.info("Query to OpenTSDB: {}",jsonQueryString); StringEntity input = new StringEntity(jsonQueryString); input.setContentType("application/json"); postRequest.setEntity(input); HttpResponse response; try { response = httpClient.execute(postRequest); } catch (IOException | RuntimeException e) { log.error("{} Exception caught executing HTTP Post: {}",e.getClass().getName(), e, e.getMessage()); throw e; } log.info("Response from httpClient.execute was {}", response); return response; }

Target:
private static HttpResponse postRequestToOpenTsdb(MetricServiceAppConfiguration config, String jsonQueryString) throws IOException { String postUrl = String.format("%s/api/query", config.getMetricServiceConfig().getOpenTsdbUrl()); log.info("POSTing JSON to URL: {}", postUrl); DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost postRequest = new HttpPost(postUrl); log.info("Query to OpenTSDB: {}",jsonQueryString); StringEntity input = new StringEntity(jsonQueryString); input.setContentType("application/json"); postRequest.setEntity(input); HttpResponse response; try { response = httpClient.execute(postRequest); } catch (IOException | RuntimeException e) { log.error("{} Exception caught executing HTTP Post: {}",e.getClass().getName(), e, e.getMessage()); throw e; } log.debug("Response from httpClient.execute was {}", response); return response; }
Source:
public T call() throws Exception { ServerTaskRegistry taskRegistry = componentRegistry.getComponent(ServerTaskRegistry.class); ServerTaskWrapper<T> task = taskRegistry.getTask(taskName); task.inject(prepareContext()); return task.run(); }

Target:
public T call() throws Exception { ServerTaskWrapper<T> task = taskRegistry.getTask(taskName); task.inject(prepareContext()); return task.run(); }
Source:
public ResourcesPresentationProvider() { super(); for (int i = 0; i < NUM_COLORS; i++) { RGB rgb = new RGB((int) (360.0 / NUM_COLORS * i), getSaturation(), getBrightness()); fColors.add(rgb); } }

Target:
public ResourcesPresentationProvider() { super(); for (int i = 0; i < NUM_COLORS; i++) { fColors.add(new RGB((int) (360.0 / NUM_COLORS * i), SATURATION, BRIGHTNESS)); } }
Source:
public boolean deletePBDSegment(BinaryDequeValidator<M> validator) throws IOException { boolean segmentDeleted = false; if (m_closed) { throw new IOException("Cannot scanForGap(): PBD has been closed"); } assertions(); if (m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("PBD " + m_nonce + " has no finished segments"); } return segmentDeleted; } Iterator<PBDSegment<M>> iter = m_segments.values().iterator(); while (iter.hasNext()) { PBDSegment<M> segment = iter.next(); try { int entriesToDelete = segment.validate(validator); if (entriesToDelete != 0) { m_numObjects -= entriesToDelete; iter.remove(); closeAndDeleteSegment(segment); segmentDeleted = true; } } catch (IOException e) { m_usageSpecificLog.warn("Error validating segment: " + segment.file() + ". Quarantining segment."); quarantineSegment(segment); } } return segmentDeleted; }

Target:
public boolean deletePBDSegment(BinaryDequeValidator<M> validator) throws IOException { boolean segmentDeleted = false; if (m_closed) { throw new IOException("Cannot deletePBDSegment(): PBD has been closed"); } assertions(); if (m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("PBD " + m_nonce + " has no segments to delete."); } return segmentDeleted; } Iterator<PBDSegment<M>> iter = m_segments.values().iterator(); while (iter.hasNext()) { PBDSegment<M> segment = iter.next(); try { int entriesToDelete = segment.validate(validator); if (entriesToDelete != 0) { m_numObjects -= entriesToDelete; iter.remove(); closeAndDeleteSegment(segment); segmentDeleted = true; } } catch (IOException e) { m_usageSpecificLog.warn("Error validating segment: " + segment.file() + ". Quarantining segment."); quarantineSegment(segment); } } return segmentDeleted; }
Source:
public void replace(View<E> update) { DatasetDescriptor updateDescriptor = update.getDataset().getDescriptor(); Compatibility.checkCompatible(updateDescriptor, descriptor); if (descriptor.isPartitioned()) { for (PartitionView<E> src : update.getCoveringPartitions()) { if (src instanceof FileSystemPartitionView) { FileSystemPartitionView<E> dest = getPartitionView( ((FileSystemPartitionView<E>) src).getRelativeLocation()); List<Path> removals = Lists.newArrayList(); Iterable<PartitionView<E>> existingPartitions = dest .toConstraintsView() .getCoveringPartitions(); for (PartitionView<E> partition : existingPartitions) { FileSystemPartitionView<E> toRemove = (FileSystemPartitionView<E>) partition; Path path = new Path(toRemove.getLocation()); removals.add(path); if (partitionListener != null && descriptor.isPartitioned()) { partitionListener.partitionDeleted( namespace, name, toRemove.getRelativeLocation().toString()); } } FileSystemUtil.replace(fileSystem, directory, new Path(dest.getLocation()), new Path(src.getLocation()), removals); if (partitionListener != null && descriptor.isPartitioned()) { partitionListener.partitionAdded( namespace, name, dest.getRelativeLocation().toString()); } } else { throw new IllegalArgumentException( "Incompatible PartitionView: " + src.getClass().getName()); } } } else { deleteAll(); merge((FileSystemDataset<E>) update.getDataset()); } }

Target:
public void replace(View<E> update) { DatasetDescriptor updateDescriptor = update.getDataset().getDescriptor(); Compatibility.checkCompatible(updateDescriptor, descriptor); if (descriptor.isPartitioned()) { for (PartitionView<E> src : update.getCoveringPartitions()) { if (src instanceof FileSystemPartitionView) { FileSystemPartitionView<E> dest = getPartitionView( ((FileSystemPartitionView<E>) src).getRelativeLocation()); List<Path> removals = Lists.newArrayList(); Iterable<PartitionView<E>> existingPartitions = dest .toConstraintsView() .getCoveringPartitions(); for (PartitionView<E> partition : existingPartitions) { FileSystemPartitionView<E> toRemove = (FileSystemPartitionView<E>) partition; Path path = new Path(toRemove.getLocation()); removals.add(path); if (partitionListener != null && descriptor.isPartitioned()) { partitionListener.partitionDeleted( namespace, name, toRemove.getRelativeLocation().toString()); } } FileSystemUtil.replace(fileSystem, directory, new Path(dest.getLocation()), new Path(src.getLocation()), removals); if (partitionListener != null && descriptor.isPartitioned()) { partitionListener.partitionAdded( namespace, name, dest.getRelativeLocation().toString()); } } else { throw new IllegalArgumentException( "Incompatible PartitionView: " + src.getClass().getName()); } } } else { PartitionView<E> srcPartition = Iterables.getOnlyElement( update.getCoveringPartitions()); List<Pair<Path, Path>> staged = FileSystemUtil.stageMove(fileSystem, new Path(srcPartition.getLocation()), new Path(unbounded.getLocation()), "replace" ); deleteAll(); FileSystemUtil.finishMove(fileSystem, staged); } }
Source:
public @NonNull String getTraceHost() { return fHostThread.getHost(); }

Target:
public String getTraceHost() { return fHostThread.getHost(); }
Source:
public URI getBundleURI(String id, String version) { SiteBundle[] entries = site.getBundles(); for (SiteBundle entrie : entries) { if (id.equals(entrie.getBundleIdentifier()) && version.equals(entrie.getBundleVersion())) { return getSiteBundleURI(entrie); } } URI base = getBaseURI(); URI url = getArchiveURI(base, FEATURE_DIR + id + VERSION_SEPARATOR + version + JAR_EXTENSION); if (url != null) return url; return URIUtil.append(base, FEATURE_DIR + id + VERSION_SEPARATOR + version + JAR_EXTENSION); }

Target:
public URI getBundleURI(String id, String version) { SiteBundle[] entries = site.getBundles(); for (SiteBundle entry : entries) { if (id.equals(entry.getBundleIdentifier()) && version.equals(entry.getBundleVersion())) { return getSiteBundleURI(entry); } } URI base = getBaseURI(); URI url = getArchiveURI(base, FEATURE_DIR + id + VERSION_SEPARATOR + version + JAR_EXTENSION); if (url != null) return url; return URIUtil.append(base, FEATURE_DIR + id + VERSION_SEPARATOR + version + JAR_EXTENSION); }
Source:
private void next0() { if (listIt != null && listIt.hasNext()) row = listIt.next(); else { listIt = mapIt.next().getValue().iterator(); row = listIt.next(); } }

Target:
private void next0() { if (listIt == null || !listIt.hasNext()) listIt = mapIt.next().getValue().iterator(); row = listIt.next(); }
Source:
public static Slice trimTrailingSpaces(Slice slice) { requireNonNull(slice, "slice is null"); return slice.slice(0, sliceLengthWithoutTrailingSpaces(slice, 0, slice.length())); }

Target:
public static Slice trimTrailingSpaces(Slice slice) { requireNonNull(slice, "slice is null"); return slice.slice(0, byteCountWithoutTrailingSpace(slice, 0, slice.length())); }
Source:
List<Event> commitEvents() { final List<Event> result = ImmutableList.copyOf(uncommittedEvents); uncommittedEvents.clear(); addToHistory(result); return result; }

Target:
List<Event> commitEvents() { final List<Event> result = ImmutableList.copyOf(uncommittedEvents); uncommittedEvents.clear(); remember(result); return result; }
Source:
public Future<Void> addColumnFamilyAsync(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException { String columnName = columnFamily.getNameAsString(); Modification.Builder modification = Modification.newBuilder().setId(columnName) .setCreate(new ColumnDescriptorAdapter() .adapt((HColumnDescriptor) columnFamily).build()); return FutureUtils .toCompletableFuture(modifyColumnAsync(tableName, columnName, "add", modification)) .thenApply(r -> null); }

Target:
public Future<Void> addColumnFamilyAsync(TableName tableName, ColumnFamilyDescriptor columnFamily) throws IOException { String columnName = columnFamily.getNameAsString(); Modification.Builder modification = Modification.newBuilder().setId(columnName) .setCreate(new ColumnDescriptorAdapter() .adapt((HColumnDescriptor) columnFamily).build()); return modifyColumnAsync(tableName, columnName, "add", modification); }
Source:
protected ActiveMQServer createServer(int port) throws Exception { final ActiveMQServer server = this.createServer(true, true); server.getConfiguration().getAcceptorConfigurations().clear(); server.getConfiguration().getAcceptorConfigurations().add(addAcceptorConfiguration(server, port)); server.getConfiguration().setName(BROKER_NAME); server.getConfiguration().setJournalDirectory(server.getConfiguration().getJournalDirectory() + port); server.getConfiguration().setBindingsDirectory(server.getConfiguration().getBindingsDirectory() + port); server.getConfiguration().setPagingDirectory(server.getConfiguration().getPagingDirectory() + port); server.getConfiguration().setJMXManagementEnabled(true); server.getConfiguration().setMessageExpiryScanPeriod(5000); server.getConfiguration().setUseLegacyAMQPQueueNaming(false); server.setMBeanServer(mBeanServer); addAdditionalAcceptors(server); configureAddressPolicy(server); configureBrokerSecurity(server); addConfiguration(server); server.start(); createAddressAndQueues(server); return server; }

Target:
protected ActiveMQServer createServer(int port) throws Exception { final ActiveMQServer server = this.createServer(true, true); server.getConfiguration().getAcceptorConfigurations().clear(); server.getConfiguration().getAcceptorConfigurations().add(addAcceptorConfiguration(server, port)); server.getConfiguration().setName(BROKER_NAME); server.getConfiguration().setJournalDirectory(server.getConfiguration().getJournalDirectory() + port); server.getConfiguration().setBindingsDirectory(server.getConfiguration().getBindingsDirectory() + port); server.getConfiguration().setPagingDirectory(server.getConfiguration().getPagingDirectory() + port); server.getConfiguration().setJMXManagementEnabled(true); server.getConfiguration().setMessageExpiryScanPeriod(5000); server.setMBeanServer(mBeanServer); addAdditionalAcceptors(server); configureAddressPolicy(server); configureBrokerSecurity(server); addConfiguration(server); server.start(); createAddressAndQueues(server); return server; }
Source:
public Collection<ItemStack> getDrops(GlowBlock block, ItemStack tool) { GlowBed bed = (GlowBed)block.getState(); byte data = bed.getColor().getWoolData(); return Collections.singletonList(new ItemStack(Material.BED, 1, data)); }

Target:
public Collection<ItemStack> getDrops(GlowBlock block, ItemStack tool) { return Collections.singletonList(new ItemStack(Material.BED, 1, (((GlowBed) block.getState()).getColor().getWoolData()))); }
Source:
public WindowedStream<Tuple.WindowedTuple<KeyValPair<String, List<CompletionCandidate>>>> compose( WindowedStream<CompletionCandidate> input) { TopNByKey topNByKey = new TopNByKey(); topNByKey.setN(candidatesPerPrefix); return input .<KeyValPair<String, CompletionCandidate>, WindowedStream<KeyValPair<String, CompletionCandidate>>>flatMap(new AllPrefixes(minPrefix, 3), name("Extract Prefixes")) .accumulateByKey(topNByKey, new Function.ToKeyValue<KeyValPair<String, CompletionCandidate>, String, CompletionCandidate>() { @Override public Tuple<KeyValPair<String, CompletionCandidate>> f(KeyValPair<String, CompletionCandidate> tuple) { return new Tuple.WindowedTuple<>(Window.GlobalWindow.getInstance(), tuple); } }, name("TopNByKey")); }

Target:
public WindowedStream<Tuple.WindowedTuple<KeyValPair<String, List<CompletionCandidate>>>> compose( WindowedStream<CompletionCandidate> input) { TopNByKey topNByKey = new TopNByKey(); topNByKey.setN(candidatesPerPrefix); return input .<KeyValPair<String, CompletionCandidate>, WindowedStream<KeyValPair<String, CompletionCandidate>>>flatMap(new AllPrefixes(minPrefix, 3), name("Extract Prefixes")) .accumulateByKey(topNByKey, new Function.ToKeyValue<KeyValPair<String, CompletionCandidate>, String, CompletionCandidate>() { @Override public Tuple<KeyValPair<String, CompletionCandidate>> f(KeyValPair<String, CompletionCandidate> tuple) { return new Tuple.WindowedTuple<>(Window.GlobalWindow.INSTANCE, tuple); } }, name("TopNByKey")); }
Source:
public static boolean tryParse(URI keyUri, AtomicReference<KeyVaultKeyUriProperties> keyVaultUriPropertiesReference) { KeyVaultKeyUriProperties keyVaultUriProperties = null; String[] segments = getSegments(keyUri); if (!((segments.length == 3) && StringUtils.equalsIgnoreCase(segments[0], KeyVaultConstants.KeysSegment))) { return false; } try { keyVaultUriProperties = new KeyVaultKeyUriProperties(keyUri); keyVaultUriProperties.keyName = segments[1]; keyVaultUriProperties.keyVersion = segments[2]; keyVaultUriProperties.keyVaultUri = new URI(keyUri.getScheme(), keyUri.getAuthority(), null, null, null); keyVaultUriPropertiesReference.set(keyVaultUriProperties); } catch (URISyntaxException e) { return false; } return true; }

Target:
public static boolean tryParse(URI keyUri, AtomicReference<KeyVaultKeyUriProperties> keyVaultUriPropertiesReference) { KeyVaultKeyUriProperties keyVaultUriProperties = null; String[] segments = getSegments(keyUri); if (!((segments.length == 3) && StringUtils.equalsIgnoreCase(segments[0], KeyVaultConstants.KeysSegment))) { return false; } try { keyVaultUriProperties = new KeyVaultKeyUriProperties(keyUri); keyVaultUriProperties.keyName = segments[1]; keyVaultUriProperties.keyVersion = segments[2]; keyVaultUriProperties.keyVaultUri = new URI(keyUri.getScheme(), keyUri.getAuthority(), null, null, null); keyVaultUriPropertiesReference.set(keyVaultUriProperties); } catch (URISyntaxException e) { logger.error("failed to parse uri {}", keyUri, e); return false; } return true; }
Source:
private void sendAndVerifyOperationRequest(RequestOrResponse request, ServerErrorCode expectedErrorCode, Boolean forceCheckOpReceived) throws InterruptedException, IOException { storageManager.resetStore(); RequestOrResponseType requestType = request.getRequestType(); Response response = sendRequestGetResponse(request, requestType == RequestOrResponseType.GetRequest || requestType == RequestOrResponseType.ReplicaMetadataRequest ? ServerErrorCode.No_Error : expectedErrorCode); if (expectedErrorCode.equals(ServerErrorCode.No_Error) || forceCheckOpReceived) { assertEquals("Operation received at the store not as expected", requestType, MockStorageManager.operationReceived); } if (requestType == RequestOrResponseType.GetRequest) { GetResponse getResponse = (GetResponse) response; for (PartitionResponseInfo info : getResponse.getPartitionResponseInfoList()) { assertEquals("Error code does not match expected", expectedErrorCode, info.getErrorCode()); } } else if (requestType == RequestOrResponseType.ReplicaMetadataRequest) { ReplicaMetadataResponse replicaMetadataResponse = (ReplicaMetadataResponse) response; for (ReplicaMetadataResponseInfo info : replicaMetadataResponse.getReplicaMetadataResponseInfoList()) { assertEquals("Error code does not match expected", expectedErrorCode, info.getError()); } } }

Target:
private void sendAndVerifyOperationRequest(RequestOrResponse request, ServerErrorCode expectedErrorCode, Boolean forceCheckOpReceived) throws InterruptedException, IOException { storageManager.resetStore(); RequestOrResponseType requestType = request.getRequestType(); Response response = sendRequestGetResponse(request, EnumSet.of(RequestOrResponseType.GetRequest, RequestOrResponseType.ReplicaMetadataRequest).contains(requestType) ? ServerErrorCode.No_Error : expectedErrorCode); if (expectedErrorCode.equals(ServerErrorCode.No_Error) || forceCheckOpReceived) { assertEquals("Operation received at the store not as expected", requestType, MockStorageManager.operationReceived); } if (requestType == RequestOrResponseType.GetRequest) { GetResponse getResponse = (GetResponse) response; for (PartitionResponseInfo info : getResponse.getPartitionResponseInfoList()) { assertEquals("Error code does not match expected", expectedErrorCode, info.getErrorCode()); } } else if (requestType == RequestOrResponseType.ReplicaMetadataRequest) { ReplicaMetadataResponse replicaMetadataResponse = (ReplicaMetadataResponse) response; for (ReplicaMetadataResponseInfo info : replicaMetadataResponse.getReplicaMetadataResponseInfoList()) { assertEquals("Error code does not match expected", expectedErrorCode, info.getError()); } } }
Source:
private static String lockName(Tree syntaxNode) { String name = SyntaxTreeNameFinder.getName(syntaxNode, SyntaxTreeNameFinder.Option.MEMBER_SELECT_CHOOSE_EXPR); return name == null ? "" : name; }

Target:
private static String lockName(Tree syntaxNode) { if (syntaxNode.is(Tree.Kind.METHOD_INVOCATION)) { ExpressionTree methodSelect = ((MethodInvocationTree) syntaxNode).methodSelect(); return SyntaxTreeNameFinder.getName(methodSelect); } return SyntaxTreeNameFinder.getName(syntaxNode); }
Source:
public int size() { try { tryLock(); return super.size(); } finally { unlock(); } }

Target:
public int size() { tryLock(); try { return super.size(); } finally { unlock(); } }
Source:
private EntityModelLabelEditor<Date> getInstanceOfDateEditor() { return new EntityModelLabelEditor<Date>(new AbstractRenderer<Date>(){ @Override public String render(Date entity) { if(entity == null) { return constants.unAvailablePropertyLabel(); } return GlusterRebalanceDateTimeRenderer.getLocalizedDateTimeFormat().format(entity); } }, new Parser<Date>() { @Override public Date parse(CharSequence text) throws ParseException { if(text.toString().isEmpty() || text == null) { return null; } else { return new Date(Date.parse(text.toString())); } } }); }

Target:
private EntityModelLabelEditor<Date> getInstanceOfDateEditor() { return new EntityModelLabelEditor<Date>(new AbstractRenderer<Date>(){ @Override public String render(Date entity) { if(entity == null) { return constants.unAvailablePropertyLabel(); } return GlusterRebalanceDateTimeRenderer.getLocalizedDateTimeFormat().format(entity); } }, new Parser<Date>() { @Override public Date parse(CharSequence text) throws ParseException { if(text == null || text.toString().isEmpty()) { return null; } else { return new Date(Date.parse(text.toString())); } } }); }
Source:
private static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null && cursor.moveToFirst()) { try { final int column_index = cursor.getColumnIndexOrThrow(column); return cursor.getString(column_index); } catch (IllegalArgumentException e) { throw new NoDataColumnForUriException(); } } } finally { if (cursor != null) cursor.close(); } return null; }

Target:
private static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) throws NoDataColumnForUriException { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null && cursor.moveToFirst()) { try { final int column_index = cursor.getColumnIndexOrThrow(column); return cursor.getString(column_index); } catch (IllegalArgumentException e) { throw new NoDataColumnForUriException(); } } } finally { if (cursor != null) cursor.close(); } return null; }
Source:
public void test_addValidBudget_newBudgetIsAdded() throws JSONException { String BUDGET_NAME = "Valid Budget"; String BUDGET_AMOUNT = "12345.00"; long BUDGET_ID = -2; solo.enterText(nameField, BUDGET_NAME); solo.enterText(amountField, BUDGET_AMOUNT); solo.sleep(1000); JSONObject serverResponse = new JSONObject(); serverResponse.put("id", BUDGET_ID); testClient.setNextResponse(serverResponse, true); solo.clickOnButton("Add"); solo.sleep(1000); Budget b = Budget.getBudgetById(-2); assertTrue("There should be a budget with ID -2.", b != null); assertEquals("The name of the budget was wrong.", BUDGET_NAME, b.getName()); assertEquals("The amount of the budget was wrong.", (int) (Double.parseDouble(BUDGET_AMOUNT) * 100), b.getBudgetAmount()); Budget.clearBudgets(); }

Target:
public void test_addValidBudget_newBudgetIsAdded() throws JSONException { String BUDGET_NAME = "Valid Budget"; String BUDGET_AMOUNT = "12345.00"; long BUDGET_ID = -2; solo.enterText(nameField, BUDGET_NAME); solo.enterText(amountField, BUDGET_AMOUNT); solo.sleep(1000); JSONObject serverResponse = new JSONObject(); serverResponse.put("id", BUDGET_ID); testClient.setNextResponse(serverResponse, true); solo.clickOnButton("Add"); solo.sleep(1000); Budget b = Budget.getBudgetById(-2); assertNotNull("There should be a budget with ID -2.", b); assertEquals("The name of the budget was wrong.", BUDGET_NAME, b.getName()); assertEquals("The amount of the budget was wrong.", (int) (Double.parseDouble(BUDGET_AMOUNT) * 100), b.getBudgetAmount()); }
Source:
public final boolean incrementToken() throws IOException { if (!input.incrementToken()) { return false; } StringBuilder stringBuilder = new StringBuilder(); String str = termAtt.toString(); termAtt.setEmpty(); String converted = this.stemmer.stemWord(str); if (!converted.isEmpty()) { stringBuilder.append(converted); } else { stringBuilder.append(str); } termAtt.resizeBuffer(stringBuilder.length()); termAtt.append(stringBuilder.toString()); termAtt.setLength(stringBuilder.length()); return true; }

Target:
public boolean incrementToken() throws IOException { if (input.incrementToken()) { String converted = stemmer.stemWord(termAtt.toString()); if (converted != null) termAtt.setEmpty().append(converted); return true; } else { return false; } }
Source:
protected void addTimeoutToxic() throws Exception { toxiProxy.toxics().timeout(TIMEOUT_NAME, ToxicDirection.DOWNSTREAM, 50).setToxicity (0.5f); }

Target:
protected void addTimeoutToxic() throws Exception { toxiProxy.toxics().timeout(TIMEOUT_NAME, ToxicDirection.DOWNSTREAM, TIMEOUT).setToxicity (TOXICITY); }
Source:
public boolean CheckFreeSpaceOnDestinationDomains() { boolean retValue = true; VmTemplate vmTemplate = DbFacade.getInstance().getVmTemplateDAO() .get(getParameters().getVmStaticData().getvmt_guid()); VmTemplateHandler.UpdateDisksFromDb(vmTemplate); double size = 0.0; java.util.ArrayList<Guid> domainsList; if (getStorageDomainId() == null || getStorageDomainId().getValue().equals(Guid.Empty)) { domainsList = (java.util.ArrayList<Guid>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.GetImageDomainsList, new GetImageDomainsListVDSCommandParameters(vmTemplate.getstorage_pool_id().getValue(), vmTemplate.getDiskList().get(0).getimage_group_id().getValue())).getReturnValue(); } else { domainsList = new java.util.ArrayList<Guid>(); domainsList.add(getStorageDomainId().getValue()); } for (Guid domainId : domainsList) { storage_domains domain = DbFacade.getInstance().getStorageDomainDAO().getForStoragePool(domainId, vmTemplate.getstorage_pool_id()); if (domain != null && domain.getstorage_domain_type() != StorageDomainType.ImportExport && domain.getstatus() == StorageDomainStatus.Active && domain.getavailable_disk_size() != null && StorageDomainSpaceChecker.hasSpaceForRequest(domain, getBlockSparseInitSizeInGB())) { size += domain.getavailable_disk_size() - Config.<Integer> GetValue(ConfigValues.FreeSpaceCriticalLowInGB); } } if (size < (getBlockSparseInitSizeInGB() * getParameters().getVmsCount() * vmTemplate.getDiskMap().size())) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); } return retValue; }

Target:
public boolean CheckFreeSpaceOnDestinationDomains() { boolean retValue = true; VmTemplate vmTemplate = DbFacade.getInstance().getVmTemplateDAO() .get(getParameters().getVmStaticData().getvmt_guid()); VmTemplateHandler.UpdateDisksFromDb(vmTemplate); double size = 0.0; java.util.ArrayList<Guid> domainsList; if (getStorageDomainId() == null || getStorageDomainId().getValue().equals(Guid.Empty)) { domainsList = (java.util.ArrayList<Guid>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.GetImageDomainsList, new GetImageDomainsListVDSCommandParameters(vmTemplate.getstorage_pool_id().getValue(), vmTemplate.getDiskList().get(0).getimage_group_id().getValue())).getReturnValue(); } else { domainsList = new java.util.ArrayList<Guid>(); domainsList.add(getStorageDomainId().getValue()); } for (Guid domainId : domainsList) { storage_domains domain = DbFacade.getInstance().getStorageDomainDAO().getForStoragePool(domainId, vmTemplate.getstorage_pool_id()); if (domain != null && domain.getstorage_domain_type() != StorageDomainType.ImportExport && domain.getstatus() == StorageDomainStatus.Active && domain.getavailable_disk_size() != null && StorageDomainSpaceChecker.hasSpaceForRequest(domain, getBlockSparseInitSizeInGB())) { size += domain.getavailable_disk_size() - getFreeSpaceCriticalLowInGB(); } } if (size < (getBlockSparseInitSizeInGB() * getParameters().getVmsCount() * vmTemplate.getDiskMap().size())) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW); } return retValue; }
Source:
public void restore() { final ModuleLogger current = this.current; if (current == null) { Module.setModuleLogger(NoopModuleLogger.getInstance()); } else { Module.setModuleLogger(current); } }

Target:
public void restore() { final Module logModule; try { logModule = moduleLoader.loadModule(MODULE_ID_LOGGING); } catch (final ModuleLoadException mle) { throw EmbeddedLogger.ROOT_LOGGER.moduleLoaderError(mle, MODULE_ID_LOGGING, moduleLoader); } final ModuleClassLoader logModuleClassLoader = logModule.getClassLoader(); final ClassLoader tccl = getTccl(); try { setTccl(logModuleClassLoader); final ModuleLogger loggerToRestore = this.loggerToRestore; if (loggerToRestore == null) { Module.setModuleLogger(NoopModuleLogger.getInstance()); } else { Module.setModuleLogger(loggerToRestore); } } finally { setTccl(tccl); } }
Source:
protected Registration(String id, String endpoint, Identity identity, String lwM2mVersion, Long lifetimeInSec, String smsNumber, BindingMode bindingMode, Link[] objectLinks, InetSocketAddress registrationEndpointAddress, Date registrationDate, Date lastUpdate, Map<String, String> additionalRegistrationAttributes) { Validate.notNull(id); Validate.notEmpty(endpoint); Validate.notNull(identity); Validate.notNull(registrationEndpointAddress); this.id = id; this.identity = identity; this.endpoint = endpoint; this.smsNumber = smsNumber; this.registrationEndpointAddress = registrationEndpointAddress; this.objectLinks = objectLinks; String rootPath = "/"; if (objectLinks != null) { for (Link link : objectLinks) { if (link != null && "oma.lwm2m".equals(link.getAttributes().get("rt"))) { rootPath = link.getUrl(); break; } } } this.rootPath = rootPath; this.lifeTimeInSec = lifetimeInSec == null ? DEFAULT_LIFETIME_IN_SEC : lifetimeInSec; this.lwM2mVersion = lwM2mVersion == null ? DEFAULT_LWM2M_VERSION : lwM2mVersion; this.bindingMode = bindingMode == null ? BindingMode.U : bindingMode; this.registrationDate = registrationDate == null ? new Date() : registrationDate; this.lastUpdate = lastUpdate == null ? new Date() : lastUpdate; if (additionalRegistrationAttributes == null || additionalRegistrationAttributes.isEmpty()) { this.additionalRegistrationAttributes = Collections.emptyMap(); } else { this.additionalRegistrationAttributes = Collections .synchronizedMap(new HashMap<>(additionalRegistrationAttributes)); } }

Target:
protected Registration(String id, String endpoint, Identity identity, String lwM2mVersion, Long lifetimeInSec, String smsNumber, BindingMode bindingMode, Link[] objectLinks, InetSocketAddress registrationEndpointAddress, Date registrationDate, Date lastUpdate, Map<String, String> additionalRegistrationAttributes) { Validate.notNull(id); Validate.notEmpty(endpoint); Validate.notNull(identity); Validate.notNull(registrationEndpointAddress); this.id = id; this.identity = identity; this.endpoint = endpoint; this.smsNumber = smsNumber; this.registrationEndpointAddress = registrationEndpointAddress; this.objectLinks = objectLinks; String rootPath = "/"; if (objectLinks != null) { for (Link link : objectLinks) { if (link != null && "oma.lwm2m".equals(link.getAttributes().get("rt"))) { rootPath = link.getUrl(); break; } } } this.rootPath = rootPath; this.lifeTimeInSec = lifetimeInSec == null ? DEFAULT_LIFETIME_IN_SEC : lifetimeInSec; this.lwM2mVersion = lwM2mVersion == null ? DEFAULT_LWM2M_VERSION : lwM2mVersion; this.bindingMode = bindingMode == null ? BindingMode.U : bindingMode; this.registrationDate = registrationDate == null ? new Date() : registrationDate; this.lastUpdate = lastUpdate == null ? new Date() : lastUpdate; if (additionalRegistrationAttributes == null || additionalRegistrationAttributes.isEmpty()) { this.additionalRegistrationAttributes = Collections.emptyMap(); } else { this.additionalRegistrationAttributes = Collections .unmodifiableMap(new HashMap<>(additionalRegistrationAttributes)); } }
Source:
private void destroyRaftNodeAsync(CPGroupId groupId) { nodeEngine.getExecutionService().execute(ASYNC_EXECUTOR, () -> raftService.destroyRaftNode(groupId)); }

Target:
private void destroyRaftNodeAsync(CPGroupId groupId) { nodeEngine.getExecutionService().execute(CP_SUBSYSTEM_EXECUTOR, () -> raftService.destroyRaftNode(groupId)); }
Source:
public VDI getIsoVDIByURL(final Connection conn, final String vmName, final String isoURL) { SR isoSR = null; String mountpoint = null; if (isoURL.startsWith("xs-tools") || isoURL.startsWith("guest-tools")) { try { final Set<VDI> vdis = VDI.getByNameLabel(conn, isoURL); if (vdis.isEmpty()) { throw new CloudRuntimeException("Could not find ISO with URL: " + isoURL); } return vdis.iterator().next(); } catch (final XenAPIException e) { throw new CloudRuntimeException("Unable to get pv iso: " + isoURL + " due to " + e.toString()); } catch (final Exception e) { throw new CloudRuntimeException("Unable to get pv iso: " + isoURL + " due to " + e.toString()); } } final int index = isoURL.lastIndexOf("/"); mountpoint = isoURL.substring(0, index); URI uri; try { uri = new URI(mountpoint); } catch (final URISyntaxException e) { throw new CloudRuntimeException("isoURL is wrong: " + isoURL); } isoSR = getISOSRbyVmName(conn, vmName); if (isoSR == null) { isoSR = createIsoSRbyURI(conn, uri, vmName, false); } final String isoName = isoURL.substring(index + 1); final VDI isoVDI = getVDIbyLocationandSR(conn, isoName, isoSR); if (isoVDI != null) { return isoVDI; } else { throw new CloudRuntimeException("Could not find ISO with URL: " + isoURL); } }

Target:
public VDI getIsoVDIByURL(final Connection conn, final String vmName, final String isoURL) { SR isoSR = null; String mountpoint = null; if (isoURL.startsWith("xs-tools")) { try { final String actualIsoURL = actualIsoTemplate(conn); final Set<VDI> vdis = VDI.getByNameLabel(conn, actualIsoURL); if (vdis.isEmpty()) { throw new CloudRuntimeException("Could not find ISO with URL: " + actualIsoURL); } return vdis.iterator().next(); } catch (final XenAPIException e) { throw new CloudRuntimeException("Unable to get pv iso: " + isoURL + " due to " + e.toString()); } catch (final Exception e) { throw new CloudRuntimeException("Unable to get pv iso: " + isoURL + " due to " + e.toString()); } } final int index = isoURL.lastIndexOf("/"); mountpoint = isoURL.substring(0, index); URI uri; try { uri = new URI(mountpoint); } catch (final URISyntaxException e) { throw new CloudRuntimeException("isoURL is wrong: " + isoURL); } isoSR = getISOSRbyVmName(conn, vmName); if (isoSR == null) { isoSR = createIsoSRbyURI(conn, uri, vmName, false); } final String isoName = isoURL.substring(index + 1); final VDI isoVDI = getVDIbyLocationandSR(conn, isoName, isoSR); if (isoVDI != null) { return isoVDI; } else { throw new CloudRuntimeException("Could not find ISO with URL: " + isoURL); } }
Source:
private void createMercs() { String fileName = "mercenaries.json"; if (!SaveManager.resourceExists(fileName)) { return; } String path = SaveManager.getRsrcPath(fileName); BufferedReader bufferedReader; try { bufferedReader = new BufferedReader(new FileReader(path)); if (new File(path).length() == 0) { bufferedReader.close(); return; } } catch (IOException e) { return; } Gson gson = new Gson(); Type type = new TypeToken<ArrayList<HashMap<String, String>>>() { }.getType(); ArrayList<HashMap<String, String>> mercs = gson.fromJson(bufferedReader, type); MercItem mercItem; for (HashMap<String, String> node : mercs) { mercItem = new MercItem( new ShipConfig(hullConfigManager.getConfig(node.get("hull")), node.get("items"), Integer.parseInt(node.get("money")), -1f, null, itemManager)); MercenaryUtils.createMerc(this, hero, mercItem); } }

Target:
private void createMercs() { if (!SaveManager.resourceExists(MERC_SAVE_FILE)) { return; } String path = SaveManager.getResourcePath(MERC_SAVE_FILE); BufferedReader bufferedReader; try { bufferedReader = new BufferedReader(new FileReader(path)); if (new File(path).length() == 0) { bufferedReader.close(); return; } } catch (IOException e) { logger.error("Could not save mercenaries!"); e.printStackTrace(); return; } Gson gson = new Gson(); Type type = new TypeToken<ArrayList<HashMap<String, String>>>() {}.getType(); ArrayList<HashMap<String, String>> mercs = gson.fromJson(bufferedReader, type); MercItem mercItems; for (HashMap<String, String> node : mercs) { mercItems = new MercItem( new ShipConfig(hullConfigManager.getConfig(node.get("hull")), node.get("items"), Integer.parseInt(node.get("money")), -1f, null, itemManager)); MercenaryUtils.createMerc(this, hero, mercItems); } }
Source:
public int getTaskInstanceCountForTaskName(final String taskname) throws IllegalAccessFault, IllegalArgumentFault, IllegalStateFault, IllegalOperationFault { final int[] taskCountTemp = {0}; final List[] tasklist = new List[1]; try { HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler(). execTransaction(new Callable<Object>() { public Object call() throws Exception { HumanTaskServerHolder.getInstance().getHtServer().getTaskEngine().getDaoConnectionFactory().getConnection(); HumanTaskServer humanTaskServer = HumanTaskServiceComponent.getHumanTaskServer(); HumanTaskEngine humanTaskEngine = humanTaskServer.getTaskEngine(); HumanTaskDAOConnectionFactory humanTaskDAOConnectionFactory = humanTaskEngine.getDaoConnectionFactory(); humanTaskServer.getServerConfig(); HTQueryBuilder htQueryBuilder = new HTQueryBuilder(); EntityManager em = humanTaskDAOConnectionFactory.getConnection().getEntityManager(); Query query = htQueryBuilder.buildQueryToFindTaskInstances(taskname, em); tasklist[0] = query.getResultList(); taskCountTemp[0] = tasklist[0].size(); return null; } }); } catch (Exception ex) { handleException(ex); } return taskCountTemp[0]; }

Target:
public int getTaskInstanceCountForTaskName(final String taskname) throws Exception { final int[] taskCountTemp = {0}; final List[] tasklist = new List[1]; HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler(). execTransaction(new Callable<Object>() { public Object call() throws Exception { HumanTaskServerHolder.getInstance().getHtServer().getTaskEngine().getDaoConnectionFactory().getConnection(); HumanTaskServer humanTaskServer = HumanTaskServiceComponent.getHumanTaskServer(); HumanTaskEngine humanTaskEngine = humanTaskServer.getTaskEngine(); HumanTaskDAOConnectionFactory humanTaskDAOConnectionFactory = humanTaskEngine.getDaoConnectionFactory(); humanTaskServer.getServerConfig(); HTQueryBuilder htQueryBuilder = new HTQueryBuilder(); EntityManager em = humanTaskDAOConnectionFactory.getConnection().getEntityManager(); Query query = htQueryBuilder.buildQueryToFindTaskInstances(taskname, em); tasklist[0] = query.getResultList(); taskCountTemp[0] = tasklist[0].size(); return null; } }); return taskCountTemp[0]; }
Source:
public void addToOrderBook(Order order) { Class buy = BuyOrder.class; Class sell = SellOrder.class; if (sell.isInstance(order)) { SellOrder s = (SellOrder) order; if (sellOrders.containsKey(s.getStockSymbol())) { ArrayList<Order> temp = sellOrders.get(s.getStockSymbol()); temp.add(s); sellOrders.put(s.getStockSymbol(), temp); } else { ArrayList<Order> temp = new ArrayList<Order>(); temp.add(s); sellOrders.put(s.getStockSymbol(), temp); } } else if (buy.isInstance(order)) { BuyOrder b = (BuyOrder) order; if (buyOrders.containsKey(b.getStockSymbol())) { ArrayList<Order> temp = buyOrders.get(b.getStockSymbol()); temp.add(b); buyOrders.put(b.getStockSymbol(), temp); } else { ArrayList<Order> temp = new ArrayList<Order>(); temp.add(b); buyOrders.put(b.getStockSymbol(), temp); } } }

Target:
public void addToOrderBook(Order order) { Class buy = BuyOrder.class; Class sell = SellOrder.class; if (sell.isInstance(order)) { SellOrder sell = (SellOrder) order; if (sellOrders.containsKey(s.getStockSymbol())) { ArrayList<Order> temp = sellOrders.get(sell.getStockSymbol()); temp.add(sell); sellOrders.put(sell.getStockSymbol(), temp); } else { ArrayList<Order> temp = new ArrayList<Order>(); temp.add(sell); sellOrders.put(sell.getStockSymbol(), temp); } } else if (buy.isInstance(order)) { BuyOrder b = (BuyOrder) order; if (buyOrders.containsKey(b.getStockSymbol())) { ArrayList<Order> temp = buyOrders.get(b.getStockSymbol()); temp.add(b); buyOrders.put(b.getStockSymbol(), temp); } else { ArrayList<Order> temp = new ArrayList<Order>(); temp.add(b); buyOrders.put(b.getStockSymbol(), temp); } } }
Source:
public @NotNull MetaTag getCharsetMetaTag(@NotNull String charsetStr) { ECharset charset = ECharset.getCharset(charsetStr).get(); if (charset != null) { return new MetaTag(charset); } return new MetaTag(ECharset.ATTRIB_NAME, charsetStr, null); }

Target:
public @NotNull MetaTag getCharsetMetaTag(@NotNull String charsetStr) { Optional<ECharset> charset = ECharset.getCharset(charsetStr); if (charset.isPresent()) { return new MetaTag(charset.get()); } return new MetaTag(ECharset.ATTRIB_NAME, charsetStr, null); }
Source:
public RequestMsg simulateSerialization(RequestMsg message) throws IOException { ByteBuf oBuf = Unpooled.buffer(); try (ByteBufOutputStream requestOutputStream = new ByteBufOutputStream(oBuf)) { message.writeTo(requestOutputStream); oBuf.resetReaderIndex(); try (ByteBufInputStream msgInputStream = new ByteBufInputStream(oBuf)) { RequestMsg msg = RequestMsg.parseFrom(msgInputStream); oBuf.release(); return msg; } } }

Target:
public RequestMsg simulateSerialization(RequestMsg message) throws IOException { ByteBuf oBuf = Unpooled.buffer(); RequestMsg msg; try (ByteBufOutputStream requestOutputStream = new ByteBufOutputStream(oBuf)) { message.writeTo(requestOutputStream); oBuf.resetReaderIndex(); try (ByteBufInputStream msgInputStream = new ByteBufInputStream(oBuf)) { msg = RequestMsg.parseFrom(msgInputStream); } } finally { oBuf.release(); } return msg; }
Source:
public void testAvailableStrata() throws Exception { String typeName = "HelloWorld"; prepareXtendBreakpoint(typeName, 3); IJavaThread thread = null; try { thread = launchToBreakpoint(typeName); assertNotNull("Breakpoint not hit within timeout period", thread); IJavaReferenceType type = ((IJavaStackFrame) thread.getTopStackFrame()).getReferenceType(); String[] strata = type.getAvailableStrata(); for (String strataName : strata) { DebugPlugin.log(new Status(IStatus.INFO, "Strata Name: ", strataName)); } DebugPlugin.log(new Status(IStatus.INFO, "Strata count: ", String.valueOf(strata.length))); assertEquals("Wrong number of available strata", 2, strata.length); assertEquals("Wrong strata", "Xtend", strata[0]); assertEquals("Wrong strata", "Java", strata[1]); } finally { terminateAndRemove(thread); removeAllBreakpoints(); } }

Target:
public void testAvailableStrata() throws Exception { String typeName = "HelloWorld"; prepareXtendBreakpoint(typeName, 3); IJavaThread thread = null; try { thread = launchToBreakpoint(typeName); assertNotNull("Breakpoint not hit within timeout period", thread); IJavaReferenceType type = ((IJavaStackFrame) thread.getTopStackFrame()).getReferenceType(); String[] strata = type.getAvailableStrata(); for (String strataName : strata) { DebugPlugin.log(new Status(IStatus.INFO, "Strata Name: ", strataName)); } DebugPlugin.log(new Status(IStatus.INFO, "Strata count: ", String.valueOf(strata.length))); assertEquals("Stratas available are: " + Arrays.toString(strata) + ", Wrong number of available strata", 2, strata.length); assertEquals("Wrong strata", "Xtend", strata[0]); assertEquals("Wrong strata", "Java", strata[1]); } finally { terminateAndRemove(thread); removeAllBreakpoints(); } }
Source:
public void close() throws IOException { if (!isClosed) { isClosed = true; for (LineConsumer lineConsumer : lineConsumers) { try { lineConsumer.close(); } catch (IOException e) { LOG.error(String.format("An error occurred while closing the line consumer %s", lineConsumer), e); } } } }

Target:
public void close() { if (isOpen) { isOpen = false; for (LineConsumer lineConsumer : lineConsumers) { try { lineConsumer.close(); } catch (IOException e) { LOG.error(String.format("An error occurred while closing the line consumer %s", lineConsumer), e); } } } }