auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void connectServiceUpIsRunning() { <START> <END> HostAndPort hp = BrooklynAccessUtils.getBrooklynAccessibleAddress(this, getAttribute(CouchbaseSyncGateway.ADMIN_REST_API_PORT)); String managementUri = String.format("http://%s:%s", hp.getHostText(), hp.getPort()); setAttribute(MANAGEMENT_URL, managementUri); httpFeed = HttpFeed.builder() .entity(this) .period(200) .baseUri(managementUri) .poll(new HttpPollConfig<Boolean>(SERVICE_UP) .onSuccess(HttpValueFunctions.responseCodeEquals(200))) .build(); }</code><technical_language>Delete blank lines</technical_language>

Target:
protected void connectServiceUpIsRunning() { HostAndPort hp = BrooklynAccessUtils.getBrooklynAccessibleAddress(this, getAttribute(CouchbaseSyncGateway.ADMIN_REST_API_PORT)); String managementUri = String.format("http://%s:%s", hp.getHostText(), hp.getPort()); setAttribute(MANAGEMENT_URL, managementUri); httpFeed = HttpFeed.builder() .entity(this) .period(200) .baseUri(managementUri) .poll(new HttpPollConfig<Boolean>(SERVICE_UP) .onSuccess(HttpValueFunctions.responseCodeEquals(200)) .onFailureOrException(Functions.constant(false))) .build(); }
Source:
<code>public void writeRecording() throws IOException { if (replay) { <START> throw new PrestoException(CONFIGURATION_INVALID, "Cannot write recording in replay mode"); <END> } Recording recording = new Recording( allDatabases, toPairsList(databaseCache), toPairsList(tableCache), toPairsList(supportedColumnStatisticsCache), toPairsList(tableStatisticsCache), toPairsList(partitionStatisticsCache), toPairsList(allTablesCache), toPairsList(allViewsCache), toPairsList(partitionCache), toPairsList(partitionNamesCache), toPairsList(partitionNamesByPartsCache), toPairsList(partitionsByNamesCache), toPairsList(rolesCache), toPairsList(databasePrivilegesCache), toPairsList(tablePrivilegesCache)); new ObjectMapperProvider().get() .writerWithDefaultPrettyPrinter() .writeValue(new File(recordingPath), recording); }</code><technical_language>wrong err categorization (i'm fine throwing IllegalStateException here, btw)</technical_language>

Target:
public void writeRecording() throws IOException { if (replay) { throw new IllegalStateException("Cannot write recording in replay mode"); } Recording recording = new Recording( allDatabases, toPairs(databaseCache), toPairs(tableCache), toPairs(supportedColumnStatisticsCache), toPairs(tableStatisticsCache), toPairs(partitionStatisticsCache), toPairs(allTablesCache), toPairs(allViewsCache), toPairs(partitionCache), toPairs(partitionNamesCache), toPairs(partitionNamesByPartsCache), toPairs(partitionsByNamesCache), toPairs(rolesCache), toPairs(databasePrivilegesCache), toPairs(tablePrivilegesCache)); new ObjectMapperProvider().get() .writerWithDefaultPrettyPrinter() .writeValue(new File(recordingPath), recording); }
Source:
<code>protected void executeQueryCommand() { Function<Guid, DiskImage> getAncestor = (Guid imageId) -> <START> diskImageDao.getAncestor(imageId, getUserID(), getParameters().isFiltered()); <END> Set<Guid> haveNullAncestor = new HashSet<>(); Predicate<Pair<Guid, DiskImage>> ancestorNotNull = (Pair<Guid, DiskImage> pair) -> { if (pair.getSecond() == null) { haveNullAncestor.add(pair.getFirst()); return false; } return true; }; Map<Guid, DiskImage> haveValidAncestor = getParameters().getIds().stream() .map(guid -> new Pair<>(guid, getAncestor.apply(guid))) .filter(ancestorNotNull) .collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)); if (!haveNullAncestor.isEmpty()) { log.warn("Ancestor is missing for the following guid(s): {}", StringUtils.join(haveNullAncestor, ',')); } getQueryReturnValue().setReturnValue(haveValidAncestor); }</code><technical_language>add logging for missing ancestor in function declared here, add a set in this function print log end: Function<Guid, DiskImage> getAncestor = (Guid imageId) -> { DiskImage ancestor = diskImageDao.getAncestor( imageId,(), getParameters().isFiltered()); if (ancestor == null) { log.warn("Ancestor is missing for guid: {}", ancestor.getId()); } return ancestor; }; or: Set<Guid> missingAncestorsGuids = new HashSet<>(); Function<Guid, DiskImage> getAncestor = (Guid imageId) -> { DiskImage ancestor = diskImageDao.getAncestor( imageId,(), getParameters().isFiltered()); if (ancestor == null) { missingAncestorsGuids.add(ancestor.getId()) } return ancestor; };</technical_language>

Target:
protected void executeQueryCommand() { Set<Guid> haveInvalidAncestor = new HashSet<>(); Function<Guid, DiskImage> getAncestor = (Guid imageId) -> { DiskImage ancestor = diskImageDao.getAncestor(imageId, getUserID(), getParameters().isFiltered()); if (ancestor == null) { haveInvalidAncestor.add(imageId); } return ancestor; }; Map<Guid, DiskImage> haveValidAncestor = getParameters().getIds().stream() .map(guid -> new Pair<>(guid, getAncestor.apply(guid))) .filter(pair -> pair.getSecond() != null) .collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)); if (!haveInvalidAncestor.isEmpty()) { log.warn("Ancestor is missing for the following guid(s): {}", StringUtils.join(haveInvalidAncestor, ',')); } getQueryReturnValue().setReturnValue(haveValidAncestor); }
Source:
<code>@Test public void testCheckQueueIntegrityOn2xLongCorruptedElement() throws IOException { QueueFile queueFile = new QueueFile(file); final byte[] a = { 1, 2 }; queueFile.add(a); final byte[] b = { 3, 4, 5 }; queueFile.add(b); final int positionOfElementB = QueueFile.HEADER_LENGTH + Element.HEADER_LENGTH + 2; queueFile.raf.seek(positionOfElementB); int doubleFileSize = (int)queueFile.raf.length() * 2; final byte[] intBuffer = new byte[4]; QueueFile.writeInt(intBuffer, 0, doubleFileSize); queueFile.raf.write(intBuffer); try { queueFile.checkQueueIntegrity(); fail("Should have complained about wrong element lengths."); } catch (IOException ex) { <START> final String message = ex.getMessage(); <END> assertThat(message).contains("corruption"); } }</code><technical_language>suggestion String message = ex.getMessage();</technical_language>

Target:
@Test public void testCheckQueueIntegrityOn2xLongCorruptedElement() throws IOException { QueueFile queueFile = new QueueFile(file); final byte[] a = { 1, 2 }; queueFile.add(a); final byte[] b = { 3, 4, 5 }; queueFile.add(b); final int positionOfElementB = QueueFile.HEADER_LENGTH + Element.HEADER_LENGTH + 2; queueFile.raf.seek(positionOfElementB); int doubleFileSize = (int)queueFile.raf.length() * 2; final byte[] intBuffer = new byte[4]; QueueFile.writeInt(intBuffer, 0, doubleFileSize); queueFile.raf.write(intBuffer); try { queueFile.checkQueueIntegrity(); fail("Should have complained about wrong element lengths."); } catch (IOException ex) { String message = ex.getMessage(); assertThat(message).contains("corruption"); } }
Source:
<code>public byte[] encrypt(byte[] message) { <START> if (publicKey == null) <END> throw new RuntimeException("Encryption failed. Public key not available."); byte[] ct = new byte[message.length + SEAL_BYTES]; isValid(sodium().crypto_box_seal( ct, message, message.length, publicKey), "Encryption failed"); return ct; }</code><technical_language>need avoid waiting encrypt time determine public key passed initialization is incorrect</technical_language>

Target:
public byte[] encrypt(byte[] message) { byte[] ct = new byte[message.length + SEAL_BYTES]; if (sodium().crypto_box_seal(ct, message, message.length, mPublicKey) != 0) { throw new IllegalArgumentException("Failed to encrypt"); } return ct; }
Source:
<code>public List<SecretSeriesAndContent> getSecretsByName(List<String> names) { checkArgument(!names.isEmpty()); SecretContentDAO secretContentDAO = secretContentDAOFactory.using(dslContext.configuration()); SecretSeriesDAO secretSeriesDAO = secretSeriesDAOFactory.using(dslContext.configuration()); List<SecretSeries> multipleseries = secretSeriesDAO.getSecretsSeriesByName(names); Iterator siter = multipleseries.iterator(); List<SecretSeriesAndContent> ret = new ArrayList<SecretSeriesAndContent>(); <START> while (siter.hasNext()) { <END> SecretSeries series = (SecretSeries) siter.next(); if (series.currentVersion().isPresent()) { long secretContentId = series.currentVersion().get(); Optional<SecretContent> secretContent = secretContentDAO.getSecretContentById(secretContentId); if (secretContent.isPresent()) { ret.add(SecretSeriesAndContent.of(series, secretContent.get())); } else { } } } return ret; }</code><technical_language>iterators (here in BatchSecretDeliveryResource), I generally prefer a foreach loop: for (SecretSeries series : multipleSeries) { ... } a easier read avoids mistakes forgetting check hasNext()/not calling next()</technical_language>

Target:
public List<SecretSeriesAndContent> getSecretsByName(List<String> names) { checkArgument(!names.isEmpty()); SecretContentDAO secretContentDAO = secretContentDAOFactory.using(dslContext.configuration()); SecretSeriesDAO secretSeriesDAO = secretSeriesDAOFactory.using(dslContext.configuration()); List<SecretSeries> multipleSeries = secretSeriesDAO.getMultipleSecretSeriesByName(names); List<SecretSeriesAndContent> ret = new ArrayList<SecretSeriesAndContent>(); for (SecretSeries series : multipleSeries) { if (series.currentVersion().isPresent()) { long secretContentId = series.currentVersion().get(); Optional<SecretContent> secretContent = secretContentDAO.getSecretContentById(secretContentId); if (secretContent.isPresent()) { ret.add(SecretSeriesAndContent.of(series, secretContent.get())); } else { throw new NotFoundException("Secret not found."); } } } return ret; }
Source:
<code>public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException, InterruptedException { RepositoryName nameFromRule = (RepositoryName) skyKey.argument(); SkyKey repositoryKey = RepositoryDirectoryValue.key(nameFromRule); RepositoryDirectoryValue repository = (RepositoryDirectoryValue) env.getValue(repositoryKey); if (repository == null) { return null; } if (!repository.repositoryExists()) { return RepositoryValue.notFound(nameFromRule); } RootedPath workspaceFilePath; try { workspaceFilePath = WorkspaceFileHelper .getWorkspaceRootedFile(Root.fromPath(repository.getPath()), env); if (workspaceFilePath == null) { return null; } } catch (IOException e) { throw new RepositoryLoaderFunctionException( <START> new IOException("Could not determine workspace file (WORKSPACE.bazel / WORKSPACE): " <END> + e.getMessage()), Transience.PERSISTENT); } SkyKey workspaceKey = WorkspaceFileValue.key(workspaceFilePath); WorkspaceFileValue workspacePackage = (WorkspaceFileValue) env.getValue(workspaceKey); if (workspacePackage == null) { return null; } RepositoryName workspaceName; try { String workspaceNameStr = workspacePackage.getPackage().getWorkspaceName(); workspaceName = workspaceNameStr.isEmpty() ? RepositoryName.create("") : RepositoryName.create("@" + workspaceNameStr); } catch (LabelSyntaxException e) { throw new IllegalStateException(e); } return RepositoryValue.success(nameFromRule, repository); }</code><technical_language>nit: "/" a directory separator. "WORKSPACE.bazel" "WORKPACE" (with quotes)</technical_language>

Target:
public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException, InterruptedException { RepositoryName nameFromRule = (RepositoryName) skyKey.argument(); SkyKey repositoryKey = RepositoryDirectoryValue.key(nameFromRule); RepositoryDirectoryValue repository = (RepositoryDirectoryValue) env.getValue(repositoryKey); if (repository == null) { return null; } if (!repository.repositoryExists()) { return RepositoryValue.notFound(nameFromRule); } RootedPath workspaceFilePath; try { workspaceFilePath = WorkspaceFileHelper .getWorkspaceRootedFile(Root.fromPath(repository.getPath()), env); if (workspaceFilePath == null) { return null; } } catch (IOException e) { throw new RepositoryLoaderFunctionException( new IOException( "Could not determine workspace file (\"WORKSPACE.bazel\" or \"WORKSPACE\"): " + e.getMessage()), Transience.PERSISTENT); } SkyKey workspaceKey = WorkspaceFileValue.key(workspaceFilePath); WorkspaceFileValue workspacePackage = (WorkspaceFileValue) env.getValue(workspaceKey); if (workspacePackage == null) { return null; } RepositoryName workspaceName; try { String workspaceNameStr = workspacePackage.getPackage().getWorkspaceName(); workspaceName = workspaceNameStr.isEmpty() ? RepositoryName.create("") : RepositoryName.create("@" + workspaceNameStr); } catch (LabelSyntaxException e) { throw new IllegalStateException(e); } return RepositoryValue.success(nameFromRule, repository); }
Source:
<code>protected void executeCommand() { if (getVmTemplate().isBaseTemplate()) { shiftBaseTemplateToSuccessor(); } List<Disk> templateImages = DbFacade.getInstance().getDiskDao().getAllForVm(getVmTemplateId()); final List<CinderDisk> cinderDisks = ImagesHandler.filterDisksBasedOnCinder(templateImages); final List<DiskImage> diskImages = ImagesHandler.filterImageDisks(templateImages, false, false, true); VmTemplateHandler.lockVmTemplateInTransaction(getVmTemplateId(), getCompensationContext()); TransactionSupport.executeInNewTransaction(() -> { if (!diskImages.isEmpty() || !cinderDisks.isEmpty()) { if (!diskImages.isEmpty() && removeVmTemplateImages()) { VmHandler.removeVmInitFromDB(getVmTemplate()); setSucceeded(true); } if (!cinderDisks.isEmpty()) { removeCinderDisks(cinderDisks); setSucceeded(true); } } <START> removeTemplateFromDb(); <END> return null; }); }</code><technical_language>currently done synchronously if removal of disks succeeded, able delete disks copies. regular delete flow adjusted handle disk copies able do it</technical_language>

Target:
protected void executeCommand() { if (getVmTemplate().isBaseTemplate()) { shiftBaseTemplateToSuccessor(); } List<Disk> templateImages = DbFacade.getInstance().getDiskDao().getAllForVm(getVmTemplateId()); final List<CinderDisk> cinderDisks = ImagesHandler.filterDisksBasedOnCinder(templateImages); final List<DiskImage> diskImages = ImagesHandler.filterImageDisks(templateImages, false, false, true); VmTemplateHandler.lockVmTemplateInTransaction(getVmTemplateId(), getCompensationContext()); TransactionSupport.executeInNewTransaction(() -> { if (!diskImages.isEmpty() || !cinderDisks.isEmpty()) { if (!diskImages.isEmpty() && removeVmTemplateImages()) { VmHandler.removeVmInitFromDB(getVmTemplate()); setSucceeded(true); } if (!cinderDisks.isEmpty()) { removeCinderDisks(cinderDisks); setSucceeded(true); } } return null; }); if (noAsyncOperations()) { handleEndAction(); } }
Source:
<code>public DDLCompiler(VoltCompiler compiler, HSQLInterface hsql, VoltDDLElementTracker tracker, ClassLoader classLoader) { assert(compiler != null); assert(hsql != null); assert(tracker != null); m_hsql = hsql; m_compiler = compiler; m_tracker = tracker; m_classLoader = classLoader; m_mvProcessor = new MaterializedViewProcessor(m_compiler, m_hsql); m_voltStatementProcessor = new VoltDBStatementProcessor(this); m_voltStatementProcessor.addNextProcessor(new CreateAggregateFunctionFromClass(this)) <START> .addNextProcessor(new CreateProcedureFromClass(this)) <END> .addNextProcessor(new CreateProcedureAsScript(this)) .addNextProcessor(new CreateProcedureAsSQL(this)) .addNextProcessor(new CreateFunctionFromMethod(this)) .addNextProcessor(new DropAggregateFunction(this)) .addNextProcessor(new DropFunction(this)) .addNextProcessor(new DropProcedure(this)) .addNextProcessor(new PartitionStatement(this)) .addNextProcessor(new ReplicateTable(this)) .addNextProcessor(new CreateRole(this)) .addNextProcessor(new DropRole(this)) .addNextProcessor(new DropStream(this)) .addNextProcessor(new DRTable(this)) .addNextProcessor(new SetGlobalParam(this)) .addNextProcessor(new CatchAllVoltDBStatement(this, m_voltStatementProcessor)); }</code><technical_language>adjust alignment</technical_language>

Target:
public DDLCompiler(VoltCompiler compiler, HSQLInterface hsql, VoltDDLElementTracker tracker, ClassLoader classLoader) { assert(compiler != null); assert(hsql != null); assert(tracker != null); m_hsql = hsql; m_compiler = compiler; m_tracker = tracker; m_classLoader = classLoader; m_mvProcessor = new MaterializedViewProcessor(m_compiler, m_hsql); m_voltStatementProcessor = new VoltDBStatementProcessor(this); m_voltStatementProcessor.addNextProcessor(new CreateProcedureFromClass(this)) .addNextProcessor(new CreateProcedureAsScript(this)) .addNextProcessor(new CreateProcedureAsSQL(this)) .addNextProcessor(new CreateAggregateFunctionFromClass(this)) .addNextProcessor(new CreateFunctionFromMethod(this)) .addNextProcessor(new DropAggregateFunction(this)) .addNextProcessor(new DropFunction(this)) .addNextProcessor(new DropProcedure(this)) .addNextProcessor(new PartitionStatement(this)) .addNextProcessor(new ReplicateTable(this)) .addNextProcessor(new CreateRole(this)) .addNextProcessor(new DropRole(this)) .addNextProcessor(new DropStream(this)) .addNextProcessor(new DRTable(this)) .addNextProcessor(new SetGlobalParam(this)) .addNextProcessor(new CatchAllVoltDBStatement(this, m_voltStatementProcessor)); }
Source:
<code><START> public static <END> List<IProject> selectionToProjects(IStructuredSelection selection) { if (selection == null) { return Collections.emptyList(); } List<IProject> resources = new ArrayList<>(); Iterator<?> iter = selection.iterator(); while (iter.hasNext()) { Object curr = iter.next(); if (curr instanceof IWorkingSet) { IWorkingSet workingSet = (IWorkingSet) curr; if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) { continue; } IAdaptable[] elements = workingSet.getElements(); for (IAdaptable element : elements) { IProject project = element.getAdapter(IProject.class); if (project != null) { resources.add(project); } } } else if (curr instanceof IAdaptable) { IProject resource = ((IAdaptable) curr).getAdapter(IProject.class); if (resource != null) { resources.add(resource); } } } return resources; }</code><technical_language>need public? Developers find this method API able change name signature again</technical_language>

Target:
private static List<IProject> selectionToProjects(IStructuredSelection selection) { if (selection == null) { return Collections.emptyList(); } List<IProject> resources = new ArrayList<>(); Iterator<?> selectionIterator = selection.iterator(); while (selectionIterator.hasNext()) { Object currentObject = selectionIterator.next(); if (currentObject instanceof IWorkingSet) { IWorkingSet workingSet = (IWorkingSet) currentObject; for (IAdaptable element : workingSet.getElements()) { IProject project = element.getAdapter(IProject.class); if (project != null) { resources.add(project); } } } else if (currentObject instanceof IAdaptable) { IProject resource = ((IAdaptable) currentObject).getAdapter(IProject.class); if (resource != null) { resources.add(resource); } } } return resources; }
Source:
<code><START> public void addToWhitelist(String clientID) { <END> whitelistedIDs.add(clientID); }</code><technical_language>In opinion, methods modify lists complemented some sort of saveLists() method inverse of loadLists() - save disk (using gson.toJson). Anyway, right lists meant edited manually editing json files (correct?) this task deferred is a real case for (like adding console commands FacadeServer APIs modify lists)</technical_language>

Target:
public void addToWhitelist(String clientID) { whitelistedIDs.add(clientID); saveLists(); }
Source:
<code>public void findOldestPasswordShouldFindOldestPasswordHistoryForUserWithThreePasswordHistory() { UserEntity user = this.userRepository.findByUserName(TEST_USERNAME_WITH_THREE_PASSWORD_HISTORY); Date nearNow = currentDateMinus(5); <START> PasswordHistoryEntity pwHistory = this.repository.findOldestPassword(TEST_USER_ID_WITH_THREE_PASSWORD_HISTORY); <END> assertThat(pwHistory, notNullValue()); assertPasswordHistoryEntity(pwHistory, user, ACTUAL_PASSWORD_FOR_USER_WITH_THREE_PASSWORD_HISTORY, nearNow); }</code><technical_language>other test insert users test data, hard coded user id values wrong in future. I suggest remove TEST_USER_ID_... constants test id user returned userRepository.findByUserName()</technical_language>

Target:
public void findOldestPasswordShouldFindOldestPasswordHistoryForUserWithThreePasswordHistory() { UserEntity user = this.userRepository.findByUserName(TEST_USERNAME_WITH_THREE_PASSWORD_HISTORY); Long testUserIdWithThreePasswordHistory = user.getId(); Date nearNow = currentDateMinus(5); PasswordHistoryEntity pwHistory = this.repository.findOldestPassword(testUserIdWithThreePasswordHistory); assertThat(pwHistory, notNullValue()); assertPasswordHistoryEntity(pwHistory, user, ACTUAL_PASSWORD_FOR_USER_WITH_THREE_PASSWORD_HISTORY, nearNow); }
Source:
<code><START> public void testGetGraphIndex() throws Exception { <END> final Edge edge = mock(Edge.class); when(edge.getTargetNode()).thenReturn(child); when(parent.getOutEdges()).thenReturn(Collections.singletonList(edge)); assertEquals(0, CaseManagementCommandUtil.getChildGraphIndex(parent, child)); }</code><technical_language>Exception is thrown</technical_language>

Target:
public void testGetGraphIndex() { final Edge edge = mock(Edge.class); when(edge.getTargetNode()).thenReturn(child); when(parent.getOutEdges()).thenReturn(Collections.singletonList(edge)); assertEquals(0, CaseManagementCommandUtil.getChildGraphIndex(parent, child)); }
Source:
<code>public void applyFieldFacet(SolrQuery query, String fieldName, String fieldValuePrefix) { Preconditions.checkNotNull(query); Preconditions.checkNotNull(fieldName); Preconditions.checkArgument(StringUtils.isNotBlank(fieldName)); query.setFacet(true); query.add(FacetParams.FACET_SORT, FacetParams.FACET_SORT_INDEX); query.add(FacetParams.FACET_FIELD, fieldName); if (!StringUtils.isBlank(fieldValuePrefix)) { query.add(FacetParams.FACET_PREFIX, fieldValuePrefixAdder.prefixWithSeparator(fieldValuePrefix)); <START> } <END> }</code><technical_language>Please consider adding params FacetParams.FACET_SORT, FacetParams.FACET_PREFIX for single field. is f.<fieldname>.facet.sort f.<fieldname>.facet.prefix. In form this call of applyFieldFacet for field override params call</technical_language>

Target:
public void applyFieldFacet(SolrQuery query, String fieldName, String fieldValuePrefix) { Preconditions.checkNotNull(query); Preconditions.checkNotNull(fieldName); Preconditions.checkArgument(StringUtils.isNotBlank(fieldName)); String fieldParamPrefix = "f." + fieldName + "."; query.setFacet(true); query.add(fieldParamPrefix + FacetParams.FACET_SORT, FacetParams.FACET_SORT_INDEX); query.add(FacetParams.FACET_FIELD, fieldName); if (!StringUtils.isBlank(fieldValuePrefix)) { query.add(fieldParamPrefix + FacetParams.FACET_PREFIX, fieldValuePrefixAdder.prefixWithSeparator(fieldValuePrefix)); } }
Source:
<code>private void onClone() { ImportCloneModel cloneModel = (ImportCloneModel) getConfirmWindow(); if ((Boolean) cloneModel.getApplyToAll().getEntity()) { if (!(Boolean) cloneModel.getNoClone().getEntity()) { String suffix = (String) cloneModel.getSuffix().getEntity(); <START> if (!validateSuffix(suffix, cloneModel.getSuffix())) { <END> return; } for (VM vm : vmsInSetupMap.values()) { vm.setvm_name(vm.getvm_name() + suffix); cloneVmMap.put(vm.getId(), vm); } } vmsInSetupMap.clear(); } else { VM vm = (VM) cloneModel.getEntity(); if (!(Boolean) cloneModel.getNoClone().getEntity()) { String vmName = (String) cloneModel.getName().getEntity(); if (!validateVmName(vmName, vm.getos(), cloneModel.getName())) { return; } vm.setvm_name(vmName); cloneVmMap.put(vm.getId(), vm); } vmsInSetupMap.remove(vm.getId()); } setConfirmWindow(null); excuteImportClone(); }</code><technical_language>need support running numbers in suffix (probably in backend code actually!)</technical_language>

Target:
private void onClone() { ImportCloneModel cloneModel = (ImportCloneModel) getConfirmWindow(); if ((Boolean) cloneModel.getApplyToAll().getEntity()) { if (!(Boolean) cloneModel.getNoClone().getEntity()) { String suffix = (String) cloneModel.getSuffix().getEntity(); if (!validateSuffix(suffix, cloneModel.getSuffix())) { return; } for (VM vm : vmsInSetupMap.values()) { vm.setvm_name(vm.getvm_name() + suffix); cloneVmMap.put(vm.getId(), vm); } } vmsInSetupMap.clear(); } else { VM vm = (VM) cloneModel.getEntity(); if (!(Boolean) cloneModel.getNoClone().getEntity()) { String vmName = (String) cloneModel.getName().getEntity(); if (!validateVmName(vmName, vm.getos(), cloneModel.getName())) { return; } vm.setvm_name(vmName); cloneVmMap.put(vm.getId(), vm); } vmsInSetupMap.remove(vm.getId()); } setConfirmWindow(null); executeImportClone(); }
Source:
<code>protected void signalRMCoreIsInitialized() { <START> rmCoreInitializedLock.lock(); <END> try { rmCoreInitialized = true; logger.info("Resource Manager is initialized"); rmCoreInitializedCondition.signalAll(); } finally { rmCoreInitializedLock.unlock(); } }</code><technical_language>afraid a deadlock occur this pattern. waitForRMCoreToBeInitialized() hold lock await a notification, while initActivity able reserve lock send notification</technical_language>

Target:
protected void signalRMCoreIsInitialized() { logger.info("Resource Manager is initialized"); countDownLatch.countDown(); }
Source:
<code>public void createNewTemplate(Template template) { <START> if (isTitleValid(template)) { <END> try { Converter converter = new Converter(template.getWorkflow().getTitle()); converter.convertWorkflowToTemplate(template); } catch (IOException | DAOException | WorkflowException e) { Helper.setErrorMessage(ERROR_SAVING, new Object[]{ObjectType.PROCESS.getTranslationSingular()}, logger, e); } List<Process> processesToAddToTemplate = templatesToCreate.get(template); try { ServiceManager.getTemplateService().save(template); } catch (DataException e) { Helper.setErrorMessage(ERROR_SAVING, new Object[]{ObjectType.TEMPLATE.getTranslationSingular()}, logger, e); } try { migrationService.addProcessesToTemplate(template, processesToAddToTemplate); } catch (DataException e) { Helper.setErrorMessage(ERROR_SAVING, new Object[]{ObjectType.PROCESS.getTranslationSingular()}, logger, e); } templatesToCreate.remove(template); } }</code><technical_language>content of this method moved MigrationService MigrationForm free of program logic</technical_language>

Target:
public void createNewTemplate(Template template) { if (migrationService.isTitleValid(template)) { try { Converter converter = new Converter(template.getWorkflow().getTitle()); converter.convertWorkflowToTemplate(template); } catch (IOException | DAOException | WorkflowException e) { Helper.setErrorMessage(ERROR_SAVING, new Object[]{ObjectType.PROCESS.getTranslationSingular()}, logger, e); } List<Process> processesToAddToTemplate = templatesToCreate.get(template); try { ServiceManager.getTemplateService().save(template); } catch (DataException e) { Helper.setErrorMessage(ERROR_SAVING, new Object[]{ObjectType.TEMPLATE.getTranslationSingular()}, logger, e); } try { migrationService.addProcessesToTemplate(template, processesToAddToTemplate); } catch (DataException e) { Helper.setErrorMessage(ERROR_SAVING, new Object[]{ObjectType.PROCESS.getTranslationSingular()}, logger, e); } templatesToCreate.remove(template); } }
Source:
<code><START> DirectClassFile getClass(String path) throws FileNotFoundException { <END> DirectClassFile classFile = null; for (ClassPathElement element : elements) { try { InputStream in = element.open(path); try { byte[] bytes = readStream(in, baos, readBuffer); baos.reset(); classFile = new DirectClassFile(bytes, path, false); classFile.setAttributeFactory(StdAttributeFactory.THE_ONE); break; } finally { in.close(); } } catch (IOException e) { } } if (classFile == null) { throw new FileNotFoundException(path); } return classFile; }</code><technical_language>Add synchronized here, of baos readBuffer. baos readBuffer local readStream</technical_language>

Target:
synchronized DirectClassFile getClass(String path) throws FileNotFoundException { DirectClassFile classFile = null; for (ClassPathElement element : elements) { try { InputStream in = element.open(path); try { byte[] bytes = readStream(in, baos, readBuffer); baos.reset(); classFile = new DirectClassFile(bytes, path, false); classFile.setAttributeFactory(StdAttributeFactory.THE_ONE); break; } finally { in.close(); } } catch (IOException e) { } } if (classFile == null) { throw new FileNotFoundException("File \"" + path + "\" not found"); } return classFile; }
Source:
<code>private void createAndRegisterResources() { registerPaxosResource(); registerExceptionMappers(); <START> Map<String, TimeLockServices> services = new ConcurrentHashMap<>(); <END> Function<String, TimeLockServices> timelockServices = namespace -> services.computeIfAbsent( namespace, this::createInvalidatingTimeLockServices); resource = TimeLockResource.create( metricsManager, timelockServices, Suppliers.compose(TimeLockRuntimeConfiguration::maxNumberOfClients, runtime::get)); healthCheck = paxosResources.leadershipComponents().healthCheck(resource::getActiveClients); LockWatchTestingService.create( Suppliers.compose(TimeLockRuntimeConfiguration::lockWatchTestConfig, runtime::get), resource::getLockWatchingResource); registrar.accept(resource); Function<String, AsyncTimelockService> serviceCreator = namespace -> timelockServices.apply(namespace).getTimelockService(); if (undertowRegistrar.isPresent()) { undertowRegistrar.get().accept(ConjureTimelockResource.undertow(redirectRetryTargeter(), serviceCreator)); } else { registrar.accept(ConjureTimelockResource.jersey(redirectRetryTargeter(), serviceCreator)); } }</code><technical_language>this works feels tacked on, adds a bit of indirection complexity I avoided. TimelockResource a map of signature function thing. Instead of passing functions everywhere, create a class deals of similar LocalPaxosComponents it? pass good go</technical_language>

Target:
private void createAndRegisterResources() { registerPaxosResource(); registerExceptionMappers(); namespaces = new TimelockNamespaces( metricsManager, this::createInvalidatingTimeLockServices, Suppliers.compose(TimeLockRuntimeConfiguration::maxNumberOfClients, runtime::get)); TimeLockResource resource = TimeLockResource.create(namespaces); healthCheck = paxosResources.leadershipComponents().healthCheck(namespaces::getActiveClients); LockWatchTestingService.create( Suppliers.compose(TimeLockRuntimeConfiguration::lockWatchTestConfig, runtime::get), resource::getLockWatchingResource); registrar.accept(resource); Function<String, AsyncTimelockService> serviceCreator = namespace -> namespaces.get(namespace).getTimelockService(); if (undertowRegistrar.isPresent()) { undertowRegistrar.get().accept(ConjureTimelockResource.undertow(redirectRetryTargeter(), serviceCreator)); } else { registrar.accept(ConjureTimelockResource.jersey(redirectRetryTargeter(), serviceCreator)); } }
Source:
<code>public ForkedServer start() { boolean isServerStarted; ProcessBuilder pb = new ProcessBuilder(); pb.command(commands); try { process = pb.start(); isServerStarted = runWithTimeout(this::checkServerLog, START_PATTERN); if (!isServerStarted) { throw new IllegalStateException("The server couldn't start"); } } catch (Exception e) { log.error(e); } <START> log.info("SERVER STARTED!"); <END> return this; }</code><technical_language>need for this</technical_language>

Target:
public ForkedServer start() { boolean isServerStarted; ProcessBuilder pb = new ProcessBuilder(); pb.command(commands); try { process = pb.start(); isServerStarted = runWithTimeout(this::checkServerLog, START_PATTERN); if (!isServerStarted) { throw new IllegalStateException("The server couldn't start"); } } catch (Exception e) { log.error(e); } return this; }
Source:
<code>public void onChanLoaderData(ChanThread result) { if (isWatching()) { chanLoader.setTimer(); } showPosts(); if (loadable.isThreadMode()) { boolean newPosts = false; int lastLoaded = loadable.lastLoaded; List<Post> posts = result.posts; List<PostImage> images = new ArrayList<>(); int more = 0; if (lastLoaded > 0) { for (int i = 0; i < posts.size(); i++) { Post post = posts.get(i); if(newPosts) { <START> if(post.hasImage) { <END> images.add(post.image); } } if (post.no == lastLoaded) { more = posts.size() - i - 1; newPosts = true; } } } loadable.setLastLoaded(posts.get(posts.size() - 1).no); if (more > 0) { threadPresenterCallback.showNewPostsNotification(true, more); if(images.size() > 0) { threadPresenterCallback.addImages(images, loadable); } } } if (loadable.markedNo >= 0) { Post markedPost = findPostById(loadable.markedNo); if (markedPost != null) { highlightPost(markedPost); scrollToPost(markedPost, false); } loadable.markedNo = -1; } addHistory(); }</code><technical_language>Please collapse ifs</technical_language>

Target:
public void onChanLoaderData(ChanThread result) { if (isWatching()) { chanLoader.setTimer(); } showPosts(); if (loadable.isThreadMode()) { boolean newPosts = false; int lastLoaded = loadable.lastLoaded; List<Post> posts = result.posts; List<PostImage> images = new ArrayList<>(); int more = 0; if (lastLoaded > 0) { for (int i = 0; i < posts.size(); i++) { Post post = posts.get(i); if(newPosts && post.hasImage) { images.add(post.image); } if (post.no == lastLoaded) { more = posts.size() - i - 1; newPosts = true; } } } loadable.setLastLoaded(posts.get(posts.size() - 1).no); if (more > 0) { threadPresenterCallback.showNewPostsNotification(true, more); if(images.size() > 0) { threadPresenterCallback.addImages(images, loadable); } } } if (loadable.markedNo >= 0) { Post markedPost = findPostById(loadable.markedNo); if (markedPost != null) { highlightPost(markedPost); scrollToPost(markedPost, false); } loadable.markedNo = -1; } addHistory(); }
Source:
<code>public PrimitiveIterator.OfLong allRows() { return new PrimitiveIterator.OfLong() { <START> private int actualRangeIndex = -1; <END> private Range actualRange; private long next = findNext(); private long findNext() { if (actualRange == null || next + 1 > actualRange.to) { if (actualRangeIndex + 1 < ranges.size()) { actualRange = ranges.get(++actualRangeIndex); next = actualRange.from; } else { return -1; } } else { ++next; } return next; } @Override public boolean hasNext() { return next >= 0; } @Override public long nextLong() { long ret = next; if (ret < 0) { throw new NoSuchElementException(); } next = findNext(); return ret; } }; }</code><technical_language>(nit) s/actual/current/g</technical_language>

Target:
public PrimitiveIterator.OfLong allRows() { return new PrimitiveIterator.OfLong() { private int currentRangeIndex = -1; private Range currentRange; private long next = findNext(); private long findNext() { if (currentRange == null || next + 1 > currentRange.to) { if (currentRangeIndex + 1 < ranges.size()) { currentRange = ranges.get(++currentRangeIndex); next = currentRange.from; } else { return -1; } } else { ++next; } return next; } @Override public boolean hasNext() { return next >= 0; } @Override public long nextLong() { long ret = next; if (ret < 0) { throw new NoSuchElementException(); } next = findNext(); return ret; } }; }
Source:
<code>public synchronized String registerProcessorAndGetId(final ProcessorData data) { final long startTime = System.currentTimeMillis(); final long retryTimeOutMs = 2 * sessionTimeoutMs; String processorId = data.getProcessorId(); if (ephemeralPath == null) { ephemeralPath = zkClient.createEphemeralSequential(keyBuilder.getProcessorsPath() + "/", data.toString()); LOG.info("Created ephemeral path: for processor: in zookeeper.", ephemeralPath, data); while (true) { ProcessorNode processorNode = new ProcessorNode(data, ephemeralPath); if (!isValidRegisteredProcessor(processorNode)) { long currentTime = System.currentTimeMillis(); if ((currentTime - startTime) < retryTimeOutMs) { LOG.info("Processor: is duplicate. Retrying registration again.", processorId); <START> timeDelay(1000); <END> } else { LOG.info("Processor: is duplicate. Deleting zookeeper node at path: {}.", processorId, ephemeralPath); zkClient.delete(ephemeralPath); metrics.deletions.inc(); throw new SamzaException(String.format("Processor: %s is duplicate in the group. Registration failed.", processorId)); } } else { break; } } } else { LOG.info("Ephemeral path: exists for processor: in zookeeper.", ephemeralPath, data); } return ephemeralPath; }</code><technical_language>timeout 5 seconds. 1s a bit aggressive</technical_language>

Target:
public synchronized String registerProcessorAndGetId(final ProcessorData data) { final long startTimeMs = System.currentTimeMillis(); final long retryTimeOutMs = 2 * sessionTimeoutMs; String processorId = data.getProcessorId(); if (ephemeralPath == null) { ephemeralPath = zkClient.createEphemeralSequential(keyBuilder.getProcessorsPath() + "/", data.toString()); LOG.info("Created ephemeral path: for processor: in zookeeper.", ephemeralPath, data); while (true) { ProcessorNode processorNode = new ProcessorNode(data, ephemeralPath); if (!isValidRegisteredProcessor(processorNode)) { long currentTimeMs = System.currentTimeMillis(); if ((currentTimeMs - startTimeMs) < retryTimeOutMs) { LOG.info("Processor: is duplicate. Retrying registration again.", processorId); timeDelay(5000); } else { LOG.info("Processor: is duplicate. Deleting zookeeper node at path: {}.", processorId, ephemeralPath); zkClient.delete(ephemeralPath); metrics.deletions.inc(); throw new SamzaException(String.format("Processor: %s is duplicate in the group. Registration failed.", processorId)); } } else { break; } } } else { LOG.info("Ephemeral path: exists for processor: in zookeeper.", ephemeralPath, data); } return ephemeralPath; }
Source:
<code>public StreamingResponse apply(FileResource rsrc) throws ResourceNotFoundException, IOException { Project.NameKey project = rsrc.getRevision().getControl().getProject().getNameKey(); Repository repo = repoManager.openRepository(project); try { RevWalk rw = new RevWalk(repo); try { RevCommit commit = rw.parseCommit(ObjectId.fromString(rsrc.getRevision().getPatchSet() .getRevision().get())); TreeWalk tw = TreeWalk.forPath(rw.getObjectReader(), rsrc.getPatchKey().get(), commit.getTree().getId()); if (tw == null) { throw new ResourceNotFoundException(); } try { final ObjectLoader loader = repo.open(tw.getObjectId(0)); return new StreamingResponse() { @Override public String getContentType() { return "text/plain;charset=UTF-8"; } @Override public void stream(OutputStream out) throws IOException { PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, Charsets.UTF_8)); try { loader.copyTo(BaseEncoding.base64().encodingStream(writer)); } finally { <START> writer.flush(); <END> } } }; } finally { tw.release(); } } finally { rw.release(); } } finally { repo.close(); } }</code><technical_language>Cool :-) Done</technical_language>

Target:
public StreamingResponse apply(FileResource rsrc) throws ResourceNotFoundException, IOException { Project.NameKey project = rsrc.getRevision().getControl().getProject().getNameKey(); Repository repo = repoManager.openRepository(project); try { RevWalk rw = new RevWalk(repo); try { RevCommit commit = rw.parseCommit(ObjectId.fromString(rsrc.getRevision().getPatchSet() .getRevision().get())); TreeWalk tw = TreeWalk.forPath(rw.getObjectReader(), rsrc.getPatchKey().get(), commit.getTree().getId()); if (tw == null) { throw new ResourceNotFoundException(); } try { final ObjectLoader loader = repo.open(tw.getObjectId(0)); return new StreamingResponse() { @Override public String getContentType() { return "text/plain;charset=UTF-8"; } @Override public void stream(OutputStream out) throws IOException { OutputStream b64Out = BaseEncoding.base64().encodingStream( new OutputStreamWriter(out, Charsets.UTF_8)); loader.copyTo(b64Out); b64Out.close(); } }; } finally { tw.release(); } } finally { rw.release(); } } finally { repo.close(); } }
Source:
<code>protected int rwInUnaryExpression(IASTNode node, IASTUnaryExpression expr, int indirection) { switch(expr.getOperator()) { case IASTUnaryExpression.op_bracketedPrimary: return rwAnyNode(expr, indirection); case IASTUnaryExpression.op_amper: return rwAnyNode(expr, indirection + 1); case IASTUnaryExpression.op_star: final IASTNode parent = expr.getParent(); if (parent instanceof IASTBinaryExpression <START> && ((IASTBinaryExpression) parent).getOperator() == IASTBinaryExpression.op_assign) { <END> return WRITE; } if (indirection > 0) { return rwAnyNode(expr, indirection - 1); } return READ; case IASTUnaryExpression.op_postFixDecr: case IASTUnaryExpression.op_postFixIncr: case IASTUnaryExpression.op_prefixDecr: case IASTUnaryExpression.op_prefixIncr: return READ | WRITE; case IASTUnaryExpression.op_minus: case IASTUnaryExpression.op_not: case IASTUnaryExpression.op_plus: case IASTUnaryExpression.op_tilde: return PDOMName.READ_ACCESS; case IASTUnaryExpression.op_sizeof: case IASTUnaryExpression.op_sizeofParameterPack: case IASTUnaryExpression.op_alignOf: return 0; } return READ; }</code><technical_language>do special-case op_assign op_plusAssign</technical_language>

Target:
protected int rwInUnaryExpression(IASTNode node, IASTUnaryExpression expr, int indirection) { switch(expr.getOperator()) { case IASTUnaryExpression.op_bracketedPrimary: return rwAnyNode(expr, indirection); case IASTUnaryExpression.op_amper: return rwAnyNode(expr, indirection + 1); case IASTUnaryExpression.op_star: if (indirection > 0) { return rwAnyNode(expr, indirection - 1); } return READ; case IASTUnaryExpression.op_postFixDecr: case IASTUnaryExpression.op_postFixIncr: case IASTUnaryExpression.op_prefixDecr: case IASTUnaryExpression.op_prefixIncr: return READ | WRITE; case IASTUnaryExpression.op_minus: case IASTUnaryExpression.op_not: case IASTUnaryExpression.op_plus: case IASTUnaryExpression.op_tilde: return PDOMName.READ_ACCESS; case IASTUnaryExpression.op_sizeof: case IASTUnaryExpression.op_sizeofParameterPack: case IASTUnaryExpression.op_alignOf: return 0; } return READ; }
Source:
<code>public Response intercept(Chain chain) throws IOException { Response response = chain.proceed(chain.request()); String hostName = chain.request().url().host(); HostMetrics metrics = hostMetrics.computeIfAbsent(hostName, host -> new HostMetrics(registry, name, host)); <START> metrics.update(response.code()); <END> return response; }</code><technical_language>prefer per-host HostMetrics this call record(response.code(), hostName)</technical_language>

Target:
public Response intercept(Chain chain) throws IOException { Response response = chain.proceed(chain.request()); String hostname = chain.request().url().host(); hostMetrics.record(hostname, response.code()); return response; }
Source:
<code>public int hashCode() { <START> return getContent().hashCode(); <END> }</code><technical_language>I need add a null check; code in SourceFile assumes content null</technical_language>

Target:
public int hashCode() { return Objects.hashCode(getContent()); }
Source:
<code><START> public BaseComponent[] getMessage() { <END> if ( message == null ) { message = messageSupplier.get(); } return message; }</code><technical_language>Racy. chuck a synchronized on</technical_language>

Target:
public synchronized BaseComponent[] getMessage() { if ( message != null ) { messageJson = null; return message; } if ( messageJson != null ) { message = ComponentSerializer.parse( messageJson ); messageJson = null; return message; } return null; }
Source:
<code>public HostMetricsRegistry(MetricRegistry registry, String serviceName) { this.hostMetrics = CacheBuilder.newBuilder() <START> .maximumSize(1_000) <END> .build(new CacheLoader<String, HostMetrics>() { @Override public HostMetrics load(String hostname) throws Exception { return new HostMetrics(registry, serviceName, hostname); } }); }</code><technical_language>add timeout</technical_language>

Target:
public HostMetricsRegistry(MetricRegistry registry, String serviceName) { this.hostMetrics = CacheBuilder.newBuilder() .maximumSize(1_000) .expireAfterAccess(1, TimeUnit.DAYS) .build(new CacheLoader<String, HostMetrics>() { @Override public HostMetrics load(String hostname) throws Exception { return new HostMetrics(registry, serviceName, hostname); } }); }
Source:
<code>public static void main(String[] args) { Scanner scanner = new Scanner(System.in); <START> System.out.print("Choose interface (To choose command line type 'cl', to choose UI type 'ui'): "); <END> System.out.flush(); String screen = scanner.nextLine(); if ("cl".equals(screen)) { System.out.print("Enter a file name: "); System.out.flush(); String filename = scanner.nextLine(); System.out.print("Enter character to seperate csv file: "); System.out.flush(); String splitBy = scanner.next(); csvToBitext(filename, splitBy, ""); } else if ("ui".equals(screen)) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("User Interface"); frame.setPreferredSize(new Dimension(400, 100)); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel text = new JLabel("Split words by:"); JTextField split = new JTextField(5); JButton btnFile = new JButton("Select Csv File"); JButton btnOk = new JButton("Ok"); JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory()); btnFile.addActionListener((ActionEvent ae) -> { jfc.setDialogTitle("Select csv file"); jfc.setAcceptAllFileFilterUsed(false); int returnValue = jfc.showOpenDialog(null); }); btnOk.addActionListener((ActionEvent ae) -> { csvToBitext(jfc.getSelectedFile().getPath(), split.getText(), ""); }); frame.add(btnFile); frame.add(text); frame.add(split); frame.add(btnOk); frame.pack(); frame.setVisible(true); } }</code><technical_language>I args instead of asking user. Also, a main method start a UI not, I sense for this option</technical_language>

Target:
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Choose interface (To choose command line type 'cl', to choose UI type 'ui'): "); String screen = scanner.nextLine(); if ("cl".equals(screen)) { System.out.print("Enter a file name: "); String filename = scanner.nextLine(); System.out.print("Enter character to seperate csv file: "); String splitBy = scanner.next(); csvToBitext(filename, splitBy, ""); } else if ("ui".equals(screen)) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("User Interface"); frame.setPreferredSize(new Dimension(400, 100)); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel text = new JLabel("Split words by:"); JTextField split = new JTextField(5); JButton btnFile = new JButton("Select Csv File"); JButton btnOk = new JButton("Ok"); JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory()); btnFile.addActionListener((ActionEvent ae) -> { jfc.setDialogTitle("Select csv file"); jfc.setAcceptAllFileFilterUsed(false); int returnValue = jfc.showOpenDialog(null); }); btnOk.addActionListener((ActionEvent ae) -> { csvToBitext(jfc.getSelectedFile().getPath(), split.getText(), ""); }); frame.add(btnFile); frame.add(text); frame.add(split); frame.add(btnOk); frame.pack(); frame.setVisible(true); } }