auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void weProxyPrepareRequests() { when(components.acceptor(CLIENT_1).prepare(1, PROPOSAL_ID_1)).thenReturn(paxosPromise(PROPOSAL_ID_1)); when(components.acceptor(CLIENT_2).prepare(1, PROPOSAL_ID_1)).thenReturn(paxosPromise(PROPOSAL_ID_1)); when(components.acceptor(CLIENT_2).prepare(2, PROPOSAL_ID_2)).thenReturn(paxosPromise(PROPOSAL_ID_2)); when(components.acceptor(CLIENT_1).getLatestSequencePreparedOrAccepted()).thenReturn(1L); when(components.acceptor(CLIENT_2).getLatestSequencePreparedOrAccepted()).thenReturn(2L); SetMultimap<Client, WithSeq<PaxosProposalId>> request = ImmutableSetMultimap .<Client, WithSeq<PaxosProposalId>>builder() .put(CLIENT_1, WithSeq.of(1, PROPOSAL_ID_1)) .putAll(CLIENT_2, WithSeq.of(1, PROPOSAL_ID_1), WithSeq.of(2, PROPOSAL_ID_2)) .build(); SetMultimap<Client, WithSeq<PaxosPromise>> expected = ImmutableSetMultimap .<Client, WithSeq<PaxosPromise>>builder() .put(CLIENT_1, WithSeq.of(1, paxosPromise(PROPOSAL_ID_1))) .put(CLIENT_2, WithSeq.of(1, paxosPromise(PROPOSAL_ID_1))) <START> .put(CLIENT_2, WithSeq.of(2, paxosPromise(PROPOSAL_ID_2))) <END> .build(); assertThat(resource.prepare(request)) .isEqualTo(expected); verify(cache).updateSequenceNumbers(ImmutableSet.of( WithSeq.of(1, CLIENT_1), WithSeq.of(2, CLIENT_2))); }</code><technical_language>nit: wrong here, of course, a bit funky putAll in in setting request</technical_language>

Target:
public void weProxyPrepareRequests() { when(components.acceptor(CLIENT_1).prepare(1, PROPOSAL_ID_1)).thenReturn(promise(PROPOSAL_ID_1)); when(components.acceptor(CLIENT_2).prepare(1, PROPOSAL_ID_1)).thenReturn(promise(PROPOSAL_ID_1)); when(components.acceptor(CLIENT_2).prepare(2, PROPOSAL_ID_2)).thenReturn(promise(PROPOSAL_ID_2)); when(components.acceptor(CLIENT_1).getLatestSequencePreparedOrAccepted()).thenReturn(1L); when(components.acceptor(CLIENT_2).getLatestSequencePreparedOrAccepted()).thenReturn(2L); SetMultimap<Client, WithSeq<PaxosProposalId>> request = ImmutableSetMultimap .<Client, WithSeq<PaxosProposalId>>builder() .put(CLIENT_1, WithSeq.of(1, PROPOSAL_ID_1)) .putAll(CLIENT_2, WithSeq.of(1, PROPOSAL_ID_1), WithSeq.of(2, PROPOSAL_ID_2)) .build(); SetMultimap<Client, WithSeq<PaxosPromise>> expected = ImmutableSetMultimap .<Client, WithSeq<PaxosPromise>>builder() .put(CLIENT_1, WithSeq.of(1, promise(PROPOSAL_ID_1))) .putAll(CLIENT_2, WithSeq.of(1, promise(PROPOSAL_ID_1)), WithSeq.of(2, promise(PROPOSAL_ID_2))) .build(); assertThat(resource.prepare(request)) .isEqualTo(expected); verify(cache).updateSequenceNumbers(ImmutableSet.of( WithSeq.of(1, CLIENT_1), WithSeq.of(2, CLIENT_2))); }
Source:
<code>public void newLimitedEntryActionRetractFact() { final LimitedEntryActionRetractFactCol52 column = new LimitedEntryActionRetractFactCol52(); column.setValue( new DTCellValue52( "" ) ); final ActionRetractFactPopup popup = new ActionRetractFactPopup( model, presenter, new ActionColumnCommand() { public void execute( final ActionCol52 column ) { presenter.appendColumn( column ); } }, column, true, !access.isEditable() ); popup.show(); <START> } <END></code><technical_language>..and above..</technical_language>

Target:
public void newLimitedEntryActionRetractFact() { final LimitedEntryActionRetractFactCol52 column = new LimitedEntryActionRetractFactCol52(); column.setValue( new DTCellValue52( "" ) ); doNewActionRetractFactColumn( column ); }
Source:
<code>public TableViewerColumn getTableViewerColumn() { <START> return tlc; <END> }</code><technical_language>Please provide more meaningful field names. consider prefixing field names f parameter fields p</technical_language>

Target:
public TableViewerColumn getTableViewerColumn() { return tableViewerColumn; }
Source:
<code>public void JERSEY_2643() { <START> String result = target("test3").request().get(String.class); <END> assertEquals("test ok", result); }</code><technical_language>I guess path "JERSEY-2643" instead of "test3"</technical_language>

Target:
public void JERSEY_2643() { String result = target("JERSEY-2643").request().get(String.class); assertEquals("test ok", result); }
Source:
<code>public @ResponseBody boolean updateGame( @PathVariable int id, @RequestParam(value = "location") String location, @RequestParam(value = "addOfficial") String addOfficial, @RequestParam(value = "removeOfficial") String removeOfficial, HttpSession session) { Member member = (Member) session.getAttribute("member"); <START> if(MemberUtils.atLeastCoordinator(member)) { <END> return false; } GameDao gameDao = new GameDao(); MemberDao memberDao = new MemberDao(); Game game = gameDao.getGameById(id, true); if(location!="") { game.setGameLocation(location); } game.removeOfficial(memberDao.getMemberByUsername(removeOfficial)); game.addOfficial(memberDao.getMemberByUsername(addOfficial)); gameDao.saveGame(game); return true; }</code><technical_language>this inverted</technical_language>

Target:
public @ResponseBody boolean updateGame( @PathVariable int id, @RequestParam(value = "location") String location, @RequestParam(value = "addOfficial") String addOfficial, @RequestParam(value = "removeOfficial") String removeOfficial, HttpSession session) { Member member = (Member) session.getAttribute("member"); if(!MemberUtils.atLeastCoordinator(member)) { return false; } GameDao gameDao = new GameDao(); MemberDao memberDao = new MemberDao(); Game game = gameDao.getGameById(id, true); if(location!="") { game.setGameLocation(location); } game.removeOfficial(memberDao.getMemberByUsername(removeOfficial)); game.addOfficial(memberDao.getMemberByUsername(addOfficial)); gameDao.saveGame(game); return true; }
Source:
<code>public static long arrayPosition( @TypeParameter("T") Type type, @OperatorDependency(operator = EQUAL, argumentTypes = {"T", "T"}) MethodHandle equalMethodHandle, @SqlType("array(T)") Block array, @SqlType("T") Slice element) { int size = array.getPositionCount(); for (int i = 0; i < size; i++) { if (!array.isNull(i)) { Slice arrayValue = type.getSlice(array, i); try { Boolean result = (Boolean) equalMethodHandle.invokeExact(arrayValue, element); <START> checkArgument(result != null, "Array element should not be nulll"); <END> if (result) { return i + 1; } } catch (Throwable t) { throw internalError(t); } } } return 0; }</code><technical_language>nit: This check assertion. matter arguments passed this function equals function return null, null case is explicitly checked before. For assertions verify is preferred. (same for others)</technical_language>

Target:
public static long arrayPosition( @TypeParameter("T") Type type, @OperatorDependency(operator = EQUAL, argumentTypes = {"T", "T"}) MethodHandle equalMethodHandle, @SqlType("array(T)") Block array, @SqlType("T") Slice element) { int size = array.getPositionCount(); for (int i = 0; i < size; i++) { if (!array.isNull(i)) { Slice arrayValue = type.getSlice(array, i); try { Boolean result = (Boolean) equalMethodHandle.invokeExact(arrayValue, element); verify(result != null, "Array element should not be nul"); if (result) { return i + 1; } } catch (Throwable t) { throw internalError(t); } } } return 0; }
Source:
<code>public static String fromIssuePriority(Issue.Priority priority) { switch (priority) { <START> case IMMEDIATE: <END> return "1"; case HIGH: return "2"; case URGEND: return "3"; case NONE: return "4"; case LOW: return "5"; default: return "4"; } }</code><technical_language>again, a map</technical_language>

Target:
public static String fromIssuePriority(Issue.Priority priority) { if (fieldMap == null) { initMap(); } return fieldMap.get(priority); }
Source:
<code>protected static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) { if(extension == null) { extension = ""; } if(containerFullPath == null) { containerFullPath = new Path(""); } if(fileName == null || fileName.trim().length() == 0) { fileName = DEFAULT_NAME; } if(fileName.contains(".")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")); } List<String> extensionPrefixes = new ArrayList<String>(); for (DiagramCategoryDescriptor diagramCategoryDescriptor : DiagramCategoryRegistry.getInstance().getDiagramCategories()) { String extensionPrefix = diagramCategoryDescriptor.getExtensionPrefix(); if (extensionPrefix == null) continue; extensionPrefixes.add(extensionPrefix); } String[] segments = fileName.split("\\."); <START> for (int i = segments.length-1; i >= 0; i--) { <END> String segment = segments[i]; if (extensionPrefixes.contains(segment)) { fileName = fileName.substring(0, fileName.lastIndexOf("."+segment)); } } IPath filePath = containerFullPath.append(fileName); filePath = filePath.addFileExtension(extension); int i = 1; while(ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) { i++; filePath = containerFullPath.append(fileName + i); if(extension != null) { filePath = filePath.addFileExtension(extension); } } return filePath.lastSegment(); }</code><technical_language>I segment of file name treated 'extension'. I able create, for example, profile.di a *.profile.di file</technical_language>

Target:
protected static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) { if(extension == null) { extension = ""; } if(containerFullPath == null) { containerFullPath = new Path(""); } if(fileName == null || fileName.trim().length() == 0) { fileName = DEFAULT_NAME; } if(fileName.contains(".")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")); } Set<String> extensionPrefixes = new HashSet<String>(); extensionPrefixes.add(extension); for(DiagramCategoryDescriptor diagramCategoryDescriptor : DiagramCategoryRegistry.getInstance().getDiagramCategories()) { String extensionPrefix = diagramCategoryDescriptor.getExtensionPrefix(); if(extensionPrefix == null) { continue; } extensionPrefixes.add(extensionPrefix); } String[] segments = fileName.split("\\."); for(int i = segments.length - 1; i > 0; i--) { String segment = segments[i]; if(extensionPrefixes.contains(segment)) { int index = fileName.lastIndexOf("." + segment); if(index >= 0) { fileName = fileName.substring(0, index); } } else { break; } } IPath filePath = containerFullPath.append(fileName); filePath = filePath.addFileExtension(extension); int i = 1; while(ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) { i++; filePath = containerFullPath.append(fileName + i); if(extension != null) { filePath = filePath.addFileExtension(extension); } } return filePath.lastSegment(); }
Source:
<code>private List<String> getServices( String serviceName ) throws SQLException { List<String> serviceNames = new ArrayList<String>(); try { StringBuilder serviceArguments = new StringBuilder().append( "/listServices" ); if ( StringUtils.isNotBlank( serviceName ) ) { serviceArguments.append( "?serviceName=" ); <START> serviceArguments.append( serviceName ); <END> } String result = execService( serviceArguments.toString() ); Document doc = XMLHandler.loadXMLString( createDocumentBuilder(), result ); Node servicesNode = XMLHandler.getSubNode( doc, "services" ); List<Node> serviceNodes = XMLHandler.getNodes( servicesNode, "service" ); for ( Node serviceNode : serviceNodes ) { serviceNames.add( XMLHandler.getTagValue( serviceNode, "name" ) ); } } catch ( Exception e ) { throw serverException( e ); } return serviceNames; }</code><technical_language>Do a URL encoding of this value. service name can, for example, spaces and/or special characters</technical_language>

Target:
private List<String> getServices( String serviceName ) throws SQLException { List<String> serviceNames = new ArrayList<String>(); try { List<Node> serviceNodes = getServiceNodes( serviceName ); for ( Node serviceNode : serviceNodes ) { serviceNames.add( XMLHandler.getTagValue( serviceNode, "name" ) ); } } catch ( Exception e ) { throw serverException( e ); } return serviceNames; }
Source:
<code>public String encryptSecret(String plainText) { if (plainText.length() > MAX_PLAINTEXT_LENGTH) { throw new IllegalArgumentException("Too long text"); } byte[] nonce = generateNonce(); Cipher cipher = cipher(ENCRYPT_MODE, sharedSecret, nonce); byte[] plainTextBytes = plainText.getBytes(UTF_8); if (plainTextBytes.length > MAX_PLAINTEXT_LENGTH) { throw new IllegalArgumentException("Too long text"); } int recordContentsLength = LENGTH_SIZE + plainTextBytes.length; <START> int recordLength = RECORD_SIZE_ALIGNMENT * ((recordContentsLength + RECORD_SIZE_ALIGNMENT - 1) / RECORD_SIZE_ALIGNMENT) + GCM_TAG_LENGTH; <END> byte[] recordBytes = new byte[recordLength]; ByteBuffer recordBuffer = ByteBuffer.wrap(recordBytes); recordBuffer.putInt(plainTextBytes.length); recordBuffer.put(plainTextBytes); byte[] cipherText; try { cipherText = cipher.doFinal(recordBytes); } catch (IllegalBlockSizeException | BadPaddingException e) { throw Throwables.propagate(e); } byte[] opaque = new byte[WRAPPING_SIZE + cipherText.length]; ByteBuffer output = ByteBuffer.wrap(opaque); output.put(NAME_BYTES); output.putInt(VERSION_2); output.putInt(TERM); output.put(nonce); output.put(cipherText); assert output.remaining() == 0; return Base64.getEncoder().encodeToString(opaque); }</code><technical_language>do need add GCM_TAG_LENGTH here? recordBytes include tag field. cipher.doFinal(recordBytes) appends a tag implicitly</technical_language>

Target:
public String encryptSecret(String plainText) { if (plainText.length() > MAX_PLAINTEXT_LENGTH) { throw new IllegalArgumentException("Too long text"); } byte[] nonce = generateNonce(); Cipher cipher = cipher(ENCRYPT_MODE, sharedSecret, nonce); byte[] plainTextBytes = plainText.getBytes(UTF_8); if (plainTextBytes.length > MAX_PLAINTEXT_LENGTH) { throw new IllegalArgumentException("Too long text"); } int recordContentsLength = LENGTH_SIZE + plainTextBytes.length; int recordLength = RECORD_SIZE_ALIGNMENT * ((recordContentsLength + RECORD_SIZE_ALIGNMENT - 1) / RECORD_SIZE_ALIGNMENT); byte[] recordBytes = new byte[recordLength]; ByteBuffer recordBuffer = ByteBuffer.wrap(recordBytes); recordBuffer.putInt(plainTextBytes.length); recordBuffer.put(plainTextBytes); byte[] cipherText; try { cipherText = cipher.doFinal(recordBytes); } catch (IllegalBlockSizeException | BadPaddingException e) { throw Throwables.propagate(e); } byte[] opaque = new byte[WRAPPING_SIZE + cipherText.length]; ByteBuffer output = ByteBuffer.wrap(opaque); output.put(NAME_BYTES); output.putInt(VERSION_2); output.putInt(TERM); output.put(nonce); output.put(cipherText); assert output.remaining() == 0; return Base64.getEncoder().encodeToString(opaque); }
Source:
<code>public void testScoresV3WithParam() { final int age = 23; final int durThreshold = 480; final List<Integer> sleepDurationMinutes = Lists.newArrayList(80, 299, 360, 510, 780); final List<Integer> correct = Lists.newArrayList(0, 27, 44, 93, 78); for (int i = 0; i < sleepDurationMinutes.size(); i++) { final int score = SleepScoreUtils.getSleepScoreDurationV3(age, durThreshold, sleepDurationMinutes.get(i)); <START> LOGGER.trace("value -> {}", sleepDurationMinutes.get(i), score); <END> assertThat(score, is(correct.get(i))); } }</code><technical_language>LOGGER.trace useful in unit tests</technical_language>

Target:
public void testScoresV3WithParam() { final int age = 23; final int durThreshold = 480; final List<Integer> sleepDurationMinutes = Lists.newArrayList(80, 299, 360, 510, 780); final List<Integer> correct = Lists.newArrayList(0, 27, 44, 93, 78); for (int i = 0; i < sleepDurationMinutes.size(); i++) { final int score = SleepScoreUtils.getSleepScoreDurationV3(1001L, age, durThreshold, sleepDurationMinutes.get(i)); LOGGER.info("value -> {}", sleepDurationMinutes.get(i), score); assertThat(score, is(correct.get(i))); } }
Source:
<code>private static String guessRemote(GitHubSCMSource source) { String apiUri = StringUtils.removeEnd(source.getApiUri(), "/"); if (StringUtils.isBlank(apiUri) || GitHubServerConfig.GITHUB_URL.equals(apiUri)) { apiUri = "<LINK_0>"; } else { apiUri = StringUtils.removeEnd(apiUri, "/"+API_V3); } GitHubSCMSourceHelper helper = GitHubSCMSourceHelper.build(source); <START> return apiUri + "/" + helper.repo + ".git"; <END> }</code><technical_language>changes getters, this reverted, right</technical_language>

Target:
private static String guessRemote(GitHubSCMSource source) { String apiUri = StringUtils.removeEnd(source.getApiUri(), "/"); if (StringUtils.isBlank(apiUri) || GitHubServerConfig.GITHUB_URL.equals(apiUri)) { apiUri = "<LINK_0>"; } else { apiUri = StringUtils.removeEnd(apiUri, "/"+API_V3); } return apiUri + "/" + source.getRepoOwner() + "/" + source.getRepository() + ".git"; }
Source:
<code>public static SessionWork<Integer> getTotalNumberOfTasks(final DBTaskDataParameters params) { return new SessionWork<Integer>() { @Override public Integer executeWork(Session session) { Set<TaskStatus> taskStatuses = params.getStatuses(); if (taskStatuses.isEmpty()) { return 0; } boolean hasUser = params.hasUser(); boolean hasTag = params.hasTag(); boolean hasDateFrom = params.hasDateFrom(); boolean hasDateTo = params.hasDateTo(); String queryPrefix = "select count(*) from TaskData T where "; Query query = getQuery(session, params, taskStatuses, hasUser, hasTag, hasDateFrom, hasDateTo, <START> null, queryPrefix); <END> Long count = (Long) query.uniqueResult(); return count.intValue(); } }; }</code><technical_language>Avoid _null_</technical_language>

Target:
public static SessionWork<Integer> getTotalNumberOfTasks(final DBTaskDataParameters params) { return new SessionWork<Integer>() { @Override public Integer executeWork(Session session) { Set<TaskStatus> taskStatuses = params.getStatuses(); if (taskStatuses.isEmpty()) { return 0; } boolean hasUser = params.hasUser(); boolean hasTag = params.hasTag(); boolean hasDateFrom = params.hasDateFrom(); boolean hasDateTo = params.hasDateTo(); String queryPrefix = "select count(*) from TaskData T where "; Query query = getQuery(session, params, taskStatuses, hasUser, hasTag, hasDateFrom, hasDateTo, SortSpecifierContainer.EMPTY_CONTAINER, queryPrefix); Long count = (Long) query.uniqueResult(); return count.intValue(); } }; }
Source:
<code>public void testSignatureMaskOnExceptionMessage() { final AzureBlobFileSystem fs; String msg = null; try { <START> fs = getFileSystem(); <END> AbfsRestOperation abfsHttpRestOperation = fs.getAbfsClient() .renamePath("testABC/test.xt", "testABC/abc.txt", null); } catch (IOException e) { msg = e.getMessage(); } Assertions.assertThat(msg.substring(msg.indexOf("sig="))) .describedAs("Signature query param should be masked") .startsWith("sig=XXXX"); }</code><technical_language>LambdaTestUtils.intercept(). simpler, (correctly) fail if rest operation raise exception</technical_language>

Target:
public void testSignatureMaskOnExceptionMessage() throws Exception { intercept(IOException.class, "sig=XXXX", () -> getFileSystem().getAbfsClient() .renamePath("testABC/test.xt", "testABC/abc.txt", null)); }
Source:
<code><START> public byte[] evaluateInitialResponse(OAuth2InitialClientMessage initialClientMessage) throws AuthenticationMechanismException, SaslException { <END> if (initialClientMessage.isBearerToken()) { String auth = initialClientMessage.getAuth(); String token = auth.substring(auth.indexOf(" ") + 1); BearerTokenEvidence evidence = new BearerTokenEvidence(token); EvidenceVerifyCallback evidenceVerifyCallback = new EvidenceVerifyCallback(evidence); try { MechanismUtil.handleCallbacks(this.mechanismName, this.callbackHandler, evidenceVerifyCallback); } catch (UnsupportedCallbackException e) { throw log.mechAuthorizationUnsupported(this.mechanismName, e); } if (evidenceVerifyCallback.isVerified()) { AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, null); try { MechanismUtil.handleCallbacks(this.mechanismName, this.callbackHandler, authorizeCallback); } catch (UnsupportedCallbackException e) { throw log.mechAuthorizationUnsupported(this.mechanismName, e); } if (authorizeCallback.isAuthorized()) { return new byte[0]; } } return createErrorMessage(); } throw log.mechInvalidClientMessage(this.mechanismName); }</code><technical_language>add SaslException here</technical_language>

Target:
public byte[] evaluateInitialResponse(OAuth2InitialClientMessage initialClientMessage) throws AuthenticationMechanismException { if (initialClientMessage.isBearerToken()) { String auth = initialClientMessage.getAuth(); String token = auth.substring(auth.indexOf(" ") + 1); BearerTokenEvidence evidence = new BearerTokenEvidence(token); EvidenceVerifyCallback evidenceVerifyCallback = new EvidenceVerifyCallback(evidence); try { MechanismUtil.handleCallbacks(this.mechanismName, this.callbackHandler, evidenceVerifyCallback); } catch (UnsupportedCallbackException e) { throw log.mechAuthorizationUnsupported(this.mechanismName, e); } if (evidenceVerifyCallback.isVerified()) { AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, null); try { MechanismUtil.handleCallbacks(this.mechanismName, this.callbackHandler, authorizeCallback); } catch (UnsupportedCallbackException e) { throw log.mechAuthorizationUnsupported(this.mechanismName, e); } if (authorizeCallback.isAuthorized()) { return new byte[0]; } } return createErrorMessage(); } throw log.mechInvalidClientMessage(this.mechanismName); }
Source:
<code>public NewTableConfiguration attachIterator(IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException { checkArgument(setting != null, "setting is null"); <START> checkArgument(scopes != null, "scopes is null"); <END> if (iteratorProps.isEmpty()) iteratorProps = new HashMap<>(); TableOperationsHelper.checkIteratorConflicts(iteratorProps, setting, scopes); for (IteratorScope scope : scopes) { String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), setting.getName()); for (Entry<String,String> prop : setting.getOptions().entrySet()) { iteratorProps.put(root + ".opt." + prop.getKey(), prop.getValue()); } iteratorProps.put(root, setting.getPriority() + "," + setting.getIteratorClass()); } return this; }</code><technical_language>Objects.requiresNonNull() here</technical_language>

Target:
public NewTableConfiguration attachIterator(IteratorSetting setting, EnumSet<IteratorScope> scopes) { Objects.requireNonNull(setting, "setting cannot be null!"); Objects.requireNonNull(scopes, "scopes cannot be null!"); try { TableOperationsHelper.checkIteratorConflicts(iteratorProps, setting, scopes); } catch (AccumuloException e) { throw new IllegalArgumentException("The specified IteratorSetting conflicts with an iterator already defined on this NewTableConfiguration", e); } for (IteratorScope scope : scopes) { String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), setting.getName()); for (Entry<String,String> prop : setting.getOptions().entrySet()) { iteratorProps.put(root + ".opt." + prop.getKey(), prop.getValue()); } iteratorProps.put(root, setting.getPriority() + "," + setting.getIteratorClass()); checkDisjoint(properties, iteratorProps, "iterator"); } return this; }
Source:
<code>private void createZip(SourceResponse upstreamResponse, String filePath) throws CatalogTransformerException { try (FileOutputStream fileOutputStream = new FileOutputStream(filePath); ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream)) { List<Result> resultList = upstreamResponse.getResults(); Map<String, Resource> resourceMap = new HashMap<>(); resultList .stream() .map(Result::getMetacard) .forEach( metacard -> { writeMetacardToZip(zipOutputStream, metacard); if (hasLocalResources(metacard)) { resourceMap.putAll(getAllMetacardContent(metacard)); } }); resourceMap.forEach( (filename, resource) -> writeResourceToZip(zipOutputStream, filename, resource)); } catch (IOException e) { <START> LOGGER.debug( <END> "Error occurred when initializing/closing ZipOutputStream with path {}.", filePath, e); throw new CatalogTransformerException( String.format( "Error occurred when initializing/closing ZipOutputStream with path %s.", filePath), e); } }</code><technical_language>in debugging throwing here. want hide internals user (although a command line utility, in that) throw internal IOException occurred, debug logging it; otherwise, throw sufficient</technical_language>

Target:
private void createZip(SourceResponse upstreamResponse, String filePath) throws CatalogTransformerException { try (FileOutputStream fileOutputStream = new FileOutputStream(filePath); ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream)) { List<Result> resultList = upstreamResponse.getResults(); Map<String, Resource> resourceMap = new HashMap<>(); resultList .stream() .map(Result::getMetacard) .forEach( metacard -> { writeMetacardToZip(zipOutputStream, metacard); if (hasLocalResources(metacard)) { resourceMap.putAll(getAllMetacardContent(metacard)); } }); resourceMap.forEach( (filename, resource) -> writeResourceToZip(zipOutputStream, filename, resource)); } catch (IOException e) { throw new CatalogTransformerException( String.format( "Error occurred when initializing/closing ZipOutputStream with path %s.", filePath), e); } }
Source:
<code>public String edit() { try { savedId.clear(); ResourceInterface resource = this.loadResource(this.getResourceId()); this.setResourceTypeCode(resource.getType()); List fileDescr = new ArrayList<String>(); fileDescr.add(resource.getDescription()); setFileDescriptions(fileDescr); List<Category> resCategories = resource.getCategories(); <START> for (int i = 0; i < resCategories.size(); i++) { <END> Category resCat = resCategories.get(i); this.getCategoryCodes().add(resCat.getCode()); } this.setMainGroup(resource.getMainGroup()); this.setStrutsAction(ApsAdminSystemConstants.EDIT); } catch (Throwable t) { logger.error("error in edit", t); return FAILURE; } return SUCCESS; }</code><technical_language>new loop strucutre: for(Category cat: resCategories) {..</technical_language>

Target:
public String edit() { try { savedId.clear(); ResourceInterface resource = this.loadResource(this.getResourceId()); this.setResourceTypeCode(resource.getType()); List fileDescr = new ArrayList<String>(); fileDescr.add(resource.getDescription()); setFileDescriptions(fileDescr); List<Category> resCategories = resource.getCategories(); for (Category cat : resCategories) { this.getCategoryCodes().add(cat.getCode()); } this.setMainGroup(resource.getMainGroup()); this.setStrutsAction(ApsAdminSystemConstants.EDIT); } catch (Throwable t) { logger.error("error in edit", t); return FAILURE; } return SUCCESS; }
Source:
<code>public PlanNode visitSort(SortNode node, RewriteContext<LimitContext> context) { LimitContext limit = context.get(); PlanNode rewrittenSource = context.rewrite(node.getSource()); if (limit != null) { return new TopNNode(node.getId(), rewrittenSource, limit.getCount(), node.getOrderingScheme(), TopNNode.Step.SINGLE); } else if (rewrittenSource != node.getSource()) { <START> return new SortNode(node.getId(), rewrittenSource, node.getOrderingScheme(), false); <END> } return node; }</code><technical_language>node.isPartial(), maintain properties of node rewritten</technical_language>

Target:
public PlanNode visitSort(SortNode node, RewriteContext<LimitContext> context) { LimitContext limit = context.get(); PlanNode rewrittenSource = context.rewrite(node.getSource()); if (limit != null) { return new TopNNode(node.getId(), rewrittenSource, limit.getCount(), node.getOrderingScheme(), TopNNode.Step.SINGLE); } else if (rewrittenSource != node.getSource()) { return new SortNode(node.getId(), rewrittenSource, node.getOrderingScheme(), node.isPartial()); } return node; }
Source:
<code>protected Response getIncomingPhoneNumber(final String accountSid, final String sid, final MediaType responseType) { try{ Account operatedAccount = accountsDao.getAccount(accountSid); secure(operatedAccount, "RestComm:Read:IncomingPhoneNumbers"); final IncomingPhoneNumber incomingPhoneNumber = dao.getIncomingPhoneNumber(new Sid(sid)); if (incomingPhoneNumber == null) { return status(NOT_FOUND).build(); } else { if (operatedAccount == null) { return status(BAD_REQUEST).build(); } secure(operatedAccount, incomingPhoneNumber.getAccountSid(), SecuredType.SECURED_STANDARD); if (APPLICATION_JSON_TYPE == responseType) { return ok(gson.toJson(incomingPhoneNumber), APPLICATION_JSON).build(); } else if (APPLICATION_XML_TYPE == responseType) { final RestCommResponse response = new RestCommResponse(incomingPhoneNumber); return ok(xstream.toXML(response), APPLICATION_XML).build(); } else { return null; } } }catch(Exception e){ <START> logger.error("", e); <END> return status(INTERNAL_SERVER_ERROR).build(); } }</code><technical_language>@maria-farooq provide a description log message</technical_language>

Target:
protected Response getIncomingPhoneNumber(final String accountSid, final String sid, final MediaType responseType) { Account operatedAccount = accountsDao.getAccount(accountSid); secure(operatedAccount, "RestComm:Read:IncomingPhoneNumbers"); try{ final IncomingPhoneNumber incomingPhoneNumber = dao.getIncomingPhoneNumber(new Sid(sid)); if (incomingPhoneNumber == null) { return status(NOT_FOUND).build(); } else { if (operatedAccount == null) { return status(BAD_REQUEST).build(); } secure(operatedAccount, incomingPhoneNumber.getAccountSid(), SecuredType.SECURED_STANDARD); if (APPLICATION_JSON_TYPE == responseType) { return ok(gson.toJson(incomingPhoneNumber), APPLICATION_JSON).build(); } else if (APPLICATION_XML_TYPE == responseType) { final RestCommResponse response = new RestCommResponse(incomingPhoneNumber); return ok(xstream.toXML(response), APPLICATION_XML).build(); } else { return null; } } }catch(Exception e){ logger.error("Exception while performing getIncomingPhoneNumber: ", e); return status(INTERNAL_SERVER_ERROR).build(); } }
Source:
<code>public List<BalanceResult> balance(Cluster cluster, List<VDS> hosts, Map<String, String> parameters) { final List<BalanceResult> migrationRule = super.balance(cluster, hosts, parameters); List<VDS> allHosts = vdsDao.getAllForCluster(cluster.getId()); List<VDS> emptyHosts = new ArrayList<>(); List<VDS> maintenanceHosts = new ArrayList<>(); List<VDS> downHosts = new ArrayList<>(); List<VDS> <START> maintenanceHostsWithOkExteranlStatus <END> = new ArrayList<>(); getHostLists(allHosts, emptyHosts, maintenanceHosts, downHosts, maintenanceHostsWithOkExteranlStatus); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( cluster, downHosts, maintenanceHosts, maintenanceHostsWithOkExteranlStatus, emptyHosts, parameters); if (action != null) { processPmAction(action); } return migrationRule; }</code><technical_language>typo</technical_language>

Target:
public List<BalanceResult> balance(Cluster cluster, List<VDS> hosts, Map<String, String> parameters) { final List<BalanceResult> migrationRule = super.balance(cluster, hosts, parameters); List<VDS> allHosts = vdsDao.getAllForCluster(cluster.getId()); List<VDS> emptyHosts = new ArrayList<>(); List<VDS> maintenanceHosts = new ArrayList<>(); List<VDS> downHosts = new ArrayList<>(); List<VDS> maintenanceHostsWithOkExternalStatus = new ArrayList<>(); getHostLists(allHosts, emptyHosts, maintenanceHosts, downHosts, maintenanceHostsWithOkExternalStatus); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( cluster, downHosts, maintenanceHosts, maintenanceHostsWithOkExternalStatus, emptyHosts, parameters); if (action != null) { processPmAction(action); } return migrationRule; }
Source:
<code>public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } String number = ns.getString("number"); String name = ns.getString("name"); try { m.setContactName(number, name); <START> int expiration = 0; <END> if (ns.getInt("expiration") != null) { expiration = ns.getInt("expiration"); m.setExpirationTimer(number, expiration); } } catch (InvalidNumberException e) { System.out.println("Invalid contact number: " + e.getMessage()); } return 0; }</code><technical_language>expiration Integer assign here, this: java Integer expiration = ns.getInt("expiration"); if (expiration != null) { m.setExpirationTimer(number, expiration); }</technical_language>

Target:
public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } String number = ns.getString("number"); String name = ns.getString("name"); try { m.setContactName(number, name); Integer expiration = ns.getInt("expiration"); if (expiration != null) { m.setExpirationTimer(number, expiration); } } catch (InvalidNumberException e) { System.out.println("Invalid contact number: " + e.getMessage()); } catch (IOException e) { System.err.println("Update contact error: " + e.getMessage()); return 3; } return 0; }
Source:
<code>public boolean removeAttributeWithoutCheck(PerunSession sess, Resource resource, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, NS_RESOURCE_ATTR); if (getAttributesManagerImpl().isCoreAttribute(sess, attribute)) throw new WrongAttributeAssignmentException(attribute); boolean changed; try { if (this.isVirtAttribute(sess, attribute)) { changed = getAttributesManagerImpl().removeVirtualAttribute(sess, resource, attribute); } else { changed = getAttributesManagerImpl().removeAttribute(sess, resource, attribute); } if (changed) getAttributesManagerImpl().changedAttributeHook(sess, resource, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } if (changed) <START> log.info("{} removed attribute({}) from esource. Id resource = {}",sess.getPerunClient().getId(), attribute.getName(), resource.getId()); <END> getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), resource); return changed; }</code><technical_language>esource -> resource want () is replaced for attr name, in other messages do that</technical_language>

Target:
public boolean removeAttributeWithoutCheck(PerunSession sess, Resource resource, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, NS_RESOURCE_ATTR); if (getAttributesManagerImpl().isCoreAttribute(sess, attribute)) throw new WrongAttributeAssignmentException(attribute); boolean changed; try { if (this.isVirtAttribute(sess, attribute)) { changed = getAttributesManagerImpl().removeVirtualAttribute(sess, resource, attribute); } else { changed = getAttributesManagerImpl().removeAttribute(sess, resource, attribute); } if (changed) getAttributesManagerImpl().changedAttributeHook(sess, resource, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } if (changed) log.info("{} removed attribute from resource {}.",sess.getLogId(), attribute.getName(), resource.getId()); getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), resource); return changed; }
Source:
<code>public ContextAction(StandardActions command, LinkedFileViewModel linkedFile, PreferencesService preferencesService) { this.command = command; this.linkedFile = linkedFile; this.executable.bind( switch (command) { case RENAME_FILE_TO_PATTERN -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent() && !linkedFile.isGeneratedNameSameAsOriginal(), linkedFile.getFile().linkProperty()); case MOVE_FILE_TO_FOLDER_AND_RENAME, MOVE_FILE_TO_FOLDER -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent() <START> && !linkedFile.isGeneratedPathSameAsOriginal(), <END> linkedFile.getFile().linkProperty()); case DOWNLOAD_FILE -> Bindings.createBooleanBinding( () -> linkedFile.getFile().isOnlineLink(), linkedFile.getFile().linkProperty()); case OPEN_FILE, OPEN_FOLDER, RENAME_FILE_TO_NAME, DELETE_FILE -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent(), linkedFile.getFile().linkProperty()); default -> BindingsHelper.constantOf(true); }); }</code><technical_language>MOVE_FILE_TO_FOLDER_AND_RENAME enabled if file is in correct folder, of correct name, not</technical_language>

Target:
public ContextAction(StandardActions command, LinkedFileViewModel linkedFile, PreferencesService preferencesService) { this.command = command; this.linkedFile = linkedFile; this.executable.bind( switch (command) { case RENAME_FILE_TO_PATTERN, MOVE_FILE_TO_FOLDER_AND_RENAME -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent() && !linkedFile.isGeneratedNameSameAsOriginal(), linkedFile.getFile().linkProperty()); case MOVE_FILE_TO_FOLDER -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent() && !linkedFile.isGeneratedPathSameAsOriginal(), linkedFile.getFile().linkProperty()); case DOWNLOAD_FILE -> Bindings.createBooleanBinding( () -> linkedFile.getFile().isOnlineLink(), linkedFile.getFile().linkProperty()); case OPEN_FILE, OPEN_FOLDER, RENAME_FILE_TO_NAME, DELETE_FILE -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent(), linkedFile.getFile().linkProperty()); default -> BindingsHelper.constantOf(true); }); }
Source:
<code>private void _setVdsmId(String vdsmid) { if (vdsmid == null) { throw new SoftError("Cannot acquire node id"); } log.infoFormat( "Host {0} reports unique id {1}", _vds.gethost_name(), vdsmid ); final List<VDS> list = LinqUtils.filter( DbFacade.getInstance().getVdsDao().getAllWithUniqueId(vdsmid), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return !vds.getId().equals(_vds.getId()); } } ); if (!list.isEmpty()) { final StringBuilder hosts = new StringBuilder(1024); for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getvds_name()); } log.errorFormat( "Host {0} reports duplicate unique id {1} of following hosts {2}", _vds.gethost_name(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", _vds.gethost_name(), hosts ) ); } <START> log.infoFormat("Assigning unique id {0} to Host {1}", _vds.gethost_name(), vdsmid); <END> _vds.setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); return null; } }); }</code><technical_language>arguments swapped</technical_language>

Target:
private void _setVdsmId(String vdsmid) { if (vdsmid == null) { throw new SoftError("Cannot acquire node id"); } log.infoFormat( "Host {0} reports unique id {1}", _vds.gethost_name(), vdsmid ); final List<VDS> list = LinqUtils.filter( DbFacade.getInstance().getVdsDao().getAllWithUniqueId(vdsmid), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return !vds.getId().equals(_vds.getId()); } } ); if (!list.isEmpty()) { final StringBuilder hosts = new StringBuilder(1024); for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getvds_name()); } log.errorFormat( "Host {0} reports duplicate unique id {1} of following hosts {2}", _vds.gethost_name(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", _vds.gethost_name(), hosts ) ); } log.infoFormat("Assigning unique id {0} to Host {1}", vdsmid, _vds.gethost_name()); _vds.setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); return null; } }); }
Source:
<code>public ParsedToken decode(String tokenString) throws InvalidTokenException { ValidToken token; try { <START> token = restToken.checkToken(tokenString, null); <END> } catch (XsrfException err) { throw new InvalidTokenException(err); } if (token == null || token.getData() == null || token.getData().isEmpty()) { throw new InvalidTokenException(); } String payload; try { payload = new String(Base64.decode(token.getData()), "UTF-8"); } catch (UnsupportedEncodingException err) { throw new InvalidTokenException(err); } int colonPos = payload.indexOf(':'); if (colonPos == -1) { throw new InvalidTokenException(); } String user; try { user = payload.substring(0, colonPos); } catch (IllegalArgumentException err) { throw new InvalidTokenException(err); } String url = payload.substring(colonPos+1); return new ParsedToken(user, url); }</code><technical_language>Base64 contains = a trailing padding character. If is present, run "token=$base64" in POST input a form, = is eaten form data parser? years I worried standard for form encoding, =, & % special encoded avoid sorts of problems</technical_language>

Target:
public ParsedToken decode(String tokenString) throws InvalidTokenException { ValidToken token; try { token = restToken.checkToken(tokenString, null); } catch (XsrfException err) { throw new InvalidTokenException(err); } if (token == null || token.getData() == null || token.getData().isEmpty()) { throw new InvalidTokenException(); } String payload; try { payload = new String(Base64.decode(token.getData()), "UTF-8"); } catch (UnsupportedEncodingException err) { throw new InvalidTokenException(err); } int colonPos = payload.indexOf(':'); if (colonPos == -1) { throw new InvalidTokenException(); } Account.Id user; try { user = Account.Id.parse(payload.substring(0, colonPos)); } catch (IllegalArgumentException err) { throw new InvalidTokenException(err); } String url = payload.substring(colonPos+1); return new ParsedToken(user, url); }
Source:
<code>public String handleGeneralExceptions(Exception e){ <START> return ("500: General Unhandled Exception<br>"+e.getMessage()); <END> }</code><technical_language>I want return generic server exceptions in payload UI. This nasty habit of exposing pieces of workings of a service world. Generally swallow unhandled exceptions log for developers/debugging</technical_language>

Target:
public String handleGeneralExceptions(Exception e){ LogSystem.LogEvent("Unhandled Exception - "+e.getMessage()); return ("500: General Unhandled Exception"); }
Source:
<code>private Set<File> getSiteFeaturesAndPlugins(File basedir) throws MojoExecutionException { try { Set<File> result = new LinkedHashSet<File>(); UpdateSite site; File siteFile = new File(basedir, "site.xml"); File categoryFile = new File(basedir, "category.xml"); if (siteFile.exists()) { site = UpdateSite.read(siteFile); } else { site = UpdateSite.read(categoryFile); <START> } <END> for (FeatureRef feature : site.getFeatures()) { addFeature(result, feature.getId()); } return result; } catch (Exception e) { throw new MojoExecutionException("Could not collect update site features and plugins", e); } }</code><technical_language>this is for eclipse-update-site. a special "aggregator pom" (poma.xml) I understand there/what useful for, ignore this for eclipse-repository before</technical_language>

Target:
private Set<File> getSiteFeaturesAndPlugins(File basedir) throws MojoExecutionException { try { Set<File> result = new LinkedHashSet<File>(); UpdateSite site; File siteFile = new File(basedir, "site.xml"); if (siteFile.exists()) { site = UpdateSite.read(siteFile); for (FeatureRef feature : site.getFeatures()) { addFeature(result, feature.getId()); } } return result; } catch (Exception e) { throw new MojoExecutionException("Could not collect update site features and plugins", e); } }
Source:
<code>private String getDefaultOrigins() { List<VDS> allVds = vdsDao.getAll(getUserID(), <START> getParameters().isFiltered()); <END> StringBuilder sb = new StringBuilder(); for (VDS vds : allVds) { if (sb.length() > 0) { sb.append(','); } sb.append(HTTPS); sb.append(vds.getHostName()); } String result = sb.toString(); log.debug("Default list of origins refreshed to: {}" , result); return result; }</code><technical_language>This filtered, in theory list of allowed origins depend permissions of user. I VdsDao.getAll(), parameters. suggest add a new method, a new stored procedure, get host names, attributes of host, is a waste of resources (joins, etc)</technical_language>

Target:
private Set<String> getDefaultOrigins() { log.debug("getDefaultOrigins() called"); List<VDS> allVds = vdsDao.getAll(getUserID(), getParameters().isFiltered()); Set<String> result = new HashSet<>(); for (VDS vds : allVds) { if (getParameters().getSuffixes().size() > 0) { for (String suffix : getParameters().getSuffixes()) { result.add(HTTPS + vds.getHostName() + suffix); } } else { result.add(HTTPS + vds.getHostName()); } } log.debug("Default list of origins refreshed to: {}" , StringUtils.join(result, ',')); return result; }
Source:
<code>protected void executeCommand() { if (getVds() == null) { return; } log.info("Before Installation host {}, {}", getVds().getId(), getVds().getName()); try { setVdsStatus(VDSStatus.Installing); if (getParameters().getAuthMethod() == AuthenticationMethod.Password) { copyEngineSshId(); } String gluster_maintenance_old_node = getVds().getName(); VdsStatic vdsStatic = vdsStaticDao.get(getVds().getId()); List<VdsStatic> vdsStatics = vdsStaticDao.getAllForCluster(vdsStatic.getClusterId()); String gluster_maintenance_cluster_node = null; String gluster_maintenance_cluster_node_2 = null; if(vdsStatics.size()>1) { for (VdsStatic vdsStatic2 : vdsStatics) { if (vdsStatic2.getHostName() != gluster_maintenance_old_node && vdsStatic2.getHostName() != gluster_maintenance_cluster_node) { gluster_maintenance_cluster_node = vdsStatic2.getHostName(); } else if (vdsStatic2.getHostName() != gluster_maintenance_old_node && vdsStatic2.getHostName() != gluster_maintenance_cluster_node_2) { gluster_maintenance_cluster_node_2 = vdsStatic2.getHostName(); } } } <START> <END> runAnsibleHostDeployPlaybook(); if(getParameters().getReconfigureGluster()) { runAnsibleReconfigureGluster(); } markCurrentCmdlineAsStored(); markVdsReinstalled(); configureManagementNetwork(); if (!getParameters().getActivateHost()) { setVdsStatus(VDSStatus.Maintenance); } else { setVdsStatus(VDSStatus.Initializing); } log.info("After Installation host {}, {}", getVds().getName(), getVds().getVdsType().name()); setSucceeded(true); } catch (VdsInstallException e) { handleError(e, e.getStatus()); } catch (Exception e) { handleError(e, VDSStatus.InstallFailed); } }</code><technical_language>logic called if reconfigure gluster option is selected</technical_language>

Target:
protected void executeCommand() { if (getVds() == null) { return; } log.info("Before Installation host {}, {}", getVds().getId(), getVds().getName()); try { setVdsStatus(VDSStatus.Installing); if (getParameters().getAuthMethod() == AuthenticationMethod.Password) { copyEngineSshId(); } runAnsibleHostDeployPlaybook(); if(getParameters().getReconfigureGluster()) { runAnsibleReconfigureGluster(); } markCurrentCmdlineAsStored(); markVdsReinstalled(); configureManagementNetwork(); if (!getParameters().getActivateHost()) { setVdsStatus(VDSStatus.Maintenance); } else { setVdsStatus(VDSStatus.Initializing); } log.info("After Installation host {}, {}", getVds().getName(), getVds().getVdsType().name()); setSucceeded(true); } catch (VdsInstallException e) { handleError(e, e.getStatus()); } catch (Exception e) { handleError(e, VDSStatus.InstallFailed); } }
Source:
<code>public void close() { try { delegate.close(connectionSupplier.getConnection()); } catch (Exception e) { throw new MuleRuntimeException(createStaticMessage(COULD_NOT_OBTAIN_A_CONNECTION), e); } finally { <START> connectionSupplier.close(); <END> connectionSupplierFactory.dispose(); } }</code><technical_language>safely()</technical_language>

Target:
public void close() { ConnectionSupplier connectionSupplier = null; try { connectionSupplier = connectionSupplierFactory.getConnectionSupplier(); delegate.close(connectionSupplier.getConnection()); } catch (Exception e) { throw new MuleRuntimeException(createStaticMessage(COULD_NOT_OBTAIN_A_CONNECTION), e); } finally { if (connectionSupplier != null) { safely(connectionSupplier::close, e -> LOGGER.debug("Found exception closing the connection supplier", e)); } connectionSupplierFactory.dispose(); } }