auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void storeNetwork() throws UnsupportedEncodingException { StringBuilder output = new StringBuilder(); if (vmInit.getNetworks() != null) { List<VmInitNetwork> networks = vmInit.getNetworks(); for (VmInitNetwork iface: networks) { output.append("iface " + iface.getName() + " inet " + iface.getBootProtocol().getDisplayName() + "\n"); <START> if (!StringUtils.isEmpty(iface.getIp())) { <END> output.append(" address " + iface.getIp() + "\n"); } if (!StringUtils.isEmpty(iface.getNetmask())) { output.append(" netmask " + iface.getNetmask() + "\n"); } if (!StringUtils.isEmpty(iface.getGateway())) { output.append(" gateway " + iface.getGateway() + "\n"); } if (vmInit.getDnsServers() != null) { output.append(" dns-nameservers") .append(" ").append(vmInit.getDnsServers()); output.append("\n"); } if (vmInit.getDnsSearch() != null) { output.append(" dns-search") .append(" ").append(vmInit.getDnsSearch()); output.append("\n"); } } output.append("auto"); for (VmInitNetwork iface : networks) { output.append(" " + iface.getName()); } output.append("\n"); } interfaces = output.toString(); if (!interfaces.isEmpty()) { metaData.put("network-interfaces", interfaces); storeNextFile(CloudInitFileMode.NETWORK, "/etc/network/interfaces", interfaces.getBytes("US-ASCII")); } }</code><technical_language>replace with: if (StringUtils.isNotEmpty(iface.getIp())) { ... }</technical_language>

Target:
private void storeNetwork() throws UnsupportedEncodingException { StringBuilder output = new StringBuilder(); if (vmInit.getNetworks() != null) { List<VmInitNetwork> networks = vmInit.getNetworks(); for (VmInitNetwork iface: networks) { output.append("iface " + iface.getName() + " inet " + iface.getBootProtocol().getDisplayName() + "\n"); if (StringUtils.isNotEmpty(iface.getIp())) { output.append(" address " + iface.getIp() + "\n"); } if (StringUtils.isNotEmpty(iface.getNetmask())) { output.append(" netmask " + iface.getNetmask() + "\n"); } if (StringUtils.isNotEmpty(iface.getGateway())) { output.append(" gateway " + iface.getGateway() + "\n"); } if (vmInit.getDnsServers() != null) { output.append(" dns-nameservers") .append(" ").append(vmInit.getDnsServers()); output.append("\n"); } if (vmInit.getDnsSearch() != null) { output.append(" dns-search") .append(" ").append(vmInit.getDnsSearch()); output.append("\n"); } } output.append("auto"); for (VmInitNetwork iface : networks) { output.append(" " + iface.getName()); } output.append("\n"); } interfaces = output.toString(); if (!interfaces.isEmpty()) { metaData.put("network-interfaces", interfaces); storeNextFile(CloudInitFileMode.NETWORK, "/etc/network/interfaces", interfaces.getBytes("US-ASCII")); } }
Source:
<code>public String getUrl() { StringBuilder url = new StringBuilder(100); url.append("jdbc:postgresql://"); for (int i = 0; i < serverNames.length; i++) { if (i > 0) { url.append(","); } url.append(serverNames[i]); <START> if (portNumbers.length >= i && portNumbers[i] != 0) { <END> url.append(":").append(portNumbers[i]); } } url.append("/").append(URLCoder.encode(databaseName)); StringBuilder query = new StringBuilder(100); for (PGProperty property: PGProperty.values()) { if (property.isPresent(properties)) { if (query.length() != 0) { query.append("&"); } query.append(property.getName()); query.append("="); query.append(URLCoder.encode(property.get(properties))); } } if (query.length() > 0) { url.append("?"); url.append(query); } return url.toString(); }</code><technical_language>This assume portNumbers is null (which if changes made)</technical_language>

Target:
public String getUrl() { StringBuilder url = new StringBuilder(100); url.append("jdbc:postgresql://"); for (int i = 0; i < serverNames.length; i++) { if (i > 0) { url.append(","); } url.append(serverNames[i]); if (portNumbers != null && portNumbers.length >= i && portNumbers[i] != 0) { url.append(":").append(portNumbers[i]); } } url.append("/").append(URLCoder.encode(databaseName)); StringBuilder query = new StringBuilder(100); for (PGProperty property: PGProperty.values()) { if (property.isPresent(properties)) { if (query.length() != 0) { query.append("&"); } query.append(property.getName()); query.append("="); query.append(URLCoder.encode(property.get(properties))); } } if (query.length() > 0) { url.append("?"); url.append(query); } return url.toString(); }
Source:
<code>public List<CloudVmInstanceStatus> reboot(AuthenticatedContext ac, List<CloudInstance> vms) { <START> AmazonEC2Client amazonEC2Client = awsClient.createAccess(new AwsCredentialView(ac.getCloudCredential()), <END> ac.getCloudContext().getLocation().getRegion().value()); List<CloudInstance> affectedVms = new ArrayList<>(); List<CloudVmInstanceStatus> rebootedVmsStatus = new ArrayList<>(); try { if (!vms.isEmpty()) { List<CloudVmInstanceStatus> statuses = check(ac, vms); doStop(new ArrayList<>(), ac, getStarted(statuses)); statuses = check(ac, vms); doStart(affectedVms, ac, getStopped(statuses), rebootedVmsStatus); logInvalidStatuses(getNotStoppedOrStarted(statuses)); } } catch (SdkClientException e) { LOGGER.warn("Failed to send reboot request to AWS: ", e); throw e; } return rebootedVmsStatus; }</code><technical_language>this is anymore</technical_language>

Target:
public List<CloudVmInstanceStatus> reboot(AuthenticatedContext ac, List<CloudInstance> vms) { List<CloudVmInstanceStatus> rebootedVmsStatus = new ArrayList<>(); try { if (!vms.isEmpty()) { List<CloudVmInstanceStatus> statuses = check(ac, vms); doStop(ac, getStarted(statuses)); statuses = check(ac, vms); logInvalidStatuses(getNotStopped(statuses), InstanceStatus.STOPPED); rebootedVmsStatus = doStart(ac, getStopped(statuses)); logInvalidStatuses(getNotStarted(statuses), InstanceStatus.STARTED); } } catch (SdkClientException e) { LOGGER.warn("Failed to send reboot request to AWS: ", e); throw e; } return rebootedVmsStatus; }
Source:
<code>private Map<String, Long> getNumTasks(List<SingularityRequestWithState> requests) { final CounterMap<String> numTasks = new CounterMap<>(requests.size()); for (SingularityTaskId taskId : taskManager.getActiveTaskIds()) { numTasks.incr(taskId.getRequestId()); } for (SingularityPendingTaskId pendingTaskId : taskManager.getPendingTaskIds()) { numTasks.incr(pendingTaskId.getRequestId()); } for (SingularityTaskId cleaningTaskId : taskManager.getCleanupTaskIds()) { <START> numTasks.decr(cleaningTaskId.getRequestId()); <END> } return numTasks.toCountMap(); }</code><technical_language>Do want include cleaning checking for provisioned, this exclude for _and_ over? avoid false alerts if</technical_language>

Target:
private Map<String, Long> getNumTasks(List<SingularityRequestWithState> requests) { final CounterMap<String> numTasks = new CounterMap<>(requests.size()); for (SingularityTaskId taskId : taskManager.getActiveTaskIds()) { numTasks.incr(taskId.getRequestId()); } for (SingularityPendingTaskId pendingTaskId : taskManager.getPendingTaskIds()) { numTasks.incr(pendingTaskId.getRequestId()); } for (SingularityTaskId cleaningTaskId : taskManager.getCleanupTaskIds()) { Optional<SingularityRequestWithState> request = requestManager.getRequest(cleaningTaskId.getRequestId()); if (request.isPresent() && request.get().getRequest().isScheduled()) { continue; } numTasks.decr(cleaningTaskId.getRequestId()); } return numTasks.toCountMap(); }
Source:
<code>public void messageReceived(ChannelHandlerContext ctx, Message message) throws Exception { switch (message.getMessageType()) { case InitRequest: InitRequest initRequestMessage = (InitRequest) message; if (initRequestMessage.getVersion() == InitMessage.DEFAULT_VERSION) { InitResponse initResponse = new InitResponse( initRequestMessage.getId(), InitMessage.DEFAULT_VERSION ); <START> initResponse.setHostPort(this.channelManager.getHostPort()); <END> initResponse.setProcessName("java-process"); ChannelFuture f = ctx.writeAndFlush(initResponse); f.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); ctx.pipeline().remove(this); channelManager.setIdentified(ctx.channel(), initRequestMessage.getHeaders()); } else { throw new FatalProtocolError( String.format("Expected Protocol version: %d", InitMessage.DEFAULT_VERSION), new Trace(0, 0, 0, (byte) 0x00) ); } break; default: throw new FatalProtocolError( "Must not send any data until receiving Init Request", new Trace(0, 0, 0, (byte) 0x00) ); } }</code><technical_language>add mutating methods? put this in constructor</technical_language>

Target:
public void messageReceived(ChannelHandlerContext ctx, Message message) throws Exception { switch (message.getMessageType()) { case InitRequest: InitRequest initRequestMessage = (InitRequest) message; if (initRequestMessage.getVersion() == InitMessage.DEFAULT_VERSION) { InitResponse initResponse = new InitResponse( initRequestMessage.getId(), InitMessage.DEFAULT_VERSION ); initResponse.setHostPort(this.peerManager.getHostPort()); initResponse.setProcessName("java-process"); ChannelFuture f = ctx.writeAndFlush(initResponse); f.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); ctx.pipeline().remove(this); peerManager.setIdentified(ctx.channel(), initRequestMessage.getHeaders()); } else { throw new FatalProtocolError( String.format("Expected Protocol version: %d", InitMessage.DEFAULT_VERSION), new Trace(0, 0, 0, (byte) 0x00) ); } break; default: throw new FatalProtocolError( "Must not send any data until receiving Init Request", new Trace(0, 0, 0, (byte) 0x00) ); } }
Source:
<code>public boolean isDefaultFilterFactorEnabled() { <START> return true; <END> }</code><technical_language>return defaultFilterFactorEnabled</technical_language>

Target:
public boolean isDefaultFilterFactorEnabled() { return defaultFilterFactorEnabled; }
Source:
<code>private void applyDevfileEndpoints(InternalMachineConfig machineConfig) { for (org.eclipse.che.api.core.model.workspace.devfile.Endpoint endpoint : component.getEndpoints()) { machineConfig .getServers() <START> .put(endpoint.getName(), ServerConfigImpl.createFromEndpoint(endpoint)); <END> } }</code><technical_language>Do care potential clashes if plugin contains endpoint of name defined in meta.yaml</technical_language>

Target:
private void applyDevfileEndpoints(InternalMachineConfig machineConfig) throws InfrastructureException { for (org.eclipse.che.api.core.model.workspace.devfile.Endpoint endpoint : component.getEndpoints()) { if (!machineConfig.getServers().containsKey(endpoint.getName())) { machineConfig .getServers() .put(endpoint.getName(), ServerConfigImpl.createFromEndpoint(endpoint)); } else { throw new InfrastructureException( format( "Devfile overrides the endpoint '%s' of the plugin/editor component '%s'. " + "This is not allowed because it would most probably cause the workspace " + "to malfunction. Please change the name of the endpoint in the devfile and try " + "to start the workspace again.", component.getId(), endpoint.getName())); } } }
Source:
<code>private static boolean classHasNoAutoValueOrImmutableAnnotation(ClassTree tree) { for (AnnotationTree annotation : tree.modifiers().annotations()) { final TypeTree type = annotation.annotationType(); <START> if (type.is(Tree.Kind.IDENTIFIER) && isAutoValueOrImmutable((IdentifierTree) type) <END> || type.is(Tree.Kind.MEMBER_SELECT) && isAutoValueOrImmutable(((MemberSelectExpressionTree) type).identifier())) { return false; } } return true; }</code><technical_language>rely syntax here, semantic. allow check if annotation is correctly fed. more precise relying syntax for tests. TypeTree, symbolType() access symbol type, check if matches fully qualified name symbolType.is("com.google.auto.value.AutoValue") symbolType.is("org.immutables.value.Value.Immutable")</technical_language>

Target:
private static boolean classHasNoAutoValueOrImmutableAnnotation(ClassTree tree) { return tree.modifiers().annotations().stream() .map(AnnotationTree::annotationType) .map(TypeTree::symbolType) .noneMatch(type -> type.is("com.google.auto.value.AutoValue") || type.is("org.immutables.value.Value$Immutable")); }
Source:
<code>public RenameDetector(Repository repo) { <START> objectReader = repo.newObjectReader(); <END> renameLimit = repo.getConfig().get(DiffConfig.KEY).getRenameLimit(); reset(); }</code><technical_language>this form instead: this(repo.newObjectReader(), repo.getConfig().get(DiffConfig.KEY));</technical_language>

Target:
public RenameDetector(Repository repo) { this(repo.newObjectReader(), repo.getConfig().get(DiffConfig.KEY)); }
Source:
<code>public void saveApplicationWithApplicationDTONullShouldThrowIllegalArgumentException() { <START> Long result = applicationsService.saveApplicaton(applicationDTO,null); <END> }</code><technical_language>application dto is null in this test case</technical_language>

Target:
public void saveApplicationWithApplicationDTONullShouldThrowIllegalArgumentException() { Long result = applicationsService.saveApplicaton(null,stateDTO); }
Source:
<code>public GlowEntity(Location location) { this.origin = location.clone(); this.previousLocation = location.clone(); this.location = location.clone(); world = (GlowWorld) location.getWorld(); <START> server = world.getServer(); <END> if (this instanceof GlowPlayer) { location = EventFactory.getInstance() .callEvent(new PlayerInitialSpawnEvent((Player) this, location)) .getSpawnLocation(); location = EventFactory.getInstance() .callEvent(new PlayerSpawnLocationEvent((Player) this, location)) .getSpawnLocation(); Position.copyLocation(location, this.origin); Position.copyLocation(location, this.previousLocation); Position.copyLocation(location, this.location); } server.getEntityIdManager().allocate(this); world.getEntityManager().register(this); }</code><technical_language>do suggested change of moving lines (assigning world server) if statement? fix a bug event setting location another world get ignored</technical_language>

Target:
public GlowEntity(Location location) { this.origin = location.clone(); this.previousLocation = location.clone(); this.location = location.clone(); if (this instanceof GlowPlayer) { location = EventFactory.getInstance() .callEvent(new PlayerInitialSpawnEvent((Player) this, location)) .getSpawnLocation(); location = EventFactory.getInstance() .callEvent(new PlayerSpawnLocationEvent((Player) this, location)) .getSpawnLocation(); Position.copyLocation(location, this.origin); Position.copyLocation(location, this.previousLocation); Position.copyLocation(location, this.location); } world = (GlowWorld) location.getWorld(); server = world.getServer(); server.getEntityIdManager().allocate(this); world.getEntityManager().register(this); }
Source:
<code>public void testVisibilityDefaultMemberFunction() throws Exception { <START> IBinding[] classBindings = getAClass(); <END> IBinding[] functionBindings = getMember("AClass", "defaultMemFun"); assertEquals(1, functionBindings.length); ICPPClassType aClass = (ICPPClassType) classBindings[0]; int visibility = aClass.getVisibility(functionBindings[0]); VisibilityHelper.assertVisibility(ICPPClassType.v_private, visibility); }</code><technical_language>Bodies of test methods similar. Extract common logic avoid code duplication</technical_language>

Target:
public void testVisibilityDefaultMemberFunction() throws Exception { int visibility = getMemberVisibility(getAClass(), "defaultMemFun", 1, 0); VisibilityAsserts.assertVisibility(ICPPClassType.v_private, visibility); }
Source:
<code>protected void updateInternal() { super.updateInternal(); if (!(getContainer().isNewStorage() || getContainer().isStorageActive())) { return; } VDS host = (VDS) getContainer().getHost().getSelectedItem(); if (host == null) { proposeDiscover(); return; } final List<EntityModel<?>> prevSelected = findSelectedItems(); clearItems(); initializeItems(null, null); AsyncQuery asyncQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { SanStorageModel model = (SanStorageModel) target; VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue; if (response.getSucceeded()) { <START> model.applyData((ArrayList<LUNs>) response.getReturnValue(), false, prevSelected); <END> model.setGetLUNsFailure(""); } else { model.setGetLUNsFailure( ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure()); } } }, true); asyncQuery.setContext(getHash()); Frontend.getInstance().runQuery(VdcQueryType.GetDeviceList, new GetDeviceListQueryParameters(host.getId(), getType()), asyncQuery); }</code><technical_language>is relevant for lun disk</technical_language>

Target:
protected void updateInternal() { super.updateInternal(); if (!(getContainer().isNewStorage() || getContainer().isStorageActive())) { return; } VDS host = (VDS) getContainer().getHost().getSelectedItem(); if (host == null) { proposeDiscover(); return; } final Collection<EntityModel<?>> prevSelected = Linq.findSelectedItems((Collection<EntityModel<?>>) getSelectedItem()); clearItems(); initializeItems(null, null); AsyncQuery asyncQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { SanStorageModel model = (SanStorageModel) target; VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue; if (response.getSucceeded()) { model.applyData((ArrayList<LUNs>) response.getReturnValue(), false, prevSelected); model.setGetLUNsFailure(""); } else { model.setGetLUNsFailure( ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure()); } } }, true); asyncQuery.setContext(getHash()); Frontend.getInstance().runQuery(VdcQueryType.GetDeviceList, new GetDeviceListQueryParameters(host.getId(), getType()), asyncQuery); }
Source:
<code>static String fillLogRow(List<String> classList, String command, String description) { VelocityEngine ve = new VelocityEngine(); StringBuilder builder = new StringBuilder(); Template t = ve.getTemplate(LOG_ROW_TEMPLATE_PATH); VelocityContext context = new VelocityContext(); context.put("className", "\"" + classList.stream().collect(Collectors.joining(" ")) + "\""); context.put("command", command); <START> context.put("description", description); <END> StringWriter writer = new StringWriter(); t.merge(context, writer); builder.append(writer.toString()); return builder.toString(); }</code><technical_language>![MINOR](<LINK_1> 'Severity: MINOR') Define a constant instead of duplicating this literal "description" 3 times. [![rule](<LINK_0>](http://sonar-s4/coding_rules#rule_key=squid%3AS1192)</technical_language>

Target:
static String fillLogRow(List<String> classList, String command, String description) { StringBuilder builder = new StringBuilder(); Template t = velocityEngine.getTemplate(LOG_ROW_TEMPLATE_PATH); VelocityContext context = new VelocityContext(); context.put("className", "\"" + classList.stream().collect(Collectors.joining(" ")) + "\""); context.put("command", command); context.put("description", description); StringWriter writer = new StringWriter(); t.merge(context, writer); builder.append(writer.toString()); return builder.toString(); }
Source:
<code>public List<Class> getSupportedTypes() { <START> return new ArrayList<>(Arrays.asList(LocalDate.class)); <END> }</code><technical_language>Collections.singletonList</technical_language>

Target:
public List<Class> getSupportedTypes() { return Collections.singletonList(LocalDate.class); }
Source:
<code>public void handleTemplateException(TemplateException te, Environment env, Writer out) throws TemplateException { <START> if (!ninjaProperties.isProd()) { <END> PrintWriter pw = (out instanceof PrintWriter) ? (PrintWriter) out : new PrintWriter(out); pw.println("<!-- FREEMARKER ERROR MESSAGE STARTS HERE -->" + "<script language=javascript> + "<script language=javascript> + "<script language=javascript> + "<script language=javascript> + "</title></xmp></script></noscript></style></object>" + "</head></pre></table>" + "</form></table></table></table></a></u></i></b>" + "<div align=left " + "style='background-color:#FFFF00; color:#FF0000; " + "display:block; border-top:double; padding:2pt; " + "font-size:medium; font-family:Arial,sans-serif; " + "font-style: normal; font-variant: normal; " + "font-weight: normal; text-decoration: none; " + "text-transform: none'>" + "<b style='font-size:medium'>FreeMarker template error!</b>" + "<pre><xmp>"); te.printStackTrace(pw); pw.println("</xmp></pre></div></html>"); pw.flush(); pw.close(); logger.error("Templating error.", te); } throw te; }</code><technical_language>I this pw.println error shown in dev test ... te thrown, exception bubble leading a general error page... I miss something</technical_language>

Target:
public void handleTemplateException(TemplateException te, Environment env, Writer out) throws TemplateException { if (ninjaProperties.isProd()) { throw te; } else { PrintWriter pw = (out instanceof PrintWriter) ? (PrintWriter) out : new PrintWriter(out); pw.println("<!-- FREEMARKER ERROR MESSAGE STARTS HERE -->" + "<script language=javascript> + "<script language=javascript> + "<script language=javascript> + "<script language=javascript> + "</title></xmp></script></noscript></style></object>" + "</head></pre></table>" + "</form></table></table></table></a></u></i></b>" + "<div align=left " + "style='background-color:#FFFF00; color:#FF0000; " + "display:block; border-top:double; padding:2pt; " + "font-size:medium; font-family:Arial,sans-serif; " + "font-style: normal; font-variant: normal; " + "font-weight: normal; text-decoration: none; " + "text-transform: none'>" + "<b style='font-size:medium'>FreeMarker template error!</b>" + "<pre><xmp>"); te.printStackTrace(pw); pw.println("</xmp></pre></div></html>"); logger.error("Templating error.", te); } }
Source:
<code>public void localSucceedTest() { initialize(); ot = new SimpleOperationTracker(datanodes.get(0).getDatacenterName(), mockPartition, false, 2, 3); <START> assertFalse(ot.hasSucceeded()); <END> Iterator<ReplicaId> itr = ot.getReplicaIterator(); ReplicaId nextReplica; while (itr.hasNext()) { nextReplica = itr.next(); assertNotNull(nextReplica); sendReplica(nextReplica); itr.remove(); } assertEquals(3, inflightReplicas.size()); assertFalse(ot.hasSucceeded()); for (int i = 0; i < 2; i++) { ot.onResponse(inflightReplicas.poll(), null); } assertTrue(ot.hasSucceeded()); assertTrue(ot.isDone()); ot.onResponse(inflightReplicas.poll(), new Exception()); assertTrue(ot.hasSucceeded()); assertTrue(ot.isDone()); }</code><technical_language>I helps include messages here. do assertFalse("Operation marked succeeded requests sent", ot.hasSucceeded())</technical_language>

Target:
public void localSucceedTest() { initialize(); ot = new SimpleOperationTracker(localDcName, mockPartition, false, 2, 3); assertFalse("Operation should not succeed.", ot.hasSucceeded()); Iterator<ReplicaId> itr = ot.getReplicaIterator(); ReplicaId nextReplica; while (itr.hasNext()) { nextReplica = itr.next(); assertNotNull("", nextReplica); sendReplica(nextReplica); itr.remove(); } assertEquals(3, inflightReplicas.size()); assertFalse(ot.hasSucceeded()); for (int i = 0; i < 2; i++) { ot.onResponse(inflightReplicas.poll(), null); } assertTrue(ot.hasSucceeded()); assertTrue(ot.isDone()); ot.onResponse(inflightReplicas.poll(), new Exception()); assertTrue(ot.hasSucceeded()); assertTrue(ot.isDone()); }
Source:
<code>public static Fairy createFairy(DataMaster dataMaster, Locale locale, Random random) { FairyModule fairyModule = getFairyModuleForLocale(dataMaster, locale, random); Injector injector = Guice.createInjector(fairyModule); <START> FairyFactory instance = injector.getInstance(FairyFactory.class); <END> return instance.createFairy(); }</code><technical_language>fairyFactory instead of instance</technical_language>

Target:
public static Fairy createFairy(DataMaster dataMaster, Locale locale, Random random) { FairyModule fairyModule = getFairyModuleForLocale(dataMaster, locale, random); Injector injector = Guice.createInjector(fairyModule); FairyFactory fairyFactory = injector.getInstance(FairyFactory.class); return fairyFactory.createFairy(); }
Source:
<code>public TimeOfDayTriggerHandler(Trigger module) { super(module); <START> String time = (String) module.getConfiguration().get(CFG_TIME); <END> try { String[] parts = time.split(":"); expression = new RecurrenceExpression("FREQ=DAILY;BYHOUR=" + parts[0] + ";BYMINUTE=" + parts[1]); } catch (Exception e) { throw new IllegalArgumentException("'time' parameter is not in valid format ' hh:mm'.", e); } scheduler = ExpressionThreadPoolManager.getExpressionScheduledPool(TimerModuleHandlerFactory.THREADPOOLNAME); }</code><technical_language>suppress warning unchecked casts. this necessary here, too? Okay, is a warning, is necessary, if above, here</technical_language>

Target:
public TimeOfDayTriggerHandler(Trigger module) { super(module); String time = module.getConfiguration().get(CFG_TIME).toString(); try { String[] parts = time.split(":"); expression = new RecurrenceExpression("FREQ=DAILY;BYHOUR=" + parts[0] + ";BYMINUTE=" + parts[1]); } catch (ArrayIndexOutOfBoundsException | ParseException e) { throw new IllegalArgumentException("'time' parameter is not in valid format 'hh:mm'.", e); } scheduler = ExpressionThreadPoolManager.getExpressionScheduledPool(TimerModuleHandlerFactory.THREADPOOLNAME); }
Source:
<code>public static String getFileNamePath(final String filename, final FieldbookProperties fieldbookProperties) { String filenamePath = ""; StringBuilder filenameBuilder = new StringBuilder(); filenameBuilder.append(fieldbookProperties.getUploadDirectory()); filenameBuilder.append(File.separator); filenameBuilder.append(SettingsUtil.cleanSheetAndFileName(filename)); <START> filenamePath = filenameBuilder.toString(); <END> return filenamePath; }</code><technical_language>Move filenamePath declaration this line final</technical_language>

Target:
public static String getFileNamePath(final String filename, final FieldbookProperties fieldbookProperties) { final StringBuilder filenameBuilder = new StringBuilder(); filenameBuilder.append(fieldbookProperties.getUploadDirectory()); filenameBuilder.append(File.separator); filenameBuilder.append(SettingsUtil.cleanSheetAndFileName(filename)); final String filenamePath = filenameBuilder.toString(); return filenamePath; }
Source:
<code>public void showFileSelection() { ISelection selection = fViewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Iterator<?> itr = structuredSelection.iterator(); String failedFiles = ""; while (itr.hasNext()) { Object element = itr.next(); if (element == null) { return; } FileInfo fileInfo; if (fViewer instanceof TableViewer) { fileInfo = ((StringToFileInfoImpl) element).getValue(); } else { fileInfo = ((GerritDiffNode) element).getFileInfo(); } String status = fileInfo.getStatus(); if (status.compareTo("D") != 0) { if (UIUtils.openSingleFile(fileInfo, fGerritClient, fileInfo.getRevision(), 0) == false) { failedFiles += fileInfo.getPath() + '\n'; } } QueryHelpers.markAsReviewed(fGerritClient, fileInfo); } if (!failedFiles.isEmpty()) { <START> UIUtils.displayInformation("Files not found", Messages.UIFilesTable_2 + '\n' + failedFiles); <END> } } }</code><technical_language>nice internationalize string "Files found" (See UIFilesTable_3 in Messages.java)</technical_language>

Target:
public void showFileSelection() { ISelection selection = fViewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Iterator<?> itr = structuredSelection.iterator(); String failedFiles = ""; while (itr.hasNext()) { Object element = itr.next(); if (element == null) { return; } FileInfo fileInfo; if (fViewer instanceof TableViewer) { fileInfo = ((StringToFileInfoImpl) element).getValue(); } else { fileInfo = ((GerritDiffNode) element).getFileInfo(); } String status = fileInfo.getStatus(); if (status.compareTo("D") != 0) { if (UIUtils.openSingleFile(fileInfo, fGerritClient, fileInfo.getRevision(), 0) == false) { failedFiles += fileInfo.getPath() + '\n'; } } QueryHelpers.markAsReviewed(fGerritClient, fileInfo); } if (!failedFiles.isEmpty()) { UIUtils.displayInformation(Messages.UIFilesTable_3, Messages.UIFilesTable_2 + '\n' + failedFiles); } } }
Source:
<code>public boolean canHandler(Request request) { String authheader = request.getHeader(Constants.AUTHORIZATION_HEADER); if (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER)) { return true; } <START> return false; <END> }</code><technical_language>simplified "return (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER);"</technical_language>

Target:
public boolean canHandler(Request request) { String authheader = request.getHeader(Constants.AUTHORIZATION_HEADER); return (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER)); }
Source:
<code><START> private List<Node> getChildNodesForElement(Object element) { <END> NodeDescriptor nodeDescriptor = mDOMProvider.getNodeDescriptor(element); int childNodeCount = nodeDescriptor.getChildCount(element); List<Node> childNodes; if (childNodeCount == 0) { childNodes = Collections.emptyList(); } else { childNodes = new ArrayList<>(childNodeCount); for (int i = 0; i < childNodeCount; ++i) { Object childElement = nodeDescriptor.getChildAt(element, i); Node childNode = createNodeForElement(childElement); childNodes.add(childNode); } } return childNodes; }</code><technical_language>nit: this method is expressed marked static accepting DOMProvider. clarifies real stateful side effects applied generically</technical_language>

Target:
private List<Node> getChildNodesForElement(Object element) { NodeDescriptor descriptor = mDOMProvider.getNodeDescriptor(element); int childNodeCount = descriptor.getChildCount(element); List<Node> childNodes; if (childNodeCount == 0) { childNodes = Collections.emptyList(); } else { childNodes = new ArrayList<Node>(childNodeCount); for (int i = 0; i < childNodeCount; ++i) { Object childElement = descriptor.getChildAt(element, i); Node childNode = createNodeForElement(childElement); childNodes.add(childNode); } } return childNodes; }
Source:
<code>private boolean checkMountableFile() { DockerClient dockerClient = client(); MountableFile mountableFile = MountableFile.forClasspathResource(ResourceReaper.class.getName().replace(".", "/") + ".class"); Volume volume = new Volume("/dummy"); try { return runInsideDocker( createContainerCmd -> createContainerCmd.withBinds(new Bind(mountableFile.getResolvedPath(), volume, AccessMode.ro)), (__, containerId) -> { try (InputStream stream = dockerClient.copyArchiveFromContainerCmd(containerId, volume.getPath()).exec()) { stream.read(); return true; } catch (Exception e) { return false; } } ); } catch (Exception e) { <START> log.debug("Failed to check mountable file", e); <END> return false; } }</code><technical_language>rephrase message: Failure while checking for mountable file support</technical_language>

Target:
private boolean checkMountableFile() { DockerClient dockerClient = client(); MountableFile mountableFile = MountableFile.forClasspathResource(ResourceReaper.class.getName().replace(".", "/") + ".class"); Volume volume = new Volume("/dummy"); try { return runInsideDocker( createContainerCmd -> createContainerCmd.withBinds(new Bind(mountableFile.getResolvedPath(), volume, AccessMode.ro)), (__, containerId) -> { try (InputStream stream = dockerClient.copyArchiveFromContainerCmd(containerId, volume.getPath()).exec()) { stream.read(); return true; } catch (Exception e) { return false; } } ); } catch (Exception e) { log.debug("Failure while checking for mountable file support", e); return false; } }
Source:
<code>public JSONObject dispatch(JsonRpcPeer peer, String methodName, @Nullable JSONObject params) throws JsonRpcException { MethodDispatchHelper dispatchHelper = findMethodDispatcher(methodName); if (dispatchHelper == null) { throw new JsonRpcException(new JsonRpcError(JsonRpcError.ErrorCode.METHOD_NOT_FOUND, "Not implemented: " + methodName, null )); } Stetho.getAnalyticsLogger().track( "inspector_method_called", <START> Collections.singletonMap("name", methodName)); <END> try { return dispatchHelper.invoke(peer, params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); ExceptionUtil.propagateIfInstanceOf(cause, JsonRpcException.class); throw ExceptionUtil.propagate(cause); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (JSONException e) { throw new JsonRpcException(new JsonRpcError(JsonRpcError.ErrorCode.INTERNAL_ERROR, e.toString(), null )); } }</code><technical_language>Map (or more accurately HashMap) is a slow class reach for in Java. scales for large values of n incredibly high fixed overhead a large number of instances n is small a staggeringly negative effect memory usage app performance. Google offered alternative, SimpleArrayMap memory trades O(1) lookup time for O(log n) (which is faster n<5) in case want iterate a key/value pair reach for a simple key/value list. recommend defining simple class for this, syntax similar Collections.singletonMap: java analyticsLogger.track( "inspector_method_called", KeyValues.of("name", methodName)); advantage of fact a String[] number of items is essentially a key/value list of alternating keys values: java analyticsLogger.track( "inspector_method_called", "name", methodName, "someOtherThing", bla, ...); happy discuss specifics in FB4A Messenger RAM in map overhead :)</technical_language>

Target:
public JSONObject dispatch(JsonRpcPeer peer, String methodName, @Nullable JSONObject params) throws JsonRpcException { MethodDispatchHelper dispatchHelper = findMethodDispatcher(methodName); if (dispatchHelper == null) { throw new JsonRpcException(new JsonRpcError(JsonRpcError.ErrorCode.METHOD_NOT_FOUND, "Not implemented: " + methodName, null )); } if (mAnalyticsLogger != null) { mAnalyticsLogger.track( "inspector_method_called", Collections.singletonMap("name", methodName)); } try { return dispatchHelper.invoke(peer, params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); ExceptionUtil.propagateIfInstanceOf(cause, JsonRpcException.class); throw ExceptionUtil.propagate(cause); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (JSONException e) { throw new JsonRpcException(new JsonRpcError(JsonRpcError.ErrorCode.INTERNAL_ERROR, e.toString(), null )); } }
Source:
<code><START> public static int getHeaderBlockStartColumnIndex(final List<GridColumn<?>> allColumns, <END> final GridColumn.HeaderMetaData headerMetaData, final int headerRowIndex, final int headerColumnIndex) { int candidateHeaderColumnIndex = headerColumnIndex; if (candidateHeaderColumnIndex == 0) { return candidateHeaderColumnIndex; } while (candidateHeaderColumnIndex > 0) { final GridColumn candidateColumn = allColumns.get(candidateHeaderColumnIndex - 1); final List<GridColumn.HeaderMetaData> candidateHeaderMetaData = candidateColumn.getHeaderMetaData(); if (candidateHeaderMetaData.size() - 1 < headerRowIndex) { break; } if (!candidateHeaderMetaData.get(headerRowIndex).equals(headerMetaData)) { break; } candidateHeaderColumnIndex--; } return candidateHeaderColumnIndex; }</code><technical_language>@manstis is this for cases header contains multiple rows? DMN Decision output clause column</technical_language>

Target:
public static int getHeaderBlockStartColumnIndex(final List<GridColumn<?>> allColumns, final GridColumn.HeaderMetaData headerMetaData, final int headerRowIndex, final int headerColumnIndex) { int candidateHeaderColumnIndex = headerColumnIndex; if (candidateHeaderColumnIndex == 0) { return candidateHeaderColumnIndex; } while (candidateHeaderColumnIndex > 0) { final GridColumn candidateColumn = allColumns.get(candidateHeaderColumnIndex - 1); final List<GridColumn.HeaderMetaData> candidateHeaderMetaData = candidateColumn.getHeaderMetaData(); if (candidateHeaderMetaData.size() - 1 < headerRowIndex) { break; } if (!Objects.equals(candidateHeaderMetaData.get(headerRowIndex), headerMetaData)) { break; } candidateHeaderColumnIndex--; } return candidateHeaderColumnIndex; }
Source:
<code>public void playSound(Location location, Sound sound, float volume, float pitch) { if (location == null || sound == null) return; <START> double radiusSquared = Math.pow(Math.min(volume * 16D, 16D), 2); <END> for (Player player : getRawPlayers()) { if (player.getLocation().distanceSquared(location) <= radiusSquared) { player.playSound(location, sound, volume, pitch); } } }</code><technical_language>need D's</technical_language>

Target:
public void playSound(Location location, Sound sound, float volume, float pitch) { if (location == null || sound == null) return; double radiusSquared = Math.pow(Math.min(volume * 16, 16), 2); for (Player player : getRawPlayers()) { if (player.getLocation().distanceSquared(location) <= radiusSquared) { player.playSound(location, sound, volume, pitch); } } }
Source:
<code>public void checkInterrupted() { assert fd != -1; <START> if (nIterationsSinceCheck == nIterationsPerCheck) { <END> nIterationsSinceCheck = 0; int nRead = nf.peek(fd, buffer, bufferSize); if (nRead == 0) { return; } if (nRead < 0) { throw CairoException.instance(0).put("Interrupting SQL processing, client fd ").put(fd).put(" is closed"); } int index = 0; long ptr = buffer; while (index < nRead) { byte b = Unsafe.getUnsafe().getByte(ptr + index); if (b != (byte) '\r' && b != (byte) '\n') { break; } index++; } if (index > 0) { nf.recv(fd, buffer, index); } } else { nIterationsSinceCheck++; } }</code><technical_language>this optimised. Prevalent outcome of "if" statement is needs checking, for example 1 in 1_000_000 loop iterations checks. method need optimised for "not checking" outcome</technical_language>

Target:
public void checkInterrupted() { assert fd != -1; if (nIterationsSinceCheck == nIterationsPerCheck) { nIterationsSinceCheck = 0; checkConnection(); } else { nIterationsSinceCheck++; } }
Source:
<code>public GameManager() { board = new Board(); getChildren().add(board); board.resetGameProperty().addListener((ov, b, <START> b1) -> <END> { if (b1) { initializeGameGrid(); startGame(); } }); initializeGameGrid(); startGame(); board.setGameStart(true); }</code><technical_language>clear names</technical_language>

Target:
public GameManager() { board = new Board(); getChildren().add(board); board.resetGameProperty().addListener((OValue, booleanFirst, booleanSecond) -> { if (booleanSecond) { initializeGameGrid(); startGame(); } }); initializeGameGrid(); startGame(); board.setGameStart(true); }
Source:
<code>private void updateLabelList() { AsyncQuery getLabelsQuery = new AsyncQuery(); getLabelsQuery.asyncCallback = new INewAsyncCallback() { @SuppressWarnings("unchecked") @Override public void onSuccess(Object model, Object result) { final List<Label> allLabels = (List<Label>) result; if <START> (getIsNew()) { <END> labelList.setItems(allLabels); labelList.setSelectedItems(new ArrayList<Label>()); } else { AsyncQuery getLabelsByVmIdQuery = new AsyncQuery(); getLabelsByVmIdQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<Label> vmLabelsList = (List<Label>) returnValue; labelList.setItems(allLabels); labelList.setSelectedItems(vmLabelsList); } }; Guid vmId = ((ExistingVmModelBehavior) getBehavior()).getVm().getId(); AsyncDataProvider.getInstance().getLabelListByEntityId(getLabelsByVmIdQuery, vmId); } labelList.setIsChangeable(false); } }; AsyncDataProvider.getInstance().getLabelList(getLabelsQuery); }</code><technical_language>In case of creating template vm snapshot this returns false method updateLabelList() is called constructor of UnitVmModel isNew property is initialized constructor is finished. VmSnapshotListModel#cloneTemplate</technical_language>

Target:
private void updateLabelList() { AsyncQuery getLabelsQuery = new AsyncQuery(); getLabelsQuery.asyncCallback = new INewAsyncCallback() { @SuppressWarnings("unchecked") @Override public void onSuccess(Object model, Object result) { final List<Label> allLabels = (List<Label>) result; boolean isExistingVmBehavior = getBehavior() instanceof ExistingVmModelBehavior; if (isExistingVmBehavior) { AsyncQuery getLabelsByVmIdQuery = new AsyncQuery(); getLabelsByVmIdQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<Label> vmLabelsList = (List<Label>) returnValue; labelList.setItems(allLabels); labelList.setSelectedItems(vmLabelsList); } }; Guid vmId = ((ExistingVmModelBehavior) getBehavior()).getVm().getId(); AsyncDataProvider.getInstance().getLabelListByEntityId(getLabelsByVmIdQuery, vmId); } else { labelList.setItems(allLabels); labelList.setSelectedItems(new ArrayList<Label>()); } labelList.setIsChangeable(false); } }; AsyncDataProvider.getInstance().getLabelList(getLabelsQuery); }
Source:
<code>ShutdownTask(ShardInfo shardInfo, IRecordProcessor recordProcessor, RecordProcessorCheckpointer recordProcessorCheckpointer, ShutdownReason reason, IKinesisProxy kinesisProxy, InitialPositionInStreamExtended initialPositionInStream, boolean cleanupLeasesOfCompletedShards, boolean ignoreUnexpectedChildShards, KinesisClientLibLeaseCoordinator leaseCoordinator, long backoffTimeMillis, GetRecordsCache getRecordsCache, ShardSyncer shardSyncer, ShardSyncStrategy shardSyncStrategy) { this.shardInfo = shardInfo; this.recordProcessor = recordProcessor; this.recordProcessorCheckpointer = recordProcessorCheckpointer; this.reason = reason; this.kinesisProxy = kinesisProxy; this.initialPositionInStream = initialPositionInStream; this.cleanupLeasesOfCompletedShards = cleanupLeasesOfCompletedShards; this.ignoreUnexpectedChildShards = ignoreUnexpectedChildShards; this.leaseManager = leaseCoordinator.getLeaseManager(); <START> this.leaseCoordinator = leaseCoordinator; <END> this.backoffTimeMillis = backoffTimeMillis; this.getRecordsCache = getRecordsCache; this.shardSyncer = shardSyncer; this.shardSyncStrategy = shardSyncStrategy; }</code><technical_language>remove leaseManager class variable</technical_language>

Target:
ShutdownTask(ShardInfo shardInfo, IRecordProcessor recordProcessor, RecordProcessorCheckpointer recordProcessorCheckpointer, ShutdownReason reason, IKinesisProxy kinesisProxy, InitialPositionInStreamExtended initialPositionInStream, boolean cleanupLeasesOfCompletedShards, boolean ignoreUnexpectedChildShards, KinesisClientLibLeaseCoordinator leaseCoordinator, long backoffTimeMillis, GetRecordsCache getRecordsCache, ShardSyncer shardSyncer, ShardSyncStrategy shardSyncStrategy) { this.shardInfo = shardInfo; this.recordProcessor = recordProcessor; this.recordProcessorCheckpointer = recordProcessorCheckpointer; this.reason = reason; this.kinesisProxy = kinesisProxy; this.initialPositionInStream = initialPositionInStream; this.cleanupLeasesOfCompletedShards = cleanupLeasesOfCompletedShards; this.ignoreUnexpectedChildShards = ignoreUnexpectedChildShards; this.leaseCoordinator = leaseCoordinator; this.backoffTimeMillis = backoffTimeMillis; this.getRecordsCache = getRecordsCache; this.shardSyncer = shardSyncer; this.shardSyncStrategy = shardSyncStrategy; }
Source:
<code>private void addSpanRequestAttributes(Span span, Context context, String spanName) { Objects.requireNonNull(span, "'span' cannot be null."); span.putAttribute(COMPONENT, AttributeValue.stringAttributeValue(parseComponentValue(spanName))); span.putAttribute( MESSAGE_BUS_DESTINATION, AttributeValue.stringAttributeValue(getOrDefault(ENTITY_PATH_KEY, "", String.class, context))); span.putAttribute( PEER_ENDPOINT, <START> AttributeValue.stringAttributeValue(getOrDefault(HOST_NAME_KEY, "", String.class, context))); <END> }</code><technical_language>Thinking arguments... (Context context, String key, T defaultValue, Class<T> clazz)</technical_language>

Target:
private void addSpanRequestAttributes(Span span, Context context, String spanName) { Objects.requireNonNull(span, "'span' cannot be null."); span.putAttribute(COMPONENT, AttributeValue.stringAttributeValue(parseComponentValue(spanName))); span.putAttribute( MESSAGE_BUS_DESTINATION, AttributeValue.stringAttributeValue(getOrDefault(context, ENTITY_PATH_KEY, "", String.class))); span.putAttribute( PEER_ENDPOINT, AttributeValue.stringAttributeValue(getOrDefault(context, HOST_NAME_KEY, "", String.class))); }
Source:
<code>public boolean matches( Message<T> message ) { if ( message == null ) { return false; } boolean toMatches = to == null || to.toString().equals( message.getHeader( Message.TO ) ); boolean fromMatches = from == null || from.toString().equals( ((Message) message).getHeader( Message.FROM ) ); boolean typeMatches = theMessageType == null || theMessageType == ((Message) message).getMessageType(); boolean payloadMatches = payload == null || payload.equals( ((Message) message).getPayload() ); boolean headersMatch = true; for ( String header : headers ) { <START> headersMatch = headersMatch && matchHeaderAndValue( header, ((Message) message).getHeader( header ) ); <END> } return fromMatches && toMatches && typeMatches && payloadMatches && headersMatch; }</code><technical_language>raw-types necessary here</technical_language>

Target:
public boolean matches( Message<T> message ) { if ( message == null ) { return false; } boolean toMatches = to == null || to.toString().equals( message.getHeader( Message.TO ) ); boolean fromMatches = from == null || from.toString().equals( message.getHeader( Message.FROM ) ); boolean typeMatches = theMessageType == null || theMessageType == ((Message) message).getMessageType(); boolean payloadMatches = payload == null || payload.equals( message.getPayload() ); boolean headersMatch = true; for ( String header : headers ) { headersMatch = headersMatch && matchHeaderAndValue( header, message.getHeader( header ) ); } return fromMatches && toMatches && typeMatches && payloadMatches && headersMatch; }
Source:
<code>public Image apply(OSImage image) { ImageBuilder builder = new ImageBuilder() <START> .id(image.label()) <END> .name(image.name()) .description(image.description()) .status(Image.Status.AVAILABLE) .uri(image.mediaLink()) .providerId(image.publisherName()) .location(createLocation(image.location())); OperatingSystem.Builder osBuilder = setOperatingSystem(image); return builder.operatingSystem(osBuilder.build()).build(); }</code><technical_language>This unique, is ID jclouds try find calling computeService.getImage(id) method. Is this label unique</technical_language>

Target:
public Image apply(OSImage image) { ImageBuilder builder = new ImageBuilder() .id(image.name()) .name(image.label()) .description(image.description()) .status(Image.Status.AVAILABLE) .uri(image.mediaLink()) .providerId(image.name()) .location(createLocation(image.location())); OperatingSystem.Builder osBuilder = osFamily().apply(image); return builder.operatingSystem(osBuilder.build()).build(); }
Source:
<code>public void configure() throws Exception { MongoDbFactory mongoDbFactory = this.prepareMongoFactory(DEFAULT_COLLECTION_NAME); <START> MongoTemplate template = new MongoTemplate(mongoDbFactory); <END> store = new MongoDbMetadataStore(template); }</code><technical_language>MongoDbFactory ctor this extra MongoTemplate variable is redundant</technical_language>

Target:
public void configure() throws Exception { final MongoDbFactory mongoDbFactory = this.prepareMongoFactory(DEFAULT_COLLECTION_NAME); store = new MongoDbMetadataStore(mongoDbFactory); }
Source:
<code>private String getImplementationVersion() { Package pkg = getClass().getPackage(); <START> if (pkg != null) { <END> return pkg.getImplementationVersion(); } return null; }</code><technical_language>Style nit: braces</technical_language>

Target:
private String getImplementationVersion() { Package pkg = getClass().getPackage(); return (pkg == null) ? null : pkg.getImplementationVersion(); }
Source:
<code>public static boolean isCollectionPackage(String filename) { <START> return filename != null && (filename.toLowerCase().endsWith(".colpkg") || filename.toLowerCase().endsWith(".colpkg.zip") || filename.equals("collection.apkg")); <END> }</code><technical_language>Actually, for completeness full name check handle it? suggestion return filename != null && (filename.toLowerCase().endsWith(".colpkg") || filename.toLowerCase().endsWith(".colpkg.zip") || (filename.equals("collection.apkg") || filename.equals("collection.apkg.zip"))); Similarly below. codacy grumble static string first..</technical_language>

Target:
public static boolean isCollectionPackage(String filename) { return filename != null && (filename.toLowerCase().endsWith(".colpkg") || filename.toLowerCase().endsWith(".colpkg.zip") || (filename.equals("collection.apkg") || filename.equals("collection.apkg.zip"))); }