auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void close() { if (_closed) { LOG.debug("Iterator was already closed. Ignoring current close command."); return; } try { _rs.close(); _stmt.executeUpdate(new SqlStringBuilder().append("HANDLER ") .appendIdent(_source.getTableName(), "Iterator") .append(" CLOSE") .toString()); _stmt.close(); <START> _conn.close(); <END> } catch (SQLException e) { } _closed = true; }</code><technical_language>Move this finally block</technical_language>

Target:
public void close() { if (_closed) { LOG.debug("Iterator was already closed. Ignoring current close command."); return; } try { _rs.close(); _stmt.executeUpdate(new SqlStringBuilder().append("HANDLER ") .appendIdent(_source.getTableName(), "Iterator") .append(" CLOSE") .toString()); } catch (SQLException e) { LOG.warn("Closing the handler threw an exception", e); } finally { try { _stmt.close(); _conn.close(); } catch (SQLException e) { LOG.warn("Closing the Mysql connnection threw an exception", e); } _closed = true; } }
Source:
<code>public OsExecutionGraphProvider(ITmfTrace trace) { super(trace, "LTTng Kernel"); fSystem = new OsSystemModel(); IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TMF_GRAPH_HANDLER_ID); for (IConfigurationElement ce : config) { String elementName = ce.getName(); <START> if (elementName.equals(HANDLER)) { <END> IOsExecutionGraphHandlerBuilder builder; try { builder = (IOsExecutionGraphHandlerBuilder) ce.createExecutableExtension(ATTRIBUTE_CLASS); } catch (CoreException e1) { Activator.getDefault().logWarning("Error create execution graph handler builder", e1); continue; } String priorityStr = ce.getAttribute(ATTRIBUTE_PRIORITY); int priority = DEFAULT_PRIORITY; try { priority = Integer.valueOf(priorityStr); } catch (NumberFormatException e) { } ITraceEventHandler handler = builder.createHandler(this, priority); registerHandler(handler); } } }</code><technical_language>swap Objects.equals</technical_language>

Target:
public OsExecutionGraphProvider(ITmfTrace trace) { super(trace, "LTTng Kernel"); fSystem = new OsSystemModel(); IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TMF_GRAPH_HANDLER_ID); for (IConfigurationElement ce : config) { String elementName = ce.getName(); if (HANDLER.equals(elementName)) { IOsExecutionGraphHandlerBuilder builder; try { builder = (IOsExecutionGraphHandlerBuilder) ce.createExecutableExtension(ATTRIBUTE_CLASS); } catch (CoreException e1) { Activator.getDefault().logWarning("Error create execution graph handler builder", e1); continue; } String priorityStr = ce.getAttribute(ATTRIBUTE_PRIORITY); int priority = DEFAULT_PRIORITY; try { priority = Integer.valueOf(priorityStr); } catch (NumberFormatException e) { } ITraceEventHandler handler = builder.createHandler(this, priority); registerHandler(handler); } } }
Source:
<code>public String[] getHiveArgs(String... args) throws IOException { List<String> newArgs = new LinkedList<>(); newArgs.addAll(Arrays.asList(args)); <START> addHiveConfigs(hiveConf, conf); <END> if (conf.getBoolean(HIVE_SASL_ENABLED, false)) { newArgs.add("--hiveconf"); newArgs.add("hive.metastore.sasl.enabled=true"); } return newArgs.toArray(new String[newArgs.size()]); }</code><technical_language>add hive configs once? hiveConf conf parameters this method</technical_language>

Target:
private String[] getHiveArgs(String... args) throws IOException { List<String> newArgs = new LinkedList<>(); newArgs.addAll(Arrays.asList(args)); if (hiveConf.getBoolean(HIVE_SASL_ENABLED, false)) { newArgs.add("--hiveconf"); newArgs.add("hive.metastore.sasl.enabled=true"); } return newArgs.toArray(new String[newArgs.size()]); }
Source:
<code>public void writeTo(ObjectOutput output) throws IOException { output.writeObject(key); output.writeObject(f); Params.writeObject(output, params); <START> output.writeObject(encodingClasses); <END> }</code><technical_language>uuuf... of Class instance is serialized a FQCN-long representation, easily 50 bytes. 2 classes 2 wrappers, this is 200 bytes command. a way</technical_language>

Target:
public void writeTo(ObjectOutput output) throws IOException { output.writeObject(key); output.writeObject(f); Params.writeObject(output, params); EncodingClasses.writeTo(output, encodingClasses); }
Source:
<code>public IsWidget getWidget() { <START> return (getView() == null) ? null : getView().asWidget(); <END> }</code><technical_language>return getView();</technical_language>

Target:
public Widget getWidget() { return asWidget(); }
Source:
<code>private Boolean areTransparencyAttestationsEqual(TransparencyAttestationDTO a, TransparencyAttestationDTO b) { <START> if (a == null || b == null) { <END> return true; } else { return StringUtils.equals(a.getTransparencyAttestation(), b.getTransparencyAttestation()); } }</code><technical_language>this &&? equal if exists other doesn't</technical_language>

Target:
private Boolean areTransparencyAttestationsEqual(TransparencyAttestationDTO a, TransparencyAttestationDTO b) { if (a == null && b == null) { return true; } else if (a == null || b == null) { return false; } else { return StringUtils.equals(a.getTransparencyAttestation(), b.getTransparencyAttestation()); } }
Source:
<code>public void addPartitionToFactStorage(GrillSessionHandle sessionid, String fact, String storageName, XPartition partition) throws GrillException { acquire(sessionid); <START> try { <END> CubeFactTable factTable = checkFactStorage(sessionid, fact, storageName); getClient(sessionid).addPartition( JAXBUtils.storagePartSpecFromXPartition(partition), storageName); LOG.info("Added partition for fact " + fact + " on storage:" + storageName + " dates: " + partition.getTimePartitionSpec() + " spec:" + partition.getNonTimePartitionSpec() + " update period: " + partition.getUpdatePeriod()); } catch (HiveException exc) { throw new GrillException(exc); } finally { release(sessionid); } }</code><technical_language>is change required</technical_language>

Target:
public void addPartitionToFactStorage(GrillSessionHandle sessionid, String fact, String storageName, XPartition partition) throws GrillException { try { acquire(sessionid); CubeFactTable factTable = checkFactStorage(sessionid, fact, storageName); getClient(sessionid).addPartition( JAXBUtils.storagePartSpecFromXPartition(partition), storageName); LOG.info("Added partition for fact " + fact + " on storage:" + storageName + " dates: " + partition.getTimePartitionSpec() + " spec:" + partition.getNonTimePartitionSpec() + " update period: " + partition.getUpdatePeriod()); } catch (HiveException exc) { throw new GrillException(exc); } finally { release(sessionid); } }
Source:
<code>public Object apply(ProjectResource rsrc, Input input) throws UnprocessableEntityException, ResourceConflictException, OrmException, IOException { Project project = rsrc.getControl().getProject(); <START> if (project.getName().endsWith(AllProjectsNameProvider.DEFAULT)) { <END> throw new UnprocessableEntityException(AllProjectsNameProvider.DEFAULT); } try { databaseDeleteHandler.assertCanDelete(project); } catch (CannotDeleteProjectException e) { throw new UnprocessableEntityException(e.getMessage()); } if (input == null || !input.force) { Collection<String> warnings = databaseDeleteHandler.getWarnings(project); if (warnings != null && !warnings.isEmpty()) { throw new ResourceConflictException(String .format("Project %s has open changes", project.getName())); } } databaseDeleteHandler.delete(project); filesystemDeleteHandler.delete(project, input == null ? false : input.preserve); cacheDeleteHandler.delete(project); return Response.none(); }</code><technical_language>'endsWith" 'equals'? is safe AllProjectsNameProvider.DEFAULT for comparison. This is default, a Gerrit server All-Projects project another name. get All-Projects name injected: AllProjectsName allProjects</technical_language>

Target:
public Object apply(ProjectResource rsrc, Input input) throws ResourceConflictException, OrmException, IOException, MethodNotAllowedException { Project project = rsrc.getControl().getProject(); if (project.getNameKey().equals(allProjectsName)) { throw new MethodNotAllowedException(); } try { databaseDeleteHandler.assertCanDelete(project); } catch (CannotDeleteProjectException e) { throw new ResourceConflictException(e.getMessage()); } if (input == null || !input.force) { Collection<String> warnings = databaseDeleteHandler.getWarnings(project); if (warnings != null && !warnings.isEmpty()) { throw new ResourceConflictException(String.format( "Project %s has open changes", project.getName())); } } databaseDeleteHandler.delete(project); filesystemDeleteHandler.delete(project, input == null ? false : input.preserve); cacheDeleteHandler.delete(project); return Response.none(); }
Source:
<code>private void writePowerEvents() { if (volatileRun) { <START> writer.writeStartElement("on_reboot"); writer.writeRaw("destroy"); writer.writeEndElement(); <END> } }</code><technical_language>if push another patch-set, please replace this writeElement</technical_language>

Target:
private void writePowerEvents() { if (volatileRun) { writer.writeElement("on_reboot", "destroy"); } }
Source:
<code>public int[] getDeleteDbOrds(int ord) { dumpChanges(); Timber.d("getDeleteDbOrds()"); int[] deletedDbOrds = new int[0]; for (int i = 0; i <= mTemplateChanges.size(); i++) { int ordinalAdjustment = 0; Object[] currentChange = { ord, ChangeType.DELETE }; if (i < mTemplateChanges.size()) { currentChange = mTemplateChanges.get(i); } if (currentChange[1] != ChangeType.DELETE) { continue; } for (int j = 0; j < i; j++) { Object[] previousChange = mTemplateChanges.get(j); if ((previousChange[1] == ChangeType.DELETE) && ((int)previousChange[0] <= (int)currentChange[0])) { ordinalAdjustment++; } } <START> deletedDbOrds = Arrays.copyOf(deletedDbOrds, deletedDbOrds.length + 1); <END> deletedDbOrds[deletedDbOrds.length-1] = (int)currentChange[0] + ordinalAdjustment; } return deletedDbOrds; }</code><technical_language>more sense a list here. if this is done due jank in Java primitive lists, favour clarity speed here</technical_language>

Target:
public int[] getDeleteDbOrds(int ord) { dumpChanges(); Timber.d("getDeleteDbOrds()"); ArrayList<Integer> deletedDbOrds = new ArrayList<>(); for (int i = 0; i <= mTemplateChanges.size(); i++) { int ordinalAdjustment = 0; Object[] currentChange = { ord, ChangeType.DELETE }; if (i < mTemplateChanges.size()) { currentChange = mTemplateChanges.get(i); } if (currentChange[1] != ChangeType.DELETE) { continue; } for (int j = 0; j < i; j++) { Object[] previousChange = mTemplateChanges.get(j); if ((previousChange[1] == ChangeType.DELETE) && ((int)previousChange[0] <= (int)currentChange[0])) { ordinalAdjustment++; } } deletedDbOrds.add((int)currentChange[0] + ordinalAdjustment); } int[] deletedDbOrdInts = new int[deletedDbOrds.size()]; for (int i = 0; i < deletedDbOrdInts.length; i++) { deletedDbOrdInts[i] = (deletedDbOrds.get(i)); } return deletedDbOrdInts; }
Source:
<code>private void fetchRelatedEntities(GlusterVolumeEntity volume) { if (volume != null) { volume.setOptions(dbFacade.getGlusterOptionDao().getOptionsOfVolume(volume.getId())); volume.setAccessProtocols(new HashSet<AccessProtocol>(getAccessProtocolsOfVolume(volume.getId()))); volume.setTransportTypes(new HashSet<TransportType>(getTransportTypesOfVolume(volume.getId()))); volume.setAsyncTask(getAsyncTaskOfVolume(volume.getId())); List<GlusterBrickEntity> bricks = dbFacade.getGlusterBrickDao().getBricksOfVolume(volume.getId()); if (volume.getAsyncTask()!=null && volume.getAsyncTask().getTaskId() != null) { for (GlusterBrickEntity brick: bricks) { <START> if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId().equals(volume.getAsyncTask().getTaskId())) { <END> brick.setAsyncTask(volume.getAsyncTask()); } } } volume.setBricks(bricks); } }</code><technical_language>Potential NPE if brick.getAsyncTask().getTaskId() returns null</technical_language>

Target:
private void fetchRelatedEntities(GlusterVolumeEntity volume) { if (volume != null) { volume.setOptions(dbFacade.getGlusterOptionDao().getOptionsOfVolume(volume.getId())); volume.setAccessProtocols(new HashSet<AccessProtocol>(getAccessProtocolsOfVolume(volume.getId()))); volume.setTransportTypes(new HashSet<TransportType>(getTransportTypesOfVolume(volume.getId()))); volume.setAsyncTask(getAsyncTaskOfVolume(volume.getId())); List<GlusterBrickEntity> bricks = dbFacade.getGlusterBrickDao().getBricksOfVolume(volume.getId()); if (volume.getAsyncTask()!=null && volume.getAsyncTask().getTaskId() != null) { for (GlusterBrickEntity brick: bricks) { if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volume.getAsyncTask().getTaskId())) { brick.setAsyncTask(volume.getAsyncTask()); } } } volume.setBricks(bricks); } }
Source:
<code>protected void checkAdditionalConstraints() { InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId); int numOfQuestionsToGet = data.bundle.questionResponseBundle.size(); for (int questionIndx = 1; questionIndx <= numOfQuestionsToGet; questionIndx++) { String questionId = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_ID + "-" + questionIndx); if (questionId == null) { continue; } FeedbackQuestionAttributes questionAttributes = data.bundle.getQuestionAttributes(questionId); if (questionAttributes == null) { statusToUser.add(new StatusMessage("The feedback session or questions may have changed while you were submitting. " + "Please check your responses to make sure they are saved correctly.", StatusMessageColor.WARNING)); isError = true; log.warning("Question not found. (deleted or invalid id passed?) id: "+ questionId + " index: " + questionIndx); continue; } boolean isGiverVisibleToInstructors = questionAttributes.showGiverNameTo.contains(FeedbackParticipantType.INSTRUCTORS); boolean isRecipientVisibleToInstructors = questionAttributes.showRecipientNameTo.contains(FeedbackParticipantType.INSTRUCTORS); boolean isResponseVisibleToInstructors = questionAttributes.showResponsesTo.contains(FeedbackParticipantType.INSTRUCTORS); if (!isResponseVisibleToInstructors || !isGiverVisibleToInstructors || !isRecipientVisibleToInstructors) { isError = true; throw new UnauthorizedAccessException( "Feedback session [" + feedbackSessionName + "] question [" + questionAttributes.getId() + "] is not accessible to instructor ["+ instructor.email + "]"); } <START> } <END> }</code><technical_language>Body of for loop is long. Increase SLAP</technical_language>

Target:
protected void checkAdditionalConstraints() { InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId); int numOfQuestionsToGet = data.bundle.questionResponseBundle.size(); for (int questionIndx = 1; questionIndx <= numOfQuestionsToGet; questionIndx++) { String paramMapKey = Const.ParamsNames.FEEDBACK_QUESTION_ID + "-" + questionIndx; String questionId = HttpRequestHelper.getValueFromParamMap(requestParameters, paramMapKey); if (questionId == null) { continue; } FeedbackQuestionAttributes questionAttributes = data.bundle.getQuestionAttributes(questionId); if (questionAttributes == null) { statusToUser.add(new StatusMessage("The feedback session or questions may have changed while you were submitting. " + "Please check your responses to make sure they are saved correctly.", StatusMessageColor.WARNING)); isError = true; log.warning("Question not found in Feedback Session [" + feedbackSessionName + "] of Course ID [" + courseId + "]." + "(deleted or invalid id passed?) id: "+ questionId + " index: " + questionIndx); continue; } checkSessionQuestionAccessPermission(instructor, questionAttributes); } }
Source:
<code>public @Nullable ClassSymbol findClassInPackage(String name, PackageSymbol pck, TreePath path) { Log.DiagnosticHandler discardDiagnosticHandler = new Log.DiscardDiagnosticHandler(log); try { Env<AttrContext> env = getEnvForPath(path); Element res = wrapInvocationOnResolveInstance( FIND_IDENT_IN_PACKAGE, env, pck, names.fromString(name), Kinds.KindSelector.TYP); <START> if (res.getKind().isClass() || res.getKind().isInterface()) { <END> return (ClassSymbol) res; } else { return null; } } finally { log.popDiagnosticHandler(discardDiagnosticHandler); } }</code><technical_language>This is fine, ElementUtils.isClassElement shorter easier read</technical_language>

Target:
public @Nullable ClassSymbol findClassInPackage(String name, PackageSymbol pck, TreePath path) { Log.DiagnosticHandler discardDiagnosticHandler = new Log.DiscardDiagnosticHandler(log); try { Env<AttrContext> env = getEnvForPath(path); Element res = wrapInvocationOnResolveInstance( FIND_IDENT_IN_PACKAGE, env, pck, names.fromString(name), Kinds.KindSelector.TYP); if (ElementUtils.isClassElement(res)) { return (ClassSymbol) res; } else { return null; } } finally { log.popDiagnosticHandler(discardDiagnosticHandler); } }
Source:
<code>private Warning<RangeHighlighterEx> createWarningFromRangeHighlighter(@NotNull RangeHighlighterEx rangeHighlighterEx, DateTime creationTime) { final DateTime now = DateTime.now(); return new Warning<>( rangeHighlighterEx, getLineNumberForHighlighter(rangeHighlighterEx), now.toDate(), <START> creationTime == null ? -1 : Seconds.secondsBetween(creationTime, now).getSeconds() <END> ); }</code><technical_language>avoid ? operator in WatchDog</technical_language>

Target:
private Warning<RangeHighlighterEx> createWarningFromRangeHighlighter(@NotNull RangeHighlighterEx rangeHighlighterEx, DateTime creationTime) { final DateTime now = DateTime.now(); int seconds; if (creationTime == null) { seconds = -1; } else { seconds = Seconds.secondsBetween(creationTime, now).getSeconds(); } return new Warning<>( rangeHighlighterEx, getLineNumberForHighlighter(rangeHighlighterEx), now.toDate(), seconds ); }
Source:
<code>public static String visibilityName(int visibility) { switch (visibility) { case ICPPClassType.v_private: return "private"; case ICPPClassType.v_protected: return "protected"; case ICPPClassType.v_public: return "public"; default: <START> throw new IllegalArgumentException("illegal visibility: " + visibility); <END> } }</code><technical_language>Please capitalize "Illegal"</technical_language>

Target:
public static String visibilityName(int visibility) { switch (visibility) { case ICPPClassType.v_private: return "private"; case ICPPClassType.v_protected: return "protected"; case ICPPClassType.v_public: return "public"; default: throw new IllegalArgumentException("Illegal visibility: " + visibility); } }
Source:
<code>public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { LOG.warn("Ignite does not support scan semantics"); <START> return Status.OK; <END> }</code><technical_language>Status.NOT_IMPLEMENTED then..</technical_language>

Target:
public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { LOG.warn("Ignite does not support scan semantics"); return Status.NOT_IMPLEMENTED; }
Source:
<code><START> private boolean isSAM(ClassTree classBody) { <END> if(hasOnlyOneMethod(classBody.members()) && classBody.symbol().isTypeSymbol()) { JavaSymbol.TypeJavaSymbol symbol = (JavaSymbol.TypeJavaSymbol) classBody.symbol(); return symbol.getInterfaces().size() == 1 && symbol.getSuperclass().is("java.lang.Object"); } return false; }</code><technical_language>![MAJOR](<LINK_0> "isSAM" a "static" method. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private static boolean isSAM(ClassTree classBody) { if(hasOnlyOneMethod(classBody.members()) && classBody.symbol().isTypeSymbol()) { JavaSymbol.TypeJavaSymbol symbol = (JavaSymbol.TypeJavaSymbol) classBody.symbol(); return symbol.getInterfaces().size() == 1 && symbol.getSuperclass().is("java.lang.Object"); } return false; }
Source:
<code>public void configure(Map<String, ?> configs) { <START> this.name = (String) configs.get(NAME_CONFIG_KEY); <END> }</code><technical_language>consider a [SimpleConfig](<LINK_0> here. a huge difference class as-is, easier changes in future if want expand configurability of this predicate</technical_language>

Target:
public void configure(Map<String, ?> configs) { this.name = new SimpleConfig(config(), configs).getString(NAME_CONFIG); }
Source:
<code>public static long parseTimestampWithoutTimeZone(String value) { LocalDateTime localDateTime = TIMESTAMP_WITH_OR_WITHOUT_TIME_ZONE_FORMATTER.parseLocalDateTime(value); try { <START> return (Long) getLocalMillis.invoke(localDateTime); <END> } catch (Throwable e) { throw new RuntimeException(e); } }</code><technical_language>invokeExact is @PolymorphicSignature, return primitives directly. If change (Long) (long), able avoid boxing, able more efficient invokeExact. return (long) getLocalMillis.invokeExact(localDateTime);</technical_language>

Target:
public static long parseTimestampWithoutTimeZone(String value) { LocalDateTime localDateTime = TIMESTAMP_WITH_OR_WITHOUT_TIME_ZONE_FORMATTER.parseLocalDateTime(value); try { return (long) getLocalMillis.invokeExact(localDateTime); } catch (Throwable e) { throw new RuntimeException(e); } }
Source:
<code>public void unBanUser(String userName, WebDriver driver) { WebElement unbanLink = driver.findElement(By.xpath( String.format(userUnbanLink, userName) )); waitForElementByElement(unbanLink); unbanLink.click(); verifyChatUnbanMessage(userName); PageObjectLogging.log("unBanUser", userName+" is no longer banned", <START> true, driver); <END> }</code><technical_language>remove 'driver' parameter log( ... ) method</technical_language>

Target:
public void unBanUser(String userName, WebDriver driver) { WebElement unbanLink = driver.findElement(By.xpath( String.format(userUnbanLink, userName) )); waitForElementByElement(unbanLink); unbanLink.click(); verifyChatUnbanMessage(userName); PageObjectLogging.log("unBanUser", userName+" is no longer banned", true); }
Source:
<code>protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock("Activate host")) { executionHandler.updateSpecificActionJobCompleted(vds.getId(), ActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(() -> { List<Network> networks = networkDao.getAllForCluster(vds.getClusterId()); networkClusterHelper.setStatus(vds.getClusterId(), networks); return null; }); if (vds.getClusterSupportsGlusterService()) { runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); GlusterStatus isRunning = glusterUtil.isVDORunning(vds.getId()); switch (isRunning) { case DOWN: log.info("VDO service is down in host : '{}' , starting VDO service", vds.getId()); startVDOService(vds); break; case UP: <START> log.info("VDO <END> service is up in host : '{}' , skipping starting of VDO service", vds.getId()); break; case UNKNOWN: log.info("VDO service is not installed host : '{}' , ignoring to start VDO service", vds.getId()); break; } } } } }</code><technical_language>this line is properly aligned</technical_language>

Target:
protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock("Activate host")) { executionHandler.updateSpecificActionJobCompleted(vds.getId(), ActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(() -> { List<Network> networks = networkDao.getAllForCluster(vds.getClusterId()); networkClusterHelper.setStatus(vds.getClusterId(), networks); return null; }); if (vds.getClusterSupportsGlusterService()) { runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); GlusterStatus isRunning = glusterUtil.isVDORunning(vds.getId()); switch (isRunning) { case DOWN: log.info("VDO service is down in host : '{}' with id '{}', starting VDO service", vds.getHostName(), vds.getId()); startVDOService(vds); break; case UP: log.info("VDO service is up in host : '{}' with id '{}', skipping starting of VDO service", vds.getHostName(), vds.getId()); break; case UNKNOWN: log.info("VDO service is not installed host : '{}' with id '{}', ignoring to start VDO service", vds.getHostName(), vds.getId()); break; } } } } }
Source:
<code>public Vector<Resource> getLazyResources() { <START> return storage.getRecordsForValues(new String[]{Resource.META_INDEX_LAZY}, new Boolean[]{true}); <END> }</code><technical_language>do this iterating ID's? This feels a bit a potential bomb call, grab a LOT of records</technical_language>

Target:
public Vector<Resource> getLazyResources() { return storage.getRecordsForValues(new String[]{Resource.META_INDEX_LAZY}, new String[]{LAZY_VAL_TRUE}); }
Source:
<code>public void setup() { nextProbeId = 0; <START> method = new MethodNode(InstrSupport.ASM_API_VERSION) { <END> private final Set<Label> visitedLabels = new HashSet<Label>(); @Override public void visitLabel(final Label label) { visitedLabels.add(label); super.visitLabel(label); } @Override public void visitLineNumber(final int line, final Label start) { assertTrue(visitedLabels.contains(start)); super.visitLineNumber(line, start); } }; method.tryCatchBlocks = new ArrayList<TryCatchBlockNode>(); probes = new boolean[32]; }</code><technical_language>@Godin considered ASM's CheckMethodAdapter instead? emit method node a instance of this adapter this false API usage detected</technical_language>

Target:
public void setup() { nextProbeId = 0; method = new MethodNode(); method.tryCatchBlocks = new ArrayList<TryCatchBlockNode>(); probes = new boolean[32]; }
Source:
<code>public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingContentProviderBlocking() { final StorIOContentResolver storIOContentResolver = mock(StorIOContentResolver.class); final StorIOContentResolver.Internal internal = mock(StorIOContentResolver.Internal.class); when(storIOContentResolver.internal()).thenReturn(internal); when(storIOContentResolver.delete()).thenReturn(new PreparedDelete.Builder(storIOContentResolver)); final PreparedDelete<DeleteResult> preparedDelete = storIOContentResolver .delete() .object(TestItem.newInstance()) .prepare(); try { preparedDelete.executeAsBlocking(); fail(); <START> } catch (StorIOException expected) { <END> } verify(storIOContentResolver).delete(); verify(storIOContentResolver).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).delete(any(DeleteQuery.class)); verifyNoMoreInteractions(storIOContentResolver, internal); }</code><technical_language>Please add assertion for exception type message, expected exception</technical_language>

Target:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingContentProviderBlocking() { final StorIOContentResolver storIOContentResolver = mock(StorIOContentResolver.class); final StorIOContentResolver.Internal internal = mock(StorIOContentResolver.Internal.class); when(storIOContentResolver.internal()).thenReturn(internal); when(storIOContentResolver.delete()).thenReturn(new PreparedDelete.Builder(storIOContentResolver)); final PreparedDelete<DeleteResult> preparedDelete = storIOContentResolver .delete() .object(TestItem.newInstance()) .prepare(); try { preparedDelete.executeAsBlocking(); fail(); } catch (StorIOException expected) { TestUtils.checkException(expected, IllegalStateException.class); } verify(storIOContentResolver).delete(); verify(storIOContentResolver).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).delete(any(DeleteQuery.class)); verifyNoMoreInteractions(storIOContentResolver, internal); }
Source:
<code>public void testDateRangeWithMonthNoLeap() throws MalformedURLException, URISyntaxException, FileNotFoundException, IOException, ParseException, DAP2Exception { <START> URI dataSetURI = this.getClass().getResource("modis_monthly_ET_3.ncml").toURI(); <END> String gridSelection = "T2MAX"; List<String> result = OpendapServerHelper.getOPeNDAPTimeRange(dataSetURI.toASCIIString(), gridSelection); assertNotNull(result); assertEquals(2, result.size()); assertEquals(result.get(0), "2000-10-01T00:00:00Z"); assertEquals(result.get(1), "2051-01-01T00:00:00Z"); }</code><technical_language>this is working ncml here</technical_language>

Target:
public void testDateRangeWithMonthNoLeap() throws MalformedURLException, URISyntaxException, FileNotFoundException, IOException, ParseException, DAP2Exception { URI dataSetURI = this.getClass().getResource("d01_T2_monthly_NOHALO.ncml").toURI(); String gridSelection = "T2MAX"; List<String> result = OpendapServerHelper.getOPeNDAPTimeRange(dataSetURI.toASCIIString(), gridSelection); assertNotNull(result); assertEquals(2, result.size()); assertEquals(result.get(0), "2000-10-01T00:00:00Z"); assertEquals(result.get(1), "2051-01-01T00:00:00Z"); }
Source:
<code>private Properties buildProperties() { Properties props = new Properties(); props.setProperty("resource.loader", "class"); props.setProperty("class.resource.loader.class", ClasspathResourceLoader.class.getCanonicalName()); props.setProperty("runtime.log", new File(configuration.getReportDirectory(), "velocity.log").getPath()); <START> props.setProperty("eventhandler.referenceinsertion.class", "org.apache.velocity.app.event.implement.EscapeHtmlReference"); <END> return props; }</code><technical_language>this labels escaped able provide HTML code report displayed HTML (eg link external server in description)</technical_language>

Target:
private Properties buildProperties() { Properties props = new Properties(); props.setProperty("resource.loader", "class"); props.setProperty("class.resource.loader.class", ClasspathResourceLoader.class.getCanonicalName()); props.setProperty("runtime.log", new File(configuration.getReportDirectory(), "velocity.log").getPath()); return props; }
Source:
<code>public DeferredStatusHolderSV(int id, Status deferredStatus) { super(id); <START> this.deferedStatus = deferredStatus; <END> }</code><technical_language>typo. r</technical_language>

Target:
public DeferredStatusHolderSV(int id, Status deferredStatus) { super(id); this.deferredStatus = deferredStatus; }
Source:
<code>public RsWithCookie(final Response res, final CharSequence name, final CharSequence value, final CharSequence... attrs) { super( new Response() { @Override public Iterable<String> head() throws IOException { <START> return RsWithCookie.extend( <END> res, name, value, attrs ); } @Override public InputStream body() throws IOException { return res.body(); } } ); RsWithCookie.checkName(name); RsWithCookie.checkValue(value); }</code><technical_language>@Bertram25 I move contents of extend method in now</technical_language>

Target:
public RsWithCookie(final Response res, final CharSequence name, final CharSequence value, final CharSequence... attrs) { super( new Response() { @Override public Iterable<String> head() throws IOException { Response resp = res; resp = new RsWithHeader( new RsWithoutHeader(res, RsWithCookie.SET_COOKIE), RsWithCookie.SET_COOKIE, RsWithCookie.make( RsWithCookie.previousValue(res), name, value, attrs ) ); return resp.head(); } @Override public InputStream body() throws IOException { return res.body(); } } ); RsWithCookie.checkName(name); RsWithCookie.checkValue(value); }
Source:
<code>public void biScan(CtRole role, CtElement element, CtElement other) { if (isNotEqual) { return; } if (element == null) { if (other != null) { fail(role, element, other); return; } return; } else if (other == null) { fail(role, element, other); return; } if (element == other) { return; } try { lastRole = role; <START> if (haveDifferentDeclaringInnerClasses(element, other)) { fail(role, element, other); return; } super.biScan(element, other); <END> } catch (java.lang.ClassCastException e) { fail(role, element, other); } finally { lastRole = null; } }</code><technical_language>Traversing hierarchy element a bit redundant affect performance a bit</technical_language>

Target:
public void biScan(CtRole role, CtElement element, CtElement other) { if (isNotEqual) { return; } if (element == null) { if (other != null) { fail(role, element, other); return; } return; } else if (other == null) { fail(role, element, other); return; } if (element == other) { return; } try { lastRole = role; super.biScan(element, other); } catch (java.lang.ClassCastException e) { fail(role, element, other); } finally { lastRole = null; } }
Source:
<code>protected void setWindowSize() { <START> if (!Configuration.getBrowser().contains("ANDROID")) { <END> if (Configuration.getBrowserSize() != null) { driver.manage().window().setSize(Configuration.getBrowserSize()); } else { driver.manage().window().maximize(); } } }</code><technical_language>do about: if ( ! "ANDROID".equals(Configuration.getBrowser()) && Configuration.getBrowserSize() != null ) { driver.manage().window().setSize(Configuration.getBrowserSize()); } else { driver.manage().window().maximize(); }</technical_language>

Target:
protected void setWindowSize() { if (!Configuration.getBrowser().contains("ANDROID") && Configuration.getBrowserSize() != null) { driver.manage().window().setSize(Configuration.getBrowserSize()); } else { driver.manage().window().maximize(); } }
Source:
<code>public void onStop() { if (mPendingConfig) { if (mSyncthingService != null && mApi != null && mSyncthingService.getCurrentState() != SyncthingService.State.DISABLED) { mApi.saveConfigAndRestart(); mPendingConfig = false; } } if (mPendingRunConditions) { if (mSyncthingService != null) { <START> mSyncthingService.reEvaluateRunConditions(); <END> } } super.onStop(); }</code><technical_language>This need "re", evaluating stuff once, twice</technical_language>

Target:
public void onStop() { if (mPendingConfig) { if (mSyncthingService != null && mApi != null && mSyncthingService.getCurrentState() != SyncthingService.State.DISABLED) { mApi.saveConfigAndRestart(); mPendingConfig = false; } } if (mPendingRunConditions) { if (mSyncthingService != null) { mSyncthingService.evaluateRunConditions(); } } super.onStop(); }
Source:
<code>public String getDockerImageName() { try { <START> return nameResolverProvider.getResolver().get(); <END> } catch (Exception e) { throw new ContainerFetchException("Can't get Docker image: " + nameResolverProvider.getResolver(), e); } }</code><technical_language>suggestion return getImage().get();</technical_language>

Target:
public String getDockerImageName() { try { return getImage().get(); } catch (Exception e) { throw new ContainerFetchException("Can't get Docker image: " + nameResolverProvider.getResolver(), e); } }
Source:
<code>public void testReleaseValidation() throws VersionValidationException { ArtifactCoordinates coordinates1 = new NugetHierarchicalArtifactCoordinates(); coordinates1.setVersion("1"); ArtifactCoordinates coordinates2 = new NugetHierarchicalArtifactCoordinates(); coordinates2.setVersion("1.0"); ArtifactCoordinates coordinates3 = new NugetHierarchicalArtifactCoordinates(); <START> coordinates3.setVersion("1.0-RELEASE"); <END> try { validator.validate(repository, coordinates1); validator.validate(repository, coordinates2); validator.validate(repository, coordinates3); } catch (Exception ex) { fail("Validator should not throw any exception but received " + ExceptionUtils.getStackTrace(ex)); } }</code><technical_language>promote of versions 1.0-RELEASE. If a release, 1.0, need for extra noise in version. for another good example, some: * 1.0-rc-1 * 1.0-milestone-1 * 1.0-alpha-1 * 1.0-beta-1</technical_language>

Target:
public void testReleaseValidation() throws VersionValidationException { ArtifactCoordinates coordinates1 = new NugetHierarchicalArtifactCoordinates(); coordinates1.setVersion("1"); ArtifactCoordinates coordinates2 = new NugetHierarchicalArtifactCoordinates(); coordinates2.setVersion("1.0"); ArtifactCoordinates coordinates3 = new NugetHierarchicalArtifactCoordinates(); coordinates3.setVersion("1.0-rc-1"); ArtifactCoordinates coordinates4 = new NugetHierarchicalArtifactCoordinates(); coordinates4.setVersion("1.0-milestone-1"); ArtifactCoordinates coordinates5 = new NugetHierarchicalArtifactCoordinates(); coordinates5.setVersion("1.0-alpha-1"); ArtifactCoordinates coordinates6 = new NugetHierarchicalArtifactCoordinates(); coordinates6.setVersion("1.0-beta-1"); try { validator.validate(repository, coordinates1); validator.validate(repository, coordinates2); validator.validate(repository, coordinates3); validator.validate(repository, coordinates4); validator.validate(repository, coordinates5); validator.validate(repository, coordinates6); } catch (Exception ex) { fail("Validator should not throw any exception but received " + ExceptionUtils.getStackTrace(ex)); } }
Source:
<code>public static void createSubscription( String topic, String subscriptionName, String owner) throws RegistryClientException { if(log.isDebugEnabled()){ log.debug("Topic name going to put to the registry is: " + topic + "and subscription name for the topic in the registry is: " + subscriptionName); } if(!NameValidations.isValidTopicName(topic)) { throw new RegistryClientException("\nTopic name: " <START> + NameValidations.getTopicNameWithoutTenantDomain(topic) END> + " can contain only alphanumeric characters and star(*) " + "delimited by dots. Names can ends with any of these or, with '#' "); } try { RegistryService registryService = CommonsDataHolder.getInstance().getRegistryService(); UserRegistry registry = registryService.getGovernanceSystemRegistry( CarbonContext.getThreadLocalCarbonContext().getTenantId() <= 0 ? MultitenantConstants.SUPER_TENANT_ID : CarbonContext.getThreadLocalCarbonContext().getTenantId() ); Collection subscription; String tenantBasedTopicName = getTenantBasedTopicName(topic); String subscriptionID = CommonsUtil.getSubscriptionID(tenantBasedTopicName, subscriptionName); if (!registry.resourceExists(subscriptionID)) { subscription = registry.newCollection(); } else { subscription = (Collection) registry.get(subscriptionID); } subscription.setProperty(OWNER, owner); subscription.setProperty(NAME, subscriptionName); subscription.setProperty(CREATED_TIME, ConverterUtil.convertToString(new Date())); registry.put(subscriptionID, subscription); } catch (RegistryException e) { throw new RegistryClientException(e); } }</code><technical_language>is this // do about</technical_language>

Target:
public static void createSubscription( String topic, String subscriptionName, String owner) throws RegistryClientException { if (log.isDebugEnabled()) { log.debug("Saving topic name: \"" + topic + "\" in registry, and subscription name for this topic is: " + subscriptionName); } try { RegistryService registryService = CommonsDataHolder.getInstance().getRegistryService(); UserRegistry registry = registryService.getGovernanceSystemRegistry( CarbonContext.getThreadLocalCarbonContext().getTenantId() <= 0 ? MultitenantConstants.SUPER_TENANT_ID : CarbonContext.getThreadLocalCarbonContext().getTenantId() ); Collection subscription; String tenantBasedTopicName = getTenantBasedTopicName(topic); String subscriptionID = CommonsUtil.getSubscriptionID(tenantBasedTopicName, subscriptionName); if (!registry.resourceExists(subscriptionID)) { subscription = registry.newCollection(); } else { subscription = (Collection) registry.get(subscriptionID); } subscription.setProperty(OWNER, owner); subscription.setProperty(NAME, subscriptionName); subscription.setProperty(CREATED_TIME, ConverterUtil.convertToString(new Date())); registry.put(subscriptionID, subscription); } catch (RegistryException e) { throw new RegistryClientException(e); } }
Source:
<code>public static RuleStatusInfo create(RuleStatus status) { if(status == null) { throw new IllegalArgumentException("Status must not be null."); } switch (status) { case DISABLED: return RuleStatusInfo.DISABLED; case UNINITIALIZED: return RuleStatusInfo.UNINITIALIZED; case INITIALIZING: return RuleStatusInfo.INITIALIZING; case IDLE: return RuleStatusInfo.IDLE; case TRIGGERED: return RuleStatusInfo.TRIGGERED; case RUNNING: return RuleStatusInfo.RUNNING; } <START> throw new IllegalArgumentException("Invalid status value."); <END> }</code><technical_language>nicer if this is put a "default" case</technical_language>

Target:
public static RuleStatusInfo create(RuleStatus status) { if (status == null) { throw new IllegalArgumentException("Status must not be null."); } switch (status) { case DISABLED: return RuleStatusInfo.DISABLED; case UNINITIALIZED: return RuleStatusInfo.UNINITIALIZED; case INITIALIZING: return RuleStatusInfo.INITIALIZING; case IDLE: return RuleStatusInfo.IDLE; case TRIGGERED: return RuleStatusInfo.TRIGGERED; case RUNNING: return RuleStatusInfo.RUNNING; default: throw new IllegalArgumentException("Invalid status value."); } }
Source:
<code><START> public void index(DbSession dbSession, Collection<EsQueueDto> items) { <END> if (items.isEmpty()) { return; } List<String> logins = items .stream() .filter(i -> { requireNonNull(i.getDocUuid(), () -> "BUG - " + i + " has not been persisted before indexing"); return true; }) .map(EsQueueDto::getDocUuid) .collect(toArrayList()); ListMultimap<String, String> organizationUuidsByLogin = ArrayListMultimap.create(); dbClient.organizationMemberDao().selectForUserIndexing(dbSession, logins, organizationUuidsByLogin::put); BulkIndexer bulkIndexer = newBulkIndexer(Size.REGULAR); bulkIndexer.start(dbSession, items); dbClient.userDao().scrollByLogins(dbSession, logins, u -> bulkIndexer.add(newIndexRequest(u, organizationUuidsByLogin))); bulkIndexer.stop(); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Remove this unused method parameter "logins". [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public IndexingResult index(DbSession dbSession, Collection<EsQueueDto> items) { if (items.isEmpty()) { return new IndexingResult(); } Set<String> logins = items .stream() .filter(i -> { requireNonNull(i.getDocId(), () -> "BUG - " + i + " has not been persisted before indexing"); return i.getDocType() == EsQueueDto.Type.USER; }) .map(EsQueueDto::getDocId) .collect(toHashSet(items.size())); ListMultimap<String, String> organizationUuidsByLogin = ArrayListMultimap.create(); dbClient.organizationMemberDao().selectForUserIndexing(dbSession, logins, organizationUuidsByLogin::put); BulkIndexer bulkIndexer = newBulkIndexer(Size.REGULAR, new ResiliencyIndexingListener(dbClient, dbSession, items)); bulkIndexer.start(); dbClient.userDao().scrollByLogins(dbSession, logins, u -> { logins.remove(u.getLogin()); bulkIndexer.add(newIndexRequest(u, organizationUuidsByLogin)); }); logins.forEach(l -> bulkIndexer.addDeletion(UserIndexDefinition.INDEX_TYPE_USER, l)); return bulkIndexer.stop(); }
Source:
<code>public static boolean preValidate(String path) throws CTFException { String metadataPath = path + Utils.SEPARATOR + METADATA_FILENAME; File metadataFile = new File(metadataPath); if (metadataFile.exists() && metadataFile.length() > PREVALIDATION_SIZE) { try (FileChannel fc = FileChannel.open(metadataFile.toPath(), StandardOpenOption.READ)) { ByteBuffer bb = ByteBuffer.allocate(PREVALIDATION_SIZE); <START> fc.read(bb); <END> if (bb.getInt(0) == Utils.TSDL_MAGIC) { return true; } bb.order(ByteOrder.LITTLE_ENDIAN); if (bb.getInt(0) == Utils.TSDL_MAGIC) { return true; } bb.position(0); Charset forName = Charset.forName("ASCII"); byte bytes[] = new byte[PREVALIDATION_SIZE]; bb.get(bytes); String text = new String(bytes, forName); return text.startsWith(TEXT_ONLY_METADATA_HEADER_PREFIX); } catch (IOException e) { throw new CTFException(e.getMessage(), e); } } return false; }</code><technical_language>ByteBuffer's API is weird, recommended steps of (in case for reading) is. bb = ByteBuffer.allocate() bb.clear(); fc.read(bb); bb.flip(); bb.get... bb.get... clear() flip() operations missing. In fact wondering working flipped in read mode..</technical_language>

Target:
public static boolean preValidate(String path) throws CTFException { String metadataPath = path + Utils.SEPARATOR + METADATA_FILENAME; File metadataFile = new File(metadataPath); if (metadataFile.exists() && metadataFile.length() > PREVALIDATION_SIZE) { try (FileChannel fc = FileChannel.open(metadataFile.toPath(), StandardOpenOption.READ)) { ByteBuffer bb = ByteBuffer.allocate(PREVALIDATION_SIZE); bb.clear(); fc.read(bb); bb.flip(); if (bb.getInt(0) == Utils.TSDL_MAGIC) { return true; } bb.order(ByteOrder.LITTLE_ENDIAN); if (bb.getInt(0) == Utils.TSDL_MAGIC) { return true; } bb.position(0); Charset forName = Charset.forName("ASCII"); byte bytes[] = new byte[PREVALIDATION_SIZE]; bb.get(bytes); String text = new String(bytes, forName); return text.startsWith(TEXT_ONLY_METADATA_HEADER_PREFIX); } catch (IOException e) { throw new CTFException(e.getMessage(), e); } } return false; }
Source:
<code>public static Slice concatenate(Slice a, byte[] b) { int size = a.length + b.length; byte[] bytes = new byte[size]; <START> System.arraycopy(a, a.offset, bytes, 0, a.length); <END> System.arraycopy(b, 0, bytes, a.length, b.length); return new Slice(bytes); }</code><technical_language>a.buffer instead of a</technical_language>

Target:
public static Slice concatenate(Slice a, byte[] b) { int size = a.length + b.length; byte[] bytes = new byte[size]; System.arraycopy(a.buffer, a.offset, bytes, 0, a.length); System.arraycopy(b, 0, bytes, a.length, b.length); return new Slice(bytes); }
Source:
<code>public void cancelTimeout( Value request ) { <START> tasks.remove( request.strValue() ); <END> }</code><technical_language>task is running in executor, prevent Jolie program terminating in case done service. executor.schedule returns a ScheduleFuture supports a cancel method cancel task</technical_language>

Target:
public Boolean cancelTimeout( Value request ) { long timeoutId = request.longValue(); ScheduledFuture f = scheduledFutureHashMap.remove( timeoutId ); return f != null && f.cancel( false ); }
Source:
<code>private void createBuilderInjectionMethod(Element element, EFragmentHolder holder, BundleHelper bundleHelper, JFieldVar argKeyStaticField, String fieldName) { JDefinedClass builderClass = holder.getBuilderClass(); JFieldRef builderArgsField = holder.getBuilderArgsField(); TypeMirror type = codeModelHelper.getActualType(element, holder); JClass paramClass = codeModelHelper.typeMirrorToJClass(type); JMethod method = builderClass.method(PUBLIC, holder.narrow(builderClass), fieldName); JExpression arg = method.param(paramClass, fieldName); <START> if (bundleHelper.isParcelerBean()) { <END> arg = getCodeModel().ref("org.parceler.Parcels").staticInvoke("wrap").arg(arg); } method.body().invoke(builderArgsField, bundleHelper.getMethodNameToSave()).arg(argKeyStaticField).arg(arg); method.body()._return(_this()); String docComment = getProcessingEnvironment().getElementUtils().getDocComment(element); codeModelHelper.addTrimmedDocComment(method, docComment); method.javadoc().addParam(fieldName).append("the Fragment argument"); method.javadoc().addReturn().append("the FragmentBuilder to chain calls"); }</code><technical_language>add this BundleHelper in some way, remove code duplication</technical_language>

Target:
private void createBuilderInjectionMethod(Element element, EFragmentHolder holder, BundleHelper bundleHelper, JFieldVar argKeyStaticField, String fieldName) { JDefinedClass builderClass = holder.getBuilderClass(); JFieldRef builderArgsField = holder.getBuilderArgsField(); TypeMirror type = codeModelHelper.getActualType(element, holder); AbstractJClass paramClass = codeModelHelper.typeMirrorToJClass(type); JMethod method = builderClass.method(PUBLIC, holder.narrow(builderClass), fieldName); JVar arg = method.param(paramClass, fieldName); method.body().add(bundleHelper.getExpressionToSaveFromField(builderArgsField, argKeyStaticField, arg)); method.body()._return(_this()); String docComment = getProcessingEnvironment().getElementUtils().getDocComment(element); codeModelHelper.addTrimmedDocComment(method, docComment); method.javadoc().addParam(fieldName).append("the Fragment argument"); method.javadoc().addReturn().append("the FragmentBuilder to chain calls"); }