auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public IManager start() { File metadata = new File(getStorageFolder(), METAFILE); if (metadata.exists()) { Collection<FilestoreModel> items = null; Gson gson = gson(); <START> try { <END> FileReader file = new FileReader(metadata); items = gson.fromJson(file, METAFILE_TYPE); file.close(); } catch (IOException e) { e.printStackTrace(); } for(Iterator<FilestoreModel> itr = items.iterator(); itr.hasNext(); ) { FilestoreModel model = itr.next(); fileCache.put(model.oid, model); } logger.info("Loaded items from filestore metadata file", fileCache.size()); } else { logger.info("No filestore metadata file found"); } return this; }</code><technical_language>try (FileReader file = new FileReader(metadata)) {</technical_language>

Target:
public IManager start() { File metadata = new File(getStorageFolder(), METAFILE); if (metadata.exists()) { Collection<FilestoreModel> items = null; Gson gson = gson(); try (FileReader file = new FileReader(metadata)) { items = gson.fromJson(file, METAFILE_TYPE); file.close(); } catch (IOException e) { e.printStackTrace(); } for(Iterator<FilestoreModel> itr = items.iterator(); itr.hasNext(); ) { FilestoreModel model = itr.next(); fileCache.put(model.oid, model); } logger.info("Loaded items from filestore metadata file", fileCache.size()); } else { logger.info("No filestore metadata file found"); } return this; }
Source:
<code>public Theme getTheme(String blogId, String themeId) { String[] columns = {COLUMN_NAME_ID, Theme.ID, Theme.AUTHOR, Theme.SCREENSHOT, Theme.AUTHOR_URI, Theme.DEMO_URI, Theme.NAME, Theme.STYLESHEET, Theme.PRICE}; String[] selection = {blogId, themeId}; Cursor cursor = db.query(THEMES_TABLE, columns, Theme.BLOG_ID + "=? AND " + Theme.ID + " id=?", selection, null, null, null); if (cursor.moveToFirst()) { <START> String id = cursor.getString(0); <END> String author = cursor.getString(1); String screenshot = cursor.getString(2); String authorURI = cursor.getString(3); String demoURI = cursor.getString(4); String name = cursor.getString(5); String stylesheet = cursor.getString(6); String price = cursor.getString(7); boolean isCurrent = cursor.getInt(8) > 0; Theme theme = new Theme(id, author, screenshot, authorURI, demoURI, name, stylesheet, price, blogId, isCurrent); cursor.close(); return theme; } else { cursor.close(); return null; } }</code><technical_language>Prefer getColumnIndex hard-coded values</technical_language>

Target:
public Theme getTheme(String blogId, String themeId) { String[] columns = {COLUMN_NAME_ID, Theme.ID, Theme.AUTHOR, Theme.SCREENSHOT, Theme.AUTHOR_URI, Theme.DEMO_URI, Theme.NAME, Theme.STYLESHEET, Theme.PRICE}; String[] selection = {blogId, themeId}; Cursor cursor = db.query(THEMES_TABLE, columns, Theme.BLOG_ID + "=? AND " + Theme.ID + " id=?", selection, null, null, null); if (cursor.moveToFirst()) { String id = cursor.getString(cursor.getColumnIndex(Theme.ID)); String author = cursor.getString(cursor.getColumnIndex(Theme.AUTHOR)); String screenshot = cursor.getString(cursor.getColumnIndex(Theme.SCREENSHOT)); String authorURI = cursor.getString(cursor.getColumnIndex(Theme.AUTHOR_URI)); String demoURI = cursor.getString(cursor.getColumnIndex(Theme.DEMO_URI)); String name = cursor.getString(cursor.getColumnIndex(Theme.NAME)); String stylesheet = cursor.getString(cursor.getColumnIndex(Theme.STYLESHEET)); String price = cursor.getString(cursor.getColumnIndex(Theme.PRICE)); boolean isCurrent = cursor.getInt(cursor.getColumnIndex(Theme.IS_CURRENT)) > 0; Theme theme = new Theme(id, author, screenshot, authorURI, demoURI, name, stylesheet, price, blogId, isCurrent); cursor.close(); return theme; } else { cursor.close(); return null; } }
Source:
<code>private void handleWrite(WriteEvent event) { out.println(); out.println(STEP_SCENARIO_INDENT + event.text); <START> out.println(); <END> }</code><technical_language>want test this multi-line strings</technical_language>

Target:
private void handleWrite(WriteEvent event) { out.println(); try(BufferedReader lines = new BufferedReader(new StringReader(event.text))) { String line; while ((line = lines.readLine()) != null) { out.println(STEP_SCENARIO_INDENT + line); } } catch (IOException e) { throw new CucumberException(e); } out.println(); }
Source:
<code>private String getPackageFileType() throws MojoFailureException { if (packageType != null && packageType.equals("jar")) { if (include == null || include.equals("all") || include.equals("minify")) { return ".jar"; } else { throw new MojoFailureException("The jar packageType requires `all` or `minify` in the `include` parameter"); } } else { if (packageType != null && !packageType.equals("zip")) { log.info(packageType + " not supported. Defaulting to 'zip'"); } <START> if (include.contains("runnable")) { <END> if (packageType != null && packageType.equals("zip")) { throw new MojoFailureException("The `include` parameter `runnable` cannot be used with the `zip` packageType"); } log.warn("The `runnable` value for the include parameter is deprecated. Use packageType `jar` instead."); packageType = "jar"; return ".jar"; } packageType = "zip"; return ".zip"; } }</code><technical_language>I include null, in case get a NPE here</technical_language>

Target:
private String getPackageFileType() throws MojoFailureException { if (packageType != null && packageType.equals("jar")) { if (include == null || include.equals("all") || include.equals("minify")) { return ".jar"; } else { throw new MojoFailureException("The jar packageType requires `all` or `minify` in the `include` parameter"); } } else { if (packageType != null && !packageType.equals("zip")) { log.info(packageType + " not supported. Defaulting to 'zip'"); } if (include != null && include.contains("runnable")) { if (packageType != null && packageType.equals("zip")) { throw new MojoFailureException("The `include` parameter `runnable` cannot be used with the `zip` packageType"); } log.warn("The `runnable` value for the include parameter is deprecated. Use packageType `jar` instead."); packageType = "jar"; return ".jar"; } packageType = "zip"; return ".zip"; } }
Source:
<code>private String validateTableNameArgument(ByteBuffer tableNameArg, TableOperation op, Validator<String> userValidator) throws ThriftTableOperationException { String tableName = tableNameArg == null ? null : ByteBufferUtil.toString(tableNameArg); if ((tableName != null) && (tableName.length() > MAX_TABLE_NAME_LEN)) { log.warn( <START> "Table names greater than 1024 characters should be renamed to conform to a 1024 character limit. " <END> + "Longer table names are no longer supported and may result in unexpected behavior."); } return _validateArgument(tableName, op, VALID_NAME.and(userValidator)); }</code><technical_language>constant in this message</technical_language>

Target:
private String validateTableNameArgument(ByteBuffer tableNameArg, TableOperation op, Validator<String> userValidator) throws ThriftTableOperationException { String tableName = tableNameArg == null ? null : ByteBufferUtil.toString(tableNameArg); if ((tableName != null) && (tableName.length() > MAX_TABLE_NAME_LEN)) { log.warn("Table names greater than " + MAX_TABLE_NAME_LEN + " characters should be renamed to conform to a " + MAX_TABLE_NAME_LEN + " character limit. Longer table names are no longer supported and may result in " + " unexpected behavior."); } return _validateArgument(tableName, op, VALID_NAME.and(userValidator)); }
Source:
<code>private synchronized void handleNi(GpsNiNotification notif) { <START> if (DEBUG) Log.d(TAG, "entering handleNi(GpsNiNotification notif)"); <END> if (notif.needNotify) { if (DEBUG) Log.d(TAG, "notif.needNotify is true"); if (notif.needVerify && mPopupImmediately) { if (DEBUG) Log.d(TAG, "calling openNiDialog(notif)"); openNiDialog(notif); } else { if (DEBUG) Log.d(TAG, "calling setNiNotification(notif)"); setNiNotification(notif); } } if (!notif.needVerify || notif.privacyOverride) { if (DEBUG) Log.d(TAG, "!notif.needVerify || notif.privacyOverride is true"); try { if (DEBUG) Log.d(TAG, "sending GPS_NI_RESPONSE_ACCEPT"); mNetInitiatedListener.sendNiResponse(notif.notificationId, GPS_NI_RESPONSE_ACCEPT); } catch (RemoteException e) { Slog.e(TAG, "RemoteException in sendNiResponse"); } } if (DEBUG) Log.d(TAG, "leaving handleNi(GpsNiNotification notif)"); }</code><technical_language>do need this? is logged in line185</technical_language>

Target:
private void handleNi(GpsNiNotification notif) { if (DEBUG) Log.d(TAG, "in handleNi () :" + " needNotify: " + notif.needNotify + " needVerify: " + notif.needVerify + " privacyOverride: " + notif.privacyOverride + " mPopupImmediately: " + mPopupImmediately); if (notif.needNotify) { if (notif.needVerify && mPopupImmediately) { openNiDialog(notif); } else { setNiNotification(notif); } } if (!notif.needVerify || notif.privacyOverride) { try { mNetInitiatedListener.sendNiResponse(notif.notificationId, GPS_NI_RESPONSE_ACCEPT); } catch (RemoteException e) { Log.e(TAG, "RemoteException in sendNiResponse"); } } }
Source:
<code>public Response add(Event event) { validateParameters(event, "origin", "severity", "customId", "description"); validateEnums(Event.class, event); EntityExternalStatus entityExternalStatus = null; if (event.isSetHost() && event.getHost().isSetExternalStatus()) { entityExternalStatus = EntityExternalStatus.fromValue(event.getHost().getExternalStatus().getState()); return performCreate(VdcActionType.AddExternalEvent, new AddExternalEventParameters(map(event), HostMapper.map(entityExternalStatus, null)), new QueryIdResolver<Long>(VdcQueryType.GetAuditLogById, GetAuditLogByIdParameters.class)); <START> } <END> AddExternalEventParameters parameters = new AddExternalEventParameters(map(event), null); if (event.isSetHost() && event.getHost().isSetExternalStatus()) { parameters.setExternalStatus(ExternalStatus.valueOf(event.getHost().getExternalStatus().getState())); } return performCreate(VdcActionType.AddExternalEvent, parameters, new QueryIdResolver<Long>(VdcQueryType.GetAuditLogById, GetAuditLogByIdParameters.class)); }</code><technical_language>this previous "if" block duplicated</technical_language>

Target:
public Response add(Event event) { validateParameters(event, "origin", "severity", "customId", "description"); validateEnums(Event.class, event); boolean isExternalStateDefined = event.isSetHost() && event.getHost().isSetExternalStatus() && event.getHost().getExternalStatus().isSetState(); AddExternalEventParameters parameters = isExternalStateDefined ? new AddExternalEventParameters(map(event), HostMapper.map(EntityExternalStatus.fromValue( event.getHost().getExternalStatus().getState()), null)) : new AddExternalEventParameters(map(event), null); return performCreate(VdcActionType.AddExternalEvent, parameters, new QueryIdResolver<Long>(VdcQueryType.GetAuditLogById, GetAuditLogByIdParameters.class)); }
Source:
<code>public void write(Text key, Text value) throws IOException { String solrFieldName; SolrInputDocument document; Type schemaType = new TypeToken<Schema>() { }.getType(); Schema inputSchema = new Gson().fromJson(key.toString(), schemaType); StructuredRecord structuredRecord = StructuredRecordStringConverter.fromJsonString(value.toString(), inputSchema); document = new SolrInputDocument(); for (Schema.Field field : structuredRecord.getSchema().getFields()) { solrFieldName = field.getName(); if (config.getOutputFieldMap().containsKey(solrFieldName)) { document.addField(config.getOutputFieldMap().get(solrFieldName), structuredRecord.get(solrFieldName)); } else { document.addField(solrFieldName, structuredRecord.get(solrFieldName)); } } documentList.add(document); try { if (documentList.size() == Integer.parseInt(conf.get(BATCH_SIZE))) { solrClient.add(documentList); solrClient.commit(); documentList.clear(); } } catch (SolrServerException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>Logger log print stack trace. LOG.error("Exception while...", e);</technical_language>

Target:
public void write(Text key, Text value) throws IOException { String solrFieldName; SolrInputDocument document = new SolrInputDocument(); Schema inputSchema = GSON.fromJson(key.toString(), SCHEMA_TYPE); StructuredRecord structuredRecord = StructuredRecordStringConverter.fromJsonString(value.toString(), inputSchema); for (Schema.Field field : structuredRecord.getSchema().getFields()) { solrFieldName = field.getName(); if (config.getOutputFieldMap().containsKey(solrFieldName)) { document.addField(config.getOutputFieldMap().get(solrFieldName), structuredRecord.get(solrFieldName)); } else { document.addField(solrFieldName, structuredRecord.get(solrFieldName)); } } documentList.add(document); try { if (documentList.size() == Integer.parseInt(conf.get(BATCH_SIZE))) { solrClient.add(documentList); solrClient.commit(); documentList.clear(); } } catch (SolrServerException e) { throw new IllegalArgumentException("Exception while indexing the documents to Solr. For more details, Please " + "check the logs.", e); } }
Source:
<code>protected AbstractAttributeEditor createAttributeEditor(TaskAttribute attribute) { if (attribute == null) { return null; } String type = attribute.getMetaData().getType(); <START> int index = taskEditorPage.getTaskRepository() <END> .getProperties() .get(IRepositoryConstants.PROPERTY_HIDDEN) .indexOf(attribute.getId()); if (index == -1) { if (type != null) { AttributeEditorFactory attributeEditorFactory = getTaskEditorPage().getAttributeEditorFactory(); AbstractAttributeEditor editor = attributeEditorFactory.createEditor(type, attribute); if (editor instanceof RichTextAttributeEditor) { boolean spellChecking = getTaskEditorPage().getAttributeEditorToolkit().hasSpellChecking(attribute); ((RichTextAttributeEditor) editor).setSpellCheckingEnabled(spellChecking); } attributeIds.add(attribute.getId()); return editor; } } return null; }</code><technical_language>turns out property null. I do String hiddenAttributes = ...getProperty(...); if (hiddenAttributes == null || !hiddenAttribute.contains(attributeId)) {... //show editor ... }</technical_language>

Target:
protected AbstractAttributeEditor createAttributeEditor(TaskAttribute attribute) { if (attribute == null) { return null; } String type = attribute.getMetaData().getType(); String hiddenAttributes = taskEditorPage.getTaskRepository() .getProperties() .get(IRepositoryConstants.PROPERTY_HIDDEN); if (hiddenAttributes == null || !hiddenAttributes.contains(attribute.getId())) { if (type != null) { AttributeEditorFactory attributeEditorFactory = getTaskEditorPage().getAttributeEditorFactory(); AbstractAttributeEditor editor = attributeEditorFactory.createEditor(type, attribute); if (editor instanceof RichTextAttributeEditor) { boolean spellChecking = getTaskEditorPage().getAttributeEditorToolkit().hasSpellChecking(attribute); ((RichTextAttributeEditor) editor).setSpellCheckingEnabled(spellChecking); } attributeIds.add(attribute.getId()); return editor; } } return null; }
Source:
<code>private static long fromMetastoreDistinctValuesCount(long distinctValuesCount, long nullsCount, long rowCount) { long nonNullsCount = rowCount - nullsCount; <START> if (nullsCount > 0 && (distinctValuesCount > 1 || nonNullsCount == 0)) { <END> distinctValuesCount--; } if (distinctValuesCount > nonNullsCount) { return nonNullsCount; } return distinctValuesCount; }</code><technical_language>nullsCount > 0 && distinctValuesCount > 0. If nonNullsCount == 0 - number of distinct values zero</technical_language>

Target:
private static long fromMetastoreDistinctValuesCount(long distinctValuesCount, long nullsCount, long rowCount) { long nonNullsCount = rowCount - nullsCount; if (nullsCount > 0 && distinctValuesCount > 0) { distinctValuesCount--; } if (nonNullsCount > 0 && distinctValuesCount == 0) { distinctValuesCount = 1; } if (distinctValuesCount > nonNullsCount) { return nonNullsCount; } return distinctValuesCount; }
Source:
<code>public ConnectionPoolConfig(VerifiableProperties verifiableProperties) { connectionPoolReadBufferSizeBytes = verifiableProperties.getIntInRange("connectionpool.read.buffer.size.bytes", 1048576, 1, 1024 * 1024 * 1024); connectionPoolWriteBufferSizeBytes = verifiableProperties.getIntInRange("connectionpool.write.buffer.size.bytes", 1048576, 1, 1024 * 1024 * 1024); connectionPoolReadTimeoutMs = verifiableProperties.getIntInRange("connectionpool.read.timeout.ms", 1500, 1, 100000); connectionPoolConnectTimeoutMs = verifiableProperties.getIntInRange("connectionpool.connect.timeout.ms", 800, 1, 100000); connectionPoolMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("connectionpool.max.connections.per.port.plain.text", 5, 1, 20); connectionPoolMaxConnectionsPerPortSSL = verifiableProperties.getIntInRange("connectionpool.max.connections.per.port.ssl", 2, 1, 20); connectionPoolMaxConnectFailuresToCleanUpAvailablePool = <START> verifiableProperties.getInt("connectionpool.max.connect.failures.to.clean.up.available.pool", 0); <END> }</code><technical_language>default 2</technical_language>

Target:
public ConnectionPoolConfig(VerifiableProperties verifiableProperties) { connectionPoolReadBufferSizeBytes = verifiableProperties.getIntInRange("connectionpool.read.buffer.size.bytes", 1048576, 1, 1024 * 1024 * 1024); connectionPoolWriteBufferSizeBytes = verifiableProperties.getIntInRange("connectionpool.write.buffer.size.bytes", 1048576, 1, 1024 * 1024 * 1024); connectionPoolReadTimeoutMs = verifiableProperties.getIntInRange("connectionpool.read.timeout.ms", 1500, 1, 100000); connectionPoolConnectTimeoutMs = verifiableProperties.getIntInRange("connectionpool.connect.timeout.ms", 800, 1, 100000); connectionPoolMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("connectionpool.max.connections.per.port.plain.text", 5, 1, 20); connectionPoolMaxConnectionsPerPortSSL = verifiableProperties.getIntInRange("connectionpool.max.connections.per.port.ssl", 2, 1, 20); }
Source:
<code>public FindJobExecutionEventsRequest(final Integer pageSize, final Integer pageNumber) { <START> setPageSize(pageSize); <END> setPageNumber(pageNumber); }</code><technical_language>Please this.xxx assign regular fields</technical_language>

Target:
public FindJobExecutionEventsRequest(final Integer pageSize, final Integer pageNumber) { super(pageSize, pageNumber, null, null); }
Source:
<code>public LambdaBeanPropertyMemberAccessor(Method getterMethod) { this.getterMethod = getterMethod; Class<?> declaringClass = getterMethod.getDeclaringClass(); if (!ReflectionHelper.isGetterMethod(getterMethod)) { throw new IllegalArgumentException("The getterMethod (" + getterMethod + ") is not a valid getter."); } propertyType = getterMethod.getReturnType(); propertyName = ReflectionHelper.getGetterPropertyName(getterMethod); MethodHandles.Lookup lookup = MethodHandles.lookup(); CallSite getterSite; try { getterSite = LambdaMetafactory.metafactory(lookup, "apply", MethodType.methodType(Function.class), MethodType.methodType(Object.class, Object.class), lookup.findVirtual(declaringClass, getterMethod.getName(), MethodType.methodType(propertyType)), MethodType.methodType(propertyType, declaringClass)); } catch (LambdaConversionException | NoSuchMethodException | IllegalAccessException e) { throw new IllegalArgumentException("Lambda creation failed for getterMethod (" + getterMethod + ").", e); } try { getterFunction = (Function) getterSite.getTarget().invokeExact(); } catch (Throwable e) { throw new IllegalArgumentException("Lambda creation failed for getterMethod (" + getterMethod + ").", e); } setterMethod = ReflectionHelper.getSetterMethod(declaringClass, getterMethod.getReturnType(), propertyName); if (setterMethod != null) { CallSite setterSite; try { setterSite = LambdaMetafactory.metafactory(lookup, "accept", MethodType.methodType(BiConsumer.class), MethodType.methodType(void.class, Object.class, Object.class), lookup.findVirtual(declaringClass, setterMethod.getName(), MethodType.methodType(void.class, propertyType)), MethodType.methodType(void.class, declaringClass, propertyType)); } catch (LambdaConversionException | NoSuchMethodException | IllegalAccessException e) { <START> throw new IllegalArgumentException("Lambda creation failed for getterMethod (" + getterMethod + ").", e); <END> } try { setterFunction = (BiConsumer) setterSite.getTarget().invokeExact(); } catch (Throwable e) { throw new IllegalArgumentException("Lambda creation failed for getterMethod (" + getterMethod + ").", e); } } else { setterFunction = null; } }</code><technical_language>I suspect message "Lambda creation failed for setterMethod", I correct</technical_language>

Target:
public LambdaBeanPropertyMemberAccessor(Method getterMethod) { this.getterMethod = getterMethod; Class<?> declaringClass = getterMethod.getDeclaringClass(); if (!ReflectionHelper.isGetterMethod(getterMethod)) { throw new IllegalArgumentException("The getterMethod (" + getterMethod + ") is not a valid getter."); } propertyType = getterMethod.getReturnType(); propertyName = ReflectionHelper.getGetterPropertyName(getterMethod); MethodHandles.Lookup lookup = MethodHandles.lookup(); getterFunction = createGetterFunction(lookup); setterMethod = ReflectionHelper.getSetterMethod(declaringClass, getterMethod.getReturnType(), propertyName); setterFunction = createSetterFunction(lookup); }
Source:
<code>public void testListUser() { Iterable<User> users = env.enterprise.listUsers(); assertEquals(Iterables.size(users), 2); users = filter(env.enterprise.listUsers(), nick(env.user.getNick())); assertEquals(size(users), 1); users = filter(env.enterprise.listUsers(), nick(env.user.getName() + "FAIL")); assertEquals(size(users), 0); users = env.enterprise.listUsers(UserOptions.builder().limit(1).startWith(0).build()); <START> assertEquals(Iterables.size(users), 1); <END> }</code><technical_language>static imported size, in previous lines</technical_language>

Target:
public void testListUser() { Iterable<User> users = env.enterprise.listUsers(); assertEquals(size(users), 2); users = filter(env.enterprise.listUsers(), nick(env.user.getNick())); assertEquals(size(users), 1); users = filter(env.enterprise.listUsers(), nick(env.user.getName() + "FAIL")); assertEquals(size(users), 0); }
Source:
<code>public BasicBrooklynCatalog(final ManagementContext mgmt, final CatalogDto dto) { <START> this.mgmt = mgmt; <END> this.catalog = new CatalogDo(dto); mgmt.getExecutionManager().submit(MutableMap.of("name", "loading catalog"), new Runnable() { public void run() { log.debug("Loading catalog for "+mgmt); catalog.load(mgmt, null); if (log.isDebugEnabled()) log.debug("Loaded catalog for "+mgmt+": "+catalog); } }); }</code><technical_language>I love this.mgmt = checkNotNull(mgmt, "managementContext"), if NPE quickly track caused caused by,</technical_language>

Target:
public BasicBrooklynCatalog(final ManagementContext mgmt, final CatalogDto dto) { this.mgmt = Preconditions.checkNotNull(mgmt, "managementContext"); this.catalog = new CatalogDo(dto); mgmt.getExecutionManager().submit(MutableMap.of("name", "loading catalog"), new Runnable() { public void run() { log.debug("Loading catalog for "+mgmt); catalog.load(mgmt, null); if (log.isDebugEnabled()) log.debug("Loaded catalog for "+mgmt+": "+catalog); } }); }
Source:
<code>private void deleteReferenceSetEntry(int referenceSetID) throws EamDbException{ Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "DELETE FROM reference_sets WHERE id=?"; try { preparedStatement = conn.prepareStatement(sql); preparedStatement.setInt(1, referenceSetID); preparedStatement.executeUpdate(); } catch (SQLException ex) { <START> throw new EamDbException("Error deleting reference set", ex); END> } finally { EamDbUtil.closePreparedStatement(preparedStatement); EamDbUtil.closeConnection(conn); } }</code><technical_language>I debugging if include some identification of reference set experienced error condition in error message</technical_language>

Target:
private void deleteReferenceSetEntry(int referenceSetID) throws EamDbException{ Connection conn = connect(); PreparedStatement preparedStatement = null; String sql = "DELETE FROM reference_sets WHERE id=?"; try { preparedStatement = conn.prepareStatement(sql); preparedStatement.setInt(1, referenceSetID); preparedStatement.executeUpdate(); } catch (SQLException ex) { throw new EamDbException("Error deleting reference set " + referenceSetID, ex); } finally { EamDbUtil.closePreparedStatement(preparedStatement); EamDbUtil.closeConnection(conn); } }
Source:
<code><START> void performDestroyView() { if (mChildFragmentManager != null) { <END> mChildFragmentManager.dispatchDestroyView(); } mState = CREATED; mCalled = false; onDestroyView(); if (!mCalled) { throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onDestroyView()"); } LoaderManager.getInstance(this).markForRedelivery(); mPerformedCreateView = false; }</code><technical_language>Do do here</technical_language>

Target:
void performDestroyView() { if (mView != null) { mViewLifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY); } if (mChildFragmentManager != null) { mChildFragmentManager.dispatchDestroyView(); } mState = CREATED; mCalled = false; onDestroyView(); if (!mCalled) { throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onDestroyView()"); } LoaderManager.getInstance(this).markForRedelivery(); mPerformedCreateView = false; }
Source:
<code>public void open(Configuration parameters) { ValueStateDescriptor<Tuple2<String, String>> descriptor = new ValueStateDescriptor<>( "state", <START> TypeInformation.of(new TypeHint<Tuple2<String, String>>(){})); <END> state = getRuntimeContext().getState(descriptor); }</code><technical_language>fyi, easier do this. suggestion Types.Tuple(Types.String, Types.String)</technical_language>

Target:
public void open(Configuration parameters) { ValueStateDescriptor<Tuple2<String, String>> descriptor = new ValueStateDescriptor<>( "state", Types.TUPLE(Types.STRING, Types.STRING)); state = getRuntimeContext().getState(descriptor); }
Source:
<code>public void start(J project, boolean newInstance) { this.job = project; try { <START> if (spec != null) { <END> this.tabs = CronTabList.create(spec, Hash.from(project.getFullName())); } } catch (ANTLRException e) { LOGGER.log(Level.WARNING, String.format("Failed to parse crontab spec %s in job %s", spec, project.getFullName()), e); } }</code><technical_language>a warning least</technical_language>

Target:
public void start(J project, boolean newInstance) { this.job = project; try { if (spec != null) { this.tabs = CronTabList.create(spec, Hash.from(project.getFullName())); } else { LOGGER.log(Level.WARNING, "The job {0} has a null crontab spec which is incorrect", job.getFullName()); } } catch (ANTLRException e) { LOGGER.log(Level.WARNING, String.format("Failed to parse crontab spec %s in job %s", spec, project.getFullName()), e); } }
Source:
<code>public void shouldScanOnlyIfRequestContentTypeIsXml() throws Exception { <START> String test = "/test"; this.nano.addHandler( new NanoServerHandler(test) { @Override protected NanoHTTPD.Response serve(NanoHTTPD.IHTTPSession session) { consumeBody(session); String response = "<foo>root:*:0:0:System Administrator:/var/root:/bin/sh</foo>"; return newFixedLengthResponse( NanoHTTPD.Response.Status.OK, NanoHTTPD.MIME_PLAINTEXT, response); } }); <END> HttpMessage msg = this.getHttpMessage(test); msg.setRequestBody("<?xml version=\"1.0\"?><comment><text>test</text></comment>"); msg.getRequestHeader().setHeader("Content-Type", "application/json"); msg.getRequestHeader().setMethod("POST"); rule.init(msg, parent); rule.scan(); assertThat(countMessagesSent, equalTo(0)); }</code><technical_language>This again, extracted a local method, createNanoHandler. this.nano.addHandler(createHandler());</technical_language>

Target:
public void shouldScanOnlyIfRequestContentTypeIsXml() throws HttpMalformedHeaderException { HttpMessage msg = this.getHttpMessage("/test"); msg.getRequestHeader().setHeader("Content-Type", "application/json"); msg.setRequestBody("<?xml version=\"1.0\"?><comment><text>test</text></comment>"); msg.getRequestHeader().setMethod("POST"); rule.init(msg, parent); rule.scan(); assertThat(countMessagesSent, equalTo(0)); }
Source:
<code>protected void onChanged() { <START> if (owningEntity != null) { <END> ((EntityInternal)owningEntity).requestPersist(); } }</code><technical_language>add } else { super.onChanged(); }</technical_language>

Target:
protected void onChanged() { if (owningEntity != null) { ((EntityInternal) owningEntity).requestPersist(); } else { super.onChanged(); } }
Source:
<code>public String toString() { StringBuffer buffer = new StringBuffer(); if (queries != null) { for (Term q : queries) { buffer.append(q); buffer.append(","); } } buffer.append("^"); buffer.append(boost); <START> buffer.append("tieBraker:"); <END> buffer.append(tieBraker); return buffer.toString(); }</code><technical_language>this adjacent boost</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); if (queries != null) { for (Term q : queries) { builder.append(q).append(","); } } builder.append("^").append(boost).append("tieBraker:").append(tieBraker); return builder.toString(); }
Source:
<code>public boolean updateDatastream(Datastream datastream) { String path = KeyBuilder.datastream(_cluster, datastream.getName()); if (!_zkclient.exists(path)) { LOG.warn("trying to update znode of datastream that does not exist. Datastream name: " + datastream.getName()); return false; } String data = DatastreamJSonUtil.getJSonStringFromDatastream(datastream); <START> _zkclient.writeData(path, data); <END> return true; }</code><technical_language>update, instead updateDataSerialized? do ensure this update succeed</technical_language>

Target:
public boolean updateDatastream(Datastream datastream) { String path = KeyBuilder.datastream(_cluster, datastream.getName()); if (!_zkclient.exists(path)) { LOG.warn("trying to update znode of datastream that does not exist. Datastream name: " + datastream.getName()); return false; } String data = DatastreamJSonUtil.getJSonStringFromDatastream(datastream); _zkclient.updateDataSerialized(path, old -> data); return true; }
Source:
<code><START> public void removeFile(IndexedFile file) <END> { int i = file.getJsonID(); JSONArray movedItem = (JSONArray) mFilesArray.remove(i); if (movedItem != null) getFile(movedItem).setJsonID(i); mFiles.remove(file.getUID()); file.unresolveLink(); saveChanges(); }</code><technical_language>_Opinion_: I expect this remove file, is a method in file index manager. I removeFileFromIndex works here. @OlivierHokke, @AlexKolpa @jzvandenoever, opinions</technical_language>

Target:
public void removeFile(IndexedFile file) { int i = file.getJsonID(); Object movedItem = mFilesArray.remove(i).getMovedElement(); if (movedItem != null && movedItem instanceof JSONArray) { getFile((JSONArray)movedItem).setJsonID(i); } mFiles.remove(file.getUID()); file.unresolveLink(); saveChanges(); }
Source:
<code>private void setUpException() { expected.expect(ClientException.class); <START> expected.expectMessage("500 Internal Server Error: /var/log/httpd/error_log"); <END> }</code><technical_language>more sense constants defined CUSTOM_CLIENT_EXCEPTION.getMessage()</technical_language>

Target:
private void setUpException() { expected.expect(ClientException.class); expected.expectMessage(CUSTOM_CLIENT_EXCEPTION.getMessage()); }
Source:
<code>private static void copyProperties(PackageProperties src, PackageProperties tgt){ tgt.setCategoryProperty(src.getCategoryProperty().orElse(null)); tgt.setContentStatusProperty(src.getContentStatusProperty().orElse(null)); tgt.setContentTypeProperty(src.getContentTypeProperty().orElse(null)); tgt.setCreatorProperty(src.getCreatorProperty().orElse(null)); tgt.setDescriptionProperty(src.getDescriptionProperty().orElse(null)); tgt.setIdentifierProperty(src.getIdentifierProperty().orElse(null)); tgt.setKeywordsProperty(src.getKeywordsProperty().orElse(null)); tgt.setLanguageProperty(src.getLanguageProperty().orElse(null)); tgt.setRevisionProperty(src.getRevisionProperty().orElse(null)); tgt.setSubjectProperty(src.getSubjectProperty().orElse(null)); tgt.setTitleProperty(src.getTitleProperty().orElse(null)); <START> tgt.setVersionProperty(src.getVersionProperty().orElse(null)); <END> }</code><technical_language>setters expect Optional, a potentially null value</technical_language>

Target:
private static void copyProperties(PackageProperties src, PackageProperties tgt) { tgt.setCategoryProperty(src.getCategoryProperty()); tgt.setContentStatusProperty(src.getContentStatusProperty()); tgt.setContentTypeProperty(src.getContentTypeProperty()); tgt.setCreatorProperty(src.getCreatorProperty()); tgt.setDescriptionProperty(src.getDescriptionProperty()); tgt.setIdentifierProperty(src.getIdentifierProperty()); tgt.setKeywordsProperty(src.getKeywordsProperty()); tgt.setLanguageProperty(src.getLanguageProperty()); tgt.setRevisionProperty(src.getRevisionProperty()); tgt.setSubjectProperty(src.getSubjectProperty()); tgt.setTitleProperty(src.getTitleProperty()); tgt.setVersionProperty(src.getVersionProperty()); }
Source:
<code>private String updateStackStatus(Stack stack, SyncResult result, List<ProviderSyncResult> providerSyncResults, int alreadyDeletedCount) { DetailedStackStatus status = providerSyncResults == null ? result.getStatus() : getStackStatus(providerSyncResults, result, alreadyDeletedCount); if (status != stack.getStackStatus().getDetailedStackStatus()) { if (autoSyncConfig.isUpdateStatus()) { if (flowLogService.isOtherFlowRunning(stack.getId())) { throw new InterruptSyncingException(":::Auto sync::: interrupt syncing in updateStackStatus, flow is running on freeipa stack " + stack.getName()); } else { stackUpdater.updateStackStatus(stack, status, result.getMessage()); } } else { LOGGER.info(":::Auto sync::: The stack status would be had to update from to {}", stack.getStackStatus().getDetailedStackStatus(), status); } } <START> return String.format("freeipa %s is %s. ", stack.getResourceCrn(), status.getStatus().toString()); <END> }</code><technical_language>toString() is necessary</technical_language>

Target:
private void updateStackStatus(Stack stack, SyncResult result, List<ProviderSyncResult> providerSyncResults, int alreadyDeletedCount) { DetailedStackStatus status = providerSyncResults == null ? result.getStatus() : getStackStatus(providerSyncResults, result, alreadyDeletedCount); if (status != stack.getStackStatus().getDetailedStackStatus()) { if (autoSyncConfig.isUpdateStatus()) { if (flowLogService.isOtherFlowRunning(stack.getId())) { throw new InterruptSyncingException(":::Auto sync::: interrupt syncing in updateStackStatus, flow is running on freeipa stack " + stack.getName()); } else { stackUpdater.updateStackStatus(stack, status, result.getMessage()); } } else { LOGGER.info(":::Auto sync::: The stack status would be had to update from to {}", stack.getStackStatus().getDetailedStackStatus(), status); } } }
Source:
<code>public List<String> getFields() { ArrayList<String> fields = new ArrayList<String>(); Metadata metadata; try { metadata = layer.getDataSource().getMetadata(); String retainedFiledName = null; for (int i = 0; i < metadata.getFieldCount(); i++) { int currentType = metadata.getFieldType(i).getTypeCode(); <START> if (currentType == 4 || (currentType >= 16 && currentType <= 256)) { <END> retainedFiledName = metadata.getFieldName(i); fields.add(retainedFiledName); } } } catch (DriverException ex) { Logger.getLogger(ChoroplethDataModel.class.getName()).log(Level.SEVERE, null, ex); } return fields; }</code><technical_language>If I remember correctly, values constant stored in Type. constants, values, for consistency reasons. Moreover, code easier understand</technical_language>

Target:
public List<String> getFields() { ArrayList<String> fields = new ArrayList<String>(); Metadata metadata; try { metadata = layer.getDataSource().getMetadata(); String retainedFiledName = null; for (int i = 0; i < metadata.getFieldCount(); i++) { int currentType = metadata.getFieldType(i).getTypeCode(); if (currentType == Type.BYTE || (currentType >= Type.DOUBLE && currentType <= Type.SHORT)) { retainedFiledName = metadata.getFieldName(i); fields.add(retainedFiledName); } } } catch (DriverException ex) { LOGGER.error(I18N.tr("Unable to load the map data header"), ex); } return fields; }
Source:
<code>private AuthenticatedUser createAuthenticatedUserForView (Object[] dbRowValues, String roles, int rowNum){ AuthenticatedUser user = new AuthenticatedUser(); user.setRowNum(rowNum); <START> user.setId(new Long((Integer)dbRowValues[0])); <END> user.setUserIdentifier((String)dbRowValues[1]); user.setLastName(UserUtil.getStringOrNull(dbRowValues[2])); user.setFirstName(UserUtil.getStringOrNull(dbRowValues[3])); user.setEmail(UserUtil.getStringOrNull(dbRowValues[4])); user.setAffiliation(UserUtil.getStringOrNull(dbRowValues[5])); user.setSuperuser((Boolean)(dbRowValues[6])); user.setPosition(UserUtil.getStringOrNull(dbRowValues[7])); user.setModificationTime(UserUtil.getTimestampOrNull(dbRowValues[8])); user.setAuthProviderId(UserUtil.getStringOrNull(dbRowValues[9])); user.setAuthProviderFactoryAlias(UserUtil.getStringOrNull(dbRowValues[10])); user.setRoles(roles); return user; }</code><technical_language>user.setId((long) dbRowValues[0]));</technical_language>

Target:
private AuthenticatedUser createAuthenticatedUserForView (Object[] dbRowValues, String roles, int rowNum){ AuthenticatedUser user = new AuthenticatedUser(); user.setId(new Long((int)dbRowValues[0])); user.setUserIdentifier((String)dbRowValues[1]); user.setLastName(UserUtil.getStringOrNull(dbRowValues[2])); user.setFirstName(UserUtil.getStringOrNull(dbRowValues[3])); user.setEmail(UserUtil.getStringOrNull(dbRowValues[4])); user.setAffiliation(UserUtil.getStringOrNull(dbRowValues[5])); user.setSuperuser((Boolean)(dbRowValues[6])); user.setPosition(UserUtil.getStringOrNull(dbRowValues[7])); user.setCreatedTime(UserUtil.getTimestampOrNull(dbRowValues[8])); user.setLastLoginTime(UserUtil.getTimestampOrNull(dbRowValues[9])); user.setLastApiUseTime(UserUtil.getTimestampOrNull(dbRowValues[10])); user.setAuthProviderId(UserUtil.getStringOrNull(dbRowValues[11])); user.setAuthProviderFactoryAlias(UserUtil.getStringOrNull(dbRowValues[12])); user.setRoles(roles); return user; }
Source:
<code>private ListenableFuture<Map<Cell, byte[]>> getFromKeyValueService( TableReference tableRef, Set<Cell> cells, AsyncKeyValueService asyncKeyValueService, AsyncTransactionService asyncTransactionService) { Map<Cell, Long> toRead = Cells.constantValueMap(cells, getStartTimestamp()); <START> ListenableFuture<Collection<Map.Entry<Cell, byte[]>>> futureBuilder = <END> Futures.transformAsync( asyncKeyValueService.getAsync(tableRef, toRead), rawResults -> getWithPostFilteringAsync( tableRef, rawResults, Value.GET_VALUE, asyncKeyValueService, asyncTransactionService), MoreExecutors.directExecutor()); return Futures.transform( futureBuilder, input -> ImmutableMap.<Cell, byte[]>builderWithExpectedSize(cells.size()).putAll(input).build(), MoreExecutors.directExecutor()); }</code><technical_language>naming</technical_language>

Target:
private ListenableFuture<Map<Cell, byte[]>> getFromKeyValueService( TableReference tableRef, Set<Cell> cells, AsyncKeyValueService asyncKeyValueService, AsyncTransactionService asyncTransactionService) { Map<Cell, Long> toRead = Cells.constantValueMap(cells, getStartTimestamp()); ListenableFuture<Collection<Map.Entry<Cell, byte[]>>> postFilteredResults = Futures.transformAsync( asyncKeyValueService.getAsync(tableRef, toRead), rawResults -> getWithPostFilteringAsync( tableRef, rawResults, Value.GET_VALUE, asyncKeyValueService, asyncTransactionService), MoreExecutors.directExecutor()); return Futures.transform(postFilteredResults, ImmutableMap::copyOf, MoreExecutors.directExecutor()); }
Source:
<code>public void workspacePut( @RequestBody WorkspaceInfo workspace, @PathVariable String workspaceName, UriComponentsBuilder builder) { if ("default".equals(workspaceName)) { catalog.setDefaultWorkspace(workspace); } else { WorkspaceInfo wks = catalog.getWorkspaceByName(workspaceName); if (wks == null) { throw new RestException( "Can't change a non existant workspace (" + workspaceName + ")", HttpStatus.NOT_FOUND); } String infoName = workspace.getName(); if (infoName != null && infoName.isEmpty()) { <START> throw new RestException("Can't change name of workspace", HttpStatus.FORBIDDEN); <END> } new CatalogBuilder(catalog).updateWorkspace(wks, workspace); catalog.save(wks); } }</code><technical_language>error message updated "the name empty" that. Honestly I check here, UI allows for workspace renames</technical_language>

Target:
public void workspacePut( @RequestBody WorkspaceInfo workspace, @PathVariable String workspaceName, UriComponentsBuilder builder) { if ("default".equals(workspaceName)) { catalog.setDefaultWorkspace(workspace); } else { WorkspaceInfo wks = catalog.getWorkspaceByName(workspaceName); if (wks == null) { throw new RestException( "Can't change a non existant workspace (" + workspaceName + ")", HttpStatus.NOT_FOUND); } String infoName = workspace.getName(); if (infoName != null && infoName.isEmpty()) { throw new RestException("The workspace name cannot be empty", HttpStatus.FORBIDDEN); } new CatalogBuilder(catalog).updateWorkspace(wks, workspace); catalog.save(wks); } }
Source:
<code>public String toString() { <START> return StringFactory.vertexProgramString(this, "alpha=" + this.alpha + ", iterations=" + this.totalIterations + ", epsilon=" + this.epsilon); <END> }</code><technical_language>show iterations epsilon</technical_language>

Target:
public String toString() { return StringFactory.vertexProgramString(this, "alpha=" + this.alpha + ", epsilon=" + this.epsilon + ", iterations=" + this.maxIterations); }
Source:
<code>private Dialog createDeleteDialog(){ return new android.app.AlertDialog.Builder(this) .setMessage(R.string.remove_device_confirm) .setPositiveButton(android.R.string.yes, (dialogInterface, i) -> { getApi().removeDevice(mDevice.deviceID); finish(); }) .setNegativeButton(android.R.string.no, (dialog, which) -> mIsShowingDeleteDialog = false) .setOnCancelListener(dialog -> mIsShowingDeleteDialog = false) .create(); <START> } <END></code><technical_language>empty lines</technical_language>

Target:
private Dialog createDeleteDialog(){ return new android.app.AlertDialog.Builder(this) .setMessage(R.string.remove_device_confirm) .setPositiveButton(android.R.string.yes, (dialogInterface, i) -> { getApi().removeDevice(mDevice.deviceID); finish(); }) .setNegativeButton(android.R.string.no, null) .create(); }
Source:
<code>void addRevisionType(Element anyMapping, Element anyMappingEnd, boolean isKey) { final Element revTypeProperty = MetadataTools.addProperty( anyMapping, verEntCfg.getRevisionTypePropName(), verEntCfg.getRevisionTypePropType(), true, isKey ); revTypeProperty.addAttribute( "type", "org.hibernate.envers.internal.entities.RevisionTypeType" ); addAdditionalColumns( anyMappingEnd ); <START> } <END></code><technical_language>need add a private method for this. call directly. BTW, careful, need indent tabs</technical_language>

Target:
void addRevisionType(Element anyMapping, Element anyMappingEnd, boolean isKey) { final Element revTypeProperty = MetadataTools.addProperty( anyMapping, verEntCfg.getRevisionTypePropName(), verEntCfg.getRevisionTypePropType(), true, isKey ); revTypeProperty.addAttribute( "type", "org.hibernate.envers.internal.entities.RevisionTypeType" ); }
Source:
<code>public Response intercept(Chain chain) throws IOException { if (NetworkUtils.isImageAllowed()) { return chain.proceed(chain.request()); } else { return new Response.Builder() <START> .code(420) <END> .protocol(Protocol.HTTP_2) .message("Dummy response") .body(new RealResponseBody(null, 0, null)) .request(chain.request()) .build(); } }</code><technical_language>huh</technical_language>

Target:
public Response intercept(Chain chain) throws IOException { if (NetworkUtils.isImageAllowed()) { return chain.proceed(chain.request()); } else { return new Response.Builder() .protocol(Protocol.HTTP_2) .code(420) .message("Policy Not Fulfilled") .body(ResponseBody.create(null, new byte[0])) .request(chain.request()) .build(); } }
Source:
<code>public SCTVerificationResult verifySingleSCT(SignedCertificateTimestamp <START> sct, <END> CertificateEntry entry) { String algorithm = sct.getSignature().getAlgorithm(); try { byte[] toVerify = sct.encodeTBS(entry); Signature signature = Signature.getInstance(algorithm); signature.initVerify(publicKey); signature.update(toVerify); if (!signature.verify(sct.getSignature().getSignature())) { return new SCTVerificationResult(sct, SCTVerificationResult.Status.BAD_SIGNATURE, this); } return new SCTVerificationResult(sct, SCTVerificationResult.Status.VALID, this); } catch (SerializationException e) { return new SCTVerificationResult(sct, SCTVerificationResult.Status.OTHER, this); } catch (NoSuchAlgorithmException e) { return new SCTVerificationResult(sct, SCTVerificationResult.Status.OTHER, this); } catch (InvalidKeyException e) { return new SCTVerificationResult(sct, SCTVerificationResult.Status.OTHER, this); } catch (SignatureException e) { throw new RuntimeException(e); } }</code><technical_language>Nit: Confirm SCT matches this log - i.e. LogID is equal</technical_language>

Target:
public SCTVerificationResult.Status verifySingleSCT(SignedCertificateTimestamp sct, CertificateEntry entry) { if (!Arrays.equals(sct.getLogID(), getID())) { return SCTVerificationResult.Status.UNKNOWN_LOG; } byte[] toVerify; try { toVerify = sct.encodeTBS(entry); } catch (SerializationException e) { return SCTVerificationResult.Status.INVALID_SCT; } Signature signature; try { String algorithm = sct.getSignature().getAlgorithm(); signature = Signature.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { return SCTVerificationResult.Status.INVALID_SCT; } try { signature.initVerify(publicKey); } catch (InvalidKeyException e) { return SCTVerificationResult.Status.INVALID_SCT; } try { signature.update(toVerify); if (!signature.verify(sct.getSignature().getSignature())) { return SCTVerificationResult.Status.INVALID_SIGNATURE; } return SCTVerificationResult.Status.VALID; } catch (SignatureException e) { throw new RuntimeException(e); } }
Source:
<code>private boolean evaluateExpressionOnEntity(String expression, Entity entity) { if (expression == null) { return true; } else { Object value; try { value = jsMagmaScriptEvaluator.eval(expression, entity); } catch (ScriptExecutionException see) { <START> return false; <END> } return value != null ? Boolean.valueOf(value.toString()) : false; } }</code><technical_language>Null expression evaluates true, errored exception evaluates false, I throw</technical_language>

Target:
private boolean evaluateExpressionOnEntity(String expression, Entity entity) { if (expression == null) { return true; } else { Object value = jsMagmaScriptEvaluator.eval(expression, entity); return value != null ? Boolean.valueOf(value.toString()) : false; } }
Source:
<code>public boolean isLaunched(Agent agent, InstanceProcess process, Instance machine) throws MachineException { Command command = new CommandImpl(format("Wait for %s, try %d", agent.getName(), ++counter), format("ps -fC %s 1>/dev/null && echo 0 || echo 1", processNameToWait), "test"); <START> try (ListLineConsumer lineConsumer = new ListLineConsumer();) { <END> InstanceProcess waitProcess = machine.createProcess(command, null); waitProcess.start(lineConsumer); return lineConsumer.getText().endsWith("[STDOUT] 0"); } catch (ConflictException e) { throw new MachineException(e.getServiceError()); } }</code><technical_language>Semicolon is needed</technical_language>

Target:
public boolean isLaunched(Agent agent, InstanceProcess process, Instance machine) throws MachineException { Command command = new CommandImpl(format("Wait for %s, try %d", agent.getName(), ++counter), format("ps -fC %s 1>/dev/null && echo 0 || echo 1", processNameToWait), "test"); try (ListLineConsumer lineConsumer = new ListLineConsumer()) { InstanceProcess waitProcess = machine.createProcess(command, null); waitProcess.start(lineConsumer); return lineConsumer.getText().endsWith("[STDOUT] 0"); } catch (ConflictException e) { throw new MachineException(e.getServiceError()); } }