auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void updateErrorMessage() { setErrorMessage(null); try { ISourceContainer[] containers = fContainer.getSourceContainers(); if (containers.length == 0) return; for (ISourceContainer c : containers) { MapEntrySourceContainer entry = (MapEntrySourceContainer)c; String backendPath = entry.getBackend(); if (backendPath.isEmpty()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_5); break; } IPath localPath = entry.getLocalPath(); if (localPath.isEmpty()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_7); break; } if (!localPath.toFile().exists()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_8); break; } if (!localPath.toFile().isDirectory()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_9); break; } if (!localPath.toFile().isAbsolute()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_10); break; } } } catch (CoreException e) { } }

Target:
private void updateErrorMessage() { setErrorMessage(null); try { ISourceContainer[] containers = fContainer.getSourceContainers(); if (containers.length == 0) return; for (ISourceContainer c : containers) { MapEntrySourceContainer entry = (MapEntrySourceContainer)c; String backendPath = entry.getBackendPathStr(); if (backendPath.isEmpty()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_5); break; } IPath localPath = entry.getLocalPath(); if (localPath.isEmpty()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_7); break; } if (!localPath.toFile().exists()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_8); break; } if (!localPath.toFile().isDirectory()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_9); break; } if (!localPath.toFile().isAbsolute()) { setErrorMessage(SourceLookupUIMessages.PathMappingDialog_10); break; } } } catch (CoreException e) { } }
Source:
public S3Client( @Named(CONF_S3_AUTH_KEY_ID) String keyId, @Named(CONF_S3_AUTH_SECRET) String secret, @Named(CONF_S3_BUCKET_NAME) String bucketName) { checkNotNull(keyId, "aws api access key id is null"); checkNotNull(secret, "aws api secret access key is null"); this.bucketName = checkNotNull(bucketName, "s3 bucket name is null"); BasicAWSCredentials credentials = null; try { credentials = new BasicAWSCredentials(keyId, secret); } catch (Exception e) { throw new AmazonClientException("Cannot initialize credentials", e); } client = AmazonS3ClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); }

Target:
public S3Client( @Named(CONF_S3_AUTH_KEY_ID) String keyId, @Named(CONF_S3_AUTH_SECRET) String secret, @Named(CONF_S3_BUCKET_NAME) String bucketName) { checkNotNull(keyId, "aws api access key id is null"); checkNotNull(secret, "aws api secret access key is null"); this.bucketName = checkNotNull(bucketName, "s3 bucket name is null"); client = AmazonS3ClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(buildAWSCredentials(keyId, secret))) .build(); }
Source:
protected void onPause() { super.onPause(); getSupportFragmentManager().popBackStack(); mIsRunning = false; }

Target:
protected void onPause() { super.onPause(); getFragmentManager().popBackStack(); mIsRunning = false; }
Source:
public void addEmail(Player player, String email) { String playerName = player.getName().toLowerCase(); if (playerCache.isAuthenticated(playerName)) { PlayerAuth auth = playerCache.getAuth(playerName); final String currentEmail = auth.getEmail(); if (!Utils.isEmailEmpty(currentEmail)) { service.send(player, MessageKey.USAGE_CHANGE_EMAIL); } else if (!validationService.validateEmail(email)) { service.send(player, MessageKey.INVALID_EMAIL); } else if (!validationService.isEmailFreeForRegistration(email, player)) { service.send(player, MessageKey.EMAIL_ALREADY_USED_ERROR); } else { EmailChangedEvent event = bukkitService.createAndCallEvent(isAsync -> new EmailChangedEvent(player, null, email, isAsync)); if (event.isCancelled()) { sendFailedMessage(player); return; } auth.setEmail(email); if (dataSource.updateEmail(auth)) { playerCache.updatePlayer(auth); bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_EMAIL, playerName); service.send(player, MessageKey.EMAIL_ADDED_SUCCESS); } else { sendFailedMessage(player); } } } else { sendUnloggedMessage(player); } }

Target:
public void addEmail(Player player, String email) { String playerName = player.getName().toLowerCase(); if (playerCache.isAuthenticated(playerName)) { PlayerAuth auth = playerCache.getAuth(playerName); final String currentEmail = auth.getEmail(); if (!Utils.isEmailEmpty(currentEmail)) { service.send(player, MessageKey.USAGE_CHANGE_EMAIL); } else if (!validationService.validateEmail(email)) { service.send(player, MessageKey.INVALID_EMAIL); } else if (!validationService.isEmailFreeForRegistration(email, player)) { service.send(player, MessageKey.EMAIL_ALREADY_USED_ERROR); } else { EmailChangedEvent event = bukkitService.createAndCallEvent(isAsync -> new EmailChangedEvent(player, null, email, isAsync)); if (event.isCancelled()) { ConsoleLogger.info("Could not add email to player '" + player + "' – event was cancelled"); service.send(player, MessageKey.EMAIL_ADD_NOT_ALLOWED); return; } auth.setEmail(email); if (dataSource.updateEmail(auth)) { playerCache.updatePlayer(auth); bungeeSender.sendAuthMeBungeecordMessage(MessageType.REFRESH_EMAIL, playerName); service.send(player, MessageKey.EMAIL_ADDED_SUCCESS); } else { ConsoleLogger.warning("Could not save email for player '" + player + "'"); service.send(player, MessageKey.ERROR); } } } else { sendUnloggedMessage(player); } }
Source:
public void testGodMode() throws IOException { System.clearProperty("godmode"); assertNull(System.getProperty("godmode")); ______TS("test verifyHtml"); testGodMode(true); ______TS("test verifyHtmlMainContent"); testGodMode(false); }

Target:
public void testGodMode() throws Exception { System.clearProperty("godmode"); assertNull(System.getProperty("godmode")); ______TS("test verifyHtml"); testGodMode(false); ______TS("test verifyHtmlMainContent"); testGodMode(true); }
Source:
public void testSingletonServicePluginsAddedHandling() { @SuppressWarnings("rawtypes") PluginInfo<Converter> converterInfo = new PluginInfo<>( DummyStringConverter.class, Converter.class); converterInfo.setPluginClass(DummyStringConverter.class); pluginService.addPlugin(converterInfo); assertNotNull(pluginService.getPlugin(DummyStringConverter.class)); assertTrue(convertService.supports("StringInput", Number.class)); }

Target:
public void testSingletonServicePluginsAddedHandling() { @SuppressWarnings("rawtypes") PluginInfo<Converter> converterInfo = new PluginInfo<>( FoodConverter.class, Converter.class); pluginService.addPlugin(converterInfo); assertNotNull(pluginService.getPlugin(FoodConverter.class)); assertTrue(convertService.supports(new Apple() {}, Peach.class)); }
Source:
public Snapshot getSnapshot() { long now = System.nanoTime(); cacheLock.readLock().lock(); try { if (now < cachedHistogramTimestampNanos + refreshIntervalNanos) { return cachedSnapshot; } } finally { cacheLock.readLock().unlock(); } cacheLock.writeLock().lock(); try { if (now >= cachedHistogramTimestampNanos + refreshIntervalNanos) { LOG.debug("Cached snapshot is too old, refreshing"); cachedHistogram = recorder.getIntervalHistogram(cachedHistogram); cachedSnapshot = new HdrSnapshot(cachedHistogram); cachedHistogramTimestampNanos = now; } return cachedSnapshot; } finally { cacheLock.writeLock().unlock(); } }

Target:
public Snapshot getSnapshot() { long now = System.nanoTime(); cacheLock.readLock().lock(); try { if (now - cachedHistogramTimestampNanos < refreshIntervalNanos) { return cachedSnapshot; } } finally { cacheLock.readLock().unlock(); } cacheLock.writeLock().lock(); try { if (now - cachedHistogramTimestampNanos >= refreshIntervalNanos) { LOG.debug("Cached snapshot is too old, refreshing"); cachedHistogram = recorder.getIntervalHistogram(cachedHistogram); cachedSnapshot = new HdrSnapshot(cachedHistogram); cachedHistogramTimestampNanos = now; } return cachedSnapshot; } finally { cacheLock.writeLock().unlock(); } }
Source:
public void testRollupModeEnabled() { Configuration config = Configuration.getInstance(); config.setProperty(CoreConfig.ROLLUP_MODE, "true"); String[] args = new String[0]; BluefloodServiceStarterException ex = null; try { BluefloodServiceStarter.main(args); } catch (BluefloodServiceStarterException e) { ex = e; } assertNull(ex); }

Target:
public void testRollupModeEnabled() { Configuration config = Configuration.getInstance(); config.setProperty(CoreConfig.ROLLUP_MODE, "true"); BluefloodServiceStarter.run(); }
Source:
private short toShort(int value) { return (short) value; }

Target:
private static short toShort(int value) { return (short) value; }
Source:
public void setUp(HttpRequestBuilderFactory httpRequestBuilderFactory, UrlUtils urlUtils) { requestBuilder = mock(RequestBuilder.class); given(httpRequestBuilderFactory.create(any(Method.class), anyString())).willReturn(requestBuilder); given(urlUtils.encodeQueryString(DECODED_VALUE_1)).willReturn(ENCODED_VALUE_1); given(urlUtils.encodeQueryString(DECODED_VALUE_2)).willReturn(ENCODED_VALUE_2); given(urlUtils.encodeQueryString(DECODED_VALUE_3)).willReturn(ENCODED_VALUE_3); }

Target:
public void setUp(HttpRequestBuilderFactory httpRequestBuilderFactory, UrlUtils urlUtils) { given(httpRequestBuilderFactory.create(any(Method.class), anyString())).willReturn(requestBuilder); given(urlUtils.encodeQueryString(DECODED_VALUE_1)).willReturn(ENCODED_VALUE_1); given(urlUtils.encodeQueryString(DECODED_VALUE_2)).willReturn(ENCODED_VALUE_2); given(urlUtils.encodeQueryString(DECODED_VALUE_3)).willReturn(ENCODED_VALUE_3); }
Source:
protected boolean canDoAction() { getDiskImage(); return true; }

Target:
protected boolean canDoAction() { if (!validate(new StoragePoolValidator(getStoragePool()).isUp())) { return false; } DiskImage diskImage = null; try { diskImage = getDiskImage(); } catch (Exception e) { log.error("Unable to get the disk image from the provider proxy", e); } if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } return true; }
Source:
private void initContentEventHandlers() { btnRevealrootcontentevent.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnRevealcontentevent.setSelected(false); btnRevealrootcontentevent.setSelected(true); btnRevealrootlayoutcontentevent.setSelected(false); contentSlot.setEnabled(false); btnSelectContentSlot.setEnabled(false); presenterConfigModel.setRevealInRoot(true); presenterConfigModel.setRevealInRootLayout(false); presenterConfigModel.setRevealInSlot(false); } }); btnRevealrootlayoutcontentevent.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnRevealcontentevent.setSelected(false); btnRevealrootcontentevent.setSelected(false); btnRevealrootlayoutcontentevent.setSelected(true); contentSlot.setEnabled(false); btnSelectContentSlot.setEnabled(false); presenterConfigModel.setRevealInRoot(false); presenterConfigModel.setRevealInRootLayout(true); presenterConfigModel.setRevealInSlot(false); } }); btnRevealcontentevent.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnRevealcontentevent.setSelected(true); btnRevealrootcontentevent.setSelected(false); btnRevealrootlayoutcontentevent.setSelected(false); contentSlot.setEnabled(true); btnSelectContentSlot.setEnabled(true); presenterConfigModel.setRevealInRoot(false); presenterConfigModel.setRevealInRootLayout(false); presenterConfigModel.setRevealInSlot(true); } }); }

Target:
private void initContentEventHandlers() { radioContentRoot.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { radioContentSlot.setSelected(false); radioContentRoot.setSelected(true); radioContentRootLayout.setSelected(false); contentSlot.setEnabled(false); selectContentSlot.setEnabled(false); presenterConfigModel.setRevealInRoot(true); presenterConfigModel.setRevealInRootLayout(false); presenterConfigModel.setRevealInSlot(false); } }); radioContentRootLayout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { radioContentSlot.setSelected(false); radioContentRoot.setSelected(false); radioContentRootLayout.setSelected(true); contentSlot.setEnabled(false); selectContentSlot.setEnabled(false); presenterConfigModel.setRevealInRoot(false); presenterConfigModel.setRevealInRootLayout(true); presenterConfigModel.setRevealInSlot(false); } }); radioContentSlot.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { radioContentSlot.setSelected(true); radioContentRoot.setSelected(false); radioContentRootLayout.setSelected(false); contentSlot.setEnabled(true); selectContentSlot.setEnabled(true); presenterConfigModel.setRevealInRoot(false); presenterConfigModel.setRevealInRootLayout(false); presenterConfigModel.setRevealInSlot(true); } }); }
Source:
public ProcessingDirective heartbeat() { final long timeMillis = System.currentTimeMillis(); return currentTrackedFile.map(trackedFile -> { return handleHeartbeatWithHealthyFileSystem(timeMillis); }).orElseGet(() -> { return timeMillis - lastFixAttempt > reconnectDelay ? attemptRecovery(timeMillis) : PAUSE; }); }

Target:
public ProcessingDirective heartbeat() { final long nanoTime = System.nanoTime(); return currentTrackedFile .map(trackedFile -> handleHeartbeatWithHealthyFileSystem(nanoTime)) .orElseGet(() -> nanoTime - lastFixAttemptNanoTime > reconnectDelayNanos ? attemptRecovery(nanoTime) : PAUSE); }
Source:
public IStatus validate(IProject project, String path) { File file = new File(path); if (!file.exists()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File not found: " + path); } if (!file.isFile()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Not a file. It's a directory: " + path); } int confidence = 0; try { if (!TmfTraceUtils.isText(file)) { return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(path, "r")) { goToCorrectStart(rafile); int lineCount = 0; int matches = 0; String line = readNextEventString(() -> rafile.read()); while ((line != null) && (lineCount++ < MAX_LINES)) { try { TraceEventField field = TraceEventField.parseJson(line); if (field.getTs() != 0 && field.getName() != "unknown") { matches++; } } catch (RuntimeException e) { confidence = Integer.MIN_VALUE; } confidence = MAX_CONFIDENCE * matches / lineCount; line = readNextEventString(() -> rafile.read()); } if (matches == 0) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Most assuredly NOT a Trace-Event trace"); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); }

Target:
public IStatus validate(IProject project, String path) { File file = new File(path); if (!file.exists()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File not found: " + path); } if (!file.isFile()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Not a file. It's a directory: " + path); } int confidence = 0; try { if (!TmfTraceUtils.isText(file)) { return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(path, "r")) { goToCorrectStart(rafile); int lineCount = 0; int matches = 0; String line = readNextEventString(() -> rafile.read()); while ((line != null) && (lineCount++ < MAX_LINES)) { try { TraceEventField field = TraceEventField.parseJson(line); if (field != null) { matches++; } } catch (RuntimeException e) { confidence = Integer.MIN_VALUE; } confidence = MAX_CONFIDENCE * matches / lineCount; line = readNextEventString(() -> rafile.read()); } if (matches == 0) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Most assuredly NOT a Trace-Event trace"); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); }
Source:
private void replyEof() { mSerializingExecutor.execute(() -> { try { Preconditions.checkState(!mContext.isDoneUnsafe()); if (!mContext.isDoneUnsafe()) { mContext.setDoneUnsafe(true); mResponse.onCompleted(); } else { LOG.warn("Tried to replyEof when stream was already finished. context: {}", mContext); } } catch (StatusRuntimeException e) { if (e.getStatus().getCode() != Status.Code.CANCELLED) { throw e; } } }); }

Target:
private void replyEof() { mSerializingExecutor.execute(() -> { try { if (!mContext.isDoneUnsafe()) { mContext.setDoneUnsafe(true); mResponse.onCompleted(); } else { LOG.debug("Tried to replyEof when stream was already finished. context: {}", mContext); } } catch (StatusRuntimeException e) { if (e.getStatus().getCode() != Status.Code.CANCELLED) { throw e; } } }); }
Source:
public void testPerformSolrCloudSynchronousRestoreNoCollection() throws Exception { setupSystemProperties(SolrCommands.CLOUD_SOLR_CLIENT_TYPE); RestoreCommand restoreCommand = getSynchronousRestoreCommand(getBackupLocation(), null, miniSolrCloud.getSolrClient()); restoreCommand.execute(); String backupName = getBackupName(consoleOutput.getOutput()); File backupFile = Paths.get(restoreCommand.backupLocation, backupName).toAbsolutePath().toFile(); assertThat( consoleOutput.getOutput(), containsString( String.format( "Restoring collection [%s] from [%s] / [%s", DEFAULT_CORE_NAME, restoreCommand.backupLocation, backupName))); assertThat(consoleOutput.getOutput(), containsString("Restore complete.")); assertThat(backupFile.exists(), is(true)); }

Target:
public void testPerformSolrCloudSynchronousRestoreNoCollection() throws Exception { setupSystemProperties(SolrCommands.CLOUD_SOLR_CLIENT_TYPE); RestoreCommand restoreCommand = getSynchronousRestoreCommand(getBackupLocation(), null, miniSolrCloud.getSolrClient()); restoreCommand.execute(); assertThat( consoleOutput.getOutput(), containsString( String.format( "Restoring collection [%s] from [%s] / [%s", DEFAULT_CORE_NAME, restoreCommand.backupLocation, backupFile.getName()))); assertThat(consoleOutput.getOutput(), containsString("Restore complete.")); }
Source:
public void testAsyncPrettyPrinterResult() { try { StringWriter out = new StringWriter(); PrintWriter writer = new PrintWriter(out); AsyncPrettyPrinter mAsyncPrettyPrinter = mPrettyPrinterTestFactory.getInstance( TEST_HEADER_NAME, TEST_HEADER_VALUE); mAsyncPrettyPrinter.printTo(writer, mInputStream); assertEquals(PRETTY_PRINT_PREFIX + Arrays.toString(TEST_RESPONSE_BODY), out.toString()); } catch (IOException e) { fail(e.getMessage()); } }

Target:
public void testAsyncPrettyPrinterResult() throws IOException { StringWriter out = new StringWriter(); PrintWriter writer = new PrintWriter(out); AsyncPrettyPrinter mAsyncPrettyPrinter = mPrettyPrinterTestFactory.getInstance( TEST_HEADER_NAME, TEST_HEADER_VALUE); mAsyncPrettyPrinter.printTo(writer, mInputStream); assertEquals(PRETTY_PRINT_PREFIX + Arrays.toString(TEST_RESPONSE_BODY), out.toString()); }
Source:
public void update() { smoothedTank.tick(getWorld()); if (tank.getFluidAmount() != fluidAmountPrev) { fluidAmountPrev = tank.getFluidAmount(); comparatorLevel = MathUtil.scaledClamp(tank.getFluidAmount(), tank.getCapacity(), 15); markDirty(); } }

Target:
public void update() { smoothedTank.tick(getWorld()); if (tank.getFluidAmount() != fluidAmountPrev) { fluidAmountPrev = tank.getFluidAmount(); markDirty(); } }
Source:
public BucketManager<Object> cloneWithProperties() { return null; }

Target:
public BucketManager<Object> cloneWithProperties() { throw new UnsupportedOperationException(); }
Source:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); setSucceeded(true); if (!images.isEmpty()) { for (DiskImage image : images) { ArrayList<Guid> storageIds = new ArrayList<>(); storageIds.add(getParameters().getStorageDomainId()); image.setStorageIds(storageIds); image.setStoragePoolId(getParameters().getStoragePoolId()); } RemoveAllVmImagesParameters removeAllVmImagesParameters = new RemoveAllVmImagesParameters(getVmId(), images); removeAllVmImagesParameters.setParentCommand(getActionType()); removeAllVmImagesParameters.setEntityInfo(getParameters().getEntityInfo()); removeAllVmImagesParameters.setForceDelete(true); removeAllVmImagesParameters.setParentParameters(getParameters()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, removeAllVmImagesParameters); if (vdcRetValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } else { getReturnValue().setFault(vdcRetValue.getFault()); setSucceeded(false); } } List<Guid> guids = new ArrayList<>(); guids.add(ovfEntityData.getEntityId()); vmAndTemplatesGenerationsDao.deleteOvfGenerations(guids); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); }

Target:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); setSucceeded(true); if (!images.isEmpty()) { List<DiskImage> imageToRemove = new ArrayList<>(); for (DiskImage image : images) { if (image.getStorageIds().get(0).equals(getParameters().getStorageDomainId())) { List<Guid> storageIds = new ArrayList<>(); storageIds.add(getParameters().getStorageDomainId()); image.setStorageIds(storageIds); image.setStoragePoolId(getParameters().getStoragePoolId()); imageToRemove.add(image); } } RemoveAllVmImagesParameters removeAllVmImagesParameters = new RemoveAllVmImagesParameters(getVmId(), imageToRemove); removeAllVmImagesParameters.setParentCommand(getActionType()); removeAllVmImagesParameters.setEntityInfo(getParameters().getEntityInfo()); removeAllVmImagesParameters.setForceDelete(true); removeAllVmImagesParameters.setParentParameters(getParameters()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, removeAllVmImagesParameters); if (vdcRetValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } else { getReturnValue().setFault(vdcRetValue.getFault()); setSucceeded(false); } } List<Guid> guids = new ArrayList<>(); guids.add(ovfEntityData.getEntityId()); vmAndTemplatesGenerationsDao.deleteOvfGenerations(guids); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); }
Source:
private ServerAddress getServerAddress() { ServerAddress address; MongoClient client = client(); address = client.getServerAddressList().get(0); client.close(); return address; }

Target:
private ServerAddress getServerAddress() { MongoClient client = client(); try { return client.getServerAddressList().get(0); } finally { client.close(); } }
Source:
public DateDoubleTimeSeries<?> evaluate(DateDoubleTimeSeries<?> ts) { ArgumentChecker.notNull(ts, "time series"); ArgumentChecker.isTrue(ts.size() > _lag, "time series length must be > lag"); final int[] times = ts.timesArrayFast(); final double[] values = ts.valuesArrayFast(); final int n = times.length; final int[] resultTimes = new int[n - _lag]; final double[] percentageChanges = new double[n - _lag]; for (int i = _lag; i < n; i++) { ArgumentChecker.isTrue(values[i - _lag] != 0.0d, "value equal to 0, no relative change can be computed"); resultTimes[i - _lag] = times[i]; percentageChanges[i - _lag] = (values[i] - values[i - _lag]) / values[i - _lag]; } return ImmutableLocalDateDoubleTimeSeries.of(resultTimes, percentageChanges); }

Target:
public DateDoubleTimeSeries<?> evaluate(DateDoubleTimeSeries<?> ts) { ArgumentChecker.notNull(ts, "time series"); ArgumentChecker.isTrue(ts.size() > _lag, "time series length must be > lag"); final int[] times = ts.timesArrayFast(); final double[] values = ts.valuesArrayFast(); final int n = times.length; final int[] resultTimes = new int[n - _lag]; final double[] percentageChanges = new double[n - _lag]; for (int i = _lag; i < n; i++) { ArgumentChecker.isTrue(values[i - _lag] != 0.0d, "value equal to 0 at date {}, no relative change can be computed", times[i - _lag]); resultTimes[i - _lag] = times[i]; percentageChanges[i - _lag] = (values[i] - values[i - _lag]) / values[i - _lag]; } return ImmutableLocalDateDoubleTimeSeries.of(resultTimes, percentageChanges); }
Source:
private void processRegionForCanadaOrUs(AddressEntity addressEntity) { String country = addressEntity.getCountry().toLowerCase(); String normalisedPostalCode = addressEntity.getPostcode().replaceAll("\\s", ""); switch (country) { case "america": case "united states": case "united states of america": case "us": case "usa": Optional.of(UsStateUtils.getState(normalisedPostalCode)); break; case "canada": Optional.of(CanadaProvinceTerritoryUtils.getState(normalisedPostalCode)); break; default: break; } }

Target:
private void processRegionForCanadaOrUs(AddressEntity addressEntity) { switch (addressEntity.getCountry()) { case "US": Optional.of(UsZipCodeToStateMapper.getState(getNormalisedPostalCode(addressEntity))); break; case "CA": Optional.of(CanadaPostalcodeToProvinceOrTerritoryMapper.getProvinceOrTerritory(getNormalisedPostalCode(addressEntity))); break; default: break; } }
Source:
public HeaderExchangeServer(Server server) { if (server == null) { throw new IllegalArgumentException("server == null"); } this.server = server; this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0); this.idleTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (idleTimeout < heartbeat * 2) { throw new IllegalStateException("idleTimeout < heartbeatInterval * 2"); } startIdleCheckTimer(); }

Target:
public HeaderExchangeServer(Server server) { Assert.notNull(server, "server == null"); this.server = server; this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0); this.idleTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (idleTimeout < heartbeat * 2) { throw new IllegalStateException("idleTimeout < heartbeatInterval * 2"); } startIdleCheckTask(); }
Source:
public String sendJoinLinkToNewInstructor(InstructorAttributes instructor, String shortName, String institute) throws EntityDoesNotExistException { String joinLink=""; InstructorAttributes instructorData = getInstructorForEmail(instructor.courseId, instructor.email); if (instructorData == null) { throw new EntityDoesNotExistException("Instructor [" + instructor.email + instructor.name + "] does not exist in course [" + instructor.courseId + "]"); } Emails emailMgr = new Emails(); try { List<MimeMessage> emails = emailMgr.generateNewInstructorAccountJoinEmail(instructorData, shortName, institute); emailMgr.sendEmail(emails.get(0)); emailMgr.sendEmail(emails.get(1)); joinLink = emails.get(2).getContent().toString(); } catch (Exception e) { throw new RuntimeException("Unexpected error while sending email",e); } return joinLink; }

Target:
public String sendJoinLinkToNewInstructor(InstructorAttributes instructor, String shortName, String institute) throws EntityDoesNotExistException { String joinLink=""; InstructorAttributes instructorData = getInstructorForEmail(instructor.courseId, instructor.email); if (instructorData == null) { throw new EntityDoesNotExistException("Instructor [" + instructor.email + instructor.name + "] does not exist in course [" + instructor.courseId + "]"); } Emails emailMgr = new Emails(); try { List<MimeMessage> emails = emailMgr.generateNewInstructorAccountJoinEmail(instructorData, shortName, institute); emailMgr.sendEmail(emails.get(0)); emailMgr.sendEmail(emails.get(1)); joinLink = emailMgr.generateNewInstructorAccountJoinLink(instructorData, institute); } catch (Exception e) { throw new RuntimeException("Unexpected error while sending email",e); } return joinLink; }
Source:
protected EntityBinding getEntityBinding(Class<?> entityClass) { Class<?> entitySearched = isMappedInterface(entityClass) ? entityClass : lookupEntityClass(entityClass); return entityBindings.getOrDefault(entitySearched, EntityBinding.EMPTY_BINDING); }

Target:
protected EntityBinding getEntityBinding(Class<?> entityClass) { if (isMappedInterface(entityClass)) { return EntityBinding.EMPTY_BINDING; } return entityBindings.getOrDefault(lookupEntityClass(entityClass), EntityBinding.EMPTY_BINDING); }
Source:
public AnalyzedStatement analyze(CreateView createView, CoordinatorTxnCtx txnCtx) { RelationName name = RelationName.of(createView.name(), txnCtx.sessionContext().searchPath().currentSchema()); name.ensureValidForRelationCreation(); if (BlobSchemaInfo.NAME.equals(name.schema())) { throw new UnsupportedOperationException("Creating a view in the \"blob\" schema is not supported"); } AnalyzedRelation query; try { String formattedQuery = SqlFormatter.formatSql(createView.query()); query = relationAnalyzer.analyzeUnbound((Query) SqlParser.createStatement(formattedQuery), txnCtx, ParamTypeHints.EMPTY); } catch (Exception e) { throw new UnsupportedOperationException("Query cannot be used in a VIEW: " + createView.query()); } if (query.fields().stream().map(f -> f.path().sqlFqn()).distinct().count() != query.fields().size()) { throw new IllegalArgumentException("Query in CREATE VIEW must not have duplicate column names"); } return new CreateViewStmt( name, query, createView.query(), createView.replaceExisting(), txnCtx.sessionContext().user() ); }

Target:
public CreateViewStmt analyze(CreateView createView, CoordinatorTxnCtx txnCtx) { RelationName name = RelationName.of(createView.name(), txnCtx.sessionContext().searchPath().currentSchema()); name.ensureValidForRelationCreation(); if (BlobSchemaInfo.NAME.equals(name.schema())) { throw new UnsupportedOperationException("Creating a view in the \"blob\" schema is not supported"); } AnalyzedRelation query; try { String formattedQuery = SqlFormatter.formatSql(createView.query()); query = relationAnalyzer.analyzeUnbound((Query) SqlParser.createStatement(formattedQuery), txnCtx, ParamTypeHints.EMPTY); } catch (Exception e) { throw new UnsupportedOperationException("Query cannot be used in a VIEW: " + createView.query()); } if (query.fields().stream().map(f -> f.path().sqlFqn()).distinct().count() != query.fields().size()) { throw new IllegalArgumentException("Query in CREATE VIEW must not have duplicate column names"); } return new CreateViewStmt( name, query, createView.query(), createView.replaceExisting(), txnCtx.sessionContext().user() ); }
Source:
public void testConcurrencyLimit() throws Exception { LimitedExecutor limitedExecutor = new LimitedExecutor(NAME, executor, 1); CountDownLatch latch = new CountDownLatch(1); CompletableFuture<String> cf1 = new CompletableFuture<>(); limitedExecutor.execute(() -> { awaitLatch(latch); cf1.complete("bla"); }); CompletableFuture<String> cf2 = new CompletableFuture<>(); limitedExecutor.execute(() -> cf2.complete("bla")); Thread.sleep(10); assertFalse(cf1.isDone()); assertFalse(cf2.isDone()); latch.countDown(); assertEquals("bla", cf1.get(10, SECONDS)); assertEquals("bla", cf2.get(10, SECONDS)); eventuallyEquals(0, executor::getActiveCount); }

Target:
public void testConcurrencyLimit() throws Exception { eventuallyEquals(0, executor::getActiveCount); LimitedExecutor limitedExecutor = new LimitedExecutor(NAME, executor, 1); CompletableFuture<String> blocker1 = new CompletableFuture<>(); CompletableFuture<String> blocker2 = new CompletableFuture<>(); CompletableFuture<String> cf1 = new CompletableFuture<>(); limitedExecutor.execute(() -> { try { cf1.complete(blocker1.get(10, SECONDS)); } catch (Exception e) { cf1.completeExceptionally(e); } }); CompletableFuture<String> cf2 = new CompletableFuture<>(); limitedExecutor.execute(() -> { try { cf2.complete(cf1.getNow("task 2 ran too early") + " " + blocker2.get(10, SECONDS)); } catch (Exception e) { cf2.completeExceptionally(e); } }); assertFalse(cf1.isDone()); assertFalse(cf2.isDone()); blocker1.complete("value1"); blocker2.complete("value2"); assertEquals("value1", cf1.get(10, SECONDS)); assertEquals("value1 value2", cf2.get(10, SECONDS)); eventuallyEquals(0, executor::getActiveCount); }
Source:
protected JarScheduler(DockerClient dockerClient, ZooKeeper zooKeeperContainer) { super(dockerClient); this.zooKeeperContainer = zooKeeperContainer; docker0AdaptorIpAddress = dockerClient.versionCmd().exec().getVersion().startsWith("1.9.") ? "172.17.0.1" : "172.17.42.1"; }

Target:
protected JarScheduler(DockerClient dockerClient, ZooKeeper zooKeeperContainer) { super(dockerClient); this.zooKeeperContainer = zooKeeperContainer; docker0AdaptorIpAddress = getDocker0AdaptorIpAddress(dockerClient); }
Source:
public Buffer getNextReceivedBuffer() { synchronized (receivedBuffers) { return receivedBuffers.poll(); } }

Target:
public Buffer getNextReceivedBuffer() { return receivedBuffers.poll(); }
Source:
public void apply() { Object thing; if (isValid) { thing = registry.getValue(injectedObject); if (registry.getRegistrySuperType() == Block.class && thing == Blocks.AIR) { thing = null; } } else { thing = null; } if (thing == null) { FMLLog.getLogger().log(Level.DEBUG, "Unable to lookup for {}. This means the object wasn't registered. It's likely just mod options.", injectedObject, field); return; } try { FinalFieldHelper.setField(field, null, thing); } catch (Exception e) { FMLLog.log(Level.WARN, e, "Unable to set %s with value %s (%s)", this.field, thing, this.injectedObject); } }

Target:
public void apply() { Object thing; if (isValid && registry.containsKey(injectedObject)) { thing = registry.getValue(injectedObject); } else { thing = null; } if (thing == null) { FMLLog.getLogger().log(Level.DEBUG, "Unable to lookup for {}. This means the object wasn't registered. It's likely just mod options.", injectedObject, field); return; } try { FinalFieldHelper.setField(field, null, thing); } catch (Exception e) { FMLLog.log(Level.WARN, e, "Unable to set %s with value %s (%s)", this.field, thing, this.injectedObject); } }
Source:
public Object fromMessage(Message<?> message, Class<?> targetClass) { try { Message<?> mm = MutableMessageBuilder.fromMessage(message).build(); return this.codec.encode(mm); } catch (IOException e) { throw new MessagingException(message, e); } }

Target:
public Object fromMessage(Message<?> message, Class<?> targetClass) { try { return this.codec.encode(message); } catch (IOException e) { throw new MessagingException(message, e); } }
Source:
private Map<String, List<Integer>> getRecipientRanksExcludingSelf(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question) { if (shouldSelfBeExcludedFromRankings(question)) { List<FeedbackResponseAttributes> responsesExcludingSelf = getResponsesExcludingSelf(responses); return generateOptionRanksMapping(responsesExcludingSelf); } else { return new HashMap<>(); } }

Target:
private Map<String, List<Integer>> getRecipientRanksExcludingSelf(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question) { if (shouldSelfBeExcludedFromRankings(question)) { List<FeedbackResponseAttributes> responsesExcludingSelf = getResponsesExcludingSelf(responses); return generateOptionRanksMapping(responsesExcludingSelf); } return new HashMap<String, List<Integer>>(); }
Source:
public static LogEntry generateInstanceFromXML(Node wn) { final String METHOD_NAME = "generateInstanceFromXML(Node)"; Date date = null; String desc = null; String type = null; try { NodeList nl = wn.getChildNodes(); for (int x = 0; x < nl.getLength(); x++) { Node node = nl.item(x); String nname = node.getNodeName(); if (nname.equalsIgnoreCase("desc")) { desc = MekHqXmlUtil.unEscape(node.getTextContent()); } else if (nname.equalsIgnoreCase("type")) { type = MekHqXmlUtil.unEscape(node.getTextContent()); } else if (nname.equalsIgnoreCase("date")) { date = DATE_FORMAT.parse(node.getTextContent().trim()); } } } catch (Exception ex) { MekHQ.getLogger().error(LogEntry.class, METHOD_NAME, ex); return null; } return new LogEntry(date, desc, type); }

Target:
public static LogEntry generateInstanceFromXML(Node wn) { final String METHOD_NAME = "generateInstanceFromXML(Node)"; Date date = null; String desc = null; String type = null; try { NodeList nl = wn.getChildNodes(); for (int x = 0; x < nl.getLength(); x++) { Node node = nl.item(x); String nname = node.getNodeName(); if (nname.equals("desc")) { desc = MekHqXmlUtil.unEscape(node.getTextContent()); } else if (nname.equals("type")) { type = MekHqXmlUtil.unEscape(node.getTextContent()); } else if (nname.equals("date")) { date = dateFormat().parse(node.getTextContent().trim()); } } } catch (Exception ex) { MekHQ.getLogger().error(LogEntry.class, METHOD_NAME, ex); return null; } return new LogEntry(date, desc, type); }
Source:
public RankQuery getRankQuery() { if (luceneQueries.querqyBoostQueries != null && luceneQueries.querqyBoostQueries.size() > 0) { final BooleanQuery.Builder builder = new BooleanQuery.Builder(); for (final Query q : luceneQueries.querqyBoostQueries) { builder.add(q, BooleanClause.Occur.SHOULD); } return new QuerqyReRankQuery(new MatchAllDocsQuery(), maybeWrapQuery(builder.build()), requestAdapter.getReRankNumDocs(), 1.0); } else if (luceneQueries.rankQuery != null && !luceneQueries.isMainQueryBoosted) { return (RankQuery) luceneQueries.rankQuery; } return null; }

Target:
public Optional<RankQuery> getRankQuery() { if (luceneQueries.querqyBoostQueries != null && luceneQueries.querqyBoostQueries.size() > 0) { final BooleanQuery.Builder builder = new BooleanQuery.Builder(); for (final Query q : luceneQueries.querqyBoostQueries) { builder.add(q, BooleanClause.Occur.SHOULD); } return Optional.of(new QuerqyReRankQuery(new MatchAllDocsQuery(), maybeWrapQuery(builder.build()), requestAdapter.getReRankNumDocs(), 1.0)); } else if (luceneQueries.rankQuery != null && !luceneQueries.isMainQueryBoosted) { return Optional.of((RankQuery) luceneQueries.rankQuery); } return Optional.empty(); }
Source:
public static String toBase64(ByteString string) { String base64 = Base64.getEncoder().encodeToString(string.getBytes()); StringBuilder str = new StringBuilder(base64.length() + base64.length() / 76); int i; if (base64.length() > 76) { for (i = 0; i + 76 < base64.length(); i += 76) { str.append(base64, i, i + 76); str.append("\n"); } str.append(base64, i, base64.length()); return str.toString(); } return base64; }

Target:
public static String toBase64(ByteString string) { return toBase64_(string.getBytes()); }
Source:
protected ScheduledReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit) { ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(name + '-' + FACTORY_ID.incrementAndGet())); this(registry, name, filter, rateUnit, durationUnit, executor); }

Target:
protected ScheduledReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit) { this(registry, name, filter, rateUnit, durationUnit, Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(name + '-' + FACTORY_ID.incrementAndGet()))); }
Source:
public QueryResponse process(QueryResponse input) throws PluginExecutionException, StopProcessingException { if (input != null) { Set<ProcessingDetails> processingDetails = input.getProcessingDetails(); List<Result> results = input.getResults(); Map<String, Serializable> properties = input.getProperties(); processingDetails .stream() .filter(ProcessingDetails::hasException) .map(ProcessingDetails::getSourceId) .forEach( id -> Metrics.counter( METRICS_PREFIX + "." + QUERY_SCOPE + "." + EXCEPTION_TYPE, Tags.of(SOURCE_TAG, id)) .increment()); results .stream() .map(Result::getMetacard) .map(Metacard::getSourceId) .forEach( id -> Metrics.counter( METRICS_PREFIX + "." + QUERY_SCOPE + "." + RESULTS_TYPE, Tags.of(SOURCE_TAG, id)) .increment()); properties .entrySet() .stream() .filter(e -> e.getKey().startsWith(METRICS_SOURCE_ELAPSED_PREFIX)) .forEach(SourceMetricsImpl::updateLatencyMetric); } return input; }

Target:
public QueryResponse process(QueryResponse input) throws PluginExecutionException, StopProcessingException { if (input == null) { LOGGER.debug("Unable to process source metrics due to null input."); return null; } Set<ProcessingDetails> processingDetails = input.getProcessingDetails(); List<Result> results = input.getResults(); Map<String, Serializable> properties = input.getProperties(); processingDetails .stream() .filter(ProcessingDetails::hasException) .map(ProcessingDetails::getSourceId) .forEach( id -> Metrics.counter( METRICS_PREFIX + "." + QUERY_SCOPE + "." + EXCEPTION_TYPE, Tags.of(SOURCE_TAG, id)) .increment()); results .stream() .map(Result::getMetacard) .map(Metacard::getSourceId) .forEach( id -> Metrics.counter( METRICS_PREFIX + "." + QUERY_SCOPE + "." + RESULTS_TYPE, Tags.of(SOURCE_TAG, id)) .increment()); properties .entrySet() .stream() .filter(e -> e.getKey() != null && e.getKey().startsWith(METRICS_SOURCE_ELAPSED_PREFIX)) .forEach(SourceMetricsImpl::updateLatencyMetric); return input; }
Source:
public void run(Timeout timeout) throws Exception { if (timeout.isCancelled()) { return; } if (logger.isInfoEnabled()) { logger.info(taskName + " : " + url); } try { doRetry(url, registry); } catch (Throwable t) { logger.warn("Failed to " + taskName + url + ", waiting for again, cause:" + t.getMessage(), t); reput(timeout, retryPeriod); } }

Target:
public void run(Timeout timeout) throws Exception { if (timeout.isCancelled() || timeout.timer().isStop() || isCancel()) { return; } if (logger.isInfoEnabled()) { logger.info(taskName + " : " + url); } try { doRetry(url, registry, timeout); } catch (Throwable t) { logger.warn("Failed to execute task " + taskName + ", url: " + url + ", waiting for again, cause:" + t.getMessage(), t); reput(timeout, retryPeriod); } }
Source:
SpatialRuleLookupArray(BBox bounds, double resolution, boolean exact) { if (bounds == null) throw new IllegalArgumentException("BBox cannot be null"); if (resolution < 1e-100) throw new IllegalArgumentException("resolution cannot be that high " + resolution); this.bounds = bounds; this.resolution = resolution; this.checkDiff = (resolution / 2) - (resolution / 10); this.exact = exact; lookupArray = new byte[getNumberOfXGrids()][getNumberOfYGrids()]; addSingleRule(EMPTY); ruleContainers.add(new SpatialRuleContainer() { { this.rules.add(EMPTY); } @Override public SpatialRuleContainer addRule(SpatialRule spatialRule) { throw new IllegalArgumentException("Cannot add to empty rule container"); } @Override public SpatialRuleContainer addRules(Collection<SpatialRule> rules) { throw new IllegalArgumentException("Cannot add to empty rule container"); } }); }

Target:
SpatialRuleLookupArray(BBox bounds, double resolution, boolean exact) { if (bounds == null) throw new IllegalArgumentException("BBox cannot be null"); if (resolution < 1e-100) throw new IllegalArgumentException("resolution cannot be that high " + resolution); this.bounds = bounds; this.resolution = resolution; this.checkDiff = (resolution / 2) - (resolution / 10); this.exact = exact; lookupArray = new byte[getNumberOfXGrids()][getNumberOfYGrids()]; addSingleRule(SpatialRule.EMPTY); ruleContainers.add(new SpatialRuleContainer() { { this.rules.add(SpatialRule.EMPTY); } @Override public SpatialRuleContainer addRule(SpatialRule spatialRule) { throw new IllegalArgumentException("Cannot add to empty rule container"); } @Override public SpatialRuleContainer addRules(Collection<SpatialRule> rules) { throw new IllegalArgumentException("Cannot add to empty rule container"); } }); }
Source:
private void createAndStartServer() throws Exception { createAndStartServer(new DummyServlet(Optional.empty())); }

Target:
private void createAndStartServer() throws Exception { createAndStartServer(new DummyServlet()); }
Source:
public static @NonNull Iterable<ITmfEventAspect<?>> generateAspects(CustomTraceDefinition definition) { boolean addExtraFieldAspect = false; List<String> fieldNames = new ArrayList<>(); ImmutableList.Builder<ITmfEventAspect<?>> builder = new ImmutableList.Builder<>(); for (OutputColumn output : definition.outputs) { if (output.tag.equals(Tag.TIMESTAMP) && (definition.timeStampOutputFormat == null || definition.timeStampOutputFormat.isEmpty())) { builder.add(TmfBaseAspects.getTimestampAspect()); fieldNames.add(output.name); } else if (output.tag.equals(Tag.EVENT_TYPE)) { builder.add(TmfBaseAspects.getEventTypeAspect()); fieldNames.add(output.name); } else if (output.tag.equals(Tag.EVENT_FIELDS_NAME)) { continue; } else if (output.tag.equals(Tag.EXTRA_FIELDS_VALUE)) { addExtraFieldAspect = true; } else { builder.add(new TmfContentFieldAspect(output.name, output.name)); fieldNames.add(output.name); } } if (addExtraFieldAspect) { builder.add(new CustomExtraFieldAspect(fieldNames)); } return builder.build(); }

Target:
public static @NonNull Iterable<ITmfEventAspect<?>> generateAspects(CustomTraceDefinition definition) { List<String> fieldNames = new ArrayList<>(); ImmutableList.Builder<ITmfEventAspect<?>> builder = new ImmutableList.Builder<>(); CustomExtraFieldsAspect extraAspect = null; for (OutputColumn output : definition.outputs) { if (output.tag.equals(Tag.TIMESTAMP) && (definition.timeStampOutputFormat == null || definition.timeStampOutputFormat.isEmpty())) { builder.add(TmfBaseAspects.getTimestampAspect()); fieldNames.add(output.name); } else if (output.tag.equals(Tag.EVENT_TYPE)) { builder.add(TmfBaseAspects.getEventTypeAspect()); fieldNames.add(output.name); } else if (output.tag.equals(Tag.EXTRA_FIELDS_NAME)) { continue; } else if (output.tag.equals(Tag.EXTRA_FIELDS_VALUE)) { if (extraAspect == null) { extraAspect = new CustomExtraFieldsAspect(); builder.add(extraAspect); } } else { builder.add(new TmfContentFieldAspect(output.name, output.name)); fieldNames.add(output.name); } } return builder.build(); }
Source:
public void setUpBeforeClass() { pickTableLayout = new PickTableLayout(tester().getMetadata(), new SqlParser()); connectorId = tester().getCurrentConnectorId(); nationTableHandle = new TableHandle( connectorId, new TpchTableHandle("nation", 1.0), TestingTransactionHandle.create(), Optional.of(TestingHandle.INSTANCE)); ordersTableHandle = new TableHandle( connectorId, new TpchTableHandle("orders", 1.0), TestingTransactionHandle.create(), Optional.of(TestingHandle.INSTANCE)); nationTableLayoutHandle = new TableLayoutHandle( connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) nationTableHandle.getConnectorHandle(), TupleDomain.all())); ordersTableLayoutHandle = new TableLayoutHandle( connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) ordersTableHandle.getConnectorHandle(), TupleDomain.all())); }

Target:
public void setUpBeforeClass() { pickTableLayout = new PickTableLayout(tester().getMetadata(), new SqlParser()); connectorId = tester().getCurrentConnectorId(); TpchTableHandle nationTpchTableHandle = new TpchTableHandle("nation", 1.0); TpchTableHandle orderTpchTableHandle = new TpchTableHandle("orders", 1.0); nationTableHandle = new TableHandle( connectorId, nationTpchTableHandle, TestingTransactionHandle.create(), Optional.of(new TpchTableLayoutHandle(nationTpchTableHandle, TupleDomain.all()))); ordersTableHandle = new TableHandle( connectorId, orderTpchTableHandle, TestingTransactionHandle.create(), Optional.of(new TpchTableLayoutHandle(orderTpchTableHandle, TupleDomain.all()))); }