auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected HttpAction redirectToOriginallyRequestedUrl(final C context, final String defaultUrl) { final Optional<String> requestedUrlOpt = context.getSessionStore().get(context, Pac4jConstants.REQUESTED_URL); String redirectUrl = requestedUrlOpt.filter(url -> isNotBlank(url)).orElse(defaultUrl); if (!defaultUrl.equals(redirectUrl)) { context.getSessionStore().set(context, Pac4jConstants.REQUESTED_URL, null); } logger.debug("redirectUrl: {}", redirectUrl); return HttpAction.redirect(context, redirectUrl); }

Target:
protected HttpAction redirectToOriginallyRequestedUrl(final C context, final String defaultUrl) { String redirectUrl = (String) context.getSessionStore() .get(context, Pac4jConstants.REQUESTED_URL) .filter(url -> CommonHelper.isNotBlank((String) url)) .orElse(defaultUrl); if (!defaultUrl.equals(redirectUrl)) { context.getSessionStore().set(context, Pac4jConstants.REQUESTED_URL, null); } logger.debug("redirectUrl: {}", redirectUrl); return HttpAction.redirect(context, redirectUrl); }
Source:
public byte[] getBody() { byte[] body = null; final AmqpBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType(); switch (bodyType) { case DATA: final BinaryData binaryData = ((AmqpDataBody) amqpAnnotatedMessage.getBody()).getBinaryData(); if (binaryData != null) { body = binaryData.getData(); } break; case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException("Body type not supported yet " + bodyType.toString())); default: logger.warning("Invalid body type {}.", bodyType); throw logger.logExceptionAsError(new IllegalStateException("Body type not valid " + bodyType.toString())); } return body; }

Target:
public byte[] getBody() { final AmqpBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType(); switch (bodyType) { case DATA: return Arrays.copyOf(binaryData, binaryData.length); case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException("Body type not supported yet " + bodyType.toString())); default: logger.warning("Invalid body type {}.", bodyType); throw logger.logExceptionAsError(new IllegalStateException("Body type not valid " + bodyType.toString())); } }
Source:
public void setup() { this.handler = new AbstractReplyProducingMessageHandler() { @Override protected Object handleRequestMessage(Message<?> requestMessage) { final SettableListenableFuture<String> future = new SettableListenableFuture<String>(); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { try { latch.await(10, TimeUnit.SECONDS); switch (whichTest) { case 0: try { future.set("reply"); } catch (Exception e) { failedCallbackException = e; noOutputChannelLatch.countDown(); } break; case 1: future.setException(new RuntimeException("foo")); break; case 2: try { future.setException(new MessagingException(requestMessage)); } catch (Exception e) { failedCallbackException = e; exceptionLatch.countDown(); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }); return future; } }; this.handler.setAsyncReplySupported(true); this.handler.setOutputChannel(this.output); this.latch = new CountDownLatch(1); }

Target:
public void setup() { this.handler = new AbstractReplyProducingMessageHandler() { @Override protected Object handleRequestMessage(Message<?> requestMessage) { final SettableListenableFuture<String> future = new SettableListenableFuture<String>(); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { try { latch.await(10, TimeUnit.SECONDS); switch (whichTest) { case 0: future.set("reply"); break; case 1: future.setException(new RuntimeException("foo")); break; case 2: future.setException(new MessagingException(requestMessage)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }); return future; } }; this.handler.setAsyncReplySupported(true); this.handler.setOutputChannel(this.output); this.latch = new CountDownLatch(1); this.logger = spy(TestUtils.getPropertyValue(this.handler, "logger", Log.class)); new DirectFieldAccessor(this.handler).setPropertyValue("logger", logger); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { failedCallbackMessage = (String) invocation.getArguments()[0]; failedCallbackException = (Exception) invocation.getArguments()[1]; exceptionLatch.countDown(); return null; } }).when(logger).error(anyString(), any(Throwable.class)); }
Source:
private String formatClassPath(String filePath) { String[] path = filePath.split("resources" + File.separator); return (path.length == 2 ? path[1] : filePath); }

Target:
private String formatClassPath(String filePath) { String[] path = filePath.split(File.separator + "resources" + File.separator); return (path.length == 2 ? path[1] : filePath); }
Source:
private void impl$onRead(NBTTagCompound compound, CallbackInfo info) { if (shadow$hasTagCompound() && shadow$getTagCompound().hasKey(Constants.Sponge.SPONGE_DATA, Constants.NBT.TAG_COMPOUND)) { DataUtil.readCustomData(shadow$getTagCompound().getCompoundTag(Constants.Sponge.SPONGE_DATA), ((org.spongepowered.api.item.inventory.ItemStack) this)); } if (this.stackTagCompound != null && this.stackTagCompound.isEmpty()) { this.stackTagCompound = null; } }

Target:
private void impl$onRead(NBTTagCompound compound, CallbackInfo info) { if (this.shadow$hasTagCompound() && this.shadow$getTagCompound().hasKey(Constants.Sponge.SPONGE_DATA, Constants.NBT.TAG_COMPOUND)) { DataUtil.readCustomData(this.shadow$getTagCompound().getCompoundTag(Constants.Sponge.SPONGE_DATA), ((org.spongepowered.api.item.inventory.ItemStack) this)); } if (this.stackTagCompound != null && this.stackTagCompound.isEmpty()) { this.stackTagCompound = null; } }
Source:
public Object getInfo() { return info; }

Target:
public String getInfo() { return player.getName(); }
Source:
private void activeSpeakerChanged(long ssrc) { Conference conference = this.conference; if (conference != null) { if (logger.isTraceEnabled()) { logger.trace( "The dominant speaker in conference " + conference.getID() + " is now the SSRC " + ssrc + "."); } AbstractEndpoint endpoint = conference.findEndpointByReceiveSSRC(ssrc); if (endpoint == null) { logger.warn("Unable to find endpoint corresponding to active" + "speaker SSRC " + ssrc); return; } synchronized (syncRoot) { if (!endpoints.remove(endpoint)) { logger.warn("Got active speaker notification for an unknown" + " endpoint (ssrc: " + ssrc + ", epId " + endpoint.getID() + ")! Ignoring"); return; } endpoints.add(0, endpoint); TaskPools.IO_POOL.submit(() -> { if (conference != null) { conference.dominantSpeakerChanged(); } }); } } }

Target:
private void activeSpeakerChanged(long ssrc) { Conference conference = this.conference; if (conference != null) { if (logger.isTraceEnabled()) { logger.trace( "The dominant speaker in conference " + conference.getID() + " is now the SSRC " + ssrc + "."); } AbstractEndpoint endpoint = conference.findEndpointByReceiveSSRC(ssrc); if (endpoint == null) { logger.warn("Unable to find endpoint corresponding to " + "active speaker SSRC " + ssrc); return; } synchronized (syncRoot) { if (!endpoints.remove(endpoint)) { logger.warn("Got active speaker notification for an unknown" + " endpoint (ssrc: " + ssrc + ", epId " + endpoint.getID() + ")! Ignoring"); return; } endpoints.add(0, endpoint); TaskPools.IO_POOL.submit(() -> { if (conference != null) { conference.dominantSpeakerChanged(); } }); } } }
Source:
private ApiResponse buildResponseFromAuthState(AuthenticationState state) { Map<String, String> fields = new HashMap<>(); fields.put("lastSuccessfulAuthTimeInMs", Long.toString(state.getLastSuccessfulAuthTime())); fields.put("lastAuthFailure", state.getLastAuthFailure()); fields.put("lastAuthHistoryId", Integer.toString(state.getLastAuthRequestHistoryId())); fields.put(PARAM_LAST_POLL_RESULT, "" + state.getLastPollResult()); fields.put(PARAM_REQUESTS_SINCE_LAST_POLL, Integer.toString(state.getRequestsSincePoll())); fields.put(PARAM_LAST_POLL_TIME_IN_MS, Long.toString(state.getLastPollTime())); return new ApiResponseSet<>("authenticationState", fields); }

Target:
private ApiResponse buildResponseFromAuthState(AuthenticationState state) { Map<String, String> fields = new HashMap<>(); fields.put("lastSuccessfulAuthTimeInMs", Long.toString(state.getLastSuccessfulAuthTime())); fields.put("lastAuthFailure", state.getLastAuthFailure()); fields.put("lastAuthHistoryId", Integer.toString(state.getLastAuthRequestHistoryId())); fields.put(PARAM_LAST_POLL_RESULT, String.valueOf(state.getLastPollResult())); fields.put(PARAM_REQUESTS_SINCE_LAST_POLL, Integer.toString(state.getRequestsSincePoll())); fields.put(PARAM_LAST_POLL_TIME_IN_MS, Long.toString(state.getLastPollTime())); return new ApiResponseSet<>("authenticationState", fields); }
Source:
public void testCorrectExceptionOnSQLException() throws Exception { Jdbi dbi = Jdbi.create(() -> { throw new SQLException(); }); try { dbi.open(); fail("Should have raised an exception"); } catch (UnableToObtainConnectionException e) { assertThat(e).isNotNull(); } }

Target:
public void testCorrectExceptionOnSQLException() throws Exception { Jdbi dbi = Jdbi.create(() -> { throw new SQLException(); }); dbi.open(); }
Source:
private Ordering<Row> makeComparator( List<DimensionSpec> dimensions, List<AggregatorFactory> aggs, List<PostAggregator> postAggs ) { Ordering<Row> ordering = new Ordering<Row>() { @Override public int compare(Row left, Row right) { return Longs.compare(left.getTimestampFromEpoch(), right.getTimestampFromEpoch()); } }; Map<String, DimensionSpec> dimensionsMap = Maps.newHashMap(); for (DimensionSpec spec : dimensions) { dimensionsMap.put(spec.getOutputName(), spec); } Map<String, AggregatorFactory> aggregatorsMap = Maps.newHashMap(); for (final AggregatorFactory agg : aggs) { aggregatorsMap.put(agg.getName(), agg); } Map<String, PostAggregator> postAggregatorsMap = Maps.newHashMap(); for (PostAggregator postAgg : postAggs) { postAggregatorsMap.put(postAgg.getName(), postAgg); } for (OrderByColumnSpec columnSpec : columns) { String columnName = columnSpec.getDimension(); Ordering<Row> nextOrdering = null; if (dimensionsMap.containsKey(columnName)) { nextOrdering = dimensionOrdering(columnName); } else if (aggregatorsMap.containsKey(columnName)) { nextOrdering = metricOrdering(columnName, aggregatorsMap.get(columnName).getComparator()); } else if (postAggregatorsMap.containsKey(columnName)) { nextOrdering = metricOrdering(columnName, postAggregatorsMap.get(columnName).getComparator()); } if (nextOrdering == null) { throw new ISE("Unknown column in order clause[%s]", columnSpec); } switch (columnSpec.getDirection()) { case DESCENDING: nextOrdering = nextOrdering.reverse(); } ordering = ordering.compound(nextOrdering); } return ordering; }

Target:
private Ordering<Row> makeComparator( List<DimensionSpec> dimensions, List<AggregatorFactory> aggs, List<PostAggregator> postAggs ) { Ordering<Row> ordering = new Ordering<Row>() { @Override public int compare(Row left, Row right) { return Longs.compare(left.getTimestampFromEpoch(), right.getTimestampFromEpoch()); } }; Map<String, DimensionSpec> dimensionsMap = Maps.newHashMap(); for (DimensionSpec spec : dimensions) { dimensionsMap.put(spec.getOutputName(), spec); } Map<String, AggregatorFactory> aggregatorsMap = Maps.newHashMap(); for (final AggregatorFactory agg : aggs) { aggregatorsMap.put(agg.getName(), agg); } Map<String, PostAggregator> postAggregatorsMap = Maps.newHashMap(); for (PostAggregator postAgg : postAggs) { postAggregatorsMap.put(postAgg.getName(), postAgg); } for (OrderByColumnSpec columnSpec : columns) { String columnName = columnSpec.getDimension(); Ordering<Row> nextOrdering = null; if (postAggregatorsMap.containsKey(columnName)) { nextOrdering = metricOrdering(columnName, postAggregatorsMap.get(columnName).getComparator()); } else if (aggregatorsMap.containsKey(columnName)) { nextOrdering = metricOrdering(columnName, aggregatorsMap.get(columnName).getComparator()); } else if (dimensionsMap.containsKey(columnName)) { nextOrdering = dimensionOrdering(columnName); } if (nextOrdering == null) { throw new ISE("Unknown column in order clause[%s]", columnSpec); } switch (columnSpec.getDirection()) { case DESCENDING: nextOrdering = nextOrdering.reverse(); } ordering = ordering.compound(nextOrdering); } return ordering; }
Source:
private void pushAndResetGradients() { for (int i = 0; i < numClasses; i++) { gradient.get(i).scalei(stepSize / batchSize); gradient.get(i).axpy(-stepSize * lambda, models.get(i)); worker.push(i, gradient.get(i)); gradient.set(i, vectorFactory.createDenseZeros(numFeatures)); } }

Target:
private void pushAndResetGradients() { for (int i = 0; i < numClasses; i++) { gradient.get(i).scalei(stepSize / batchSize); if (lambda != 0) { gradient.get(i).axpy(-stepSize * lambda, models.get(i)); } worker.push(i, gradient.get(i)); gradient.set(i, vectorFactory.createDenseZeros(numFeatures)); } }
Source:
public void createPartControl(final Composite parent) { final FormToolkit toolkit = new FormToolkit(parent.getDisplay()); form = toolkit.createForm(parent); form.setText(DVMessages.getString(NoConnectionSelected)); final Composite container = form.getBody(); GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).applyTo(container); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container); createTableViewer(container); getSite().registerContextMenu(new MenuManager(), null); getSite().getWorkbenchWindow().getSelectionService() .addSelectionListener(DockerExplorerView.VIEW_ID, this); hookContextMenu(); hookToolBarItems(); IEclipsePreferences preferences = InstanceScope.INSTANCE .getNode(Activator.PLUGIN_ID); boolean showAll = preferences.getBoolean(SHOW_ALL_CONTAINERS_PREFERENCE, true); showAllContainers(showAll); final ICommandService service = getViewSite().getWorkbenchWindow() .getService(ICommandService.class); service.getCommand(SHOW_ALL_CONTAINERS_COMMAND_ID) .getState(TOGGLE_STATE).setValue(showAll); service.refreshElements(SHOW_ALL_CONTAINERS_COMMAND_ID, null); boolean filterByLabels = preferences .getBoolean(FILTER_WITH_LABELS_PREFERENCE, false); showContainersWithLabels(filterByLabels); service.getCommand(FILTER_CONTAINERS_COMMAND_ID).getState(TOGGLE_STATE) .setValue(filterByLabels); service.refreshElements(FILTER_CONTAINERS_COMMAND_ID, null); DockerConnectionManager.getInstance() .addConnectionManagerListener(this); viewer.refresh(); }

Target:
public void createPartControl(final Composite parent) { final FormToolkit toolkit = new FormToolkit(parent.getDisplay()); form = toolkit.createForm(parent); form.setText(DVMessages.getString(NoConnectionSelected)); final Composite container = form.getBody(); GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).applyTo(container); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container); createTableViewer(container); getSite().registerContextMenu(new MenuManager(), null); getSite().getWorkbenchWindow().getSelectionService() .addSelectionListener(DockerExplorerView.VIEW_ID, this); hookContextMenu(); hookToolBarItems(); IEclipsePreferences preferences = InstanceScope.INSTANCE .getNode(Activator.PLUGIN_ID); boolean showAll = preferences.getBoolean(SHOW_ALL_CONTAINERS_PREFERENCE, true); showAllContainers(showAll); final ICommandService service = getViewSite().getWorkbenchWindow() .getService(ICommandService.class); service.getCommand(SHOW_ALL_CONTAINERS_COMMAND_ID) .getState(TOGGLE_STATE).setValue(showAll); service.refreshElements(SHOW_ALL_CONTAINERS_COMMAND_ID, null); boolean filterByLabels = preferences .getBoolean(FILTER_WITH_LABELS_PREFERENCE, false); showContainersWithLabels(filterByLabels); service.getCommand(FILTER_CONTAINERS_COMMAND_ID).getState(TOGGLE_STATE) .setValue(filterByLabels); service.refreshElements(FILTER_CONTAINERS_COMMAND_ID, null); DockerConnectionManager.getInstance() .addConnectionManagerListener(this); }
Source:
public void onFluidInventoryChanged( final IFluidHandler inventory ) { final int slot = getTankSlot( inventory ); this.tankChanged[slot] = true; if( this.isWorking == slot ) { return; } final boolean had = this.hasWorkToDo(); this.updatePlan( slot ); final boolean now = this.hasWorkToDo(); if( had != now ) { try { if( now ) { this.gridProxy.getTick().alertDevice( this.gridProxy.getNode() ); } else { this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() ); } } catch( final GridAccessException e ) { } } }

Target:
public void onFluidInventoryChanged( final IFluidHandler inventory ) { final int slot = getTankSlot( inventory ); this.tankChanged[slot] = true; this.saveChanges(); if( this.isWorking == slot ) { return; } final boolean had = this.hasWorkToDo(); this.updatePlan( slot ); final boolean now = this.hasWorkToDo(); if( had != now ) { try { if( now ) { this.gridProxy.getTick().alertDevice( this.gridProxy.getNode() ); } else { this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() ); } } catch( final GridAccessException e ) { } } }
Source:
public List<String> checkGlusterQuorum(Cluster cluster, Iterable<Guid> selectedHostIdsForMaintenance) { List<String> volumesWithoutQuorum = new ArrayList<>(); if (cluster.supportsGlusterService()) { List<GlusterBrickEntity> bricksGoingToMaintenance = new ArrayList<>(); for (Guid serverId : selectedHostIdsForMaintenance) { bricksGoingToMaintenance.addAll(getGlusterBrickDao().getGlusterVolumeBricksByServerId(serverId)); } List<GlusterVolumeEntity> volumesInCluster = getGlusterVolumeDao().getByClusterId(cluster.getId()); for (GlusterVolumeEntity volume : volumesInCluster) { if (volume.getVolumeType().isReplicatedType()) { if (!isQuorumMet(volume, bricksGoingToMaintenance)) { volumesWithoutQuorum.add(volume.getName()); } } } } return volumesWithoutQuorum; }

Target:
public List<String> checkGlusterQuorum(Cluster cluster, Iterable<Guid> selectedHostIdsForMaintenance) { List<String> volumesWithoutQuorum = new ArrayList<>(); if (cluster.supportsGlusterService()) { List<GlusterBrickEntity> bricksGoingToMaintenance = new ArrayList<>(); for (Guid serverId : selectedHostIdsForMaintenance) { bricksGoingToMaintenance.addAll(getGlusterBrickDao().getGlusterVolumeBricksByServerId(serverId)); } List<GlusterVolumeEntity> volumesInCluster = getGlusterVolumeDao().getByClusterId(cluster.getId()); for (GlusterVolumeEntity volume : volumesInCluster) { if (volume.getVolumeType().isReplicatedType() && !isQuorumMet(volume, bricksGoingToMaintenance)) { volumesWithoutQuorum.add(volume.getName()); } } } return volumesWithoutQuorum; }
Source:
public void execute(RepositoryPath path) throws IOException { List<Path> filePaths = Files.list(path) .filter(p -> { try { return Boolean.TRUE.equals(Files.getAttribute(p, RepositoryFileAttributes.METADATA)); } catch (IOException e) { logger.error(String.format("Failed to read attributes for [%s]", p), e); } return false; }).collect(Collectors.toList()); RepositoryPath parentPath = path.getParent() .toAbsolutePath(); if (filePaths.isEmpty()) { return; } if (!getVisitedRootPaths().isEmpty() && getVisitedRootPaths().containsKey(parentPath)) { List<RepositoryPath> visitedVersionPaths = getVisitedRootPaths().get(parentPath); if (visitedVersionPaths.contains(path)) { return; } } if (logger.isDebugEnabled()) { System.out.println(parentPath); } if (previousPath != null && !parentPath.startsWith(previousPath)) { getVisitedRootPaths().remove(previousPath); previousPath = parentPath; } if (previousPath == null) { previousPath = parentPath; } List<RepositoryPath> versionDirectories = getVersionDirectories(parentPath); if (versionDirectories == null || versionDirectories.isEmpty()) { return; } getVisitedRootPaths().put(parentPath, versionDirectories); if (logger.isDebugEnabled()) { for (Path directory : versionDirectories) { System.out.println(" " + directory.toAbsolutePath().toString()); } } RepositoryPath basePath = versionDirectories.get(0).getParent(); RepositoryLayoutFileSystemProvider provider = (RepositoryLayoutFileSystemProvider) basePath.getFileSystem() .provider(); try { provider.storeChecksum(basePath, forceRegeneration); } catch (NoSuchAlgorithmException e) { throw new IOException(e); } }

Target:
public void execute(RepositoryPath path) throws IOException { List<Path> filePaths = Files.list(path) .filter(p -> { try { return Boolean.TRUE.equals(Files.getAttribute(p, RepositoryFileAttributes.METADATA)); } catch (IOException e) { logger.error(String.format("Failed to read attributes for [%s]", p), e); } return false; }).collect(Collectors.toList()); RepositoryPath parentPath = path.getParent() .toAbsolutePath(); if (filePaths.isEmpty()) { return; } if (!getVisitedRootPaths().isEmpty() && getVisitedRootPaths().containsKey(parentPath)) { List<RepositoryPath> visitedVersionPaths = getVisitedRootPaths().get(parentPath); if (visitedVersionPaths.contains(path)) { return; } } if (logger.isDebugEnabled()) { System.out.println(parentPath); } if (previousPath != null && !parentPath.startsWith(previousPath)) { getVisitedRootPaths().remove(previousPath); previousPath = parentPath; } if (previousPath == null) { previousPath = parentPath; } List<RepositoryPath> versionDirectories = getVersionDirectories(parentPath); if (versionDirectories == null || versionDirectories.isEmpty()) { return; } getVisitedRootPaths().put(parentPath, versionDirectories); if (logger.isDebugEnabled()) { for (Path directory : versionDirectories) { System.out.println(" " + directory.toAbsolutePath().toString()); } } RepositoryPath basePath = versionDirectories.get(0).getParent(); RepositoryLayoutFileSystemProvider provider = (RepositoryLayoutFileSystemProvider) basePath.getFileSystem() .provider(); provider.storeChecksum(basePath, forceRegeneration); }
Source:
private PrintLayer createMyPlacesPrintLayer(int categoryId, LayerProperties requestedLayer) { int opacity = requestedLayer.getOpacity() != null ? requestedLayer.getOpacity() : 100; if (opacity <= 0) { return null; } PrintLayer layer = new PrintLayer(); layer.setId(categoryId); layer.setType("myplaces"); layer.setVersion("1.3.0"); layer.setName("oskari:my_places_categories"); layer.setSrsName("EPSG:3067"); layer.setOpacity(opacity); return layer; }

Target:
private PrintLayer createMyPlacesPrintLayer(int categoryId, LayerProperties requestedLayer) { int opacity = requestedLayer.getOpacity() != null ? requestedLayer.getOpacity() : 100; if (opacity <= 0) { return null; } PrintLayer layer = new PrintLayer(); layer.setId(categoryId); layer.setType("myplaces"); layer.setVersion("1.3.0"); layer.setName("oskari:my_places_categories"); layer.setOpacity(opacity); return layer; }
Source:
private Request make(final byte[] boundary, final ReadableByteChannel body) throws IOException { final File file = File.createTempFile( RqMultipart.class.getName(), ".tmp" ); final RandomAccessFile accessfile = new RandomAccessFile( file, "rw" ); final FileChannel channel = accessfile.getChannel(); try { channel.write( ByteBuffer.wrap( this.head().iterator().next().getBytes( StandardCharsets.UTF_8 ) ) ); channel.write(ByteBuffer.wrap(Base.CRLF.getBytes())); this.copy(channel, boundary, body); } finally { accessfile.close(); } return new RqWithHeader( new RqLive( new TempInputStream( new FileInputStream(file), file ) ), "Content-Length", String.valueOf(file.length()) ); }

Target:
private Request make(final byte[] boundary, final ReadableByteChannel body) throws IOException { final File file = File.createTempFile( RqMultipart.class.getName(), ".tmp" ); try (RandomAccessFile accessfile = new RandomAccessFile( file, "rw" )) { final FileChannel channel = accessfile.getChannel(); channel.write( ByteBuffer.wrap( this.head().iterator().next().getBytes( StandardCharsets.UTF_8 ) ) ); channel.write( ByteBuffer.wrap(Base.CRLF.getBytes(StandardCharsets.UTF_8)) ); this.copy(channel, boundary, body); } return new RqWithHeader( new RqLive( new TempInputStream( new FileInputStream(file), file ) ), "Content-Length", String.valueOf(file.length()) ); }
Source:
private void handleSingleExecution(HttpServletRequest req, HttpServletResponse resp, Map<String , String> templateVariableMap) throws IOException { String executionId = templateVariableMap.get(EXECUTION_ID_KEY); ExecutionDetailedResponse executionResponse; try { executionResponse = executorService.getSingleExecution(executionId); } catch (CloudFlowNotFoundException e) { sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, e.getMessage()); return; } sendResponse(resp, HttpServletResponse.SC_OK, executionResponse); }

Target:
private void handleSingleExecution(HttpServletRequest req, HttpServletResponse resp, Map<String , String> templateVariableMap) throws IOException { String executionId = templateVariableMap.get(EXECUTION_ID_KEY); ExecutionDetailedResponse executionResponse; try { executionResponse = executionService.getExecution(executionId); } catch (CloudFlowNotFoundException e) { sendErrorResponse(resp, HttpServletResponse.SC_NOT_FOUND, e.getMessage()); return; } sendResponse(resp, HttpServletResponse.SC_OK, executionResponse); }
Source:
public void testForName_withProviderWithRecursiveCall() throws Exception { FakeCharsetProvider.setDelegate(new MockCharsetProviderWithRecursiveCall()); try { Charset.forName("poop"); } catch (UnsupportedCharsetException expected) { } finally { FakeCharsetProvider.clearDelegate(); } }

Target:
public void testForName_withProviderWithRecursiveCall() throws Exception { FakeCharsetProvider.setDelegate(new MockCharsetProviderWithRecursiveCall()); try { Charset.forName("poop"); fail(); } catch (UnsupportedCharsetException expected) { } finally { FakeCharsetProvider.clearDelegate(); } }
Source:
private MockChartView createMockChartViewFromType(int type) { switch(type) { case ComponentConstants.CHART_TYPE_LINE: return new MockLineChartView(); case ComponentConstants.CHART_TYPE_SCATTER: return new MockScatterChartView(); case ComponentConstants.CHART_TYPE_AREA: return new MockAreaChartView(); case ComponentConstants.CHART_TYPE_BAR: return new MockBarChartView(); case ComponentConstants.CHART_TYPE_PIE: return new MockPieChartView(); default: throw new IllegalArgumentException("type:" + type); } }

Target:
private MockChartView createMockChartViewFromType(int type) { switch (type) { case ComponentConstants.CHART_TYPE_LINE: return new MockLineChartView(); case ComponentConstants.CHART_TYPE_SCATTER: return new MockScatterChartView(); case ComponentConstants.CHART_TYPE_AREA: return new MockAreaChartView(); case ComponentConstants.CHART_TYPE_BAR: return new MockBarChartView(); case ComponentConstants.CHART_TYPE_PIE: return new MockPieChartView(); default: throw new IllegalArgumentException("Invalid Chart type specified: " + type); } }
Source:
public void onInit(FMLInitializationEvent e) { if (ENABLE_INIT) { throw new CustomModLoadingErrorDisplayException("Custom Test Exception", new RuntimeException("Thrown in Initialization")) { @Override public void initGui(GuiErrorScreen parent, FontRenderer fontRenderer) { } @Override public void drawScreen(GuiErrorScreen parent, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) { parent.drawCenteredString(parent.mc.fontRenderer, "Custom Test Exception", parent.width / 2, 90, 16777215); parent.drawCenteredString(parent.mc.fontRenderer, LOREM_IPSUM, parent.width / 2, 110, 16777215); } }; } }

Target:
public void onInit(FMLInitializationEvent e) { if (ENABLE_INIT) { throwException("Thrown in Init"); } }
Source:
public static void main(String... args) { Logger.getRootLogger().setLevel(Level.OFF); ConnectionCache c = new ConnectionCache(); int exitCode = 0; if(!args[0].equals("interactive")) { exitCode = new CommandLine(new RootCommand()).setExecutionStrategy(new CommandLine.RunLast()).execute(args); } else { Scanner command = new Scanner(System.in); CommandLine cl = new CommandLine(new RootCommand()).setExecutionStrategy(new CommandLine.RunLast()); while (true) { System.out.print("spliceck> "); String s = command.nextLine(); if (s.equals("exit")) break; if (s.trim().length() == 0) continue; String[] args2 = s.split(" "); exitCode = cl.execute(args2); if( exitCode == 0 ) System.out.println(Utils.Colored.green( "return code " + exitCode + "\n") ); else System.out.println(Utils.Colored.red( "return code " + exitCode + "\n") ); } command.close(); } try { c.close(); } catch (Exception e) { e.printStackTrace(); } System.exit(exitCode); }

Target:
public static void main(String... args) { Logger.getRootLogger().setLevel(Level.OFF); ConnectionSingleton c = new ConnectionSingleton(); int exitCode = 0; if(!args[0].equals("interactive")) { exitCode = new CommandLine(new RootCommand()).setExecutionStrategy(new CommandLine.RunLast()).execute(args); } else { Scanner command = new Scanner(System.in); CommandLine cl = new CommandLine(new RootCommand()).setExecutionStrategy(new CommandLine.RunLast()); while (true) { System.out.print("spliceck> "); String s = command.nextLine().trim(); if (s.equals("exit") || s.equals("quit") || s.equals("q") ) break; if (s.length() == 0) continue; String[] args2 = s.split(" "); exitCode = cl.execute(args2); } command.close(); } try { c.close(); } catch (Exception e) { e.printStackTrace(); } System.exit(exitCode); }
Source:
public Pair<Expression, Set<OutputAnchor>> getLocalExpr() { Expression expr = new FunVar(this.funInfo); Set<OutputAnchor> outsideAnchors = new HashSet<>(); for (InputAnchor in : this.getActiveInputs()) { Pair<Expression, Set<OutputAnchor>> pair = in.getLocalExpr(); expr = new Apply(expr, pair.a); outsideAnchors.addAll(pair.b); } if (funInfo instanceof DefinitionFunction) { outsideAnchors.addAll(((DefinitionFunction)funInfo).getSource().getAllOutputs()); } return new Pair<>(expr, outsideAnchors); }

Target:
public Pair<Expression, Set<OutputAnchor>> getLocalExpr() { Expression expr = new FunVar(this.funInfo); Set<OutputAnchor> outsideAnchors = new HashSet<>(); for (InputAnchor in : this.getActiveInputs()) { Pair<Expression, Set<OutputAnchor>> pair = in.getLocalExpr(); expr = new Apply(expr, pair.a); outsideAnchors.addAll(pair.b); } outsideAnchors.addAll(funInfo.getRequiredBlocks().stream().flatMap(block -> block.getAllOutputs().stream()).collect(Collectors.toList())); return new Pair<>(expr, outsideAnchors); }
Source:
private void givenOneReposAndOneMergeRequest() { final StashRepo oneRepo = new StashRepo("repo1"); List<StashRepo> stashRepos = new ArrayList<>(); stashRepos.add(oneRepo); List<StashPullRequest> stashMergeRequests = new ArrayList<>(); stashMergeRequests.add(new StashPullRequest("1", stashRepos.get(0))); final StashPullRequest stashPullRequest = new StashPullRequest("2", stashRepos.get(0)); stashPullRequest.addReviewer(new StashUser("user", "user name")); stashMergeRequests.add(stashPullRequest); stashMergeRequests.add(new StashPullRequest("1", stashRepos.get(0))); doReturn(stashRepos).when(stashApiClient).readStashRepos(any(StashConfig.class)); doReturn(asList(new StashPullRequest("1", oneRepo))).when(stashApiClient).readStashPullRequests(GIVEN_STASH_CONFIG, oneRepo); }

Target:
private void givenOneReposAndOneMergeRequest() { List<StashRepo> stashRepos = createRepositories(1); mockStashapiClientReadStashRepos(stashRepos); mockStashApiClientReadStashPullRequest(stashRepos.get(0), asList(new StashPullRequest("1", stashRepos.get(0)))); }
Source:
private static boolean sendToSlackChannel(String authToken, String message, String channel) { boolean success = false; logger.info("sendToSlackChannel authToken='{}', message='{}', channel='{}'", authToken, message, channel); SlackSession session = null; try { session = SlackSessionFactory.createWebSocketSlackSession(authToken); session.connect(); SlackChannel slackChannel = session.findChannelByName(channel); if (slackChannel == null) { logger.error("Could not find Slack channel '{}'", channel); } else { session.sendMessage(slackChannel, message); success = true; } } catch (IOException e) { logger.error("Error sending message to Slack channel", e); } finally { try { if (session != null) { session.disconnect(); } } catch (IOException e) { logger.error("Error disonnecting Slack session", e); } } return success; }

Target:
private static boolean sendToSlackChannel(String authToken, String message, String channel) { boolean success = false; logger.debug("sendToSlackChannel authToken='{}', message='{}', channel='{}'", authToken, message, channel); SlackSession session = null; try { session = SlackSessionFactory.createWebSocketSlackSession(authToken); session.connect(); SlackChannel slackChannel = session.findChannelByName(channel); if (slackChannel == null) { logger.error("Could not find Slack channel '{}'", channel); } else { session.sendMessage(slackChannel, message); success = true; } } catch (IOException e) { logger.error("Error sending message to Slack channel", e); } finally { try { if (session != null) { session.disconnect(); } } catch (IOException e) { logger.error("Error disconnecting Slack session", e); } } return success; }
Source:
public void registerMBean(Metric metric, ObjectName name) { AbstractBean mbean; if (metric instanceof Gauge) mbean = new JmxGauge((Gauge<?>) metric, name); else if (metric instanceof Counter) mbean = new JmxCounter((Counter) metric, name); else if (metric instanceof Histogram) mbean = new JmxHistogram((Histogram) metric, name); else if (metric instanceof Timer) mbean = new JmxTimer((Timer) metric, name, TimeUnit.SECONDS, TimeUnit.MICROSECONDS); else if (metric instanceof Metered) mbean = new JmxMeter((Metered) metric, name, TimeUnit.SECONDS); else if (metric instanceof IntegerSetting) mbean = new JmxIntegerSetting((IntegerSetting) metric, name); else throw new IllegalArgumentException("Unknown metric type: " + metric.getClass()); if (!mBeanServer.isRegistered(name)) mBeanServer.registerMBean(mbean, name, MBeanWrapper.OnException.LOG); }

Target:
public void registerMBean(Metric metric, ObjectName name) { AbstractBean mbean; if (metric instanceof Gauge) mbean = new JmxGauge((Gauge<?>) metric, name); else if (metric instanceof Counter) mbean = new JmxCounter((Counter) metric, name); else if (metric instanceof Histogram) mbean = new JmxHistogram((Histogram) metric, name); else if (metric instanceof Timer) mbean = new JmxTimer((Timer) metric, name, TimeUnit.SECONDS, TimeUnit.MICROSECONDS); else if (metric instanceof Metered) mbean = new JmxMeter((Metered) metric, name, TimeUnit.SECONDS); else throw new IllegalArgumentException("Unknown metric type: " + metric.getClass()); if (!mBeanServer.isRegistered(name)) mBeanServer.registerMBean(mbean, name, MBeanWrapper.OnException.LOG); }
Source:
private void updateUploadingMediaList() { AztecText.AttributePredicate uploadingPredicate = getPredicateWithClass("uploading"); mUploadingMediaProgressMax.clear(); for (Attributes attrs : content.getAllElementAttributes(uploadingPredicate)) { String localMediaId = attrs.getValue("data-wpid"); if (!TextUtils.isEmpty(localMediaId)) { mUploadingMediaProgressMax.put(localMediaId, new Float(0)); } } }

Target:
private void updateUploadingMediaList() { AztecText.AttributePredicate uploadingPredicate = getPredicateWithClass("uploading"); mUploadingMediaProgressMax.clear(); for (Attributes attrs : content.getAllElementAttributes(uploadingPredicate)) { String localMediaId = attrs.getValue("data-wpid"); if (!TextUtils.isEmpty(localMediaId)) { mUploadingMediaProgressMax.put(localMediaId, 0f); } } }
Source:
public static String constructAddErrorRecordString(ComplexEventChunk<StreamEvent> eventChunk, boolean isObjectColumnPresent, TableDefinition tableDefinition, Exception e) { JsonObject payloadJson = new JsonObject(); if (isObjectColumnPresent || e instanceof ConnectionUnavailableException) { payloadJson.addProperty("isEditable", false); } else { payloadJson.addProperty("isEditable", true); } JsonArray attributes = new JsonArray(); JsonArray records = new JsonArray(); for (Attribute attribute : tableDefinition.getAttributeList()) { JsonObject attributeJson = new JsonObject(); attributeJson.add("name", new JsonPrimitive(attribute.getName())); attributeJson.add("type", new JsonPrimitive(String.valueOf(attribute.getType()))); attributes.add(attributeJson); } payloadJson.add("attributes", attributes); while (eventChunk.hasNext()) { StreamEvent streamEvent = eventChunk.next(); JsonArray record = new JsonArray(); for (Object item : streamEvent.getOutputData()) { if (item == null) { record.add(JsonNull.INSTANCE); } record.add(String.valueOf(item)); } records.add(record); } payloadJson.add("records", records); return payloadJson.toString(); }

Target:
public static String constructAddErrorRecordString(ComplexEventChunk<StreamEvent> eventChunk, boolean isObjectColumnPresent, TableDefinition tableDefinition, Exception e) { JsonObject payloadJson = new JsonObject(); payloadJson.addProperty("isEditable", !(isObjectColumnPresent || e instanceof ConnectionUnavailableException)); JsonArray attributes = new JsonArray(); JsonArray records = new JsonArray(); for (Attribute attribute : tableDefinition.getAttributeList()) { JsonObject attributeJson = new JsonObject(); attributeJson.add("name", new JsonPrimitive(attribute.getName())); attributeJson.add("type", new JsonPrimitive(String.valueOf(attribute.getType()))); attributes.add(attributeJson); } payloadJson.add("attributes", attributes); while (eventChunk.hasNext()) { StreamEvent streamEvent = eventChunk.next(); JsonArray record = new JsonArray(); for (Object item : streamEvent.getOutputData()) { if (item == null) { record.add(JsonNull.INSTANCE); } else { record.add(String.valueOf(item)); } } records.add(record); } payloadJson.add("records", records); return payloadJson.toString(); }
Source:
public LuceneQuery build() { String jpqlString = accept(new JPAQueryGenerator()); log.tracef("JPQL string : %s", jpqlString); Sort sort = null; if (sortCriteria != null && !sortCriteria.isEmpty()) { SortField[] sortField = new SortField[sortCriteria.size()]; int i = 0; for (SortCriteria sc : sortCriteria) { sortField[i++] = new SortField(sc.getAttributePath(), SortField.STRING, sc.getSortOrder() == SortOrder.DESC); } sort = new Sort(sortField); } LuceneProcessingChain processingChain = new LuceneProcessingChain((SearchFactoryIntegrator) searchManager.getSearchFactory(), entityNamesResolver, null); QueryParser queryParser = new QueryParser(); LuceneQueryParsingResult parsingResult = queryParser.parseQuery(jpqlString, processingChain); return new EmbeddedLuceneQuery(searchManager, parsingResult, sort, startOffset, maxResults); }

Target:
public LuceneQuery build() { String jpqlString = accept(new JPAQueryGenerator()); if (log.isTraceEnabled()) { log.tracef("JPQL string : %s", jpqlString); } Sort sort = null; if (sortCriteria != null && !sortCriteria.isEmpty()) { SortField[] sortField = new SortField[sortCriteria.size()]; int i = 0; for (SortCriteria sc : sortCriteria) { sortField[i++] = new SortField(sc.getAttributePath(), SortField.STRING, sc.getSortOrder() == SortOrder.DESC); } sort = new Sort(sortField); } LuceneProcessingChain processingChain = new LuceneProcessingChain((SearchFactoryIntegrator) searchManager.getSearchFactory(), entityNamesResolver, null); QueryParser queryParser = new QueryParser(); LuceneQueryParsingResult parsingResult = queryParser.parseQuery(jpqlString, processingChain); return new EmbeddedLuceneQuery(searchManager, parsingResult, sort, startOffset, maxResults); }
Source:
public boolean create(Personname personnameRecord) { LOG.trace("PersonnameDAO.create() - Begin"); boolean result = true; if (personnameRecord != null) { result = super.create(personnameRecord); } LOG.trace("PersonnameDAO.create() - End"); return result; }

Target:
public boolean create(Personname personnameRecord) { LOG.trace("PersonnameDAO.create() - Begin"); return personnameRecord != null ? super.create(personnameRecord) : true; }
Source:
protected void applyResults(Runnable runnable) { synchronized (fLastZoomThreadId) { if (fInstanceId == fLastZoomThreadId) { runnable.run(); } } }

Target:
protected void applyResults(Runnable runnable) { synchronized (fZoomThreadResultLock) { if (this == fZoomThread) { runnable.run(); } } }
Source:
public VisualEditorSaveChangesDialog clickSaveWithRecaptcha() { waitForElementClickableByElement(publishButton); if (checkIfElementOnPage(recaptchaArea)) { recaptchaContainer = saveDialogBody.findElement(recaptchaImageBy); waitForElementVisibleByElement(recaptchaContainer); } publishButton.click(); PageObjectLogging.log("clickSaveWithRecaptcha", "The 2nd Publish Button is clicked", true); return new VisualEditorSaveChangesDialog(driver); }

Target:
public VisualEditorSaveChangesDialog clickSaveWithRecaptcha() { waitForElementClickableByElement(publishButton); if (checkIfElementOnPage(recaptchaArea)) { recaptchaContainer = saveDialogBody.findElement(recaptchaImageBy); waitForElementVisibleByElement(recaptchaContainer); } publishButton.click(); return new VisualEditorSaveChangesDialog(driver); }
Source:
public void start() throws Exception { if (connectivity.isDeviceOnline(mSettings.canDownloadWith3G())) { List<Language> languagesFromServer = client.getLanguages(); List<Language> languagesToDownload = getLanguagesToDownload(languagesFromServer); updateLocalTranslations(languagesToDownload, client); } }

Target:
public void start() throws Exception { if (connectivity.isDeviceOnline()) { List<Language> languagesFromServer = client.getLanguages(); List<Language> languagesToDownload = getLanguagesToDownload(languagesFromServer); updateLocalTranslations(languagesToDownload, client); } }
Source:
public void VisualEditorEditing_004_insertLinks() { String articleName2 = PageContent.articleNamePrefix + base.getTimeStamp(); ArticlePageObject article = base.openArticleByName(wikiURL, articleName2); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); VisualEditorHyperLinkDialog veLinkDialog = ve.clickLinkButton(); ve = veLinkDialog.typeInLinkInput(PageContent.internalLink); veLinkDialog.verifyMatchingPageIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); veLinkDialog = ve.clickLinkButton(); ve = veLinkDialog.typeInLinkInput(PageContent.redLink); veLinkDialog.verifyNewPageIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); veLinkDialog = ve.clickLinkButton(); ve = veLinkDialog.typeInLinkInput(PageContent.externalLink); veLinkDialog.verifyExternalLinkIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); VisualEditorReviewChangesDialog reviewDialog = saveDialog.clickReviewYourChanges(); reviewDialog.verifyAddedDiffs(linkWikiTexts); }

Target:
public void VisualEditorEditing_004_insertLinks() { String articleName2 = PageContent.articleNamePrefix + base.getTimeStamp(); ArticlePageObject article = base.openArticleByName(wikiURL, articleName2); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); VisualEditorHyperLinkDialog veLinkDialog = ve.clickLinkButton(); veLinkDialog.typeInLinkInput(PageContent.internalLink); veLinkDialog.verifyMatchingPageIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); veLinkDialog = ve.clickLinkButton(); veLinkDialog.typeInLinkInput(PageContent.redLink); veLinkDialog.verifyNewPageIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); veLinkDialog = ve.clickLinkButton(); veLinkDialog.typeInLinkInput(PageContent.externalLink); veLinkDialog.verifyExternalLinkIsTop(); ve = veLinkDialog.clickLinkResult(); ve.typeReturn(); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); VisualEditorReviewChangesDialog reviewDialog = saveDialog.clickReviewYourChanges(); reviewDialog.verifyAddedDiffs(linkWikiTexts); }
Source:
private static void writeAddress(@NonNull Parcel dest, @NonNull InetAddress addr) { if (addr instanceof Inet6Address) { final Inet6Address v6Addr = (Inet6Address) addr; dest.writeByte(ADDR_TYPE_V6); dest.writeByteArray(v6Addr.getAddress()); dest.writeInt(v6Addr.getScopeId()); return; } dest.writeByte(ADDR_TYPE_OTHER); dest.writeByteArray(addr.getAddress()); }

Target:
private static void writeAddress(@NonNull Parcel dest, @NonNull InetAddress addr) { dest.writeByteArray(addr.getAddress()); if (addr instanceof Inet6Address) { final Inet6Address v6Addr = (Inet6Address) addr; final boolean hasScopeId = v6Addr.getScopeId() != 0; dest.writeBoolean(hasScopeId); if (hasScopeId) dest.writeInt(v6Addr.getScopeId()); } }
Source:
public void onSpecialSymbol(char symbol) { this.wikimodelListener.onSpecialSymbol(symbol); }

Target:
public void onSpecialSymbol(char symbol) { this.wikimodelListener.onSpecialSymbol(String.valueOf(symbol)); }
Source:
public void close() { log.debug("Closing"); if ( state.compareAndSet(CuratorFrameworkState.STARTED, CuratorFrameworkState.STOPPED) ) { listeners.forEach(new Function<CuratorListener, Void>() { @Override public Void apply(CuratorListener listener) { CuratorEvent event = new CuratorEventImpl(CuratorFrameworkImpl.this, CuratorEventType.CLOSING, 0, null, null, null, null, null, null, null, null); try { listener.eventReceived(CuratorFrameworkImpl.this, event); } catch ( Exception e ) { log.error("Exception while sending Closing event", e); } return null; } }); listeners.clear(); unhandledErrorListeners.clear(); connectionStateManager.close(); if (backgroundThread != null) { backgroundThread.interrupt(); try { backgroundThread.join(1000); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } client.close(); namespaceWatcherMap.close(); } }

Target:
public void close() { log.debug("Closing"); if ( state.compareAndSet(CuratorFrameworkState.STARTED, CuratorFrameworkState.STOPPED) ) { listeners.forEach(new Function<CuratorListener, Void>() { @Override public Void apply(CuratorListener listener) { CuratorEvent event = new CuratorEventImpl(CuratorFrameworkImpl.this, CuratorEventType.CLOSING, 0, null, null, null, null, null, null, null, null); try { listener.eventReceived(CuratorFrameworkImpl.this, event); } catch ( Exception e ) { log.error("Exception while sending Closing event", e); } return null; } }); if ( executorService != null ) { executorService.shutdownNow(); try { executorService.awaitTermination(maxCloseWaitMs, TimeUnit.MILLISECONDS); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } } listeners.clear(); unhandledErrorListeners.clear(); connectionStateManager.close(); client.close(); namespaceWatcherMap.close(); } }
Source:
public static <T> BufferedIterator<T> buffered(Iterator<T> self) { return new IteratorBufferedIterator<T>(self); }

Target:
public static <T> BufferedIterator<T> buffered(Iterator<T> self) { if (self instanceof BufferedIterator) { return (BufferedIterator<T>) self; } else { return new IteratorBufferedIterator<T>(self); } }