auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void multipleAssembliesUniqueNames() { AssemblyConfiguration assemblyConfigurationOne = new AssemblyConfiguration.Builder().name("foo").build(); AssemblyConfiguration assemblyConfigurationTwo = new AssemblyConfiguration.Builder().name("foo").build(); BuildImageConfiguration config = new BuildImageConfiguration.Builder(). assemblies(Arrays.asList(assemblyConfigurationOne, assemblyConfigurationTwo)).build(); try { config.initAndValidate(logger); } catch (IllegalArgumentException expected) { return; } fail("Should have failed."); }

Target:
public void multipleAssembliesUniqueNames() { AssemblyConfiguration assemblyConfigurationOne = new AssemblyConfiguration.Builder().name("foo").build(); AssemblyConfiguration assemblyConfigurationTwo = new AssemblyConfiguration.Builder().name("foo").build(); BuildImageConfiguration config = new BuildImageConfiguration.Builder(). assemblies(Arrays.asList(assemblyConfigurationOne, assemblyConfigurationTwo)).build(); config.initAndValidate(logger); }
Source:
public AdColonyBannerRenderer(MediationBannerAdConfiguration adConfiguration) { requestedZone = adConfiguration.getServerParameters().getString(AdColonyAdapterUtils.KEY_ZONE_ID); this.adSize = AdColonyAdapterUtils.adColonyAdSizeFromAdMobAdSize( adConfiguration.getContext(), adConfiguration.getAdSize()); }

Target:
public AdColonyBannerRenderer(MediationBannerAdConfiguration adConfiguration) { requestedZone = adConfiguration.getServerParameters().getString(AdColonyAdapterUtils.KEY_ZONE_ID); this.adSize = new AdColonyAdSize(convertPixelsToDp( adConfiguration.getAdSize().getWidthInPixels(adConfiguration.getContext())), convertPixelsToDp( adConfiguration.getAdSize().getHeightInPixels(adConfiguration.getContext()))); }
Source:
public static void checkPreJoinableClausesForDuplicatesAndShadowing( final List<PreJoinableClause> preJoinableClauses ) { List<String> prefixes = new ArrayList<>(); for (PreJoinableClause clause : preJoinableClauses) { prefixes.add(clause.getPrefix()); } checkPrefixesForDuplicatesAndShadowing(prefixes); }

Target:
private static void checkPreJoinableClausesForDuplicatesAndShadowing( final List<PreJoinableClause> preJoinableClauses ) { List<String> prefixes = new ArrayList<>(); for (PreJoinableClause clause : preJoinableClauses) { prefixes.add(clause.getPrefix()); } checkPrefixesForDuplicatesAndShadowing(prefixes); }
Source:
public void assertCommandExistsOnTimeOut(Integer timeout, Integer wait, String command, String search, String foo, Integer exitStatus) throws Exception { Boolean found = false; AssertionError ex = null; command = "set -o pipefail && alias grep='grep --color=never' && " + command; for (int i = 0; (i <= timeout); i += wait) { if (found) { break; } commonspec.getLogger().debug("Checking output value"); commonspec.getRemoteSSHConnection().runCommand(command); commonspec.setCommandResult(commonspec.getRemoteSSHConnection().getResult()); try { if (exitStatus != null) { assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(exitStatus); } assertThat(commonspec.getCommandResult()).as("Contains " + search + ".").contains(search); found = true; timeout = i; } catch (AssertionError e) { commonspec.getLogger().info("Command output don't found yet after " + i + " seconds"); Thread.sleep(wait * 1000); ex = e; } } if (!found) { throw (ex); } commonspec.getLogger().info("Command output found after " + timeout + " seconds"); }

Target:
public void assertCommandExistsOnTimeOut(Integer timeout, Integer wait, String command, String search, String foo, Integer exitStatus) throws Exception { Boolean found = false; AssertionError ex = null; command = "set -o pipefail && alias grep='grep --color=never' && " + command; for (int i = 0; (i <= timeout); i += wait) { if (found) { break; } commonspec.getLogger().debug("Checking output value"); commonspec.getRemoteSSHConnection().runCommand(command); commonspec.setCommandResult(commonspec.getRemoteSSHConnection().getResult()); try { if (exitStatus != null) { assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(exitStatus); } else { assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(0); } assertThat(commonspec.getCommandResult()).as("Contains " + search + ".").contains(search); found = true; timeout = i; } catch (AssertionError e) { commonspec.getLogger().info("Command output don't found yet after " + i + " seconds"); Thread.sleep(wait * 1000); ex = e; } } if (!found) { throw (ex); } commonspec.getLogger().info("Command output found after " + timeout + " seconds"); }
Source:
private static NotificationChannel createChannelAutoDownload(Context c) { NotificationChannel mChannel = new NotificationChannel( CHANNEL_ID_AUTO_DOWNLOAD, c.getString(R.string.notification_channel_auto_download), NotificationManager.IMPORTANCE_DEFAULT); mChannel.setDescription(c.getString(R.string.notification_channel_downloading_description)); return mChannel; }

Target:
private static NotificationChannel createChannelAutoDownload(Context c) { NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID_AUTO_DOWNLOAD, c.getString(R.string.notification_channel_auto_download), NotificationManager.IMPORTANCE_DEFAULT); mChannel.setDescription(c.getString(R.string.notification_channel_episode_auto_download)); return mChannel; }
Source:
public void initialize() throws IllegalStateException { initChildEntries(rootFile); serializer.store(rootFile.getName(), rootFile); if (LOGGER.isDebugEnabled()) { timer = new Timer(); timer.scheduleAtFixedRate(new LogProcessing(), LOGGING_TIME_DELAY, LOGGING_TIME_INTERVAL); } }

Target:
public void initialize() throws IllegalStateException { initChildEntries(rootFile); serializer.store(rootFile.getName(), rootFile); }
Source:
public ComparableComparator getInstance(){ return INSTANCE; }

Target:
public static ComparableComparator getInstance(){ return INSTANCE; }
Source:
private String mapInternalRestUri(final String httpUri) { if (httpUri.startsWith("info:/rest")) { String realpath = httpUri.substring(10); if (realpath.startsWith("/")) { realpath = realpath.substring(1); } final String fullUri = uriBuilder.build(realpath).toString(); return getPath(fullUri); } return null; }

Target:
private String mapInternalRestUri(final String httpUri) { final String internalRestString = internalIdPrefix() + "/rest"; if (httpUri.startsWith(internalRestString)) { String realpath = httpUri.substring(internalRestString.length()); if (realpath.startsWith("/")) { realpath = realpath.substring(1); } final String fullUri = uriBuilder.build(realpath).toString(); return getPath(fullUri); } return null; }
Source:
public DataNodeRemoteReplicaInfos(String datacenter, RemoteReplicaInfo remoteReplicaInfo) { this.datacenter = datacenter; this.dataNodeToReplicaLists = new HashMap<DataNodeId, List<RemoteReplicaInfo>>(); this.dataNodeToReplicaLists.put(remoteReplicaInfo.getReplicaId().getDataNodeId(), Arrays.asList(remoteReplicaInfo)); }

Target:
public DataNodeRemoteReplicaInfos(String datacenter, RemoteReplicaInfo remoteReplicaInfo) { this.datacenter = datacenter; this.dataNodeToReplicaLists = new HashMap<DataNodeId, List<RemoteReplicaInfo>>(); this.dataNodeToReplicaLists.put(remoteReplicaInfo.getReplicaId().getDataNodeId(), new ArrayList<RemoteReplicaInfo>(Arrays.asList(remoteReplicaInfo))); }
Source:
private Callable<Void> processRecoveredBufferTask(RecoveredInputChannel inputChannel, int totalStates, int[] states, boolean verifyRelease) { return () -> { int numProcessedStates = 0; while (numProcessedStates < totalStates) { if (verifyRelease && inputChannel.isReleased()) { break; } if (inputChannel.getNumberOfQueuedBuffers() == 0) { Thread.sleep(1); continue; } try { Optional<BufferAndAvailability> bufferAndAvailability = inputChannel.getNextBuffer(); if (bufferAndAvailability.isPresent()) { Buffer buffer = bufferAndAvailability.get().buffer(); BufferBuilderAndConsumerTest.assertContent(buffer, null, states); buffer.recycleBuffer(); numProcessedStates++; } } catch (Throwable t) { assertTrue("The expected exception should only happen in the case of released channel.", verifyRelease && inputChannel.isReleased()); } } return null; }; }

Target:
private Callable<Void> processRecoveredBufferTask(RecoveredInputChannel inputChannel, int totalStates, int[] states, boolean verifyRelease) { return () -> { int numProcessedStates = 0; while (numProcessedStates < totalStates) { if (verifyRelease && inputChannel.isReleased()) { break; } if (inputChannel.getNumberOfQueuedBuffers() == 0) { Thread.sleep(1); continue; } try { Optional<BufferAndAvailability> bufferAndAvailability = inputChannel.getNextBuffer(); if (bufferAndAvailability.isPresent()) { Buffer buffer = bufferAndAvailability.get().buffer(); BufferBuilderAndConsumerTest.assertContent(buffer, null, states); buffer.recycleBuffer(); numProcessedStates++; } } catch (Throwable t) { if (!(verifyRelease && inputChannel.isReleased())) { throw new AssertionError("Exceptions are expected here only if the input channel was released", t); } } } return null; }; }
Source:
boolean matchesTableAlias(String tableAlias) { return m_tableAlias == null || m_tableAlias.equals(tableAlias); }

Target:
boolean matchesTableAlias(String tableAlias) { if (m_tableAlias == null) { return m_tableName.equals(tableAlias); } else { return m_tableAlias.equals(tableAlias); } }
Source:
public boolean affectsSpawning() { return this.affectsSpawning; }

Target:
public boolean affectsSpawning() { return this.affectsSpawning && !this.isSpectator(); }
Source:
private void image(@NonNull FeaturedImage image) { if (containerView.getWidth() == 0) { containerView.getViewTreeObserver().addOnGlobalLayoutListener(() -> loadImage(image)); } else { loadImage(image); } }

Target:
private void image(@NonNull FeaturedImage image) { containerView.post(() -> loadImage(image)); }
Source:
private void findContentRenames(ContentSource.Pair reader, ProgressMonitor pm) throws IOException { int cnt = Math.max(added.size(), deleted.size()); if (getRenameLimit() == 0 || cnt <= getRenameLimit()) { SimilarityRenameDetector d; d = new SimilarityRenameDetector(reader, deleted, added); d.setRenameScore(getRenameScore()); d.compute(pm); overRenameLimit |= d.isTableOverflow(); deleted = d.getLeftOverSources(); added = d.getLeftOverDestinations(); entries.addAll(d.getMatches()); } else { overRenameLimit = true; } }

Target:
private void findContentRenames(ContentSource.Pair reader, ProgressMonitor pm) throws IOException, CanceledException { int cnt = Math.max(added.size(), deleted.size()); if (getRenameLimit() == 0 || cnt <= getRenameLimit()) { SimilarityRenameDetector d; d = new SimilarityRenameDetector(reader, deleted, added); d.setRenameScore(getRenameScore()); d.compute(pm); overRenameLimit |= d.isTableOverflow(); deleted = d.getLeftOverSources(); added = d.getLeftOverDestinations(); entries.addAll(d.getMatches()); } else { overRenameLimit = true; } }
Source:
public static PaymentForSearchResult valueOf( ChargeFromResponse paymentResult, URI selfLink, URI paymentEventsLink, URI paymentCancelLink, URI paymentRefundsLink) { return new PaymentForSearchResult( paymentResult.getChargeId(), paymentResult.getAmount(), paymentResult.getState(), paymentResult.getReturnUrl(), paymentResult.getDescription(), paymentResult.getReference(), paymentResult.getEmail(), paymentResult.getPaymentProvider(), paymentResult.getCardLabel(), paymentResult.getCreated_date(), paymentResult.getRefundSummary(), selfLink, paymentEventsLink, paymentCancelLink, paymentRefundsLink); }

Target:
public static PaymentForSearchResult valueOf( ChargeFromResponse paymentResult, URI selfLink, URI paymentEventsLink, URI paymentCancelLink, URI paymentRefundsLink) { return new PaymentForSearchResult( paymentResult.getChargeId(), paymentResult.getAmount(), paymentResult.getState(), paymentResult.getReturnUrl(), paymentResult.getDescription(), paymentResult.getReference(), paymentResult.getEmail(), paymentResult.getPaymentProvider(), paymentResult.getCardBrand(), paymentResult.getCreated_date(), paymentResult.getRefundSummary(), selfLink, paymentEventsLink, paymentCancelLink, paymentRefundsLink); }
Source:
public void testClickContactOpensMap() throws JSONException, InterruptedException { getMockDispatcher().setPlacesResponse(new MockResponse().setBody(MockJsonUtils.getPlacesJson())); String[] contactEmails = (new String[]{"family.member@example.com"}); JSONObject location = new JSONObject(); location.put("lat", "37.483477313364574") .put("lon", "-122.14838393032551") .put("rad", "100"); JSONObject[] locations = (new JSONObject[]{location}); getMockDispatcher().setDashboardResponse(new MockResponse().setBody(MockJsonUtils .getDashboardJsonContactsUserLocation(contactEmails, locations, location))); enterPlacesScreen(); onView(withContentDescription("family.member@example.com")).perform(click()); onView(withId(R.id.map)).check(matches(isDisplayed())); }

Target:
public void testClickContactOpensMap() throws JSONException, InterruptedException { getMockDispatcher().setPlacesResponse(new MockResponse().setBody(MockJsonUtils.getPlacesJson())); String[] contactEmails = new String[]{"family.member@example.com"}; JSONObject location = new JSONObject(); location.put("lat", "37.483477313364574") .put("lon", "-122.14838393032551") .put("rad", "100"); JSONObject[] locations = new JSONObject[]{location}; getMockDispatcher().setDashboardResponse(new MockResponse().setBody(MockJsonUtils .getDashboardJsonContactsUserLocation(contactEmails, locations, location))); enterPlacesScreen(); onView(withContentDescription("family.member@example.com")).perform(click()); onView(withId(R.id.map)).check(matches(isDisplayed())); }
Source:
public void set6ByteLong( long index, int offset, long value ) { long pageId = pageId( index ); offset += offset( index ); try ( PageCursor cursor = pagedFile.io( pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW ); ) { cursor.next(); cursor.putInt( offset, (int) value ); cursor.putShort( offset + Integer.BYTES, (short) (value >>> 32) ); checkBounds( cursor ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }

Target:
public void set6ByteLong( long index, int offset, long value ) { long pageId = pageId( index ); offset += offset( index ); try ( PageCursor cursor = pagedFile.io( pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW ) ) { cursor.next(); cursor.putInt( offset, (int) value ); cursor.putShort( offset + Integer.BYTES, (short) (value >>> Integer.SIZE) ); checkBounds( cursor ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }
Source:
protected void line(PrintStream out, double x, double y, double resolution) throws IOException { x = isFlipXaxis() ? getBedWidth() - Util.px2mm(x, resolution) : Util.px2mm(x, resolution); y = isFlipYaxis() ? getBedHeight() - Util.px2mm(y, resolution) : Util.px2mm(y, resolution); String append = ""; if (nextPower != currentPower) { append += String.format(FORMAT_LOCALE, " S%d", (int) nextPower); currentPower = nextPower; } if (nextSpeed != currentSpeed) { append += String.format(FORMAT_LOCALE, " F%d", (int) (max_speed*nextSpeed/100.0)); currentSpeed = nextSpeed; } sendLine("G1 X%.3f Y%.3f"+append, x, y); }

Target:
protected void line(PrintStream out, double x, double y, double resolution) throws IOException { x = isFlipXaxis() ? getBedWidth() - Util.px2mm(x, resolution) : Util.px2mm(x, resolution); y = isFlipYaxis() ? getBedHeight() - Util.px2mm(y, resolution) : Util.px2mm(y, resolution); String line = "G1"; if (x != currentX) { if (resolution >= 254) { line += String.format(FORMAT_LOCALE, "X%.3f", x); } else { line += String.format(FORMAT_LOCALE, "X%.2f", x); } currentX = x; } if (y != currentY) { if (resolution >= 254) { line += String.format(FORMAT_LOCALE, "Y%.3f", y); } else { line += String.format(FORMAT_LOCALE, "Y%.2f", y); } currentY = y; } if (nextPower != currentPower) { line += String.format(FORMAT_LOCALE, "S%.2f", nextPower); currentPower = nextPower; } if (nextSpeed != currentSpeed) { line += String.format(FORMAT_LOCALE, "F%d", (int) (max_speed*nextSpeed/100.0)); currentSpeed = nextSpeed; } sendLine(line); }
Source:
protected boolean validateMacAddress(VmNetworkInterface iface) { if (!Regex.IsMatch(iface.getMacAddress(), VmNetworkInterface.VALID_MAC_ADDRESS_FORMAT)) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MacAddress", iface.getMacAddress()); logable.AddCustomValue("IfaceName", iface.getName()); AuditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_IMPORT_INTERFACES_WITH_INVALID_MAC_ADDRESS); addCanDoActionMessage(VdcBllMessages.VM_IMPORT_INTERFACES_WITH_INVALID_MAC_ADDRESS); return false; } return true; }

Target:
protected boolean validateMacAddress(VmNetworkInterface iface) { if (!StringUtils.isEmpty(iface.getMacAddress()) && !validMacAddress.matcher(iface.getMacAddress()).matches()) { addCanDoActionMessage("$IfaceName " + iface.getName()); addCanDoActionMessage("$MacAddress " + iface.getMacAddress()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_INTERFACE_INVALID); return false; } return true; }
Source:
protected InputChannel( SingleInputGate inputGate, int channelIndex, ResultPartitionID partitionId, int initialBackoff, int maxBackoff, Counter numBytesIn, Counter numBuffersIn) { int initial = initialBackoff; int max = maxBackoff; checkArgument(initial >= 0 && initial <= max); this.inputGate = checkNotNull(inputGate); this.channelInfo = new InputChannelInfo(inputGate.getGateIndex(), channelIndex); this.partitionId = checkNotNull(partitionId); this.initialBackoff = initial; this.maxBackoff = max; this.currentBackoff = initial == 0 ? -1 : 0; this.numBytesIn = numBytesIn; this.numBuffersIn = numBuffersIn; }

Target:
protected InputChannel( SingleInputGate inputGate, int channelIndex, ResultPartitionID partitionId, int initialBackoff, int maxBackoff, Counter numBytesIn, Counter numBuffersIn) { checkArgument(channelIndex >= 0); int initial = initialBackoff; int max = maxBackoff; checkArgument(initial >= 0 && initial <= max); this.inputGate = checkNotNull(inputGate); this.channelInfo = new InputChannelInfo(inputGate.getGateIndex(), channelIndex); this.partitionId = checkNotNull(partitionId); this.initialBackoff = initial; this.maxBackoff = max; this.currentBackoff = initial == 0 ? -1 : 0; this.numBytesIn = numBytesIn; this.numBuffersIn = numBuffersIn; }
Source:
private byte[] buildPart(String name, TypedOutput body, boolean first) { ByteArrayOutputStream out = null; try { out = new ByteArrayOutputStream(); out.write(buildBoundary(boundary, first, false)); out.write(buildHeader(name, body)); body.writeTo(out); return out.toByteArray(); } catch (IOException ex) { throw new RuntimeException(ex); } finally { if (out != null) { try { out.close(); } catch (IOException ignored) { } } } }

Target:
private byte[] buildPart(String name, TypedOutput body, boolean first) { ByteArrayOutputStream out = null; try { out = new ByteArrayOutputStream(); out.write(buildBoundary(boundary, first, false)); out.write(buildHeader(name, body)); body.writeTo(out); return out.toByteArray(); } catch (IOException ex) { throw new RuntimeException("Unable to write multipart request.", ex); } finally { if (out != null) { try { out.close(); } catch (IOException ignored) { } } } }
Source:
private LogRecordWithInputStream nextLogRecord() throws IOException { try { return nextLogRecord(reader); } catch (EndOfStreamException e) { eos = true; return null; } }

Target:
private LogRecordWithInputStream nextLogRecord() throws IOException { try { return nextLogRecord(reader); } catch (EndOfStreamException e) { eos = true; LOG.info(()->"end of stream is reached"); return null; } }
Source:
public static InitializedInputVariable createCustomInput(String parentId, VariableDeclaration varDecl, String expression) { String isExpressionPattern = "^#\\{(.+)}$"; String decodedExpression = decode(expression); if (decodedExpression.matches(isExpressionPattern)) { return new InputExpression(parentId, varDecl, decodedExpression); } else { return new InputConstant(parentId, varDecl, decodedExpression); } }

Target:
public static InitializedInputVariable createCustomInput(String parentId, VariableDeclaration varDecl, String expression) { String decodedExpression = decode(expression); if (EXPRESSION.matcher(decodedExpression).matches()) { return new InputExpression(parentId, varDecl, decodedExpression); } else { return new InputConstant(parentId, varDecl, decodedExpression); } }
Source:
public String render(final GetBucketResult result) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(result); }

Target:
public String render(final GetBucketResult result) throws JsonProcessingException { final ObjectMapper mapper = new ObjectMapper(); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(result); }
Source:
private SourceSystemId parseSource(LahdejarjestelmaIdReturnVal lahdejarjestelmaIdReturnVal) { String id = lahdejarjestelmaIdReturnVal.getId(); if (StringUtils.isNotBlank(id) && id.contains(":")) { KoskiStudyProgrammeHandler handler = KoskiStudyProgrammeHandler.valueOf(id.substring(0, id.indexOf(':'))); Long studentId = Long.valueOf(id.substring(id.indexOf(':') + 1)); return new SourceSystemId(handler, studentId); } return null; }

Target:
private SourceSystemId parseSource(LahdejarjestelmaIdReturnVal lahdejarjestelmaIdReturnVal) { String id = lahdejarjestelmaIdReturnVal.getId(); if (StringUtils.isNotBlank(id) && id.contains(":")) { KoskiStudyProgrammeHandler handler = KoskiStudyProgrammeHandler.valueOf(StringUtils.substringBefore(id, ":")); Long studentId = Long.valueOf(StringUtils.substringAfter(id, ":")); return new SourceSystemId(handler, studentId); } return null; }
Source:
private void init() { FirebaseApp.initializeApp(this); RxJavaPlugins.setErrorHandler(new DefaultRxErrorHandler(analytics)); final Scheduler asyncMainThreadScheduler = AndroidSchedulers.from(Looper.getMainLooper(), true); RxAndroidPlugins.setInitMainThreadSchedulerHandler(scheduler -> asyncMainThreadScheduler); flex.initialize(); userPreferenceManager.initialize(); purchaseManager.initialize(this); orderingPreferencesManager.initialize(); dateFormatter.initialize(); onLaunchDataPreFetcher.loadUserData(); identityManager.initialize(); pushManager.initialize(); cognitoManager.initialize(); ocrManager.initialize(); crashReporter.initialize(userPreferenceManager.get(UserPreference.Privacy.EnableCrashTracking)); receiptsOrderer.initialize(); picassoInitializer.initialize(); markedForDeletionCleaner.safelyDeleteAllOutstandingItems(); memoryLeakMonitor.initialize(); extraInitializer.init(); PDFBoxResourceLoader.init(getApplicationContext()); Completable.fromAction(() -> new SmartReceiptsTemporaryFileCache(this).resetCache()) .subscribeOn(Schedulers.io()) .subscribe(); appVersionManager.onLaunch(); appRatingPreferencesStorage.incrementLaunchCount(); }

Target:
private void init() { RxJavaPlugins.setErrorHandler(new DefaultRxErrorHandler(analytics)); final Scheduler asyncMainThreadScheduler = AndroidSchedulers.from(Looper.getMainLooper(), true); RxAndroidPlugins.setInitMainThreadSchedulerHandler(scheduler -> asyncMainThreadScheduler); flex.initialize(); userPreferenceManager.initialize(); purchaseManager.initialize(this); orderingPreferencesManager.initialize(); dateFormatter.initialize(); onLaunchDataPreFetcher.loadUserData(); identityManager.initialize(); pushManager.initialize(); cognitoManager.initialize(); ocrManager.initialize(); crashReporter.initialize(userPreferenceManager.get(UserPreference.Privacy.EnableCrashTracking)); receiptsOrderer.initialize(); picassoInitializer.initialize(); markedForDeletionCleaner.safelyDeleteAllOutstandingItems(); memoryLeakMonitor.initialize(); extraInitializer.init(); PDFBoxResourceLoader.init(getApplicationContext()); Completable.fromAction(() -> new SmartReceiptsTemporaryFileCache(this).resetCache()) .subscribeOn(Schedulers.io()) .subscribe(); appVersionManager.onLaunch(); appRatingPreferencesStorage.incrementLaunchCount(); }
Source:
public void visitForStatement(ForStatementTree tree) { List<UnaryExpressionTree> unaryOperations = tree.update().stream() .filter(expression -> expression.is(Kind.PREFIX_INCREMENT, Kind.PREFIX_DECREMENT, Kind.POSTFIX_INCREMENT, Kind.POSTFIX_DECREMENT)) .map(UnaryExpressionTree.class::cast) .collect(Collectors.toList()); if (!unaryOperations.isEmpty() && !tree.condition().isEmpty()) { checkCondition(tree.condition().get(tree.condition().size() - 1), unaryOperations); } super.visitForStatement(tree); }

Target:
public void visitForStatement(ForStatementTree tree) { List<ExpressionTree> updates = tree.update().stream() .filter(expression -> updateKind(expression) != UpdateKind.UNKNOWN) .collect(Collectors.toList()); ExpressionTree forCondition = CheckUtils.getForCondition(tree); if (forCondition != null && !updates.isEmpty()) { checkCondition(forCondition, updates); } super.visitForStatement(tree); }
Source:
private void processSingleResultMCDC(String resultPath, Matcher m) { DispoItemData item = datIdToItem.get(generateDatId(m.group(1), m.group(2))); Integer lineNumber = Integer.valueOf(m.group(3)); Integer bitsTrue = Integer.valueOf(m.group(4)); Integer bitsUsed = Integer.valueOf(m.group(5)); Map<String, Boolean> bitsTrueMap = getBitToBoolean(Integer.toString(bitsTrue, 2), Integer.toString(bitsUsed, 2)); for (String abbrevCond : bitsTrueMap.keySet()) { String TorF = bitsTrueMap.get(abbrevCond) ? "T" : "F"; String location = String.format("%s.%s.%s", lineNumber, abbrevCond, TorF); Discrepancy matchingDiscrepancy = matchDiscrepancy(location, item.getDiscrepanciesList()); if (matchingDiscrepancy != null) { String text = matchingDiscrepancy.getText(); Map<String, Discrepancy> discrepancies = item.getDiscrepanciesList(); discrepancies.remove(matchingDiscrepancy.getId()); item.setDiscrepanciesList(discrepancies); addAnnotationForForCoveredLine(item, location, Test_Unit_Resolution, resultPath, text); } else { System.out.println(""); } } }

Target:
private void processSingleResultMCDC(String resultPath, Matcher m) { DispoItemData item = datIdToItem.get(generateDatId(m.group(1), m.group(2))); if(item != null) { Integer lineNumber = Integer.valueOf(m.group(3)); Integer bitsTrue = Integer.valueOf(m.group(4)); Integer bitsUsed = Integer.valueOf(m.group(5)); Map<String, Boolean> bitsTrueMap = getBitToBoolean(Integer.toString(bitsTrue, 2), Integer.toString(bitsUsed, 2)); for (String abbrevCond : bitsTrueMap.keySet()) { String TorF = bitsTrueMap.get(abbrevCond) ? "T" : "F"; String location = String.format("%s.%s.%s", lineNumber, abbrevCond, TorF); Discrepancy matchingDiscrepancy = matchDiscrepancy(location, item.getDiscrepanciesList()); if (matchingDiscrepancy != null) { String text = matchingDiscrepancy.getText(); Map<String, Discrepancy> discrepancies = item.getDiscrepanciesList(); discrepancies.remove(matchingDiscrepancy.getId()); item.setDiscrepanciesList(discrepancies); addAnnotationForForCoveredLine(item, location, Test_Unit_Resolution, resultPath, text); } } } }
Source:
private String formatLogStmt(String statement) { if (statement == null) { return "sqlHash=null, statement=null"; } synchronized(this) { if (statement.equals(lastLogStmt)) { return lastLogStmtFormat; } String hash = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.reset(); md.update(statement.getBytes("UTF-8")); hash = new BigInteger(1, md.digest()).toString(16); } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { stmtLogger.error("Cannot encode statement " + statement, e); } String subStatement = statement; if (maxStatementLogLen >= 0 && maxStatementLogLen < statement.length()) { subStatement = statement.substring(0, maxStatementLogLen) + " ... "; } subStatement = StringUtils.maskMessage(subStatement, StringUtils.maskPasswordPattern,StringUtils.maskString); if (maxStatementLogLen >= 0 && maxStatementLogLen < subStatement.length()) { subStatement = subStatement.substring(0, maxStatementLogLen) + " ... "; } String result = String.format("sqlHash=%s, statement=[ %s ]", hash, subStatement); lastLogStmt = statement; lastLogStmtFormat = result; return result; } }

Target:
private String formatLogStmt(String statement) { if (statement == null) { return "sqlHash=null, statement=null"; } synchronized(this) { if (statement.equals(lastLogStmt)) { return lastLogStmtFormat; } String hash = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.reset(); md.update(statement.getBytes("UTF-8")); hash = new BigInteger(1, md.digest()).toString(16); } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { stmtLogger.error("Cannot encode statement " + statement, e); } String subStatement = statement; if (maxStatementLogLen >= 0 && maxStatementLogLen < statement.length()) { subStatement = statement.substring(0, maxStatementLogLen) + " ... "; } String result = String.format("sqlHash=%s, statement=[ %s ]", hash, subStatement); lastLogStmt = statement; lastLogStmtFormat = result; return result; } }
Source:
protected String getProcessedUrl( IMetaStore metastore, String url ) { if ( url == null ) { return null; } if ( metastore == null ) { if ( Spoon.getInstance() != null ) { metaStore = Spoon.getInstance().getMetaStore(); } } else { metaStore = metastore; } NamedCluster c = null; if ( metaStore != null ) { c = namedClusterService.getNamedClusterByName( sourceConfigurationName, metaStore ); } else { if ( namedClusterService.getClusterTemplate() != null ) { c = namedClusterService.getClusterTemplate().fromXmlForEmbed( embeddedNamedClusterNode ); } } if ( c != null ) { url = c.processURLsubstitution( url, metaStore, new Variables() ); } return url; }

Target:
protected String getProcessedUrl( IMetaStore metastore, String url ) { if ( url == null ) { return null; } if ( metastore == null ) { try { metaStore = MetaStoreConst.openLocalPentahoMetaStore( false ); } catch ( Exception e ) { } } else { metaStore = metastore; } NamedCluster c = null; if ( metaStore != null ) { c = namedClusterService.getNamedClusterByName( sourceConfigurationName, metaStore ); } else { if ( namedClusterService.getClusterTemplate() != null ) { c = namedClusterService.getClusterTemplate().fromXmlForEmbed( embeddedNamedClusterNode ); } } if ( c != null ) { url = c.processURLsubstitution( url, metaStore, new Variables() ); } return url; }
Source:
public static String generateSequence(int len, int skipPeriod, int skipLength) { StringBuilder text = new StringBuilder(); int skipStart = skipPeriod - skipLength; int skippedChars = 0; for (int i = 0; i - skippedChars < len; ++i) { if (skipPeriod == 0 || i % skipPeriod < skipStart) { text.append((char) (32 + i % 95)); } else { skippedChars++; } } return (text.toString()); }

Target:
public static String generateSequence(int len, int skipPeriod, int skipLength) { StringBuilder text = new StringBuilder(len); int skipStart = skipPeriod - skipLength; int skippedChars = 0; for (int i = 0; i - skippedChars < len; ++i) { if (skipPeriod == 0 || i % skipPeriod < skipStart) { text.append((char) (32 + i % 95)); } else { skippedChars++; } } return text.toString(); }
Source:
public void setupProperties() { super.setupProperties(); manualQuery.setValue(false); query.setTaggedValue(ComponentConstants.LINE_SEPARATOR_REPLACED_TO, " "); convertColumnsAndTableToUppercase.setValue(true); }

Target:
public void setupProperties() { super.setupProperties(); manualQuery.setValue(false); query.setTaggedValue(ComponentConstants.LINE_SEPARATOR_REPLACED_TO, " "); }
Source:
public ResponseEntity deleteStringPattern(@PathVariable("tenant") final String tenant, @PathVariable("name") final String name) throws IOException { _referenceDataDao.removeStringPattern(_contextFactory.getContext(tenant), name); return ResponseEntity.noContent().build(); }

Target:
public ResponseEntity<Void> deleteStringPattern(@PathVariable("tenant") final String tenant, @PathVariable("name") final String name) throws IOException { _referenceDataDao.removeStringPattern(_contextFactory.getContext(tenant), name); return ResponseEntity.noContent().build(); }
Source:
public static void checkFetchHints(EnumSet<FetchHint> fetchHints, FetchHint neededFetchHint) { if (!fetchHints.contains(neededFetchHint)) { throw new VertexiumMissingFetchHintException(fetchHints, EnumSet.of(neededFetchHint)); } }

Target:
public static void checkFetchHints(EnumSet<FetchHint> fetchHints, FetchHint neededFetchHint) { checkFetchHints(fetchHints, EnumSet.of(neededFetchHint)); }
Source:
private static void writeContents( FileSystemAbstraction fileSystemAbstraction, File file, String contents ) { byte[] bytes = contents.getBytes(); try ( StoreChannel storeChannel = fileSystemAbstraction.create( file ) ) { storeChannel.write( ByteBuffer.wrap( bytes ) ); storeChannel.close(); } catch ( IOException e ) { throw new RuntimeException( e ); } }

Target:
private static void writeContents( FileSystemAbstraction fileSystemAbstraction, File file, String contents ) { byte[] bytes = contents.getBytes(); try ( StoreChannel storeChannel = fileSystemAbstraction.create( file ) ) { storeChannel.write( ByteBuffer.wrap( bytes ) ); } catch ( IOException e ) { throw new RuntimeException( e ); } }
Source:
public boolean isSystemLibrary() { String value = attributes.get(TAG_SYSTEMLIBRARY); if (value == null) { return false; } return Boolean.parseBoolean(value); }

Target:
public boolean isSystemLibrary() { return this.isSystemLibrary; }
Source:
public void addsPath() throws IOException { MatcherAssert.assertThat( new Href("<LINK_2>").path("c").path("d").toString(), Matchers.equalTo("<LINK_0>") ); }

Target:
public void addsPath() throws IOException { MatcherAssert.assertThat( new Href("<LINK_2>").path("c").path("d").toString(), Matchers.equalTo("<LINK_0>") ); MatcherAssert.assertThat( new Href("<LINK_1>").path("e").path("f").toString(), Matchers.equalTo("<LINK_1>e/f") ); }
Source:
public Disposable scheduleDirect(@NonNull Runnable run) { ObjectHelper.requireNonNull(run, "runnable is null"); run.run(); return EmptyDisposable.INSTANCE; }

Target:
public Disposable scheduleDirect(@NonNull Runnable run) { RxJavaPlugins.onSchedule(run).run(); return EmptyDisposable.INSTANCE; }
Source:
private RepoCollectionMetadata fetchArticleCollection(ArticleIdentity id) { String identifier = id.getIdentifier(); Optional<Integer> versionNumber = id.getVersionNumber(); RepoCollectionMetadata collection; try { if (versionNumber.isPresent()) { collection = contentRepoService.getCollection(new RepoVersionNumber(identifier, versionNumber.get())); } else { collection = contentRepoService.getLatestCollection(identifier); } } catch(NotFoundException nfe) { throw entityNotFound(nfe.getMessage() + ": " + identifier); } return collection; }

Target:
private RepoCollectionMetadata fetchArticleCollection(ArticleIdentity id) { String identifier = id.getIdentifier(); Optional<Integer> versionNumber = id.getVersionNumber(); RepoCollectionMetadata collection; try { if (versionNumber.isPresent()) { collection = contentRepoService.getCollection(new RepoVersionNumber(identifier, versionNumber.get())); } else { collection = contentRepoService.getLatestCollection(identifier); } } catch(NotFoundException nfe) { throw reportNotFound(id, "collection", nfe); } return collection; }
Source:
public List<ValidationMessage> validateForRefOperation() throws RefOperationValidationException { List<ValidationMessage> messages = Lists.newLinkedList(); boolean withException = false; try { for (RefOperationValidationListener listener : refOperationValidationListeners) { messages.addAll(listener.onRefOperation(event)); } } catch (ValidationException e) { messages.add(new ValidationMessage(e.getMessage(), true)); withException = true; } finally { if (withException) { throwException(messages, event); } } return messages; }

Target:
public List<ValidationMessage> validateForRefOperation() throws RefOperationValidationException { List<ValidationMessage> messages = Lists.newArrayList(); boolean withException = false; try { for (RefOperationValidationListener listener : refOperationValidationListeners) { messages.addAll(listener.onRefOperation(event)); } } catch (ValidationException e) { messages.add(new ValidationMessage(e.getMessage(), true)); withException = true; } if (withException) { throwException(messages, event); } return messages; }
Source:
public DBObject convert(Variant object) { String id = Variant.buildVariantId(object.getChromosome(), object.getStart(), object.getReference(), object.getAlternate()); BasicDBObject mongoVariant = new BasicDBObject("_id", id) .append(TYPE_FIELD, object.getType().name()) .append(CHROMOSOME_FIELD, object.getChromosome()) .append(START_FIELD, object.getStart()) .append(END_FIELD, object.getEnd()) .append(LENGTH_FIELD, object.getLength()) .append(REFERENCE_FIELD, object.getReference()) .append(ALTERNATE_FIELD, object.getAlternate()); appendAt(object, mongoVariant); appendHgvs(object, mongoVariant); appendFiles(object, mongoVariant); appendStatistics(object, mongoVariant); return mongoVariant; }

Target:
public DBObject convert(Variant object) { String id = object.buildVariantId(); BasicDBObject mongoVariant = new BasicDBObject("_id", id) .append(TYPE_FIELD, object.getType().name()) .append(CHROMOSOME_FIELD, object.getChromosome()) .append(START_FIELD, object.getStart()) .append(END_FIELD, object.getEnd()) .append(LENGTH_FIELD, object.getLength()) .append(REFERENCE_FIELD, object.getReference()) .append(ALTERNATE_FIELD, object.getAlternate()); appendAt(object, mongoVariant); appendHgvs(object, mongoVariant); appendFiles(object, mongoVariant); appendStatistics(object, mongoVariant); return mongoVariant; }
Source:
public static String getLibraryUrl(String libraryId, String revision) { if (!SUPPORT_REPOSITORY_DEFAULTS.containsKey(libraryId)) { return null; } if (!AndroidSdkUtils.isAndroidSdkAvailable()) { throw new IllegalStateException("No SDK Available. Please configure your SDK in the project structure."); } String sdkLocation = AndroidSdkUtils.tryToChooseAndroidSdk().getLocation(); String path = String.format(SUPPORT_REPOSITORY_BASE_PATH, sdkLocation, libraryId + "-" + revision) + MAVEN_METADATA_FILE_NAME; path = FileUtil.toSystemIndependentName(path); File supportMetadataFile = new File(path); if (!supportMetadataFile.exists()) { return SUPPORT_REPOSITORY_DEFAULTS.get(libraryId); } String version = getLatestVersionFromMavenMetadata(supportMetadataFile); return String.format(SUPPORT_BASE_URL, libraryId, revision, version); }

Target:
public static String getLibraryUrl(String libraryId, String revision) { if (!SUPPORT_REPOSITORY_DEFAULTS.containsKey(libraryId)) { return null; } if (!AndroidSdkUtils.isAndroidSdkAvailable()) { throw new IllegalStateException("No SDK Available. Please configure your SDK in the Project Structure dialog."); } String sdkLocation = AndroidSdkUtils.tryToChooseAndroidSdk().getLocation(); String path = String.format(SUPPORT_REPOSITORY_BASE_PATH, sdkLocation, libraryId + "-" + revision) + MAVEN_METADATA_FILE_NAME; path = FileUtil.toSystemDependentName(path); File supportMetadataFile = new File(path); if (!supportMetadataFile.exists()) { return SUPPORT_REPOSITORY_DEFAULTS.get(libraryId); } String version = getLatestVersionFromMavenMetadata(supportMetadataFile); return String.format(SUPPORT_BASE_URL, libraryId, revision, version); }
Source:
protected static DefaultCustomPage decode(int contextId, String encodedString) { String[] pieces = encodedString.split(FIELD_SEPARATOR, -1); DefaultCustomPage defaultCustomPage = null; try { defaultCustomPage = new DefaultCustomPage( contextId, new String( Base64.getDecoder().decode(pieces[0]), StandardCharsets.UTF_8), CustomPageMatcherLocation.getCustomPagePageMatcherLocationWithId( Integer.parseInt(pieces[1])), Boolean.parseBoolean(pieces[2]), Type.getCustomPageTypeWithId(Integer.parseInt(pieces[3])), Boolean.parseBoolean(pieces[4])); } catch (Exception ex) { System.out.println(ex.getMessage()); LOGGER.error( "An error occured while decoding DefaultCustomPage from: " + encodedString, ex); return null; } return defaultCustomPage; }

Target:
protected static DefaultCustomPage decode(int contextId, String encodedString) { String[] pieces = encodedString.split(FIELD_SEPARATOR, -1); DefaultCustomPage defaultCustomPage = null; try { defaultCustomPage = new DefaultCustomPage( contextId, new String( Base64.getDecoder().decode(pieces[0]), StandardCharsets.UTF_8), CustomPageMatcherLocation.getCustomPagePageMatcherLocationWithId( Integer.parseInt(pieces[1])), Boolean.parseBoolean(pieces[2]), Type.getCustomPageTypeWithId(Integer.parseInt(pieces[3])), Boolean.parseBoolean(pieces[4])); } catch (Exception ex) { LOGGER.error( "An error occured while decoding DefaultCustomPage from: " + encodedString, ex); return null; } return defaultCustomPage; }
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { mIndexes = savedInstanceState.getIntegerArrayList(KEY_INDEXES); mFirstPositions = savedInstanceState.getIntegerArrayList(KEY_FIRST_POSITIONS); mTops = savedInstanceState.getIntegerArrayList(KEY_TOPS); mHeightCell = savedInstanceState.getInt(KEY_HEIGHT_CELL); setMessageForEmptyList(savedInstanceState.getString(KEY_EMPTY_LIST_MESSAGE)); } else { mIndexes = new ArrayList<Integer>(); mFirstPositions = new ArrayList<Integer>(); mTops = new ArrayList<Integer>(); mHeightCell = 0; } SharedPreferences appPreferences = PreferenceManager .getDefaultSharedPreferences(MainApp.getAppContext()); mScale = appPreferences.getFloat(GRID_COLUMNS, -1.0f); }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { mIndexes = savedInstanceState.getIntegerArrayList(KEY_INDEXES); mFirstPositions = savedInstanceState.getIntegerArrayList(KEY_FIRST_POSITIONS); mTops = savedInstanceState.getIntegerArrayList(KEY_TOPS); mHeightCell = savedInstanceState.getInt(KEY_HEIGHT_CELL); setMessageForEmptyList(savedInstanceState.getString(KEY_EMPTY_LIST_MESSAGE)); } else { mIndexes = new ArrayList<Integer>(); mFirstPositions = new ArrayList<Integer>(); mTops = new ArrayList<Integer>(); mHeightCell = 0; } SharedPreferences appPreferences = PreferenceManager .getDefaultSharedPreferences(getContext()); mScale = appPreferences.getFloat(GRID_COLUMNS, -1.0f); }
Source:
public void onBarrierStateChanged(final String version, ZkBarrierForVersionUpgrade.State state) { LOG.info("JobModel version " + version + " obtained consensus successfully!"); metrics.barrierStateChange.inc(); metrics.singleBarrierRebalancingTime.update(System.nanoTime() - startTime); if (ZkBarrierForVersionUpgrade.State.DONE.equals(state)) { debounceTimer.scheduleAfterDebounceTime(barrierAction, 0, () -> onNewJobModelConfirmed(version)); } else { if (ZkBarrierForVersionUpgrade.State.TIMED_OUT.equals(state)) { LOG.warn("Leader: barrier for version " + version + " timed out."); if (leaderElector.amILeader()) { debounceTimer.scheduleAfterDebounceTime(ScheduleAfterDebounceTime.ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); } } } }

Target:
public void onBarrierStateChanged(final String version, ZkBarrierForVersionUpgrade.State state) { LOG.info("JobModel version " + version + " obtained consensus successfully!"); metrics.barrierStateChange.inc(); metrics.singleBarrierRebalancingTime.update(System.nanoTime() - startTime); if (ZkBarrierForVersionUpgrade.State.DONE.equals(state)) { debounceTimer.scheduleAfterDebounceTime(barrierAction, 0, () -> onNewJobModelConfirmed(version)); } else { if (ZkBarrierForVersionUpgrade.State.TIMED_OUT.equals(state)) { LOG.warn("Barrier for version " + version + " timed out."); if (zkController.isLeader()) { LOG.info("Leader will schedule a new job model generation"); debounceTimer.scheduleAfterDebounceTime(ScheduleAfterDebounceTime.ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); } } } }
Source:
public String getTypeName() { return null; }

Target:
public String getTypeName() { return "Insertion Feature"; }
Source:
public void clickOkButton() { WaitUtils.sleepQuietly(2); seleniumWebDriverHelper.waitAndClick(By.xpath(OK_BUTTON_XPATH)); }

Target:
public void clickOkButton() { seleniumWebDriverHelper.waitAndClick(By.xpath(OK_BUTTON_XPATH)); }
Source:
public CategoryTree get() { Logger.info("categoryTreeProvider"); final PagedQueryResult<Category> pagedQueryResult = client.execute(CategoryQuery.of()).get(2000, TimeUnit.MILLISECONDS); return CategoryTree.of(pagedQueryResult.getResults()); }

Target:
public CategoryTree get() { Logger.info("execute CategoryTreeProvider.get()"); final PagedQueryResult<Category> pagedQueryResult = client.execute(CategoryQuery.of()).get(2000, TimeUnit.MILLISECONDS); return CategoryTree.of(pagedQueryResult.getResults()); }
Source:
public FileProcessor(DatastreamTask datastreamTask, DatastreamEventProducer producer) throws FileNotFoundException { _task = datastreamTask; _fileName = datastreamTask.getDatastreamSource().getConnectionString(); _positionValue = (FilePositionValue) PositionDataStore.getInstance() .computeIfAbsent(_task.getConnectorType(), s -> new ConcurrentHashMap<>()) .computeIfAbsent(new FilePositionKey(BrooklinInstanceInfo.getInstanceName(), _task.getTaskPrefix(), _task.getDatastreamTaskName(), Instant.now(), _fileName), s -> new FilePositionValue()); final File file = new File(_fileName); _positionValue.setFileLengthBytes(file.length()); _inputStream = new CountingInputStream(new FileInputStream(file)); _fileReader = new BufferedReader(new InputStreamReader(_inputStream)); _producer = producer; _isStopped = false; _cancelRequested = false; LOG.info("Created FileProcessor for " + datastreamTask); }

Target:
public FileProcessor(DatastreamTask datastreamTask, DatastreamEventProducer producer) throws FileNotFoundException { _task = datastreamTask; _fileName = datastreamTask.getDatastreamSource().getConnectionString(); _positionValue = (FilePositionValue) ConnectorPositionsCache.getInstance() .computeIfAbsent(_task.getConnectorType(), s -> new ConcurrentHashMap<>()) .computeIfAbsent(new FilePositionKey(BrooklinInstanceInfo.getInstanceName(), _task.getTaskPrefix(), _task.getDatastreamTaskName(), Instant.now(), _fileName), s -> new FilePositionValue()); final File file = new File(_fileName); _positionValue.setFileLengthBytes(file.length()); _inputStream = new CountingInputStream(new FileInputStream(file)); _fileReader = new BufferedReader(new InputStreamReader(_inputStream)); _producer = producer; _isStopped = false; _cancelRequested = false; LOG.info("Created FileProcessor for " + datastreamTask); }
Source:
public void run() { try { checkLogDir(logDirectory); } catch (LogDirNotFoundException e) { LOG.error("Incorrect path to log directory. Directory: not exist", logDirectory); return; } if (!charsetSetup()) { LOG.error("Charset: is not supported", charsetName); return; } FileTailerState fileTailerState = getSaveStateFromFile(); try { if (fileTailerState == null) { LOG.info("Fail state do not found. Start reading all directory"); runWithOutRestore(); } else { runFromSaveState(fileTailerState); } } catch (InterruptedException e) { LOG.info("Tailer daemon was interrupted"); } LOG.info("Tailer daemon stopped"); }

Target:
public void run() { try { checkLogDirExists(logDirectory); } catch (LogDirNotFoundException e) { LOG.error("Incorrect path to log directory; directory does not exist", logDirectory.getAbsolutePath()); return; } FileTailerState fileTailerState = getSaveStateFromFile(); try { if (fileTailerState == null) { LOG.info("File Tailer state was not found; start reading all logs from the directory from the beginning"); runWithOutRestore(); } else { runFromSaveState(fileTailerState); } } catch (InterruptedException e) { LOG.info("Tailer daemon was interrupted"); } LOG.info("Tailer daemon stopped"); }