auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int paginate( final MasterReport report, final int yieldRate ) throws ReportProcessingException, IOException, ContentIOException { final ExtendedConfiguration config = ClassicEngineBoot.getInstance().getExtendedConfig(); final boolean firstPageMode = config.getBoolProperty( "org.pentaho.reporting.platform.plugin.output.FirstPageMode" ); if ( firstPageMode ) { return 1; } try { String key = report.getContentCacheKey(); if ( key == null ) { key = createKey( report ); } final IReportContent cachedContent = getCachedContent( key ); if ( cachedContent != null ) { return cachedContent.getPageCount(); } final IReportContent freshCache = regenerateCache( report, yieldRate, key ); return freshCache.getPageCount(); } catch ( final CacheKeyException e ) { return super.paginate( report, yieldRate ); } }

Target:
public int paginate( final MasterReport report, final int yieldRate ) throws ReportProcessingException, IOException, ContentIOException { try { String key = report.getContentCacheKey(); if ( key == null ) { key = createKey( report ); } final IReportContent cachedContent = getCachedContent( key ); if ( cachedContent != null ) { return cachedContent.getPageCount(); } final IReportContent freshCache = regenerateCache( report, yieldRate, key, 0 ); return freshCache.getPageCount(); } catch ( final CacheKeyException e ) { return super.paginate( report, yieldRate ); } }
Source:
private void sendKinesisRecord(ByteBuffer data, PutRecordRequest putRecordRequest) { putRecordRequest.setData(data); try { kinesisClient.putRecord(putRecordRequest); } catch (ProvisionedThroughputExceededException ex) { LOG.debug("Throughput exceeded. Sleeping for 10 ms and retrying"); } try { Thread.sleep(10); } catch (InterruptedException e) { LOG.info("Retry wait interrupted", e); } }

Target:
private void sendKinesisRecord(ByteBuffer data, PutRecordRequest putRecordRequest) { for (int i = 0; i < MAX_RETRIES; i++) { putRecordRequest.setData(data); try { kinesisClient.putRecord(putRecordRequest); return; } catch (ProvisionedThroughputExceededException ex) { LOG.debug("Throughput exceeded. Sleeping for 10 ms and retrying."); try { Thread.sleep(10); } catch (InterruptedException e) { LOG.info("Retry wait interrupted", e); } } } LOG.error("Maximum retries exhausted"); }
Source:
private void updateArbiterAvailability() { getArbiterVolume().setIsAvailable(getTypeList().getSelectedItem().isReplicatedType() && getCluster().getSelectedItem() != null); }

Target:
private void updateArbiterAvailability() { getArbiterVolume().setIsAvailable(getTypeList().getSelectedItem().isReplicatedType()); }
Source:
public static <T> TSpliterator<T> spliterator(Iterator<? extends T> iterator, long size, int characteristics) { TArrayList<T> list = new TArrayList<T>(); while (iterator.hasNext()) { list.add((T) iterator.next()); } return list.spliterator(); }

Target:
public static <T> TSpliterator<T> spliterator(Iterator<? extends T> iterator, long size, int characteristics) { return new TSpliterator<T>() { @Override public boolean tryAdvance(Consumer<? super T> action) { if (iterator.hasNext()) { action.accept(iterator.next()); return true; } else { return false; } } @Override public TSpliterator<T> trySplit() { return null; } @Override public long estimateSize() { return size; } @Override public int characteristics() { return characteristics; } }; }
Source:
private CurveCurrencyParameterSensitivity mapSensitivity(DoubleUnaryOperator operator, Currency currency) { double[] updated = new double[sensitivity.length]; for (int i = 0; i < sensitivity.length; i++) { updated[i] = operator.applyAsDouble(sensitivity[i]); } return new CurveCurrencyParameterSensitivity(metadata, currency, updated); }

Target:
private CurveCurrencyParameterSensitivity mapSensitivity(DoubleUnaryOperator operator, Currency currency) { return new CurveCurrencyParameterSensitivity(metadata, currency, DoubleArrayMath.apply(sensitivity, operator)); }
Source:
public static Duration getExpiry(ExpiryPolicy policy, Operation op) { switch (op) { case CREATION: try { return policy.getExpiryForCreation(); } catch (Throwable t) { return Duration.ETERNAL; } case ACCESS: try { return policy.getExpiryForAccess(); } catch (Throwable t) { return null; } case UPDATE: try { return policy.getExpiryForUpdate(); } catch (Exception e) { return null; } default: throw log.unknownExpiryOperation(op.toString()); } }

Target:
public static Duration getExpiry(ExpiryPolicy policy, Operation op) { switch (op) { case CREATION: try { return policy.getExpiryForCreation(); } catch (Throwable t) { return getDefaultDuration(); } case ACCESS: try { return policy.getExpiryForAccess(); } catch (Throwable t) { return null; } case UPDATE: try { return policy.getExpiryForUpdate(); } catch (Exception e) { return null; } default: throw log.unknownExpiryOperation(op.toString()); } }
Source:
public void testSetTime() throws Exception { try (AccumuloClient client = createAccumuloClient()) { tableName = "testSetTime_table1"; NewTableConfiguration newTableConf = new NewTableConfiguration(); newTableConf.setTimeType(TimeType.LOGICAL); client.tableOperations().create(tableName, newTableConf); aconf = getCluster().getServerContext().getConfiguration(); fs = getCluster().getFileSystem(); rootPath = cluster.getTemporaryPath().toString(); testSingleTabletSingleFile(client, false, true); } }

Target:
public void testSetTime() throws Exception { try (AccumuloClient client = createAccumuloClient()) { tableName = "testSetTime_table1"; NewTableConfiguration newTableConf = new NewTableConfiguration(); newTableConf.setTimeType(TimeType.LOGICAL); client.tableOperations().create(tableName, newTableConf); testSingleTabletSingleFile(client, false, true); } }
Source:
public RangeResourceEntry add(ResourceEntry<Long> resourceEntry) { RangeResourceEntry rangeResourceEntry = (RangeResourceEntry) resourceEntry; if (this.begin < rangeResourceEntry.getBegin()) { this.begin = rangeResourceEntry.getBegin(); } if (this.end > rangeResourceEntry.getBegin()) { this.end = rangeResourceEntry.getBegin(); } return this; }

Target:
public RangeResourceEntry add(ResourceEntry<Long> resourceEntry) { RangeResourceEntry rangeResourceEntry = (RangeResourceEntry) resourceEntry; if (rangeResourceEntry.getEnd() < rangeResourceEntry.getEnd() || rangeResourceEntry.getBegin() > this.end + 1 || rangeResourceEntry.getEnd() < this.begin - 1) { return this; } if (rangeResourceEntry.getBegin() < this.begin) { this.begin = rangeResourceEntry.getBegin(); } if (rangeResourceEntry.getEnd() > this.end) { this.end = rangeResourceEntry.getEnd(); } return this; }
Source:
protected Binding[] createBindings(Control control) throws DatabindingFailedException { final IObservableValue value = WidgetProperties.text().observe(hyperlink); final Binding binding = getDataBindingContext().bindValue(value, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { updateChangeListener((EObject) value); return "<a>" + getText(value) + "</a>"; } }); final IObservableValue tooltipValue = WidgetProperties.tooltipText().observe(hyperlink); final Binding tooltipBinding = getDataBindingContext().bindValue(tooltipValue, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { return getText(value); } }); final IObservableValue imageValue = WidgetProperties.image().observe(imageHyperlink); final Binding imageBinding = getDataBindingContext().bindValue(imageValue, getModelValue(), new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy() { @Override public Object convert(Object value) { return getImage(value); } }); final IObservableValue deleteButtonEnablement = WidgetProperties.enabled().observe(deleteReferenceButton); getDataBindingContext().bindValue(deleteButtonEnablement, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { return value != null; } }); return new Binding[] { binding, tooltipBinding, imageBinding }; }

Target:
protected Binding[] createBindings(Control control) throws DatabindingFailedException { final IObservableValue value = WidgetProperties.text().observe(hyperlink); final Binding binding = getDataBindingContext().bindValue(value, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { updateChangeListener((EObject) value); return "<a>" + getText(value) + "</a>"; } }); final IObservableValue tooltipValue = WidgetProperties.tooltipText().observe(hyperlink); final Binding tooltipBinding = getDataBindingContext().bindValue(tooltipValue, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { return getText(value); } }); final IObservableValue imageValue = WidgetProperties.image().observe(imageHyperlink); final Binding imageBinding = getDataBindingContext().bindValue(imageValue, getModelValue(), new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy() { @Override public Object convert(Object value) { return getImage(value); } }); final IObservableValue deleteButtonEnablement = WidgetProperties.enabled().observe(deleteReferenceButton); final Binding deleteBinding = getDataBindingContext().bindValue(deleteButtonEnablement, getModelValue(), createValueExtractingUpdateStrategy(), new UpdateValueStrategy() { @Override public Object convert(Object value) { return value != null; } }); return new Binding[] { binding, tooltipBinding, imageBinding, deleteBinding }; }
Source:
public VariantWrapper read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { DBObject dbObject = delegateReader.read(); if (dbObject != null) { Variant variant = converter.convertToDataModelType(dbObject); return new VariantWrapper(variant); } else { return null; } }

Target:
public VariantWrapper read() throws Exception { DBObject dbObject = delegateReader.read(); if (dbObject != null) { Variant variant = converter.convertToDataModelType(dbObject); return new VariantWrapper(variant); } else { return null; } }
Source:
public static Mapping forIgnore( String targetName) { return new Mapping( null, null, null, null, targetName, null, true, null, null, null, null, null, null, new HashSet<>(), null, null, null ); }

Target:
public static Mapping forIgnore( String targetName) { return new Mapping( null, null, null, null, targetName, null, true, null, null, null, null, null, null, Collections.emptySet(), null, null, null ); }
Source:
public void teleport(CommandContext args, Actor sender) throws CommandException { LocalPlayer player = worldGuard.checkPlayer(sender); Location teleportLocation; World world = checkWorld(args, player, 'w'); RegionManager regionManager = checkRegionManager(world); ProtectedRegion existing = checkExistingRegion(regionManager, args.getString(0), true); if (!getPermissionModel(player).mayTeleportTo(existing)) { throw new CommandPermissionsException(); } if (args.hasFlag('s')) { teleportLocation = existing.getFlag(Flags.SPAWN_LOC); if (teleportLocation == null) { throw new CommandException( "The region has no spawn point associated."); } } else { teleportLocation = existing.getFlag(Flags.TELE_LOC); if (teleportLocation == null) { throw new CommandException("The region has no teleport point associated."); } } String message = existing.getFlag(Flags.TELE_MESSAGE); message = message == null ? Flags.TELE_MESSAGE.getDefault() : message; message = message == null ? "" : message.replace("%id%", existing.getId()); player.teleport(teleportLocation, message, "Unable to teleport to region '" + existing.getId() + "'."); }

Target:
public void teleport(CommandContext args, Actor sender) throws CommandException { LocalPlayer player = worldGuard.checkPlayer(sender); Location teleportLocation; World world = checkWorld(args, player, 'w'); RegionManager regionManager = checkRegionManager(world); ProtectedRegion existing = checkExistingRegion(regionManager, args.getString(0), true); if (!getPermissionModel(player).mayTeleportTo(existing)) { throw new CommandPermissionsException(); } if (args.hasFlag('s')) { teleportLocation = existing.getFlag(Flags.SPAWN_LOC); if (teleportLocation == null) { throw new CommandException( "The region has no spawn point associated."); } } else { teleportLocation = existing.getFlag(Flags.TELE_LOC); if (teleportLocation == null) { throw new CommandException("The region has no teleport point associated."); } } String message = existing.getFlag(Flags.TELE_MESSAGE); if (message == null) { message = Flags.TELE_MESSAGE.getDefault(); } player.teleport(teleportLocation, message.replace("%id%", existing.getId()), "Unable to teleport to region '" + existing.getId() + "'."); }
Source:
public boolean equals(Object o) { return o instanceof GitHubPushCause || super.equals(o); }

Target:
public boolean equals(Object o) { return o instanceof GitHubPushCause && Objects.equals(this.pushedBy, ((GitHubPushCause) o).pushedBy) && super.equals(o); }
Source:
public void process(Exchange exchange) throws Exception { CamelCMISActions action = exchange.getIn().getHeader(CamelCMISConstants.CMIS_ACTION, CamelCMISActions.class); this.getClass().getDeclaredMethod(action.getMethodName(), Exchange.class).invoke(this , exchange); }

Target:
public void process(Exchange exchange) throws Exception { CamelCMISActions action = exchange.getIn().getHeader(CamelCMISConstants.CMIS_ACTION, CamelCMISActions.class); Class[] paramMethod = {Exchange.class}; Method method = ReflectionHelper.findMethod(this.getClass(), action.getMethodName(), paramMethod); Object object = ObjectHelper.invokeMethod(method, this, exchange); exchange.getOut().copyFrom(exchange.getIn()); exchange.getOut().setBody(object); }
Source:
synchronized void sendButtonToListeners(LIRCButtonEvent buttonEvent) { try { for (LIRCEventListener listener : listeners) { listener.buttonPressed(buttonEvent); } } catch (Exception e) { logger.error("Error invoking event listener", e); } }

Target:
public synchronized void sendButtonToListeners(LIRCButtonEvent buttonEvent) { try { for (LIRCEventListener listener : listeners) { listener.buttonPressed(buttonEvent); } } catch (Exception e) { logger.error("Error invoking event listener", e); } }
Source:
protected void readFromResources(String postFix) { if (!new File(absolutePathOfStorageDir + File.separator + getFileName() + "_" + Version.VERSION).exists()) makeFileFromResourceFile(postFix); else { File dbDir = new File(absolutePathOfStorageDir); List<File> resourceFiles = Arrays.asList(dbDir.list((dir, name) -> name.startsWith(getFileName() + "_"))).stream().map(s -> new File(s)).collect(Collectors.toList()); history = new HashMap<>(); store = readStore(getFileName()); resourceFiles.forEach(file -> { SplitStore tmp = readStore(file.getName().replace(postFix, "")); history.put(file.getName().replace(postFix, "").replace(getFileName(), "").replace("_", ""), tmp); }); } }

Target:
protected void readFromResources(String postFix) { history = new HashMap<>(); store = readStore(getFileName()); List<String> versions = new ArrayList<>(); versions.add(Version.VERSION); versions.addAll(Version.history); versions.forEach(version -> { String filename = getFileName() + "_" + version; if (new File(absolutePathOfStorageDir, filename).exists()) { history.put(version, readStore(getFileName() + "_" + version)); } else { history.put(version, copyAndSplit(version, postFix)); } }); storage.initAndGetPersistedWithFileName(getFileName(), 10); }
Source:
public ReviewInput toReviewInput(@NotNull Review review, @Nullable String tag) { ReviewInput reviewInput = new ReviewInput(); reviewInput.message = Joiner.on(". ").join(review.getMessages()); reviewInput.labels = new HashMap<>(review.getScores()); if (StringUtils.isNotBlank(tag)) { reviewInput.tag = tag; } reviewInput.comments = new HashMap<>(); for (ReviewFile file : review.getFiles()) { List<ReviewInput.CommentInput> comments = new ArrayList<>(); for (Comment comment : file.getComments()) { ReviewInput.CommentInput commentInput = new ReviewInput.CommentInput(); commentInput.line = comment.getLine(); commentInput.message = comment.getMessage(); comments.add(commentInput); } reviewInput.comments.put(file.getReviewFilename(), comments); } return reviewInput; }

Target:
public ReviewInput toReviewInput(@NotNull Review review, @Nullable String tag) { ReviewInput reviewInput = new ReviewInput(); reviewInput.message = Joiner.on(MESSAGE_SEPARATOR).join(review.getMessages()); reviewInput.labels = new HashMap<>(review.getScores()); if (StringUtils.isNotBlank(tag)) { reviewInput.tag = tag; } reviewInput.comments = review.getFiles().stream() .collect(Collectors.toMap(ReviewFile::getReviewFilename, this::buildFileComments)); return reviewInput; }
Source:
public IterableStream<ServiceBusReceivedMessage> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maxWaitTime' cannot be zero or less. maxWaitTime: " + maxWaitTime)); } final Flux<ServiceBusReceivedMessage> messages = Flux.create(emitter -> queueWork(maxMessages, maxWaitTime, emitter)); return new IterableStream<>(messages); }

Target:
public IterableStream<ServiceBusReceivedMessage> receive(int maxMessages, Duration maxWaitTime) { if (maxMessages <= 0) { throw logger.logExceptionAsError(new IllegalArgumentException( "'maxMessages' cannot be less than or equal to 0. maxMessages: " + maxMessages)); } else if (Objects.isNull(maxWaitTime)) { throw logger.logExceptionAsError( new NullPointerException("'maxWaitTime' cannot be null.")); } else if (maxWaitTime.isNegative() || maxWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maxWaitTime' cannot be zero or less. maxWaitTime: " + maxWaitTime)); } final Flux<ServiceBusReceivedMessage> messages = Flux.create(emitter -> queueWork(maxMessages, maxWaitTime, emitter)); return new IterableStream<>(messages); }
Source:
public static String supportedVerbs() { StringBuilder verbNames = new StringBuilder(); for (GetActionArgument verb: GetActionArgument.values()) { verbNames.append(verb.name().toLowerCase() + " "); } return verbNames.toString(); }

Target:
public static String supportedVerbs() { return Arrays.asList(values()).toString().replaceAll("^.|.$", ""); }
Source:
private void onPartitionSnapshotRestored(UUID nodeId, int grpId, int partId, long cntr) { Map<Integer, Set<Integer>> grpParts = remaining.get(nodeId); assert grpParts != null : "nodeId=" + nodeId + ", grpId=" + grpId + ", p=" + partId; Set<Integer> parts = grpParts.get(grpId); boolean rmvd = parts.remove(partId); assert rmvd : "nodeId=" + nodeId + ", grpId=" + grpId + ", p=" + partId; Map<UUID, Map<Integer, Long>> grpCntrs = restored.computeIfAbsent(grpId, v -> new ConcurrentHashMap<>()); grpCntrs.computeIfAbsent(nodeId, v -> new ConcurrentHashMap<>()).put(partId, cntr); if (parts.isEmpty() && grpParts.remove(grpId) != null && remaining.values().stream().map(Map::keySet).noneMatch(set -> set.contains(grpId))) onCacheGroupDone(grpId, grpCntrs); }

Target:
private void onPartitionSnapshotRestored(UUID nodeId, int grpId, int partId, long cntr) { Map<Integer, Set<Integer>> grpParts = remaining.get(nodeId); assert grpParts != null : "nodeId=" + nodeId + ", grpId=" + grpId + ", p=" + partId; Set<Integer> parts = grpParts.get(grpId); boolean rmvd = parts.remove(partId); assert rmvd : "nodeId=" + nodeId + ", grpId=" + grpId + ", p=" + partId; Map<UUID, Map<Integer, Long>> grpCntrs = restored.computeIfAbsent(grpId, v -> new ConcurrentHashMap<>()); grpCntrs.computeIfAbsent(nodeId, v -> new ConcurrentHashMap<>()).put(partId, cntr); GridFutureAdapter<GridDhtPreloaderAssignments> resFut; if (!parts.isEmpty() || grpParts.remove(grpId) == null || remaining.values().stream().map(Map::keySet).anyMatch(grps -> grps.contains(grpId)) || (resFut = futAssigns.remove(grpId)) == null) return; CacheGroupContext grp = cctx.cache().cacheGroup(grpId); assert !grp.localWalEnabled() : "grp=" + grp.cacheOrGroupName(); IgniteInternalFuture<?> idxFut = cctx.database().rebuildIndexes(grp); GridDhtPreloaderAssignments histAssignments = makeHistoricalAssignments(grp, grpCntrs); resFut.onDone(histAssignments); if (histAssignments.isEmpty()) idxFut.listen(f -> cctx.walState().onGroupRebalanceFinished(grp.groupId(), topVer)); boolean finalPreloading = futAssigns.isEmpty() && onDone(true); if (log.isInfoEnabled()) { log.info("Completed" + (finalPreloading ? " (final)" : "") + " partition files preloading [grp=" + grp.cacheOrGroupName() + "]"); } }
Source:
public RetentionMode mode() { return RetentionMode.fromString(mode); }

Target:
public RetentionMode mode() { return this.mode == null ? null : RetentionMode.fromString(this.mode); }
Source:
public List<File> getGeneratedFileList() { List<File> files = new ArrayList<File>(); files.add(getOutputFile(generator.getRecognizerFileName())); files.add(getOutputFile(generator.getVocabFileName())); ST headerExtST = null; ST extST = generator.templates.getInstanceOf("codeFileExtension"); if (generator.templates.isDefined("headerFile")) { headerExtST = generator.templates.getInstanceOf("headerFileExtension"); String suffix = Grammar.getGrammarTypeToFileNameSuffix(g.getType()); String fileName = g.name + suffix + headerExtST.render(); files.add(getOutputFile(fileName)); } if ( g.isCombined() ) { String suffix = Grammar.getGrammarTypeToFileNameSuffix(ANTLRParser.LEXER); String lexer = g.name + suffix + extST.render(); files.add(getOutputFile(lexer)); String lexerTokens = g.name + suffix + ".tokens"; files.add(getOutputFile(lexerTokens)); if (headerExtST != null) { String header = g.name + suffix + headerExtST.render(); files.add(getOutputFile(header)); } } if ( g.tool.gen_listener ) { files.add(getOutputFile(generator.getListenerFileName())); files.add(getOutputFile(generator.getBaseListenerFileName())); } if ( g.tool.gen_visitor ) { files.add(getOutputFile(generator.getVisitorFileName())); files.add(getOutputFile(generator.getBaseVisitorFileName())); } List<Grammar> imports = g.getAllImportedGrammars(); if ( imports!=null ) { for (Grammar g : imports) { files.add(getOutputFile(g.fileName)); } } if (files.isEmpty()) { return null; } return files; }

Target:
public List<File> getGeneratedFileList() { List<File> files = new ArrayList<File>(); files.add(getOutputFile(generator.getRecognizerFileName())); files.add(getOutputFile(generator.getVocabFileName())); ST headerExtST = null; ST extST = generator.templates.getInstanceOf("codeFileExtension"); if (generator.templates.isDefined("headerFile")) { headerExtST = generator.templates.getInstanceOf("headerFileExtension"); String suffix = Grammar.getGrammarTypeToFileNameSuffix(g.getType()); String fileName = g.name + suffix + headerExtST.render(); files.add(getOutputFile(fileName)); } if ( g.isCombined() ) { String suffix = Grammar.getGrammarTypeToFileNameSuffix(ANTLRParser.LEXER); String lexer = g.name + suffix + extST.render(); files.add(getOutputFile(lexer)); String lexerTokens = g.name + suffix + CodeGenerator.VOCAB_FILE_EXTENSION; files.add(getOutputFile(lexerTokens)); if (headerExtST != null) { String header = g.name + suffix + headerExtST.render(); files.add(getOutputFile(header)); } } if ( g.tool.gen_listener ) { files.add(getOutputFile(generator.getListenerFileName())); files.add(getOutputFile(generator.getBaseListenerFileName())); } if ( g.tool.gen_visitor ) { files.add(getOutputFile(generator.getVisitorFileName())); files.add(getOutputFile(generator.getBaseVisitorFileName())); } List<Grammar> imports = g.getAllImportedGrammars(); if ( imports!=null ) { for (Grammar g : imports) { files.add(getOutputFile(g.fileName)); } } if (files.isEmpty()) { return null; } return files; }
Source:
public synchronized void setSoTimeout(int timeout) throws SocketException { underlying.setSoTimeout(timeout); }

Target:
public void setSoTimeout(int timeout) throws SocketException { underlying.setSoTimeout(timeout); }
Source:
public void dispose() { this.runInControlledConcurrency(() -> { log.info("IrsProxyData::disposing"); resetIrs(); getSchedulUtil().deleteJob(storagePoolRefreshJobId); getSchedulUtil().deleteJob(domainRecoverOnHostJobId); _disposed = true; }); }

Target:
public void dispose() { runInControlledConcurrency(() -> { log.info("IrsProxyData::disposing"); resetIrs(); getSchedulUtil().deleteJob(storagePoolRefreshJobId); getSchedulUtil().deleteJob(domainRecoverOnHostJobId); _disposed = true; }); }
Source:
public ConnectorPartitioningHandle getPartitioningHandleForExchange(ConnectorSession session, int partitionCount, List<Type> partitionTypes) { return new HivePartitioningHandle( partitionCount, partitionTypes.stream() .map(type -> toHiveType( typeTranslator, translateHiveUnsupportedTypeForTemporaryTable(type, typeManager), getDefaultHiveTypeForTemporaryTable(getTemporaryTableStorageFormat(session)))) .collect(toImmutableList()), OptionalInt.empty()); }

Target:
public ConnectorPartitioningHandle getPartitioningHandleForExchange(ConnectorSession session, int partitionCount, List<Type> partitionTypes) { return new HivePartitioningHandle( partitionCount, partitionTypes.stream() .map(type -> toHiveType( typeTranslator, translateHiveUnsupportedTypeForTemporaryTable(type, typeManager))) .collect(toImmutableList()), OptionalInt.empty()); }
Source:
public Comparator getComparator() { return new Comparator<HyperLogLogCollector>() { @Override public int compare(HyperLogLogCollector lhs, HyperLogLogCollector rhs) { if(lhs == null) { return rhs == null ? 0 : -1; } if(rhs == null) { return 1; } return lhs.compareTo(rhs); } }; }

Target:
public Comparator getComparator() { return Ordering.<HyperLogLogCollector>natural().nullsFirst(); }
Source:
private ChannelElementValuesDto findEmptyChannel(final List<ChannelElementValuesDto> channelElementValuesList) { for (final ChannelElementValuesDto channelElementValues : channelElementValuesList) { final boolean deviceIdentificationValues = (channelElementValues.getIdentificationNumber() == null || "00000000".equals(channelElementValues.getIdentificationNumber()) && (channelElementValues.getPrimaryAddress() == 0)); final boolean deviceConfigurationValues = (channelElementValues.getVersion() == 0) && (channelElementValues.getDeviceTypeIdentification() == 0) && channelElementValues.getManufacturerIdentification() == null; if (deviceIdentificationValues && deviceConfigurationValues) { return channelElementValues; } } return null; }

Target:
private ChannelElementValuesDto findEmptyChannel(final List<ChannelElementValuesDto> channelElementValuesList) { for (final ChannelElementValuesDto channelElementValues : channelElementValuesList) { if (this.checkChannelIdentificationValues(channelElementValues) && this.checkChannelConfigurationValues(channelElementValues)) { return channelElementValues; } } return null; }
Source:
protected byte[] createTinyBinary(String xml) throws XMLStreamException, SaxonApiException, IOException { SaxonDocBuilder builder = new SaxonDocBuilder(processor); XmlReader xmlReader = new XmlReader(); xmlReader.addHandler(builder); xmlReader.setStripNamespaces(true); xmlReader.read(IOUtils.toInputStream(xml, Charset.defaultCharset().name())); XdmNode node = builder.getDocument(); TinyTree tinyTree = ((TinyDocumentImpl) node.getUnderlyingNode()).getTree(); TinyBinary tinyBinary = new TinyBinary(tinyTree, StandardCharsets.UTF_8); return tinyBinary.getBytes(); }

Target:
private byte[] createTinyBinary(String xml) throws XMLStreamException, SaxonApiException, IOException { SaxonDocBuilder builder = new SaxonDocBuilder(processor); XmlReader xmlReader = new XmlReader(); xmlReader.addHandler(builder); xmlReader.setStripNamespaces(true); xmlReader.read(IOUtils.toInputStream(xml, Charset.defaultCharset().name())); XdmNode node = builder.getDocument(); TinyTree tinyTree = ((TinyDocumentImpl) node.getUnderlyingNode()).getTree(); TinyBinary tinyBinary = tinyBinaryFunction.apply(tinyTree); return tinyBinary.getBytes(); }
Source:
private Map<String, Object> createResultMap(Result result) { Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("status", result.getStatus().lowerCaseName()); if (result.getErrorMessage() != null) { resultMap.put("error_message", result.getErrorMessage()); } if (result.getDuration() != 0) { resultMap.put("duration", MILLISECONDS.toNanos(result.getDuration())); } return resultMap; }

Target:
private Map<String, Object> createResultMap(Result result) { Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("status", result.getStatus().lowerCaseName()); if (result.getErrorMessage() != null) { resultMap.put("error_message", result.getErrorMessage()); } if (result.getDuration() != 0) { resultMap.put("duration", result.getDuration()); } return resultMap; }
Source:
public BsmAdminPageAttributeEditWindow value(String value) { findElementById("valueField").clear(); findElementById("valueField").sendKeys(String.valueOf(value)); return this; }

Target:
public BsmAdminPageAttributeEditWindow value(String value) { findElementById("valueField").clear(); findElementById("valueField").sendKeys(value); return this; }
Source:
private AbstractPlanNode findScanNodeForWindowFunction(AbstractPlanNode root) { while (root != null && ( ! (( root instanceof AbstractJoinPlanNode ) || (root instanceof AbstractScanPlanNode )))) { root = (root.getChildCount() == 0) ? null : root.getChild(0); } return root; }

Target:
private IndexUseForOrderBy findScanNodeForWindowFunction(AbstractPlanNode root) { while (root != null) { if (root instanceof IndexSortablePlanNode) { return ((IndexSortablePlanNode) root).indexUse(); } if ((root instanceof AbstractScanPlanNode) || (root instanceof AbstractJoinPlanNode)) { return null; } if (root.getChildCount() == 0) { break; } root = root.getChild(0); } return null; }
Source:
public void synchronizeMailboxSynchronous_withNoRemoteFolderProvided_shouldOpenRemoteFolderFromStore() throws Exception { messageCountInRemoteFolder(1); when(account.getRemoteStore()).thenReturn(remoteStore); when(remoteStore.getFolder(FOLDER_NAME)).thenReturn(remoteFolder); controller.synchronizeMailboxSynchronous(account, FOLDER_NAME, listener, null); verify(remoteFolder).open(Folder.OPEN_MODE_RW); }

Target:
public void synchronizeMailboxSynchronous_withNoRemoteFolderProvided_shouldOpenRemoteFolderFromStore() throws Exception { messageCountInRemoteFolder(1); configureRemoteStoreWithFolder(); controller.synchronizeMailboxSynchronous(account, FOLDER_NAME, listener, null); verify(remoteFolder).open(Folder.OPEN_MODE_RW); }
Source:
public void run() { boolean eosWritten = false; try { while (underlying.hasNext()) { List<T> readAhead = new ArrayList<T>(batchSize + 1); for (int i = 0; i < batchSize && underlying.hasNext(); i++) { readAhead.add(underlying.next()); } buffer.put(readAhead); if (readAhead.size() == 0) { eosWritten = true; } } } catch (InterruptedException ie) { } catch (Throwable t) { ex.set(t); throw new RuntimeException(t); } finally { Thread.interrupted(); try { if (!eosWritten) { buffer.put(new ArrayList<T>()); } } catch (InterruptedException e2) { log.warn("Thread interrupt received whilst writing end of stream indicator"); } } }

Target:
public void run() { boolean eosWritten = false; try { while (underlying.hasNext()) { final List<T> readAhead = new ArrayList<T>(bufferSize); for (int i = 0; i < bufferSize && underlying.hasNext(); i++) { readAhead.add(underlying.next()); } buffer.put(readAhead); if (readAhead.isEmpty()) { eosWritten = true; } } } catch (InterruptedException ie) { } catch (Throwable t) { ex.set(t); throw new RuntimeException(t); } finally { Thread.interrupted(); try { if (!eosWritten) { buffer.put(new ArrayList<T>()); } } catch (InterruptedException e2) { log.warn("Thread interrupt received whilst writing end of stream indicator"); } } }
Source:
public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options) { checkArgument(location == null || location.equals(region), "location must be null or %s", region); boolean containerCreated; if (options.isPublicRead()) { containerCreated = api.getContainerApi(regionId).create(container, ANYBODY_READ); } else { containerCreated = api.getContainerApi(regionId).create(container, BASIC_CONTAINER); } if (containerCreated) { containerCache.put(container, Optional.fromNullable(api.getContainerApi(regionId).get(container))); } return containerCreated; }

Target:
public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options) { checkArgument(location == null || location.equals(region), "location must be null or %s", region); boolean containerCreated = api.getContainerApi(regionId).create(container, options.isPublicRead() ? ANYBODY_READ : BASIC_CONTAINER); if (containerCreated) { containerCache.put(container, Optional.fromNullable(api.getContainerApi(regionId).get(container))); } return containerCreated; }
Source:
public void testReadStatistics() throws IOException { describe("Testing the values of statistics from read operation in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path readStatPath = path(getMethodName()); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, readStatPath); out.write(defBuffer); out.hflush(); in = abfss.openFileForRead(readStatPath, fs.getFsStatistics()); for (int i = 0; i < OPERATIONS; i++) { in.read(); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); assertEquals("Mismatch in bytesRead value", OPERATIONS, stats.getBytesRead()); assertEquals("Mismatch in readOps value", OPERATIONS, stats.getReadOperations()); assertEquals("Mismatch in remoteReadOps value", 1, stats.getRemoteReadOperations()); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }

Target:
public void testReadStatistics() throws IOException { describe("Testing the values of statistics from read operation in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path readStatPath = path(getMethodName()); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, readStatPath); out.write(defBuffer); out.hflush(); in = abfss.openFileForRead(readStatPath, fs.getFsStatistics()); for (int i = 0; i < OPERATIONS; i++) { in.read(); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); LOG.info("STATISTICS: {}", stats.toString()); assertEquals("Mismatch in bytesRead value", OPERATIONS, stats.getBytesRead()); assertEquals("Mismatch in readOps value", OPERATIONS, stats.getReadOperations()); assertEquals("Mismatch in remoteReadOps value", 1, stats.getRemoteReadOperations()); in.close(); LOG.info("STATISTICS after closing: {}", stats.toString()); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }
Source:
public MonoReilSolver(final IInstructionGraph instructionGraph, final AnalysisDirection analysisDirection, final ILattice<LatticeElementType> lattice) { m_graph = Preconditions.checkNotNull(instructionGraph, "Instruction graph argument can not be null"); m_direction = Preconditions.checkNotNull(analysisDirection, "Analysis direction argument can not be null"); m_lattice = Preconditions.checkNotNull(lattice, "Latice argument can not be null"); m_workList = MinMaxPriorityQueue.expectedSize(m_graph.size()).create(); }

Target:
public MonoReilSolver(final IInstructionGraph instructionGraph, final AnalysisDirection analysisDirection, final ILattice<LatticeElementType> lattice) { m_graph = Preconditions.checkNotNull(instructionGraph, "Error: instruction graph argument can not be null"); m_direction = Preconditions.checkNotNull(analysisDirection, "Error: analysis direction argument can not be null"); m_lattice = Preconditions.checkNotNull(lattice, "Error: latice argument can not be null"); m_workList = MinMaxPriorityQueue.expectedSize(m_graph.size()).create(); }
Source:
private static void verifyIssue(TestIssue expected, PreciseIssue actual) { if (line(actual) > expected.line()) { fail("Missing issue at line " + expected.line()); } if (line(actual) < expected.line()) { fail("Unexpected issue at line " + line(actual) + ": \"" + actual.primaryLocation().message() + "\""); } if (expected.message() != null) { assertThat(actual.primaryLocation().message()).as("Bad message at line " + expected.line()).isEqualTo(expected.message()); } if (expected.effortToFix() != null) { assertThat(actual.cost()).as("Bad effortToFix at line " + expected.line()).isEqualTo(expected.effortToFix()); } if (expected.startColumn() != null) { assertThat(((PreciseIssue) actual).primaryLocation().startLineOffset() + 1).as("Bad start column at line " + expected.line()).isEqualTo(expected.startColumn()); } if (expected.endColumn() != null) { assertThat(((PreciseIssue) actual).primaryLocation().endLineOffset() + 1).as("Bad end column at line " + expected.line()).isEqualTo(expected.endColumn()); } if (expected.endLine() != null) { assertThat(((PreciseIssue) actual).primaryLocation().endLine()).as("Bad end line at line " + expected.line()).isEqualTo(expected.endLine()); } if (expected.secondaryLines() != null) { assertThat(secondary(actual)).as("Bad secondary locations at line " + expected.line()).isEqualTo(expected.secondaryLines()); } }

Target:
private static void verifyIssue(TestIssue expected, PreciseIssue actual) { if (line(actual) > expected.line()) { fail("Missing issue at line " + expected.line()); } if (line(actual) < expected.line()) { fail("Unexpected issue at line " + line(actual) + ": \"" + actual.primaryLocation().message() + "\""); } if (expected.message() != null) { assertThat(actual.primaryLocation().message()).as("Bad message at line " + expected.line()).isEqualTo(expected.message()); } if (expected.effortToFix() != null) { assertThat(actual.cost()).as("Bad effortToFix at line " + expected.line()).isEqualTo(expected.effortToFix()); } if (expected.startColumn() != null) { assertThat(actual.primaryLocation().startLineOffset() + 1).as("Bad start column at line " + expected.line()).isEqualTo(expected.startColumn()); } if (expected.endColumn() != null) { assertThat(actual.primaryLocation().endLineOffset() + 1).as("Bad end column at line " + expected.line()).isEqualTo(expected.endColumn()); } if (expected.endLine() != null) { assertThat(actual.primaryLocation().endLine()).as("Bad end line at line " + expected.line()).isEqualTo(expected.endLine()); } if (expected.secondaryLines() != null) { assertThat(secondary(actual)).as("Bad secondary locations at line " + expected.line()).isEqualTo(expected.secondaryLines()); } }
Source:
private Component getComponent(String name, AbstractProject firstJob, AbstractProject lastJob, boolean showAggregatedPipeline, int componentNumber) throws PipelineException { Pipeline pipeline = Pipeline.extractPipeline(name, firstJob, lastJob); Component component = new Component(name, firstJob.getName(), firstJob.getUrl(), firstJob.isParameterized(), noOfPipelines, pagingEnabled, componentNumber); List<Pipeline> pipelines = new ArrayList<Pipeline>(); if (showAggregatedPipeline) { pipelines.add(pipeline.createPipelineAggregated(getOwnerItemGroup(), showAggregatedChanges)); } if (isFullScreenView()) { pipelines.addAll(pipeline.createPipelineLatest(noOfPipelines, getOwnerItemGroup(), false, component)); } else { pipelines.addAll(pipeline.createPipelineLatest(noOfPipelines, getOwnerItemGroup(), pagingEnabled, component)); } component.setPipeines(pipelines); return component; }

Target:
private Component getComponent(String name, AbstractProject firstJob, AbstractProject lastJob, boolean showAggregatedPipeline, int componentNumber) throws PipelineException { Pipeline pipeline = Pipeline.extractPipeline(name, firstJob, lastJob); Component component = new Component(name, firstJob.getName(), firstJob.getUrl(), firstJob.isParameterized(), noOfPipelines, pagingEnabled, componentNumber); List<Pipeline> pipelines = new ArrayList<Pipeline>(); if (showAggregatedPipeline) { pipelines.add(pipeline.createPipelineAggregated(getOwnerItemGroup(), showAggregatedChanges)); } if (isFullScreenView()) { pipelines.addAll(pipeline.createPipelineLatest(noOfPipelines, getOwnerItemGroup(), false, component)); } else { pipelines.addAll(pipeline.createPipelineLatest(noOfPipelines, getOwnerItemGroup(), pagingEnabled, component)); } component.setPipelines(pipelines); return component; }
Source:
public boolean matches(Object item) { if(item instanceof Shell){ Shell shell = (Shell)item; CompositeHandler compositeHandler = CompositeHandler.getInstance(); LabelHandler lHandler = LabelHandler.getInstance(); try{ Composite shellComposite = (Composite)compositeHandler.getChildren(shell)[0]; Control[] compositeChildren = compositeHandler.getChildren(shellComposite); Control labelControl = compositeChildren[2]; if(labelControl instanceof Label){ String labelText = lHandler.getText((Label)labelControl); if(title != null){ return title.equals(labelText); } return matcher.matches(labelText); } }catch (Exception e) { return false; } } return false; }

Target:
public boolean matches(Object item) { if(item instanceof Shell){ Shell shell = (Shell)item; CompositeHandler compositeHandler = CompositeHandler.getInstance(); LabelHandler lHandler = LabelHandler.getInstance(); try{ Composite shellComposite = (Composite)compositeHandler.getChildren(shell)[0]; Control[] compositeChildren = compositeHandler.getChildren(shellComposite); Control labelControl = compositeChildren[2]; if(labelControl instanceof Label){ String labelText = lHandler.getText((Label)labelControl); return matcher.matches(labelText); } }catch (Exception e) { return false; } } return false; }
Source:
public Connector processImageActionName() { return integrationContext -> { Map<String, Object> inBoundVariables = integrationContext.getInBoundVariables(); System.out.println("processImageActionName inbound variables keys: " + inBoundVariables.keySet()); System.out.println("processImageActionName inbound variables values: " + inBoundVariables.values()); boolean expectedValue = (Boolean) inBoundVariables.get("expectedKey"); integrationContext.addOutBoundVariable("approved", expectedValue); assertThat(((String) inBoundVariables.get("input-variable-name-1"))).isEqualTo("input-variable-name-1"); return integrationContext; }; }

Target:
public Connector processImageActionName() { return integrationContext -> { Map<String, Object> inBoundVariables = integrationContext.getInBoundVariables(); LOGGER.info("processImageActionName inbound variables keys: " + inBoundVariables.keySet()); LOGGER.info("processImageActionName inbound variables values: " + inBoundVariables.values()); boolean expectedValue = (Boolean) inBoundVariables.get("expectedKey"); integrationContext.addOutBoundVariable("approved", expectedValue); assertThat(((String) inBoundVariables.get("input-variable-name-1"))).isEqualTo("input-variable-name-1"); return integrationContext; }; }
Source:
private RbContentService.RbEndpoints createRbService(Site site) { RbContentService.RbEndpoints webService; webService = RestAdapterFactory.newInstance(site, String.format(Locale.ROOT, Prefs.getRestbaseUriFormat(), WikipediaApp.getInstance().getNetworkProtocol(), site.getDomain())) .create(RbContentService.RbEndpoints.class); return webService; }

Target:
private RbContentService.RbEndpoints createRbService(Site site) { RbContentService.RbEndpoints webService = RestAdapterFactory.newInstance(site, String.format(Locale.ROOT, Prefs.getRestbaseUriFormat(), WikipediaApp.getInstance().getNetworkProtocol(), site.getDomain())) .create(RbContentService.RbEndpoints.class); return webService; }
Source:
public void testGetSelectedElementUUIDWhenNotSelected() { selectedItems.clear(); assertEquals(null, ClientUtils.getSelectedElementUUID(viewerSession)); assertEquals(null, ClientUtils.getSelectedElementUUID(editorSession)); }

Target:
public void testGetSelectedElementUUIDWhenNotSelected() { selectedItems.clear(); assertNull(ClientUtils.getSelectedElementUUID(viewerSession)); assertNull(ClientUtils.getSelectedElementUUID(editorSession)); }
Source:
public Response shutdownTasksForDataSource(@PathParam("dataSource") final String dataSource) { return asLeaderWith( taskMaster.getTaskQueue(), new Function<TaskQueue, Response>() { @Override public Response apply(TaskQueue taskQueue) { final List<Task> tasks = taskStorageQueryAdapter.getActiveTasks(); boolean ownTask = false; for (final Task task : tasks) { if (task.getDataSource().equals(dataSource)) { taskQueue.shutdown(task.getId()); ownTask = true; } } if (!ownTask) { return Response.status(Response.Status.BAD_REQUEST) .entity(StringUtils.format( "Cannot find any active task for this dataSource: [%s]", dataSource )) .build(); } else { return Response.ok(ImmutableMap.of("dataSource", dataSource)).build(); } } } ); }

Target:
public Response shutdownTasksForDataSource(@PathParam("dataSource") final String dataSource) { return asLeaderWith( taskMaster.getTaskQueue(), new Function<TaskQueue, Response>() { @Override public Response apply(TaskQueue taskQueue) { final List<TaskInfo<Task, TaskStatus>> tasks = taskStorageQueryAdapter.getActiveTaskInfo(dataSource); for (final TaskInfo<Task, TaskStatus> task : tasks) { taskQueue.shutdown(task.getId()); } return Response.ok(ImmutableMap.of("dataSource", dataSource)).build(); } } ); }
Source:
void triggerReload() throws Exception { LiveReloadWebSocketHandler handler = connect(); this.server.triggerReload(); await().atMost(Duration.ofSeconds(1)).until(handler::getMessages, msgs -> msgs.get(0).contains("<LINK_0>") && msgs.get(1).contains("command\":\"reload\"")); }

Target:
void triggerReload() throws Exception { LiveReloadWebSocketHandler handler = connect(); this.server.triggerReload(); await().atMost(Duration.ofSeconds(1)).until(handler::getMessages, (msgs) -> msgs.get(0).contains("<LINK_0>") && msgs.get(1).contains("command\":\"reload\"")); }
Source:
protected Message<?> toMessagingMessage(org.springframework.amqp.core.Message amqpMessage) { if (this.batchingStrategy.canDebatch(amqpMessage.getMessageProperties())) { if (this.converterAdapter.isMessageList()) { List<Message<?>> messages = new ArrayList<>(); this.batchingStrategy.deBatch(amqpMessage, fragment -> { messages.add(super.toMessagingMessage(fragment)); }); return new GenericMessage<>(messages); } else { List<Object> list = new ArrayList<Object>(); this.batchingStrategy.deBatch(amqpMessage, fragment -> { list.add(this.converterAdapter.extractPayload(fragment)); }); return MessageBuilder.withPayload(list) .copyHeaders(this.converterAdapter .getHeaderMapper() .toHeaders(amqpMessage.getMessageProperties())) .build(); } } return super.toMessagingMessage(amqpMessage); }

Target:
protected Message<?> toMessagingMessage(org.springframework.amqp.core.Message amqpMessage) { if (this.batchingStrategy.canDebatch(amqpMessage.getMessageProperties())) { if (this.converterAdapter.isMessageList()) { List<Message<?>> messages = new ArrayList<>(); this.batchingStrategy.deBatch(amqpMessage, fragment -> { messages.add(super.toMessagingMessage(fragment)); }); return new GenericMessage<>(messages); } else { List<Object> list = new ArrayList<>(); this.batchingStrategy.deBatch(amqpMessage, fragment -> { list.add(this.converterAdapter.extractPayload(fragment)); }); return MessageBuilder.withPayload(list) .copyHeaders(this.converterAdapter .getHeaderMapper() .toHeaders(amqpMessage.getMessageProperties())) .build(); } } return super.toMessagingMessage(amqpMessage); }
Source:
private void checkLogDir() throws LogdirContentCheckException { File[] files = this.dataDir.listFiles(); if(files != null) { boolean hasSnapshotFiles = false; for (File file : files) { if(Util.isSnapshotFile(file)){ hasSnapshotFiles = true; break; } } if (hasSnapshotFiles) { throw new LogdirContentCheckException("Log directory has snapshot files. Check if dataLogDir and dataDir configuration is correct."); } } }

Target:
private void checkLogDir() throws LogDirContentCheckException { File[] files = this.dataDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return Util.isSnapshotFileName(name); } }); if (files != null && files.length > 0) { throw new LogDirContentCheckException("Log directory has snapshot files. Check if dataLogDir and dataDir configuration is correct."); } }