auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void startSeekForRange( IndexProgressor.NodeValueClient client, GeometryRangePredicate rangePredicate, IndexQuery[] query ) { try { BridgingIndexProgressor multiProgressor = new BridgingIndexProgressor( client, descriptor.schema().getPropertyIds() ); client.initialize( descriptor, multiProgressor, query ); SpaceFillingCurve curve = spatial.getSpaceFillingCurve(); Envelope completeEnvelope = SpatialKnownIndex.envelopeFromCRS( spatial.crs ); double[] from = rangePredicate.from() == null ? completeEnvelope.getMin() : rangePredicate.from().coordinate(); double[] to = rangePredicate.to() == null ? completeEnvelope.getMax() : rangePredicate.to().coordinate(); Envelope envelope = new Envelope( from, to ); List<SpaceFillingCurve.LongRange> ranges = curve.getTilesIntersectingEnvelope( envelope ); for ( SpaceFillingCurve.LongRange range : ranges ) { KEY treeKeyFrom = layout.newKey(); KEY treeKeyTo = layout.newKey(); treeKeyFrom.fromDerivedValue( Long.MIN_VALUE, range.min ); treeKeyTo.fromDerivedValue( Long.MAX_VALUE, range.max + 1 ); RawCursor<Hit<KEY,VALUE>,IOException> seeker = makeIndexSeeker( treeKeyFrom, treeKeyTo ); IndexProgressor hitProgressor = new NativeHitIndexProgressor<>( seeker, client, openSeekers ); multiProgressor.initialize( descriptor, hitProgressor, query ); } } catch ( IllegalArgumentException e ) { client.initialize( descriptor, IndexProgressor.EMPTY, query ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }

Target:
private void startSeekForRange( IndexProgressor.NodeValueClient client, GeometryRangePredicate rangePredicate, IndexQuery[] query ) { try { BridgingIndexProgressor multiProgressor = new BridgingIndexProgressor( client, descriptor.schema().getPropertyIds() ); client.initialize( descriptor, multiProgressor, query ); SpaceFillingCurve curve = spatial.getSpaceFillingCurve(); Envelope completeEnvelope = SpatialKnownIndex.envelopeFromCRS( spatial.crs ); double[] from = rangePredicate.from() == null ? completeEnvelope.getMin() : rangePredicate.from().coordinate(); double[] to = rangePredicate.to() == null ? completeEnvelope.getMax() : rangePredicate.to().coordinate(); Envelope envelope = new Envelope( from, to ); List<SpaceFillingCurve.LongRange> ranges = curve.getTilesIntersectingEnvelope( envelope ); for ( SpaceFillingCurve.LongRange range : ranges ) { KEY treeKeyFrom = layout.newKey(); KEY treeKeyTo = layout.newKey(); treeKeyFrom.fromDerivedValue( Long.MIN_VALUE, range.min ); treeKeyTo.fromDerivedValue( Long.MAX_VALUE, range.max + 1 ); RawCursor<Hit<KEY,VALUE>,IOException> seeker = makeIndexSeeker( treeKeyFrom, treeKeyTo ); IndexProgressor hitProgressor = new SpatialHitIndexProgressor<>( seeker, client, openSeekers ); multiProgressor.initialize( descriptor, hitProgressor, query ); } } catch ( IllegalArgumentException e ) { client.initialize( descriptor, IndexProgressor.EMPTY, query ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }
Source:
private void listenForMessages() { while (isEnabled.get()) { ReceiveMessageResult receiveMessageResult = amazonSQS.receiveMessage( new ReceiveMessageRequest(this.queueUrl) .withMaxNumberOfMessages(subscription.getMaxNumberOfMessages()) .withVisibilityTimeout(subscription.getVisibilityTimeout()) .withWaitTimeSeconds(subscription.getWaitTimeSeconds()) .withMessageAttributeNames("All")); if (receiveMessageResult.getMessages().isEmpty()) { log.debug("Received no messages for queue {}", queueARN); continue; } receiveMessageResult.getMessages().forEach(this::handleMessage); } }

Target:
private void listenForMessages() { while (isEnabled.get()) { ReceiveMessageResult receiveMessageResult = amazonSQS.receiveMessage( new ReceiveMessageRequest(this.subscriptionInfo.queueUrl) .withMaxNumberOfMessages(subscription.getMaxNumberOfMessages()) .withVisibilityTimeout(subscription.getVisibilityTimeout()) .withWaitTimeSeconds(subscription.getWaitTimeSeconds()) .withMessageAttributeNames("All")); if (receiveMessageResult.getMessages().isEmpty()) { log.debug("Received no messages for queue {}", queueARN); continue; } receiveMessageResult.getMessages().forEach(this::handleMessage); } }
Source:
public static int getClientReachableLocalInetAddressCount() { try { Set<InetAddress> validInetAddresses = new HashSet<>(); Enumeration<NetworkInterface> allNetworkInterfaces = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface networkInterface : Collections.list(allNetworkInterfaces)) { for (InetAddress inetAddress : Collections.list(networkInterface.getInetAddresses())) { if (inetAddress.isLinkLocalAddress()) { continue; } if (inetAddress.isMulticastAddress()) { continue; } if (inetAddress.isLoopbackAddress()) { continue; } validInetAddresses.add(inetAddress); } } if (LOG.isDebugEnabled()) { LOG.debug("Detected local network addresses", validInetAddresses.size()); LOG.debug("Resolved local addresses are: {}", Arrays.toString(validInetAddresses.toArray())); } return validInetAddresses.size() > 0 ? validInetAddresses.size() : DEFAULT_INET_ADDRESS_COUNT; } catch (SocketException ex) { LOG.warn("Failed to list all network interfaces, assuming 1", ex); return DEFAULT_INET_ADDRESS_COUNT; } }

Target:
public static int getClientReachableLocalInetAddressCount() { try { Set<InetAddress> validInetAddresses = new HashSet<>(); Enumeration<NetworkInterface> allNetworkInterfaces = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface networkInterface : Collections.list(allNetworkInterfaces)) { for (InetAddress inetAddress : Collections.list(networkInterface.getInetAddresses())) { if (inetAddress.isLinkLocalAddress()) { if (LOG.isDebugEnabled()) { LOG.debug("Ignoring link-local InetAddress {}", inetAddress); } continue; } if (inetAddress.isMulticastAddress()) { if (LOG.isDebugEnabled()) { LOG.debug("Ignoring multicast InetAddress {}", inetAddress); } continue; } if (inetAddress.isLoopbackAddress()) { if (LOG.isDebugEnabled()) { LOG.debug("Ignoring loopback InetAddress {}", inetAddress); } continue; } validInetAddresses.add(inetAddress); } } if (LOG.isDebugEnabled()) { LOG.debug("Detected local network addresses", validInetAddresses.size()); LOG.debug("Resolved local addresses are: {}", Arrays.toString(validInetAddresses.toArray())); } return validInetAddresses.size() > 0 ? validInetAddresses.size() : DEFAULT_INET_ADDRESS_COUNT; } catch (SocketException ex) { LOG.warn("Failed to list all network interfaces, assuming 1", ex); return DEFAULT_INET_ADDRESS_COUNT; } }
Source:
private void doButtonPressed(int index) { switch (index) { case IDX_ADD:{ List<String> existing= fFilterListField.getElements(); TypeFilterInputDialog dialog= new TypeFilterInputDialog(getShell(), existing); if (dialog.open() == Window.OK) { String res= (String) dialog.getResult(); fFilterListField.addElement(res); fFilterListField.setChecked(res, true); } } break; case IDX_ADD_PACKAGE: String[] res= choosePackage(); if (res != null) { fFilterListField.addElements(Arrays.asList(res)); for (String re : res) { fFilterListField.setChecked(re, true); } } break; case IDX_EDIT:{ List<String> selected= fFilterListField.getSelectedElements(); if (selected.isEmpty()) { return; } String editedEntry= selected.get(0); List<String> existing= fFilterListField.getElements(); existing.remove(editedEntry); TypeFilterInputDialog dialog= new TypeFilterInputDialog(getShell(), existing); dialog.setInitialString(editedEntry); if (dialog.open() == Window.OK) { fFilterListField.replaceElement(editedEntry, (String) dialog.getResult()); } } break; default: break; } }

Target:
private void doButtonPressed(int index) { switch (index) { case IDX_ADD: TypeFilterInputDialog dialog= new TypeFilterInputDialog(getShell(), fFilterListField.getElements()); if (dialog.open() == Window.OK) { String res= (String) dialog.getResult(); fFilterListField.addElement(res); fFilterListField.setChecked(res, true); } break; case IDX_ADD_PACKAGE: String[] res= choosePackage(); if (res != null) { fFilterListField.addElements(Arrays.asList(res)); for (String re : res) { fFilterListField.setChecked(re, true); } } break; case IDX_EDIT: List<String> selected= fFilterListField.getSelectedElements(); if (selected.isEmpty()) { return; } String editedEntry= selected.get(0); List<String> existing= fFilterListField.getElements(); existing.remove(editedEntry); dialog= new TypeFilterInputDialog(getShell(), existing); dialog.setInitialString(editedEntry); if (dialog.open() == Window.OK) { fFilterListField.replaceElement(editedEntry, (String) dialog.getResult()); } break; default: break; } }
Source:
public void testExpressionProfiler() { CallExpression add10Expression = call( internalOperator(ADD, BIGINT.getTypeSignature(), ImmutableList.of(BIGINT.getTypeSignature(), BIGINT.getTypeSignature())), BIGINT, field(0, BIGINT), constant(10L, BIGINT)); PageFunctionCompiler functionCompiler = new PageFunctionCompiler(createTestMetadataManager(), 0); Supplier<PageProjection> projectionSupplier = functionCompiler.compileProjection(add10Expression, Optional.empty()); PageProjection projection = projectionSupplier.get(); Page page = new Page(createLongSequenceBlock(1, 10)); ExpressionProfiler profiler = new ExpressionProfiler(10, 10_000); for (int i = 0; i < 100; i++) { profiler.start(); Work<Block> work = projection.project(SESSION, new DriverYieldSignal(), page, SelectedPositions.positionsRange(0, page.getPositionCount())); profiler.stop(page.getPositionCount()); work.process(); } assertFalse(profiler.isExpressionExpensive()); profiler = new ExpressionProfiler(10, 0); for (int i = 0; i < 100; i++) { profiler.start(); Work<Block> work = projection.project(SESSION, new DriverYieldSignal(), page, SelectedPositions.positionsRange(0, page.getPositionCount())); profiler.stop(page.getPositionCount()); work.process(); } assertTrue(profiler.isExpressionExpensive()); }

Target:
public void testExpressionProfiler() { CallExpression add10Expression = call( internalOperator(ADD, BIGINT.getTypeSignature(), ImmutableList.of(BIGINT.getTypeSignature(), BIGINT.getTypeSignature())), BIGINT, field(0, BIGINT), constant(10L, BIGINT)); TestingTicker testingTicker = new TestingTicker(); PageFunctionCompiler functionCompiler = new PageFunctionCompiler(createTestMetadataManager(), 0); Supplier<PageProjection> projectionSupplier = functionCompiler.compileProjection(add10Expression, Optional.empty()); PageProjection projection = projectionSupplier.get(); Page page = new Page(createLongSequenceBlock(1, 11)); ExpressionProfiler profiler = new ExpressionProfiler(testingTicker, SPLIT_RUN_QUANTA); for (int i = 0; i < 100; i++) { profiler.start(); Work<Block> work = projection.project(SESSION, new DriverYieldSignal(), page, SelectedPositions.positionsRange(0, page.getPositionCount())); if (i < 10) { testingTicker.increment(10, SECONDS); profiler.stop(page.getPositionCount()); assertTrue(profiler.isExpressionExpensive()); } else { testingTicker.increment(0, NANOSECONDS); profiler.stop(page.getPositionCount()); assertFalse(profiler.isExpressionExpensive()); } work.process(); } }
Source:
public void createDirectory_returnsFalseWhenCannotCreate() throws IOException, StandardException { String testDir = "/noPermissionToCreateFolderInRoot"; ExportParams exportParams = ExportParams.withDirectory(testDir); ExportFile exportFile = new ExportFile(exportParams, testTaskId(),dfs); try { assertFalse(exportFile.createDirectory()); } catch (Exception e) { Assert.assertTrue(e.getMessage(), e.getMessage().contains("IOException '/noPermissionToCreateFolderInRoot' when accessing directory") || e.getMessage().contains("IOException '/noPermissionToCreateFolderInRoot: Read-only file system' when accessing directory")); } assertFalse(new File(testDir).exists()); assertFalse(new File(testDir).isDirectory()); }

Target:
public void createDirectory_returnsFalseWhenCannotCreate() throws IOException, StandardException { String testDir = "/noPermissionToCreateFolderInRoot"; ExportParams exportParams = ExportParams.withDirectory(testDir); ExportFile exportFile = new ExportFile(exportParams, testTaskId(),dfs); try { assertFalse(exportFile.createDirectory()); } catch (Exception e) { assertThat(e.getMessage(), stringContainsInOrder("IOException '/noPermissionToCreateFolderInRoot","' when accessing directory")); } assertFalse(new File(testDir).exists()); assertFalse(new File(testDir).isDirectory()); }
Source:
public void whenReadingEventsTheOrderIsCorrect() throws NakadiException, IOException, InterruptedException { final EventStreamConfig config = EventStreamConfig .builder() .withCursors(ImmutableList.of(new NakadiCursor(TIMELINE, "0", "0"))) .withBatchLimit(1) .withStreamLimit(4) .build(); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final int eventNum = 4; final LinkedList<ConsumedEvent> events = new LinkedList<>(IntStream .range(0, eventNum) .boxed() .map(index -> new ConsumedEvent( ("event" + index).getBytes(), new NakadiCursor(TIMELINE, "0", KafkaCursor.toNakadiOffset(index)))) .collect(Collectors.toList())); final EventStream eventStream = new EventStream(predefinedConsumer(events), out, config, mock(BlacklistService.class), cursorConverter, BYTES_FLUSHED_METER); eventStream.streamEvents(new AtomicBoolean(true)); final String[] batches = out.toString().split(BATCH_SEPARATOR); assertThat(batches, arrayWithSize(eventNum)); IntStream .range(0, eventNum) .boxed() .forEach(index -> assertThat( batches[index], sameJSONAs(jsonBatch( "0", KafkaCursor.toNakadiOffset(index), Optional.of(nCopies(1, ("event" + index).getBytes())))) )); }

Target:
public void whenReadingEventsTheOrderIsCorrect() throws NakadiException, IOException, InterruptedException { final EventStreamConfig config = EventStreamConfig .builder() .withCursors(ImmutableList.of(new NakadiCursor(TIMELINE, "0", "0"))) .withBatchLimit(1) .withStreamLimit(4) .build(); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final int eventNum = 4; final LinkedList<ConsumedEvent> events = new LinkedList<>(IntStream .range(0, eventNum) .boxed() .map(index -> new ConsumedEvent( ("event" + index).getBytes(UTF_8), new NakadiCursor(TIMELINE, "0", KafkaCursor.toNakadiOffset(index)))) .collect(Collectors.toList())); final EventStream eventStream = new EventStream(predefinedConsumer(events), out, config, mock(BlacklistService.class), cursorConverter, BYTES_FLUSHED_METER); eventStream.streamEvents(new AtomicBoolean(true)); final String[] batches = out.toString().split(BATCH_SEPARATOR); assertThat(batches, arrayWithSize(eventNum)); IntStream .range(0, eventNum) .boxed() .forEach(index -> assertThat( batches[index], sameJSONAs(jsonBatch( "0", KafkaCursor.toNakadiOffset(index), Optional.of(nCopies(1, ("event" + index).getBytes(UTF_8))))) )); }
Source:
public void configure(MavenAndroidProject mavenProject, IDEAndroidProject eclipseProject, IClasspathDescriptor classpath) { try { IJavaProject javaproject = JavaCore.create(eclipseProject.getProject()); IClasspathEntry[] tosort = javaproject.readRawClasspath(); IClasspathEntry[] sorted = sortClasspath(mavenProject, tosort); javaproject.setRawClasspath(sorted, new NullProgressMonitor()); javaproject.save(new NullProgressMonitor(), false); } catch (JavaModelException e) { throw new ProjectConfigurationException("error re-ordering classpath", e); } }

Target:
public void configure(MavenAndroidProject mavenProject, IDEAndroidProject eclipseProject, IClasspathDescriptor classpath) { try { IJavaProject javaproject = JavaCore.create(eclipseProject.getProject()); IClasspathEntry[] tosort = javaproject.readRawClasspath(); sort(tosort, bySourceFolderOrdering(mavenProject)); javaproject.setRawClasspath(tosort, new NullProgressMonitor()); javaproject.save(new NullProgressMonitor(), false); } catch (JavaModelException e) { throw new ProjectConfigurationException("error re-ordering classpath", e); } }
Source:
private static boolean isVideoTag(TagNode node) { return "VIDEO".equalsIgnoreCase(node.getNodeName()); }

Target:
private static boolean isVideoTag(TagNode node) { return node.equalsElementName("VIDEO"); }
Source:
public static SsoMethod map(Sso model, SsoMethod template) { if (model != null && model.getMethods() != null && model.getMethods().getMethod() != null && model.getMethods().getMethod().size() == 1) { if (model.getMethods().getMethod().get(0) == org.ovirt.engine.api.model.SsoMethod.GUEST_AGENT) { return SsoMethod.GUEST_AGENT; } } return SsoMethod.NONE; }

Target:
public static SsoMethod map(Sso model, SsoMethod template) { if (model != null && model.getMethods() != null && model.getMethods().getMethods() != null && model.getMethods().getMethods().size() == 0) { return SsoMethod.NONE; } return SsoMethod.GUEST_AGENT; }
Source:
private View.OnClickListener onClickActionSolver(final OnClickAction action) { return new View.OnClickListener() { @Override public void onClick(View v) { switch (action) { case SET_URL: ((LoginActivity) getActivity()).setUrl(CustomFragmentDialog.this.mEditText.getText().toString().trim()); dismiss(); break; case DISMISS_URL_DIALOG: ((LoginActivity) getActivity()).hideURLDialog(); dismiss(); break; case LOGIN: ((LoginActivity) getActivity()).login(); dismiss(); break; case DISMISS: dismiss(); break; case LOGOUT: ((ACBaseActivity) getActivity()).logout(); dismiss(); break; case FINISH: getActivity().moveTaskToBack(true); android.os.Process.killProcess(android.os.Process.myPid()); System.exit(1); break; case INTERNET: getActivity().startActivity(new Intent(Settings.ACTION_SETTINGS)); dismiss(); break; case UNAUTHORIZED: ((ACBaseActivity) getActivity()).moveUnauthorizedUserToLoginScreen(); dismiss(); break; case END_VISIT: ((VisitDashboardActivity) getActivity()).endVisit(); dismiss(); break; case START_VISIT: doStartVisitAction(); dismiss(); break; case REGISTER_PATIENT: ((RegisterPatientActivity) getActivity()).mPresenter.confirm(); dismiss(); break; case CANCEL_REGISTERING: ((RegisterPatientActivity) getActivity()).mPresenter.finishRegisterActivity(); dismiss(); break; default: break; } } }; }

Target:
private View.OnClickListener onClickActionSolver(final OnClickAction action) { return new View.OnClickListener() { @Override public void onClick(View v) { switch (action) { case SET_URL: ((LoginActivity) getActivity()).setUrl(CustomFragmentDialog.this.mEditText.getText().toString().trim()); dismiss(); break; case DISMISS_URL_DIALOG: ((LoginActivity) getActivity()).hideURLDialog(); dismiss(); break; case LOGIN: ((LoginActivity) getActivity()).login(); dismiss(); break; case DISMISS: dismiss(); break; case LOGOUT: ((ACBaseActivity) getActivity()).logout(); dismiss(); break; case FINISH: getActivity().moveTaskToBack(true); android.os.Process.killProcess(android.os.Process.myPid()); System.exit(1); break; case INTERNET: getActivity().startActivity(new Intent(Settings.ACTION_SETTINGS)); dismiss(); break; case UNAUTHORIZED: ((ACBaseActivity) getActivity()).moveUnauthorizedUserToLoginScreen(); dismiss(); break; case END_VISIT: ((VisitDashboardActivity) getActivity()).endVisit(); dismiss(); break; case START_VISIT: doStartVisitAction(); dismiss(); break; case REGISTER_PATIENT: ((RegisterPatientActivity) getActivity()).mPresenter.registerPatient(); dismiss(); break; case CANCEL_REGISTERING: ((RegisterPatientActivity) getActivity()).mPresenter.finishRegisterActivity(); dismiss(); break; default: break; } } }; }
Source:
protected SSLContext getSslContext(ElasticSearchClientConfig config) { if (StringUtils.isBlank(config.getOption(KEYSTORE_PATH_OPT))) { return null; } try { Path keyStorePath = Paths.get(config.getOption(KEYSTORE_PATH_OPT)); String keyStorePass = config.getOption(KEYSTORE_PASSWORD_OPT); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); try (InputStream is = Files.newInputStream(keyStorePath)) { keyStore.load(is, keyStorePass.toCharArray()); } SSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(keyStore, null); return sslBuilder.build(); } catch (KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException | KeyManagementException e) { throw new NuxeoException("Cannot setup SSL for RestClient: " + config, e); } }

Target:
protected SSLContext getSslContext(ElasticSearchClientConfig config) { if (StringUtils.isBlank(config.getOption(KEYSTORE_PATH_OPT))) { return null; } try { Path keyStorePath = Paths.get(config.getOption(KEYSTORE_PATH_OPT)); String keyStorePass = config.getOption(KEYSTORE_PASSWORD_OPT); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); try (InputStream is = Files.newInputStream(keyStorePath)) { keyStore.load(is, keyStorePass.toCharArray()); } SSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(keyStore, null); return sslBuilder.build(); } catch (GeneralSecurityException | IOException e) { throw new NuxeoException("Cannot setup SSL for RestClient: " + config, e); } }
Source:
public void processEvent(final Map<String, String> dispatchMap) { final Object countObject = dispatchMap.get(EventStrings.HTTP_EVENT_COUNT); if (countObject == null) { dispatchMap.put(EventStrings.HTTP_EVENT_COUNT, "1"); } else { dispatchMap.put(EventStrings.HTTP_EVENT_COUNT, Integer.toString(Integer.parseInt((String) countObject) + 1)); } final List eventList = getEventList(); final int size = eventList.size(); for (int i = 0; i < size; i++) { final Pair eventPair = (Pair<String, String>) eventList.get(i); final String name = (String) eventPair.first; if (name.equals(EventStrings.HTTP_RESPONSE_CODE) || name.equals(EventStrings.REQUEST_ID_HEADER) || name.equals(EventStrings.OAUTH_ERROR_CODE) || name.equals(EventStrings.HTTP_PATH)) { dispatchMap.put(name, (String) eventPair.second); } } }

Target:
public void processEvent(final Map<String, String> dispatchMap) { final Object countObject = dispatchMap.get(EventStrings.HTTP_EVENT_COUNT); if (countObject == null) { dispatchMap.put(EventStrings.HTTP_EVENT_COUNT, "1"); } else { dispatchMap.put(EventStrings.HTTP_EVENT_COUNT, Integer.toString(Integer.parseInt((String) countObject) + 1)); } if (dispatchMap.containsKey(EventStrings.HTTP_RESPONSE_CODE)) { dispatchMap.put(EventStrings.HTTP_RESPONSE_CODE, ""); } if (dispatchMap.containsKey(EventStrings.OAUTH_ERROR_CODE)) { dispatchMap.put(EventStrings.OAUTH_ERROR_CODE, ""); } if (dispatchMap.containsKey(EventStrings.HTTP_PATH)) { dispatchMap.put(EventStrings.HTTP_PATH, ""); } if (dispatchMap.containsKey(EventStrings.REQUEST_ID_HEADER)) { dispatchMap.put(EventStrings.REQUEST_ID_HEADER, ""); } final List<Pair<String, String>> eventList = getEventList(); for (Pair<String, String> eventPair : eventList) { final String name = eventPair.first; if (name.equals(EventStrings.HTTP_RESPONSE_CODE) || name.equals(EventStrings.REQUEST_ID_HEADER) || name.equals(EventStrings.OAUTH_ERROR_CODE) || name.equals(EventStrings.HTTP_PATH)) { dispatchMap.put(name, eventPair.second); } } }
Source:
public Collection<ManagedThreadPoolExecutor> getMBeans() { return mBeans; }

Target:
public Collection<ManagedThreadPoolExecutor> getMBeans() { return Collections.unmodifiableList(mBeans); }
Source:
public SimpleActionButton() { super(); initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { button.removeStyleName(style.buttonMouseOver()); button.addStyleName(style.buttonMouseOut()); } }); button.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { button.removeStyleName(style.buttonMouseOut()); button.addStyleName(style.buttonMouseOver()); } }); button.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { button.removeStyleName(style.buttonMouseOver()); button.addStyleName(style.buttonMouseOut()); } }); }

Target:
public SimpleActionButton() { initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { button.removeStyleName(style.buttonMouseOver()); button.addStyleName(style.buttonMouseOut()); } }); button.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { button.removeStyleName(style.buttonMouseOut()); button.addStyleName(style.buttonMouseOver()); } }); button.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { button.removeStyleName(style.buttonMouseOver()); button.addStyleName(style.buttonMouseOut()); } }); }
Source:
private Object loadCompilerShim(ExecutionContext context) { try { ClassLoaderCache classLoaderCache = context.getClassLoaderCache(); classLoaderCache.addRef(); ClassLoader classLoader = classLoaderCache.getClassLoaderForClassPath( ToolProvider.getSystemToolClassLoader(), ImmutableList.copyOf( compilerClassPath .stream() .map(p -> ((PathSourcePath) p).getRelativePath()) .map(PATH_TO_URL) .iterator())); return classLoader.loadClass(COMPILER_CLASS).newInstance(); } catch (Exception ex) { throw new RuntimeException(ex); } }

Target:
private Object loadCompilerShim(ExecutionContext context) { try { ClassLoaderCache classLoaderCache = context.getClassLoaderCache(); classLoaderCache.addRef(); ClassLoader classLoader = classLoaderCache.getClassLoaderForClassPath( SynchronizedToolProvider.getSystemToolClassLoader(), ImmutableList.copyOf( compilerClassPath .stream() .map(p -> ((PathSourcePath) p).getRelativePath()) .map(PATH_TO_URL) .iterator())); return classLoader.loadClass(COMPILER_CLASS).newInstance(); } catch (Exception ex) { throw new RuntimeException(ex); } }
Source:
public T update(final T object) { validateCredentials(object); if (JDOHelper.getObjectState(object) == ObjectState.TRANSIENT) { throw new UpdateFromTransientException(); } updateModificationData(object); final T updatedInstance = repository.update(object); if (!getComboboxStringFields().isEmpty()) { updateComboList(object); } if (recordHistory) { historyService.record(updatedInstance); } TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { if (allowUpdateEvent) { sendEvent((Long) getId(updatedInstance), UPDATE); } } }); return updatedInstance; }

Target:
public T update(final T object) { validateCredentials(object); if (JDOHelper.getObjectState(object) == ObjectState.TRANSIENT) { return updateFromTransient(object); } updateModificationData(object); final T updatedInstance = repository.update(object); if (recordHistory) { historyService.record(updatedInstance); } TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { @Override public void afterCommit() { if (allowUpdateEvent) { sendEvent((Long) getId(updatedInstance), UPDATE); } } }); return updatedInstance; }
Source:
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { if (e.getMessage() instanceof ThriftMessage) { ThriftMessage message = (ThriftMessage) e.getMessage(); if (taskTimeoutMillis > 0) { message.setProcessStartTimeMillis(System.currentTimeMillis()); } checkResponseOrderingRequirements(ctx, message); TNiftyTransport messageTransport = new TNiftyTransport(ctx.getChannel(), message); TTransportPair transportPair = TTransportPair.fromSingleTransport(messageTransport); TProtocolPair protocolPair = duplexProtocolFactory.getProtocolPair(transportPair); TProtocol inProtocol = protocolPair.getInputProtocol(); TProtocol outProtocol = protocolPair.getOutputProtocol(); try { processRequest(ctx, message, messageTransport, inProtocol, outProtocol); } catch (RejectedExecutionException ex) { TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Server overloaded"); sendTApplicationException(x, ctx, message, dispatcherSequenceId.get(), messageTransport, inProtocol, outProtocol); } } else { ctx.sendUpstream(e); } }

Target:
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { if (e.getMessage() instanceof ThriftMessage) { ThriftMessage message = (ThriftMessage) e.getMessage(); if (taskTimeoutMillis > 0) { message.setProcessStartTimeMillis(System.currentTimeMillis()); } checkResponseOrderingRequirements(ctx, message); TNiftyTransport messageTransport = new TNiftyTransport(ctx.getChannel(), message); TTransportPair transportPair = TTransportPair.fromSingleTransport(messageTransport); TProtocolPair protocolPair = duplexProtocolFactory.getProtocolPair(transportPair); TProtocol inProtocol = protocolPair.getInputProtocol(); TProtocol outProtocol = protocolPair.getOutputProtocol(); processRequest(ctx, message, messageTransport, inProtocol, outProtocol); } else { ctx.sendUpstream(e); } }
Source:
private HttpResponse handleResponse(final HttpHost httpHost, final HttpRequest request, final HttpResponse originalResponse, final HttpContext context) throws IOException { final GoodDataChallengeType challenge = identifyGoodDataChallenge(originalResponse); if (challenge == GoodDataChallengeType.UNKNOWN) { return originalResponse; } EntityUtils.consume(originalResponse.getEntity()); final boolean entered = authLock.tryLock(); if (entered) { try { final Lock writeLock = rwLock.writeLock(); writeLock.lock(); boolean doSST = true; try { if (challenge == GoodDataChallengeType.TT && sst != null) { if (refreshTt()) { doSST = false; } } if (doSST) { sst = sstStrategy.obtainSst(httpClient, authHost); if (!refreshTt()) { throw new GoodDataAuthException("Unable to obtain TT after successfully obtained SST"); } } } catch (GoodDataAuthException e) { return new BasicHttpResponse(new BasicStatusLine(originalResponse.getProtocolVersion(), HttpStatus.SC_UNAUTHORIZED, e.getMessage())); } finally { writeLock.unlock(); } } finally { authLock.unlock(); } } return this.execute(httpHost, request, context); }

Target:
private HttpResponse handleResponse(final HttpHost httpHost, final HttpRequest request, final HttpResponse originalResponse, final HttpContext context) throws IOException { final GoodDataChallengeType challenge = identifyGoodDataChallenge(originalResponse); if (challenge == GoodDataChallengeType.UNKNOWN) { return originalResponse; } EntityUtils.consume(originalResponse.getEntity()); if (authLock.tryLock()) { try { final Lock writeLock = rwLock.writeLock(); writeLock.lock(); boolean doSST = true; try { if (challenge == GoodDataChallengeType.TT && sst != null) { if (refreshTt()) { doSST = false; } } if (doSST) { sst = sstStrategy.obtainSst(httpClient, authHost); if (!refreshTt()) { throw new GoodDataAuthException("Unable to obtain TT after successfully obtained SST"); } } } catch (GoodDataAuthException e) { return new BasicHttpResponse(new BasicStatusLine(originalResponse.getProtocolVersion(), HttpStatus.SC_UNAUTHORIZED, e.getMessage())); } finally { writeLock.unlock(); } } finally { authLock.unlock(); } } return this.execute(httpHost, request, context); }
Source:
public GrasSimulatedUser(User other, ISchedulingState cluster) { super(other, cluster); Map<String, Double> guaranteedGenericResources = new HashMap<>(); Map<String, Double> availGenericResources = cluster.getClusterTotalGenericResource(); for (Map.Entry<String, Double> entry : availGenericResources.entrySet()) { String resource = entry.getKey(); Double guaranteedAmount = other.getGenericGuaranteed().getOrDefault(resource, 0.0); guaranteedGenericResources.put(resource, guaranteedAmount); } this.guaranteedGenericResources = guaranteedGenericResources; }

Target:
public GrasSimulatedUser(User other, ISchedulingState cluster) { super(other, cluster); Map<String, Double> guaranteedGenericResources = new HashMap<>(); Set<String> availGenericResourceTypes = cluster.getClusterTotalGenericResources().keySet(); for (String resourceType : availGenericResourceTypes) { Double guaranteedAmount = other.getGenericGuaranteed().getOrDefault(resourceType, 0.0); guaranteedGenericResources.put(resourceType, guaranteedAmount); } this.guaranteedGenericResources = guaranteedGenericResources; }
Source:
private ValidationResult referencedNetworkAttachmentActuallyExists(Guid networkAttachmentId) { boolean doesNotReferenceExistingNetworkAttachment = networkAttachmentId == null; if (doesNotReferenceExistingNetworkAttachment) { return ValidationResult.VALID; } for (NetworkAttachment existingAttachment : existingAttachments) { if (existingAttachment.getId().equals(networkAttachmentId)) { return ValidationResult.VALID; } } return new ValidationResult(EngineMessage.NETWORK_ATTACHMENT_NOT_EXISTS); }

Target:
private ValidationResult referencedNetworkAttachmentActuallyExists(Guid networkAttachmentId) { boolean doesNotReferenceExistingNetworkAttachment = networkAttachmentId == null; if (doesNotReferenceExistingNetworkAttachment) { return ValidationResult.VALID; } for (NetworkAttachment existingAttachment : existingAttachments) { if (existingAttachment.getId().equals(networkAttachmentId)) { return ValidationResult.VALID; } } EngineMessage engineMessage = EngineMessage.NETWORK_ATTACHMENT_NOT_EXISTS; String id = networkAttachmentId.toString(); String replacement = ReplacementUtils.getVariableAssignmentString(engineMessage, id); return new ValidationResult(engineMessage, replacement); }
Source:
public void updatePerson(Person person) { person.setLastUpdated(new DateTime(DateTimeZones.UTC)); person.setMediaType(null); DBObject idQuery = translator.idQuery(person.getCanonicalUri()).build(); persistenceAuditLog.logWrite(person); collection.update(idQuery, translator.writeUpdate(idQuery, person), true, false); lookupEntryStore.store(LookupEntry.lookupEntryFrom(person)); writeEquivalences(person); }

Target:
public void updatePerson(Person person) { person.setLastUpdated(new DateTime(DateTimeZones.UTC)); person.setMediaType(null); DBObject idQuery = translator.idQuery(person.getCanonicalUri()).build(); persistenceAuditLog.logWrite(person); collection.update(idQuery, translator.mainPersonFieldsToDBObject(idQuery, person), true, false); lookupEntryStore.store(LookupEntry.lookupEntryFrom(person)); writeEquivalences(person); }
Source:
protected BookieServer startBookie(ServerConfiguration conf) throws Exception { BookieServer server = new BookieServer(conf); BookieSocketAddress address = Bookie.getBookieAddress(conf); if (bkc == null) { bkc = new BookKeeperTestClient(baseClientConf); } Future<?> waitForBookie = bkc.waitForBookie(address); server.start(); waitForBookie.get(30, TimeUnit.SECONDS); LOG.info("New bookie, {}, has been created.", address); try { startAutoRecovery(server, conf); } catch (CompatibilityException ce) { LOG.error("Exception while starting AutoRecovery!", ce); } catch (UnavailableException ue) { LOG.error("Exception while starting AutoRecovery!", ue); } return server; }

Target:
protected BookieServer startBookie(ServerConfiguration conf) throws Exception { BookieServer server = new BookieServer(conf); BookieSocketAddress address = Bookie.getBookieAddress(conf); if (bkc == null) { bkc = new BookKeeperTestClient(baseClientConf); } Future<?> waitForBookie = conf.isForceReadOnlyBookie() ? bkc.waitForReadOnlyBookie(address) : bkc.waitForWritableBookie(address); server.start(); waitForBookie.get(30, TimeUnit.SECONDS); LOG.info("New bookie '{}' has been created.", address); try { startAutoRecovery(server, conf); } catch (CompatibilityException ce) { LOG.error("Exception while starting AutoRecovery!", ce); } catch (UnavailableException ue) { LOG.error("Exception while starting AutoRecovery!", ue); } return server; }
Source:
private static String cpuToConstraint(CPU cpu) { switch (cpu) { case X86_32: return "@bazel_tools case X86_64: return "@bazel_tools case PPC: return "@bazel_tools case ARM: return "@bazel_tools case AARCH64: return "@bazel_tools case S390X: return "@bazel_tools } return null; }

Target:
static String cpuToConstraint(CPU cpu) { switch (cpu) { case X86_32: return "@bazel_tools case X86_64: return "@bazel_tools case PPC: return "@bazel_tools case ARM: return "@bazel_tools case AARCH64: return "@bazel_tools case S390X: return "@bazel_tools } return null; }
Source:
private void updateSiteOrFinishActivity(Bundle savedInstanceState) { if (savedInstanceState == null) { if (getArguments() != null) { mSite = (SiteModel) getArguments().getSerializable(WordPress.SITE); mPost = mPostStore.getPostByLocalPostId(getArguments().getInt(EditPostActivity.EXTRA_POST_LOCAL_ID)); } else { mSite = (SiteModel) getActivity().getIntent().getSerializableExtra(WordPress.SITE); mPost = mPostStore.getPostByLocalPostId(getActivity().getIntent() .getIntExtra(EditPostActivity.EXTRA_POST_LOCAL_ID, 0)); } } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); mPost = mPostStore.getPostByLocalPostId(savedInstanceState.getInt(EditPostActivity.EXTRA_POST_LOCAL_ID)); } if (mSite == null) { ToastUtils.showToast(getActivity(), R.string.blog_not_found, ToastUtils.Duration.SHORT); getActivity().finish(); } }

Target:
private void updateSiteOrFinishActivity(Bundle savedInstanceState) { if (savedInstanceState == null) { if (getArguments() != null) { mSite = (SiteModel) getArguments().getSerializable(WordPress.SITE); } else { mSite = (SiteModel) getActivity().getIntent().getSerializableExtra(WordPress.SITE); } } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); } if (mSite == null) { ToastUtils.showToast(getActivity(), R.string.blog_not_found, ToastUtils.Duration.SHORT); getActivity().finish(); } }
Source:
public void checkFillSelectionAfterSelectingDatasetAuthentication() throws Exception { enableService(); Bundle clientState = new Bundle(); clientState.putCharSequence("clientStateKey", "clientStateValue"); final IntentSender authentication = AuthenticationActivity.createSender(getContext(), 1, new CannedDataset.Builder() .setField(ID_USERNAME, "dude") .setField(ID_PASSWORD, "sweet") .setPresentation(createPresentation("Dataset")) .build()); sReplier.addResponse(new CannedFillResponse.Builder().addDataset( new CannedDataset.Builder() .setField(ID_USERNAME, "username") .setId("name") .setPresentation(createPresentation("authentication")) .setAuthentication(authentication) .build()) .setExtras(clientState).build()); mActivity.onUsername(View::requestFocus); sUiBot.selectDataset("authentication"); sReplier.getNextFillRequest(); eventually(() -> { FillEventHistory selection = InstrumentedAutoFillService.peekInstance() .getFillEventHistory(); assertThat(selection.getClientState().getCharSequence("clientStateKey")).isEqualTo( "clientStateValue"); assertThat(selection.getEvents().size()).isAtLeast(1); assertThat(selection.getEvents().size()).isAtMost(2); FillEventHistory.Event event = selection.getEvents().get(0); assertThat(event.getType()).isEqualTo(TYPE_DATASET_AUTHENTICATION_SELECTED); assertThat(event.getDatasetId()).isEqualTo("name"); }); }

Target:
public void checkFillSelectionAfterSelectingDatasetAuthentication() throws Exception { enableService(); Bundle clientState = new Bundle(); clientState.putCharSequence("clientStateKey", "clientStateValue"); final IntentSender authentication = AuthenticationActivity.createSender(getContext(), 1, new CannedDataset.Builder() .setField(ID_USERNAME, "dude") .setField(ID_PASSWORD, "sweet") .setPresentation(createPresentation("Dataset")) .build()); sReplier.addResponse(new CannedFillResponse.Builder().addDataset( new CannedDataset.Builder() .setField(ID_USERNAME, "username") .setId("name") .setPresentation(createPresentation("authentication")) .setAuthentication(authentication) .build()) .setExtras(clientState).build()); mActivity.onUsername(View::requestFocus); sUiBot.selectDataset("authentication"); sReplier.getNextFillRequest(); eventually(() -> { FillEventHistory selection = InstrumentedAutoFillService.peekInstance() .getFillEventHistory(); assertThat(selection.getClientState().getCharSequence("clientStateKey")).isEqualTo( "clientStateValue"); assertThat(selection.getEvents().size()).isEqualTo(2); FillEventHistory.Event event = selection.getEvents().get(0); assertThat(event.getType()).isEqualTo(TYPE_DATASET_AUTHENTICATION_SELECTED); assertThat(event.getDatasetId()).isEqualTo("name"); }); }
Source:
public MapillarySequence(final String key, final String userKey, String organizationKey, final long capturedAt) { this.images = new CopyOnWriteArrayList<>(); this.key = key; this.capturedAt = capturedAt; if (userKey != null) { setUser(userKey); } if (organizationKey != null) { setOrganization(organizationKey); } }

Target:
public MapillarySequence(final String key, final String userKey, String organizationKey, final long capturedAt) { this.images = new CopyOnWriteArrayList<>(); this.key = key; this.capturedAt = capturedAt; setUser(userKey); setOrganization(organizationKey); }
Source:
public String getDescription() { return "Split a geometry with another geometry\n." + "Supported operations are : \n" + "<ul>Split a polygon with a linestring</ul>" + "<ul>Split a multilinestring with a linestring or a point</ul>" + "<ul>Split a linestring with a linestring or a point</ul>" + "Note : if the second geometry is a point\n" + "the user can specify a tolerance to snap\n" + "the point to the geometry. The default tolerance is : \n" + "10E-6"; }

Target:
public String getDescription() { return "<html>Split a geometry with another geometry\n." + "Supported operations are : \n" + "<ul><li>Split a polygon with a linestring</li>" + "<li>Split a multilinestring with a linestring or a point</li>" + "<li>Split a linestring with a linestring or a point</li>" + "Note : if the second geometry is a point\n" + "the user can specify a tolerance to snap\n" + "the point to the geometry. The default tolerance is : \n" + "10^(-6) meters.</ul></html>"; }
Source:
public Set<InstalledDriver> getInstalledDrivers(String profileName) { Set installedDrivers = new HashSet<InstalledDriver>(); if (profileName != null) { if (drivers.get(profileName) == null) { throw ROOT_LOGGER.noDriverDefinedInDefaultProfile(); } installedDrivers.addAll(drivers.get(profileName).values()); } if (drivers.get(DEFAULT_PROFILE) != null) { installedDrivers.addAll(drivers.get(DEFAULT_PROFILE).values()); } return Collections.unmodifiableSet(Collections.synchronizedSet(installedDrivers)); }

Target:
public Set<InstalledDriver> getInstalledDrivers(String profileName) { Set<InstalledDriver> installedDrivers = new HashSet<>(); synchronized (drivers) { if (profileName != null) { if (drivers.get(profileName) != null) { installedDrivers.addAll(drivers.get(profileName).values()); } } else { if (drivers.get(DEFAULT_PROFILE) == null) { throw ROOT_LOGGER.noDriverDefinedInDefaultProfile(); } } if (drivers.get(DEFAULT_PROFILE) != null) { installedDrivers.addAll(drivers.get(DEFAULT_PROFILE).values()); } } return Collections.unmodifiableSet(installedDrivers); }
Source:
private void split() { mChildren = new PointQuadTree[]{ new PointQuadTree(mBounds.minX, mBounds.minY, mBounds.midX, mBounds.midY, mDepth + 1), new PointQuadTree(mBounds.midX, mBounds.minY, mBounds.maxX, mBounds.midY, mDepth + 1), new PointQuadTree(mBounds.minX, mBounds.midY, mBounds.midX, mBounds.maxY, mDepth + 1), new PointQuadTree(mBounds.midX, mBounds.midY, mBounds.maxX, mBounds.maxY, mDepth + 1) }; List<T> items = mItems; mItems = null; for (T item : items) { add(item); } items.clear(); }

Target:
private void split() { mChildren = new PointQuadTree[]{ new PointQuadTree(mBounds.minX, mBounds.minY, mBounds.midX, mBounds.midY, mDepth + 1), new PointQuadTree(mBounds.midX, mBounds.minY, mBounds.maxX, mBounds.midY, mDepth + 1), new PointQuadTree(mBounds.minX, mBounds.midY, mBounds.midX, mBounds.maxY, mDepth + 1), new PointQuadTree(mBounds.midX, mBounds.midY, mBounds.maxX, mBounds.maxY, mDepth + 1) }; List<T> items = mItems; mItems = null; for (T item : items) { add(item); } }
Source:
public static List<StreamInterceptor> getInterceptors() { if (!isLoadedAlready) { loadInterceptors(); isLoadedAlready = true; } return Collections.unmodifiableList(interceptors); }

Target:
public static List<StreamInterceptor> getInterceptors() { if (!isLoadedAlready) { try { lock.lock(); if (!isLoadedAlready) { loadInterceptors(); isLoadedAlready = true; } } finally { lock.unlock(); } } return Collections.unmodifiableList(interceptors); }
Source:
protected static void assertRequestHasCommonProperties(final RecordedRequest request) { assertEquals(request.getMethod(), "POST"); assertEquals(request.getHeader(HttpHeaders.AUTHORIZATION), authHeader); assertEquals(request.getHeader(HttpHeaders.ACCEPT), MediaType.TEXT_XML); }

Target:
protected static void assertRequestHasCommonProperties(final RecordedRequest request) { assertEquals(request.getMethod(), "POST"); assertEquals(request.getPath(), rootUrl); assertEquals(request.getHeader(HttpHeaders.AUTHORIZATION), authHeader); assertEquals(request.getHeader(HttpHeaders.ACCEPT), MediaType.TEXT_XML); }
Source:
public void testDefaultLoggerClosesItStreams() throws Exception { final Checker checker = new Checker(); try (CloseAndFlushTestByteArrayOutputStream testInfoOutputStream = new CloseAndFlushTestByteArrayOutputStream(); CloseAndFlushTestByteArrayOutputStream testErrorOutputStream = new CloseAndFlushTestByteArrayOutputStream()) { checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader()); checker.addListener(new DefaultLogger(testInfoOutputStream, OutputStreamOptions.CLOSE, testErrorOutputStream, OutputStreamOptions.CLOSE)); final File tmpFile = temporaryFolder.newFile("file.java"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verify(checker, tmpFile.getPath(), expected); assertWithMessage("Close count") .that(testInfoOutputStream.getCloseCount()) .isEqualTo(1); assertWithMessage("Flush count") .that(testInfoOutputStream.getFlushCount()) .isAnyOf(3, 4); assertWithMessage("Close count") .that(testErrorOutputStream.getCloseCount()) .isEqualTo(1); assertWithMessage("Flush count") .that(testErrorOutputStream.getFlushCount()) .isAnyOf(1, 2); } }

Target:
public void testDefaultLoggerClosesItStreams() throws Exception { final Checker checker = new Checker(); try (CloseAndFlushTestByteArrayOutputStream testInfoOutputStream = new CloseAndFlushTestByteArrayOutputStream(); CloseAndFlushTestByteArrayOutputStream testErrorOutputStream = new CloseAndFlushTestByteArrayOutputStream()) { checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader()); checker.addListener(new DefaultLogger(testInfoOutputStream, OutputStreamOptions.CLOSE, testErrorOutputStream, OutputStreamOptions.CLOSE)); final File tmpFile = temporaryFolder.newFile("file.java"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verify(checker, tmpFile.getPath(), expected); assertWithMessage("Output stream close count") .that(testInfoOutputStream.getCloseCount()) .isEqualTo(1); assertWithMessage("Output stream flush count") .that(testInfoOutputStream.getFlushCount()) .isEqualTo(TestUtil.adjustFlushCountForOutputStreamClose(3)); assertWithMessage("Error stream close count") .that(testErrorOutputStream.getCloseCount()) .isEqualTo(1); assertWithMessage("Error stream flush count") .that(testErrorOutputStream.getFlushCount()) .isEqualTo(TestUtil.adjustFlushCountForOutputStreamClose(1)); } }
Source:
protected final long evalLong(long left, long right) { return LongMath.pow(left, (int) right); }

Target:
protected final long evalLong(long left, long right) { return LongMath.pow(left, Ints.checkedCast(right)); }
Source:
public String getInstanceId() { String[] parts = clusterName.split("/"); Preconditions.checkState(parts.length == 6, "Malformed cluster name: " + clusterName); return parts[3]; }

Target:
public String getInstanceId() { return instanceId; }
Source:
private org.eclipse.swt.graphics.Image createImage() { org.eclipse.swt.graphics.Image newImage; RenderedImage image = renderManager.getImage(); this.backBufferTrsf=renderManager.getMapInternal().getViewportModel().worldToScreenTransform(); if (image != null) newImage = AWTSWTImageUtils.createSWTImage(image, false); else { newImage = new Image(getDisplay(), getWidth(), getHeight()); } return newImage; }

Target:
private org.eclipse.swt.graphics.Image createImage() { org.eclipse.swt.graphics.Image newImage; RenderedImage image = renderManager.getImage(); if (image != null) newImage = AWTSWTImageUtils.createSWTImage(image, false); else { newImage = new Image(getDisplay(), getWidth(), getHeight()); } return newImage; }