auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static <K,V extends Item> Map<K,V> loadChildren(ItemGroup parent, File modulesDir, Function1<? extends K,? super V> key) { modulesDir.mkdirs(); File[] subdirs = modulesDir.listFiles(new FileFilter() { public boolean accept(File child) { return child.isDirectory(); } }); CopyOnWriteMap.Tree<K,V> configurations = new CopyOnWriteMap.Tree<K,V>(); for (File subdir : subdirs) { try { V item = (V) parent.getItem(subdir.getName()); if (item == null) { XmlFile xmlFile = Items.getConfigFile( subdir ); if (xmlFile.exists()) { item = (V) Items.load( parent, subdir ); }else{ Logger.getLogger( ItemGroupMixIn.class.getName() ).log( Level.WARNING, "could not find file " + xmlFile.getFile()); continue; } } else { item.onLoad(parent, subdir.getName()); } configurations.put(key.call(item), item); } catch (IOException e) { Logger.getLogger(ItemGroupMixIn.class.getName()).log(Level.WARNING, "could not load " + subdir, e); } catch (Exception e) { <START> Logger.getLogger(ItemGroupMixIn.class.getName()).log(Level.WARNING, "could not load " + subdir, e); <END> } } return configurations; }</code><technical_language>If catching Exception delete prior catch of IOException redundant</technical_language>

Target:
public static <K,V extends Item> Map<K,V> loadChildren(ItemGroup parent, File modulesDir, Function1<? extends K,? super V> key) { modulesDir.mkdirs(); File[] subdirs = modulesDir.listFiles(new FileFilter() { public boolean accept(File child) { return child.isDirectory(); } }); CopyOnWriteMap.Tree<K,V> configurations = new CopyOnWriteMap.Tree<K,V>(); for (File subdir : subdirs) { try { V item = (V) parent.getItem(subdir.getName()); if (item == null) { XmlFile xmlFile = Items.getConfigFile( subdir ); if (xmlFile.exists()) { item = (V) Items.load( parent, subdir ); }else{ Logger.getLogger( ItemGroupMixIn.class.getName() ).log( Level.WARNING, "could not find file " + xmlFile.getFile()); continue; } } else { item.onLoad(parent, subdir.getName()); } configurations.put(key.call(item), item); } catch (Exception e) { Logger.getLogger(ItemGroupMixIn.class.getName()).log(Level.WARNING, "could not load " + subdir, e); } } return configurations; }
Source:
<code>TagsManager(SleuthkitCase caseDb) { this.caseDb = caseDb; TaggingManager taggingMgr = caseDb.getTaggingManager(); try { List<TagSet> setList = taggingMgr.getTagSets(); if (setList.isEmpty()) { <START> TagSet set = taggingMgr.addTagSet("Project VIC (United States)"); <END> for (TagNameDefinition def : TagNameDefinition.getProjectVICDefaultDefinitions()) { TagName tagName = caseDb.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus()); taggingMgr.addTagNameToTagSet(set, tagName); } for (TagNameDefinition def : TagNameDefinition.getStandardTagNameDefinitions()) { caseDb.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus()); } } } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex); } for (TagNameDefinition tagName : TagNameDefinition.getTagNameDefinitions()) { tagName.saveToCase(caseDb); } }</code><technical_language>In TagNameDefinition, default Project VIC tag set name a localizable string, is hard-coded here</technical_language>

Target:
TagsManager(SleuthkitCase caseDb) { this.caseDb = caseDb; TaggingManager taggingMgr = caseDb.getTaggingManager(); try { List<TagSet> setList = taggingMgr.getTagSets(); if (setList.isEmpty()) { List<TagName> tagNameList = new ArrayList<>(); for (TagNameDefinition def : TagNameDefinition.getProjectVICDefaultDefinitions()) { tagNameList.add(caseDb.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus())); } taggingMgr.addTagSet(DEFAULT_TAG_SET_NAME, tagNameList); for (TagNameDefinition def : TagNameDefinition.getStandardTagNameDefinitions()) { caseDb.addOrUpdateTagName(def.getDisplayName(), def.getDescription(), def.getColor(), def.getKnownStatus()); } } } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex); } for (TagNameDefinition tagName : TagNameDefinition.getTagNameDefinitions()) { tagName.saveToCase(caseDb); } }
Source:
<code>public int compare(Template firstTemplate, Template secondTemplate) { <START> if (Objects.isNull(firstTemplate) || Objects.isNull(secondTemplate)) { return 1; } if (Objects.isNull(firstTemplate.getWorkflow()) ? Objects.nonNull(secondTemplate.getWorkflow()) : Objects.isNull(secondTemplate.getWorkflow()) <END> || !firstTemplate.getWorkflow().getId().equals(secondTemplate.getWorkflow().getId())) { return 1; } if (Objects.isNull(firstTemplate.getRuleset()) ? Objects.nonNull(secondTemplate.getRuleset()) : Objects.isNull(secondTemplate.getRuleset()) || !firstTemplate.getRuleset().getId().equals(secondTemplate.getRuleset().getId())) { return 1; } if (Objects.isNull(firstTemplate.getDocket()) ? Objects.nonNull(secondTemplate.getDocket()) : Objects.isNull(secondTemplate.getDocket()) || !firstTemplate.getDocket().getId().equals(secondTemplate.getDocket().getId())) { return 1; } return 0; }</code><technical_language>This compare method return 1 (e.g. "unequal") if templates null. Is intended</technical_language>

Target:
public int compare(Template firstTemplate, Template secondTemplate) { if (Objects.isNull(firstTemplate)) { return Objects.isNull(secondTemplate) ? 0 : 1; } if (Objects.isNull(secondTemplate)) { return 1; } if (Objects.isNull(firstTemplate.getWorkflow()) ? Objects.nonNull(secondTemplate.getWorkflow()) : Objects.isNull(secondTemplate.getWorkflow()) || !firstTemplate.getWorkflow().getId().equals(secondTemplate.getWorkflow().getId())) { return 1; } if (Objects.isNull(firstTemplate.getRuleset()) ? Objects.nonNull(secondTemplate.getRuleset()) : Objects.isNull(secondTemplate.getRuleset()) || !firstTemplate.getRuleset().getId().equals(secondTemplate.getRuleset().getId())) { return 1; } if (Objects.isNull(firstTemplate.getDocket()) ? Objects.nonNull(secondTemplate.getDocket()) : Objects.isNull(secondTemplate.getDocket()) || !firstTemplate.getDocket().getId().equals(secondTemplate.getDocket().getId())) { return 1; } return 0; }
Source:
<code>protected void run() throws Failure { if (all && projectNames.size() > 0) { throw new UnloggedFailure(1, "error: cannot combine --all and PROJECT"); } ReplicationState state = new ReplicationState(ReplicationType.COMMAND, this); Future<?> future = null; if (all) { future = pushAllFactory.create(urlMatch, state).schedule(0, TimeUnit.SECONDS); } else { for (String name : projectNames) { Project.NameKey key = new Project.NameKey(name); if (projectCache.get(key) != null) { replication.scheduleFullSync(key, urlMatch, state); } else { writeStdErrSync("error: '" + name + "': not a Gerrit project"); } } state.markAllPushTasksScheduled(); } if (wait) { if (future != null) { try { future.get(); } catch (InterruptedException e) { <START> wrappedLog.error("Thread was interrupted while waiting for PushAll operation to finish", e, state); <END> } catch (ExecutionException e) { wrappedLog.error("An exception was thrown in PushAll operation", e, state); } } if (state.hasPushTask()) { try { state.waitForReplication(); } catch (InterruptedException e) { wrappedLog.error("We are interrupted while waiting replication to complete", state); } } else { writeStdOutSync("Nothing to replicate"); } } }</code><technical_language>Yes, avoid cases, exit earlier a "return" statement in exceptions</technical_language>

Target:
protected void run() throws Failure { if (all && projectNames.size() > 0) { throw new UnloggedFailure(1, "error: cannot combine --all and PROJECT"); } ReplicationState state = new ReplicationState(ReplicationType.COMMAND, this); Future<?> future = null; if (all) { future = pushAllFactory.create(urlMatch, state).schedule(0, TimeUnit.SECONDS); } else { for (String name : projectNames) { Project.NameKey key = new Project.NameKey(name); if (projectCache.get(key) != null) { replication.scheduleFullSync(key, urlMatch, state); } else { writeStdErrSync("error: '" + name + "': not a Gerrit project"); } } state.markAllPushTasksScheduled(); } if (wait) { if (future != null) { try { future.get(); } catch (InterruptedException e) { wrappedLog.error("Thread was interrupted while waiting for PushAll operation to finish", e, state); return; } catch (ExecutionException e) { wrappedLog.error("An exception was thrown in PushAll operation", e, state); return; } } if (state.hasPushTask()) { try { state.waitForReplication(); } catch (InterruptedException e) { writeStdErrSync("We are interrupted while waiting replication to complete"); } } else { writeStdOutSync("Nothing to replicate"); } } }
Source:
<code><START> public synchronized IFile createBookmarksFile() throws CoreException { <END> IFile file = getBookmarksFile(); if (fResource instanceof IFolder) { if (!file.exists()) { final IFile bookmarksFile = getProject().getTracesFolder().getResource().getFile(BOOKMARKS_HIDDEN_FILE); if (!bookmarksFile.exists()) { final InputStream source = new ByteArrayInputStream(new byte[0]); bookmarksFile.create(source, true, null); } bookmarksFile.setHidden(true); file.createLink(bookmarksFile.getLocation(), IResource.REPLACE, null); file.setHidden(true); file.setPersistentProperty(TmfCommonConstants.TRACETYPE, TmfTrace.class.getCanonicalName()); } } return file; }</code><technical_language>is sychnronized here? synch object is TmfTraceElement.this. prevents is createBookmarsFile() is executed thread separately for TmfTraceElement object. prevents is createBookmarksFile() createSupplementaryDirectory() of parent class is entered thread time for TmfTraceElement object</technical_language>

Target:
public IFile createBookmarksFile() throws CoreException { IFile file = getBookmarksFile(); if (fResource instanceof IFolder) { if (!file.exists()) { final IFile bookmarksFile = getProject().getTracesFolder().getResource().getFile(BOOKMARKS_HIDDEN_FILE); if (!bookmarksFile.exists()) { final InputStream source = new ByteArrayInputStream(new byte[0]); bookmarksFile.create(source, true, null); } bookmarksFile.setHidden(true); file.createLink(bookmarksFile.getLocation(), IResource.REPLACE, null); file.setHidden(true); file.setPersistentProperty(TmfCommonConstants.TRACETYPE, TmfTrace.class.getCanonicalName()); } } return file; }
Source:
<code>public void deleteAll() { try { <START> String query = new String("*:*"); <END> solrServer.deleteByQuery(query); } catch (SolrServerException e) { log.error(e.getLocalizedMessage(), e); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } }</code><technical_language>new String() is redundant</technical_language>

Target:
public void deleteAll() { try { String query = "*:*"; solrServer.deleteByQuery(query); } catch (SolrServerException e) { log.error(e.getLocalizedMessage(), e); } catch (IOException e) { log.error(e.getLocalizedMessage(), e); } }
Source:
<code>private SctId getLastSctId(final String namespace, final ComponentCategory category) { return store.get().read(new IndexRead<SctId>() { @Override public SctId execute(final Searcher index) throws IOException { final boolean intNamespace = CompareUtils.isEmpty(namespace); final Expression idsByNamespaceAndType = Expressions.builder() <START> .must(Expressions.exactMatch("namespace", intNamespace ? 0L : Long.parseLong(namespace))) <END> .must(Expressions.exactMatch("partitionId", (intNamespace ? "0" : "1") + Integer.toString(category.ordinal()))) .build(); final Hits<SctId> hits = index.search(Query.select(SctId.class) .where(idsByNamespaceAndType) .sortBy(SortBy.field("sequence", Order.DESC)) .offset(0) .limit(1) .build()); return Iterables.getOnlyElement(hits, null); } }); }</code><technical_language>Similarly Fields, declare Expressions in SctId class</technical_language>

Target:
private SctId getLastSctId(final String namespace, final ComponentCategory category) { return store.get().read(new IndexRead<SctId>() { @Override public SctId execute(final Searcher index) throws IOException { final Expression idsByNamespaceAndType = Expressions.builder() .must(SctId.Expressions.namespace(namespace)) .must(SctId.Expressions.partitionId(namespace, category)) .build(); final Hits<SctId> hits = index.search(Query.select(SctId.class) .where(idsByNamespaceAndType) .sortBy(SortBy.field(SctId.Fields.SEQUENCE, Order.DESC)) .offset(0) .limit(1) .build()); return Iterables.getOnlyElement(hits, null); } }); }
Source:
<code><START> private void startSending() { <END> if (!isTyping) { isTyping = true; h = new Handler(); h.postDelayed(new Runnable() { @Override public void run() { flushQueue(); if (currentIdleTime > TYPING_TIMEOUT) { isTyping = false; } else { h.postDelayed(this, PACKET_SEND_DUR); } } }, PACKET_SEND_DUR); } }</code><technical_language>I shortened rtt.addChild(rrtEvent.toElement()). nee handle case differently if anyway</technical_language>

Target:
private void startSending() { if (isTyping.compareAndSet(false, true)) { h = new Handler(); h.postDelayed(new Runnable() { @Override public void run() { flushQueue(); if (currentIdleTime > TYPING_TIMEOUT) { isTyping.set(false); } else { h.postDelayed(this, PACKET_SEND_DUR); } } }, PACKET_SEND_DUR); } }
Source:
<code>public void initialise() throws InitialisationException { this.flowConstruct = getFromAnnotatedObjectOrFail(muleContext.getConfigurationComponentLocator(), this); <START> this.flowProcessingTemplate = new SchedulerFlowProcessingTemplate(listener, new LinkedList<>(), this); <END> this.flowProcessContext = new SchedulerProcessContext(); createScheduler(); }</code><technical_language>LinkedList<> -> emptyList()</technical_language>

Target:
public void initialise() throws InitialisationException { this.flowConstruct = getFromAnnotatedObjectOrFail(muleContext.getConfigurationComponentLocator(), this); this.flowProcessingTemplate = new SchedulerFlowProcessingTemplate(listener, emptyList(), this); this.flowProcessContext = new SchedulerProcessContext(); createScheduler(); }
Source:
<code>public KnoxShellTable string(String csvString) throws IOException { <START> InputStream is = new ByteArrayInputStream(csvString.getBytes(StandardCharsets.UTF_8)); <END> try (Reader stringStreamReader = new InputStreamReader(is, StandardCharsets.UTF_8); BufferedReader csvReader = new BufferedReader(stringStreamReader);) { buildTableFromCSVReader(csvReader); } return this.table; }</code><technical_language>move this try block is closed too</technical_language>

Target:
public KnoxShellTable string(String csvString) throws IOException { try (InputStream is = new ByteArrayInputStream(csvString.getBytes(StandardCharsets.UTF_8)); Reader stringStreamReader = new InputStreamReader(is, StandardCharsets.UTF_8); BufferedReader csvReader = new BufferedReader(stringStreamReader);) { buildTableFromCSVReader(csvReader); } return this.table; }
Source:
<code>public Boolean put(final WifiInfo wifiInfo) { <START> final Map<String, AttributeValue> attributes = new HashMap<>(); <END> attributes.put(SENSE_ATTRIBUTE_NAME, new AttributeValue().withS(wifiInfo.senseId)); attributes.put(SSID_ATTRIBUTE_NAME, new AttributeValue().withS(wifiInfo.ssid)); attributes.put(RSSI_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(wifiInfo.rssi))); attributes.put(LAST_UPDATED_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(wifiInfo.lastUpdated))); final PutItemRequest putItemRequest = new PutItemRequest() .withTableName(wifiTableName) .withItem(attributes); try { final PutItemResult putItemResult = dynamoDBClient.putItem(putItemRequest); return putItemResult != null; } catch (AmazonServiceException ase) { LOGGER.error(ase.getMessage()); } return Boolean.FALSE; }</code><technical_language>strictly required, decouple creating Map<String, AttributeValue> calling putItem</technical_language>

Target:
public Boolean put(final WifiInfo wifiInfo) { final PutItemRequest putItemRequest = new PutItemRequest() .withTableName(wifiTableName) .withItem(createDynamoDBItemFromWifiInfo(wifiInfo)); try { final PutItemResult putItemResult = dynamoDBClient.putItem(putItemRequest); return putItemResult != null; } catch (AmazonServiceException ase) { LOGGER.error(ase.getMessage()); } return Boolean.FALSE; }
Source:
<code>@Override public void run() { init(); while (!Thread.currentThread().isInterrupted() && !stopped) { long currReservedSegment = -1; try { deleteObsoleteRawSegments(); currReservedSegment = tryReserveNextSegmentOrWait(); if (currReservedSegment == -1) continue; <START> File tmpZip = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment) + FilePageStoreManager.ZIP_SUFFIX + ".tmp"); <END> File zip = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment) + FilePageStoreManager.ZIP_SUFFIX); File raw = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment)); if (!Files.exists(raw.toPath())) throw new IgniteCheckedException("WAL archive segment is missing: " + raw); compressSegmentToFile(currReservedSegment, raw, tmpZip); Files.move(tmpZip.toPath(), zip.toPath()); if (mode != WALMode.NONE) { try (FileIO f0 = ioFactory.create(zip, CREATE, READ, WRITE)) { f0.force(); } if (evt.isRecordable(EVT_WAL_SEGMENT_COMPACTED)) { evt.record(new WalSegmentCompactedEvent( cctx.discovery().localNode(), currReservedSegment, zip.getAbsoluteFile()) ); } } lastCompressedIdx = currReservedSegment; } catch (IgniteCheckedException | IOException e) { U.error(log, "Compression of WAL segment [idx=" + currReservedSegment + "] was skipped due to unexpected error", e); lastCompressedIdx++; } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); } finally { if (currReservedSegment != -1) release(new FileWALPointer(currReservedSegment, 0, 0)); } } }</code><technical_language>extract ".tmp"</technical_language>

Target:
@Override public void run() { init(); while (!Thread.currentThread().isInterrupted() && !stopped) { long currReservedSegment = -1; try { deleteObsoleteRawSegments(); currReservedSegment = tryReserveNextSegmentOrWait(); if (currReservedSegment == -1) continue; File tmpZip = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment) + FilePageStoreManager.ZIP_SUFFIX + FilePageStoreManager.TMP_SUFFIX); File zip = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment) + FilePageStoreManager.ZIP_SUFFIX); File raw = new File(walArchiveDir, FileDescriptor.fileName(currReservedSegment)); if (!Files.exists(raw.toPath())) throw new IgniteCheckedException("WAL archive segment is missing: " + raw); compressSegmentToFile(currReservedSegment, raw, tmpZip); Files.move(tmpZip.toPath(), zip.toPath()); if (mode != WALMode.NONE) { try (FileIO f0 = ioFactory.create(zip, CREATE, READ, WRITE)) { f0.force(); } if (evt.isRecordable(EVT_WAL_SEGMENT_COMPACTED)) { evt.record(new WalSegmentCompactedEvent( cctx.discovery().localNode(), currReservedSegment, zip.getAbsoluteFile()) ); } } lastCompressedIdx = currReservedSegment; } catch (IgniteCheckedException | IOException e) { U.error(log, "Compression of WAL segment [idx=" + currReservedSegment + "] was skipped due to unexpected error", e); lastCompressedIdx++; } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); } finally { if (currReservedSegment != -1) release(new FileWALPointer(currReservedSegment, 0, 0)); } } }
Source:
<code>private void filterAccessibleProxiedArtifacts(final List<ArtifactEntry> artifactEntries) { if (CollectionUtils.isEmpty(artifactEntries)) { return; } for (final Iterator<ArtifactEntry> it = artifactEntries.iterator(); it.hasNext(); ) { final ArtifactEntry artifactEntry = it.next(); final Storage storage = configurationManager.getConfiguration().getStorage(artifactEntry.getStorageId()); final Repository repository = storage.getRepository(artifactEntry.getRepositoryId()); if (!repository.isProxyRepository()) { <START> logger.debug("Repository is not a proxy repository.", repository.getId()); <END> it.remove(); continue; } final RemoteRepository remoteRepository = repository.getRemoteRepository(); if (remoteRepository == null) { logger.warn("Repository is not associated with remote repository", repository.getId()); it.remove(); continue; } if (!remoteRepositoryAlivenessCacheManager.isAlive(remoteRepository)) { logger.warn("Remote repository is down. Artifacts won't be cleaned up.", remoteRepository.getUrl()); it.remove(); continue; } } }</code><technical_language>I causing a lot of unnecessary debugging output safely remove it</technical_language>

Target:
private void filterAccessibleProxiedArtifacts(final List<ArtifactEntry> artifactEntries) { if (CollectionUtils.isEmpty(artifactEntries)) { return; } for (final Iterator<ArtifactEntry> it = artifactEntries.iterator(); it.hasNext(); ) { final ArtifactEntry artifactEntry = it.next(); final Storage storage = configurationManager.getConfiguration().getStorage(artifactEntry.getStorageId()); final Repository repository = storage.getRepository(artifactEntry.getRepositoryId()); if (!repository.isProxyRepository()) { it.remove(); continue; } final RemoteRepository remoteRepository = repository.getRemoteRepository(); if (remoteRepository == null) { logger.warn("Repository is not associated with remote repository", repository.getId()); it.remove(); continue; } if (!remoteRepositoryAlivenessCacheManager.isAlive(remoteRepository)) { logger.warn("Remote repository is down. Artifacts won't be cleaned up.", remoteRepository.getUrl()); it.remove(); continue; } } }
Source:
<code>public SegmentLayer(IrisStarTable table) { if (table == null) { throw new InvalidParameterException("star table cannot be null"); } this.setInSource(table); this.suffix = '_' + table.getName(); this.setxCol(Column.SPECTRAL_COL.name()) .setyCol(Column.FLUX_COL.name()) .setErrorBarType(ErrorBarType.capped_lines) .setMarkType(ShapeType.open_circle) <START> .setSize(4); <END> this.showErrorBars = true; this.showMarks = true; }</code><technical_language>this statement setting default plotter preferences, move setxCol() setyCol() calls setInSource() line 189? way, meat (x, y, errors) is setInSource(), plotter preferences (errorBarType, markType, size, etc.) separate. Also, anytime setInSource() is called, x y values set well</technical_language>

Target:
public SegmentLayer(IrisStarTable table) { if (table == null) { throw new InvalidParameterException("star table cannot be null"); } this.setInSource(table); this.suffix = '_' + table.getName(); this.setErrorBarType(ErrorBarType.capped_lines) .setMarkType(ShapeType.open_circle) .setSize(4); this.showErrorBars = true; this.showMarks = true; }
Source:
<code>public void putByteBuffer(int index, ByteBuffer src, int len) { assert (len <= src.remaining()); if(src.hasArray()) { byte[] srcArray = src.array(); putBytes(index, srcArray, src.position(), len); } else { <START> for(int i = 0; i < len; ++i) { <END> putByte(index + i, src.get()); } } src.position(src.position() + len); }</code><technical_language>putByte() loop sounds slow (I 5x slower). java.nio.ByteBuffer#put(java.nio.ByteBuffer) java.nio.Buffer#limit(int) this? int currLimitOfSrc = src.limit(); src.limit(src.position() + len); reference.put(src); src.limit(currLimitOfSrc); urgent improve later</technical_language>

Target:
public void putByteBuffer(int index, ByteBuffer src, int len) { assert (len <= src.remaining()); if(src.hasArray()) { putBytes(index, src.array(), src.position(), len); src.position(src.position() + len); } else { int prevSrcLimit = src.limit(); try { src.limit(src.position() + len); reference.put(src); } finally { src.limit(prevSrcLimit); } } }
Source:
<code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File file = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); file = checkForIndex(request, response, file, request.getPathInfo()); <START> if (null == file) { <END> response.sendError(HttpServletResponse.SC_NOT_FOUND); } else { ServletUtils.sendFile(request, response, file, type); } }</code><technical_language>Please "something <operator> null" convention</technical_language>

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File file = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); file = checkForIndex(request, response, file, request.getPathInfo()); if (file == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else { ServletUtils.sendFile(request, response, file, type); } }
Source:
<code>private Set<ConstrainedElement> getFieldMetaData(Class<?> beanClass) { Set<ConstrainedElement> propertyMetaData = newHashSet(); for ( Field field : run( GetDeclaredFields.action( beanClass ) ) ) { if ( Modifier.isStatic( field.getModifiers() ) || field.isSynthetic() ) { continue; } <START> String name = new ExecutablePropertyNodeNameProvider( propertyNodeNameProvider, beanClass ).getName( field.getName() ); <END> JavaBeanField javaBeanField = new JavaBeanField( field, name ); if ( annotationProcessingOptions.areMemberConstraintsIgnoredFor( javaBeanField ) ) { continue; } propertyMetaData.add( findPropertyMetaData( javaBeanField ) ); } return propertyMetaData; }</code><technical_language>need create this ExecutablePropertyNodeNameProvider. a wrapper of field/getter implements Property interface added in this PR pass propertyNodeNameProvider. add propertyNodeNameProvider additional field this provider. in JavaBeanHelper it. add a method in helper resolve a name for us</technical_language>

Target:
private Set<ConstrainedElement> getFieldMetaData(Class<?> beanClass) { Set<ConstrainedElement> propertyMetaData = newHashSet(); for ( Field field : run( GetDeclaredFields.action( beanClass ) ) ) { if ( Modifier.isStatic( field.getModifiers() ) || field.isSynthetic() ) { continue; } JavaBeanField javaBeanField = javaBeanHelper.field( field ); if ( annotationProcessingOptions.areMemberConstraintsIgnoredFor( javaBeanField ) ) { continue; } propertyMetaData.add( findPropertyMetaData( javaBeanField ) ); } return propertyMetaData; }
Source:
<code>private void updateMetaDataDescription(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); if (!isDomainExistAndActive()) { addAuditLog(storageDomain, diskImage); return; } try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); <START> addAuditLog(storageDomain, diskImage); <END> } }</code><technical_language>this a audit log of error, while other of warning (not performing failed)</technical_language>

Target:
private void updateMetaDataDescription(DiskImage diskImage) { StorageDomain storageDomain = getStorageDomainDAO().getForStoragePool(diskImage.getStorageIds().get(0), getVm().getStoragePoolId()); if (!isDomainExistAndActive()) { addAuditLog(storageDomain, diskImage); return; } try { SetVolumeDescriptionVDSCommandParameters vdsCommandParameters = new SetVolumeDescriptionVDSCommandParameters(getVm().getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId(), getJsonDiskDescription()); runVdsCommand(VDSCommandType.SetVolumeDescription, vdsCommandParameters); } catch (Exception e) { log.error("Exception while setting volume description for disk. ERROR: '{}'", e); auditLogForNoMetadataDescriptionUpdate(storageDomain, diskImage); } }
Source:
<code><START> private boolean initTranscripts(){ <END> loadTranscriptsData(unit); try { initTranscriptListView(); updateTranscript(subtitlesObj); return true; } catch (NullPointerException e) { return false; } }</code><technical_language>Return of method is used</technical_language>

Target:
private void initTranscripts() { loadTranscriptsData(); if (subtitlesObj != null) { initTranscriptListView(); updateTranscript(subtitlesObj); } }
Source:
<code>private static List<CaseLabelTree> allLabels(SwitchStatementTree switchStatementTree) { return switchStatementTree.cases().stream() .flatMap(caseGroup -> caseGroup.labels().stream()) <START> .collect(Collectors.toList()); <END> }</code><technical_language>solely a stream size return a Stream here... need collect a list..</technical_language>

Target:
private static Stream<CaseLabelTree> allLabels(SwitchStatementTree switchStatementTree) { return switchStatementTree.cases().stream().flatMap(caseGroup -> caseGroup.labels().stream()); }
Source:
<code>public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters) { List<VDS> acceptableHostsList = vmToHostAffinityFilterPolicyUnit.get().getAcceptableHosts(false, hosts, vm, new PerHostMessages(), getPendingResourceManager()); Map<Guid, VDS> acceptableHostsMap = new HashMap<>(); if <START> (acceptableHostsList != null) { <END> acceptableHostsMap = acceptableHostsList.stream().collect(Collectors.toMap(VDS::getId, h -> h)); } List<Pair<Guid, Integer>> retList = new ArrayList<>(); int score; for (VDS host : hosts) { score = DEFAULT_SCORE; if (!acceptableHostsMap.containsKey(host.getId())) { score = MaxSchedulerWeight; } retList.add(new Pair<>(host.getId(), score)); } return retList; }</code><technical_language>I acceptableHostsList null</technical_language>

Target:
public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters) { List<VDS> acceptableHostsList = vmToHostAffinityFilterPolicyUnit.get().getAcceptableHosts(false, hosts, vm, new PerHostMessages(), getPendingResourceManager()); Map<Guid, VDS> acceptableHostsMap = acceptableHostsList.stream().collect(Collectors.toMap(VDS::getId, h -> h)); List<Pair<Guid, Integer>> retList = new ArrayList<>(); int score; for (VDS host : hosts) { score = DEFAULT_SCORE; if (!acceptableHostsMap.containsKey(host.getId())) { score = MaxSchedulerWeight; } retList.add(new Pair<>(host.getId(), score)); } return retList; }
Source:
<code>private boolean upgradeProviderDb(SQLiteDatabase db, ProviderUtils.ProviderType type) { File oldDbFile = CommCareApplication._().getDatabasePath(type.getOldDbName()); if (oldDbFile.exists()) { File newDbFile = CommCareApplication._().getDatabasePath( ProviderUtils.getProviderDbName(type, getInstalledAppRecord(c, db).getApplicationId())); <START> if (!oldDbFile.renameTo(newDbFile)) { <END> return false; } else { return true; } } return true; }</code><technical_language>should. If rename file app work. do "Start sqldb transaction for app record. try move form provider try move instance provider if succeed, commit transaciton if fails, revert transaction restart commcare." app try restarts</technical_language>

Target:
private boolean upgradeProviderDb(SQLiteDatabase db, ProviderUtils.ProviderType type) { File oldDbFile = CommCareApplication._().getDatabasePath(type.getOldDbName()); if (oldDbFile.exists()) { File newDbFile = CommCareApplication._().getDatabasePath( ProviderUtils.getProviderDbName(type, getInstalledAppRecord(c, db).getApplicationId())); if (!oldDbFile.renameTo(newDbFile)) { throw new MigrationException(false); } else { return true; } } return true; }
Source:
<code>public VmNextRunConfigurationModel() { setApplyCpuLater(new EntityModel<Boolean>(false)); <START> setVmUnpinnedLatch(new EntityModel<Boolean>(false)); <END> getVmUnpinnedLatch().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { if (isVmUnpinned()) { UICommand okCommand = getCommands().get(0); if (okCommand != null) { okCommand.setIsExecutionAllowed(getVmUnpinnedLatch().getEntity()); } } } }); }</code><technical_language>ConfirmationModel.getLatch()</technical_language>

Target:
public VmNextRunConfigurationModel() { setApplyCpuLater(new EntityModel<Boolean>(false)); setVmUnpinnedLatch(new EntityModel<Boolean>(false)); setLatch(getVmUnpinnedLatch()); }
Source:
<code>public void start(Properties props) { try { HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); assignment = context.assignment(); hdfsWriter = new HdfsWriter(connectorConfig, assignment); recover(assignment); resetOffsets(); } catch (ConfigException e) { <START> throw new CopycatException( <END> "Couldn't start HdfsSinkConnector due to configuration error.", e); } }</code><technical_language>more clean here? thinking if start() encounters error, giving resources acquired far. In particular, if leases for some of WALs, give task in a state of start() reinvoked</technical_language>

Target:
public void start(Properties props) { try { HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); int schemaCacheSize = connectorConfig.getInt(HdfsSinkConnectorConfig.SCHEMA_CACHE_SIZE_CONFIG); avroData = new AvroData(schemaCacheSize); hdfsWriter = new HdfsWriter(connectorConfig, context, avroData); Set<TopicPartition> assignment = context.assignment(); recover(assignment); } catch (ConfigException e) { throw new CopycatException( "Couldn't start HdfsSinkConnector due to configuration error.", e); } catch (CopycatException e) { hdfsWriter.close(); } }
Source:
<code>private void karmaDec( ReceivePrivmsg event ) { Matcher decMatcher = decrementPattern.matcher( event.getText() ); if ( decMatcher.matches() ) { String wordBlob = decMatcher.group( 0 ); List<String> nicks = new LinkedList<String>(); Matcher nickMatcher = decBlobPattern.matcher( wordBlob ); while ( nickMatcher.find() ) { nicks.add( BaseNick.toBaseNick( nickMatcher.group( 1 ) ) ); } for ( String nick : nicks ) { if ( !nick.equals( bot.getNick() ) ) KarmaDB.modNounKarma( nick, -1 ); else <START> event.reply( "I think I'm supposed to insult you now." ); <END> } } }</code><technical_language>this for loop, result in a lot of duplicate messages channel if decrements bot times in message</technical_language>

Target:
private void karmaDec( ReceivePrivmsg event ) { Matcher decMatcher = decrementPattern.matcher( event.getText() ); if ( decMatcher.matches() ) { String wordBlob = decMatcher.group( 0 ); List<String> nicks = new LinkedList<String>(); Matcher nickMatcher = decBlobPattern.matcher( wordBlob ); while ( nickMatcher.find() ) { nicks.add( BaseNick.toBaseNick( nickMatcher.group( 1 ) ) ); } boolean insult = false; for ( String nick : nicks ) { if ( !nick.equals( bot.getNick() ) ) KarmaDB.modNounKarma( nick, -1 ); else insult = true; } if ( insult ) event.reply( "I think I'm supposed to insult you now." ); } }
Source:
<code>private void checkTaskManagerTimeout(int redundantTaskManagerNum) throws Exception { Executor executor = TestingUtils.defaultExecutor(); canBeReleasedFuture.set(CompletableFuture.completedFuture(true)); try (SlotManager slotManager = SlotManagerBuilder .newBuilder() .setTaskManagerTimeout(Time.milliseconds(10L)) .setRedundantTaskManagerNum(redundantTaskManagerNum) <START> .build()) { slotManager.start(resourceManagerId, executor, resourceManagerActions); <END> executor.execute(() -> slotManager.registerTaskManager(taskManagerConnection, slotReport)); assertThat(releaseFuture.get(), is(equalTo(taskManagerConnection.getInstanceID()))); } }</code><technical_language>buildAndStartWithDirectExec#buildAndStartWithDirectExec instead</technical_language>

Target:
private void checkTaskManagerTimeout(int redundantTaskManagerNum) throws Exception { canBeReleasedFuture.set(CompletableFuture.completedFuture(true)); try (SlotManager slotManager = SlotManagerBuilder .newBuilder() .setTaskManagerTimeout(Time.milliseconds(10L)) .setRedundantTaskManagerNum(redundantTaskManagerNum) .buildAndStartWithDirectExec(resourceManagerId, resourceManagerActions)) { slotManager.registerTaskManager(taskManagerConnection, slotReport); assertThat(releaseFuture.get(), is(equalTo(taskManagerConnection.getInstanceID()))); } }
Source:
<code>Slice(byte[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = ARRAY_BYTE_BASE_OFFSET + offset; this.size = length; this.retainedSize = INSTANCE_SIZE + sizeOf(base); <START> this.reference = (offset == 0 && length == base.length ? COMPACT : NOT_COMPACT); <END> }</code><technical_language>I missed updating parenthesis this</technical_language>

Target:
Slice(byte[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = ARRAY_BYTE_BASE_OFFSET + offset; this.size = length; this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length) ? COMPACT : NOT_COMPACT; }
Source:
<code>public CompletableFuture<Object> invokeAsync(InvocationContext ctx, VisitableCommand command) { <START> Stages.pushInvocationIdNDC(command, trace); <END> try { Object result = firstInterceptor.visitCommand(ctx, command); if (result instanceof InvocationStage) { return ((InvocationStage) result).toCompletableFuture(); } else { return CompletableFuture.completedFuture(result); } } catch (Throwable t) { return CompletableFutures.completedExceptionFuture(t); } finally { Stages.popInvocationIdNDC(command, trace); } }</code><technical_language>offtopic: related PR. compete Radim for longest PR? :)</technical_language>

Target:
public CompletableFuture<Object> invokeAsync(InvocationContext ctx, VisitableCommand command) { try { Object result = firstInterceptor.visitCommand(ctx, command); if (result instanceof InvocationStage) { return ((InvocationStage) result).toCompletableFuture(); } else { return CompletableFuture.completedFuture(result); } } catch (Throwable t) { return CompletableFutures.completedExceptionFuture(t); } }
Source:
<code>private Network <START> getGlusterNetworkId(VdsStatic <END> server, String networkAddress) { List<Network> allNetworksInCluster = DbFacade.getInstance().getNetworkDao().getAllForCluster(server.getVdsGroupId()); for (Network network : allNetworksInCluster) { if (network.getCluster().isGluster()) { return network; } } return null; }</code><technical_language>getGlusterNetwork. networkAddress is used. pass 'clusterId' function more readable</technical_language>

Target:
private Network getGlusterNetworkId(VdsStatic server, String networkAddress) { List<Network> allNetworksInCluster = DbFacade.getInstance().getNetworkDao().getAllForCluster(server.getVdsGroupId()); for (Network network : allNetworksInCluster) { if (network.getCluster().isGluster() && isSameNetworkAddress(server.getId(), network.getName(), networkAddress)) { return network; } } return null; }
Source:
<code>public GridH2Table( CreateTableData createTblData, GridH2RowDescriptor desc, H2TableDescriptor tblDesc, GridCacheContextInfo cacheInfo ) { super(createTblData); assert tblDesc != null; this.desc = desc; this.cacheInfo = cacheInfo; affKeyCol = calculateAffinityKeyColumn(); affKeyColIsKey = affKeyCol != null && desc.isKeyColumn(affKeyCol.column.getColumnId()); identifier = new QueryTable(getSchema().getName(), getName()); identifierStr = identifier.schema() + "." + identifier.table(); idxs = tblDesc.createSystemIndexes(this); assert idxs != null; List<Index> clones = new ArrayList<>(idxs.size()); for (Index index : idxs) { Index clone = createDuplicateIndexIfNeeded(index); if (clone != null) clones.add(clone); } idxs.addAll(clones); boolean hasHashIndex = idxs.size() >= 2 && index(0).getIndexType().isHash(); if (hasHashIndex) idxs.add(0, new H2TableScanIndex(this, index(1), index(0))); else idxs.add(0, new H2TableScanIndex(this, index(0), null)); pkIndexPos = hasHashIndex ? 2 : 1; sysIdxsCnt = idxs.size(); lock = new ReentrantReadWriteLock(); if (desc != null && desc.context() != null) { GridKernalContext ctx = desc.context().kernalContext(); log = ctx.log(getClass()); } <START> assert log != null; <END> }</code><technical_language>a bit strange. Check log initialized, initialized in case desc context fro desc exist. I cases happen ( desc is null context is null). add check</technical_language>

Target:
public GridH2Table( CreateTableData createTblData, GridH2RowDescriptor desc, H2TableDescriptor tblDesc, GridCacheContextInfo cacheInfo ) { super(createTblData); assert tblDesc != null; this.desc = desc; this.cacheInfo = cacheInfo; affKeyCol = calculateAffinityKeyColumn(); affKeyColIsKey = affKeyCol != null && desc.isKeyColumn(affKeyCol.column.getColumnId()); identifier = new QueryTable(getSchema().getName(), getName()); identifierStr = identifier.schema() + "." + identifier.table(); idxs = tblDesc.createSystemIndexes(this); assert idxs != null; List<Index> clones = new ArrayList<>(idxs.size()); for (Index index : idxs) { Index clone = createDuplicateIndexIfNeeded(index); if (clone != null) clones.add(clone); } idxs.addAll(clones); boolean hasHashIndex = idxs.size() >= 2 && index(0).getIndexType().isHash(); if (hasHashIndex) idxs.add(0, new H2TableScanIndex(this, index(1), index(0))); else idxs.add(0, new H2TableScanIndex(this, index(0), null)); pkIndexPos = hasHashIndex ? 2 : 1; sysIdxsCnt = idxs.size(); lock = new ReentrantReadWriteLock(); if (cacheInfo.affinityNode()) { long totalTblSize = rowCount(false); size.add(totalTblSize); } tblStats = new TableStatistics(0, 0); if (desc != null && desc.context() != null) { GridKernalContext ctx = desc.context().kernalContext(); log = ctx.log(getClass()); } }
Source:
<code>protected GlusterVolumeProfileInfo setBrickNames(GlusterVolumeProfileInfo profileInfo) { List<BrickProfileDetails> brickProfiles= profileInfo.getBrickProfileDetails(); <START> for(int i = 0; i < brickProfiles.size(); i++) { <END> brickProfiles.get(i).setBrickName(DbFacade.getInstance().getGlusterBrickDao().getById(brickProfiles.get(i).getBrickId()).getQualifiedName()); } return profileInfo; }</code><technical_language>for brickProfile in brickProfiles ?</technical_language>

Target:
protected GlusterVolumeProfileInfo setBrickNames(GlusterVolumeProfileInfo profileInfo) { List<BrickProfileDetails> brickProfiles= profileInfo.getBrickProfileDetails(); for(BrickProfileDetails brickProfileDetails : brickProfiles) { brickProfileDetails.setBrickName(DbFacade.getInstance().getGlusterBrickDao().getById(brickProfileDetails.getBrickId()).getQualifiedName()); } return profileInfo; }
Source:
<code>public void setDataSourceCountCallback_switchesToDefinedSize_throwsOnSizeQuery() { TestComponent testComponent = new TestComponent(); Assert.assertTrue(testComponent.getLazyDataView().isDefinedSize()); testComponent.setDataSource(query -> Stream.of("foo","bar","baz")); Assert.assertFalse(testComponent.getLazyDataView().isDefinedSize()); testComponent.getLazyDataView().withDefinedSize(); <START> expectedException.expect(IllegalStateException.class); <END> testComponent.getLazyDataView().getSize(); }</code><technical_language>annotation expected is enough checking message</technical_language>

Target:
public void setDataSourceCountCallback_switchesToDefinedSize_throwsOnSizeQuery() { TestComponent testComponent = new TestComponent(); testComponent.setDataSource(query -> Stream.of("foo","bar","baz")); Assert.assertFalse(testComponent.getLazyDataView().isDefinedSize()); testComponent.getLazyDataView().withDefinedSize(); Assert.assertTrue(testComponent.getLazyDataView().isDefinedSize()); expectedException.expect(IllegalStateException.class); testComponent.getLazyDataView().getSize(); }
Source:
<code>public void open() throws Exception { joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader()); joinCondition.setRuntimeContext(getRuntimeContext()); joinCondition.open(new Configuration()); nextLeftIndex = getRuntimeContext().getState( new ValueStateDescriptor<>(NEXT_LEFT_INDEX_STATE_NAME, Types.LONG)); leftState = getRuntimeContext().getMapState( new MapStateDescriptor<>(LEFT_STATE_NAME, Types.LONG, leftType)); rightState = getRuntimeContext().getMapState( new MapStateDescriptor<>(RIGHT_STATE_NAME, Types.LONG, rightType)); registeredTimer = getRuntimeContext().getState( new ValueStateDescriptor<>(REGISTERED_TIMER_STATE_NAME, Types.LONG)); timerService = getInternalTimerService( TIMERS_STATE_NAME, VoidNamespaceSerializer.INSTANCE, this); collector = new TimestampedCollector<>(output); outRow = new JoinedRow(); <START> } <END></code><technical_language>expicity call outRow.setRowKind(RowKind.INSERT)</technical_language>

Target:
public void open() throws Exception { joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader()); joinCondition.setRuntimeContext(getRuntimeContext()); joinCondition.open(new Configuration()); nextLeftIndex = getRuntimeContext().getState( new ValueStateDescriptor<>(NEXT_LEFT_INDEX_STATE_NAME, Types.LONG)); leftState = getRuntimeContext().getMapState( new MapStateDescriptor<>(LEFT_STATE_NAME, Types.LONG, leftType)); rightState = getRuntimeContext().getMapState( new MapStateDescriptor<>(RIGHT_STATE_NAME, Types.LONG, rightType)); registeredTimer = getRuntimeContext().getState( new ValueStateDescriptor<>(REGISTERED_TIMER_STATE_NAME, Types.LONG)); timerService = getInternalTimerService( TIMERS_STATE_NAME, VoidNamespaceSerializer.INSTANCE, this); collector = new TimestampedCollector<>(output); outRow = new JoinedRow(); outRow.setRowKind(RowKind.INSERT); }
Source:
<code>public void endWindow() { logger.info("in endWindow()"); while (doneTuples.peek() != null) { S3Reconciler.OutputMetaData metaData = doneTuples.poll(); logger.info("found metaData = {}", metaData); committedTuples.remove(metaData); try { Path dest = new Path(metaData.getPath()); FileStatus[] statuses = fs.listStatus(dest.getParent()); <START> logger.info("found statuses = {}", statuses); <END> for (FileStatus status : statuses) { String statusName = status.getPath().getName(); logger.info("statusName = {}", statusName); if (statusName.endsWith(TMP_EXTENSION) && statusName.startsWith(metaData.getFileName())) { String actualFileName = statusName.substring(0, statusName.lastIndexOf('.', statusName.lastIndexOf('.') - 1)); logger.info("actualFileName = {}", actualFileName); if (metaData.getFileName().equals(actualFileName)) { logger.info("deleting stray file {}", statusName); fs.delete(status.getPath(), true); } } else if (statusName.equals(metaData.getFileName())) { logger.info("deleting s3-compaction file {}", statusName); fs.delete(status.getPath(), true); } } } catch (IOException e) { logger.error("Unable to Delete a file: {}", metaData.getFileName()); } } }</code><technical_language>please add statements debug instead of info</technical_language>

Target:
public void endWindow() { logger.info("in endWindow()"); while (doneTuples.peek() != null) { FSRecordCompactionOperator.OutputMetaData metaData = doneTuples.poll(); logger.debug("found metaData = {}", metaData); committedTuples.remove(metaData); try { Path dest = new Path(metaData.getPath()); FileStatus[] statuses = fs.listStatus(dest.getParent()); for (FileStatus status : statuses) { String statusName = status.getPath().getName(); if (statusName.endsWith(TMP_EXTENSION) && statusName.startsWith(metaData.getFileName())) { String actualFileName = statusName.substring(0, statusName.lastIndexOf('.', statusName.lastIndexOf('.') - 1)); logger.debug("actualFileName = {}", actualFileName); if (metaData.getFileName().equals(actualFileName)) { logger.debug("deleting stray file {}", statusName); fs.delete(status.getPath(), true); } } else if (statusName.equals(metaData.getFileName())) { logger.info("deleting s3-compaction file {}", statusName); fs.delete(status.getPath(), true); } } } catch (IOException e) { logger.error("Unable to Delete a file: {}", metaData.getFileName()); } } }