auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void endVmCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { final boolean taskGroupSucceeded = getParameters().getTaskGroupSuccess(); Guid createdSnapshotId = getSnapshotDao().getId(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshotId, SnapshotStatus.OK); if (getParameters().getParentCommand() != VdcActionType.RunVm && getVm() != null && getVm().isStatusUp() && getVm().getRunOnVds() != null) { performLiveSnapshot(createdSnapshotId); } } else { revertToActiveSnapshot(createdSnapshotId); } getVmStaticDAO().incrementDbGeneration(getVm().getId()); endActionOnDisks(); setSucceeded(taskGroupSucceeded); getReturnValue().setEndActionTryAgain(false); return null; } }); <START> if (getVm().isAutoStartup() && isVmDownUnintentionally() && getParameters().getInitialVmStatus() != VMStatus.Down) { <END> Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId()), ExecutionHandler.createInternalJobContext()); } }</code><technical_language>i is a check for getVm() != null transaction (previous code) i guess for a reason, add</technical_language>

Target:
protected void endVmCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { final boolean taskGroupSucceeded = getParameters().getTaskGroupSuccess(); Guid createdSnapshotId = getSnapshotDao().getId(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshotId, SnapshotStatus.OK); if (getParameters().getParentCommand() != VdcActionType.RunVm && getVm() != null && getVm().isStatusUp() && getVm().getRunOnVds() != null) { performLiveSnapshot(createdSnapshotId); } } else { revertToActiveSnapshot(createdSnapshotId); } getVmStaticDAO().incrementDbGeneration(getVm().getId()); endActionOnDisks(); setSucceeded(taskGroupSucceeded); getReturnValue().setEndActionTryAgain(false); return null; } }); if (getVm() != null && getVm().isAutoStartup() && isVmDownUnintentionally() && getParameters().getInitialVmStatus() != VMStatus.Down) { Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId()), ExecutionHandler.createInternalJobContext()); } }
Source:
<code>public void testSaveToKeyValueCacheWithoutCacheDir() throws Exception { <START> File keyValueCacheDir = new File(temporaryFolder.getRoot(), "ParseKeyValueCache"); <END> assertTrue(keyValueCacheDir.exists()); keyValueCacheDir.delete(); assertFalse(keyValueCacheDir.exists()); ParseKeyValueCache.saveToKeyValueCache("key", "value"); assertEquals(1, keyValueCacheDir.listFiles().length); assertArrayEquals( "value".getBytes(), ParseFileUtils.readFileToByteArray(keyValueCacheDir.listFiles()[0])); }</code><technical_language>nit: hold a reference File in initialize() in setUp here</technical_language>

Target:
public void testSaveToKeyValueCacheWithoutCacheDir() throws Exception { assertTrue(keyValueCacheDir.exists()); keyValueCacheDir.delete(); assertFalse(keyValueCacheDir.exists()); ParseKeyValueCache.saveToKeyValueCache("key", "value"); assertEquals(1, keyValueCacheDir.listFiles().length); assertArrayEquals( "value".getBytes(), ParseFileUtils.readFileToByteArray(keyValueCacheDir.listFiles()[0])); }
Source:
<code>public void deleteDocument(Exchange exchange) throws Exception { validateRequiredHeader(exchange, CamelCMISConstants.CMIS_OBJECT_ID); Message message = exchange.getIn(); String objectId = message.getHeader(CamelCMISConstants.CMIS_OBJECT_ID, String.class); <START> Boolean allVersions = Boolean.valueOf(message.getHeader(CamelCMISConstants.ALL_VERSIONS, String.class)); <END> Document document = (Document) getSessionFacade().getObjectById(objectId); document.delete(allVersions); }</code><technical_language>message.getHeader(xxx, Boolean.class)</technical_language>

Target:
public void deleteDocument(Exchange exchange) throws Exception { validateRequiredHeader(exchange, CamelCMISConstants.CMIS_OBJECT_ID); Message message = exchange.getIn(); String objectId = message.getHeader(CamelCMISConstants.CMIS_OBJECT_ID, String.class); Boolean allVersions = message.getHeader(CamelCMISConstants.ALL_VERSIONS, Boolean.class); Document document = (Document) getSessionFacade().getObjectById(objectId); document.delete(allVersions); }
Source:
<code>public WellKnownImage(@Nullable String loginUser, String uuid, String description, OsFamily osFamily, @Nullable String osVersion, int size, @Nullable Boolean is64bit) { this.loginUser = firstNonNull(loginUser, DEFAULT_USER); this.uuid = checkNotNull(uuid, "uuid cannot be mull"); this.description = checkNotNull(description, "description cannot be mull"); <START> this.osFamily = checkNotNull(osFamily, "osFamily cannot be mull"); <END> this.osVersion = osVersion; this.size = size; this.is64bit = firstNonNull(is64bit, Boolean.TRUE); }</code><technical_language>[minor] mull? ;-)</technical_language>

Target:
public WellKnownImage(@Nullable String loginUser, String uuid, String description, OsFamily osFamily, @Nullable String osVersion, int size, @Nullable Boolean is64bit) { this.loginUser = firstNonNull(loginUser, DEFAULT_USER); this.uuid = checkNotNull(uuid, "uuid cannot be null"); this.description = checkNotNull(description, "description cannot be null"); this.osFamily = checkNotNull(osFamily, "osFamily cannot be null"); this.osVersion = osVersion; this.size = size; this.is64bit = firstNonNull(is64bit, Boolean.TRUE); }
Source:
<code>private void createAuditTable(final IDBI dbi, final String tableName) { createTable( dbi, tableName, ImmutableList.of( String.format( "CREATE TABLE %1$s (\n" + " id %2$s NOT NULL,\n" + " auditkey VARCHAR(255) NOT NULL,\n" + " author VARCHAR(255) NOT NULL,\n" + " emailid VARCHAR(255) NOT NULL,\n" + " comment VARCHAR(2048) NOT NULL,\n" + " audit_time VARCHAR(255) NOT NULL,\n" <START> + " config_payload %3$s NOT NULL,\n" <END> + " PRIMARY KEY(id)\n" + ")", tableName, getSerialType(), getPayloadType() ), String.format("CREATE INDEX idx_%1$s_auditkey_time ON %1$s(auditkey, audit_time)", tableName), String.format("CREATE INDEX idx_%1$s_audit_time ON %1$s(audit_time)", tableName) ) ); }</code><technical_language>call this payload</technical_language>

Target:
private void createAuditTable(final IDBI dbi, final String tableName) { createTable( dbi, tableName, ImmutableList.of( String.format( "CREATE TABLE %1$s (\n" + " id %2$s NOT NULL,\n" + " audit_key VARCHAR(255) NOT NULL,\n" + " type VARCHAR(255) NOT NULL,\n" + " author VARCHAR(255) NOT NULL,\n" + " comment VARCHAR(2048) NOT NULL,\n" + " created_date VARCHAR(255) NOT NULL,\n" + " payload %3$s NOT NULL,\n" + " PRIMARY KEY(id)\n" + ")", tableName, getSerialType(), getPayloadType() ), String.format("CREATE INDEX idx_%1$s_key_time ON %1$s(audit_key, created_date)", tableName), String.format("CREATE INDEX idx_%1$s_type_time ON %1$s(audit_key, created_date)", tableName), String.format("CREATE INDEX idx_%1$s_audit_time ON %1$s(created_date)", tableName) ) ); }
Source:
<code>public IOMode getIOConfiguration(IOLine ioLine) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); <START> if (ioLine == null) <END> throw new NullPointerException("DIO pin cannot be null."); String atCommand = ioLine.getATCommand(); ATCommandResponse response = sendATCommand(new ATCommand(atCommand)); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); int ioModeValue = response.getResponse()[0]; IOMode dioMode = IOMode.getIOMode(ioModeValue, ioLine); if (dioMode != null) return dioMode; throw new XBeeException(XBeeException.INVALID_OPERATION); }</code><technical_language>Change DIO Line</technical_language>

Target:
public IOMode getIOConfiguration(IOLine ioLine) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("DIO pin cannot be null."); ATCommandResponse response = sendATCommand(new ATCommand(ioLine.getConfigurationATCommand())); if (response == null || response.getResponseStatus() != ATCommandStatus.OK || response == null || response.getResponse().length == 0) throw new XBeeException(XBeeException.INVALID_OPERATION); int ioModeValue = response.getResponse()[0]; IOMode dioMode = IOMode.getIOMode(ioModeValue, ioLine); if (dioMode != null) return dioMode; throw new XBeeException(XBeeException.INVALID_OPERATION); }
Source:
<code>public void install(SnapshotReader snapshotReader) { if (mClosed) { return; } if (mIgnoreApplys) { LOG.warn("Unexpected request to install a snapshot on a read-only journal state machine"); return; } long snapshotId = 0L; try (InputStream srs = new SnapshotReaderStream(snapshotReader)) { snapshotId = snapshotReader.readLong(); JournalUtils.restoreFromCheckpoint(new CheckpointInputStream(srs), getStateMachines()); } catch (Exception e) { JournalUtils.handleJournalReplayFailure(LOG, e, <START> "Failed to install snapshot"); <END> if (ServerConfiguration.getBoolean(PropertyKey.MASTER_JOURNAL_TOLERATE_CORRUPTION)) { return; } } if (snapshotId < mNextSequenceNumberToRead - 1) { LOG.warn("Installed snapshot for SN but next SN to read is {}", snapshotId, mNextSequenceNumberToRead); } mNextSequenceNumberToRead = snapshotId + 1; LOG.info("Successfully installed snapshot up to SN {}", snapshotId); }</code><technical_language>include snapshotId in message</technical_language>

Target:
public void install(SnapshotReader snapshotReader) { if (mClosed) { return; } if (mIgnoreApplys) { LOG.warn("Unexpected request to install a snapshot on a read-only journal state machine"); return; } long snapshotId = 0L; try (InputStream srs = new SnapshotReaderStream(snapshotReader)) { snapshotId = snapshotReader.readLong(); JournalUtils.restoreFromCheckpoint(new CheckpointInputStream(srs), getStateMachines()); } catch (Exception e) { JournalUtils.handleJournalReplayFailure(LOG, e, "Failed to install snapshot: %s", snapshotId); if (ServerConfiguration.getBoolean(PropertyKey.MASTER_JOURNAL_TOLERATE_CORRUPTION)) { return; } } if (snapshotId < mNextSequenceNumberToRead - 1) { LOG.warn("Installed snapshot for SN but next SN to read is {}", snapshotId, mNextSequenceNumberToRead); } mNextSequenceNumberToRead = snapshotId + 1; LOG.info("Successfully installed snapshot up to SN {}", snapshotId); }
Source:
<code>public BinderTypeRegistry binderTypeRegistry() { BinderType bt = new BinderType(NAME, new Class[] {SpringIntegrationBinderConfiguration.class}); Map<String, BinderType> binderTypes = new HashMap<>(); <START> binderTypes.put(NAME, bt); <END> BinderTypeRegistry btr = new DefaultBinderTypeRegistry(binderTypes); return btr; }</code><technical_language>Collections.singletonMap() instead</technical_language>

Target:
public BinderTypeRegistry binderTypeRegistry() { BinderType binderType = new BinderType(NAME, new Class[] {SpringIntegrationBinderConfiguration.class}); BinderTypeRegistry btr = new DefaultBinderTypeRegistry(Collections.singletonMap(NAME, binderType)); return btr; }
Source:
<code>public void setupLocalServerAdapter() { NewServerWizard serverW = new NewServerWizard(); try { serverW.open(); NewServerWizardPage sp = new NewServerWizardPage(serverW); sp.selectType(getFamily(server), server); serverW.next(); NewServerAdapterPage ap = new NewServerAdapterPage(serverW); ap.setRuntime(null); ap.checkErrors(); serverW.next(); setupRuntime(serverW); serverW.finish(); } catch (AssertionError | RuntimeException e) { try { serverW.cancel(); } catch (RedDeerException ex) { <START> throw ex; <END> } throw e; } }</code><technical_language>I log exception print stack trace continue parent block throw Assertion runtime exception. This lost exception cancel dialog</technical_language>

Target:
public void setupLocalServerAdapter() { NewServerWizard serverW = new NewServerWizard(); try { serverW.open(); NewServerWizardPage sp = new NewServerWizardPage(serverW); sp.selectType(getFamily(server), server); serverW.next(); NewServerAdapterPage ap = new NewServerAdapterPage(serverW); ap.setRuntime(null); ap.checkErrors(); serverW.next(); setupRuntime(serverW); serverW.finish(); } catch (AssertionError | RuntimeException e) { try { serverW.cancel(); } catch (RedDeerException ex) { LOGGER.error("Cannot close server wizard!", ex); } throw e; } }
Source:
<code>public static boolean setOptionInCDT(IProject project, String optionIDString, boolean value, String parentToolName) { IConfiguration activeConf = helperGetActiveConfiguration(project); ITool gccCompileriTool = helperGetGccCompilerTool(parentToolName, activeConf); IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString); if (optionTemplate == null) { MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionTemplate); return false; } IOption mutableOptionToSet = null; try { mutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false); mutableOptionToSet.setValue(value); } catch (BuildException e) { MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionForWriting); } <START> IResourceInfo resourceInfos[] = activeConf.getResourceInfos(); <END> IResourceInfo resourceInfo = resourceInfos[0]; ManagedBuildManager.setOption(resourceInfo, gccCompileriTool, mutableOptionToSet, true); ManagedBuildManager.saveBuildInfo(project, true); return true; }</code><technical_language>If need [0] is need for resourceInfos variable</technical_language>

Target:
public static boolean setOptionInCDT(IProject project, String optionIDString, boolean value, String parentToolName) { IConfiguration activeConf = helperGetActiveConfiguration(project); ITool gccCompileriTool = helperGetGccCompilerTool(parentToolName, activeConf); IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString); if (optionTemplate == null) { MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionTemplate); return false; } IOption mutableOptionToSet = null; try { mutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false); mutableOptionToSet.setValue(value); } catch (BuildException e) { MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionForWriting); } IResourceInfo resourceInfo = activeConf.getResourceInfos()[0]; ManagedBuildManager.setOption(resourceInfo, gccCompileriTool, mutableOptionToSet, true); ManagedBuildManager.saveBuildInfo(project, true); return true; }
Source:
<code>public void testIsEmpty() { assertTrue(StringHelper.isEmpty(null)); assertTrue(StringHelper.isEmpty(StringHelper.EMPTY)); <START> assertFalse(StringHelper.isEmpty("test")); <END> }</code><technical_language>a String consisting of spaces? this: java String empty = " ";</technical_language>

Target:
public void testIsEmpty() { assertTrue(StringHelper.isEmpty(null)); assertTrue(StringHelper.isEmpty("")); assertFalse(StringHelper.isEmpty("test")); assertFalse(StringHelper.isEmpty(" ")); }
Source:
<code>protected boolean isValidConnection(StorageServerConnections conn) { StorageType storageType = conn.getStorageType(); if (storageType == StorageType.NFS && (!new NfsMountPointConstraint().isValid(conn.getConnection(), null) || <START> StringUtils.containsAny(conn.getConnection(), " <END> "))) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID); } if (storageType == StorageType.POSIXFS && StringUtils.isEmpty(conn.getVfsType())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE); } if ((storageType == StorageType.POSIXFS || storageType == StorageType.NFS) && !validate(validateMountOptions())) { return false; } if (storageType == StorageType.ISCSI) { if (StringUtils.isEmpty(conn.getIqn())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_IQN); } if (!isValidStorageConnectionPort(conn.getPort())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID_PORT); } } if (storageType == StorageType.GLUSTERFS) { StorageConnectionValidator validator = new StorageConnectionValidator(conn); if (!validate(validator.canVDSConnectToGlusterfs(getVds()))) { return false; } } if (checkIsConnectionFieldEmpty(conn)) { return false; } return true; }</code><technical_language>this NfsMountPointConstraint's logic</technical_language>

Target:
protected boolean isValidConnection(StorageServerConnections conn) { StorageType storageType = conn.getStorageType(); if (storageType == StorageType.NFS && !new NfsMountPointConstraint().isValid(conn.getConnection(), null)) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID); } if (storageType == StorageType.POSIXFS && StringUtils.isEmpty(conn.getVfsType())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE); } if ((storageType == StorageType.POSIXFS || storageType == StorageType.NFS) && !validate(validateMountOptions())) { return false; } if (storageType == StorageType.ISCSI) { if (StringUtils.isEmpty(conn.getIqn())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_EMPTY_IQN); } if (!isValidStorageConnectionPort(conn.getPort())) { return failValidation(EngineMessage.VALIDATION_STORAGE_CONNECTION_INVALID_PORT); } } if (storageType == StorageType.GLUSTERFS) { StorageConnectionValidator validator = new StorageConnectionValidator(conn); if (!validate(validator.canVDSConnectToGlusterfs(getVds()))) { return false; } } if (checkIsConnectionFieldEmpty(conn)) { return false; } return true; }
Source:
<code>private int addSingleSPA(Entity entity, double xpCap) { int unitType = entity.getUnitType(); <START> List<SpecialAbility> choices = coalescedSPAList(unitType, xpCap); <END> if (choices.size() == 0) { return 0; } int spaIndex; SpecialAbility spa = null; while (choices.size() > 0) { spaIndex = Compute.randomInt(choices.size()); spa = choices.get(spaIndex); if (entity.hasAbility(spa.getName()) || !extraEligibilityCheck(spa, entity)) { choices.remove(spaIndex); spa = null; } else { break; } } if (spa == null) { return 0; } String spaValue; switch (spa.getName()) { case OptionsConstants.MISC_HUMAN_TRO: spaValue = pickRandomHumanTRO(); break; case OptionsConstants.GUNNERY_RANGE_MASTER: spaValue = pickRandomRangeMaster(); break; case OptionsConstants.GUNNERY_SPECIALIST: spaValue = pickRandomGunnerySpecialization(entity); break; case OptionsConstants.GUNNERY_WEAPON_SPECIALIST: spaValue = pickRandomWeapon(entity, false); break; case OptionsConstants.GUNNERY_SANDBLASTER: spaValue = pickRandomWeapon(entity, true); break; default: entity.getCrew().getOptions().getOption(spa.getName()).setValue(true); return spa.getCost(); } if (spaValue.equals(Crew.SPECIAL_NONE)) { return 0; } entity.getCrew().getOptions().getOption(spa.getName()).setValue(spaValue); return spa.getCost(); }</code><technical_language>main problem is list of SPAs is built, SPAs left wind ineligible. I a loop in terminates picked SPA run out of SPAs pick. time SPA is eliminated for reason, remove "choices" list loop again. way, guaranteed eventually reduces "choices" empty list pick valid</technical_language>

Target:
private int addSingleSPA(Entity entity, double xpCap) { int unitType = entity.getUnitType(); List<SpecialAbility> choices = coalescedSPAList(unitType, xpCap); if (choices.size() == 0) { return 0; } while (choices.size() > 0) { int spaIndex = Compute.randomInt(choices.size()); SpecialAbility spa = choices.get(spaIndex); if (entity.hasAbility(spa.getName()) || !extraEligibilityCheck(spa, entity)) { choices.remove(spaIndex); } else { String spaValue; switch (spa.getName()) { case OptionsConstants.MISC_HUMAN_TRO: spaValue = pickRandomHumanTRO(); break; case OptionsConstants.GUNNERY_RANGE_MASTER: spaValue = pickRandomRangeMaster(); break; case OptionsConstants.GUNNERY_SPECIALIST: spaValue = pickRandomGunnerySpecialization(entity); break; case OptionsConstants.GUNNERY_WEAPON_SPECIALIST: spaValue = pickRandomWeapon(entity, false); break; case OptionsConstants.GUNNERY_SANDBLASTER: spaValue = pickRandomWeapon(entity, true); break; default: entity.getCrew().getOptions().getOption(spa.getName()).setValue(true); return spa.getCost(); } if (!spaValue.equals(Crew.SPECIAL_NONE)) { entity.getCrew().getOptions().getOption(spa.getName()).setValue(spaValue); return spa.getCost(); } } } return 0; }
Source:
<code>public void setUp() { objectMapper = new ObjectMapper(); mockMvc = MockMvcBuilders.standaloneSetup(controllersUnderTest()) .setViewResolvers(viewResolver()) <START> .setControllerAdvice(new GlobalControllerExceptionHandler()) <END> .setHandlerExceptionResolvers(uncheckedExceptionResolver()) .build(); }</code><technical_language>Please this configurable for view resolver</technical_language>

Target:
public void setUp() { objectMapper = new ObjectMapper(); mockMvc = MockMvcBuilders.standaloneSetup(controllersUnderTest()) .setViewResolvers(viewResolver()) .setControllerAdvice(controllerAdvice()) .setHandlerExceptionResolvers(uncheckedExceptionResolver()) .build(); }
Source:
<code>private PatchSet getBasePatchSet(Change change, Ref ref) throws IOException, InvalidChangeOperationException { try { <START> int pos = ref.getName().lastIndexOf("/"); <END> String psId = ref.getName().substring(pos + 1); return db.get().patchSets().get(new PatchSet.Id( change.getId(), Integer.valueOf(psId))); } catch (OrmException e) { throw new IOException(e); } }</code><technical_language>Maybe: checkArgument(pos >0, "invalid edit ref: %s", ref.getName());</technical_language>

Target:
private PatchSet getBasePatchSet(Change change, Ref ref) throws IOException, InvalidChangeOperationException { try { int pos = ref.getName().lastIndexOf("/"); checkArgument(pos >0, "invalid edit ref: %s", ref.getName()); String psId = ref.getName().substring(pos + 1); return db.get().patchSets().get(new PatchSet.Id( change.getId(), Integer.valueOf(psId))); } catch (OrmException e) { throw new IOException(e); } }
Source:
<code>public CategoryView findCategoryWithoutCache(CategoryView parentCategoryView, String category) { if(parentCategoryView.getName().toLowerCase().equals(category.toLowerCase())) { return parentCategoryView; } for(String key : parentCategoryView.getChildren().keySet()) { <START> CategoryView categoryView = findCategoryWithoutCache(parentCategoryView.getChild(key), category); <END> if(categoryView != null) { return categoryView; } } return null; }</code><technical_language>Well, streaming get recursive structure, if rewrite for-loop do java return parentCategoryView.getChildren().keySet().stream() .map((String key) -> findCategoryWithoutCache(parentCategoryView.getChild(key), category)) .filter(Objects::nonNull).findAny().orElse(null); Also, save getChild lookup iterating parentCategoryView.getChildren().values() instead of .keySet(). In a stream: java return parentCategoryView.getChildren().values().stream() .map((CategoryView child) -> findCategoryWithoutCache(child, category)) .filter(Objects::nonNull).findAny().orElse(null);</technical_language>

Target:
public CategoryView findCategoryWithoutCache(CategoryView parentCategoryView, String category) { if(parentCategoryView.getName().equalsIgnoreCase(category)) { return parentCategoryView; } return parentCategoryView.getChildren().values().stream() .map((CategoryView child) -> findCategoryWithoutCache(child, category)) .filter(Objects::nonNull).findAny().orElse(null); }
Source:
<code><START> public void onTraversalStart() { <END> try { outputStream = outputFile != null ? new PrintStream(outputFile) : System.out; } catch ( final FileNotFoundException e ) { throw new UserException.CouldNotReadInputFile(outputFile, e); } List<SimpleInterval> intervals = intervalArgumentCollection.getIntervals(getReferenceDictionary()); targetTerriroty = intervals.stream().mapToInt(i -> i.size()).sum(); id = FilenameUtils.getBaseName(drivingVariantFile); }</code><technical_language>For TODO sample names, a VariantWalker get samples getHeaderForVariants().getSampleNamesInOrder()</technical_language>

Target:
public void onTraversalStart() { id = FilenameUtils.getBaseName(drivingVariantFile); }
Source:
<code><START> private void assertAllHBaseRowsHaveEmptyColumnCell(byte[] hbaseTableName, byte[] emptyColumnFamilyName, byte[] emptyColumnName, long minTimestamp, int expectedRows) throws IOException, SQLException { <END> try (Table tbl = driver.getConnectionQueryServices(getUrl(), TestUtil.TEST_PROPERTIES) .getTable(hbaseTableName)) { Scan allRows = new Scan(); allRows.setMaxVersions(1); allRows.setTimeRange(minTimestamp, minTimestamp + Integer.MAX_VALUE); ResultScanner scanner = tbl.getScanner(allRows); int numMatchingRows = 0; for (Result result = scanner.next(); result != null; result = scanner.next()) { numMatchingRows += result.containsColumn(emptyColumnFamilyName, emptyColumnName) ? 1 : 0; } assertEquals(String.format( "Expected rows do match for table = %s at timestamp %d", Bytes.toString(hbaseTableName), minTimestamp), expectedRows, numMatchingRows); } }</code><technical_language>nit: more 100 chars line</technical_language>

Target:
private void assertAllHBaseRowsHaveEmptyColumnCell(byte[] hbaseTableName, byte[] emptyColumnFamilyName, byte[] emptyColumnName, long minTimestamp, int expectedRows) throws IOException, SQLException { try (Table tbl = driver.getConnectionQueryServices(getUrl(), TestUtil.TEST_PROPERTIES) .getTable(hbaseTableName)) { Scan allRows = new Scan(); allRows.setTimeRange(minTimestamp, minTimestamp + Integer.MAX_VALUE); ResultScanner scanner = tbl.getScanner(allRows); int numMatchingRows = getNumRowsWithEmptyColumnAndMaxTimestamp(scanner, emptyColumnFamilyName, emptyColumnName); assertEquals(String.format("Expected rows do match for table = %s at timestamp %d", Bytes.toString(hbaseTableName), minTimestamp), expectedRows, numMatchingRows); } }
Source:
<code>private void setUpFlushTask() { ThreadFactory threadFactory = new ThreadFactoryBuilder() <START> .setNameFormat("event-logger-flush-%d") <END> .build(); flushScheduler = Executors.newSingleThreadScheduledExecutor(threadFactory); Runnable runnable = new Runnable() { @Override public void run() { try { if (dirty) { eventLogWriter.flush(); dirty = false; } } catch (IOException ex) { LOG.error("Error flushing " + eventLogPath, ex); throw new RuntimeException(ex); } } }; flushScheduler.scheduleAtFixedRate(runnable, FLUSH_INTERVAL_MILLIS, FLUSH_INTERVAL_MILLIS, TimeUnit.MILLISECONDS); }</code><technical_language>add setDaemon(true)</technical_language>

Target:
private void setUpFlushTask() { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("event-logger-flush-%d") .setDaemon(true) .build(); flushScheduler = Executors.newSingleThreadScheduledExecutor(threadFactory); Runnable runnable = new Runnable() { @Override public void run() { try { if (dirty) { eventLogWriter.flush(); dirty = false; } } catch (IOException ex) { LOG.error("Error flushing " + eventLogPath, ex); throw new RuntimeException(ex); } } }; flushScheduler.scheduleAtFixedRate(runnable, FLUSH_INTERVAL_MILLIS, FLUSH_INTERVAL_MILLIS, TimeUnit.MILLISECONDS); }
Source:
<code><START> public String fetchRandomGeneIdFromAnalytics(AnalyticsSchemaField field, String term) { <END> SolrQueryBuilder<AnalyticsCollectionProxy> queryBuilder = new SolrQueryBuilder<>(); queryBuilder .addQueryFieldByTerm(field, term) .setFieldList(AnalyticsCollectionProxy.BIOENTITY_IDENTIFIER) .setRows(MAX_ROWS); return analyticsCollectionProxy .query(queryBuilder) .getResults() .get(RNG.nextInt(MAX_ROWS)) .getFieldValue("bioentity_identifier") .toString(); }</code><technical_language>this method name parameters descriptive enough is on... method is basically a random gene ID satisfies a condition, contents</technical_language>

Target:
public String fetchRandomGeneIdFromAnalytics(AnalyticsSchemaField field, String term) { SolrQueryBuilder<AnalyticsCollectionProxy> queryBuilder = new SolrQueryBuilder<>(); queryBuilder .addQueryFieldByTerm(field, term) .setFieldList(AnalyticsCollectionProxy.BIOENTITY_IDENTIFIER) .setRows(MAX_ROWS); return getRandomSolrDocument(analyticsCollectionProxy.query(queryBuilder).getResults()) .getFieldValue("bioentity_identifier") .toString(); }
Source:
<code>public List<String> getPrimaryFromClauseTables() { return (List<String>) joins.values() .stream() .map( elem -> ((JoinSequence) elem).getFromPart().getFirstJoin().getJoinable().getTableName() ). <START> collect( Collectors.toList() ); <END> }</code><technical_language>I this is tested. Is this classic of some anyway</technical_language>

Target:
public List<String> getPrimaryFromClauseTables() { throw new UnsupportedOperationException( "The classic mode does not support UPDATE statements via createQuery!" ); }
Source:
<code>private void updateCurrentMemory(int newAmountOfMemory) { int currentMemory = getVm().getMemSizeMb(); if (getVm().getStatus().isNotRunning()) { newVmStatic.setMemSizeMb(newAmountOfMemory); return; } if (getVm().getStatus() != VMStatus.Up) { newVmStatic.setMemSizeMb(currentMemory); log.warn("Memory update {}MB -> {}MB of VM ({}) left out. Memory can't be updated in <START> current state VM ({}).", <END> currentMemory, newAmountOfMemory, getVm().getName(), getVm().getId(), getVm().getStatus()); return; } if (currentMemory != newAmountOfMemory) { hotSetMemory(newAmountOfMemory); } }</code><technical_language>current VM state</technical_language>

Target:
private void updateCurrentMemory(int newAmountOfMemory) { int currentMemory = getVm().getMemSizeMb(); if (getVm().getStatus().isNotRunning()) { newVmStatic.setMemSizeMb(newAmountOfMemory); return; } if (getVm().getStatus() != VMStatus.Up) { newVmStatic.setMemSizeMb(currentMemory); log.warn("Memory update {}MB -> {}MB of VM ({}) left out. Memory can't be updated in current VM state ({}).", currentMemory, newAmountOfMemory, getVm().getName(), getVm().getId(), getVm().getStatus()); return; } if (currentMemory != newAmountOfMemory) { hotSetMemory(newAmountOfMemory); } }
Source:
<code>private void checkRefresh() { if (delegate == null || !requiresRefresh() || updateRunnable != null) { return; } updateRunnable = new Runnable() { @Override public void run() { CountingChannel toClose = null; WriteLock writeLock = null; try { <START> CountingChannel newChannel = new CountingChannel(factory.create()); <END> writeLock = delegateLock.writeLock(); writeLock.lock(); if (delegate != null && requiresRefresh()) { toClose = delegate; delegate = newChannel; nextRefresh = calculateNewRefreshTime(); } else { toClose = newChannel; } } finally { updateRunnable = null; if (toClose != null) { closingAsynchronously.incrementAndGet(); } if (writeLock != null) { writeLock.unlock(); } try { toClose.close(); } catch (IOException e) { log.log(Level.WARNING, "Could not close a recycled delegate", e); } catch (InterruptedException e) { Thread.interrupted(); } finally { synchronized (closingAsynchronously) { if (closingAsynchronously.decrementAndGet() == 0) { closingAsynchronously.notify(); } } } } } }; executor.execute(updateRunnable); }</code><technical_language>this done lock prevent potentially creating unused connections? I admit likely, a bad idea</technical_language>

Target:
private void checkRefresh() { if (requiresUpdate()) { synchronized (this) { if (requiresUpdate()) { currentlyUpdating.set(true); executor.execute(updater); } } } }
Source:
<code>public void dynamicallyConvertExternalToManagedTable() throws Throwable { primary.run("use " + primaryDbName) .run("create external table t1 (id int) stored as orc") .run("insert into table t1 values (1)") .run("create external table t2 (place string) partitioned by (country string)") .run("insert into table t2 partition(country='india') values ('bangalore')") .runFailure("alter table t1 set tblproperties('EXTERNAL'='false')") <START> .runFailure("alter table t2 set tblproperties('EXTERNAL'='false')"); <END> }</code><technical_language>Test this explicit conversion transactional table, if possible</technical_language>

Target:
public void dynamicallyConvertExternalToManagedTable() throws Throwable { primary.run("use " + primaryDbName) .run("create external table t1 (id int) stored as orc") .run("insert into table t1 values (1)") .run("create external table t2 (place string) partitioned by (country string)") .run("insert into table t2 partition(country='india') values ('bangalore')") .runFailure("alter table t1 set tblproperties('EXTERNAL'='false')") .runFailure("alter table t1 set tblproperties('EXTERNAL'='false', 'TRANSACTIONAL'='true')") .runFailure("alter table t2 set tblproperties('EXTERNAL'='false')"); }
Source:
<code>public Object[] getChildren(Object parentElement) { if (parentElement instanceof IFeatureModel) { IFeatureModel featureModel = (IFeatureModel) parentElement; Object[] features = featureModel.getFeature().getIncludedFeatures(); if (!input.isIncludePlugins()) { return features; } Object[] plugins = featureModel.getFeature().getPlugins(); <START> Object[] all = new Object[features.length + plugins.length]; <END> System.arraycopy(features, 0, all, 0, features.length); System.arraycopy(plugins, 0, all, features.length, plugins.length); return all; } else if (parentElement instanceof IFeatureChild) { IFeatureChild featureChild = (IFeatureChild) parentElement; IFeatureModel featureModel = featureModelManager.findFeatureModel(featureChild.getId()); return getChildren(featureModel); } return new Object[0]; }</code><technical_language>Arrays.copyOf save arraycopy</technical_language>

Target:
public Object[] getChildren(Object parentElement) { if (parentElement instanceof IFeatureModel) { IFeatureModel featureModel = (IFeatureModel) parentElement; Object[] features = featureModel.getFeature().getIncludedFeatures(); if (!fInput.isIncludePlugins()) { return features; } Object[] plugins = featureModel.getFeature().getPlugins(); Object[] all = new Object[features.length + plugins.length]; System.arraycopy(features, 0, all, 0, features.length); System.arraycopy(plugins, 0, all, features.length, plugins.length); return all; } else if (parentElement instanceof IFeatureChild) { IFeatureChild featureChild = (IFeatureChild) parentElement; IFeatureModel featureModel = fFeatureModelManager.findFeatureModel(featureChild.getId()); return getChildren(featureModel); } return new Object[0]; }
Source:
<code>public void save() { try { Preferences accountsNode = AccountModel.getAccountsPreferences(); Preferences clusterNode = accountsNode.node(getId()); ISecurePreferences clusterSecureNode = AccountModel.getSecureAccountsPreferences().node(getId()); clusterNode.put(ENDPOINT_URL_KEY, getEndpointURL()); <START> removed.stream().forEach(id -> { <END> try { clusterNode.node(id).removeNode(); clusterSecureNode.node(id).removeNode(); } catch (BackingStoreException e) { OpenShiftIOCoreActivator.logError(e.getLocalizedMessage(), e); } }); removed.clear(); clusterNode.flush(); clusterSecureNode.flush(); } catch (BackingStoreException | IOException e) { OpenShiftIOCoreActivator.logError("Error saving cluster in storage", e); } }</code><technical_language>call forEach once, stream()</technical_language>

Target:
public void save() { try { Preferences accountsNode = AccountModel.getAccountsPreferences(); Preferences clusterNode = accountsNode.node(getId()); ISecurePreferences clusterSecureNode = AccountModel.getSecureAccountsPreferences().node(getId()); clusterNode.put(ENDPOINT_URL_KEY, getEndpointURL()); removed.forEach(id -> { try { clusterNode.node(id).removeNode(); clusterSecureNode.node(id).removeNode(); } catch (BackingStoreException e) { OpenShiftIOCoreActivator.logError(e.getLocalizedMessage(), e); } }); removed.clear(); clusterNode.flush(); clusterSecureNode.flush(); } catch (BackingStoreException | IOException e) { OpenShiftIOCoreActivator.logError("Error saving cluster in storage", e); } }
Source:
<code>public ExchangeContext(boolean crd, GridDhtPartitionsExchangeFuture fut) { int protocolVer = exchangeProtocolVersion(fut.firstEventCache().minimumNodeVersion()); <START> if (getBoolean(IGNITE_PME_EXCHANGE_FREE, true) && <END> !compatibilityNode && fut.wasRebalanced() && fut.isBaselineNodeFailed() && allNodesSupports(fut.firstEventCache().allNodes(), PME_FREE_SWITCH)) { exchangeFreeSwitch = true; merge = false; } else if (compatibilityNode || (crd && fut.localJoinExchange())) { fetchAffOnJoin = true; merge = false; } else { boolean startCaches = fut.exchangeId().isJoined() && fut.sharedContext().cache().hasCachesReceivedFromJoin(fut.exchangeId().eventNode()); fetchAffOnJoin = protocolVer == 1; merge = !startCaches && protocolVer > 1 && fut.firstEvent().type() != EVT_DISCOVERY_CUSTOM_EVT; } evts = new ExchangeDiscoveryEvents(fut); }</code><technical_language>Feature work property set. turned in case of property set</technical_language>

Target:
public ExchangeContext(boolean crd, GridDhtPartitionsExchangeFuture fut) { int protocolVer = exchangeProtocolVersion(fut.firstEventCache().minimumNodeVersion()); boolean allNodesSupportsPmeFreeSwitch = allNodesSupports(fut.firstEventCache().allNodes(), PME_FREE_SWITCH); if (!allNodesSupportsPmeFreeSwitch) fut.logger().warning("Current topology does not support the PME-free switch, " + "may be you use different versions Apache Ignite or the feature is explicitly disabled " + "by JVM option IGNITE_PME_FREE_SWITCH_DISABLED on some nodes."); if (!compatibilityNode && fut.wasRebalanced() && fut.isBaselineNodeFailed() && allNodesSupportsPmeFreeSwitch) { exchangeFreeSwitch = true; merge = false; } else if (compatibilityNode || (crd && fut.localJoinExchange())) { fetchAffOnJoin = true; merge = false; } else { boolean startCaches = fut.exchangeId().isJoined() && fut.sharedContext().cache().hasCachesReceivedFromJoin(fut.exchangeId().eventNode()); fetchAffOnJoin = protocolVer == 1; merge = !startCaches && protocolVer > 1 && fut.firstEvent().type() != EVT_DISCOVERY_CUSTOM_EVT; } evts = new ExchangeDiscoveryEvents(fut); }
Source:
<code>public static Calendar dateToCalendar(Date date) { <START> Calendar calendar = Calendar.getInstance( ENCODING_TIME_ZONE, Locale.ROOT ); <END> calendar.setTime( date ); return calendar; }</code><technical_language>in dateToString Locale is ENGLISH is ROOT, is a reason for stick one</technical_language>

Target:
public static Calendar dateToCalendar(Date date) { Calendar calendar = Calendar.getInstance( ENCODING_TIME_ZONE, Locale.ENGLISH ); calendar.setTime( date ); return calendar; }
Source:
<code>private static String toYAML(Entrypoint ep) { try { return new YAMLMapper().writer().writeValueAsString(ep); } catch (JsonProcessingException e) { <START> throw new IllegalStateException("Could not serialize entrypoint to YAML. This is a bug.", e); <END> } }</code><technical_language>I avoid throwing RuntimeException here. is wrap DevfileException</technical_language>

Target:
private static String toYAML(Entrypoint ep) throws DevfileException { return Serialization.asYaml(ep); }
Source:
<code>default <R> Future<R> collect(PartialFunction<? super T, ? extends R> partialFunction) { Objects.requireNonNull(partialFunction, "partialFunction is null"); final Promise<R> promise = Promise.make(executorService()); <START> onComplete((Try<T> result) -> promise.complete(result.collect(partialFunction))); <END> return promise.future(); }</code><technical_language>lambda param type needed, simple form result -> ..</technical_language>

Target:
default <R> Future<R> collect(PartialFunction<? super T, ? extends R> partialFunction) { Objects.requireNonNull(partialFunction, "partialFunction is null"); final Promise<R> promise = Promise.make(executorService()); onComplete(result -> promise.complete(result.collect(partialFunction))); return promise.future(); }
Source:
<code>public QueryRunner<SegmentAnalysis> createRunner(final Segment segment) { return new QueryRunner<SegmentAnalysis>() { @Override public Sequence<SegmentAnalysis> run(Query<SegmentAnalysis> inQ, Map<String, Object> responseContext) { SegmentMetadataQuery query = (SegmentMetadataQuery) inQ; final QueryableIndex index = segment.asQueryableIndex(); final Map<String, ColumnAnalysis> analyzedColumns; long totalSize = 0; <START> int numRows = 0; <END> if (index == null) { StorageAdapter segmentAdapter = segment.asStorageAdapter(); analyzedColumns = analyzer.analyze(segmentAdapter, query.getAnalysisTypes()); numRows = segmentAdapter.getNumRows(); } else { analyzedColumns = analyzer.analyze(index, query.getAnalysisTypes()); numRows = index.getNumRows(); } if (query.hasSize()) { totalSize = analyzedColumns.size() * numRows; } Map<String, ColumnAnalysis> columns = Maps.newTreeMap(); ColumnIncluderator includerator = query.getToInclude(); for (Map.Entry<String, ColumnAnalysis> entry : analyzedColumns.entrySet()) { final String columnName = entry.getKey(); final ColumnAnalysis column = entry.getValue(); if (!column.isError()) { totalSize += column.getSize(); } if (includerator.include(columnName)) { columns.put(columnName, column); } } return Sequences.simple( Arrays.asList( new SegmentAnalysis( segment.getIdentifier(), Arrays.asList(segment.getDataInterval()), columns, totalSize ) ) ); } }; }</code><technical_language>minor nit, this a final int initial value, ensure set in if statement</technical_language>

Target:
public QueryRunner<SegmentAnalysis> createRunner(final Segment segment) { return new QueryRunner<SegmentAnalysis>() { @Override public Sequence<SegmentAnalysis> run(Query<SegmentAnalysis> inQ, Map<String, Object> responseContext) { SegmentMetadataQuery query = (SegmentMetadataQuery) inQ; final QueryableIndex index = segment.asQueryableIndex(); final Map<String, ColumnAnalysis> analyzedColumns; final int numRows; long totalSize = 0; if (index == null) { StorageAdapter segmentAdapter = segment.asStorageAdapter(); analyzedColumns = analyzer.analyze(segmentAdapter, query.getAnalysisTypes()); numRows = segmentAdapter.getNumRows(); } else { analyzedColumns = analyzer.analyze(index, query.getAnalysisTypes()); numRows = index.getNumRows(); } if (query.hasSize()) { totalSize = analyzedColumns.size() * numRows; } Map<String, ColumnAnalysis> columns = Maps.newTreeMap(); ColumnIncluderator includerator = query.getToInclude(); for (Map.Entry<String, ColumnAnalysis> entry : analyzedColumns.entrySet()) { final String columnName = entry.getKey(); final ColumnAnalysis column = entry.getValue(); if (!column.isError()) { totalSize += column.getSize(); } if (includerator.include(columnName)) { columns.put(columnName, column); } } return Sequences.simple( Arrays.asList( new SegmentAnalysis( segment.getIdentifier(), Arrays.asList(segment.getDataInterval()), columns, totalSize ) ) ); } }; }
Source:
<code>void refreshTokenWithoutCache(final String refreshToken, final AuthenticationRequest authenticationRequest, final AuthenticationCallback<AuthenticationResult> externalCallback) { Logger.setCorrelationId(authenticationRequest.getCorrelationId()); Logger.v(TAG, "Refresh token without cache"); final CallbackHandler callbackHandle = new CallbackHandler(getHandler(), externalCallback); THREAD_EXECUTOR.execute(new Runnable() { @Override public void run() { try { validateAcquireTokenRequest(authenticationRequest); final AcquireTokenSilentHandler acquireTokenSilentHandler = new AcquireTokenSilentHandler(mContext, authenticationRequest, mTokenCacheAccessor); <START> if(mAuthContext.getExtendedLifetimeEnabled()) { <END> acquireTokenSilentHandler.setOutageModeIsOn(true); } final AuthenticationResult authResult = acquireTokenSilentHandler.acquireTokenWithRefreshToken(refreshToken); callbackHandle.onSuccess(authResult); } catch (final AuthenticationException authenticationException) { callbackHandle.onError(authenticationException); } } }); }</code><technical_language>space if</technical_language>

Target:
void refreshTokenWithoutCache(final String refreshToken, final AuthenticationRequest authenticationRequest, final AuthenticationCallback<AuthenticationResult> externalCallback) { Logger.setCorrelationId(authenticationRequest.getCorrelationId()); Logger.v(TAG, "Refresh token without cache"); final CallbackHandler callbackHandle = new CallbackHandler(getHandler(), externalCallback); THREAD_EXECUTOR.execute(new Runnable() { @Override public void run() { try { validateAcquireTokenRequest(authenticationRequest); final AcquireTokenSilentHandler acquireTokenSilentHandler = new AcquireTokenSilentHandler(mContext, authenticationRequest, mTokenCacheAccessor); final AuthenticationResult authResult = acquireTokenSilentHandler.acquireTokenWithRefreshToken(refreshToken); callbackHandle.onSuccess(authResult); } catch (final AuthenticationException authenticationException) { callbackHandle.onError(authenticationException); } } }); }
Source:
<code>protected int run() throws Exception { boolean errorOccurred = false; final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { stderr.println("The Jenkins instance has not been started, or was already shut down!"); return -1; } final HashSet<String> hs = new HashSet<String>(); hs.addAll(jobs); for (String job_s: hs) { AbstractItem job = null; try { job = (AbstractItem) jenkins.getItemByFullName(job_s); if(job == null) { stderr.format("No such job '%s'\n", job_s); errorOccurred = true; continue; } try { <START> job.checkPermission(AbstractItem.DELETE); <END> } catch (Exception e) { stderr.println(e.getMessage()); errorOccurred = true; continue; } job.delete(); } catch (Exception e) { stderr.format("Unexpected exception occurred during deletion of job '%s': %s\n", job == null ? "(null)" : job.getFullName(), e.getMessage() ); errorOccurred = true; continue; } } return errorOccurred ? -1 : 0; }</code><technical_language>hasPermission()</technical_language>

Target:
protected int run() throws Exception { boolean errorOccurred = false; final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { stderr.println("The Jenkins instance has not been started, or was already shut down!"); return -1; } final HashSet<String> hs = new HashSet<String>(); hs.addAll(jobs); for (String job_s: hs) { AbstractItem job = null; try { job = (AbstractItem) jenkins.getItemByFullName(job_s); if(job == null) { stderr.format("No such job '%s'\n", job_s); errorOccurred = true; continue; } try { job.checkPermission(AbstractItem.DELETE); } catch (Exception e) { stderr.println(e.getMessage()); errorOccurred = true; continue; } job.delete(); } catch (Exception e) { final String errorMsg = String.format("Unexpected exception occurred during deletion of job '%s': %s", job == null ? "(null)" : job.getFullName(), e.getMessage()); stderr.println(errorMsg); LOGGER.warning(errorMsg); errorOccurred = true; continue; } } return errorOccurred ? -1 : 0; }