auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static byte[] buildAndSaveKeystore(final List<Ternary<String, String, String>> certs, final String storePassword) throws KeyStoreException, NoSuchAlgorithmException, <END> CertificateException, IOException, InvalidKeySpecException { final KeyStore ks = KeyStore.getInstance("JKS"); ks.load(null, storePassword != null ? storePassword.toCharArray() : null); for (final Ternary<String, String, String> cert : certs) { if (cert.third() == null) { final Certificate c = buildCertificate(cert.second()); ks.setCertificateEntry(cert.first(), c); } else { final Certificate[] c = new Certificate[certs.size()]; int i = certs.size(); for (final Ternary<String, String, String> ct : certs) { c[i - 1] = buildCertificate(ct.second()); i--; } ks.setKeyEntry(cert.first(), buildPrivateKey(cert.third()), storePassword != null ? storePassword.toCharArray() : null, c); } } try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { ks.store(os, storePassword != null ? storePassword.toCharArray() : null); return os.toByteArray(); } }</code><technical_language>Please consider adding a Preconditions.checkArgument check certs is null</technical_language>

Target:
public static byte[] buildAndSaveKeystore(final List<Ternary<String, String, String>> certs, final String storePassword) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, InvalidKeySpecException { Preconditions.checkNotNull(certs, "List of certificates to be saved in keystore cannot be null"); char password[] = null; if (storePassword != null) { password = storePassword.toCharArray(); } final KeyStore ks = KeyStore.getInstance("JKS"); ks.load(null, password); for (final Ternary<String, String, String> cert : certs) { if (cert.third() == null) { final Certificate c = buildCertificate(cert.second()); ks.setCertificateEntry(cert.first(), c); } else { final Certificate[] c = new Certificate[certs.size()]; int i = certs.size(); for (final Ternary<String, String, String> ct : certs) { c[i - 1] = buildCertificate(ct.second()); i--; } ks.setKeyEntry(cert.first(), buildPrivateKey(cert.third()), password, c); } } try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { ks.store(os, password); return os.toByteArray(); } }
Source:
<code>public ValidationResult networkQosExistsOrNull() { <START> return vnicProfile.getNetworkQosId() != null && getNetworkQos() == null <END> ? new ValidationResult(VdcBllMessages.NETWORK_QOS_NOT_EXISTS) : ValidationResult.VALID; }</code><technical_language>positive: return vnicProfile.getNetworkQosId() == null || getNetworkQos() != null ? ValidationResult.VALID : new ValidationResult(VdcBllMessages.NETWORK_QOS_NOT_EXISTS) ;</technical_language>

Target:
public ValidationResult networkQosExistsOrNull() { return vnicProfile.getNetworkQosId() == null || getDbFacade().getQosDao().get(vnicProfile.getNetworkQosId()) != null ? ValidationResult.VALID : new ValidationResult(VdcBllMessages.NETWORK_QOS_NOT_EXISTS); }
Source:
<code>public void writeTo(Object object, TreePruner pruner, DataWriter writer) throws IOException { TreePruner child = pruner.accept(object, this); if (child==null) return; <START> Object d = writer.getExportConfig().getExportInterceptor().getValue(this,object,writer.getExportConfig()); <END> if ((d==null && skipNull) || d == ExportInterceptor.SKIP) { return; } if (merge) { if (d != null) { if (d.getClass().getAnnotation(ExportedBean.class) == null) { if(writer.getExportConfig().isSkipIfFail()){ return; } else { throw new NotExportableException(d.getClass()); } } Model model = owner.getOrNull(d.getClass(), parent.type, name); model.writeNestedObjectTo(d, new FilteringTreePruner(parent.HAS_PROPERTY_NAME_IN_ANCESTRY,child), writer); } } else { writer.name(name); writeValue(type, d, child, writer); } }</code><technical_language>gratuitous, revert</technical_language>

Target:
public void writeTo(Object object, TreePruner pruner, DataWriter writer) throws IOException { TreePruner child = pruner.accept(object, this); if (child==null) return; Object d = writer.getExportConfig().getExportInterceptor().getValue(this,object, writer.getExportConfig()); if ((d==null && skipNull) || d == ExportInterceptor.SKIP) { return; } if (merge) { if (d != null) { Class<?> objectType = d.getClass(); Model model = owner.getOrNull(objectType, parent.type, name); if (model == null && !writer.getExportConfig().isSkipIfFail()) { throw new NotExportableException(objectType); } else if (model != null) { model.writeNestedObjectTo(d, new FilteringTreePruner(parent.HAS_PROPERTY_NAME_IN_ANCESTRY,child), writer); } } } else { writer.name(name); writeValue(type, d, child, writer); } }
Source:
<code>public void testGetStreamIds() { <START> assertEquals(ImmutableList.of(), ImmutableList.copyOf( <END> new StreamConfig(new MapConfig()).getStreamIds())); StreamConfig streamConfig = new StreamConfig(new MapConfig(ImmutableMap.of( String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property", "value"))); assertEquals(ImmutableList.of(STREAM_ID), ImmutableList.copyOf(streamConfig.getStreamIds())); streamConfig = new StreamConfig(new MapConfig(ImmutableMap.of( String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property.subProperty", "value"))); assertEquals(ImmutableList.of(STREAM_ID), ImmutableList.copyOf(streamConfig.getStreamIds())); streamConfig = new StreamConfig(new MapConfig(ImmutableMap.of( String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property0", "value", String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property1", "value", String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property.subProperty0", "value", String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property.subProperty1", "value", String.format(StreamConfig.STREAM_ID_PREFIX, OTHER_STREAM_ID) + ".property", "value"))); assertEquals(ImmutableList.of(STREAM_ID, OTHER_STREAM_ID), ImmutableList.copyOf(streamConfig.getStreamIds())); }</code><technical_language>getStreamIds returns a Set, change expected values compare Set? I realize testGetStreamIds originally written compare a Set instead of List</technical_language>

Target:
public void testGetStreamIds() { assertEquals(ImmutableList.of(), ImmutableList.copyOf( new StreamConfig(new MapConfig()).getStreamIds())); StreamConfig streamConfig = new StreamConfig(new MapConfig(ImmutableMap.of( String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property", "value"))); assertEquals(ImmutableSet.of(STREAM_ID), ImmutableSet.copyOf(streamConfig.getStreamIds())); streamConfig = new StreamConfig(new MapConfig(ImmutableMap.of( String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property.subProperty", "value"))); assertEquals(ImmutableSet.of(STREAM_ID), ImmutableSet.copyOf(streamConfig.getStreamIds())); streamConfig = new StreamConfig(new MapConfig(ImmutableMap.of( String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property0", "value", String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property1", "value", String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property.subProperty0", "value", String.format(StreamConfig.STREAM_ID_PREFIX, STREAM_ID) + ".property.subProperty1", "value", String.format(StreamConfig.STREAM_ID_PREFIX, OTHER_STREAM_ID) + ".property", "value"))); assertEquals(ImmutableSet.of(STREAM_ID, OTHER_STREAM_ID), ImmutableSet.copyOf(streamConfig.getStreamIds())); }
Source:
<code>private List<Window> fetchWindowsInQueue() { List<Window> windows = Lists.newArrayList(getWindows()); <START> return ImmutableList.copyOf(Lists.reverse(windows)); <END> }</code><technical_language>Remove reversal here, JDK 8 implementation return in reverse, JDK 9 implementation *not* reversed</technical_language>

Target:
private List<Window> fetchWindowsInQueue() { return ImmutableList.copyOf(getWindows()); }
Source:
<code>public void verifyDatasetVersions(Collection collection, CollectionReader collectionReader, Session session) throws ZebedeeException, IOException { if (CMSFeatureFlags.cmsFeatureFlags().isDatasetVersionVerificationEnabled()) { info().collectionID(collection).log("dataset version verification feature enabled verifying collection"); try { versionsService.verifyCollectionDatasets(zebedeeCmsService.getZebedeeReader(), collection, collectionReader, session); } catch (VersionNotFoundException ex) { <START> info().collectionID(collection) <END> .user(session) .exception(ex) .log("error verifying collection datasets"); throw new UnexpectedErrorException(ex.getMessage(), 409); } } }</code><technical_language>this error() instead of info()</technical_language>

Target:
public void verifyDatasetVersions(Collection collection, CollectionReader collectionReader, Session session) throws ZebedeeException, IOException { if (CMSFeatureFlags.cmsFeatureFlags().isDatasetVersionVerificationEnabled()) { info().collectionID(collection).log("dataset version verification feature enabled verifying collection"); try { versionsService.verifyCollectionDatasets(zebedeeCmsService.getZebedeeReader(), collection, collectionReader, session); } catch (VersionNotFoundException ex) { error().collectionID(collection) .user(session) .exception(ex) .log("collection approval denied. Error verifying dataset(s) - version(s) not found in either" + " collection or published content"); throw new UnexpectedErrorException(ex.getMessage(), 409); } } }
Source:
<code>public MatchClause append(Filter filter) { boolean wasPreviousSegmentRelationshipEntity = false; for (Filter.NestedPathSegment segment : filter.getNestedPath()) { boolean nestedRelationshipEntity = segment.isNestedRelationshipEntity(); if (!wasPreviousSegmentRelationshipEntity) { <START> if (segment.getRelationshipDirection().equals(Direction.INCOMING)) { <END> clause.append("<"); } clause.append( String.format("-[%s:`%s`]-", nestedRelationshipEntity && isLastSegment(filter, segment) ? "r" + index : "", segment.getRelationshipType())); if (segment.getRelationshipDirection().equals(Direction.OUTGOING)) { clause.append(">"); } } if (!nestedRelationshipEntity && !isLastSegment(filter, segment)) { clause.append(String.format("(:`%s`)", segment.getNestedEntityTypeLabel())); } wasPreviousSegmentRelationshipEntity = nestedRelationshipEntity; } clause.append(String.format("(%s) ", "m" + index)); return this; }</code><technical_language>suggestion if (segment.getRelationshipDirection() == Direction.INCOMING) {</technical_language>

Target:
public MatchClause append(Filter filter) { boolean wasPreviousSegmentRelationshipEntity = false; for (Filter.NestedPathSegment segment : filter.getNestedPath()) { boolean nestedRelationshipEntity = segment.isNestedRelationshipEntity(); if (!wasPreviousSegmentRelationshipEntity) { if (segment.getRelationshipDirection() == Direction.INCOMING) { clause.append("<"); } clause.append( String.format("-[%s:`%s`]-", nestedRelationshipEntity && isLastSegment(filter, segment) ? "r" + index : "", segment.getRelationshipType())); if (segment.getRelationshipDirection() == Direction.OUTGOING) { clause.append(">"); } } if (!nestedRelationshipEntity && !isLastSegment(filter, segment)) { clause.append(String.format("(:`%s`)", segment.getNestedEntityTypeLabel())); } wasPreviousSegmentRelationshipEntity = nestedRelationshipEntity; } clause.append(String.format("(%s) ", "m" + index)); return this; }
Source:
<code>public void testTypeConfiguration() throws Exception { ColumnTypingStrategy strategy = ColumnTypingStrategies.customTypes(ColumnType.STRING, ColumnType.NUMBER); <START> try ( final ColumnTypingSession session = strategy.startColumnTypingSession() ) { <END> assertEquals(ColumnType.STRING, session.getNextColumnType(new ColumnTypingContextImpl(0))); assertEquals(ColumnType.NUMBER, session.getNextColumnType(new ColumnTypingContextImpl(1))); } }</code><technical_language>In a try resources statement resource is implicitly final, remove final modifier</technical_language>

Target:
public void testTypeConfiguration() throws Exception { ColumnTypingStrategy strategy = ColumnTypingStrategies.getCustomStrategy(ColumnType.STRING, ColumnType.NUMBER); try (ColumnTypingSession session = strategy.startColumnTypingSession()) { assertEquals(ColumnType.STRING, session.getNextColumnType(new ColumnTypingContext(0))); assertEquals(ColumnType.NUMBER, session.getNextColumnType(new ColumnTypingContext(1))); } }
Source:
<code>public String jwt(final Authentication authentication) { final Jwt token = (Jwt) authentication.getPrincipal(); @SuppressWarnings("unchecked") final Collection<String> scopes = (Collection<String>) token.getClaims().get("scope"); return String.format( <START> "Hello, %s! You are sucessfully authenticated and granted with %s scopes using a JavaWebToken.", <END> token.getSubject(), scopes.toString()); }</code><technical_language>Jwt is name of class JSON Web Token is JWT stands for</technical_language>

Target:
public String jwt(final Authentication authentication) { final Jwt token = (Jwt) authentication.getPrincipal(); final String scopes = token.getClaimAsString("scope"); return String.format( "Hello, %s! You are sucessfully authenticated and granted with %s scopes using a Jwt.", token.getSubject(), scopes); }
Source:
<code>public static Tuple<String> parseAutoEventValue(String automaticEventValue) { int lastIndex = automaticEventValue.lastIndexOf(":P"); if (lastIndex == -1) { return new Tuple<>(ActivityEventObjectType.ENROLLMENT.name().toLowerCase(), automaticEventValue); <START> } <END> return new Tuple<>(automaticEventValue.substring(0, lastIndex), automaticEventValue.substring(lastIndex+1)); }</code><technical_language>default enrollment. mPower 2.0 configs change anyway, back-compat is a non-issue. Adding a special case for enrollment adds complexity confusion. If absolutely need a default for some reason, default activities_retrieved</technical_language>

Target:
public static Tuple<String> parseAutoEventValue(String automaticEventValue) { int lastIndex = automaticEventValue.lastIndexOf(":P"); if (lastIndex == -1) { return new Tuple<>(null, automaticEventValue); } return new Tuple<>(automaticEventValue.substring(0, lastIndex), automaticEventValue.substring(lastIndex+1)); }
Source:
<code>private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) { IBreakpoint newBreakpoint = null; Object[] children = container.getChildren(); for (Object <START> childElement : <END> refContainer.getChildren()) { Object element = getElement(children, childElement); if (element == null) { if (childElement instanceof BreakpointContainer) { BreakpointContainer.addChildContainer(container, (BreakpointContainer) childElement, containerDelta); } else if(childElement instanceof IBreakpoint) { BreakpointContainer.addBreakpoint(container, (IBreakpoint) childElement, containerDelta); if (newBreakpoint == null) { newBreakpoint = (IBreakpoint) childElement; } } } else if (element instanceof BreakpointContainer) { ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1); BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) childElement); newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) childElement, childDelta); childDelta.setChildCount(((BreakpointContainer) element).getChildren().length); } } return newBreakpoint; }</code><technical_language>Rename this refChildElement refChild</technical_language>

Target:
private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) { IBreakpoint newBreakpoint = null; Object[] children = container.getChildren(); for (Object refChildElement : refContainer.getChildren()) { Object element = getElement(children, refChildElement); if (element == null) { if (refChildElement instanceof BreakpointContainer) { BreakpointContainer.addChildContainer(container, (BreakpointContainer) refChildElement, containerDelta); } else if(refChildElement instanceof IBreakpoint) { BreakpointContainer.addBreakpoint(container, (IBreakpoint) refChildElement, containerDelta); if (newBreakpoint == null) { newBreakpoint = (IBreakpoint) refChildElement; } } } else if (element instanceof BreakpointContainer) { ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1); BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) refChildElement); newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) refChildElement, childDelta); childDelta.setChildCount(((BreakpointContainer) element).getChildren().length); } } return newBreakpoint; }
Source:
<code><START> public void testSerde() throws JsonParseException, JsonMappingException, JsonProcessingException, IOException <END> { ObjectMapper mapper = new DefaultObjectMapper(); SketchEstimateWithErrorBounds est = new SketchEstimateWithErrorBounds(100.0,101.5,98.5,2); Assert.assertEquals(est, mapper.readValue( mapper.writeValueAsString(est), SketchEstimateWithErrorBounds.class)); }</code><technical_language>need IOException</technical_language>

Target:
public void testSerde() throws IOException { ObjectMapper mapper = new DefaultObjectMapper(); SketchEstimateWithErrorBounds est = new SketchEstimateWithErrorBounds(100.0,101.5,98.5,2); Assert.assertEquals(est, mapper.readValue( mapper.writeValueAsString(est), SketchEstimateWithErrorBounds.class)); }
Source:
<code>public void execute(IProgressMonitor m) throws CoreException { IProgressMonitor monitor; if (m == null) monitor = new NullProgressMonitor(); else monitor = m; IWorkspaceRunnable action = new IWorkspaceRunnable() { public void run(IProgressMonitor actMonitor) throws CoreException { String taskName; if (branches.size() == 1) taskName = NLS.bind( CoreText.DeleteBranchOperation_TaskName, branches .iterator().next().getName()); else { StringBuilder names = new StringBuilder(); for (Iterator<Ref> it = branches.iterator(); it.hasNext(); ) { Ref ref = it.next(); names.append(ref.getName()); if (it.hasNext()) names.append(", "); } taskName = NLS.bind( CoreText.DeleteBranchOperation_TaskName, <START> names.substring(0, names.length() - 2)); <END> } actMonitor.beginTask(taskName, branches.size()); for (Ref branch : branches) { try { new Git(repository).branchDelete().setBranchNames( branch.getName()).setForce(force).call(); status = OK; } catch (NotMergedException e) { status = REJECTED_UNMERGED; break; } catch (CannotDeleteCurrentBranchException e) { status = REJECTED_CURRENT; break; } catch (JGitInternalException e) { throw new CoreException(Activator.error(e.getMessage(), e)); } actMonitor.worked(1); } actMonitor.done(); } }; ResourcesPlugin.getWorkspace().run(action, monitor); }</code><technical_language>conditionally added comma need do a substring(0, length - 2)</technical_language>

Target:
public void execute(IProgressMonitor m) throws CoreException { IProgressMonitor monitor; if (m == null) monitor = new NullProgressMonitor(); else monitor = m; IWorkspaceRunnable action = new IWorkspaceRunnable() { public void run(IProgressMonitor actMonitor) throws CoreException { String taskName; if (branches.size() == 1) taskName = NLS.bind( CoreText.DeleteBranchOperation_TaskName, branches .iterator().next().getName()); else { StringBuilder names = new StringBuilder(); for (Iterator<Ref> it = branches.iterator(); it.hasNext(); ) { Ref ref = it.next(); names.append(ref.getName()); if (it.hasNext()) names.append(", "); } taskName = NLS.bind( CoreText.DeleteBranchOperation_TaskName, names); } actMonitor.beginTask(taskName, branches.size()); for (Ref branch : branches) { try { new Git(repository).branchDelete().setBranchNames( branch.getName()).setForce(force).call(); status = OK; } catch (NotMergedException e) { status = REJECTED_UNMERGED; break; } catch (CannotDeleteCurrentBranchException e) { status = REJECTED_CURRENT; break; } catch (JGitInternalException e) { throw new CoreException(Activator.error(e.getMessage(), e)); } actMonitor.worked(1); } actMonitor.done(); } }; ResourcesPlugin.getWorkspace().run(action, monitor); }
Source:
<code>public Transceiver readFlaggedComments() throws IOException { return new Transceiver() { @Override protected HashSet<CommentNodeView> getData() throws IOException { CommentNodeView.Factory viewFactory = new CommentNodeView.Factory(runtimeConfiguration); return getAllFlags().stream() .map(Flag::getFlaggedComment) .map(viewFactory::create) <START> .collect(Collectors.toCollection(HashSet::new)); <END> } @Override protected Calendar getLastModifiedDate() throws IOException { return null; } }; }</code><technical_language>Collectors.toSet() is terser (and Set<> is a return type HashSet<>)</technical_language>

Target:
public Transceiver readFlaggedComments() throws IOException { return new Transceiver() { @Override protected Set<CommentNodeView> getData() throws IOException { CommentNodeView.Factory viewFactory = new CommentNodeView.Factory(runtimeConfiguration); return getAllFlags().stream() .map(Flag::getFlaggedComment) .map(viewFactory::create) .collect(Collectors.toSet()); } @Override protected Calendar getLastModifiedDate() throws IOException { return null; } }; }
Source:
<code>public Vm defaultVmMapper(final Cloudlet cloudlet) { <START> if (cloudlet.isBindToVm() && this.equals(cloudlet.getVm().getBroker()) && cloudlet.getVm().isCreated()) { <END> return cloudlet.getVm(); } if (firstVmMapperCall) { for (Vm vm : getVmCreatedList()) { updateNumberOfPes(vm.getId(), vm.getNumberOfPes()); } firstVmMapperCall = false; } Optional<Map.Entry<Long, Long>> minVmPes = vmNumberOfPesUpdated .entrySet() .stream() .filter(x -> x.getValue() >= cloudlet.getNumberOfPes()) .min(Comparator.comparingLong(x -> x.getValue())); if (minVmPes.isPresent()) { Vm mappedVm = getVmCreatedList() .stream() .filter(vm -> vm.getId() == minVmPes.get().getKey()) .findFirst() .orElse(Vm.NULL); if (mappedVm != Vm.NULL) { LOGGER.debug("{} (PEs: {}) mapped to (available PEs: {})", cloudlet, cloudlet.getNumberOfPes(), mappedVm, vmNumberOfPesUpdated.get(mappedVm.getId())); updateNumberOfPes(mappedVm.getId(), mappedVm.getNumberOfPes() - cloudlet.getNumberOfPes()); } return mappedVm; } else { LOGGER.warn("{} (PEs: {}) couldn't be mapped to any VM", cloudlet, cloudlet.getNumberOfPes()); } return Vm.NULL; }</code><technical_language>isBindToVm is misspelled, please rename isBoundToVm. This line is repeated in broker implementations. Please introduce method in Cloudlet interface (and implementation in CloudletSimple): java /** * Checks if Cloudlet is bound some VM, if VM is created belongs Cloudlet's broker. * @return true if Cloudlet is bound a VM created for broker, false */ public boolean isBoundToCreatedVm(){ return isBindToVm() && this.getBroker().equals(this.getVm().getBroker()) && this.getVm().isCreated() } DatacenterBrokerSimple.defaultVmMapper call this new method</technical_language>

Target:
public Vm defaultVmMapper(final Cloudlet cloudlet) { if (cloudlet.isBoundToCreatedVm()) { return cloudlet.getVm(); } final Vm mappedVm = getVmCreatedList() .stream() .filter(vm -> vm.getExpectedFreePesNumber() >= cloudlet.getNumberOfPes()) .min(Comparator.comparingLong(vm -> vm.getExpectedFreePesNumber())) .orElse(Vm.NULL); if(mappedVm != Vm.NULL){ LOGGER.debug("{}: {}: (PEs: {}) mapped to (available PEs: {}, tot PEs: {})", getSimulation().clock(), getName(), cloudlet, cloudlet.getNumberOfPes(), mappedVm, mappedVm.getExpectedFreePesNumber(), mappedVm.getFreePesNumber()); } else { LOGGER.warn(": {}: {}: (PEs: {}) couldn't be mapped to any VM", getSimulation().clock(), getName(), cloudlet, cloudlet.getNumberOfPes()); } return mappedVm; }
Source:
<code>public void shouldInvokeStorageServiceAndResetContributorsWhenEventIsCreatedByCopy() { DocumentModel doc = session.createDocumentModel("File"); Map<String, Serializable> properties = new HashMap<>(); properties.put(RESET_CREATOR, true); DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), doc); <START> ctx.setProperties(properties); <END> Event event = ctx.newEvent(DOCUMENT_CREATED_BY_COPY); eventService.fireEvent(event); Calendar expectedDate = Calendar.getInstance(); expectedDate.setTime(new Date(event.getTime())); assertNull(doc.getPropertyValue("dc:creator")); assertNull(doc.getPropertyValue("dc:contributors")); assertNull(doc.getPropertyValue("dc:lastContributor")); verify(storageService).setCreationDate(eq(doc), eq(expectedDate)); verify(storageService).setModificationDate(eq(doc), eq(expectedDate)); verify(storageService).addContributor(eq(doc), eq(event)); }</code><technical_language>Collections.singletonMap</technical_language>

Target:
public void shouldInvokeStorageServiceAndResetContributorsWhenEventIsCreatedByCopy() { DocumentModel doc = session.createDocumentModel("File"); Map<String, Serializable> properties = new HashMap<>(); properties.put(RESET_CREATOR, true); DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), doc); ctx.setProperties(properties); Event event = ctx.newEvent(DOCUMENT_CREATED_BY_COPY, FLAG_INLINE); eventService.fireEvent(event); Calendar expectedDate = Calendar.getInstance(); expectedDate.setTime(new Date(event.getTime())); assertNull(doc.getPropertyValue(DUBLINCORE_CREATOR_PROPERTY)); assertNull(doc.getPropertyValue(DUBLINCORE_CONTRIBUTORS_PROPERTY)); assertNull(doc.getPropertyValue(DUBLINCORE_LAST_CONTRIBUTOR_PROPERTY)); verify(storageService).setCreationDate(eq(doc), eq(expectedDate)); verify(storageService).setModificationDate(eq(doc), eq(expectedDate)); verify(storageService).addContributor(eq(doc), eq(event)); }
Source:
<code>public DhcpdImpl() { <START> Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { <END> @Override public void run() { DhcpdImpl.this.shutdown = true; DhcpdImpl.this.port67Listener.stop(); DhcpdImpl.this.port68Listener.stop(); LOG.debug("Dhcpd terminated successfully."); } })); }</code><technical_language>cleanup bundle is destroyed a shutdown hook</technical_language>

Target:
public DhcpdImpl() { }
Source:
<code>void update(ObservationPoint obsPoint, MapView mapView, boolean isMlsPointUpdate) { final Projection pj = mapView.getProjection(); GeoPoint geoPoint = (isMlsPointUpdate)? obsPoint.pointMLS : obsPoint.pointGPS; if (geoPoint == null) { <START> Log.i(LOG_TAG, "Caller error: geoPoint is null"); <END> return; } final Point point = pj.toPixels(geoPoint, null); final int size = mSize3px * 2; final Rect dirty = new Rect(point.x - size, point.y - size, point.x + size, point.y + size); dirty.offset(mapView.getScrollX(), mapView.getScrollY()); mapView.postInvalidate(dirty.left, dirty.top, dirty.right, dirty.bottom); if (!isMlsPointUpdate) { addToGridHash(obsPoint, point); } }</code><technical_language>this a warning info level message? happen</technical_language>

Target:
void update(ObservationPoint obsPoint, MapView mapView, boolean isMlsPointUpdate) { final Projection pj = mapView.getProjection(); GeoPoint geoPoint = (isMlsPointUpdate)? obsPoint.pointMLS : obsPoint.pointGPS; if (geoPoint == null) { Log.w(LOG_TAG, "Caller error: geoPoint is null"); return; } final Point point = pj.toPixels(geoPoint, null); final int size = mSize3px * 2; final Rect dirty = new Rect(point.x - size, point.y - size, point.x + size, point.y + size); dirty.offset(mapView.getScrollX(), mapView.getScrollY()); mapView.postInvalidate(dirty.left, dirty.top, dirty.right, dirty.bottom); if (!isMlsPointUpdate) { addToGridHash(obsPoint, point); } }
Source:
<code>public static String loadJSONFromCommit(String filename, String shacommit) throws IOException { String json = ""; <START> json = getFromUrl("<LINK_0>" + shacommit + "/" + filename); <END> if (!json.isEmpty()) json = json.replaceAll(" return json; }</code><technical_language>This change impossible read tests local folder</technical_language>

Target:
public static String loadJSONFromCommit(String filename, String shacommit) throws IOException { String json = ""; if (!SystemProperties.getDefault().githubTestsLoadLocal()) json = getFromUrl("<LINK_0>" + shacommit + "/" + filename); if (!json.isEmpty()) json = json.replaceAll(" return json.isEmpty() ? getFromLocal(filename) : json; }
Source:
<code>public String getCookie(String name) { String cookies = headers.get("cookie"); <START> if(null != cookies) { <END> String[] rawCookies = cookies.split(";"); for(String cookie : rawCookies) { String[] pair = cookie.split("="); if(pair[0].trim().equalsIgnoreCase(name) && pair.length == 2) { return pair[1].trim(); } } } return ""; }</code><technical_language>suggestion if (null != cookies) {</technical_language>

Target:
public String getCookie(String name) { if (hasHeader("cookie")) { String[] rawCookies = getHeader("cookie").split(";"); for (String cookie : rawCookies) { String[] pair = cookie.split("="); if (pair.length == 2 && pair[0].trim().equalsIgnoreCase(name)) { return pair[1].trim(); } } } return ""; }
Source:
<code>public void testConverter() throws Exception { String converterName = cs.getConverterName("application/pdf", "text/plain"); assertEquals("pdf2text", converterName); checkConverterAvailability(converterName); checkCommandAvailability("pdftotext"); BlobHolder pdfBH = getBlobFromPath("test-docs/hello.pdf"); BlobHolder result = cs.convert(converterName, pdfBH, null); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(1, blobs.size()); Blob blob = result.getBlob(); assertNotNull(blob); assertEquals("text/plain", blob.getMimeType()); assertTrue(blob.getLength() > 0); <START> String newline = System.getProperty("line.separator"); <END> assertEquals("Hello from a PDF Document!" + newline + newline + "\f", blob.getString()); }</code><technical_language>System.lineSeparator()</technical_language>

Target:
public void testConverter() throws Exception { String converterName = cs.getConverterName("application/pdf", "text/plain"); assertEquals("pdf2text", converterName); checkConverterAvailability(converterName); checkCommandAvailability("pdftotext"); BlobHolder pdfBH = getBlobFromPath("test-docs/hello.pdf"); BlobHolder result = cs.convert(converterName, pdfBH, null); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(1, blobs.size()); Blob blob = result.getBlob(); assertNotNull(blob); assertEquals("text/plain", blob.getMimeType()); assertTrue(blob.getLength() > 0); String newline = System.lineSeparator(); assertEquals("Hello from a PDF Document!" + newline + newline + "\f", blob.getString()); }
Source:
<code>private void assignStatelessActiveTasks() { <START> final PriorityQueue<UUID> statelessActiveTaskClientsQueue = getClientPriorityQueueByTaskLoad(clientStates); <END> statelessActiveTaskClientsQueue.addAll(clientStates.keySet()); for (final TaskId task : statelessTasks) { final UUID client = statelessActiveTaskClientsQueue.poll(); final ClientState state = clientStates.get(client); state.assignActive(task); statelessActiveTaskClientsQueue.offer(client); } }</code><technical_language>wondering if ValidClientsByTaskLoadQueue (with a (c,t)-> true predicate) instead of a plain PriorityQueue here, queue nicely enforces uniqueness of elements</technical_language>

Target:
private void assignStatelessActiveTasks() { final ValidClientsByTaskLoadQueue statelessActiveTaskClientsByTaskLoad = new ValidClientsByTaskLoadQueue( clientStates, (client, task) -> true ); statelessActiveTaskClientsByTaskLoad.offerAll(clientStates.keySet()); for (final TaskId task : statelessTasks) { final UUID client = statelessActiveTaskClientsByTaskLoad.poll(task); final ClientState state = clientStates.get(client); state.assignActive(task); statelessActiveTaskClientsByTaskLoad.offer(client); } }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { if (listPermissionSubjects == null) { <START> listPermissionSubjects = super.getPermissionCheckSubjects(); <END> Guid diskId = _oldDisk == null ? null : _oldDisk.getimage_group_id(); listPermissionSubjects.add(new PermissionSubject(diskId, VdcObjectType.Disk, ActionGroup.EDIT_DISK_PROPERTIES)); listPermissionSubjects = QuotaHelper.getInstance().addQuotaPermissionSubject(listPermissionSubjects, getStoragePool(), getQuotaId()); } return listPermissionSubjects; }</code><technical_language>require permission disk only, calling super add requirement for vm</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { if (listPermissionSubjects == null) { listPermissionSubjects = new ArrayList<PermissionSubject>(); Guid diskId = _oldDisk == null ? null : _oldDisk.getimage_group_id(); listPermissionSubjects.add(new PermissionSubject(diskId, VdcObjectType.Disk, ActionGroup.EDIT_DISK_PROPERTIES)); listPermissionSubjects = QuotaHelper.getInstance().addQuotaPermissionSubject(listPermissionSubjects, getStoragePool(), getQuotaId()); } return listPermissionSubjects; }
Source:
<code>public void removeSpecificUserOwner(PerunSession sess, User user, User specificUser) throws InternalErrorException, UserNotExistsException, PrivilegeException, SpecificUserExpectedException, NotSpecificUserExpectedException, RelationNotExistsException, SpecificUserOwnerAlreadyRemovedException { Utils.checkPerunSession(sess); getUsersManagerBl().checkUserExists(sess, user); getUsersManagerBl().checkUserExists(sess, specificUser); if (user.isServiceUser()) throw new NotSpecificUserExpectedException(user); if (user.isSponsoredUser() && specificUser.isSponsoredUser()) throw new NotSpecificUserExpectedException(specificUser); if (!specificUser.isSpecificUser()) throw new SpecificUserExpectedException(specificUser); <START> if(!AuthzResolver.authorizedInternal(sess, "removeSpecificUserOwner_User_User_policy", Collections.singletonList(specificUser))) { <END> throw new PrivilegeException(sess, "removeSpecificUserOwner"); } getUsersManagerBl().removeSpecificUserOwner(sess, user, specificUser); }</code><technical_language>2 methods authorizedInternal in 1 if clause objects? Like: if(!AuthzResolver.authorizedInternal(sess, "removeSpecificUserOwner_User_User_policy", Collections.singletonList(user)) && !AuthzResolver.authorizedInternal(sess, "removeSpecificUserOwner_User_User_policy", Collections.singletonList(specificUser))) { .. }</technical_language>

Target:
public void removeSpecificUserOwner(PerunSession sess, User user, User specificUser) throws InternalErrorException, UserNotExistsException, PrivilegeException, SpecificUserExpectedException, NotSpecificUserExpectedException, RelationNotExistsException, SpecificUserOwnerAlreadyRemovedException { Utils.checkPerunSession(sess); getUsersManagerBl().checkUserExists(sess, user); getUsersManagerBl().checkUserExists(sess, specificUser); if (user.isServiceUser()) throw new NotSpecificUserExpectedException(user); if (user.isSponsoredUser() && specificUser.isSponsoredUser()) throw new NotSpecificUserExpectedException(specificUser); if (!specificUser.isSpecificUser()) throw new SpecificUserExpectedException(specificUser); if(!AuthzResolver.authorizedInternal(sess, "removeSpecificUserOwner_User_User_policy", Collections.singletonList(specificUser)) && !AuthzResolver.authorizedInternal(sess, "owner-removeSpecificUserOwner_User_User_policy", Collections.singletonList(user))) { throw new PrivilegeException(sess, "removeSpecificUserOwner"); } getUsersManagerBl().removeSpecificUserOwner(sess, user, specificUser); }
Source:
<code>public int hashCode() { <START> return formField.getPageNumber() * formField.getFieldNumber() <END> * (int) Math.floor((double) formField.getSortWeight()); }</code><technical_language>rule is hashCodes if equals returns true. case if pageNumber is equal some other field is different. easiest fix is include field is checked in compareTo i.e. pageNumber. Please HashCodeBuilder generate value</technical_language>

Target:
public int hashCode() { return new HashCodeBuilder().append(formField.getPageNumber()).build(); }
Source:
<code>public void visitUnionType(UnionTypeTree tree) { resolveAs((List<TypeTree>) tree.typeAlternatives(), JavaSymbol.TYP); <START> ImmutableList.Builder<Type> builder = ImmutableList.builder(); <END> for (TypeTree typeTree : tree.typeAlternatives()) { builder.add(typeTree.symbolType()); } registerType(tree, (JavaType) resolve.leastUpperBound(builder.build())); }</code><technical_language>builder is perfect name here. uniontype</technical_language>

Target:
public void visitUnionType(UnionTypeTree tree) { resolveAs((List<TypeTree>) tree.typeAlternatives(), JavaSymbol.TYP); ImmutableList.Builder<Type> uniontype = ImmutableList.builder(); for (TypeTree typeTree : tree.typeAlternatives()) { uniontype.add(typeTree.symbolType()); } registerType(tree, (JavaType) resolve.leastUpperBound(uniontype.build())); }
Source:
<code>public static List<LogsForNamespaceAndUseCase> getLogsForHistoryQueries( LocalHistoryLoader localHistoryLoader, List<HistoryQuery> historyQueries) { Map<NamespaceAndUseCase, SequenceBounds> lastVerifiedSequences = historyQueries.stream() <START> .collect(Collectors.toMap( <END> HistoryQuery::getNamespaceAndUseCase, HistoryLoaderAndTransformer::sequenceBounds, HistoryLoaderAndTransformer::seqBoundsCollisionResolver)); PaxosHistoryOnSingleNode localPaxosHistory = localHistoryLoader.getLocalPaxosHistory(lastVerifiedSequences); return KeyedStream.stream(localPaxosHistory.history()) .mapEntries(HistoryLoaderAndTransformer::processHistory) .values() .collect(Collectors.toList()); }</code><technical_language>a huge fan - KeyedStream.of(historyQueries).mapKeys(...).map(...) of way, confess do merging resolution in KeyedStream (although collect multimap)</technical_language>

Target:
public static List<LogsForNamespaceAndUseCase> getLogsForHistoryQueries( LocalHistoryLoader localHistoryLoader, List<HistoryQuery> historyQueries) { Map<NamespaceAndUseCase, HistoryQuerySequenceBounds> namespaceAndUseCaseWiseSequenceRangeToBeVerified = historyQueries.stream() .collect(Collectors.toMap( HistoryQuery::getNamespaceAndUseCase, HistoryQuery::getSequenceBounds, HistoryLoaderAndTransformer::minimalLowerBoundResolver)); PaxosHistoryOnSingleNode localPaxosHistory = localHistoryLoader.getLocalPaxosHistory(namespaceAndUseCaseWiseSequenceRangeToBeVerified); return KeyedStream.stream(localPaxosHistory.history()) .mapEntries(HistoryLoaderAndTransformer::processHistory) .values() .collect(Collectors.toList()); }
Source:
<code>public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids) { <START> return Iterables.transform(Maps.filterKeys(nodes.get().asMap(), in(ImmutableSet.copyOf(ids))).values(), converter); <END> }</code><technical_language>Static imports (of e.g. Iterables.transform) static imports? Mixed bunch down, e.g. EC2ListNodesStrategy **with** imports plenty of other cases **without**</technical_language>

Target:
public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids) { return transform(filterKeys(nodes.get().asMap(), in(ImmutableSet.copyOf(ids))).values(), converter); }
Source:
<code>@Override public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) { QuickAssistAssistant quickAssistAssistant = new QuickAssistAssistant(); List<IQuickAssistProcessor> quickAssistProcessors = new ArrayList<IQuickAssistProcessor>(); quickAssistProcessors.add(new MarkerResoltionQuickAssistProcessor()); <START> quickAssistProcessors.addAll(GenericEditorPlugin.getDefault().getQuickAssistProcessorRegistry().getQuickAssistProcessors()); <END> CompositeQuickAssistProcessor compQuickAssistProcessor = new CompositeQuickAssistProcessor(quickAssistProcessors); quickAssistAssistant.setQuickAssistProcessor(compQuickAssistProcessor); quickAssistAssistant.setRestoreCompletionProposalSize(EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); quickAssistAssistant.setInformationControlCreator(parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString())); return quickAssistAssistant; }</code><technical_language>This input content-types parameter sort out processors use</technical_language>

Target:
@Override public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) { QuickAssistAssistant quickAssistAssistant = new QuickAssistAssistant(); List<IQuickAssistProcessor> quickAssistProcessors = new ArrayList<IQuickAssistProcessor>(); quickAssistProcessors.add(new MarkerResoltionQuickAssistProcessor()); quickAssistProcessors.addAll(GenericEditorPlugin.getDefault().getQuickAssistProcessorRegistry().getQuickAssistProcessors(sourceViewer, editor, getContentTypes(sourceViewer))); CompositeQuickAssistProcessor compQuickAssistProcessor = new CompositeQuickAssistProcessor(quickAssistProcessors); quickAssistAssistant.setQuickAssistProcessor(compQuickAssistProcessor); quickAssistAssistant.setRestoreCompletionProposalSize(EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); quickAssistAssistant.setInformationControlCreator(parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString())); return quickAssistAssistant; }
Source:
<code><START> public SearchFormsLoader generateLoader( <END> CatalogFramework catalogFramework, EndpointUtil endpointUtil, String formsDir, String formsFile, String resultsFile) { return new SearchFormsLoader(catalogFramework, endpointUtil, formsDir, formsFile, resultsFile); }</code><technical_language>protected most</technical_language>

Target:
protected SearchFormsLoader generateLoader( CatalogFramework catalogFramework, EndpointUtil endpointUtil, String formsDir, String formsFile, String resultsFile) { return new SearchFormsLoader(catalogFramework, endpointUtil, formsDir, formsFile, resultsFile); }
Source:
<code>public Retrofit2ClientBuilder hostMetricsRegistry(HostMetricsRegistry newHostMetricsRegistry) { hostMetricsRegistry = newHostMetricsRegistry; <START> return this; <END> }</code><technical_language>check for null here</technical_language>

Target:
public Retrofit2ClientBuilder hostMetricsRegistry(HostMetricsRegistry newHostMetricsRegistry) { Preconditions.checkNotNull(newHostMetricsRegistry, "hostMetricsRegistry can't be null"); hostMetricsRegistry = newHostMetricsRegistry; return this; }
Source:
<code>private TestRunner() { this.configs = new HashMap<>(); this.inMemoryScope = RandomStringUtils.random(10, true, true); <START> configs.put(ApplicationConfig.APP_NAME, JOB_NAME); <END> configs.put(JobConfig.PROCESSOR_ID(), "1"); configs.put(JobCoordinatorConfig.JOB_COORDINATOR_FACTORY, PassthroughJobCoordinatorFactory.class.getName()); configs.put(JobConfig.STARTPOINT_METADATA_STORE_FACTORY(), InMemoryMetadataStoreFactory.class.getCanonicalName()); configs.put(TaskConfig.GROUPER_FACTORY(), SingleContainerGrouperFactory.class.getName()); configs.put(JobConfig.JOB_NON_LOGGED_STORE_BASE_DIR(), new File(System.getProperty("java.io.tmpdir"), this.inMemoryScope + "-non-logged").getAbsolutePath()); configs.put(JobConfig.JOB_LOGGED_STORE_BASE_DIR(), new File(System.getProperty("java.io.tmpdir"), this.inMemoryScope + "-logged").getAbsolutePath()); addConfig(JobConfig.JOB_DEFAULT_SYSTEM(), JOB_DEFAULT_SYSTEM); addConfig(ClusterManagerConfig.JOB_HOST_AFFINITY_ENABLED, Boolean.FALSE.toString()); addConfig(InMemorySystemConfig.INMEMORY_SCOPE, inMemoryScope); addConfig(new InMemorySystemDescriptor(JOB_DEFAULT_SYSTEM).withInMemoryScope(inMemoryScope).toConfig()); }</code><technical_language>Rename JOB_NAME constant APP_NAME</technical_language>

Target:
private TestRunner() { this.configs = new HashMap<>(); this.inMemoryScope = RandomStringUtils.random(10, true, true); configs.put(ApplicationConfig.APP_NAME, APP_NAME); configs.put(JobConfig.PROCESSOR_ID(), "1"); configs.put(JobCoordinatorConfig.JOB_COORDINATOR_FACTORY, PassthroughJobCoordinatorFactory.class.getName()); configs.put(JobConfig.STARTPOINT_METADATA_STORE_FACTORY(), InMemoryMetadataStoreFactory.class.getCanonicalName()); configs.put(TaskConfig.GROUPER_FACTORY(), SingleContainerGrouperFactory.class.getName()); configs.put(JobConfig.JOB_NON_LOGGED_STORE_BASE_DIR(), new File(System.getProperty("java.io.tmpdir"), this.inMemoryScope + "-non-logged").getAbsolutePath()); configs.put(JobConfig.JOB_LOGGED_STORE_BASE_DIR(), new File(System.getProperty("java.io.tmpdir"), this.inMemoryScope + "-logged").getAbsolutePath()); addConfig(JobConfig.JOB_DEFAULT_SYSTEM(), JOB_DEFAULT_SYSTEM); addConfig(ClusterManagerConfig.JOB_HOST_AFFINITY_ENABLED, Boolean.FALSE.toString()); addConfig(InMemorySystemConfig.INMEMORY_SCOPE, inMemoryScope); addConfig(new InMemorySystemDescriptor(JOB_DEFAULT_SYSTEM).withInMemoryScope(inMemoryScope).toConfig()); }
Source:
<code>public static boolean mountAll(WebApplication app) { String mapInfoClassName = app.getClass().getCanonicalName() + "MountInfo"; try { MountInfo mountInfo = (MountInfo) Class.forName(mapInfoClassName).newInstance(); mountInfo.getMountList().mount(app); return true; <START> } catch (Exception ex) <END> { return false; } }</code><technical_language>is a good idea log this (as WARN)</technical_language>

Target:
public static boolean mountAll(WebApplication app) { final String mapInfoClassName = app.getClass().getCanonicalName() + "MountInfo"; try { final MountInfo mountInfo = (MountInfo) WicketObjects.newInstance(mapInfoClassName); for(IRequestMapper mapper: mountInfo.getMountList()) { app.mount(mapper); } return true; } catch (Exception ex) { LOG.warn("Failed to automount pages.",ex); return false; } }
Source:
<code>private static IndexFamilyDto asDto(IndexFamily from, boolean includeChildren) { IndexFamilyDto dto = new IndexFamilyDto(); dto.setId(from.getId()); dto.setName(from.getName()); dto.setArchived(from.getArchived()); <START> dto.setIndices(from.getIndices().stream().map(x -> asDto(x, false)).collect(Collectors.toList())); <END> dto.setMaximumNumber(from.getMaximumNumber()); dto.setPlatformType(from.getPlatformType() == null ? null : from.getPlatformType().name()); return dto; }</code><technical_language>is includeChildren used</technical_language>

Target:
private static IndexFamilyDto asDto(IndexFamily from, boolean includeChildren) { IndexFamilyDto dto = new IndexFamilyDto(); dto.setId(from.getId()); dto.setName(from.getName()); dto.setArchived(from.getArchived()); if (includeChildren) { dto.setIndices(from.getIndices().stream().map(x -> asDto(x, false)).collect(Collectors.toList())); } dto.setMaximumNumber(from.getMaximumNumber()); dto.setPlatformType(from.getPlatformType() == null ? null : from.getPlatformType().name()); return dto; }
Source:
<code>private Iterator<Object[]> zipArgs(Method method, Object[] args) { boolean foundIterator = false; List<Iterator<?>> extras = new ArrayList<>(); for (int paramIdx = 0; paramIdx < method.getParameterCount(); paramIdx++) { final boolean singleValue = method.getParameters()[paramIdx].isAnnotationPresent(SingleValue.class); final Object arg = args[paramIdx]; <START> if (ReflectionArrayIterator.isIterable(arg) && !singleValue) { <END> extras.add(ReflectionArrayIterator.of(arg)); foundIterator = true; } else { extras.add(Stream.generate(() -> arg).iterator()); } } if (!foundIterator) { throw new UnableToCreateStatementException("@SqlBatch method has no Iterable or array parameters," + " did you mean @SqlQuery?", null, null); } final Object[] sharedArg = new Object[args.length]; return new Iterator<Object[]>() { @Override public boolean hasNext() { for (Iterator<?> extra : extras) { if (!extra.hasNext()) { return false; } } return true; } @Override public Object[] next() { for (int i = 0; i < extras.size(); i++) { sharedArg[i] = extras.get(i).next(); } return sharedArg; } }; }</code><technical_language>Meh: swap conditions, !singleValue short-circuit isIterable call</technical_language>

Target:
private Iterator<Object[]> zipArgs(Method method, Object[] args) { boolean foundIterator = false; List<Iterator<?>> extras = new ArrayList<>(); for (int paramIdx = 0; paramIdx < method.getParameterCount(); paramIdx++) { final boolean singleValue = method.getParameters()[paramIdx].isAnnotationPresent(SingleValue.class); final Object arg = args[paramIdx]; if (!singleValue && ReflectionArrayIterator.isIterable(arg)) { extras.add(ReflectionArrayIterator.of(arg)); foundIterator = true; } else { extras.add(Stream.generate(() -> arg).iterator()); } } if (!foundIterator) { throw new UnableToCreateStatementException("@SqlBatch method has no Iterable or array parameters," + " did you mean @SqlQuery?", null, null); } final Object[] sharedArg = new Object[args.length]; return new Iterator<Object[]>() { @Override public boolean hasNext() { for (Iterator<?> extra : extras) { if (!extra.hasNext()) { return false; } } return true; } @Override public Object[] next() { for (int i = 0; i < extras.size(); i++) { sharedArg[i] = extras.get(i).next(); } return sharedArg; } }; }