auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void startDefaultMaster(String... args) throws Exception { <START> List<String> argsList = setupDefaultMaster(args); <END> if (argsList == null) { return; } startMaster(argsList.toArray(new String[argsList.size()])); waitForMasterToConnectToZK(); }</code><technical_language>final</technical_language>

Target:
protected void startDefaultMaster(String... args) throws Exception { final List<String> argsList = setupDefaultMaster(args); if (argsList == null) { return; } startMaster(argsList.toArray(new String[argsList.size()])); waitForMasterToConnectToZK(); }
Source:
<code>public void testExpirationTime_whenMaxIdleTime_isSmallerThan_TTL() { IMap<Integer, Integer> map = createMapWithMaxIdleSeconds(10); map.put(1, 1, 100, TimeUnit.SECONDS); EntryView<Integer, Integer> entryView = map.getEntryView(1); long lastAccessTime = entryView.getLastAccessTime(); long delayToExpiration = lastAccessTime + TimeUnit.SECONDS.toMillis(10); long expectedExpirationTime = delayToExpiration + entryView.getCreationTime(); <START> System.out.println(lastAccessTime + " " + delayToExpiration); <END> assertEquals(expectedExpirationTime, entryView.getExpirationTime()); }</code><technical_language>leftover</technical_language>

Target:
public void testExpirationTime_whenMaxIdleTime_isSmallerThan_TTL() { IMap<Integer, Integer> map = createMapWithMaxIdleSeconds(10); map.put(1, 1, 100, TimeUnit.SECONDS); EntryView<Integer, Integer> entryView = map.getEntryView(1); long lastAccessTime = entryView.getLastAccessTime(); long delayToExpiration = lastAccessTime + TimeUnit.SECONDS.toMillis(10); long expectedExpirationTime = delayToExpiration + entryView.getCreationTime(); assertEquals(expectedExpirationTime, entryView.getExpirationTime()); }
Source:
<code>protected void configureEnvironment(final ClusterEnvironment.Builder builder) { <START> Jackson2ObjectMapperBuilder jacksonBuilder = new Jackson2ObjectMapperBuilder(); <END> jacksonBuilder.serializationInclusion(JsonInclude.Include.NON_NULL); jacksonBuilder.modules(new CouchbaseJacksonModule(), new JsonValueModule()); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new CouchbaseJacksonModule()); objectMapper.registerModule(new JsonValueModule()); builder.jsonSerializer(JacksonJsonSerializer.create(objectMapper)); }</code><technical_language>I this is work? do expose jackson user, encoding decoding spring side SDK itself.. this mapper/converter logic instead</technical_language>

Target:
protected void configureEnvironment(final ClusterEnvironment.Builder builder) { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new CouchbaseJacksonModule()); objectMapper.registerModule(new JsonValueModule()); builder.jsonSerializer(JacksonJsonSerializer.create(objectMapper)); }
Source:
<code>public ValueHolder parseUrl(String stringUrl) { ValueHolder valueHolder = null; <START> Matcher regexpMatcher = URL_REGEX.matcher( stringUrl ); <END> if ( regexpMatcher.matches() ) { String protocol = regexpMatcher.group( 1 ); String host = regexpMatcher.group( 2 ); int port = -1; String portMatch = regexpMatcher.group( 3 ); if ( portMatch != null ) { port = Integer.parseInt( portMatch ); } valueHolder = new ValueHolder( protocol, host, port ); } return valueHolder; }</code><technical_language>wondering reg exp potentially user constraint. Is evaluated well</technical_language>

Target:
private ValueHolder parseUrl(String stringUrl) { ValueHolder valueHolder = null; Matcher regexpMatcher = URL_REGEX.matcher( stringUrl ); if ( regexpMatcher.matches() ) { String protocol = regexpMatcher.group( 1 ); String host = regexpMatcher.group( 2 ); int port = -1; String portMatch = regexpMatcher.group( 3 ); if ( portMatch != null ) { port = Integer.parseInt( portMatch ); } valueHolder = new ValueHolder( protocol, host, port ); } return valueHolder; }
Source:
<code>public Integer int32(String name) { <START> Int32Field field = fieldSearcher.nextField(name, Int32Field.class, null, structReadBuffer); <END> if (field == null) { return null; } return (Integer) field.decode(structReadBuffer); }</code><technical_language>methods do thing. factor out some generic method</technical_language>

Target:
public Integer int32(String name) { return fieldDecoder.decodeValue(name, Int32Field.class); }
Source:
<code>private TaskData doInBackgroundCountModels(TaskData... params){ Timber.d("doInBackgroundLoadModels"); Collection col = CollectionHelper.getInstance().getCol(mContext); ArrayList<JSONObject> models = (ArrayList<JSONObject>) col.getModels().all(); ArrayList<Integer> cardCount = new ArrayList<Integer>(); Collections.sort(models, new Comparator<JSONObject>() { @Override public int compare(JSONObject a, JSONObject b) { try { return a.getString("name").compareTo(b.getString("name")); } catch (JSONException e) { throw new RuntimeException(e); } } }); for (JSONObject n : models) { try { long modID = n.getLong("id"); cardCount.add(col.getModels().nids(col.getModels().get(modID)).size()); <START> } catch (JSONException e) { <END> Timber.e("doInBackgroundLoadModels :: JSONException"); return new TaskData(false); } } Object[] data = new Object[2]; data[0] = models; data[1] = cardCount; return (new TaskData(0, data, true)); }</code><technical_language>I find repeatedly catching JSONExceptions distracting. easier follow if encase block of code a single try/catch instead of repeating (ultimately achieves here)</technical_language>

Target:
private TaskData doInBackgroundCountModels(TaskData... params){ Timber.d("doInBackgroundLoadModels"); Collection col = CollectionHelper.getInstance().getCol(mContext); ArrayList<JSONObject> models = (ArrayList<JSONObject>) col.getModels().all(); ArrayList<Integer> cardCount = new ArrayList<Integer>(); Collections.sort(models, new Comparator<JSONObject>() { @Override public int compare(JSONObject a, JSONObject b) { try { return a.getString("name").compareTo(b.getString("name")); } catch (JSONException e) { throw new RuntimeException(e); } } }); try{ for (JSONObject n : models) { long modID = n.getLong("id"); cardCount.add(col.getModels().nids(col.getModels().get(modID)).size()); } } catch (JSONException e) { Timber.e("doInBackgroundLoadModels :: JSONException"); return new TaskData(false); } Object[] data = new Object[2]; data[0] = models; data[1] = cardCount; return (new TaskData(0, data, true)); }
Source:
<code>public void applyInventory(InventoryEvent event) { String par = event.getMessage(); Player p = event.getPlayer(); Inventory i = p.getInventory(); if (par.equalsIgnoreCase(name)) { clearInv(p); ItemStack HEALTH_POTION = new ItemStack(Material.POTION, 1, (short) 16373); ItemStack STEAK = new ItemStack(Material.COOKED_BEEF, 1); ItemStack BOW = new ItemStack(Material.BOW, 1); ItemStack ARROWS = new ItemStack(Material.ARROW, 64); ItemStack STONEY_POOS = new ItemStack(Material.STONE, 64); ItemStack IRON_HELMET = new ItemStack(Material.IRON_HELMET, 1); ItemStack IRON_CHESTPLATE = new ItemStack(Material.IRON_CHESTPLATE, 1); ItemStack IRON_PANTS = new ItemStack(Material.IRON_LEGGINGS, 1); ItemStack IRON_BOOTS = new ItemStack(Material.IRON_BOOTS, 1); ItemStack IRON_SWORD = new ItemStack(Material.IRON_SWORD, 1); p.getInventory().setBoots(IRON_BOOTS); p.getInventory().setLeggings(IRON_PANTS); p.getInventory().setChestplate(IRON_CHESTPLATE); p.getInventory().setHelmet(IRON_HELMET); i.setItem(0, IRON_SWORD); i.setItem(1, BOW); i.setItem(2, STEAK); i.setItem(3, HEALTH_POTION); i.setItem(4, ARROWS); i.setItem(5, STONEY_POOS); <START> i.setItem(6, STONEY_POOS); <END> } }</code><technical_language>Update proper naming</technical_language>

Target:
public void applyInventory(InventoryEvent event) { String par = event.getMessage(); Player p = event.getPlayer(); Inventory i = p.getInventory(); if (par.equalsIgnoreCase(name)) { clearInv(p); ItemStack HEALTH_POTION = new ItemStack(Material.POTION, 1, (short) 16373); ItemStack STEAK = new ItemStack(Material.COOKED_BEEF, 1); ItemStack BOW = new ItemStack(Material.BOW, 1); ItemStack ARROWS = new ItemStack(Material.ARROW, 64); ItemStack STONE = new ItemStack(Material.STONE, 64); ItemStack IRON_HELMET = new ItemStack(Material.IRON_HELMET, 1); ItemStack IRON_CHESTPLATE = new ItemStack(Material.IRON_CHESTPLATE, 1); ItemStack IRON_PANTS = new ItemStack(Material.IRON_LEGGINGS, 1); ItemStack IRON_BOOTS = new ItemStack(Material.IRON_BOOTS, 1); ItemStack IRON_SWORD = new ItemStack(Material.IRON_SWORD, 1); p.getInventory().setBoots(IRON_BOOTS); p.getInventory().setLeggings(IRON_PANTS); p.getInventory().setChestplate(IRON_CHESTPLATE); p.getInventory().setHelmet(IRON_HELMET); i.setItem(0, IRON_SWORD); i.setItem(1, BOW); i.setItem(2, STEAK); i.setItem(3, HEALTH_POTION); i.setItem(4, ARROWS); i.setItem(5, STONE); i.setItem(6, STONE); } }
Source:
<code>public static String resolveFast(User u) { Mailer.UserProperty emailProperty = u.getProperty(Mailer.UserProperty.class); if (emailProperty != null && emailProperty.hasExplicitlyConfiguredAddress()) { String explicitAddress = emailProperty.getExplicitlyConfiguredAddress(); <START> if (explicitAddress != null) END> return explicitAddress; } String extractedAddress = extractAddressFromId(u.getFullName()); if (extractedAddress != null) return extractedAddress; if(u.getFullName().contains("@")) return u.getFullName(); String ds = Mailer.descriptor().getDefaultSuffix(); if(ds!=null) { Matcher m = WINDOWS_DOMAIN_REGEXP.matcher(u.getFullName()); if (m.matches() && u.getFullName().replace('\\','_').equals(u.getId())) return m.group(1)+ds; return u.getId()+ds; } return null; }</code><technical_language>call hasExplicitlyConfiguredAddress with</technical_language>

Target:
public static String resolveFast(User u) { String userPropertyAddress = extractAddressFromUserProperty(u); if (userPropertyAddress != null) { return userPropertyAddress; } String extractedAddress = extractAddressFromId(u.getFullName()); if (extractedAddress != null) return extractedAddress; if(u.getFullName().contains("@")) return u.getFullName(); String ds = Mailer.descriptor().getDefaultSuffix(); if(ds!=null) { Matcher m = WINDOWS_DOMAIN_REGEXP.matcher(u.getFullName()); if (m.matches() && u.getFullName().replace('\\','_').equals(u.getId())) return m.group(1)+ds; return u.getId()+ds; } return null; }
Source:
<code>public void testGeneIdsOrGeneNamesNonExisting() { List<FeatureCoordinates> featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_NON_EXISTING), Arrays.asList(GENE_NAME_NON_EXISITNG)); <START> assertTrue(featureCoordinates.size() == 0); <END> featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_NON_EXISTING), null); assertTrue(featureCoordinates.size() == 0); featureCoordinates = findByIdsOrNamesHelper(null, Arrays.asList(GENE_NAME_NON_EXISITNG)); assertTrue(featureCoordinates.size() == 0); }</code><technical_language>suggestion assertEquals(0, featureCoordinates.size());</technical_language>

Target:
public void testGeneIdsOrGeneNamesNonExisting() { List<FeatureCoordinates> featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_NON_EXISTING), Arrays.asList(GENE_NAME_NON_EXISITNG)); assertEquals(0, featureCoordinates.size()); featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_NON_EXISTING), null); assertEquals(0, featureCoordinates.size()); featureCoordinates = findByIdsOrNamesHelper(null, Arrays.asList(GENE_NAME_NON_EXISITNG)); assertEquals(0, featureCoordinates.size()); }
Source:
<code>public PatternScatterGraphView() { super(ID); <START> this.addPartPropertyListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(TmfXmlStrings.XML_LATENCY_OUTPUT_DATA)) { Object newValue = event.getNewValue(); if (newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); setPartName(fViewInfo.getLabel()); loadLatencyView(); <END> } } } }); }</code><technical_language>lambda</technical_language>

Target:
public PatternScatterGraphView() { super(ID); this.addPartPropertyListener(event -> { if (event.getProperty().equals(TmfXmlStrings.XML_LATENCY_OUTPUT_DATA)) { Object newValue = event.getNewValue(); if (newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); setPartName(fViewInfo.getLabel()); loadLatencyView(); } } }); }
Source:
<code>public JSONObject populateRunOptions(HttpSession session, JSONObject json) { Long sequencerReferenceId = json.getLong("sequencerReference"); String cId = json.getString("run_cId"); try { SequencerReference sr = requestManager.getSequencerReferenceById(sequencerReferenceId); PlatformType pt = sr.getPlatform().getPlatformType(); Map<String, Object> responseMap = new HashMap<>(); User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName()); <START> Run run = new RunImpl(user); <END> run.setSequencerReference(sr); session.setAttribute("run_" + cId, run); responseMap.put("partitions", getPlatformRunOptions(run)); return JSONUtils.JSONObjectResponse(responseMap); } catch (IOException e) { log.error("failed to get run options", e); return JSONUtils.SimpleJSONError("Failed to get Run options"); } }</code><technical_language>subclass</technical_language>

Target:
public JSONObject populateRunOptions(HttpSession session, JSONObject json) { Long sequencerReferenceId = json.getLong("sequencerReference"); String cId = json.getString("run_cId"); try { SequencerReference sr = requestManager.getSequencerReferenceById(sequencerReferenceId); PlatformType pt = sr.getPlatform().getPlatformType(); Map<String, Object> responseMap = new HashMap<>(); User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName()); Run run = new RunImpl(user); run.setPlatformType(pt); run.setSequencerReference(sr); session.setAttribute("run_" + cId, run); responseMap.put("partitions", getPlatformRunOptions(run)); return JSONUtils.JSONObjectResponse(responseMap); } catch (IOException e) { log.error("failed to get run options", e); return JSONUtils.SimpleJSONError("Failed to get Run options"); } }
Source:
<code>public Boolean add(Room room) throws Exception { if (getById(room.getId()).isPresent()) { return false; } try (var connection = getConnection(); var statement = connection.prepareStatement("INSERT INTO ROOMS VALUES (?,?,?,?)")) { statement.setInt(1, room.getId()); statement.setString(2, room.getRoomType()); statement.setInt(3, room.getPrice()); statement.setBoolean(4, room.isBooked()); statement.execute(); return true; <START> } catch (Exception ex) { throw new SqlException(ex.getMessage(), ex); <END> } }</code><technical_language>a bit suspicious. catching exception throwing SqlException? Is SqlException caught somewhere</technical_language>

Target:
public Boolean add(Room room) throws Exception { if (getById(room.getId()).isPresent()) { return false; } try (var connection = getConnection(); var statement = connection.prepareStatement("INSERT INTO ROOMS VALUES (?,?,?,?)")) { statement.setInt(1, room.getId()); statement.setString(2, room.getRoomType()); statement.setInt(3, room.getPrice()); statement.setBoolean(4, room.isBooked()); statement.execute(); return true; } catch (Exception e) { throw new Exception(e.getMessage(), e); } }
Source:
<code>public String asString() { final Map<String, Object> map = jsonBuilder.map(); map.put("rels", relList); AtomicInteger skipNormalize = null; if (getDetailLevel() != SqlExplainLevel.DIGEST_ATTRIBUTES) { skipNormalize = RexNode.DESCRIBE_WITHOUT_NORMALIZE.get(); skipNormalize.incrementAndGet(); } <START> try { <END> return jsonBuilder.toJsonString(map); } finally { if (skipNormalize != null) { skipNormalize.decrementAndGet(); } } }</code><technical_language>This wrapper appears in places, write a method encapsulate</technical_language>

Target:
public String asString() { final Map<String, Object> map = jsonBuilder.map(); map.put("rels", relList); try (RexNode.Closeable ignored = withRexNormalize()) { return jsonBuilder.toJsonString(map); } }
Source:
<code>private CompiledQuery sqlBackup(SqlExecutionContext executionContext) throws SqlException { final CharSequence tok = SqlUtil.fetchNext(lexer); if (null != tok) { <START> if (Chars.equalsLowerCaseAscii(tok, "table")) { <END> return sqlTableBackup(executionContext); } } throw SqlException.position(lexer.getPosition()).put(" expected 'table'"); }</code><technical_language>this replaced existing expectKeyword call. is a standard check in parser/compiler</technical_language>

Target:
private CompiledQuery sqlBackup(SqlExecutionContext executionContext) throws SqlException { if (null == configuration.getBackupRoot()) { throw CairoException.instance(0).put("Backup is disabled, no backup root directory is configured in the server configuration ['cairo.sql.backup.root' property]"); } final CharSequence tok = SqlUtil.fetchNext(lexer); if (null != tok) { if (Chars.equalsLowerCaseAscii(tok, "table")) { return sqlTableBackup(executionContext); } if (Chars.equalsLowerCaseAscii(tok, "database")) { return sqlDatabaseBackup(executionContext); } } throw SqlException.position(lexer.lastTokenPosition()).put(" expected 'table' or 'database'"); }
Source:
<code>public void testCannotDecodeIncompleteSequence() { List<Long> bytes = Arrays.asList(0xffL); <START> assertEquals(null, variableLengthQuantity.decode(bytes)); <END> }</code><technical_language>this is essentially error case I expect throw exception instead of returning null</technical_language>

Target:
public void testCannotDecodeIncompleteSequence() { List<Long> bytes = Arrays.asList(0xffL); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Invalid variable-length quantity encoding"); variableLengthQuantity.decode(bytes); }
Source:
<code>public void openSite_shouldShowAuditLog() { <START> tester.debugComponentTrees(); <END> tester.assertVisible("auditsContainer:audits"); tester.assertVisible("auditsContainer:audits:0:audit"); tester.assertVisible("auditsContainer:audits:1:audit"); int i = 0; for (Event event : domain.getAllAudits()) { tester.assertLabel("auditsContainer:audits:" + i + ":audit", event.getName()); i++; } }</code><technical_language>remove commit</technical_language>

Target:
public void openSite_shouldShowAuditLog() { tester.assertVisible("auditsContainer:audits"); tester.assertVisible("auditsContainer:audits:0:audit"); tester.assertVisible("auditsContainer:audits:1:audit"); int i = 0; for (Event event : domain.getAllAudits()) { tester.assertLabel("auditsContainer:audits:" + i + ":audit", event.getName()); i++; } }
Source:
<code>public static synchronized void logWarning(String message,Throwable ex) { <START> if (IntroPlugin.getDefault().isDebugging() && LOG_WARN) { <END> getDefault().getLog().warn(message, ex); } }</code><technical_language>LOG_WARN argument</technical_language>

Target:
public static synchronized void logWarning(String message,Throwable ex) { if (LOG_WARN && IntroPlugin.getDefault().isDebugging()) { getDefault().getLog().warn(message, ex); } }
Source:
<code>public String init() { String urlName = getWorkspaceUrlName(); if (StringUtils.isBlank(urlName)) { return NavigationRules.NOT_FOUND; } WorkspaceEntity workspaceEntity = workspaceController.findWorkspaceEntityByUrlName(urlName); if (workspaceEntity == null) { return NavigationRules.NOT_FOUND; } if (!sessionController.hasWorkspacePermission(MuikkuPermissions.MANAGE_WORKSPACE, workspaceEntity)) { return NavigationRules.ACCESS_DENIED; } <START> workspaceChatSettings = true; <END> workspaceEntityId = workspaceEntity.getId(); workspaceBackingBean.setWorkspaceUrlName(urlName); WorkspaceEntityFile customFrontImage = workspaceEntityFileController.findWorkspaceEntityFile(workspaceEntity, "workspace-frontpage-image-cropped"); hasCustomFrontPageImage = customFrontImage != null; customFrontPageImageUrl = hasCustomFrontPageImage ? String.format("/rest/workspace/workspaces/%d/workspacefile/workspace-frontpage-image-cropped", workspaceEntity.getId()) : null; return null; }</code><technical_language>this defined is saved in database instead of a constant</technical_language>

Target:
public String init() { String urlName = getWorkspaceUrlName(); if (StringUtils.isBlank(urlName)) { return NavigationRules.NOT_FOUND; } WorkspaceEntity workspaceEntity = workspaceController.findWorkspaceEntityByUrlName(urlName); if (workspaceEntity == null) { return NavigationRules.NOT_FOUND; } if (!sessionController.hasWorkspacePermission(MuikkuPermissions.MANAGE_WORKSPACE, workspaceEntity)) { return NavigationRules.ACCESS_DENIED; } SchoolDataIdentifier userIdentifier = sessionController.getLoggedUser(); UserChatSettings userChatSettings = chatController.findUserChatSettings(userIdentifier); if (userChatSettings != null && userChatSettings.getVisibility().equals(UserChatVisibility.VISIBLE_TO_ALL)) { workspaceChatSettings = true; } workspaceEntityId = workspaceEntity.getId(); workspaceBackingBean.setWorkspaceUrlName(urlName); WorkspaceEntityFile customFrontImage = workspaceEntityFileController.findWorkspaceEntityFile(workspaceEntity, "workspace-frontpage-image-cropped"); hasCustomFrontPageImage = customFrontImage != null; customFrontPageImageUrl = hasCustomFrontPageImage ? String.format("/rest/workspace/workspaces/%d/workspacefile/workspace-frontpage-image-cropped", workspaceEntity.getId()) : null; return null; }
Source:
<code>private long getExpiryTime(NHttpClientConnection connection) { long expiryTime = System.currentTimeMillis(); String keepAliveTimeout = (String) connection.getContext(). getAttribute(PassThroughConstants.CONNECTION_KEEP_ALIVE_TIME_OUT); <START> if (keepAliveTimeout != null) { <END> try { expiryTime = expiryTime + (Integer.parseInt(keepAliveTimeout) * 1000) - this.connectionGraceTime; } catch (NumberFormatException e) { log.error("Error parsing value " + keepAliveTimeout + " as connection keep-alive timeout.", e); expiryTime = expiryTime + this.connectionIdleTime; } } else { expiryTime = expiryTime + this.connectionIdleTime; } return expiryTime; }</code><technical_language>add a debug log for expiry time set</technical_language>

Target:
private long getExpiryTime(NHttpClientConnection connection) { long expiryTime = System.currentTimeMillis(); Object keepAlive = connection.getContext(). getAttribute(PassThroughConstants.CONNECTION_KEEP_ALIVE_TIME_OUT); if (keepAlive != null) { int keepAliveTimeout = (int) keepAlive; expiryTime = expiryTime + keepAliveTimeout - this.connectionGraceTime; } else { expiryTime = expiryTime + this.connectionIdleTime; } if (log.isDebugEnabled()) { log.debug("Expiry time set for connection: " + expiryTime + " milliseconds"); } return expiryTime; }
Source:
<code>protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupId())); if (!getParameters().isVmRunningOnSpm()) { <START> imagesHandler.prepareImage(getParameters().getStoragePoolId(), <END> getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), getParameters().getSpmId()); } ReduceImageVDSCommandParameters parameters = new ReduceImageVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), getParameters().isAllowActive()); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.ReduceImage, parameters); if (vdsReturnValue.getSucceeded()) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); getTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); setSucceeded(true); } }</code><technical_language>need handle failure (rollback, log, etc..)</technical_language>

Target:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupId())); boolean prepareImageSucceeded = false; if (!getParameters().isVmRunningOnSpm()) { log.debug("Preparing image on the SPM", getParameters().getImageId()); try { imagesHandler.prepareImage(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), getParameters().getSpmId()); prepareImageSucceeded = true; } catch (EngineException e) { log.error("Failed to prepare image on the SPM", getParameters().getImageId()); } } if (!getParameters().isVmRunningOnSpm() && !prepareImageSucceeded) { log.error("Image prepare failed on the SPM, hence reduce will not be performed"); return; } try { ReduceImageVDSCommandParameters parameters = new ReduceImageVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), getParameters().isAllowActive()); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.ReduceImage, parameters); if (vdsReturnValue.getSucceeded()) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); getTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); } } catch (EngineException e) { log.error("Reducing image failed", getParameters().getImageId()); } setSucceeded(true); }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getBricks() == null || getParameters().getBricks().size() == 0) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) { if (getParameters().getReplicaCount() > getGlusterVolume().getReplicaCount() + 1) { <START> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT_MORE_THAN_ONE); <END> } else if (getParameters().getReplicaCount() < getGlusterVolume().getReplicaCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT); } } else if (getGlusterVolume().getVolumeType() == GlusterVolumeType.STRIPE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_STRIPE) { if (getParameters().getStripeCount() > getGlusterVolume().getStripeCount() + 1) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_STRIPE_COUNT_MORE_THAN_ONE); } else if (getParameters().getStripeCount() < getGlusterVolume().getStripeCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_STRIPE_COUNT); } } return updateBrickServerNames(getParameters().getBricks(), true); }</code><technical_language>is return false</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getBricks() == null || getParameters().getBricks().size() == 0) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) { if (getParameters().getReplicaCount() > getGlusterVolume().getReplicaCount() + 1) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT_MORE_THAN_ONE); return false; } else if (getParameters().getReplicaCount() < getGlusterVolume().getReplicaCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT); return false; } } else if (getGlusterVolume().getVolumeType() == GlusterVolumeType.STRIPE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_STRIPE) { if (getParameters().getStripeCount() > getGlusterVolume().getStripeCount() + 1) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_STRIPE_COUNT_MORE_THAN_ONE); return false; } else if (getParameters().getStripeCount() < getGlusterVolume().getStripeCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_STRIPE_COUNT); return false; } } return updateBrickServerNames(getParameters().getBricks(), true); }
Source:
<code>public void enqueue(Callback<V> callback) { try { executor.execute(() -> { if (canceled) { return; } call = delegate.get(); AutoCloseable nameReverter = updateThreadName(call.toString()); try { ThrottledCallback<V> throttleCallback = new ThrottledCallback<>(callback, limitListener); call.enqueue(throttleCallback); throttleCallback.await(); } finally { try { <START> nameReverter.close(); <END> } catch (Exception e) { } } }); } catch (Exception e) { limitListener.onIgnore(); throw e; } }</code><technical_language>this is unnecessarily defensive rest of code base, distracting. ok reverting this normal close? Thread.setName existing name if break break other places</technical_language>

Target:
@Override public void enqueue(Callback<V> callback) { try { executor.execute(new QueuedCall(callback)); } catch (RuntimeException | Error e) { propagateIfFatal(e); limitListener.onIgnore(); throw e; } }
Source:
<code>public void resourceChanged(IResourceChangeEvent event) { if (fViewer.getInput() == null) { return; } IResourceDelta delta= event.getDelta(); if (delta == null) return; for (IResourceDelta <START> pDelta : <END> delta.getAffectedChildren(IResourceDelta.CHANGED)) { if ((pDelta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { IProject project= (IProject) pDelta.getResource(); if (needsRefiltering(project)) { final Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { ctrl.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (!ctrl.isDisposed()) fViewer.refresh(false); } }); } return; } } } }</code><technical_language>rename delta</technical_language>

Target:
public void resourceChanged(IResourceChangeEvent event) { if (fViewer.getInput() == null) { return; } IResourceDelta delta= event.getDelta(); if (delta == null) return; for (IResourceDelta deltachild : delta.getAffectedChildren(IResourceDelta.CHANGED)) { if ((deltachild.getFlags() & IResourceDelta.DESCRIPTION) != 0) { IProject project= (IProject) deltachild.getResource(); if (needsRefiltering(project)) { final Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { ctrl.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (!ctrl.isDisposed()) fViewer.refresh(false); } }); } return; } } } }
Source:
<code>public Map<String, String> getParameters() { Map<String, String> parameters = new HashMap<String, String>(); try { final String scopesAsString = getScopesAsString(); if (StringUtils.isNotBlank(clientId)) { parameters.put(AuthorizeRequestParam.CLIENT_ID, clientId); } if (StringUtils.isNotBlank(scopesAsString)) { parameters.put(AuthorizeRequestParam.SCOPE, scopesAsString); } for (String key : getCustomParameters().keySet()) { parameters.put(key, getCustomParameters().get(key)); } } catch (JSONException e) { <START> e.printStackTrace(); <END> } return parameters; }</code><technical_language>Log in logger, print in console</technical_language>

Target:
public Map<String, String> getParameters() { Map<String, String> parameters = new HashMap<String, String>(); try { final String scopesAsString = getScopesAsString(); if (StringUtils.isNotBlank(clientId)) { parameters.put(AuthorizeRequestParam.CLIENT_ID, clientId); } if (StringUtils.isNotBlank(scopesAsString)) { parameters.put(AuthorizeRequestParam.SCOPE, scopesAsString); } for (String key : getCustomParameters().keySet()) { parameters.put(key, getCustomParameters().get(key)); } } catch (JSONException e) { LOG.error(e.getMessage(), e); } return parameters; }
Source:
<code>public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); List<String> inputFields = new ArrayList<>(); List<String> outputFields = new ArrayList<>(); Schema inputSchema = context.getInputSchema(); if (SchemaValidator.validateSchemaIsNotNull(inputSchema, "input")) { inputFields = inputSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); } Schema outputSchema = context.getOutputSchema(); if (SchemaValidator.validateSchemaIsNotNull(outputSchema, "output")) { outputFields = outputSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); } <START> FieldOperation dataPrepOperation = new FieldTransformOperation("JavaScript", config.script, inputFields, <END> outputFields); context.record(Collections.singletonList(dataPrepOperation)); }</code><technical_language>script possibly long. I if enforce a maximum length (we done this wrangler well). include 30 lines something? @bdmogal do think</technical_language>

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); List<String> inputFields = new ArrayList<>(); List<String> outputFields = new ArrayList<>(); Schema inputSchema = context.getInputSchema(); if (SchemaValidator.canRecordLineage(inputSchema, "input")) { inputFields = inputSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); } Schema outputSchema = context.getOutputSchema(); if (SchemaValidator.canRecordLineage(outputSchema, "output")) { outputFields = outputSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); } FieldOperation dataPrepOperation = new FieldTransformOperation("JavaScript", config.script, inputFields, outputFields); context.record(Collections.singletonList(dataPrepOperation)); }
Source:
<code>public void addHost(final Host host) { logger.debug("Adding tracker for {}", host); HostLatencyTracker old = latencies.putIfAbsent(host, new HostLatencyTracker(scale, (30L * minMeasure) / 100L)); if (old == null && hostMetricsEnabled()) { String metricName = MetricsUtil.hostMetricName("LatencyAwarePolicy.latencies.", host); if (!metrics.getRegistry().getNames().contains(metricName)) { <START> logger.info("Adding gauge " + metricName); <END> metrics.getRegistry().register( metricName, new Gauge<Long>() { @Override public Long getValue() { TimestampedAverage latency = latencyTracker.latencyOf(host); return (latency == null) ? -1 : latency.average; } }); } } }</code><technical_language>Minor nit, this debug</technical_language>

Target:
public void addHost(final Host host) { logger.debug("Adding tracker for {}", host); HostLatencyTracker old = latencies.putIfAbsent(host, new HostLatencyTracker(scale, (30L * minMeasure) / 100L)); if (old == null && hostMetricsEnabled()) { String metricName = MetricsUtil.hostMetricName("LatencyAwarePolicy.latencies.", host); if (!metrics.getRegistry().getNames().contains(metricName)) { logger.debug("Adding gauge " + metricName); metrics.getRegistry().register( metricName, new Gauge<Long>() { @Override public Long getValue() { TimestampedAverage latency = latencyTracker.latencyOf(host); return (latency == null) ? -1 : latency.average; } }); } } }
Source:
<code>private ContainerCascadingMetaData(ValueExtractorManager valueExtractorManager, CascadingMetaDataBuilder cascadingMetaDataBuilder) { this( <START> cascadingMetaDataBuilder.getEnclosingType(), <END> cascadingMetaDataBuilder.getTypeParameter(), cascadingMetaDataBuilder.getDeclaredContainerClass(), cascadingMetaDataBuilder.getDeclaredTypeParameter(), cascadingMetaDataBuilder.getContainerElementTypesCascadingMetaData().entrySet().stream() .map( entry -> new ContainerCascadingMetaData( valueExtractorManager, entry.getValue() ) ) .collect( Collectors.collectingAndThen( Collectors.toList(), CollectionHelper::toImmutableList ) ), cascadingMetaDataBuilder.isCascading(), GroupConversionHelper.of( cascadingMetaDataBuilder.getGroupConversions() ), cascadingMetaDataBuilder.isMarkedForCascadingOnAnnotatedObjectOrContainerElements() ); }</code><technical_language>remove getValueExtractorCandidatesForCascadedValidation() ValueExtractorManager 2 private methods calls</technical_language>

Target:
private ContainerCascadingMetaData(ValueExtractorManager valueExtractorManager, CascadingMetaDataBuilder cascadingMetaDataBuilder) { this( valueExtractorManager, cascadingMetaDataBuilder.getEnclosingType(), cascadingMetaDataBuilder.getTypeParameter(), cascadingMetaDataBuilder.getDeclaredContainerClass(), cascadingMetaDataBuilder.getDeclaredTypeParameter(), cascadingMetaDataBuilder.getContainerElementTypesCascadingMetaData().entrySet().stream() .map( entry -> new ContainerCascadingMetaData( valueExtractorManager, entry.getValue() ) ) .collect( Collectors.collectingAndThen( Collectors.toList(), CollectionHelper::toImmutableList ) ), cascadingMetaDataBuilder.isCascading(), GroupConversionHelper.of( cascadingMetaDataBuilder.getGroupConversions() ), cascadingMetaDataBuilder.isMarkedForCascadingOnAnnotatedObjectOrContainerElements() ); }
Source:
<code>protected int checkCommon(long hash, boolean rejoining, VoltTable resultTables[], VoltMessage message) { if (!rejoining) { if (m_responseHash == null) { m_responseHash = Long.valueOf(hash); } else if (!m_responseHash.equals(hash)) { } m_lastResponse = message; m_lastResultTables = resultTables; } if (m_lastResponse == null) { m_lastResponse = message; m_lastResultTables = resultTables; } m_expectedHSIds.remove(message.m_sourceHSId); if (m_expectedHSIds.size() == 0) { <START> tmLog.info("satisfied"); <END> return DONE; } else { return WAITING; } }</code><technical_language>Debug log</technical_language>

Target:
protected int checkCommon(long hash, boolean rejoining, VoltTable resultTables[], VoltMessage message) { if (!rejoining) { if (m_responseHash == null) { m_responseHash = Long.valueOf(hash); } else if (!m_responseHash.equals(hash)) { tmLog.fatal("Stored procedure " + getStoredProcedureName() + " generated different SQL queries at different partitions." + " Shutting down to preserve data integrity."); String msg = String.format("HASH MISMATCH COMPARING: %d to %d\n" + "PREV MESSAGE: %s\n" + "CURR MESSAGE: %s\n", hash, m_responseHash, m_lastResponse.toString(), message.toString()); tmLog.error(msg); return MISMATCH; } m_lastResponse = message; m_lastResultTables = resultTables; } if (m_lastResponse == null) { m_lastResponse = message; m_lastResultTables = resultTables; } m_expectedHSIds.remove(message.m_sourceHSId); if (m_expectedHSIds.size() == 0) { return DONE; } else { return WAITING; } }
Source:
<code>private static void findComponentCyclesRecursion( Stack<String> stack, Map<String, Set<String>> edgesOut, Set<String> seen, List<List<String>> cycles) { if (stack.isEmpty()) { return; } String compId1 = stack.peek(); if (!edgesOut.containsKey(compId1) || edgesOut.get(compId1).isEmpty()) { stack.pop(); return; } Set<String> children = new HashSet<>(edgesOut.get(compId1)); for (String compId2: children) { if (seen.contains(compId2)) { List<String> cycle = new ArrayList<>(); if (compId1.equals(compId2)) { cycle.add(compId2); } else if (edgesOut.get(compId2).contains(compId1)) { cycle.addAll(Arrays.asList(compId1, compId2)); } else { List<String> tmp = Collections.list(stack.elements()); int prevIdx = tmp.indexOf(compId2); if (prevIdx >= 0) { <START> tmp.subList(prevIdx, tmp.size()); <END> } tmp.add(compId2); cycle.addAll(tmp); } cycles.add(cycle); edgesOut.get(compId1).remove(compId2); continue; } seen.add(compId2); stack.push(compId2); findComponentCyclesRecursion(stack, edgesOut, seen, cycles); } stack.pop(); }</code><technical_language>this needs tmp = tmp.subList(prevIdx, tmp.size()); result accurate</technical_language>

Target:
private static void findComponentCyclesRecursion( Stack<String> stack, Map<String, Set<String>> edgesOut, Set<String> seen, List<List<String>> cycles) { if (stack.isEmpty()) { return; } String compId1 = stack.peek(); if (!edgesOut.containsKey(compId1) || edgesOut.get(compId1).isEmpty()) { stack.pop(); return; } Set<String> children = new HashSet<>(edgesOut.get(compId1)); for (String compId2: children) { if (seen.contains(compId2)) { List<String> possibleCycle = new ArrayList<>(); if (compId1.equals(compId2)) { possibleCycle.add(compId2); } else if (edgesOut.get(compId2) != null && edgesOut.get(compId2).contains(compId1)) { possibleCycle.addAll(Arrays.asList(compId1, compId2)); } else { List<String> tmp = Collections.list(stack.elements()); int prevIdx = tmp.indexOf(compId2); if (prevIdx >= 0) { tmp = tmp.subList(prevIdx, tmp.size()); tmp.add(compId2); possibleCycle.addAll(tmp); } } if (!possibleCycle.isEmpty()) { cycles.add(possibleCycle); edgesOut.get(compId1).remove(compId2); continue; } } seen.add(compId2); stack.push(compId2); findComponentCyclesRecursion(stack, edgesOut, seen, cycles); } stack.pop(); }
Source:
<code>private List<Port> getAllInheritedPorts(org.eclipse.uml2.uml.Class aClass) { <START> ArrayList<Port> ports = new ArrayList<Port>(); <END> ports.addAll(aClass.getOwnedPorts()); for (org.eclipse.uml2.uml.Classifier parent : aClass.allParents()) { if (parent instanceof org.eclipse.uml2.uml.Class) { ports.addAll(getAllInheritedPorts((org.eclipse.uml2.uml.Class)parent)); } } return ports; }</code><technical_language>habit interfaces possible: List<Port> ports = new ArrayList<Port>();</technical_language>

Target:
private List<Port> getAllInheritedPorts(org.eclipse.uml2.uml.Class aClass) { List<Port> ports = new ArrayList<Port>(); ports.addAll(aClass.getOwnedPorts()); for (org.eclipse.uml2.uml.Classifier parent : aClass.allParents()) { if (parent instanceof org.eclipse.uml2.uml.Class) { ports.addAll(getAllInheritedPorts((org.eclipse.uml2.uml.Class)parent)); } } return ports; }
Source:
<code>private PageableResult searchStartsWith(RequestContext context, String codeOrName, List<ConceptSource> conceptSources){ Set<ConceptReferenceTerm> resultTerms = new LinkedHashSet<ConceptReferenceTerm>(); int count = 0; <START> if (codeOrName != null && StringUtils.isNotEmpty(codeOrName)) { <END> for (ConceptSource conceptSource : conceptSources) { resultTerms.addAll(conceptService.getConceptReferenceTerms(codeOrName, conceptSource, context.getStartIndex(), context.getLimit(), context.getIncludeAll())); count += conceptService.getCountOfConceptReferenceTerms(codeOrName, conceptSource, context.getIncludeAll()); } } else { for (ConceptSource conceptSource : conceptSources) { resultTerms.addAll(conceptService.getConceptReferenceTerms(null, conceptSource, context.getStartIndex(), context.getLimit(), context.getIncludeAll())); count += conceptService.getCountOfConceptReferenceTerms(null, conceptSource, context.getIncludeAll()); } } if (resultTerms.isEmpty()){ return new EmptySearchResult(); } else { boolean hasMore = count > (context.getStartIndex() + context.getLimit()); List<ConceptReferenceTerm> listResult = new ArrayList<ConceptReferenceTerm>(); listResult.addAll(resultTerms); return new AlreadyPaged<ConceptReferenceTerm>(context, listResult, hasMore); } }</code><technical_language>StringUtils.isNotEmpty check for codeOrName != null</technical_language>

Target:
private PageableResult searchStartsWith(RequestContext context, String codeOrName, List<ConceptSource> conceptSources){ Set<ConceptReferenceTerm> resultTerms = new LinkedHashSet<ConceptReferenceTerm>(); int count = 0; if (StringUtils.isNotEmpty(codeOrName)) { for (ConceptSource conceptSource : conceptSources) { resultTerms.addAll(conceptService.getConceptReferenceTerms(codeOrName, conceptSource, context.getStartIndex(), context.getLimit(), context.getIncludeAll())); count += conceptService.getCountOfConceptReferenceTerms(codeOrName, conceptSource, context.getIncludeAll()); } } else { for (ConceptSource conceptSource : conceptSources) { resultTerms.addAll(conceptService.getConceptReferenceTerms(null, conceptSource, context.getStartIndex(), context.getLimit(), context.getIncludeAll())); count += conceptService.getCountOfConceptReferenceTerms(null, conceptSource, context.getIncludeAll()); } } if (resultTerms.isEmpty()){ return new EmptySearchResult(); } else { boolean hasMore = count > (context.getStartIndex() + context.getLimit()); List<ConceptReferenceTerm> listResult = new ArrayList<ConceptReferenceTerm>(); listResult.addAll(resultTerms); return new AlreadyPaged<ConceptReferenceTerm>(context, listResult, hasMore); } }
Source:
<code>private JSONObject leadSectionPayload(Page page) { SparseArray<String> localizedStrings = localizedStrings(page); try { return new JSONObject() .put("sequence", currentSequenceNum) .put("title", page.getDisplayTitle()) .put("section", page.getSections().get(0).toJSON()) .put("string_page_similar_titles", localizedStrings.get(R.string.page_similar_titles)) .put("string_page_issues", localizedStrings.get(R.string.button_page_issues)) .put("string_table_infobox", localizedStrings.get(R.string.table_infobox)) .put("string_table_other", localizedStrings.get(R.string.table_other)) .put("string_table_close", localizedStrings.get(R.string.table_close)) .put("string_expand_refs", localizedStrings.get(R.string.expand_refs)) <START> .put("isBeta", app.getReleaseType() != RELEASE_PROD) <END> .put("siteLanguage", model.getTitle().getSite().getLanguageCode()) .put("isMainPage", page.isMainPage()) .put("apiLevel", Build.VERSION.SDK_INT); } catch (JSONException e) { throw new RuntimeException(e); } }</code><technical_language>fault moved constant, exposing isBeta() function instead? ReleaseUtil directly</technical_language>

Target:
private JSONObject leadSectionPayload(Page page) { SparseArray<String> localizedStrings = localizedStrings(page); try { return new JSONObject() .put("sequence", currentSequenceNum) .put("title", page.getDisplayTitle()) .put("section", page.getSections().get(0).toJSON()) .put("string_page_similar_titles", localizedStrings.get(R.string.page_similar_titles)) .put("string_page_issues", localizedStrings.get(R.string.button_page_issues)) .put("string_table_infobox", localizedStrings.get(R.string.table_infobox)) .put("string_table_other", localizedStrings.get(R.string.table_other)) .put("string_table_close", localizedStrings.get(R.string.table_close)) .put("string_expand_refs", localizedStrings.get(R.string.expand_refs)) .put("isBeta", app.isPreProdRelease()) .put("siteLanguage", model.getTitle().getSite().getLanguageCode()) .put("isMainPage", page.isMainPage()) .put("apiLevel", Build.VERSION.SDK_INT); } catch (JSONException e) { throw new RuntimeException(e); } }
Source:
<code>public void testApplication() throws Exception { try { LocalMode lma = LocalMode.newInstance(); lma.prepareDAG(new ThroughputBasedApplication(), getConfig()); LocalMode.Controller lc = lma.getController(); lc.runAsync(); while (!checkFilesCopied(numFiles)) { System.out.println("Waiting for files to get copied."); Thread.sleep(1000); } <START> verifyCopiedData(); <END> } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }</code><technical_language>lc.runAsync(); accompanied lc.shutDown()</technical_language>

Target:
public void testApplication() throws Exception { try { LocalMode lma = LocalMode.newInstance(); lma.prepareDAG(new ThroughputBasedApplication(), getConfig()); LocalMode.Controller lc = lma.getController(); lc.runAsync(); while (!checkFilesCopied(numFiles)) { System.out.println("Waiting for files to get copied."); Thread.sleep(1000); } lc.shutdown(); verifyCopiedData(); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }