auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updateReceivedMediaStreamStats( RTCPPacket[] in) { MediaStreamStatsImpl streamStats = mediaStream.getMediaStreamStats(); for (RTCPPacket rtcp : in) { switch (rtcp.type) { case RTCPFBPacket.PSFB: if (rtcp instanceof RTCPREMBPacket) { RTCPREMBPacket remb = (RTCPREMBPacket) rtcp; if (logger.isTraceEnabled()) { logger.trace( <START> "remb,stream=" + mediaStream.hashCode() + <END> " bps=" + remb.getBitrate() + ",dest=" + Arrays.toString(remb.getDest())); } streamStats.rembReceived(remb); } break; case RTCPPacket.SR: if (rtcp instanceof RTCPSRPacket) { streamStats.srReceived((RTCPSRPacket) rtcp); } case RTCPPacket.RR: { RTCPReport report; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); rtcp.assemble(new DataOutputStream(baos)); byte[] buf = baos.toByteArray(); report = parseRTCPReport(rtcp.type, buf, 0, buf.length); } catch (IOException ioe) { logger.error("Failed to assemble an RTCP report: " + ioe); report = null; } if (report != null) { streamStats.getRTCPReports().rtcpReportReceived(report); } } break; case RTCPFBPacket.RTPFB: if (rtcp instanceof NACKPacket) { NACKPacket nack = (NACKPacket) rtcp; streamStats.nackReceived(nack); } break; case RTCPExtendedReport.XR: if (rtcp instanceof RTCPExtendedReport) { streamStats.getRTCPReports().rtcpExtendedReportReceived( (RTCPExtendedReport) rtcp); } break; default: break; } } }</code><technical_language>please change remb remb_received this? I this sounds stupid, I admin cases I REMBs in wrong direction..</technical_language>

Target:
private void updateReceivedMediaStreamStats( RTCPPacket[] in) { MediaStreamStatsImpl streamStats = mediaStream.getMediaStreamStats(); for (RTCPPacket rtcp : in) { switch (rtcp.type) { case RTCPFBPacket.PSFB: if (rtcp instanceof RTCPREMBPacket) { RTCPREMBPacket remb = (RTCPREMBPacket) rtcp; if (logger.isTraceEnabled()) { logger.trace("remb_received,stream=" + mediaStream.hashCode() + " bps=" + remb.getBitrate() + ",dest=" + Arrays.toString(remb.getDest())); } streamStats.rembReceived(remb); } break; case RTCPPacket.SR: if (rtcp instanceof RTCPSRPacket) { streamStats.srReceived((RTCPSRPacket) rtcp); } case RTCPPacket.RR: { RTCPReport report; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); rtcp.assemble(new DataOutputStream(baos)); byte[] buf = baos.toByteArray(); report = parseRTCPReport(rtcp.type, buf, 0, buf.length); } catch (IOException ioe) { logger.error("Failed to assemble an RTCP report: " + ioe); report = null; } if (report != null) { streamStats.getRTCPReports().rtcpReportReceived(report); } } break; case RTCPFBPacket.RTPFB: if (rtcp instanceof NACKPacket) { NACKPacket nack = (NACKPacket) rtcp; streamStats.nackReceived(nack); } break; case RTCPExtendedReport.XR: if (rtcp instanceof RTCPExtendedReport) { streamStats.getRTCPReports().rtcpExtendedReportReceived( (RTCPExtendedReport) rtcp); } break; default: break; } } }
Source:
<code>protected void init() { super.init(); setVmId(getParameters().getContainerId()); setStoragePoolId(getParameters().getStoragePoolId()); imageToDestinationDomainMap = getParameters().getImageToDestinationDomainMap(); if (getParameters().getVm() != null && getVm().getDiskMap() != null) { <START> getVm().getDiskMap().values().stream().filter(DisksFilter.ONLY_IMAGES) .map(DiskImage.class::cast).collect(Collectors.toList()); <END> } ensureDomainMap(imageList, getParameters().getDestDomainId()); }</code><technical_language>Assign imageList</technical_language>

Target:
protected void init() { super.init(); setVmId(getParameters().getContainerId()); setStoragePoolId(getParameters().getStoragePoolId()); imageToDestinationDomainMap = getParameters().getImageToDestinationDomainMap(); if (getParameters().getVm() != null && getVm().getDiskMap() != null) { imageList = getVm().getDiskMap().values().stream().filter(DisksFilter.ONLY_IMAGES) .map(DiskImage.class::cast).collect(Collectors.toList()); } ensureDomainMap(imageList, getParameters().getDestDomainId()); }
Source:
<code>public HttpSocialNetworkServer(SocialNetwork social, MutablePointers mutable, InetSocketAddress address) throws IOException { this.address = address; <START> if (address.getHostName().contains("local")) <END> server = HttpServer.create(address, CONNECTION_BACKLOG); else server = HttpServer.create(new InetSocketAddress(InetAddress.getLocalHost(), address.getPort()), CONNECTION_BACKLOG); ch = new SocialHandler(social); server.createContext("/" + SOCIAL_URL, ch); server.createContext("/" + HttpMutablePointerServer.MUTABLE_POINTERS_URL, new HttpMutablePointerServer.MutationHandler(mutable)); server.setExecutor(Executors.newFixedThreadPool(HANDLER_THREAD_COUNT)); }</code><technical_language>case insensitive</technical_language>

Target:
public HttpSocialNetworkServer(SocialNetwork social, MutablePointers mutable, InetSocketAddress address) throws IOException { this.address = address; if (address.getHostName().toLowerCase().contains("local")) server = HttpServer.create(address, CONNECTION_BACKLOG); else server = HttpServer.create(new InetSocketAddress(InetAddress.getLocalHost(), address.getPort()), CONNECTION_BACKLOG); ch = new SocialHandler(social); server.createContext("/" + SOCIAL_URL, ch); server.createContext("/" + HttpMutablePointerServer.MUTABLE_POINTERS_URL, new HttpMutablePointerServer.MutationHandler(mutable)); server.setExecutor(Executors.newFixedThreadPool(HANDLER_THREAD_COUNT)); }
Source:
<code>public ActivationKey updateActivationKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, ActivationKey key) { ActivationKey toUpdate = activationKeyCurator.verifyAndLookupKey(activationKeyId); if (key.getName() != null) { toUpdate.setName(key.getName()); } String serviceLevel = key.getServiceLevel(); if (serviceLevel != null) { serviceLevelValidator.validate(toUpdate.getOwner(), serviceLevel); toUpdate.setServiceLevel(serviceLevel); } if (key.getReleaseVer() != null) { toUpdate.setReleaseVer(key.getReleaseVer()); } if (key.getDescription() != null) { toUpdate.setDescription(key.getDescription()); } <START> toUpdate.setAutoAttach(key.isAutoAttach()); <END> activationKeyCurator.merge(toUpdate); return toUpdate; }</code><technical_language>I need a null check other properties, update property releaseVer is clobber existing auto attach setting null</technical_language>

Target:
public ActivationKey updateActivationKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, ActivationKey key) { ActivationKey toUpdate = activationKeyCurator.verifyAndLookupKey(activationKeyId); if (key.getName() != null) { toUpdate.setName(key.getName()); } String serviceLevel = key.getServiceLevel(); if (serviceLevel != null) { serviceLevelValidator.validate(toUpdate.getOwner(), serviceLevel); toUpdate.setServiceLevel(serviceLevel); } if (key.getReleaseVer() != null) { toUpdate.setReleaseVer(key.getReleaseVer()); } if (key.getDescription() != null) { toUpdate.setDescription(key.getDescription()); } if (key.isAutoAttach() != null) { toUpdate.setAutoAttach(key.isAutoAttach()); } activationKeyCurator.merge(toUpdate); return toUpdate; }
Source:
<code>private static boolean isValidHostName(String name) { return isIPv4Address(name) || isIPv6Address(name) || isRFC3986HostName(name); <START> } <END></code><technical_language>isIPv4Address return false for input IP address fails a subsequent check, e.g. 999.9.9.9. In case subject checks (which fail if code is correct)</technical_language>

Target:
private static boolean isValidHostName(String name) { return isIPv6Address(name) || isRFC3986HostName(name); }
Source:
<code>public void run() { LOG.info(getName() + " thread started"); <START> synchronized (this) { <END> started = true; this.notifyAll(); } try { runLoop(); } finally { try { watchService.close(); } catch (IOException e) { LOG.warn("Error closing watch service", e); } LOG.info(getName() + " thread finished"); } }</code><technical_language>eliminate locking if expose states</technical_language>

Target:
public void run() { try { LOG.info(getName() + " thread started"); if (!compareAndSetState( FileChangeWatcher.State.STARTING, FileChangeWatcher.State.RUNNING)) { FileChangeWatcher.State state = FileChangeWatcher.this.getState(); if (state != FileChangeWatcher.State.STOPPING) { throw new IllegalStateException("Unexpected state: " + state); } return; } runLoop(); } catch (Exception e) { LOG.warn("Error in runLoop()", e); throw e; } finally { try { watchService.close(); } catch (IOException e) { LOG.warn("Error closing watch service", e); } LOG.info(getName() + " thread finished"); FileChangeWatcher.this.setState(FileChangeWatcher.State.STOPPED); } }
Source:
<code>public StepDefinitionMatch stepDefinitionMatch(String featurePath, PickleStep step) { String stepText = step.getText(); CacheEntry cacheEntry = matchedStepDefinitionsCache.get(stepText); if (cacheEntry != null) { return new StepDefinitionMatch(cacheEntry.arguments, cacheEntry.stepDefinition, featurePath, step, localizedXStreams); } List<StepDefinitionMatch> matches = stepDefinitionMatches(featurePath, step); if (matches.isEmpty()) { return null; } if (matches.size() == 1) { StepDefinitionMatch match = matches.get(0); matchedStepDefinitionsCache.put(stepText, new CacheEntry(match.getStepDefinition(),match.getArguments())); return match; } else { <START> throw new AmbiguousStepDefinitionsException(step, matches); <END> } }</code><technical_language>stay consistent rest of this method preferable remove else clause simply throw exception statement in method</technical_language>

Target:
public StepDefinitionMatch stepDefinitionMatch(String featurePath, PickleStep step) { String stepText = step.getText(); CacheEntry cacheEntry = matchedStepDefinitionsCache.get(stepText); if (cacheEntry != null) { return new StepDefinitionMatch(cacheEntry.arguments, cacheEntry.stepDefinition, featurePath, step, localizedXStreams); } List<StepDefinitionMatch> matches = stepDefinitionMatches(featurePath, step); if (matches.isEmpty()) { return null; } if (matches.size() == 1) { StepDefinitionMatch match = matches.get(0); matchedStepDefinitionsCache.put(stepText, new CacheEntry(match.getStepDefinition(), match.getArguments())); return match; } throw new AmbiguousStepDefinitionsException(step, matches); }
Source:
<code>public VdsIdVDSCommandBase(P parameters) { <START> this(parameters, true); <END> }</code><technical_language>true=>false</technical_language>

Target:
public VdsIdVDSCommandBase(P parameters) { this(parameters, false); }
Source:
<code>private void addIndex(Label label, Index index) { if ( index != null ) { if ( index.getName() != null ) { <START> log.cannotSetNameForIndex( index.getName() ); <END> if ( log.isEnabled( Level.WARN ) ) { log.warnf( "Neo4j does not support named indexes. Property name='%1$s' is ignored!", index.getName() ); } } List<String> properties = CollectionHelper.toStream( index.getColumnIterator() ) .map( Column::getName ).collect( Collectors.toList() ); indexSpecs.add( new Neo4jIndexSpec( label, properties ) ); } }</code><technical_language>do cannotSetNameForIndex warnf</technical_language>

Target:
private void addIndex(Label label, Index index) { if ( index != null ) { if ( index.getName() != null ) { log.cannotSetNameForIndex( index.getName() ); } List<String> properties = CollectionHelper.toStream( index.getColumnIterator() ) .map( Column::getName ).collect( Collectors.toList() ); indexSpecs.add( new Neo4jIndexSpec( label, properties ) ); } }
Source:
<code>private void addOpenEditorTasks(HashSet<ITask> relevantTasks) { IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow workbenchWindow : workbenchWindows) { IWorkbenchPage[] workbenchPages = workbenchWindow.getPages(); for (IWorkbenchPage workbenchPage : workbenchPages) { IEditorReference[] editorReferences = workbenchPage.getEditorReferences(); for (IEditorReference editorReference : editorReferences) { IEditorPart editorPart = editorReference.getEditor(false); if (editorPart instanceof TaskEditor) { TaskEditorInput taskEditorInput = ((TaskEditor) editorPart).getTaskEditorInput(); <START> if (taskEditorInput.exists()) { <END> relevantTasks.add(taskEditorInput.getTask()); } } } } } }</code><technical_language>add task if is a local task</technical_language>

Target:
private void addOpenEditorTasks(HashSet<ITask> relevantTasks) { IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow workbenchWindow : workbenchWindows) { IWorkbenchPage[] workbenchPages = workbenchWindow.getPages(); for (IWorkbenchPage workbenchPage : workbenchPages) { IEditorReference[] editorReferences = workbenchPage.getEditorReferences(); for (IEditorReference editorReference : editorReferences) { IEditorPart editorPart = editorReference.getEditor(false); if (editorPart instanceof TaskEditor) { TaskEditorInput taskEditorInput = ((TaskEditor) editorPart).getTaskEditorInput(); if (taskEditorInput.exists()) { ITask task = taskEditorInput.getTask(); if (!(task instanceof LocalTask)) { relevantTasks.add(task); } } } } } } }
Source:
<code>public boolean checkAccess(User user, String commandName) throws PermissionDeniedException { if (isDisabled()) { return true; } Account account = accountService.getAccount(user.getAccountId()); if (account == null) { throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null"); } final Role accountRole = roleService.findRole(account.getRoleId()); if (accountRole == null || accountRole.getId() < 1L) { denyApiAccess(commandName); } if (accountRole.getRoleType() == RoleType.Admin && accountRole.getId() == RoleType.Admin.getId()) { return true; } final List<RolePermission> rolePermissions = roleService.findAllPermissionsBy(accountRole.getId()); <START> if (checkPermission(rolePermissions, RolePermission.Permission.ALLOW, commandName)) { <END> return true; } if (checkPermission(rolePermissions, RolePermission.Permission.DENY, commandName)) { denyApiAccess(commandName); } if (annotationRoleBasedApisMap.get(accountRole.getRoleType()) != null && annotationRoleBasedApisMap.get(accountRole.getRoleType()).contains(commandName)) { return true; } denyApiAccess(commandName); return false; }</code><technical_language>For a role if permissions whats default policy - allow deny? Based default need allow deny both. is a provision select default policy for a role in case role permissions exceptions default policy</technical_language>

Target:
public boolean checkAccess(User user, String commandName) throws PermissionDeniedException { if (isDisabled()) { return true; } Account account = accountService.getAccount(user.getAccountId()); if (account == null) { throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null"); } final Role accountRole = roleService.findRole(account.getRoleId()); if (accountRole == null || accountRole.getId() < 1L) { denyApiAccess(commandName); } if (accountRole.getRoleType() == RoleType.Admin && accountRole.getId() == RoleType.Admin.getId()) { return true; } for (final RolePermission permission : roleService.findAllPermissionsBy(accountRole.getId())) { if (permission.getRule().matches(commandName)) { if (RolePermission.Permission.ALLOW.equals(permission.getPermission())) { return true; } else { denyApiAccess(commandName); } } } if (annotationRoleBasedApisMap.get(accountRole.getRoleType()) != null && annotationRoleBasedApisMap.get(accountRole.getRoleType()).contains(commandName)) { return true; } denyApiAccess(commandName); return false; }
Source:
<code>protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { JdbcSchema schema = (JdbcSchema) db; SqlDialect dialect = schema.getDialect(); try (Statement stmt = schema.getConnection().createStatement()) { <START> Set<String> listIndexes = dialect.listIndexes( schema.getConnection(), "changes"); for (String index : listIndexes) { if (index.equalsIgnoreCase("changes_allOpen")) { stmt.executeUpdate("DROP INDEX " + index); } if (index.equalsIgnoreCase("changes_allClosed")) { stmt.executeUpdate("DROP INDEX " + index); } if (index.equalsIgnoreCase("changes_byBranchClosed")) { stmt.executeUpdate("DROP INDEX " + index); } } <END> stmt.executeUpdate("DROP INDEX changes_byProjectOpen"); if (dialect instanceof DialectPostgreSQL) { stmt.executeUpdate("CREATE INDEX changes_byProjectOpen" + " ON changes (dest_project_name, last_updated_on)" + " WHERE open = 'Y'"); } else { stmt.executeUpdate("CREATE INDEX changes_byProjectOpen" + " ON changes (open, dest_project_name, last_updated_on)"); } } }</code><technical_language>do need iterate list of indexes? Is some of do exist in some cases? In other words, do: stmt.executeUpdate("DROP INDEX changes_allOpen"); stmt.executeUpdate("DROP INDEX changes_allClosed"); stmt.executeUpdate("DROP INDEX changes_byBranchClosed"); ? If do need test for existence, a regex instead of sequence of if- statements? Pattern pattern = Pattern.compile("^changes_(allOpen|allClosed|byBranchClosed)$", Pattern.CASE_INSENSITIVE); Set<String> listIndexes = dialect.listIndexes( schema.getConnection(), "changes"); for (String index : listIndexes) { if (pattern.matcher(index).matches()) { stmt.executeUpdate("DROP INDEX " + index); } }</technical_language>

Target:
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { JdbcSchema schema = (JdbcSchema) db; SqlDialect dialect = schema.getDialect(); try (Statement stmt = schema.getConnection().createStatement()) { Pattern pattern = Pattern.compile("^changes_(allOpen|allClosed|byBranchClosed)$", Pattern.CASE_INSENSITIVE); Set<String> listIndexes = dialect.listIndexes( schema.getConnection(), "changes"); for (String index : listIndexes) { if (pattern.matcher(index).matches()) { stmt.executeUpdate("DROP INDEX " + index); } } stmt.executeUpdate("DROP INDEX changes_byProjectOpen"); if (dialect instanceof DialectPostgreSQL) { stmt.executeUpdate("CREATE INDEX changes_byProjectOpen" + " ON changes (dest_project_name, last_updated_on)" + " WHERE open = 'Y'"); } else { stmt.executeUpdate("CREATE INDEX changes_byProjectOpen" + " ON changes (open, dest_project_name, last_updated_on)"); } } }
Source:
<code>public List<Object> configurations() { <START> return Collections.singletonList(allowEmptyCatch); <END> }</code><technical_language>need object</technical_language>

Target:
public List<Object> configurations() { return Collections.singletonList(new Config()); }
Source:
<code><START> private boolean isBootstrapped(RequestMsg requestMsg) { <END> if (getCurrentLayout() == null) { log.debug("Received request but not bootstrapped! RequestMsg={}", requestMsg); return false; } return true; }</code><technical_language>Notice this check is called handlers for actual bootstrap call. I recommend this check is executed in entry point, i.e, processRequest. java @Override protected void processRequest(RequestMsg req, ChannelHandlerContext ctx, IServerRouter r) { executor.submit(() -> { if (!req.getPayload().getPayloadCase().equals(RequestPayloadMsg.PayloadCase.BOOTSTRAP_LAYOUT_REQUEST) && !isBootstrapped(req)) { r.sendNoBootstrapError(req.getHeader(), ctx); return; } // process layout server requests server is bootstrapped getHandlerMethods().handle(req, ctx, r); }); }</technical_language>

Target:
private boolean isBootstrapped(RequestMsg requestMsg) { if (getCurrentLayout() == null) { log.debug("Received request but not bootstrapped! RequestMsg={}", TextFormat.shortDebugString(requestMsg)); return false; } return true; }
Source:
<code>public String toString() <START> { <END> return format("PrestoWarning(code: %s, message: %s)", code, message); }</code><technical_language>MoreObjects.toStringHelper</technical_language>

Target:
public String toString() { return format("%s, %s", warningCode, message); }
Source:
<code>public void deactivate(ComponentContext context) throws LoginException { <START> log.info("deactivate"); <END> for (String id : registeredServices.keySet()) { unregisterService(id); } log.info("Deactivation successful!"); }</code><technical_language>trace</technical_language>

Target:
public void deactivate(ComponentContext context) throws LoginException { log.trace("deactivate"); for (String id : registeredServices.keySet()) { unregisterService(id); } log.trace("Deactivation successful!"); }
Source:
<code>public void testIsHostedEngineStorage() { VmStatic vm = new VmStatic(); vm.setId(Guid.newGuid()); vm.setOrigin(OriginType.HOSTED_ENGINE); vmStaticDao.save(vm); DiskImage disk = new DiskImage(); disk.setId(Guid.newGuid()); disk.setImageId(Guid.newGuid()); disk.setActive(true); disk.setVolumeType(VolumeType.Preallocated); disk.setVolumeFormat(VolumeFormat.RAW); <START> disk.setDiskDescription(""); <END> imageDao.save(disk.getImage()); baseDiskDao.save(disk); ImageStorageDomainMap map = new ImageStorageDomainMap( disk.getImageId(), existingDomain.getId(), null, null); imageStorageDomainMapDao.save(map); VmDevice device = new VmDevice( new VmDeviceId(disk.getId(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", null, true, false, false, "", null, null, null); vmDeviceDao.save(device); DiskVmElement diskVmElement = new DiskVmElement(device.getId()); diskVmElement.setDiskInterface(DiskInterface.IDE); diskVmElementDao.save(diskVmElement); StorageDomain domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); vmStaticDao.update(vm); domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); }</code><technical_language>needed, part of constructor</technical_language>

Target:
public void testIsHostedEngineStorage() { VmStatic vm = new VmStatic(); vm.setId(Guid.newGuid()); vm.setOrigin(OriginType.HOSTED_ENGINE); vmStaticDao.save(vm); DiskImage disk = new DiskImage(); disk.setId(Guid.newGuid()); disk.setImageId(Guid.newGuid()); disk.setActive(true); disk.setVolumeType(VolumeType.Preallocated); disk.setVolumeFormat(VolumeFormat.RAW); imageDao.save(disk.getImage()); baseDiskDao.save(disk); ImageStorageDomainMap map = new ImageStorageDomainMap( disk.getImageId(), existingDomain.getId(), null, null); imageStorageDomainMapDao.save(map); VmDevice device = new VmDevice( new VmDeviceId(disk.getId(), vm.getId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", null, true, false, false, "", null, null, null); vmDeviceDao.save(device); DiskVmElement diskVmElement = new DiskVmElement(device.getId()); diskVmElement.setDiskInterface(DiskInterface.IDE); diskVmElementDao.save(diskVmElement); StorageDomain domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); vmStaticDao.update(vm); domain = dao.get(existingDomain.getId()); assertTrue(domain.isHostedEngineStorage()); }
Source:
<code><START> public DefaultPageCursorTracerSupplier() <END> { }</code><technical_language>grab INSTANCE this, instead of making constructor public creating a new one</technical_language>

Target:
private DefaultPageCursorTracerSupplier() { }
Source:
<code>private HttpURLConnection setupConnection() throws IOException { Logger.v(TAG, "HttpWebRequest setupConnection thread:" + android.os.Process.myTid()); if (mUrl == null) { throw new IllegalArgumentException("requestURL"); } if (!mUrl.getProtocol().equalsIgnoreCase("http") && !mUrl.getProtocol().equalsIgnoreCase("https")) { throw new IllegalArgumentException("requestURL"); } HttpURLConnection.setFollowRedirects(true); final HttpURLConnection connection = (HttpURLConnection)mUrl.openConnection(); connection.setConnectTimeout(CONNECT_TIME_OUT); if (Build.VERSION.SDK_INT > 13) { connection.setRequestProperty("Connection", "close"); } final Iterator<String> headerKeys = mRequestHeaders.keySet().iterator(); while (headerKeys.hasNext()) { String header = headerKeys.next(); Logger.v(TAG, "Setting header: " + header); connection.setRequestProperty(header, mRequestHeaders.get(header)); } <START> System.setProperty("http.keepAlive", "false"); <END> connection.setReadTimeout(READ_TIME_OUT); connection.setInstanceFollowRedirects(mInstanceRedirectsFollow); connection.setUseCaches(mUseCaches); connection.setRequestMethod(mRequestMethod); connection.setDoInput(true); setRequestBody(connection); return connection; }</code><technical_language>this disable connection reuse for client a library. For example for a significant impact thumbnail downloading code..</technical_language>

Target:
private HttpURLConnection setupConnection() throws IOException { Logger.v(TAG, "HttpWebRequest setupConnection thread:" + android.os.Process.myTid()); if (mUrl == null) { throw new IllegalArgumentException("requestURL"); } if (!mUrl.getProtocol().equalsIgnoreCase("http") && !mUrl.getProtocol().equalsIgnoreCase("https")) { throw new IllegalArgumentException("requestURL"); } HttpURLConnection.setFollowRedirects(true); final HttpURLConnection connection = (HttpURLConnection)mUrl.openConnection(); connection.setConnectTimeout(CONNECT_TIME_OUT); if (Build.VERSION.SDK_INT > 13) { connection.setRequestProperty("Connection", "close"); } final Iterator<String> headerKeys = mRequestHeaders.keySet().iterator(); while (headerKeys.hasNext()) { String header = headerKeys.next(); Logger.v(TAG, "Setting header: " + header); connection.setRequestProperty(header, mRequestHeaders.get(header)); } System.setProperty("http.keepAlive", "false"); connection.setReadTimeout(READ_TIME_OUT); connection.setInstanceFollowRedirects(mInstanceRedirectsFollow); connection.setUseCaches(mUseCaches); connection.setRequestMethod(mRequestMethod); connection.setDoInput(true); setRequestBody(connection, mRequestContent, mRequestContentType); return connection; }
Source:
<code>private ClusterClientProvider<String> createClusterClientProvider(String clusterId) { return () -> { final Configuration configuration = new Configuration(flinkConfig); try { <START> final Optional<Endpoint> restEndpoint = client.getRestEndpoint(clusterId).get(); <END> if (restEndpoint.isPresent()) { configuration.setString(RestOptions.ADDRESS, restEndpoint.get().getAddress()); configuration.setInteger(RestOptions.PORT, restEndpoint.get().getPort()); } else { throw new RuntimeException( new ClusterRetrieveException( "Could not get the rest endpoint of " + clusterId)); } return new RestClusterClient<>( configuration, clusterId, new StandaloneClientHAServices(HighAvailabilityServicesUtils.getWebMonitorAddress( configuration, HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION))); } catch (Exception e) { client.handleException(e); throw new RuntimeException(new ClusterRetrieveException("Could not create the RestClusterClient.", e)); } }; }</code><technical_language>do future.get, wrap underlying exception a ExecutionException. call ExceptionUtils#stripExecutionException unwrap</technical_language>

Target:
private ClusterClientProvider<String> createClusterClientProvider(String clusterId) { return () -> { final Configuration configuration = new Configuration(flinkConfig); final Optional<Endpoint> restEndpoint = client.getRestEndpoint(clusterId); if (restEndpoint.isPresent()) { configuration.setString(RestOptions.ADDRESS, restEndpoint.get().getAddress()); configuration.setInteger(RestOptions.PORT, restEndpoint.get().getPort()); } else { throw new RuntimeException( new ClusterRetrieveException( "Could not get the rest endpoint of " + clusterId)); } try { return new RestClusterClient<>( configuration, clusterId, new StandaloneClientHAServices(HighAvailabilityServicesUtils.getWebMonitorAddress( configuration, HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION))); } catch (Exception e) { client.handleException(e); throw new RuntimeException(new ClusterRetrieveException("Could not create the RestClusterClient.", e)); } }; }
Source:
<code>private SimpleFeatureCollection eliminateFeatureBounds(SimpleFeatureCollection fc) { final SimpleFeatureType original = fc.getSchema(); List<String> names = new ArrayList<String>(); boolean alternateGeometry = false; for(AttributeDescriptor ad : original.getAttributeDescriptors()) { final String name = ad.getLocalName(); <START> if(!boundedBy.equals(name) && !metaData.equals(name)) { <END> names.add(name); } if(!location.equals(name) && ad instanceof GeometryDescriptor) { alternateGeometry = true; } } if(alternateGeometry) { names.remove("location"); } if(names.size() < original.getDescriptors().size()) { String[] namesArray = names.toArray(new String[names.size()]); SimpleFeatureType target = SimpleFeatureTypeBuilder.retype(original, namesArray); return new RetypingFeatureCollection(fc, target); } return fc; }</code><technical_language>So... a typo in name of "metadataProperty"</technical_language>

Target:
private SimpleFeatureCollection eliminateFeatureBounds(SimpleFeatureCollection fc) { final SimpleFeatureType original = fc.getSchema(); List<String> names = new ArrayList<String>(); boolean alternateGeometry = false; for(AttributeDescriptor ad : original.getAttributeDescriptors()) { final String name = ad.getLocalName(); if(!BOUNDEDBY.equals(name) && !METADATA.equals(name)) { names.add(name); } if(!LOCATION.equals(name) && ad instanceof GeometryDescriptor) { alternateGeometry = true; } } if(alternateGeometry) { names.remove("location"); } if(names.size() < original.getDescriptors().size()) { String[] namesArray = names.toArray(new String[names.size()]); SimpleFeatureType target = SimpleFeatureTypeBuilder.retype(original, namesArray); return new RetypingFeatureCollection(fc, target); } return fc; }
Source:
<code>public void postAttachInit(ArrayList<EntityModel> datacenters) { ListModel model = new ListModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().attachToDataCenterTitle()); if (getEntity() != null) { switch (getEntity().getStorageDomainType()) { case ISO: setHelpTag(HelpTag.attach_iso_library); break; case Data: setHelpTag(HelpTag.attach_storage); break; case ImportExport: setHelpTag(HelpTag.attach_export_domain); break; } } model.setItems(datacenters); if (datacenters.isEmpty()) { model.setMessage(ConstantsManager.getInstance() .getConstants() .thereAreNoDataCenterStorageDomainAttachedMsg()); UICommand tempVar = new UICommand("Cancel", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().close()); tempVar.setIsDefault(true); tempVar.setIsCancel(true); model.getCommands().add(tempVar); } else { <START> model.setSelectedItem(datacenters.get(0)); <END> UICommand tempVar2 = UICommand.createDefaultOkUiCommand("OnAttach", this); model.getCommands().add(tempVar2); UICommand tempVar3 = UICommand.createCancelUiCommand("Cancel", this); model.getCommands().add(tempVar3); } }</code><technical_language>fix it.</technical_language>

Target:
public void postAttachInit(ArrayList<EntityModel> datacenters) { ListModel model = new ListModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().attachToDataCenterTitle()); if (getEntity() != null) { switch (getEntity().getStorageDomainType()) { case ISO: setHelpTag(HelpTag.attach_iso_library); break; case Data: setHelpTag(HelpTag.attach_storage); break; case ImportExport: setHelpTag(HelpTag.attach_export_domain); break; } } if (datacenters.isEmpty()) { model.setMessage(ConstantsManager.getInstance() .getConstants() .thereAreNoDataCenterStorageDomainAttachedMsg()); UICommand tempVar = new UICommand("Cancel", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().close()); tempVar.setIsDefault(true); tempVar.setIsCancel(true); model.getCommands().add(tempVar); } else { model.setItems(datacenters, datacenters.get(0)); UICommand tempVar2 = UICommand.createDefaultOkUiCommand("OnAttach", this); model.getCommands().add(tempVar2); UICommand tempVar3 = UICommand.createCancelUiCommand("Cancel", this); model.getCommands().add(tempVar3); } }
Source:
<code>public void deleteCell(EntityId entityId, String family, String qualifier, long timestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete cell while KijiTableWriter %s is in state %s.", this, state); final HBaseColumnName hbaseColumnName = mWriterLayoutCapsule.getColumnNameTranslator() .toHBaseColumnName(new KijiColumnName(family, qualifier)); final DeleteRequest delete = new DeleteRequest( <START> Bytes.toBytes(mTable.getName()), entityId.getHBaseRowKey(), <END> hbaseColumnName.getFamily(), hbaseColumnName.getQualifier(), timestamp); delete.setDeleteAtTimestampOnly(true); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }</code><technical_language>table name</technical_language>

Target:
public void deleteCell(EntityId entityId, String family, String qualifier, long timestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete cell while KijiTableWriter %s is in state %s.", this, state); final HBaseColumnName hbaseColumnName = mWriterLayoutCapsule.getColumnNameTranslator() .toHBaseColumnName(new KijiColumnName(family, qualifier)); final DeleteRequest delete = new DeleteRequest( mTableName, entityId.getHBaseRowKey(), hbaseColumnName.getFamily(), hbaseColumnName.getQualifier(), timestamp); delete.setDeleteAtTimestampOnly(true); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }
Source:
<code><START> public static <END> boolean isAnyPrefixOf(String pathToCheck, Collection<String> possiblePrefixes) { for (String possiblePrefix : possiblePrefixes) { if (pathToCheck.startsWith(possiblePrefix)) { return true; } if (possiblePrefix.length() == pathToCheck.length() + 1 && possiblePrefix.charAt(possiblePrefix.length() - 1) == '/' && possiblePrefix.startsWith(pathToCheck)) { return true; } } return false; }</code><technical_language>unnecessary declare this method public, if package visible test in package</technical_language>

Target:
protected static boolean isAnyPrefixOf(String pathToCheck, Collection<String> possiblePrefixes) { for (String possiblePrefix : possiblePrefixes) { if (pathToCheck.startsWith(possiblePrefix)) { return true; } if (possiblePrefix.length() == pathToCheck.length() + 1 && possiblePrefix.charAt(possiblePrefix.length() - 1) == '/' && possiblePrefix.startsWith(pathToCheck)) { return true; } } return false; }
Source:
<code>public SQLJobSubmissionBuilder addJars(List<Path> jarFiles) { <START> this.jars.addAll(jarFiles.stream().map(path -> path.toAbsolutePath().toString()).collect(Collectors.toList())); <END> return this; }</code><technical_language>suggestion jarFiles.forEach(this::addJar);</technical_language>

Target:
public SQLJobSubmissionBuilder addJars(List<Path> jarFiles) { jarFiles.forEach(this::addJar); return this; }
Source:
<code>public String getDisplayRecipient(ZulipApp app) { if (this.getType() == MessageType.STREAM_MESSAGE) { return this.getStream().getName(); } else { Person[] people = this.getRecipients(app); ArrayList<String> names = new ArrayList<>(); for (Person person : people) { <START> if (!person.getEmail().equals(app.getYou().getEmail()) || people.length == 1) { <END> names.add(person.getName()); } } return TextUtils.join(", ", names); } }</code><technical_language>problem ID's here</technical_language>

Target:
public String getDisplayRecipient(ZulipApp app) { if (this.getType() == MessageType.STREAM_MESSAGE) { return this.getStream().getName(); } else { Person[] people = this.getRecipients(app); ArrayList<String> names = new ArrayList<>(); for (Person person : people) { if (person.id != app.getYou().id || people.length == 1) { names.add(person.getName()); } } return TextUtils.join(", ", names); } }
Source:
<code><START> public void writeFrom(ReadableByteChannel channel, long offset, long size) <END> throws IOException { if (offset < 0 || offset > capacityInBytes) { throw new IllegalArgumentException( "Provided offset [" + offset + "] is out of bounds for the segment [" + file.getAbsolutePath() + "] with capacity [" + capacityInBytes + "]"); } if (offset + size > capacityInBytes) { ensureNext(metrics.overflowWriteError); logger.info("{} : Write of data of size from offset from a channel will be rolled over " + "to the next segment because capacity is {}", file.getAbsolutePath(), next.getName(), size, offset, next.getName(), capacityInBytes); } long sizeToBeWritten = Math.min(size, capacityInBytes - offset); long sizeLeft = size - sizeToBeWritten; long bytesWritten = 0; while (bytesWritten < sizeToBeWritten) { bytesWritten += fileChannel.transferFrom(channel, offset + bytesWritten, sizeToBeWritten - bytesWritten); } if (offset + sizeToBeWritten > endOffset.get()) { endOffset.set(offset + sizeToBeWritten); } if (sizeLeft > 0) { next.writeFrom(channel, 0, sizeLeft); } }</code><technical_language>is purpose, I semantics cleaner if caller manages write (so ensure "offset + size" is greater capacity on)</technical_language>

Target:
void writeFrom(ReadableByteChannel channel, long offset, long size) throws IOException { if (offset < 0 || offset >= capacityInBytes) { throw new IndexOutOfBoundsException( "Provided offset [" + offset + "] is out of bounds for the segment [" + file.getAbsolutePath() + "] with capacity [" + capacityInBytes + "]"); } if (offset + size > capacityInBytes) { metrics.overflowWriteError.inc(); throw new IndexOutOfBoundsException("Cannot write to segment [" + file.getAbsolutePath() + "] from offset [" + offset + "] for size [" + size + "] because it exceeds the capacity [" + capacityInBytes + "]"); } long bytesWritten = 0; while (bytesWritten < size) { bytesWritten += fileChannel.transferFrom(channel, offset + bytesWritten, size - bytesWritten); } if (offset + size > endOffset.get()) { endOffset.set(offset + size); } }
Source:
<code>protected void printEntryLogMetadata(long logId) throws IOException { LOG.info("Print entryLogMetadata of entrylog " + logId + " (" + Long.toHexString(logId) + ".log)"); initEntryLogger(); EntryLogMetadata entryLogMetadata = entryLogger.getEntryLogMetadata(logId); entryLogMetadata.getLedgersMap().forEach((ledgerId, size) -> { <START> LOG.info("--------- Lid=" + ledgerIdFormatter.formatLedgerId(ledgerId) + ", TotalSizeOfEntriesOfLedger=" <END> + size + " ---------"); }); }</code><technical_language>{}</technical_language>

Target:
protected void printEntryLogMetadata(long logId) throws IOException { LOG.info("Print entryLogMetadata of entrylog ({}.log)", logId, Long.toHexString(logId)); initEntryLogger(); EntryLogMetadata entryLogMetadata = entryLogger.getEntryLogMetadata(logId); entryLogMetadata.getLedgersMap().forEach((ledgerId, size) -> { LOG.info("--------- Lid={}, TotalSizeOfEntriesOfLedger={} ---------", ledgerIdFormatter.formatLedgerId(ledgerId), size); }); }
Source:
<code>private static void serializeIdentity(final PreSharedKeyIdentity principal, final DatagramWriter writer) { writer.writeByte(ClientAuthenticationType.PSK.code); <START> byte[] virtualHost = principal.getVirtualHost() == null ? new byte[0] : <END> principal.getVirtualHost().getBytes(StandardCharsets.UTF_8); writeBytesWithLength(PSK_LENGTH_BITS, virtualHost, writer); writeBytesWithLength(PSK_LENGTH_BITS, principal.getIdentity().getBytes(StandardCharsets.UTF_8), writer); }</code><technical_language>I prefer a static final byte[] EMPTY = {}; reused</technical_language>

Target:
private static void serializeIdentity(final PreSharedKeyIdentity principal, final DatagramWriter writer) { writer.writeByte(ClientAuthenticationType.PSK.code); byte[] virtualHost = principal.getVirtualHost() == null ? EMPTY_BYTE_ARRAY : principal.getVirtualHost().getBytes(StandardCharsets.UTF_8); writeBytesWithLength(PSK_LENGTH_BITS, virtualHost, writer); writeBytesWithLength(PSK_LENGTH_BITS, principal.getIdentity().getBytes(StandardCharsets.UTF_8), writer); }
Source:
<code>public long computeBin(final Histogram1d<T> histo) {; <START> long[] hist = histo.toLongArray(); <END> int no_pts = hist.length; int pk, st, fi, d1, d2; long tmp; int i; int thresh; boolean doInvert = false; pk = find_start(hist, no_pts); st = find_first(hist, no_pts); fi = find_end(hist, no_pts); d1 = pk - st; d2 = fi - pk; if ((d1 < 0) || (d2 < 0)) { log.warn("Histogram peak at a strange location"); } if (d1 > d2) { doInvert = true; } if (doInvert) { for (i = 0; i < no_pts / 2; i++) { tmp = hist[i]; hist[i] = hist[no_pts - 1 - i]; hist[no_pts - 1 - i] = tmp; } } st = find_start(hist, no_pts); thresh = find_corner(hist, st, no_pts); if (doInvert) { thresh = no_pts - thresh - 1; } return thresh; }</code><technical_language>work histogram instead of copying a long[]'</technical_language>

Target:
public long computeBin(final Histogram1d<T> histo) {; long[] hist = histo.toLongArray(); int noPts = hist.length; int pk, st, fi, d1, d2; long tmp; int i; int thresh; boolean doInvert = false; pk = findStart(hist, noPts); st = findFirst(hist, noPts); fi = findEnd(hist, noPts); d1 = pk - st; d2 = fi - pk; if ((d1 < 0) || (d2 < 0)) { log.warn("Histogram peak at a strange location"); } if (d1 > d2) { doInvert = true; } if (doInvert) { for (i = 0; i < noPts / 2; i++) { tmp = hist[i]; hist[i] = hist[noPts - 1 - i]; hist[noPts - 1 - i] = tmp; } } st = findStart(hist, noPts); thresh = findCorner(hist, st, noPts); if (doInvert) { thresh = noPts - thresh - 1; } return thresh; }
Source:
<code>private TimeLockServices createLegacyTimeLockServices( Supplier<ManagedTimestampService> rawTimestampServiceSupplier, RemoteLockService lockService) { TimelockService timelockService = new LockTokenConvertingTimelockService( <START> new LegacyTimelockService(rawTimestampServiceSupplier.get(), <END> lockService, LockClient.of("legacy"))); return TimeLockServices.create( new TimelockTimestampServiceAdapter(timelockService), lockService, AsyncOrLegacyTimelockService.createFromLegacyTimelock(timelockService), AwaitingLeadershipProxy.newProxyInstance( ManagedTimestampService.class, rawTimestampServiceSupplier, leaderElectionService)); }</code><technical_language>i this timestamp service needs wrapped AwaitingLeadershipProxy (created below)</technical_language>

Target:
private TimeLockServices createLegacyTimeLockServices( Supplier<ManagedTimestampService> rawTimestampServiceSupplier, RemoteLockService lockService) { ManagedTimestampService timestampService = AwaitingLeadershipProxy.newProxyInstance( ManagedTimestampService.class, rawTimestampServiceSupplier, leaderElectionService); TimelockService timelockService = new LockTokenConvertingTimelockService( new LegacyTimelockService( timestampService, lockService, LockClient.of("legacy"))); return TimeLockServices.create( timestampService, lockService, AsyncOrLegacyTimelockService.createFromLegacyTimelock(timelockService), timestampService); }
Source:
<code>public void testWithParserAndNullInputformatParseProperly() throws IOException { final InputRowParser<ByteBuffer> parser = new StringInputRowParser( new NotConvertibleToInputFormatParseSpec(), StringUtils.UTF8_STRING ); final StreamChunkParser chunkParser = new StreamChunkParser( parser, null, null, null, null ); <START> final String json = "{\"timestamp\": \"2020-01-01\", \"dim\": \"val\", \"met\": \"val2\"}"; List<InputRow> parsedRows = chunkParser.parse(Collections.singletonList(json.getBytes(StringUtils.UTF8_STRING))); Assert.assertEquals(1, parsedRows.size()); InputRow row = parsedRows.get(0); Assert.assertEquals(DateTimes.of("2020-01-01"), row.getTimestamp()); Assert.assertEquals("val", Iterables.getOnlyElement(row.getDimension("dim"))); Assert.assertEquals("val2", Iterables.getOnlyElement(row.getDimension("met"))); <END> }</code><technical_language>This is repeated for of tests below, worth factoring out</technical_language>

Target:
public void testWithParserAndNullInputformatParseProperly() throws IOException { final InputRowParser<ByteBuffer> parser = new StringInputRowParser( new NotConvertibleToInputFormatParseSpec(), StringUtils.UTF8_STRING ); final StreamChunkParser chunkParser = new StreamChunkParser( parser, null, null, null, null ); parseAndAssertResult(chunkParser); }
Source:
<code>public void start(Collection<? extends Location> locations) { RedisStore master = getMaster(); if (master == null) { master = addChild(EntitySpec.create(RedisStore.class)); setAttribute(MASTER, master); } Entities.manage(master); <START> master.invoke(RedisStore.START, ImmutableMap.<String, Object>of("locations", ImmutableList.copyOf(locations))).blockUntilEnded(); <END> DynamicCluster slaves = getSlaves(); if (slaves == null) { slaves = addChild(EntitySpec.create(DynamicCluster.class) .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(RedisSlave.class).configure(RedisSlave.MASTER, master))); setAttribute(SLAVES, slaves); } slaves.invoke(DynamicCluster.START, ImmutableMap.<String, Object>of("locations", ImmutableList.copyOf(locations))).blockUntilEnded(); setAttribute(Startable.SERVICE_UP, calculateServiceUp()); addEnricher(Enrichers.builder() .propagating(RedisStore.HOSTNAME, RedisStore.ADDRESS, RedisStore.SUBNET_HOSTNAME, RedisStore.SUBNET_ADDRESS, RedisStore.REDIS_PORT) .from(master) .build()); }</code><technical_language>@mikezaccardo I mislead blockUntilEnded. throw exceptions if error while executing effector. getUnchecked</technical_language>

Target:
public void start(Collection<? extends Location> locations) { ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING); ServiceProblemsLogic.clearProblemsIndicator(this, START); try { doStart(locations); ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING); } catch (Exception e) { ServiceProblemsLogic.updateProblemsIndicator(this, START, "Start failed with error: "+e); ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE); throw Exceptions.propagate(e); } }
Source:
<code>private Collection<Resource> <START> getModifiedResources() <END> { List<Resource> changed = new ArrayList<Resource>(); for (Resource currentResource : session.getAllSessionResources()) { if (currentResource.isModified()) { changed.add(currentResource); } } for (Resource currentResource : session.getSemanticResources()) { if (currentResource.isModified()) { changed.add(currentResource); } } return changed; }</code><technical_language>controlled resources changed</technical_language>

Target:
private Collection<Resource> getModifiedResources() { List<Resource> changed = new ArrayList<Resource>(); for (Resource currentResource : session.getAllSessionResources()) { if (currentResource.isModified()) { changed.add(currentResource); } } for (Resource currentResource : session.getSemanticResources()) { if (currentResource.isModified()) { changed.add(currentResource); } } if (session instanceof DAnalysisSessionEObject) { for (Resource currentResource : ((DAnalysisSessionEObject) session).getControlledResources()) { if (currentResource.isModified()) { changed.add(currentResource); } } } return changed; }
Source:
<code><START> static public void assertEqualDoubleArrays(final double[] lhs, final double[] rhs, final double accuracy) { <END> if (accuracy <= 0) throw new IllegalArgumentException("Accuracy must be positive."); Assert.assertEquals(lhs.length, rhs.length, "Arrays not same length: " + lhs.length + " vs. " + rhs.length); for (int i = 0; i < lhs.length; ++i) { Assert.assertTrue(compareDoubleWithAccuracy(lhs[i], rhs[i], accuracy), "Arrays disagree at position " + i + ": " + lhs[i] + " vs. " + rhs[i] + ". "); } }</code><technical_language>public static boolean</technical_language>

Target:
public static void assertEqualDoubleArrays(final double[] lhs, final double[] rhs, final double accuracy) { Assert.assertNotNull(lhs); Assert.assertNotNull(rhs); if (accuracy <= 0) throw new IllegalArgumentException("Accuracy must be positive."); Assert.assertEquals(lhs.length, rhs.length, "Arrays not same length: " + lhs.length + " vs. " + rhs.length); for (int i = 0; i < lhs.length; ++i) { Assert.assertTrue(compareDoubleWithAccuracy(lhs[i], rhs[i], accuracy), "Arrays disagree at position " + i + ": " + lhs[i] + " vs. " + rhs[i] + ". "); } }