auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void findPatientByUUID_ShouldFindCorrectPatientByUUID() { patientRoomDAO.savePatient(expectedPatientEntity1); patientRoomDAO.savePatient(expectedPatientEntity2); patientRoomDAO.findPatientByUUID(expectedPatientEntity2.getUuid()).subscribe(new SingleObserver<List<PatientEntity>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(List<PatientEntity> patientEntities) { Assert.assertEquals(patientEntities.get(0).getEncounters(),expectedEncounterEntity2); Assert.assertEquals(patientEntities.get(0).getDisplay(),expectedPatientEntity2.getDisplay()); Assert.assertEquals(patientEntities.get(0).getAddress_1(),expectedPatientEntity2.getAddress_1()); Assert.assertEquals(patientEntities.get(0).getAddress_2(),expectedPatientEntity2.getAddress_2()); Assert.assertEquals(patientEntities.get(0).getAge(),expectedPatientEntity2.getAge()); Assert.assertEquals(patientEntities.get(0).getBirthDate(),expectedPatientEntity2.getBirthDate()); Assert.assertEquals(patientEntities.get(0).getCauseOfDeath(),expectedPatientEntity2.getCauseOfDeath()); Assert.assertEquals(patientEntities.get(0).getCity(),expectedPatientEntity2.getCity()); Assert.assertEquals(patientEntities.get(0).getCountry(),expectedPatientEntity2.getCountry()); Assert.assertEquals(patientEntities.get(0).getDeathDate(),expectedPatientEntity2.getDeathDate()); Assert.assertEquals(patientEntities.get(0).getFamilyName(),expectedPatientEntity2.getFamilyName()); Assert.assertEquals(patientEntities.get(0).getGender(),expectedPatientEntity2.getGender()); Assert.assertEquals(patientEntities.get(0).getGivenName(),expectedPatientEntity2.getGivenName()); Assert.assertEquals(patientEntities.get(0).getIdentifier(),expectedPatientEntity2.getIdentifier()); Assert.assertEquals(patientEntities.get(0).getMiddleName(),expectedPatientEntity2.getMiddleName()); Assert.assertEquals(patientEntities.get(0).getPhoto(),expectedPatientEntity2.getPhoto()); Assert.assertEquals(patientEntities.get(0).getPostalCode(),expectedPatientEntity2.getPostalCode()); Assert.assertEquals(patientEntities.get(0).getState(),expectedPatientEntity2.getState()); Assert.assertEquals(patientEntities.get(0).isSynced(),expectedPatientEntity2.isSynced()); } @Override public void onError(Throwable e) { Log.i(TAG,e.getMessage()); } }); }

Target:
public void findPatientByUUID_ShouldFindCorrectPatientByUUID() { patientRoomDAO.savePatient(expectedPatientEntity1); patientRoomDAO.savePatient(expectedPatientEntity2); patientRoomDAO.findPatientByUUID(expectedPatientEntity2.getUuid()).subscribe(new SingleObserver<List<PatientEntity>>() { @Override public void onSubscribe(Disposable d) { } @Override public void onSuccess(List<PatientEntity> patientEntities) { Assert.assertEquals(patientEntities.get(0), expectedPatientEntity2); } @Override public void onError(Throwable e) { Log.i(TAG, e.getMessage()); } }); }
Source:
public AssertUserFailedException(String errorMessage) { super(MediaWikiApiErrorHandler.ERROR_NO_SUCH_ENTITY, errorMessage); }

Target:
public AssertUserFailedException(String errorMessage) { super(MediaWikiApiErrorHandler.ERROR_ASSERT_USER_FAILED, errorMessage); }
Source:
public void testExceptionsArePrintedToLog() throws KettleException { ProgressBar progressBar = Mockito.mock( ProgressBar.class ); RuntimeTestStatus clusterTestStatus = Mockito.mock( RuntimeTestStatus.class ); Label testLabel = Mockito.mock( Label.class ); RuntimeTestModuleResults runtimeTestModuleResults = Mockito.mock( RuntimeTestModuleResults.class ); RuntimeTestResult result = Mockito.mock( RuntimeTestResult.class ); RuntimeTestResultEntry entry = Mockito.mock( RuntimeTestResultEntry.class ); ArrayList<RuntimeTestModuleResults> results = new ArrayList<>(); results.add( runtimeTestModuleResults ); ArrayList<RuntimeTestResult> runtimeTestResults = new ArrayList<>(); runtimeTestResults.add( result ); ArrayList<RuntimeTestResultEntry> entries = new ArrayList<>(); entries.add( entry ); entries.add( entry ); Mockito.when( clusterTestStatus.getModuleResults() ).thenReturn( results ); Mockito.when( clusterTestStatus.isDone() ).thenReturn( true ); Mockito.when( runtimeTestModuleResults.getRuntimeTestResults() ).thenReturn( runtimeTestResults ); Mockito.when( result.getRuntimeTest() ).thenReturn( Mockito.mock( RuntimeTest.class ) ); Mockito.when( result.getRuntimeTestResultEntries() ).thenReturn( entries ); Mockito.when( entry.getSeverity() ).thenReturn( RuntimeTestEntrySeverity.FATAL ); Mockito.when( entry.getException() ).thenReturn( new Exception() ); testDialog.getRunnable( progressBar, clusterTestStatus, testLabel ).run(); Mockito.verify( entry, Mockito.times( 4 ) ).getException(); }

Target:
public void testExceptionsArePrintedToLog() throws KettleException { ProgressBar progressBar = Mockito.mock( ProgressBar.class ); RuntimeTestStatus clusterTestStatus = Mockito.mock( RuntimeTestStatus.class ); Label testLabel = Mockito.mock( Label.class ); RuntimeTestModuleResults runtimeTestModuleResults = Mockito.mock( RuntimeTestModuleResults.class ); RuntimeTestResult result = Mockito.mock( RuntimeTestResult.class ); RuntimeTestResultEntry entry = Mockito.mock( RuntimeTestResultEntry.class ); Exception exception = new Exception(); ArrayList<RuntimeTestModuleResults> results = new ArrayList<>(); results.add( runtimeTestModuleResults ); ArrayList<RuntimeTestResult> runtimeTestResults = new ArrayList<>(); runtimeTestResults.add( result ); ArrayList<RuntimeTestResultEntry> entries = new ArrayList<>(); entries.add( entry ); entries.add( entry ); Mockito.when( clusterTestStatus.getModuleResults() ).thenReturn( results ); Mockito.when( clusterTestStatus.isDone() ).thenReturn( true ); Mockito.when( runtimeTestModuleResults.getRuntimeTestResults() ).thenReturn( runtimeTestResults ); Mockito.when( result.getRuntimeTest() ).thenReturn( Mockito.mock( RuntimeTest.class ) ); Mockito.when( result.getRuntimeTestResultEntries() ).thenReturn( entries ); Mockito.when( entry.getSeverity() ).thenReturn( RuntimeTestEntrySeverity.FATAL ); Mockito.when( entry.getException() ).thenReturn( exception ); testDialog.getRunnable( progressBar, clusterTestStatus, testLabel ).run(); Mockito.verify( logChannelInterface, Mockito.times( 2 ) ).logBasic( ExceptionUtils.getStackTrace( exception ) ); }
Source:
private void logAccountingLineBaseList(List accountingLines, StringBuilder sb) { List<AccountingLineBase> accountinLineBases = accountingLines; accountinLineBases.stream().forEach(line -> sb.append(line.toString())); }

Target:
private void logAccountingLineBaseList(List accountingLines, StringBuilder sb) { List<AccountingLineBase> accountingLineBases = accountingLines; accountingLineBases.stream().map(AccountingLineBase::toString).forEach(sb::append); }
Source:
public void testSomethingByIterableWithIterable() { final SomethingByIterable s = handle.attach(SomethingByIterable.class); final List<Something> out = s.get(() -> Arrays.asList(new SomethingKey(1, "1"), new SomethingKey(2, "2")) .iterator()); assertThat(out).hasSize(2); }

Target:
public void testSomethingByIterableWithIterable() { final SomethingByIterable s = handle.attach(SomethingByIterable.class); final List<Something> out = s.get(() -> Arrays.asList(new SomethingKey(1, "1"), new SomethingKey(2, "2")) .iterator()); assertThat(out).hasSameElementsAs(expectedSomethings); }
Source:
public Optional<Relation> getModelClass() { final Relation relation = new Relation(); return Optional.of(relation); }

Target:
public Optional<Relation> getModelClass() { return Optional.of(new Relation()); }
Source:
private String getColumnName(Column annotation, Field field) { String name = annotation.name(); return (name.length() > 0) ? name : field.getName(); }

Target:
private String getColumnName(Column annotation, Field field) { String name = annotation.name().isEmpty() ? field.getName() : annotation.name(); return name.toLowerCase(); }
Source:
public static boolean clear() { if (!isHawkInitialised()) { return false; } return hawkBuilder.getStorage().clear(); }

Target:
public static boolean clear() { Utils.validateBuild(); return internal.getStorage().clear(); }
Source:
public void revertFile() throws IOException { OutputStream fileOutputStream = Files.newOutputStream( Paths.get("src/test/resources/testmetaOldFormat.xml")); fileOutputStream.write(testMetaOldFormat); fileOutputStream.close(); }

Target:
public void revertFile() throws IOException { IOUtils.write( testMetaOldFormat, Files.newOutputStream(Paths.get(pathOfOldMetaFormat))); }
Source:
public void aBundledResponseMessageWillContainTheResponseFromAllTheRequests() throws Throwable { LOGGER.debug("check if we get responses for all the requests"); final NodeList nodeList = this.runXpathResult.getNodeList(this.response, " assertEquals(REQUEST_ACTIONS.size(), nodeList.getLength()); }

Target:
public void aBundledResponseMessageWillContainTheResponseFromAllTheRequests() throws Throwable { LOGGER.debug("check if we get responses for all the requests"); final NodeList nodeList = this.runXpathResult.getNodeList(this.response, " assertEquals("the number of request actions should equals the nr nodelists", REQUEST_ACTIONS.size(), nodeList.getLength()); }
Source:
private <V> V doInWorkingDirectory(Message<?> message, Session<FTPFile> session, Callable<V> task) throws IOException { Expression workingDirExpression = this.workingDirExpression; FTPClient ftpClient = (FTPClient) session.getClientInstance(); String currentWorkingDirectory = null; try { if (workingDirExpression != null) { currentWorkingDirectory = ftpClient.printWorkingDirectory(); String workingDir = workingDirExpression.getValue(this.evaluationContext, message, String.class); ftpClient.changeWorkingDirectory(workingDir); } return task.call(); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } else { throw new IOException("Uncategorised IO exception", e); } } finally { if (workingDirExpression != null) { ftpClient.changeWorkingDirectory(currentWorkingDirectory); } } }

Target:
private <V> V doInWorkingDirectory(Message<?> message, Session<FTPFile> session, Callable<V> task) throws IOException { Expression workingDirExpression = this.workingDirExpression; FTPClient ftpClient = (FTPClient) session.getClientInstance(); String currentWorkingDirectory = null; boolean restoreWorkingDirectory = false; try { if (workingDirExpression != null) { currentWorkingDirectory = ftpClient.printWorkingDirectory(); String newWorkingDirectory = workingDirExpression.getValue(this.evaluationContext, message, String.class); if (!Objects.equals(currentWorkingDirectory, newWorkingDirectory)) { ftpClient.changeWorkingDirectory(newWorkingDirectory); restoreWorkingDirectory = true; } } return task.call(); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } else if (e instanceof RuntimeException) { throw (RuntimeException) e; } else { throw new IOException("Uncategorised IO exception", e); } } finally { if (restoreWorkingDirectory) { ftpClient.changeWorkingDirectory(currentWorkingDirectory); } } }
Source:
public BuyerAsTakerProtocol(BuyerAsTakerTrade trade) { super(trade); Offer offer = checkNotNull(trade.getOffer()); processModel.getTradingPeer().setPubKeyRing(offer.getPubKeyRing()); processModel.getTradeManager().requestPersistence(); }

Target:
public BuyerAsTakerProtocol(BuyerAsTakerTrade trade) { super(trade); Offer offer = checkNotNull(trade.getOffer()); processModel.getTradingPeer().setPubKeyRing(offer.getPubKeyRing()); }
Source:
void wrapTestStorage() { ServerEnvironment serverEnv = ServerEnvironment.instance(); StorageFactory testStorage = InMemoryStorageFactory.newInstance(); serverEnv.configureStorage().tests(testStorage); StorageFactory storageFactory = serverEnv.storageFactory(); assertThat(storageFactory).isInstanceOf(SystemAwareStorageFactory.class); SystemAwareStorageFactory systemAware = (SystemAwareStorageFactory) storageFactory; assertThat(systemAware.delegate()).isEqualTo(testStorage); }

Target:
void wrapTestStorage() { ServerEnvironment serverEnv = ServerEnvironment.instance(); StorageFactory testStorage = InMemoryStorageFactory.newInstance(); serverEnv.use(testStorage, Tests.class); StorageFactory storageFactory = serverEnv.storageFactory(); assertThat(storageFactory).isInstanceOf(SystemAwareStorageFactory.class); SystemAwareStorageFactory systemAware = (SystemAwareStorageFactory) storageFactory; assertThat(systemAware.delegate()).isEqualTo(testStorage); }
Source:
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { truckIds = new String[cursor.getCount()]; if (cursor.moveToFirst()) { selectedTruckId = cursor.getString(TrucksOwnedByUserQuery.NAME); int counter = 0; do { truckIds[counter] = cursor.getString(TrucksOwnedByUserQuery.ID); counter++; } while (cursor.moveToNext()); } String[] adapterCols = {TrucksOwnedByUserQuery.PROJECTION[TrucksOwnedByUserQuery.NAME]}; int[] adapterRowViews = new int[]{android.R.id.text1}; spinnerAdapter = new SimpleCursorAdapter(getSupportActionBar().getThemedContext(), android.R.layout.simple_spinner_item, cursor, adapterCols, adapterRowViews, 0); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); actionBarSpinner.setAdapter(spinnerAdapter); actionBarSpinner.setOnItemSelectedListener(this); }

Target:
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { truckIds = new String[cursor.getCount()]; if (cursor.moveToFirst()) { selectedTruckId = cursor.getString(TrucksOwnedByUserQuery.ID); int counter = 0; do { truckIds[counter] = cursor.getString(TrucksOwnedByUserQuery.ID); counter++; } while (cursor.moveToNext()); } String[] adapterCols = {TrucksOwnedByUserQuery.PROJECTION[TrucksOwnedByUserQuery.NAME]}; int[] adapterRowViews = new int[]{android.R.id.text1}; spinnerAdapter = new SimpleCursorAdapter(getSupportActionBar().getThemedContext(), android.R.layout.simple_spinner_item, cursor, adapterCols, adapterRowViews, 0); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); actionBarSpinner.setAdapter(spinnerAdapter); actionBarSpinner.setOnItemSelectedListener(this); }
Source:
public boolean handleSingleExercise(Exercise exercise, String path) { if (exercise.isLocked()) { return false; } Path filePath = Folders.tempFolder().resolve(exercise.getName() + ".zip"); downloadExerciseZip(exercise.getZipUrl(), filePath.toString()); try { taskExecutor.extractProject(filePath, Paths.get(path)); } catch (IOException e) { log.error("Could not extract archive: {}", path.toString()); return false; } finally { deleteZip(filePath); } return true; }

Target:
public boolean handleSingleExercise(Exercise exercise, String path) { if (exercise.isLocked()) { return false; } Path filePath = Folders.tempFolder().resolve(exercise.getName() + ".zip"); if(!downloadExerciseZip(exercise.getZipUrl(), filePath.toString())) { return false; } try { taskExecutor.extractProject(filePath, Paths.get(path)); } catch (IOException e) { log.error("Could not extract archive: {}", path.toString()); return false; } finally { deleteZip(filePath); } return true; }
Source:
private static String nanosToString(long nanos) { double value = (double) nanos / _1_SECOND_IN_NANOS; return String.format("%.3g %s", value, JobMessages.cancelability_monitor_abbrevUnitSeconds); }

Target:
private static String nanosToString(long nanos) { double value = (double) nanos / _1_SECOND_IN_NANOS; final String format = nanos >= TimeUnit.SECONDS.toNanos(100) ? "%.0f %s" : nanos >= TimeUnit.MILLISECONDS.toNanos(10) ? "%.2g %s" : "%.1g %s"; return String.format(format, value, JobMessages.cancelability_monitor_abbrevUnitSeconds); }
Source:
private void addStorageDomainImageFeature(Features features) { Feature feature = new Feature(); feature.setName("Image Storage Domains"); feature.setDescription("Importing and exporting images from and to image storage domain (as for example OpenStack glance)"); features.getFeature().add(feature); }

Target:
private void addStorageDomainImageFeature(Features features) { Feature feature = new Feature(); feature.setName("Image Storage Domains (Tech Preview)"); feature.setDescription("Importing and exporting images from and to image storage domain (as for example OpenStack glance)"); features.getFeature().add(feature); }
Source:
public void indexMarker(final IMarker marker) { try { Logger.traceIndexing("Indexing after addition...", marker); final Document doc = LuceneDocumentFactory.createDocument(marker); Logger.debugIndexing("Adding Marker into index with following fields: {}", doc.getFields()); indexWriter.addDocument(doc); indexWriter.commit(); } catch (Exception e) { Logger.error("Failed to index the JAX-RS Endpoint " + marker, e); } finally { Logger.traceIndexing(" Done indexing {}.", marker); } }

Target:
public void indexMarker(final IMarker marker) { try { Logger.traceIndexing("Indexing after addition...", marker); final Document doc = LuceneDocumentFactory.createDocument(marker); Logger.debugIndexing("Adding Marker into index with following fields: {}", doc.getFields()); indexWriter.addDocument(doc); indexWriter.commit(); } catch (IOException e) { Logger.error("Failed to index the JAX-RS Endpoint " + marker, e); } finally { Logger.traceIndexing(" Done indexing {}.", marker); } }
Source:
public void createAccount(View view) { EditText editText = (EditText) findViewById(R.id.editTextCreateAccount); String username = editText.getText().toString(); if (username.contains(" ")){ displayError(getString(R.string.messageUsernameContainsSpaces)); } else if (username.length() < 1){ displayError(getString(R.string.messageUsernameTooShort)); } else { Intent intent = new Intent(this, CreatingAccountActivity.class); intent.putExtra(CreatingAccountActivity.USERNAME, username); startActivity(intent); } }

Target:
public void createAccount(View view) { String username = mEditTextCreateAccount.getText().toString(); if (username.contains(" ")){ displayError(getString(R.string.messageUsernameContainsSpaces)); } else if (username.length() < 1){ displayError(getString(R.string.messageUsernameTooShort)); } else { Intent intent = new Intent(this, CreatingAccountActivity.class); intent.putExtra(CreatingAccountActivity.USERNAME, username); startActivity(intent); } }
Source:
public synchronized Set<FractionMetadata> fractions() { return probablyFractionProjects() .stream() .map(FractionRegistry.INSTANCE::of) .filter(e->e!=null) .collect(Collectors.toSet()); }

Target:
public synchronized Set<FractionMetadata> fractions() { return probablyFractionProjects() .stream() .map(FractionRegistry.INSTANCE::of) .filter(Objects::nonNull) .collect(Collectors.toSet()); }
Source:
public void testNoPassphraseParsing() throws Exception { File file = new File("src/test/resources/com/sonymobile/tools/gerrit/gerritevents/id_rsa"); boolean tested = SshUtil.checkPassPhrase(file, null); assertTrue("Passphrase validation failed to validate null passphrase with none set", tested); tested = SshUtil.checkPassPhrase(file, ""); assertTrue("Passphrase validation failed to validate empty passphrase with none set", tested); tested = SshUtil.checkPassPhrase(file, "nope"); assertFalse("Passphrase validation passed incorrectly on a file with none set", tested); }

Target:
public void testNoPassphraseParsing() throws Exception { URL url = Thread.currentThread().getContextClassLoader().getResource( "com/sonymobile/tools/gerrit/gerritevents/id_rsa"); File file = new File(url.getPath()); boolean tested = SshUtil.checkPassPhrase(file, null); assertTrue("Passphrase validation failed to validate null passphrase with none set", tested); tested = SshUtil.checkPassPhrase(file, ""); assertTrue("Passphrase validation failed to validate empty passphrase with none set", tested); tested = SshUtil.checkPassPhrase(file, "nope"); assertFalse("Passphrase validation passed incorrectly on a file with none set", tested); }
Source:
public void addMouseListener(MouseListener listener) { if (this.dropdownTableViewer != null && !this.dropdownTable.isDisposed()) this.dropdownTable.addMouseListener(listener); }

Target:
public void addMouseListener(MouseListener listener) { if (this.dropdownTable != null && !this.dropdownTable.isDisposed()) this.dropdownTable.addMouseListener(listener); }
Source:
private QemuVolumeFormat(String value) { value = value; }

Target:
private QemuVolumeFormat(String value) { this.value = value; }
Source:
public String toString() { return "{" + "dataSource='" + getDataSource() + '\'' + ", stream='" + getId() + '\'' + ", partitions=" + getPartitions() + ", replicas=" + getReplicas() + ", durationSeconds=" + getDurationSeconds() + ", active=" + getActiveTasks() + ", publishing=" + getPublishingTasks() + ", suspended=" + getSuspended() + '}'; }

Target:
public String toString() { return "KinesisSupervisorReportPayload{" + "dataSource='" + getDataSource() + '\'' + ", stream='" + getStream() + '\'' + ", partitions=" + getPartitions() + ", replicas=" + getReplicas() + ", durationSeconds=" + getDurationSeconds() + ", active=" + getActiveTasks() + ", publishing=" + getPublishingTasks() + ", suspended=" + getSuspended() + '}'; }
Source:
public void getRankedPassages(Args args) throws Exception { Map<String, Float> scoredDocs = retrieveDocuments(args.query, 100); Map<String, Float> sentencesMap = new LinkedHashMap<>(); IndexUtils util = new IndexUtils(args.index); TokenizerFactory<CoreLabel> tokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), ""); for (Map.Entry<String, Float> doc : scoredDocs.entrySet()) { List<Sentence> sentences = util.getSentDocument(doc.getKey()); for (Sentence sent : sentences) { List<CoreLabel> tokens = tokenizerFactory.getTokenizer(new StringReader(sent.text())).tokenize(); String answerTokens = tokens.stream() .map(CoreLabel::toString) .collect(Collectors.joining(" ")); sentencesMap.put(answerTokens, doc.getValue()); } } String queryTokens = tokenizerFactory.getTokenizer(new StringReader(args.query)).tokenize().stream() .map(CoreLabel::toString) .collect(Collectors.joining(" ")); scorer.score(queryTokens, sentencesMap); List<ScoredPassage> topPassages = scorer.extractTopPassages(); for (ScoredPassage s: topPassages) { System.out.println(s.getSentence() + " " + s.getScore()); } }

Target:
public void getRankedPassages(Args args) throws Exception { Map<String, Float> scoredDocs = retrieveDocuments(args.query, args.hits); Map<String, Float> sentencesMap = new LinkedHashMap<>(); IndexUtils util = new IndexUtils(args.index); TokenizerFactory<CoreLabel> tokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), ""); for (Map.Entry<String, Float> doc : scoredDocs.entrySet()) { List<Sentence> sentences = util.getSentDocument(doc.getKey()); for (Sentence sent : sentences) { List<CoreLabel> tokens = tokenizerFactory.getTokenizer(new StringReader(sent.text())).tokenize(); String answerTokens = tokens.stream() .map(CoreLabel::toString) .collect(Collectors.joining(" ")); sentencesMap.put(answerTokens, doc.getValue()); } } String queryTokens = tokenizerFactory.getTokenizer(new StringReader(args.query)).tokenize().stream() .map(CoreLabel::toString) .collect(Collectors.joining(" ")); scorer.score(queryTokens, sentencesMap); List<ScoredPassage> topPassages = scorer.extractTopPassages(); for (ScoredPassage s: topPassages) { System.out.println(s.getSentence() + " " + s.getScore()); } }
Source:
public void say(String message) { try { new MaryTTS.Speaker(message).start(); } catch (Exception e) { LOG.log(Level.SEVERE, "Impossible to speak for ''{0}''", Freedomotic.getStackTraceInfo(e)); } }

Target:
public void say(String message) { if (!message.isEmpty()) { try { new MaryTTS.Speaker(message).start(); } catch (Exception ex) { LOG.log(Level.SEVERE, "Impossible to speak for ''{0}''", ex); } } else { LOG.log(Level.WARNING, "Impossible to speak. Message is empty"); } }
Source:
public static boolean areApplicabilityTagsInvalid(String wordml, BranchId branch, HashCollection<String, String> validFeatureValues) { Matcher match = FEATURE_CONFIG_PATTERN.matcher(wordml); boolean isFeature = false; String expression = null; while (match.find()) { String plainText = textOnly(match.group()); if (plainText.startsWith("Feature")) { String start = textOnly(match.group(9)); String end = match.group(23); if (end != null) { end = textOnly(end); if (!start.equalsIgnoreCase(end)) { return true; } } isFeature = true; expression = "Feature" + textOnly(match.group(9)); } else if (plainText.startsWith("Configuration")) { String start = textOnly(match.group(38)); String end = match.group(58); if (end != null) { end = textOnly(end); if (!start.equalsIgnoreCase(end)) { return true; } } expression = "Configuration" + textOnly(match.group(38)); } if(isExpressionInvalid(expression, branch, validFeatureValues, isFeature)) { return true; } } return false; }

Target:
public static boolean areApplicabilityTagsInvalid(String wordml, BranchId branch, HashCollection<String, String> validFeatureValues) { Matcher match = FEATURE_CONFIG_PATTERN.matcher(wordml); boolean isFeature = false; String expression = null; while (match.find()) { String plainText = textOnly(match.group()); if (plainText.startsWith("Feature")) { int featStartTagGroup = 9; int featEndTagGroup = 23; String start = textOnly(match.group(featStartTagGroup)); String end = match.group(featEndTagGroup); if (end != null) { end = textOnly(end); if (!start.equalsIgnoreCase(end)) { return true; } } isFeature = true; expression = "Feature" + textOnly(match.group(featStartTagGroup)); } else if (plainText.startsWith("Configuration")) { int configStartTagGroup = 38; int configEndTagGroup = 58; String start = textOnly(match.group(configStartTagGroup)); String end = match.group(configEndTagGroup); if (end != null) { end = textOnly(end); if (!start.equalsIgnoreCase(end)) { return true; } } expression = "Configuration" + textOnly(match.group(configStartTagGroup)); } if (isExpressionInvalid(expression, branch, validFeatureValues, isFeature)) { return true; } } return false; }
Source:
public void preProcess(INDArray array, DistributionStats stats) { if (array.rank() == 2) { array.subiRowVector(stats.getMean()); array.diviRowVector(filteredStd(stats)); } else { Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getMean(), array, 1)); Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, filteredStd(stats), array, 1)); } }

Target:
public void preProcess(INDArray array, DistributionStats stats) { if (array.rank() <= 2) { array.subiRowVector(stats.getMean()); array.diviRowVector(filteredStd(stats)); } else { Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getMean(), array, 1)); Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, filteredStd(stats), array, 1)); } }
Source:
public void shutdown() throws InterruptedException { this.running = false; LOG.info("Shutting down GarbageCollectorThread"); while (!compacting.compareAndSet(false, true)) { wait(1000); } gcExecutor.shutdown(); if (gcExecutor.awaitTermination(60, TimeUnit.SECONDS)) { LOG.warn("GC executor did not shut down in 60 seconds. Killing"); gcExecutor.shutdownNow(); } }

Target:
public void shutdown() throws InterruptedException { this.running = false; LOG.info("Shutting down GarbageCollectorThread"); while (!compacting.compareAndSet(false, true)) { Thread.sleep(100); } gcExecutor.shutdown(); if (gcExecutor.awaitTermination(60, TimeUnit.SECONDS)) { LOG.warn("GC executor did not shut down in 60 seconds. Killing"); gcExecutor.shutdownNow(); } }
Source:
public void setMaxModelMemory(long numBytes) { if (numBytes <= 0) { throw new IllegalArgumentException("[" + MAX_MODEL_MEMORY.getPreferredName() + "] must be positive."); } this.maxModelMemory = numBytes; }

Target:
public void setMaxModelMemory(long numBytes) { if (numBytes < MIN_MODEL_MEMORY) { throw new IllegalArgumentException("[" + MAX_MODEL_MEMORY.getPreferredName() + "] must be at least 1mb."); } if (numBytes >= FORECAST_LOCAL_STORAGE_LIMIT.getBytes()) { throw ExceptionsHelper.badRequestException( "[{}] must be less than {}", MAX_MODEL_MEMORY.getPreferredName(), FORECAST_LOCAL_STORAGE_LIMIT.getStringRep()); } this.maxModelMemory = numBytes; }
Source:
void addPart(String name, TypedOutput body) { if (name == null) { throw new NullPointerException("Part name must not be null."); } if (body == null) { throw new NullPointerException("Part body must not be null."); } boolean first = (parts.size() == 0); byte[] part = buildPart(name, body, first); parts.add(part); length += part.length; }

Target:
void addPart(String name, TypedOutput body) { if (name == null) { throw new NullPointerException("Part name must not be null."); } if (body == null) { throw new NullPointerException("Part body must not be null."); } byte[] part = buildPart(name, body, parts.isEmpty()); parts.add(part); length += part.length; }
Source:
protected void transfer(IProgressMonitor monitor, Map<String, IProject> projectMapping, List<FileList> missingFiles) throws IOException, SarosCancellationException { try { stoppedLocalEditor = session.getStopManager().stop( session.getLocalUser(), "Read-only while negotiation!"); } catch (InterruptedException e) { log.error("while blocking local editor", e); Thread.currentThread().interrupt(); } for (Entry<String, IProject> entry : projectMapping.entrySet()) { final String projectID = entry.getKey(); final IProject project = entry.getValue(); session.addProjectMapping(projectID, project); } int filesMissing = 0; for (FileList list : missingFiles) filesMissing += list.getPaths().size(); Set<SPath> files = new HashSet<SPath>(filesMissing * 2); for (final FileList list : missingFiles) { IProject project = session.getProject(list.getProjectID()); for (String file : list.getPaths()) { files.add(new SPath(project.getFile(file))); } } awaitActivityQueueingActivation(monitor); activityQueuer = new ResourceActivityQueuer(files); session.registerQueuingHandler(activityQueuer); transmitter.send(ISarosSession.SESSION_CONNECTION_ID, getPeer(), StartActivityQueuingResponse.PROVIDER .create( new StartActivityQueuingResponse(getSessionID(), getID()))); checkCancellation(CancelOption.NOTIFY_PEER); if (filesMissing > 0) receiveStream(monitor, filesMissing); }

Target:
protected void transfer( IProgressMonitor monitor, Map<String, IProject> projectMapping, List<FileList> missingFiles) throws IOException, SarosCancellationException { for (Entry<String, IProject> entry : projectMapping.entrySet()) { final String projectID = entry.getKey(); final IProject project = entry.getValue(); session.addProjectMapping(projectID, project); } int missingFilesCount = missingFiles.stream().mapToInt(f -> f.getPaths().size()).sum(); Set<SPath> files = new HashSet<>(missingFilesCount * 2); for (FileList list : missingFiles) { IProject project = session.getProject(list.getProjectID()); for (String file : list.getPaths()) { files.add(new SPath(project.getFile(file))); } } awaitActivityQueueingActivation(monitor); activityQueuer.enableQueuing(files); transmitter.send( ISarosSession.SESSION_CONNECTION_ID, getPeer(), StartActivityQueuingResponse.PROVIDER.create( new StartActivityQueuingResponse(getSessionID(), getID()))); checkCancellation(CancelOption.NOTIFY_PEER); if (missingFilesCount > 0) { receiveStream(monitor, missingFilesCount); } }
Source:
protected void resolveLineTagLocations(String sourceName, String... tags) throws IOException { try (BufferedReader reader = new BufferedReader(new FileReader(SOURCE_PATH + sourceName))) { Set<String> tagsToFind = new HashSet<>(Arrays.asList(tags)); String line; int lineNumber = 1; int numberFound = 0; fTagLocations.clear(); line = reader.readLine(); while (line != null) { for (String tag : tagsToFind) { if (line.contains(tag)) { if (fTagLocations.containsKey(tag)) { throw new RuntimeException("Tag " + tag + " was found twice in " + sourceName); } fTagLocations.put(tag, lineNumber); numberFound++; break; } } lineNumber++; line = reader.readLine(); } if (numberFound != tagsToFind.size()) { throw new RuntimeException( "Some tags were not found in " + sourceName); } } }

Target:
protected void resolveLineTagLocations(String sourceName, String... tags) throws IOException { try (BufferedReader reader = new BufferedReader(new FileReader(SOURCE_PATH + sourceName))) { Set<String> tagsToFind = new HashSet<>(Arrays.asList(tags)); String line; int lineNumber = 1; int numberFound = 0; line = reader.readLine(); while (line != null) { for (String tag : tagsToFind) { if (line.contains(tag)) { if (fTagLocations.containsKey(tag)) { throw new RuntimeException("Tag " + tag + " was found twice in " + sourceName); } fTagLocations.put(tag, lineNumber); numberFound++; break; } } lineNumber++; line = reader.readLine(); } if (numberFound != tagsToFind.size()) { throw new RuntimeException( "Some tags were not found in " + sourceName); } } }
Source:
private void addTableToSource(final DatastoreConnection con) { if (con != null) { final Schema defaultSchema = con.getSchemaNavigator().getDefaultSchema(); final int datastoreSize = defaultSchema.getTables().length; if (datastoreSize <= 1) { final Column[] columns = defaultSchema.getTable(0).getColumns(); for (int i = 0; i < columns.length; i++) { if (!_analysisJobBuilder.containsSourceColumn(columns[i])) { _analysisJobBuilder.addSourceColumns(columns); } } } } }

Target:
private void addTableToSource(final DatastoreConnection con) { if (con != null) { final Schema defaultSchema = con.getSchemaNavigator().getDefaultSchema(); final int datastoreSize = defaultSchema.getTables().length; if (datastoreSize == 1) { final Column[] columns = defaultSchema.getTable(0).getColumns(); _analysisJobBuilder.addSourceColumns(columns); } } }
Source:
public Status insert(String table, String key, Map<String, ByteIterator> values) { try { user.setUserId(key); for (int i = 0; i < fieldCount; i++) { String field = FIELDS[i + 1]; int fieldIndex = i + 1; String fieldValue = values.get(field).toString(); user.put(fieldIndex, fieldValue); user.setDirty(fieldIndex); } dataStore.put(key, user); } catch (Exception e) { LOG.info("There is a problem inserting data \n"+ e.getMessage(), e); return Status.ERROR; } return Status.OK; }

Target:
public Status insert(String table, String key, Map<String, ByteIterator> values) { try { user.setUserId(key); for (int fieldCount = 0; fieldCount < totalFieldCount; fieldCount++) { String field = FIELDS[fieldCount + 1]; int fieldIndex = fieldCount + 1; String fieldValue = values.get(field).toString(); user.put(fieldIndex, fieldValue); user.setDirty(fieldIndex); } dataStore.put(key, user); } catch (Exception e) { LOG.info("There is a problem inserting data \n {}", e.getMessage(), e); return Status.ERROR; } return Status.OK; }
Source:
public FasteningElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { FasteningElement.Builder builder = FasteningElement.builder(); builder.setOriginId(parser.getAttributeValue("", FasteningElement.ATTR_ID)); if (ParserUtils.getBooleanAttribute(parser, FasteningElement.ATTR_CLEAR, false)) { builder.setClear(); } if (ParserUtils.getBooleanAttribute(parser, FasteningElement.ATTR_SHELL, false)) { builder.setShell(); } outerloop: while (true) { XmlPullParser.Event tag = parser.next(); switch (tag) { case START_ELEMENT: String name = parser.getName(); String namespace = parser.getNamespace(); if (MessageFasteningManager.NAMESPACE.equals(namespace) && ExternalElement.ELEMENT.equals(name)) { ExternalElement external = new ExternalElement( parser.getAttributeValue("", ExternalElement.ATTR_NAME), parser.getAttributeValue("", ExternalElement.ATTR_ELEMENT_NAMESPACE)); builder.addExternalPayload(external); continue; } ExtensionElement wrappedPayload = PacketParserUtils.parseExtensionElement(name, namespace, parser, xmlEnvironment); builder.addWrappedPayload(wrappedPayload); break; case END_ELEMENT: name = parser.getName(); namespace = parser.getNamespace(); if (FasteningElement.ELEMENT.equals(name) && MessageFasteningManager.NAMESPACE.equals(namespace)) { break outerloop; } break; default: break; } } return builder.build(); }

Target:
public FasteningElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { FasteningElement.Builder builder = FasteningElement.builder(); builder.setOriginId(parser.getAttributeValue("", FasteningElement.ATTR_ID)); if (ParserUtils.getBooleanAttribute(parser, FasteningElement.ATTR_CLEAR, false)) { builder.setClear(); } if (ParserUtils.getBooleanAttribute(parser, FasteningElement.ATTR_SHELL, false)) { builder.setShell(); } outerloop: while (true) { XmlPullParser.Event tag = parser.next(); switch (tag) { case START_ELEMENT: String name = parser.getName(); String namespace = parser.getNamespace(); if (MessageFasteningManager.NAMESPACE.equals(namespace) && ExternalElement.ELEMENT.equals(name)) { ExternalElement external = new ExternalElement( parser.getAttributeValue("", ExternalElement.ATTR_NAME), parser.getAttributeValue("", ExternalElement.ATTR_ELEMENT_NAMESPACE)); builder.addExternalPayload(external); continue; } ExtensionElement wrappedPayload = PacketParserUtils.parseExtensionElement(name, namespace, parser, xmlEnvironment); builder.addWrappedPayload(wrappedPayload); break; case END_ELEMENT: if (parser.getDepth() == initialDepth) { break outerloop; } break; default: break; } } return builder.build(); }
Source:
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { final Statement stmt = ((JdbcSchema) db).getConnection().createStatement(); try { final ResultSet rs = stmt.executeQuery( "SELECT account_id, display_patch_sets_in_reverse_order, " + " display_person_name_in_review_category " + "FROM accounts"); try { final List<Account> accountsToUpdate = new LinkedList<Account>(); while (rs.next()) { final boolean reversePatchSetOrder = rs.getBoolean(2); final boolean showUsernameInReviewCategory = rs.getBoolean(3); if (reversePatchSetOrder || showUsernameInReviewCategory) { final Account.Id id = new Account.Id(rs.getInt(1)); final Account account = db.accounts().get(id); final AccountGeneralPreferences prefs = account.getGeneralPreferences(); prefs.setReversePatchSetOrder(reversePatchSetOrder); prefs.setShowUsernameInReviewCategory(showUsernameInReviewCategory); accountsToUpdate.add(account); } } if (!accountsToUpdate.isEmpty()) { db.accounts().update(accountsToUpdate); } } finally { rs.close(); } } finally { stmt.close(); } }

Target:
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { final Statement stmt = ((JdbcSchema) db).getConnection().createStatement(); try { stmt.executeUpdate("UPDATE accounts SET reverse_patch_set_order = 'Y' "+ "WHERE display_patch_sets_in_reverse_order = 'Y'"); stmt.executeUpdate("UPDATE accounts SET show_username_in_review_category = 'Y' " + "WHERE display_person_name_in_review_category = 'Y'"); } finally { stmt.close(); } }
Source:
private void updateTissueMaterialDaoDependencies() { if (sampleService != null) sampleService.setTissueMaterialDao(tissueMaterialDao); updateSamplePurposeDaoDependencies(); }

Target:
private void updateTissueMaterialDaoDependencies() { if (sampleService != null) sampleService.setTissueMaterialDao(tissueMaterialDao); }
Source:
public Long getLastModified() { String updateTs = DefaultGroovyMethods.asType(super.get("updateTs"), String.class); return Strings.isNullOrEmpty(updateTs) ? null : Long.valueOf(updateTs); }

Target:
public Long getLastModified() { String updateTs = (String) super.get("updateTs"); return Strings.isNullOrEmpty(updateTs) ? null : Long.valueOf(updateTs); }
Source:
public String generateNewMachineUniqueName() { Object context = setup.peek(CloudLocationConfig.CALLER_CONTEXT); Entity entity = null; if (context instanceof Entity) entity = (Entity) context; String template = this.setup.get(MACHINE_NAME_TEMPLATE); if (!template.startsWith("#ftl\n")) template = "#ftl\n" + template; String processed; if (entity == null) processed = TemplateProcessor.processTemplateContents(template, this.setup.get(EXTRA_SUBSTITUTIONS)); else processed = TemplateProcessor.processTemplateContents(template, (EntityInternal)entity, this.setup.get(EXTRA_SUBSTITUTIONS)); return sanitize(Strings.getFragmentBetween(processed, "#ftl\n", null)).toLowerCase(); }

Target:
public String generateNewMachineUniqueName() { Object context = setup.peek(CloudLocationConfig.CALLER_CONTEXT); Entity entity = null; if (context instanceof Entity) { entity = (Entity) context; } String template = this.setup.get(MACHINE_NAME_TEMPLATE); String processed; if (entity == null) { processed = TemplateProcessor.processTemplateContents(template, this.setup.get(EXTRA_SUBSTITUTIONS)); } else { processed = TemplateProcessor.processTemplateContents(template, (EntityInternal)entity, this.setup.get(EXTRA_SUBSTITUTIONS)); } processed = Strings.removeFromStart(processed, "#ftl\n"); return sanitize(processed); }
Source:
protected static void addLocatorSuffix(Map<String, List<String>> locatorSuffixesMap, String key, String... values) { List<String> list = new ArrayList<>(Arrays.asList(values)); locatorSuffixesMap.put(key, list); }

Target:
protected static void addLocatorSuffix(Map<String, List<String>> locatorSuffixesMap, String key, String... values) { List<String> list = new ArrayList<>(); Collections.addAll(list, values); locatorSuffixesMap.put(key, list); }
Source:
private DiskImage createMetadaaDisk(Snapshot snapshot) { List<Guid> guids = GuidUtils.getGuidListFromString(snapshot.getMemoryVolume()); DiskImage memoryDisk = MemoryUtils.createMetadataDisk(); memoryDisk.setId(guids.get(4)); memoryDisk.setImageId(guids.get(5)); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(guids.get(0)))); memoryDisk.setStoragePoolId(guids.get(1)); memoryDisk.setCreationDate(snapshot.getCreationDate()); return memoryDisk; }

Target:
private DiskImage createMetadaaDisk(Snapshot snapshot) { List<Guid> guids = GuidUtils.getGuidListFromString(snapshot.getMemoryVolume()); StorageDomainStatic sd = isStorageDomainExists(snapshot, guids, guids.get(4), guids.get(5)); if (sd == null) return null; DiskImage memoryDisk = MemoryUtils.createMetadataDisk(); memoryDisk.setId(guids.get(4)); memoryDisk.setImageId(guids.get(5)); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(guids.get(0)))); memoryDisk.setStoragePoolId(guids.get(1)); memoryDisk.setCreationDate(snapshot.getCreationDate()); return memoryDisk; }
Source:
private Map<String, String> createAdditionalEnvironmentMap( final File jobDirectory, final JobSpecification jobSpec ) { final Map<String, String> envMap = Maps.newHashMap(); envMap.put( JobConstants.GENIE_JOB_DIR_ENV_VAR, jobDirectory.toString() ); envMap.put( JobConstants.GENIE_APPLICATION_DIR_ENV_VAR, PathUtils.jobApplicationsDirectoryPath(jobDirectory).toString() ); envMap.put( JobConstants.GENIE_COMMAND_DIR_ENV_VAR, PathUtils.jobCommandDirectoryPath(jobDirectory, jobSpec.getCommand().getId()).toString() ); envMap.put( JobConstants.GENIE_CLUSTER_DIR_ENV_VAR, PathUtils.jobClusterDirectoryPath(jobDirectory, jobSpec.getCluster().getId()).toString() ); return Collections.unmodifiableMap(envMap); }

Target:
private Map<String, String> createAdditionalEnvironmentMap( final File jobDirectory, final JobSpecification jobSpec ) { final ImmutableMap.Builder<String, String> mapBuilder = new ImmutableMap.Builder<>(); mapBuilder.put( JobConstants.GENIE_JOB_DIR_ENV_VAR, jobDirectory.toString() ); mapBuilder.put( JobConstants.GENIE_APPLICATION_DIR_ENV_VAR, PathUtils.jobApplicationsDirectoryPath(jobDirectory).toString() ); mapBuilder.put( JobConstants.GENIE_COMMAND_DIR_ENV_VAR, PathUtils.jobCommandDirectoryPath(jobDirectory, jobSpec.getCommand().getId()).toString() ); mapBuilder.put( JobConstants.GENIE_CLUSTER_DIR_ENV_VAR, PathUtils.jobClusterDirectoryPath(jobDirectory, jobSpec.getCluster().getId()).toString() ); return mapBuilder.build(); }
Source:
public static void main(final String[] args) { FormTrainingClient client = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); String targetResourceId = "target-resource-Id"; String targetResourceRegion = "target-resource-region"; final String copyModelId = "copy-model-Id"; final CopyAuthorization modelCopyAuthorization = client.getCopyAuthorization(targetResourceId, targetResourceRegion); SyncPoller<OperationResult, CustomFormModelInfo> copyPoller = client.beginCopyModel(copyModelId, modelCopyAuthorization); CustomFormModelInfo modelCopy = copyPoller.getFinalResult(); System.out.printf("Copied model has model Id: %s, model status: %s, was created on: %s," + " last updated on: %s.%n", modelCopy.getModelId(), modelCopy.getStatus(), modelCopy.getCreatedOn(), modelCopy.getLastUpdatedOn()); }

Target:
public static void main(final String[] args) { FormTrainingClient sourceClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); FormTrainingClient targetClient = new FormTrainingClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); String targetResourceId = "target-resource-Id"; String targetResourceRegion = "target-resource-region"; CopyAuthorization modelCopyAuthorization = targetClient.getCopyAuthorization(targetResourceId, targetResourceRegion); String copyModelId = "copy-model-Id"; SyncPoller<OperationResult, CustomFormModelInfo> copyPoller = sourceClient.beginCopyModel(copyModelId, modelCopyAuthorization); copyPoller.waitForCompletion(); CustomFormModel copiedModel = targetClient.getCustomModel(modelCopyAuthorization.getModelId()); System.out.printf("Copied model has model Id: %s, model status: %s, was created on: %s," + " transfer completed on: %s.%n", copiedModel.getModelId(), copiedModel.getModelStatus(), copiedModel.getRequestedOn(), copiedModel.getCompletedOn()); }
Source:
public CompletableFuture<SecurityToken> getToken(final String resource, final Duration timeout) { final MSICredentials credentials = new MSICredentials(); return CompletableFuture.supplyAsync(() -> { try { String rawToken = credentials.getToken(resource); return new JsonSecurityToken(rawToken, resource); } catch (IOException | ParseException e) { throw new CompletionException(e); } }); }

Target:
public CompletableFuture<SecurityToken> getToken(final String resource, final Duration timeout) { return CompletableFuture.supplyAsync(() -> { try { String rawToken = ManagedIdentityTokenProvider.credentials.getToken(ClientConstants.EVENTHUBS_AUDIENCE); return new JsonSecurityToken(rawToken, resource); } catch (IOException | ParseException e) { throw new CompletionException(e); } }); }
Source:
public static String getValueAsString(TelemetryBis.Telemetry msg, String name) { for (TelemetryBis.TelemetryField field : msg.getDataGpbkvList()) { TelemetryBis.TelemetryField subField = findFieldWithName(field, name); if (subField != null) { return subField.getStringValue(); } } return ""; }

Target:
public static String getValueAsString(TelemetryBis.Telemetry msg, String name) { if (Objects.isNull(msg) || Objects.isNull(name)) { return null; } for (TelemetryBis.TelemetryField field : msg.getDataGpbkvList()) { TelemetryBis.TelemetryField subField = findFieldWithName(field, name); if (subField != null) { return getStringValue(subField); } } return null; }
Source:
public boolean isEligibleJob(final String timestamp, final String name) { final Date searchedTimestamp; if (timestamp == null || Long.valueOf(timestamp) < 0) { return true; } else { searchedTimestamp = new Date(Long.valueOf(timestamp)); } final String timestampString = name.substring(name.lastIndexOf("-") + 1, name.indexOf(".")); final Date jobDate = new Date(Long.valueOf(timestampString)); if (jobDate.after(searchedTimestamp)) { return true; } return false; }

Target:
public boolean isEligibleJob(final String timestamp, final String name) { final Date searchedTimestamp; if (timestamp == null || Long.valueOf(timestamp) < 0) { return true; } else { searchedTimestamp = new Date(Long.valueOf(timestamp)); } final String timestampString = name.substring(name.lastIndexOf("-") + 1, name.indexOf(".")); final Date jobDate = new Date(Long.valueOf(timestampString)); return jobDate.after(searchedTimestamp); }