auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void waitForLiveServerToReload(int timeout) { long start = System.currentTimeMillis(); ModelNode operation = new ModelNode(); operation.get(OP_ADDR).setEmptyList(); operation.get(OP).set(READ_ATTRIBUTE_OPERATION); operation.get(NAME).set("server-state"); while (System.currentTimeMillis() - start < timeout) { recreateClient(); ModelControllerClient liveClient = client.getControllerClient(); try { ModelNode result = liveClient.execute(operation); if ("running".equals(result.get(RESULT).asString())) { return; } } catch (IOException e) { } try { Thread.sleep(100); } catch (InterruptedException e) { } } fail("Live Server did not reload in the imparted time."); }

Target:
void waitForLiveServerToReload(int timeout) { long start = System.currentTimeMillis(); ModelNode operation = new ModelNode(); operation.get(OP_ADDR).setEmptyList(); operation.get(OP).set(READ_ATTRIBUTE_OPERATION); operation.get(NAME).set("server-state"); while (System.currentTimeMillis() - start < timeout) { recreateClient(); ModelControllerClient liveClient = client.getControllerClient(); try { ModelNode result = liveClient.execute(operation); if ("running".equals(result.get(RESULT).asString())) { return; } } catch (IOException e) { } try { Thread.sleep(100); } catch (InterruptedException e) { } } fail("Live Server did not reload in the imparted time."); }
Source:
public void init() { get( "/user", (req, res) -> { Subject subject = (Subject) SecurityUtils.getSubject(); res.type(APPLICATION_JSON); return getSubjectAttributes(subject); }, util::getJson); put( "/user/preferences", APPLICATION_JSON, (req, res) -> { Subject subject = (Subject) SecurityUtils.getSubject(); if (subject.isGuest()) { res.status(401); return ImmutableMap.of("message", "Guest cannot save preferences."); } Map<String, Object> preferences = GSON.fromJson(util.safeGetBody(req), MAP_STRING_TO_OBJECT_TYPE); if (preferences == null) { preferences = new HashMap<>(); } setUserPreferences(subject, preferences); return preferences; }, util::getJson); put( "/user/notifications", APPLICATION_JSON, (req, res) -> { Subject subject = (Subject) SecurityUtils.getSubject(); if (subject.isGuest()) { res.status(401); return ImmutableMap.of("message", "Guest cannot save notifications."); } Map<String, List<String>> notification = GSON.fromJson(util.safeGetBody(req), MAP_STRING_TO_OBJECT_TYPE); deleteNotifications(notification.get("alerts")); return ""; }, util::getJson); exception(EntityTooLargeException.class, util::handleEntityTooLargeException); exception(IOException.class, util::handleIOException); exception(RuntimeException.class, util::handleRuntimeException); }

Target:
public void init() { get( "/user", (req, res) -> { Subject subject = (Subject) SecurityUtils.getSubject(); res.type(APPLICATION_JSON); return getSubjectAttributes(subject); }, util::getJson); put( "/user/preferences", APPLICATION_JSON, (req, res) -> { Subject subject = (Subject) SecurityUtils.getSubject(); if (subject.isGuest()) { res.status(401); return ImmutableMap.of("message", "Guest cannot save preferences."); } Map<String, Object> preferences = GSON.fromJson(util.safeGetBody(req), MAP_STRING_TO_OBJECT_TYPE); if (preferences == null) { preferences = new HashMap<>(); } setUserPreferences(subject, preferences); return preferences; }, util::getJson); put( "/user/notifications", APPLICATION_JSON, (req, res) -> { Subject subject = (Subject) SecurityUtils.getSubject(); if (subject.isGuest()) { res.status(401); return ImmutableMap.of("message", "Guest cannot save notifications."); } Map<String, Object> notification = GSON.fromJson(util.safeGetBody(req), MAP_STRING_TO_OBJECT_TYPE); addUserNotification(subject, notification); return ""; }, util::getJson); delete( "/user/notifications", APPLICATION_JSON, (req, res) -> { Subject subject = (Subject) SecurityUtils.getSubject(); if (subject.isGuest()) { res.status(401); return ImmutableMap.of("message", "Guest cannot save notifications."); } Map<String, List<String>> notification = GSON.fromJson(util.safeGetBody(req), MAP_STRING_TO_OBJECT_TYPE); deleteNotifications(notification.get("alerts")); return ""; }, util::getJson); exception(EntityTooLargeException.class, util::handleEntityTooLargeException); exception(IOException.class, util::handleIOException); exception(RuntimeException.class, util::handleRuntimeException); }
Source:
public QueryResponse getFilesByStudy(@PathVariable("study") String study, @RequestParam("species") String species, HttpServletResponse response) throws UnknownHostException, IllegalOpenCGACredentialsException, IOException { initializeQueryOptions(); MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species)); QueryResult queryResult = Utils.buildQueryResult(variantSourceEntityRepository.findByStudyId(study)); if (queryResult.getResult().size() == 0) { queryResult = Utils.buildQueryResult(Collections.emptyList()); queryResult.setErrorMsg("Study identifier not found"); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setQueryResponse(queryResult); } VariantSourceEntity variantSourceEntity = (VariantSourceEntity) queryResult.getResult().get(0); QueryResult finalResult = Utils.buildQueryResult(variantSourceEntityRepository.findByStudyId(variantSourceEntity.getStudyId())); finalResult.setDbTime(finalResult.getDbTime() - queryResult.getDbTime()); return setQueryResponse(finalResult); }

Target:
public QueryResponse getFilesByStudy(@PathVariable("study") String study, @RequestParam("species") String species, HttpServletResponse response) throws UnknownHostException, IllegalOpenCGACredentialsException, IOException { initializeQueryOptions(); MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species)); List variantSourceEntityList = variantSourceEntityRepository.findByStudyIdOrStudyName(study, study); QueryResult queryResult; if (variantSourceEntityList.size() == 0) { queryResult = Utils.buildQueryResult(Collections.emptyList()); queryResult.setErrorMsg("Study identifier not found"); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setQueryResponse(queryResult); } queryResult = Utils.buildQueryResult(variantSourceEntityList); return setQueryResponse(queryResult); }
Source:
public void onBindViewHolder(final RvViewHolder holder, int position) { final int pos=position; holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { holder.onClick(v); selection[pos]=!selection[pos]; if(selection[pos]){ holder.cardView.setBackgroundColor(selectionColor); }else{ holder.cardView.setBackgroundColor(backgroundColor); } } }); if(layoutType==0){ String first =firstItem[position]; holder.textViewFirst.setText(first); }else if(layoutType==1){ String first =firstItem[position]; String second=secondItem[position]; holder.textViewFirst.setText(first); holder.textViewSecond.setText(second); }else if(layoutType==2){ String first =firstItem[position]; String second=secondItem[position]; holder.textViewFirst.setText(first); holder.textViewSecond.setText(second); }else if(layoutType==3){ String first =firstItem[position]; Drawable drawable = images.get(position); ViewUtil.setImage(holder.imageVieww, drawable); holder.textViewFirst.setText(first); } else if(layoutType==4){ String first =firstItem[position]; String second=secondItem[position]; Drawable drawable = images.get(position); ViewUtil.setImage(holder.imageVieww, drawable); holder.textViewFirst.setText(first); holder.textViewSecond.setText(second); } }

Target:
public void onBindViewHolder(final RvViewHolder holder, int position) { final int pos=position; holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { holder.onClick(v); selection[pos]=!selection[pos]; if(selection[pos]){ holder.cardView.setBackgroundColor(selectionColor); }else{ holder.cardView.setBackgroundColor(backgroundColor); } } }); if(layoutType==Component.LISTVIEW_LAYOUT_SINGLE_TEXT){ String first =firstItem[position]; holder.textViewFirst.setText(first); }else if(layoutType==Component.LISTVIEW_LAYOUT_TWO_TEXT){ String first =firstItem[position]; String second=secondItem[position]; holder.textViewFirst.setText(first); holder.textViewSecond.setText(second); }else if(layoutType==Component.LISTVIEW_LAYOUT_TWO_TEXT_LINEAR){ String first =firstItem[position]; String second=secondItem[position]; holder.textViewFirst.setText(first); holder.textViewSecond.setText(second); }else if(layoutType==Component.LISTVIEW_LAYOUT_IMAGE_SINGLE_TEXT){ String first =firstItem[position]; Drawable drawable = images.get(position); ViewUtil.setImage(holder.imageVieww, drawable); holder.textViewFirst.setText(first); } else if(layoutType==Component.LISTVIEW_LAYOUT_IMAGE_TWO_TEXT){ String first =firstItem[position]; String second=secondItem[position]; Drawable drawable = images.get(position); ViewUtil.setImage(holder.imageVieww, drawable); holder.textViewFirst.setText(first); holder.textViewSecond.setText(second); } }
Source:
public Object executeCommand(ExtendedExecuteCommandParams extendedExecuteCommandParams) { final Object[] result = new Object[1]; try { List<InitializedLanguageServer> servers = registry .getApplicableLanguageServers(extendedExecuteCommandParams.getFileUri()) .stream() .flatMap(Collection::stream) .collect(Collectors.toList()); OperationUtil.doInParallel( servers, new LSOperation<InitializedLanguageServer, Object>() { @Override public boolean canDo(InitializedLanguageServer element) { return element.getServer().getWorkspaceService() != null; } @Override public CompletableFuture<Object> start(InitializedLanguageServer element) { return element .getServer() .getWorkspaceService() .executeCommand(extendedExecuteCommandParams); } @Override public boolean handleResult(InitializedLanguageServer element, Object response) { result[0] = response; return true; } }, 10_000); return result[0]; } catch (LanguageServerException e) { LOG.error("error executing command", e); throw new JsonRpcException(-27000, e.getMessage()); } }

Target:
public Object executeCommand(ExtendedExecuteCommandParams extendedExecuteCommandParams) { final Object[] result = new Object[1]; try { List<InitializedLanguageServer> servers = registry .getApplicableLanguageServers(extendedExecuteCommandParams.getFileUri()) .stream() .flatMap(Collection::stream) .collect(Collectors.toList()); OperationUtil.doInSequence( servers, new LSOperation<InitializedLanguageServer, Object>() { @Override public boolean canDo(InitializedLanguageServer element) { return element.getServer().getWorkspaceService() != null; } @Override public CompletableFuture<Object> start(InitializedLanguageServer element) { return element .getServer() .getWorkspaceService() .executeCommand(extendedExecuteCommandParams); } @Override public boolean handleResult(InitializedLanguageServer element, Object response) { result[0] = response; return true; } }, 10_000); return result[0]; } catch (LanguageServerException e) { LOG.error("error executing command", e); throw new JsonRpcException(-27000, e.getMessage()); } }
Source:
public void setLastPullCursor(FormStatus fs, String cursor) { lastPullCursorsByFormId.put(fs.getFormId(), cursor); }

Target:
public void setLastPullCursor(FormStatus fs, String cursor) { lastPullCursorsByFormId.put(fs.getFormId(), cursor); triggerOnChange(); }
Source:
private static boolean isReturnTypeCompletelySubstituted(JavaType resultType, List<TypeVariableJavaType> typeVariables){ if(typeVariables.contains(resultType)) { return false; } if(resultType.isArray()) { return isReturnTypeCompletelySubstituted(((ArrayJavaType) resultType).elementType, typeVariables); } if(resultType instanceof WildCardType) { return isReturnTypeCompletelySubstituted(((WildCardType) resultType).bound, typeVariables); } if(resultType instanceof ParametrizedTypeJavaType) { for (JavaType substitutedType : ((ParametrizedTypeJavaType) resultType).typeSubstitution.substitutedTypes()) { if(!isReturnTypeCompletelySubstituted(substitutedType, typeVariables)) { return false; } } } return true; }

Target:
private static boolean isReturnTypeCompletelySubstituted(JavaType resultType, List<TypeVariableJavaType> typeVariables){ if(typeVariables.contains(resultType)) { return false; } if(resultType.isArray()) { return isReturnTypeCompletelySubstituted(((ArrayJavaType) resultType).elementType, typeVariables); } if(resultType.isTagged(JavaType.WILDCARD)) { return isReturnTypeCompletelySubstituted(((WildCardType) resultType).bound, typeVariables); } if(resultType instanceof ParametrizedTypeJavaType) { for (JavaType substitutedType : ((ParametrizedTypeJavaType) resultType).typeSubstitution.substitutedTypes()) { if(!isReturnTypeCompletelySubstituted(substitutedType, typeVariables)) { return false; } } } return true; }
Source:
public void processPacket(EntityPlayer player) { ItemStack book; if (hand == EnumHand.MAIN_HAND) { if (!(player.getHeldItemMainhand().getItem().getClass() == ItemGuideBook.class)) return; book = player.getHeldItemMainhand(); } else { if (!(player.getHeldItemOffhand().getItem().getClass() == ItemGuideBook.class)) return; book = player.getHeldItemOffhand(); } NBTTagCompound nbt = book.getTagCompound(); nbt.setFloat("sliderProgress", sliderProgress); nbt.setInteger("page", page); }

Target:
public void processPacket(EntityPlayer player) { ItemStack book; book = player.getHeldItem(hand); if (book.getItem() != LPItems.itemGuideBook) return; NBTTagCompound nbt = book.getTagCompound(); if(nbt == null) nbt = new NBTTagCompound(); nbt.setFloat("sliderProgress", sliderProgress); nbt.setInteger("page", page); book.setTagCompound(nbt); }
Source:
public Part findReplacement(boolean refit) { if (hasReplacementPart()) { return getReplacementPart(); } return campaign.streamSpareParts() .filter(MissingPart::isAvailableAsReplacement) .reduce(null, (bestPart, part) -> { if (isAcceptableReplacement(part, refit)) { if (bestPart == null) { return part; } else { int bestPartArmor = 0; int currentPartArmor = 0; int bestPartQuantity = 0; int currentPartQuantity = 0; for (Part p : bestPart.getChildParts()) { if (p instanceof BaArmor) { bestPartArmor = ((BaArmor)p).getAmount(); } else { bestPartQuantity++; } } for (Part p : part.getChildParts()) { if (p instanceof BaArmor) { currentPartArmor = ((BaArmor)p).getAmount(); } else { currentPartQuantity++; } } if (currentPartQuantity > bestPartQuantity) { return part; } else if (currentPartArmor > bestPartArmor) { return part; } } } return bestPart; }); }

Target:
public Part findReplacement(boolean refit) { if (hasReplacementPart()) { return getReplacementPart(); } return campaign.streamSpareParts() .filter(MissingPart::isAvailableAsReplacement) .reduce(null, (bestPart, part) -> { if (isAcceptableReplacement(part, refit)) { if (bestPart == null) { return part; } else { int bestPartArmor = 0; int currentPartArmor = 0; int bestPartQuantity = 0; int currentPartQuantity = 0; for (Part p : bestPart.getChildParts()) { if (p instanceof BaArmor) { bestPartArmor = ((BaArmor) p).getAmount(); } else { bestPartQuantity++; } } for (Part p : part.getChildParts()) { if (p instanceof BaArmor) { currentPartArmor = ((BaArmor) p).getAmount(); } else { currentPartQuantity++; } } if ((currentPartQuantity > bestPartQuantity) || (currentPartArmor > bestPartArmor)) { return part; } } } return bestPart; }); }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { LaunchConfiguration launchConfigurationRequest = (LaunchConfiguration) postParams.get("launchConfiguration"); Map<String, Object> launchConfigurationMap = Maps.newHashMap(); Map<String, Object> args = Maps.newHashMap(); launchConfigurationMap.put("args", args); launchConfigurationMap.put("type", launchConfigurationRequest.getType().toString()); args.put("loadBalancers", launchConfigurationRequest.getLoadBalancers()); Map<String, Object> server = Maps.newHashMap(); args.put("server", server); server.put("name", launchConfigurationRequest.getServerName()); server.put("imageRef", launchConfigurationRequest.getServerImageRef()); server.put("flavorRef", launchConfigurationRequest.getServerFlavorRef()); server.put("OS-DCF:diskConfig", launchConfigurationRequest.getServerDiskConfig()); server.put("metadata", launchConfigurationRequest.getServerMetadata()); List<Map<String, String>> networks = Lists.newArrayList(); server.put("networks", networks); for(String networkId : launchConfigurationRequest.getNetworks()) { Map<String, String> network = Maps.newHashMap(); network.put("uuid", networkId); networks.add(network); } server.put("personality", launchConfigurationRequest.getPersonalities()); return jsonBinder.bindToRequest(request, launchConfigurationMap); }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { return jsonBinder.bindToRequest(request, ParseHelper.buildLaunchConfigurationRequestMap(postParams)); }
Source:
private void assertFrames(byte[] source, final boolean expected) { InstrSupport.classReaderFor(source) .accept(new ClassVisitor(InstrSupport.ASM_API_VERSION) { @Override public MethodVisitor visitMethod(int access, String name, final String desc, String signature, String[] exceptions) { return new MethodVisitor(InstrSupport.ASM_API_VERSION) { boolean frames = false; @Override public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) { frames = true; } @Override public void visitEnd() { if (CondyProbeArrayStrategy.B_DESC .equals(desc)) { assertEquals(Boolean.FALSE, Boolean.valueOf(frames)); } else { assertEquals(Boolean.valueOf(expected), Boolean.valueOf(frames)); } } }; } }, 0); }

Target:
private void assertFrames(byte[] source, final boolean expected) { InstrSupport.classReaderFor(source) .accept(new ClassVisitor(InstrSupport.ASM_API_VERSION) { @Override public MethodVisitor visitMethod(int access, String name, final String desc, String signature, String[] exceptions) { return new MethodVisitor(InstrSupport.ASM_API_VERSION) { boolean frames = false; @Override public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) { frames = true; } @Override public void visitEnd() { if (CondyProbeArrayStrategy.B_DESC .equals(desc)) { assertFalse( "CondyProbeArrayStrategy does not need frames", frames); } else { assertEquals(Boolean.valueOf(expected), Boolean.valueOf(frames)); } } }; } }, 0); }
Source:
public CompactionManagerTest() throws InterruptedException { StoreConfig config = new StoreConfig(new VerifiableProperties(properties)); messageRetentionTimeInMs = config.storeDeletedMessageRetentionDays * Time.SecsPerDay * Time.MsPerSec; time.sleep(2 * messageRetentionTimeInMs); MetricRegistry metricRegistry = new MetricRegistry(); StorageManagerMetrics metrics = new StorageManagerMetrics(metricRegistry); blobStore = new MockBlobStore("", config, null, null, metrics, null, 0, null, null, null, time); blobStore.capacityInBytes = CAPACITY_IN_BYTES; blobStore.usedCapacity = CAPACITY_IN_BYTES * 6 / 10; blobStore.start(); compactionManager = new CompactionManager(config); }

Target:
public CompactionManagerTest() throws InterruptedException { config = new StoreConfig(new VerifiableProperties(properties)); messageRetentionTimeInMs = config.storeDeletedMessageRetentionDays * Time.SecsPerDay * Time.MsPerSec; time.sleep(2 * messageRetentionTimeInMs); MetricRegistry metricRegistry = new MetricRegistry(); StorageManagerMetrics metrics = new StorageManagerMetrics(metricRegistry); blobStore = new MockBlobStore(config, metrics, time, CAPACITY_IN_BYTES, DEFAULT_USED_CAPACITY_IN_BYTES); compactionManager = new CompactionManager(config, time); }
Source:
public void setContent(String newContent) { if (newContent == null) { this.content = ""; this.maskedContent = ""; } else { if (isPasswordHiden(newContent)) { if (contentChanged(newContent)) { String[] splitNewContent = splitbyPasswordTag(newContent); String[] splitContent = splitbyPasswordTag(content); this.content = splitNewContent[0] + splitContent[1] + splitNewContent[2]; this.maskedContent = hidePassword(content); } } else { this.content = newContent; this.maskedContent = hidePassword(content); } } }

Target:
public void setContent(String newContent) { if (newContent == null) { this.content = ""; this.maskedContent = ""; } else { if (PasswordTagUtil.isPasswordHidden(newContent)) { if (PasswordTagUtil.isContentChanged(newContent, maskedContent)) { String[] splitNewContent = PasswordTagUtil.splitByPasswordTag(newContent); String[] splitContent = PasswordTagUtil.splitByPasswordTag(content); if (splitContent != null) { this.content = splitNewContent[0] + splitContent[1] + splitNewContent[2]; } else { this.content = splitNewContent[0] + (PasswordTagUtil.TAG_PASSWORD_BEGIN + PasswordTagUtil.TAG_PASSWORD_END) + splitNewContent[2]; } this.maskedContent = PasswordTagUtil.hidePassword(content); } } else { this.content = newContent; this.maskedContent = PasswordTagUtil.hidePassword(content); } } }
Source:
public Reply<?> findById(@Named("id") String id) { Optional<RoamingGroup> group = repository.findById(id); if (!group.isPresent()) { return Reply.saying().notFound(); } RoamingGroupDTO dto = adapt(group.get()); return Reply.with(dto).as(Json.class); }

Target:
public Reply<?> findById(@Named("id") String id) { Optional<RoamingGroup> group = repository.findById(id); if (!group.isPresent()) { return Reply.saying().notFound(); } RoamingGroupDTO dto = adapt(group.get()); return Reply.with(dto).as(Json.class).ok(); }
Source:
public @ResponseBody String updateContext( @RequestParam(value = "context", required = true) int context, Model model, HttpSession session) { model.addAttribute("message", ""); model.addAttribute("errorMessage", ""); Member member = (Member) session.getAttribute("member"); if (member == null) return "redirect:denied"; if (context == member.getContext().ordinal()) { return null; } else if (context == UserType.PLAYER.ordinal()) { member.setContext(UserType.PLAYER); } else if (context == (int) UserType.OFFICIAL.ordinal() && MemberUtils.atLeastOfficial(member)) { member.setContext(UserType.OFFICIAL); } else if (context == (int) UserType.COORDINATOR.ordinal() && MemberUtils.atLeastCoordinator(member)) { member.setContext(UserType.COORDINATOR); } else if (context == (int) UserType.ADMIN.ordinal() && member.getUserType() == UserType.ADMIN) { member.setContext(UserType.ADMIN); } else { return "redirect:denied"; } MemberDao memberDao = new MemberDao(); memberDao.save(member); session.setAttribute("member", memberDao.getMemberById(member.getId())); return null; }

Target:
public @ResponseBody String updateContext( @RequestParam(value = "context", required = true) int context, Model model, HttpSession session) { model.addAttribute("message", ""); model.addAttribute("errorMessage", ""); Member member = (Member) session.getAttribute("member"); if (member == null) return "redirect:/denied"; if (context == member.getContext().ordinal()) { return null; } else if (context == UserType.PLAYER.ordinal()) { member.setContext(UserType.PLAYER); } else if (context == (int) UserType.OFFICIAL.ordinal() && MemberUtils.atLeastOfficial(member)) { member.setContext(UserType.OFFICIAL); } else if (context == (int) UserType.COORDINATOR.ordinal() && MemberUtils.atLeastCoordinator(member)) { member.setContext(UserType.COORDINATOR); } else if (context == (int) UserType.ADMIN.ordinal() && member.getUserType() == UserType.ADMIN) { member.setContext(UserType.ADMIN); } else { return "redirect:/denied"; } MemberDao memberDao = new MemberDao(); memberDao.save(member); session.setAttribute("member", memberDao.getMemberById(member.getId())); return null; }
Source:
public void testOrderWithDifferentPrefixes() throws Exception { String[] names = { "r-3", "r-2", "r-1", "w-2", "w-1" }; String[] expected = { "r-1", "r-2", "r-3" }; assertOrderedNodeNames(names, expected); }

Target:
public void testOrderWithDifferentPrefixes() throws Exception { String[] names = { "r-3", "r-2", "r-1", "w-2", "w-1" }; String[] expected = { "r-1", "w-1", "r-2", "w-2", "r-3" }; assertOrderedNodeNames(names, expected); }
Source:
public void sendSmsCommand(String phone, Command command) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException { if (Context.getSmppManager() != null) { if (command.getType().equals(Command.TYPE_CUSTOM)) { Context.getSmppManager().sendMessageSync(phone, command.getString(Command.KEY_DATA), true); } else if (supportedSmsCommands.contains(command.getType()) && smsEncoder != null) { Context.getSmppManager().sendMessageSync(phone, (String) smsEncoder.encodeCommand(command), true); } else { throw new RuntimeException( "Command " + command.getType() + " is not supported in protocol " + getName()); } } else { throw new RuntimeException("Smpp client is not enabled"); } }

Target:
public void sendSmsCommand(String phone, Command command) throws Exception { if (Context.getSmppManager() != null) { if (command.getType().equals(Command.TYPE_CUSTOM)) { Context.getSmppManager().sendMessageSync(phone, command.getString(Command.KEY_DATA), true); } else if (supportedSmsCommands.contains(command.getType()) && smsEncoder != null) { Context.getSmppManager().sendMessageSync(phone, (String) smsEncoder.encodeCommand(command), true); } else { throw new RuntimeException( "Command " + command.getType() + " is not supported in protocol " + getName()); } } else { throw new RuntimeException("SMPP client is not enabled"); } }
Source:
public void testConvertToDataModelTypeNullIds() { mongoVariant.remove(uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter.IDS_FIELD); uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter converter = new uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter(); Variant converted = converter.convert(mongoVariant); assertNotNull(converted.getIds()); assertTrue(converted.getIds().isEmpty()); variant.setIds(new HashSet<String>()); assertEquals(variant, converted); }

Target:
public void testConvertToDataModelTypeNullIds() { mongoVariant.remove(DBObjectToVariantConverter.IDS_FIELD); DBObjectToVariantConverter converter = new DBObjectToVariantConverter(); Variant converted = converter.convert(mongoVariant); assertNotNull(converted.getIds()); assertTrue(converted.getIds().isEmpty()); variant.setIds(new HashSet<String>()); assertEquals(variant, converted); }
Source:
private static void addIteratorWorkerDirect( Graph graph, Iterator<Triple> it ) { if ( OldStyle && graph instanceof GraphWithPerform ) { GraphWithPerform g = (GraphWithPerform)graph; while (it.hasNext()) g.performAdd(it.next()); } else { while (it.hasNext()) graph.add(it.next()); } }

Target:
private static void addIteratorWorkerDirect( Graph graph, Iterator<Triple> it ) { if ( OldStyle && graph instanceof GraphWithPerform ) { GraphWithPerform g = (GraphWithPerform)graph; it.forEachRemaining(g::performAdd); } else { it.forEachRemaining(graph::add); } }
Source:
private boolean isExcludedPath(URI uri) { Pattern excludedPattern = errorProneOptions.getExcludedPattern(); return (excludedPattern != null) && excludedPattern.matcher(uri.toString()).matches(); }

Target:
private boolean isExcludedPath(URI uri) { Pattern excludedPattern = errorProneOptions.getExcludedPattern(); return (excludedPattern != null) && excludedPattern.matcher(ASTHelpers.getFileNameFromUri(uri)).matches(); }
Source:
protected String contentFrom(FitNesseContext context, Request request, WikiPage requestedPage) { requestData= request; return prepareResponseDocument(context).html(); }

Target:
protected String contentFrom(FitNesseContext context, Request request, WikiPage requestedPage) { return prepareResponseDocument(context).html(request); }
Source:
boolean prepare(boolean markManaged, boolean canCreate) throws InfrastructureException { KubernetesClient client = clientFactory.create(workspaceId); Namespace namespace = get(name, client); if (namespace == null) { if (!canCreate) { throw new InfrastructureException( format("Creating the namespace '%s' is not allowed, yet" + " it was not found.", name)); } create(name, client, markManaged); return true; } if (markManaged && !isLabeled(namespace, "che-managed", "true")) { KubernetesObjectUtil.putLabel(namespace, "che-managed", "true"); update(namespace, client); } return false; }

Target:
void prepare(boolean markManaged, boolean canCreate) throws InfrastructureException { KubernetesClient client = clientFactory.create(workspaceId); Namespace namespace = get(name, client); if (namespace == null) { if (!canCreate) { throw new InfrastructureException( format("Creating the namespace '%s' is not allowed, yet it was not found.", name)); } namespace = create(name, client); } if (markManaged && !isLabeled(namespace, MANAGED_NAMESPACE_LABEL, "true")) { KubernetesObjectUtil.putLabel(namespace, MANAGED_NAMESPACE_LABEL, "true"); update(namespace, client); } }
Source:
private void updateMapping(String reviewUrl, String reviewDescription) { String oldTaskUrl = getTaskUrl(reviewUrl); String newTaskUrl = this.extractTaskUrl(reviewDescription); if (newTaskUrl == null && oldTaskUrl != null) { taskReviewsMap.get(oldTaskUrl).remove(reviewUrl); } else if (newTaskUrl != null) { taskReviewsMap.put(newTaskUrl, reviewUrl); if (oldTaskUrl != null) { taskReviewsMap.remove(oldTaskUrl, reviewUrl); } } }

Target:
private void updateMapping(String reviewUrl, String reviewDescription) { String oldTaskUrl = getTaskUrl(reviewUrl); String newTaskUrl = this.extractTaskUrl(reviewDescription); if (newTaskUrl == null && oldTaskUrl != null) { taskReviewsMap.remove(oldTaskUrl, reviewUrl); } else if (newTaskUrl != null) { if (oldTaskUrl != null && !oldTaskUrl.equals(newTaskUrl)) { taskReviewsMap.remove(oldTaskUrl, reviewUrl); } if (newTaskUrl != null) { taskReviewsMap.put(newTaskUrl, reviewUrl); } } }
Source:
private boolean initQcowCompat(Guid storagePoolId, Guid storageDomainId, Guid diskId, Guid volumeId, DiskImage newDiskImage) { if (newDiskImage.getVolumeFormat().equals(VolumeFormat.COW)) { StoragePool sp = storagePoolDao.get(storagePoolId); QemuImageInfo qemuImageInfo = null; if (sp != null && FeatureSupported.qcowCompatSupported(sp.getCompatibilityVersion())) { qemuImageInfo = ImagesHandler.getQemuImageInfoFromVdsm(storagePoolId, storageDomainId, diskId, volumeId, null, false); } if (qemuImageInfo == null) { getQueryReturnValue().setExceptionString("Failed to fetch qemu image info from storage"); return false; } newDiskImage.setQcowCompat(qemuImageInfo.getQcowCompat()); } return true; }

Target:
private boolean initQcowCompat(Guid storagePoolId, Guid storageDomainId, Guid diskId, Guid volumeId, DiskImage newDiskImage) { if (newDiskImage.getVolumeFormat().equals(VolumeFormat.COW)) { StoragePool sp = storagePoolDao.get(storagePoolId); QemuImageInfo qemuImageInfo = null; if (sp != null && FeatureSupported.qcowCompatSupported(sp.getCompatibilityVersion())) { qemuImageInfo = ImagesHandler.getQemuImageInfoFromVdsm(storagePoolId, storageDomainId, diskId, volumeId, null, true); if (qemuImageInfo == null) { getQueryReturnValue().setExceptionString("Failed to fetch qemu image info from storage"); return false; } newDiskImage.setQcowCompat(qemuImageInfo.getQcowCompat()); } } return true; }
Source:
boolean nextImpl() { row = null; if (result != null && result.next()) { int columnCount = result.getVisibleColumnCount(); Value[] currentRow = result.currentRow(); values = new Value[columnCount]; System.arraycopy(currentRow, 0, values, 0, columnCount); } else { values = null; } return values != null; }

Target:
boolean nextImpl() { row = null; if (result != null && result.next()) { int columnCount = result.getVisibleColumnCount(); Value[] currentRow = result.currentRow(); values = Arrays.copyOf(currentRow, columnCount); } else { values = null; } return values != null; }
Source:
public SwitchToBroker canSwitchToBroker() { final String packageName = mContext.getPackageName(); boolean switchToBrokerFlag = AuthenticationSettings.INSTANCE.getUseBroker() && checkAccount(mAcctManager, "", "") && !packageName.equalsIgnoreCase(AuthenticationSettings.INSTANCE.getBrokerPackageName()) && !packageName.equalsIgnoreCase(AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME) && verifyAuthenticator(mAcctManager); if (!switchToBrokerFlag) { return SwitchToBroker.CANNOT_SWITCH_TO_BROKER; } else { try { verifyBrokerPermissionsAPI23AndHigher(); } catch (final UsageAuthenticationException exception) { return SwitchToBroker.NEED_PERMISSIONS_TO_SWITCH_TO_BROKER; } return SwitchToBroker.CAN_SWITCH_TO_BROKER; } }

Target:
public SwitchToBroker canSwitchToBroker() { final String packageName = mContext.getPackageName(); boolean switchToBrokerFlag = AuthenticationSettings.INSTANCE.getUseBroker() && checkAccount(mAcctManager, "", "") && !packageName.equalsIgnoreCase(AuthenticationSettings.INSTANCE.getBrokerPackageName()) && !packageName.equalsIgnoreCase(AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME) && verifyAuthenticator(mAcctManager); if (!switchToBrokerFlag) { return SwitchToBroker.CANNOT_SWITCH_TO_BROKER; } try { verifyBrokerPermissionsAPI23AndHigher(); } catch (final UsageAuthenticationException exception) { return SwitchToBroker.NEED_PERMISSIONS_TO_SWITCH_TO_BROKER; } return SwitchToBroker.CAN_SWITCH_TO_BROKER; }
Source:
private Set<IArtifactType> getAllArtTypes() { Set<IArtifactType> allArtTypes = new HashSet<>(); if (artifactTypes == null || !artifactTypes.isEmpty()) { allArtTypes.addAll(artifactTypes); } else { getArtifactTypesFromWorkItemTypes(); } return allArtTypes; }

Target:
private Set<IArtifactType> getAllArtTypes() { Set<IArtifactType> allArtTypes = new HashSet<>(); if (artifactTypes != null || !artifactTypes.isEmpty()) { allArtTypes.addAll(artifactTypes); } else { allArtTypes = getArtifactTypesFromWorkItemTypes(); } return allArtTypes; }
Source:
public void testCompute() throws Exception { String testTaskName = "testTask"; int executions = 5; startCollectStatistics(); IgniteRunnable task = new IgniteRunnable() { @Override public void run() { } }; for (int i = 0; i < executions; i++) ignite.compute().withName(testTaskName).run(task); HashMap<IgniteUuid, Integer> sessions = new HashMap<>(); AtomicInteger tasks = new AtomicInteger(); AtomicInteger jobs = new AtomicInteger(); stopCollectStatisticsAndRead(new TestHandler() { @Override public void task(UUID nodeId, IgniteUuid sesId, String taskName, long startTime, long duration, int affPartId) { sessions.compute(sesId, (uuid, val) -> val == null ? 1 : ++val); tasks.incrementAndGet(); assertEquals(ignite.context().localNodeId(), nodeId); assertEquals(testTaskName, taskName); assertTrue(startTime > 0); assertTrue(duration >= 0); assertEquals(-1, affPartId); } @Override public void job(UUID nodeId, IgniteUuid sesId, long queuedTime, long startTime, long duration, boolean timedOut) { sessions.compute(sesId, (uuid, val) -> val == null ? 1 : ++val); jobs.incrementAndGet(); assertEquals(ignite.context().localNodeId(), nodeId); assertTrue(queuedTime >= 0); assertTrue(startTime > 0); assertTrue(duration >= 0); assertFalse(timedOut); } }); assertEquals(executions, tasks.get()); assertEquals(executions, jobs.get()); Collection<Integer> vals = sessions.values(); assertEquals(executions, vals.size()); assertTrue("Invalid sessions: " + sessions, vals.stream().allMatch(val -> val == 2)); }

Target:
public void testCompute() throws Exception { String testTaskName = "testTask"; int executions = 5; long startTime = U.currentTimeMillis(); startCollectStatistics(); IgniteRunnable task = new IgniteRunnable() { @Override public void run() { } }; for (int i = 0; i < executions; i++) node.compute().withName(testTaskName).run(task); HashMap<IgniteUuid, Integer> sessions = new HashMap<>(); AtomicInteger tasks = new AtomicInteger(); AtomicInteger jobs = new AtomicInteger(); stopCollectStatisticsAndRead(new TestHandler() { @Override public void task(UUID nodeId, IgniteUuid sesId, String taskName, long taskStartTime, long duration, int affPartId) { sessions.compute(sesId, (uuid, cnt) -> cnt == null ? 1 : ++cnt); tasks.incrementAndGet(); assertEquals(node.context().localNodeId(), nodeId); assertEquals(testTaskName, taskName); assertTrue(taskStartTime >= startTime); assertTrue(duration >= 0); assertEquals(-1, affPartId); } @Override public void job(UUID nodeId, IgniteUuid sesId, long queuedTime, long jobStartTime, long duration, boolean timedOut) { sessions.compute(sesId, (uuid, cnt) -> cnt == null ? 1 : ++cnt); jobs.incrementAndGet(); assertEquals(srv.context().localNodeId(), nodeId); assertTrue(queuedTime >= 0); assertTrue(jobStartTime >= startTime); assertTrue(duration >= 0); assertFalse(timedOut); } }); assertEquals(executions, tasks.get()); assertEquals(executions, jobs.get()); Collection<Integer> vals = sessions.values(); assertEquals(executions, vals.size()); assertTrue("Invalid sessions: " + sessions, vals.stream().allMatch(cnt -> cnt == NODES_CNT)); }
Source:
private int getSelectionValue(long time) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID); if (ssq == null) { continue; } if (time >= ssq.getStartTime() && time <= ssq.getCurrentEndTime()) { List<Integer> currentThreadQuarks = ssq.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); for (int currentThreadQuark : currentThreadQuarks) { try { ITmfStateInterval currentThreadInterval = ssq.querySingleState(time, currentThreadQuark); int currentThread = currentThreadInterval.getStateValue().unboxInt(); if (currentThread > 0) { int statusQuark = ssq.optQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThread)); if (statusQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { continue; } ITmfStateInterval statusInterval = ssq.querySingleState(time, statusQuark); if (statusInterval.getStartTime() == time) { return currentThread; } } } catch (TimeRangeException | StateValueTypeException e) { Activator.getDefault().logError(e.getMessage()); } catch (StateSystemDisposedException e) { } } } } return -1; }

Target:
private int getSelectionValue(long time) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID); if (ssq == null) { continue; } if (time >= ssq.getStartTime() && time <= ssq.getCurrentEndTime()) { List<Integer> currentThreadQuarks = ssq.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); for (int currentThreadQuark : currentThreadQuarks) { try { ITmfStateInterval currentThreadInterval = ssq.querySingleState(time, currentThreadQuark); int currentThread = currentThreadInterval.getStateValue().unboxInt(); if (currentThread > 0) { int statusQuark = ssq.optQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThread)); if (statusQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { continue; } ITmfStateInterval statusInterval = ssq.querySingleState(time, statusQuark); if (statusInterval.getStartTime() == time) { return currentThread; } } } catch (TimeRangeException | StateValueTypeException e) { Activator.getDefault().logError(e.getMessage()); } catch (StateSystemDisposedException e) { } } } } return NO_THREAD_FOUND; }
Source:
public MachineSet ensureExists(int count, ReusableMachineTemplate template) { MachineSet current; synchronized (this) { current = all(matching(template)); } if (current.size() >= count) return current; MachineSet moreNeeded = create(count-current.size(), template); return current.added(moreNeeded); }

Target:
public MachineSet ensureExists(int count, ReusableMachineTemplate template) { MachineSet current; current = all(matching(template)); if (current.size() >= count) return current; MachineSet moreNeeded = create(count-current.size(), template); return current.added(moreNeeded); }
Source:
public JsonObject findDocument(String query, String sort) throws DataException { SearchRestClient restClient = initiateRestClient(); String response = restClient.getDocument(query, sort, 0, 1); JsonReader jsonReader = Json.createReader(new StringReader(response)); JsonObject jsonObject = jsonReader.readObject(); if (jsonObject.containsKey("hits")) { JsonObject hits = jsonObject.getJsonObject("hits"); JsonArray inHits = hits.getJsonArray("hits"); if (!inHits.isEmpty()) { return inHits.getJsonObject(0); } } else { return jsonObject; } return Json.createObjectBuilder().build(); }

Target:
public JsonObject findDocument(String query, String sort) throws DataException { SearchRestClient restClient = initiateRestClient(); String response = restClient.getDocument(query, sort, 0, 1); try (JsonReader jsonReader = Json.createReader(new StringReader(response))) { JsonObject jsonObject = jsonReader.readObject(); if (jsonObject.containsKey("hits")) { JsonObject hits = jsonObject.getJsonObject("hits"); JsonArray inHits = hits.getJsonArray("hits"); if (!inHits.isEmpty()) { return inHits.getJsonObject(0); } } else { return jsonObject; } } return Json.createObjectBuilder().build(); }
Source:
public void createBeans(Environment environment) { getBeanManager().getServices().get(WeldModules.class).preBeanRegistration(this, environment); if (getBeanManager().getServices().get(EjbSupport.class) == EjbSupport.NOOP_IMPLEMENTATION) { beanDeployer.addBuiltInBean(new InjectionPointBean(beanManager)); } beanDeployer.addBuiltInBean(new EventMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new EventBean(beanManager)); beanDeployer.addBuiltInBean(new InstanceBean(beanManager)); beanDeployer.addBuiltInBean(new ConversationBean(beanManager)); beanDeployer.addBuiltInBean(new BeanMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new InterceptedBeanMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new DecoratedBeanMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new InterceptorMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new DecoratorMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new InterceptionFactoryBean(beanManager)); if (beanManager.getServices().getRequired(SecurityServices.class) != NoopSecurityServices.INSTANCE) { beanDeployer.addBuiltInBean(new PrincipalBean(beanManager)); } for (ContextHolder<? extends Context> context : contexts) { beanDeployer.addBuiltInBean(ContextBean.of(context, beanManager)); } beanDeployer.addBuiltInBean(new RequestContextControllerBean(beanManager)); if (beanDeploymentArchive.getBeansXml() != null) { if (beanDeploymentArchive.getBeansXml().isTrimmed()) { beanDeployer.getEnvironment().trim(); } } beanDeployer.createClassBeans(); }

Target:
public void createBeans(Environment environment) { getBeanManager().getServices().get(WeldModules.class).preBeanRegistration(this, environment); if (getBeanManager().getServices().get(EjbSupport.class) == EjbSupport.NOOP_IMPLEMENTATION) { beanDeployer.addBuiltInBean(new InjectionPointBean(beanManager)); } beanDeployer.addBuiltInBean(new EventMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new EventBean(beanManager)); beanDeployer.addBuiltInBean(new InstanceBean(beanManager)); beanDeployer.addBuiltInBean(new ConversationBean(beanManager)); beanDeployer.addBuiltInBean(new BeanMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new InterceptedBeanMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new DecoratedBeanMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new InterceptorMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new DecoratorMetadataBean(beanManager)); beanDeployer.addBuiltInBean(new InterceptionFactoryBean(beanManager)); if (beanManager.getServices().getRequired(SecurityServices.class) != NoopSecurityServices.INSTANCE) { beanDeployer.addBuiltInBean(new PrincipalBean(beanManager)); } for (ContextHolder<? extends Context> context : contexts) { beanDeployer.addBuiltInBean(ContextBean.of(context, beanManager)); } beanDeployer.addBuiltInBean(new RequestContextControllerBean(beanManager)); if (beanDeploymentArchive.getBeansXml() != null && beanDeploymentArchive.getBeansXml().isTrimmed()) { beanDeployer.getEnvironment().trim(); } beanDeployer.createClassBeans(); }
Source:
public Optional<Joinable> build(final DataSource dataSource, final JoinConditionAnalysis condition) { if (condition.canHashJoin() && dataSource instanceof InlineDataSource) { final InlineDataSource inlineDataSource = (InlineDataSource) dataSource; final List<String> rightKeyColumns = condition.getRightKeyColumns(); return Optional.of( new IndexedTableJoinable( new RowBasedIndexedTable<>( inlineDataSource.getRowsAsList(), inlineDataSource.rowAdapter(), inlineDataSource.getRowSignature(), rightKeyColumns ) ) ); } else { return Optional.empty(); } }

Target:
public Optional<Joinable> build(final DataSource dataSource, final JoinConditionAnalysis condition) { if (condition.canHashJoin() && dataSource instanceof InlineDataSource) { final InlineDataSource inlineDataSource = (InlineDataSource) dataSource; final Set<String> rightKeyColumns = condition.getRightEquiConditionKeys(); return Optional.of( new IndexedTableJoinable( new RowBasedIndexedTable<>( inlineDataSource.getRowsAsList(), inlineDataSource.rowAdapter(), inlineDataSource.getRowSignature(), rightKeyColumns ) ) ); } else { return Optional.empty(); } }
Source:
public static String autoPreciseConvert(long size, SizeUnit inUnit) { String convertedSize = ""; while(size > 1024) { Pair<SizeUnit, Double> result = SizeConverter.autoConvert(size, inUnit); convertedSize = convertedSize.concat(result.getSecond().intValue() + " " + result.getFirst().toString() + " "); long reminder = size - SizeConverter.convert(result.getSecond().longValue(), result.getFirst(), inUnit).longValue(); size = reminder; } convertedSize = convertedSize.concat((((convertedSize != "") && (size > 0)) || ((convertedSize == "") && (size == 0))) ? (size + " " + inUnit) : ""); return convertedSize; }

Target:
public static String autoPreciseConvert(long size, SizeUnit inUnit) { String convertedSize = ""; while(size > 1024) { Pair<SizeUnit, Double> result = SizeConverter.autoConvert(size, inUnit); convertedSize = convertedSize.concat(result.getSecond().intValue() + " " + result.getFirst().toString() + " "); long remainder = size - SizeConverter.convert(result.getSecond().longValue(), result.getFirst(), inUnit).longValue(); size = remainder; } convertedSize = convertedSize.concat((((convertedSize != "") && (size > 0)) || ((convertedSize == "") && (size == 0))) ? (size + " " + inUnit) : ""); return convertedSize; }
Source:
public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.DREW_CARD) { amountOfCardsDrawnThisTurn.putIfAbsent(event.getPlayerId(), 0); amountOfCardsDrawnThisTurn.compute(event.getPlayerId(), (k, amount) -> amount += 1); } }

Target:
public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.DREW_CARD) { amountOfCardsDrawnThisTurn.putIfAbsent(event.getPlayerId(), 0); amountOfCardsDrawnThisTurn.compute(event.getPlayerId(), (k, amount) -> amount + 1); } }