auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static <T, C, R extends Iterable<T>> Map<C, R> groupBy(Traversable<T> source, Function<? super T, ? extends C> classifier, Function<? super Iterable<T>, R> mapper) { Objects.requireNonNull(classifier, "classifier is null"); Objects.requireNonNull(mapper, "mapper is null"); <START> final java.util.Map<C, Collection<T>> mutableResults = new java.util.LinkedHashMap<>(source.size()); <END> for (T value : source) { final C key = classifier.apply(value); mutableResults.computeIfAbsent(key, k -> new ArrayList<>()).add(value); } Map<C, R> results = LinkedHashMap.empty(); for (java.util.Map.Entry<C, Collection<T>> entry : mutableResults.entrySet()) { results = results.put(entry.getKey(), mapper.apply(entry.getValue())); } return results; }</code><technical_language>If source is a LinearSeq this means more time completely traverse => bad, right</technical_language>

Target:
static <T, C, R extends Iterable<T>> Map<C, R> groupBy(Traversable<T> source, Function<? super T, ? extends C> classifier, Function<? super Iterable<T>, R> mapper) { Objects.requireNonNull(classifier, "classifier is null"); Objects.requireNonNull(mapper, "mapper is null"); final java.util.Map<C, Collection<T>> mutableResults = new java.util.LinkedHashMap<>(source.isTraversableAgain() ? source.size() : 16); for (T value : source) { final C key = classifier.apply(value); mutableResults.computeIfAbsent(key, k -> new ArrayList<>()).add(value); } Map<C, R> results = LinkedHashMap.empty(); for (java.util.Map.Entry<C, Collection<T>> entry : mutableResults.entrySet()) { results = results.put(entry.getKey(), mapper.apply(entry.getValue())); } return results; }
Source:
<code><START> public static DebugFeatures fromString(String value) <END> { String normalized = value.toUpperCase().replace("-", "_"); return DebugFeatures.valueOf(normalized); }</code><technical_language>This is referring DebugFeatures, surprised working</technical_language>

Target:
public static EndpointDebugFeatures fromString(String value) { String normalized = value.toUpperCase().replace("-", "_"); return EndpointDebugFeatures.valueOf(normalized); }
Source:
<code>private TransactionComponents createTransactionComponents( @Output List<AutoCloseable> closeables, MetricsManager metricsManager, LockAndTimestampServices lockAndTimestampServices, KeyValueService keyValueService, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier) { CoordinationService<InternalSchemaMetadata> coordinationService = getSchemaMetadataCoordinationService( metricsManager, lockAndTimestampServices, keyValueService); TransactionSchemaManager transactionSchemaManager = new TransactionSchemaManager(coordinationService); <START> TransactionService transactionService = initializeCloseable(() -> AtlasDbMetrics.instrumentTimed( <END> metricsManager.getRegistry(), TransactionService.class, TransactionServices.createTransactionService(keyValueService, transactionSchemaManager)), closeables); Optional<TransactionSchemaInstaller> schemaInstaller = getTransactionSchemaInstallerIfSupported( closeables, keyValueService, runtimeConfigSupplier, transactionSchemaManager); return ImmutableTransactionComponents.builder() .transactionService(transactionService) .schemaInstaller(schemaInstaller) .build(); }</code><technical_language>Hmm, want this call SerializableTransactionManager:385, here. TransactionService is a separate class TransactionManager (the is manages start->commit timestamp mappings, is interface users AtlasDB)</technical_language>

Target:
private TransactionComponents createTransactionComponents( @Output List<AutoCloseable> closeables, MetricsManager metricsManager, LockAndTimestampServices lockAndTimestampServices, KeyValueService keyValueService, Supplier<AtlasDbRuntimeConfig> runtimeConfigSupplier) { CoordinationService<InternalSchemaMetadata> coordinationService = getSchemaMetadataCoordinationService( metricsManager, lockAndTimestampServices, keyValueService); TransactionSchemaManager transactionSchemaManager = new TransactionSchemaManager(coordinationService); TransactionService transactionService = initializeCloseable(() -> AtlasDbMetrics.instrument( metricsManager.getRegistry(), TransactionService.class, TransactionServices.createTransactionService(keyValueService, transactionSchemaManager)), closeables); Optional<TransactionSchemaInstaller> schemaInstaller = getTransactionSchemaInstallerIfSupported( closeables, keyValueService, runtimeConfigSupplier, transactionSchemaManager); return ImmutableTransactionComponents.builder() .transactionService(transactionService) .schemaInstaller(schemaInstaller) .build(); }
Source:
<code>public org.infinispan.transaction.TransactionMode getMode() { <START> switch (this) { <END> case NON_XA: case NON_DURABLE_XA: case FULL_XA: return org.infinispan.transaction.TransactionMode.TRANSACTIONAL; default: return org.infinispan.transaction.TransactionMode.NON_TRANSACTIONAL; } }</code><technical_language>smaller: return this == ? NON_TRANSACTIONAL : TRANSACTIONAL</technical_language>

Target:
public org.infinispan.transaction.TransactionMode getMode() { return this == NONE ? org.infinispan.transaction.TransactionMode.NON_TRANSACTIONAL : org.infinispan.transaction.TransactionMode.TRANSACTIONAL; }
Source:
<code>public static Map<Class<?>, Serde<?, ?>> getSerdes() { <START> return SERDES; <END> }</code><technical_language>wrap in immutable map</technical_language>

Target:
public static Map<Class<?>, Serde<?, ?>> getSerdes() { return Collections.unmodifiableMap(SERDES); }
Source:
<code>public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) { ClientStatistics clientStatistics = statsRef.get(); if (clientStatistics != null && clientStatistics.metricsBlob() != null) { long timestamp = clientStatistics.timestamp(); byte[] metricsBlob = clientStatistics.metricsBlob(); MetricConsumer consumer = new MetricConsumer() { @Override public void consumeLong(MetricDescriptor descriptor, long value) { context.collect(enhanceDescriptor(descriptor, timestamp), value); } @Override public void consumeDouble(MetricDescriptor descriptor, double value) { context.collect(enhanceDescriptor(descriptor, timestamp), value); } private MetricDescriptor enhanceDescriptor(MetricDescriptor descriptor, long timestamp) { return descriptor <START> .withExcludedTargets(asList(MetricTarget.values())) <END> .withIncludedTarget(MANAGEMENT_CENTER) .withTag(METRICS_TAG_CLIENT, getUuid().toString()) .withTag(METRICS_TAG_TIMESTAMP, Long.toString(timestamp)); } }; MetricsCompressor.extractMetrics(metricsBlob, consumer); } }</code><technical_language>MetricTarget.values() creates a new array instance invocation (as standard enum behavior). cache this array a static field in this anonymous class do similar avoid paying for this</technical_language>

Target:
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) { ClientStatistics clientStatistics = statsRef.get(); if (clientStatistics != null && clientStatistics.metricsBlob() != null) { long timestamp = clientStatistics.timestamp(); byte[] metricsBlob = clientStatistics.metricsBlob(); MetricConsumer consumer = new MetricConsumer() { @Override public void consumeLong(MetricDescriptor descriptor, long value) { context.collect(enhanceDescriptor(descriptor, timestamp), value); } @Override public void consumeDouble(MetricDescriptor descriptor, double value) { context.collect(enhanceDescriptor(descriptor, timestamp), value); } private MetricDescriptor enhanceDescriptor(MetricDescriptor descriptor, long timestamp) { return descriptor .withExcludedTargets(MetricTarget.VALUES_LIST) .withIncludedTarget(MANAGEMENT_CENTER) .withTag(METRICS_TAG_CLIENT, getUuid().toString()) .withTag(METRICS_TAG_TIMESTAMP, Long.toString(timestamp)); } }; MetricsCompressor.extractMetrics(metricsBlob, consumer); } }
Source:
<code>private String updateInstanceStatus(InstanceMetaData instanceMetaData, DetailedStackStatus detailedStackStatus) { String instanceStatusInfo = ""; switch (detailedStackStatus) { case AVAILABLE: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.CREATED); <START> instanceStatusInfo = String.format("instance %s is %s. ", instanceMetaData.getInstanceId(), InstanceStatus.CREATED.toString()); <END> break; case UNHEALTHY: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.UNHEALTHY); instanceStatusInfo = String.format("instance %s is %s. ", instanceMetaData.getInstanceId(), InstanceStatus.UNHEALTHY.toString()); break; case UNREACHABLE: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.UNREACHABLE); instanceStatusInfo = String.format("instance %s is %s. ", instanceMetaData.getInstanceId(), InstanceStatus.UNREACHABLE.toString()); break; default: LOGGER.info(":::Auto sync::: the '{}' status is not converted", detailedStackStatus); } return instanceStatusInfo; }</code><technical_language>toString() is necessary</technical_language>

Target:
private void updateInstanceStatus(InstanceMetaData instanceMetaData, DetailedStackStatus detailedStackStatus) { switch (detailedStackStatus) { case AVAILABLE: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.CREATED); break; case UNHEALTHY: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.UNHEALTHY); break; case UNREACHABLE: setStatusIfNotTheSame(instanceMetaData, InstanceStatus.UNREACHABLE); break; default: LOGGER.info(":::Auto sync::: the '{}' status is not converted", detailedStackStatus); } }
Source:
<code>public Properties readZipFile(String zipFilePath) { try { ZipFile zipFile = new ZipFile(zipFilePath); Enumeration<? extends ZipEntry> e = zipFile.entries(); while (e.hasMoreElements()) { ZipEntry entry = e.nextElement(); <START> String end = "pom.properties"; <END> if (!entry.isDirectory() && entry.getName().startsWith(MAVEN_META_INF) && entry.getName().endsWith(end)) { BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry)); Properties props = new Properties(); props.load(bis); bis.close(); return props; } else { continue; } } } catch (IOException e) { logger.error("IOError :{}", e.getMessage(), e); } return new Properties(); }</code><technical_language>end private static final String. sense create new local variable in a while loop.</technical_language>

Target:
private Properties readZipFile(String zipFilePath) { try { ZipFile zipFile = new ZipFile(zipFilePath); Enumeration<? extends ZipEntry> e = zipFile.entries(); while (e.hasMoreElements()) { ZipEntry entry = e.nextElement(); if (!entry.isDirectory() && entry.getName().startsWith(MAVEN_META_INF) && entry.getName().endsWith("pom.properties")) { try (BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry))) { Properties props = new Properties(); props.load(bis); return props; } } } } catch (IOException e) { logger.error("IOError :{}", e.getMessage(), e); } return new Properties(); }
Source:
<code>public Boolean call() { try { long start = 0; if (logger.isInfoEnabled()) { start = System.currentTimeMillis(); logger.info("Removing job " + jobId); } SchedulerDBManager dbManager = service.getInfrastructure().getDBManager(); List<InternalJob> jobs = dbManager.loadJobWithTasksIfNotRemoved(jobId); TerminationData terminationData; <START> if (jobs.size() != 1) { <END> terminationData = service.getJobs().removeJob(jobId); } else { if (isInFinishedState(jobs.get(0))) { terminationData = service.getJobs().removeJob(jobId); } else { terminationData = service.getJobs().killJob(jobId); } } service.submitTerminationDataHandler(terminationData); if (jobs.size() != 1) { return false; } InternalJob job = jobs.get(0); job.setRemovedTime(System.currentTimeMillis()); boolean removeFromDb = PASchedulerProperties.JOB_REMOVE_FROM_DB.getValueAsBoolean(); dbManager.removeJob(jobId, jobs.get(0).getRemovedTime(), removeFromDb); ServerJobAndTaskLogs.getInstance().remove(jobId, job.getOwner()); if (logger.isInfoEnabled()) { logger.info("Job " + jobId + " removed in " + (System.currentTimeMillis() - start) + "ms"); } service.getListener() .jobStateUpdated(job.getOwner(), new NotificationData<JobInfo>(SchedulerEvent.JOB_REMOVE_FINISHED, new JobInfoImpl((JobInfoImpl) job.getJobInfo()))); service.wakeUpSchedulingThread(); } catch (Exception e) { logger.error("Error while removing job " + jobId, e); throw e; } return true; }</code><technical_language>!= 1 jobs.empty()? if jobs.size is 2 ? i don t get exact logic :D</technical_language>

Target:
public Boolean call() { try { long start = 0; if (logger.isInfoEnabled()) { start = System.currentTimeMillis(); logger.info("Removing job " + jobId); } SchedulerDBManager dbManager = service.getInfrastructure().getDBManager(); List<InternalJob> jobs = dbManager.loadJobWithTasksIfNotRemoved(jobId); TerminationData terminationData; if (jobs.size() != 1) { terminationData = service.getJobs().removeJob(jobId); } else { if (isInFinishedState(jobs.get(0))) { terminationData = service.getJobs().removeJob(jobId); } else { terminationData = service.getJobs().killJob(jobId); } } service.submitTerminationDataHandler(terminationData); if (jobs.size() != 1) { return false; } InternalJob job = jobs.get(0); job.setRemovedTime(System.currentTimeMillis()); boolean removeFromDb = PASchedulerProperties.JOB_REMOVE_FROM_DB.getValueAsBoolean(); dbManager.removeJob(jobId, job.getRemovedTime(), removeFromDb); ServerJobAndTaskLogs.getInstance().remove(jobId, job.getOwner()); if (logger.isInfoEnabled()) { logger.info("Job " + jobId + " removed in " + (System.currentTimeMillis() - start) + "ms"); } service.getListener() .jobStateUpdated(job.getOwner(), new NotificationData<JobInfo>(SchedulerEvent.JOB_REMOVE_FINISHED, new JobInfoImpl((JobInfoImpl) job.getJobInfo()))); service.wakeUpSchedulingThread(); } catch (Exception e) { logger.error("Error while removing job " + jobId, e); throw e; } return true; }
Source:
<code>public void run() { try { final String path = ZKPaths.makePath(basePath, segmentHolder.getSegmentIdentifier()); final byte[] payload = jsonMapper.writeValueAsBytes(segmentHolder.getChangeRequest()); curator.create().withMode(CreateMode.EPHEMERAL).forPath(path, payload); log.debug( "ZKNode created for server to [%s] %s [%s]", basePath, segmentHolder.getType() == LOAD ? "load" : "drop", segmentHolder.getSegmentIdentifier() ); <START> final ScheduledFuture<?> future = monitorNodeRemovedExecutor.schedule( <END> () -> { try { if (curator.checkExists().forPath(path) != null) { failAssign(segmentHolder, new ISE("%s was never removed! Failing this operation!", path)); } else { log.debug("%s detected to be removed. ", path); } } catch (Exception e) { failAssign(segmentHolder, e); } }, config.getLoadTimeoutDelay().getMillis(), TimeUnit.MILLISECONDS ); final Stat stat = curator.checkExists().usingWatcher( (CuratorWatcher) watchedEvent -> { switch (watchedEvent.getType()) { case NodeDeleted: future.cancel(true); entryRemoved(segmentHolder, watchedEvent.getPath()); break; default: } } ).forPath(path); if (stat == null) { final byte[] noopPayload = jsonMapper.writeValueAsBytes(new SegmentChangeRequestNoop()); curator.create().withMode(CreateMode.EPHEMERAL).forPath(path, noopPayload); entryRemoved(segmentHolder, path); } } catch (KeeperException.NodeExistsException ne) { log.warn(ne, "ZK node already exists because segment change request hasn't yet been processed"); failAssign(segmentHolder); } catch (Exception e) { failAssign(segmentHolder, e); } }</code><technical_language>Please extract this block a method reduce size of run()</technical_language>

Target:
public void run() { try { final String path = ZKPaths.makePath(basePath, segmentHolder.getSegmentIdentifier()); final byte[] payload = jsonMapper.writeValueAsBytes(segmentHolder.getChangeRequest()); curator.create().withMode(CreateMode.EPHEMERAL).forPath(path, payload); log.debug( "ZKNode created for server to [%s] %s [%s]", basePath, segmentHolder.getType() == LOAD ? "load" : "drop", segmentHolder.getSegmentIdentifier() ); final ScheduledFuture<?> nodeDeletedCheck = scheduleNodeDeletedCheck(path); final Stat stat = curator.checkExists().usingWatcher( (CuratorWatcher) watchedEvent -> { switch (watchedEvent.getType()) { case NodeDeleted: nodeDeletedCheck.cancel(true); entryRemoved(segmentHolder, watchedEvent.getPath()); break; default: } } ).forPath(path); if (stat == null) { final byte[] noopPayload = jsonMapper.writeValueAsBytes(new SegmentChangeRequestNoop()); curator.create().withMode(CreateMode.EPHEMERAL).forPath(path, noopPayload); entryRemoved(segmentHolder, path); } } catch (KeeperException.NodeExistsException ne) { log.warn(ne, "ZK node already exists because segment change request hasn't yet been processed"); failAssign(segmentHolder); } catch (Exception e) { failAssign(segmentHolder, e); } }
Source:
<code>public void getInstanceAsync_nullConfigShouldThrow() { thrown.expect(IllegalArgumentException.class); Realm.getInstanceAsync(null, new Realm.Callback() { @Override public void onSuccess(Realm realm) { <START> } <END> }); }</code><technical_language>fail(); in onSuccess()</technical_language>

Target:
public void getInstanceAsync_nullConfigShouldThrow() { thrown.expect(IllegalArgumentException.class); Realm.getInstanceAsync(null, new Realm.Callback() { @Override public void onSuccess(Realm realm) { fail(); } }); }
Source:
<code>public Response updateWorkflowInstance(@ApiParam("Internal id for workflow instance") @PathParam("id") long id, @ApiParam("Submitted workflow instance information") UpdateWorkflowInstanceRequest req) { <START> return handleExceptions(() -> { <END> boolean updated = super.updateWorkflowInstance(id, req, workflowInstanceFactory, workflowInstances, workflowInstanceDao); return (updated ? noContent() : status(CONFLICT)).build(); }); }</code><technical_language>this throw EmptyResultDataAccessException if workflow is found? -> exception mapper fail format string due missing argument</technical_language>

Target:
public Response updateWorkflowInstance(@ApiParam("Internal id for workflow instance") @PathParam("id") long id, @ApiParam("Submitted workflow instance information") UpdateWorkflowInstanceRequest req) { return handleExceptions(() -> { boolean updated = super.updateWorkflowInstance(id, req, workflowInstanceFactory, workflowInstances, workflowInstanceDao); return (updated ? noContent() : status(CONFLICT)); }); }
Source:
<code>private void registerReceivers() { this.registrar = new BroadcastRegistrar(); this.registrar.addAction(UserList.ACTION_USER_LIST_UPDATE, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { <START> Log.i("MenuFragment", "User list update intent caught"); <END> ((UserListAdapter)userView.getAdapter()) .updateUserList( ( (CustomApp)getActivity().getApplication() ).getUserList()); } }).register(this.getActivity()); }</code><technical_language>This a variable TAG. TAG private static final String TAG = MenuFragment.class.getName()</technical_language>

Target:
private void registerReceivers() { this.registrar = new BroadcastRegistrar(); this.registrar.addAction(UserList.ACTION_USER_LIST_UPDATE, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { ((UserListAdapter)userView.getAdapter()).notifyDataSetChanged(); } }).register(this.getActivity()); }
Source:
<code>private QueueEntry(List<DataSegment> segments) { Preconditions.checkArgument(segments != null && !segments.isEmpty()); final List<DataSegment> segmentsToSort = new ArrayList<>(segments); Collections.sort(segmentsToSort); this.interval = new Interval( segmentsToSort.get(0).getInterval().getStart(), segmentsToSort.get(segmentsToSort.size() - 1).getInterval().getEnd() ); <START> this.segments = segmentsToSort; <END> }</code><technical_language>order of segments matter? calculate min start max end O(n) implementation looping segments</technical_language>

Target:
private QueueEntry(List<DataSegment> segments) { Preconditions.checkArgument(segments != null && !segments.isEmpty()); DateTime minStart = DateTimes.MAX, maxEnd = DateTimes.MIN; for (DataSegment segment : segments) { if (segment.getInterval().getStart().compareTo(minStart) < 0) { minStart = segment.getInterval().getStart(); } if (segment.getInterval().getEnd().compareTo(maxEnd) > 0) { maxEnd = segment.getInterval().getEnd(); } } this.interval = new Interval(minStart, maxEnd); this.segments = segments; }
Source:
<code>public void select(final int delay) { ArgumentVerifier.assertNotNegative(delay, "delay"); checkRunning(); localNoThreadScheduler.tick(null); try { if(delay == 0) { commonSelector.selectNow(); } else { commonSelector.select(delay); } if(isRunning()) { for(final SelectionKey key: commonSelector.selectedKeys()) { try { if(key.isAcceptable()) { doServerAccept(servers.get(key.channel())); } else { final Client tmpClient = clients.get(key.channel()); try{ if(key.isConnectable() && tmpClient != null) { doClientConnect(tmpClient, commonSelector); key.cancel(); setClientOperations(tmpClient); } else { if (key.isReadable()) { if(tmpClient != null){ stats.addRead(doClientRead(tmpClient, commonSelector)); } else { final Server server = servers.get(key.channel()); if(server != null && server.getServerType() == WireProtocol.UDP) { server.acceptChannel((DatagramChannel)server.getSelectableChannel()); } } } if(key.isWritable()) { stats.addWrite(doClientWrite(tmpClient, commonSelector)); } } <START> } catch(Exception e) { <END> if(tmpClient != null) { tmpClient.close(); } } } } catch(CancelledKeyException e) { } } commonSelector.selectNow(); localNoThreadScheduler.tick(null); } } catch (IOException e) { } catch(ClosedSelectorException e) { } catch (NullPointerException e) { } }</code><technical_language>I dropping exception here? allow ExceptionUtils handle it</technical_language>

Target:
public void select(final int delay) { ArgumentVerifier.assertNotNegative(delay, "delay"); checkRunning(); localNoThreadScheduler.tick(null); try { if(delay == 0) { commonSelector.selectNow(); } else { commonSelector.select(delay); } if(isRunning()) { for(final SelectionKey key: commonSelector.selectedKeys()) { try { if(key.isAcceptable()) { doServerAccept(servers.get(key.channel())); } else { final Client tmpClient = clients.get(key.channel()); if(key.isConnectable() && tmpClient != null) { doClientConnect(tmpClient, commonSelector); key.cancel(); setClientOperations(tmpClient); } else { if (key.isReadable()) { if(tmpClient != null){ stats.addRead(doClientRead(tmpClient, commonSelector)); } else { final Server server = servers.get(key.channel()); if(server != null && server.getServerType() == WireProtocol.UDP) { server.acceptChannel((DatagramChannel)server.getSelectableChannel()); } } } if(key.isWritable()) { stats.addWrite(doClientWrite(tmpClient, commonSelector)); } } } } catch(CancelledKeyException e) { } } commonSelector.selectNow(); localNoThreadScheduler.tick(null); } } catch (IOException e) { } catch(ClosedSelectorException e) { } catch (NullPointerException e) { } }
Source:
<code>private String setParameter(HttpMessage msg, NameValuePair originalPair, String name, String value, boolean escaped) { ParameterParser parser; if (originalPair.getType() == NameValuePair.TYPE_POST_DATA) { parser = Model.getSingleton().getSession().getFormParamParser(msg.getRequestHeader().getURI().toString()); } else { parser = Model.getSingleton().getSession().getUrlParamParser(msg.getRequestHeader().getURI().toString()); } StringBuilder sb = new StringBuilder(); String encodedValue = (escaped) ? value : getEscapedValue(msg, value); NameValuePair pair; boolean isAppended = false; String query = null; for (int i = 0; i < getParamList().size(); i++) { pair = getParamList().get(i); if (i == originalPair.getPosition()) { isAppended = paramAppend(sb, getEscapedName(msg, name), encodedValue, parser); } else { isAppended = paramAppend(sb, getEscapedName(msg, pair.getName()), getEscapedValue(msg, pair.getValue()), parser); } if (isAppended && i < getParamList().size() - 1) { sb.append(parser.getDefaultKeyValuePairSeparator()); } query = sb.toString(); } if (query == null) { <START> query = encodedValue; <END> } buildMessage(msg, query); return query; }</code><technical_language>caused mixed indentation chars</technical_language>

Target:
private String setParameter(HttpMessage msg, NameValuePair originalPair, String name, String value, boolean escaped) { ParameterParser parser; if (originalPair.getType() == NameValuePair.TYPE_POST_DATA) { parser = Model.getSingleton().getSession().getFormParamParser(msg.getRequestHeader().getURI().toString()); } else { parser = Model.getSingleton().getSession().getUrlParamParser(msg.getRequestHeader().getURI().toString()); } StringBuilder sb = new StringBuilder(); String encodedValue = (escaped) ? value : getEscapedValue(msg, value); NameValuePair pair; boolean isAppended; for (int i = 0; i < getParamList().size(); i++) { pair = getParamList().get(i); if (i == originalPair.getPosition()) { isAppended = paramAppend(sb, getEscapedName(msg, name), encodedValue, parser); } else { isAppended = paramAppend(sb, getEscapedName(msg, pair.getName()), getEscapedValue(msg, pair.getValue()), parser); } if (isAppended && i < getParamList().size() - 1) { sb.append(parser.getDefaultKeyValuePairSeparator()); } } if (sb.length() == 0) { sb.append(encodedValue); } String query = sb.toString(); buildMessage(msg, query); return query; }
Source:
<code>public boolean intersects(GeoShape geoShape) { <START> throw new VertexiumException("Not implemented for argument type " + geoShape.getClass().getName()); <END> }</code><technical_language>able call intersects geoShapes here</technical_language>

Target:
public boolean intersects(GeoShape geoShape) { return geoShapes.stream().anyMatch(shape -> shape.intersects(geoShape)); }
Source:
<code>public void process(TestDeployment testDeployment, Archive<?> protocolArchive) { TestClass testClass = this.testClass.get(); if (testClass.isAnnotationPresent(WarpTest.class)) { Archive<?> applicationArchive = testDeployment.getApplicationArchive(); List<ArchivePath> classPathsToRemove = new LinkedList<ArchivePath>(); for (ArchivePath archivePath : applicationArchive.getContent().keySet()) { String path = archivePath.get(); String classPath = testClass.getName().replace(".", "/"); if (path.matches("/WEB-INF/classes/" + classPath + "(\\$[0-9]*)?\\.class")) { classPathsToRemove.add(archivePath); } } for (ArchivePath archivePath : classPathsToRemove) { applicationArchive.delete(archivePath); } <START> WebArchive protocolWar = (WebArchive)protocolArchive; <END> protocolWar.addAsLibrary( ShrinkWrap.create(JavaArchive.class, "arquillian-warp-filter.jar") .addClass(WarpFilter.class)); } }</code><technical_language>This assumption is true for Servlet Protocol. Other Protocols protocolArchive types. Warp works Servlet Protocol, a check/controlled exception if a .war (not of Type WebArchive) nice, is handled else where? java if(protocolArchive.getName().endsWith(".war")) { protocolArchive.as(WebArchive.class).addAsLibrary(...) }</technical_language>

Target:
public void process(TestDeployment testDeployment, Archive<?> protocolArchive) { TestClass testClass = this.testClass.get(); if (testClass.isAnnotationPresent(WarpTest.class)) { Archive<?> applicationArchive = testDeployment.getApplicationArchive(); List<ArchivePath> classPathsToRemove = new LinkedList<ArchivePath>(); for (ArchivePath archivePath : applicationArchive.getContent().keySet()) { String path = archivePath.get(); String classPath = testClass.getName().replace(".", "/"); if (path.matches("/WEB-INF/classes/" + classPath + "(\\$[0-9]*)?\\.class")) { classPathsToRemove.add(archivePath); } } for (ArchivePath archivePath : classPathsToRemove) { applicationArchive.delete(archivePath); } if (Validate.isArchiveOfType(WebArchive.class, protocolArchive)) { protocolArchive.as(WebArchive.class).addAsLibrary( ShrinkWrap.create(JavaArchive.class, "arquillian-warp-filter.jar") .addClass(WarpFilter.class)); } else { throw new IllegalArgumentException("Protocol archives of type "+protocolArchive.getClass()+" not supported. Please use the Servlet 3.0 protocol."); } } }
Source:
<code>public int compareTo(Comment that){ <START> return (int) (this.getId() - that.getId()); <END> }</code><technical_language>this is safe. I check <, >, == return -1, 1, 0 (otherwise integer overflow problems I think)</technical_language>

Target:
public int compareTo(Comment that){ return Long.valueOf(this.getId()).compareTo(that.getId()); }
Source:
<code>protected void invokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor) { ExtensionContext extensionContext = context.getExtensionContext(); context.getThrowableCollector().execute(() -> { Object instance = extensionContext.getRequiredTestInstance(); Object testFactoryMethodResult = executableInvoker.invoke(getTestMethod(), instance, extensionContext, context.getExtensionRegistry()); TestSource defaultTestSource = getSource().orElseThrow( () -> new JUnitException("Illegal state: TestSource must be present")); <START> if (testFactoryMethodResult instanceof DynamicNode) { <END> execute((DynamicNode) testFactoryMethodResult, defaultTestSource, 1, dynamicTestExecutor); return; } try (Stream<DynamicNode> dynamicNodeStream = toDynamicNodeStream(testFactoryMethodResult)) { int index = 1; Iterator<DynamicNode> iterator = dynamicNodeStream.iterator(); while (iterator.hasNext()) { execute(iterator.next(), defaultTestSource, index++, dynamicTestExecutor); } } catch (ClassCastException ex) { throw invalidReturnTypeException(ex); } }); }</code><technical_language>This handled in toDynamicNodeStream returning Stream.of((DynamicNode) testFactoryMethodResult)</technical_language>

Target:
protected void invokeTestMethod(JupiterEngineExecutionContext context, DynamicTestExecutor dynamicTestExecutor) { ExtensionContext extensionContext = context.getExtensionContext(); context.getThrowableCollector().execute(() -> { Object instance = extensionContext.getRequiredTestInstance(); Object testFactoryMethodResult = executableInvoker.invoke(getTestMethod(), instance, extensionContext, context.getExtensionRegistry()); TestSource defaultTestSource = getSource().orElseThrow( () -> new JUnitException("Illegal state: TestSource must be present")); try (Stream<DynamicNode> dynamicNodeStream = toDynamicNodeStream(testFactoryMethodResult)) { int index = 1; Iterator<DynamicNode> iterator = dynamicNodeStream.iterator(); while (iterator.hasNext()) { DynamicNode dynamicNode = iterator.next(); Optional<JupiterTestDescriptor> descriptor = createDynamicDescriptor(this, dynamicNode, index++, defaultTestSource, getDynamicDescendantFilter()); descriptor.ifPresent(dynamicTestExecutor::execute); } } catch (ClassCastException ex) { throw invalidReturnTypeException(ex); } }); }
Source:
<code>GdkColor getContextColor () { if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { if (foreground != null) { return display.toGdkColor (foreground); } else { return display.COLOR_LIST_FOREGROUND; } } else { <START> return super.getContextBackground (); <END> } }</code><technical_language>If overriding getContextColor() call super.getContextColor(), super.getContextBackground()</technical_language>

Target:
GdkColor getContextColor () { if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) { if (foreground != null) { return display.toGdkColor (foreground); } else { return display.COLOR_LIST_FOREGROUND; } } else { return super.getContextColor (); } }
Source:
<code>public List<Pool> lookupOversubscribedBySubscriptionIds(Owner owner, Map<String, Entitlement> subIdMap) { List<Criterion> subIdMapCriteria = new ArrayList<Criterion>(); Criterion[] exampleCriteria = new Criterion[0]; <START> Owner currentOwner = null; <END> for (Entry<String, Entitlement> entry : subIdMap.entrySet()) { SimpleExpression subscriptionExpr = Restrictions.eq("sourceSub.subscriptionId", entry.getKey()); Junction subscriptionJunction = Restrictions.and(subscriptionExpr).add( Restrictions.or(Restrictions.isNull("sourceEntitlement"), Restrictions.eqOrIsNull("sourceEntitlement", entry.getValue()))); subIdMapCriteria.add(subscriptionJunction); } return currentSession() .createCriteria(Pool.class) .createAlias("sourceSubscription", "sourceSub") .add(Restrictions.eq("owner", owner)) .add(Restrictions.ge("quantity", 0L)) .add(Restrictions.gtProperty("consumed", "quantity")) .add(Restrictions.or(subIdMapCriteria.toArray(exampleCriteria))).list(); }</code><technical_language>Unused variable</technical_language>

Target:
public List<Pool> lookupOversubscribedBySubscriptionIds(Owner owner, Map<String, Entitlement> subIdMap) { List<Criterion> subIdMapCriteria = new ArrayList<Criterion>(); Criterion[] exampleCriteria = new Criterion[0]; for (Entry<String, Entitlement> entry : subIdMap.entrySet()) { SimpleExpression subscriptionExpr = Restrictions.eq("sourceSub.subscriptionId", entry.getKey()); Junction subscriptionJunction = Restrictions.and(subscriptionExpr).add( Restrictions.or(Restrictions.isNull("sourceEntitlement"), Restrictions.eqOrIsNull("sourceEntitlement", entry.getValue()))); subIdMapCriteria.add(subscriptionJunction); } return currentSession() .createCriteria(Pool.class) .createAlias("sourceSubscription", "sourceSub") .add(Restrictions.eq("owner", owner)) .add(Restrictions.ge("quantity", 0L)) .add(Restrictions.gtProperty("consumed", "quantity")) .add(Restrictions.or(subIdMapCriteria.toArray(exampleCriteria))).list(); }
Source:
<code>public void onDisable() { getBackup().setPendingShutdown(true); for (User user : getOnlineUsers()) { if (user.isVanished()) { user.setVanished(false); user.sendMessage(tl("unvanishedReload")); } user.stopTransaction(); } cleanupOpenInventories(); if (i18n != null) { i18n.onDisable(); } if (backup != null) { backup.stopTask(); } Economy.setEss(null); Trade.closeLog(); getUserMap().getUUIDMap().shutdown(); HandlerList.unregisterAll(this); while (getBackup().isActive()) { try { <START> Thread.sleep(10); <END> } catch (InterruptedException e) { e.printStackTrace(); } } }</code><technical_language>I do, Aikar pointed out this done a future. If work here, change this sleep for a time, avoid superfluous waiting. main thread do this point anyways</technical_language>

Target:
public void onDisable() { boolean stopping = ServerState.isStopping(); if (!stopping) { LOGGER.log(Level.SEVERE, tl("serverReloading")); } getBackup().setPendingShutdown(true); for (User user : getOnlineUsers()) { if (user.isVanished()) { user.setVanished(false); user.sendMessage(tl("unvanishedReload")); } if (stopping) { user.setLastLocation(); if (!user.isHidden()) { user.setLastLogout(System.currentTimeMillis()); } user.cleanup(); } else { user.stopTransaction(); } } cleanupOpenInventories(); if (getBackup().getTaskLock() != null && !getBackup().getTaskLock().isDone()) { LOGGER.log(Level.SEVERE, tl("backupInProgress")); getBackup().getTaskLock().join(); } if (i18n != null) { i18n.onDisable(); } if (backup != null) { backup.stopTask(); } Economy.setEss(null); Trade.closeLog(); getUserMap().getUUIDMap().shutdown(); HandlerList.unregisterAll(this); }
Source:
<code>public int hashCode() { <START> final int prime = 31; <END> int result = 1; result = prime * result + ((m_name == null) ? 0 : m_name.hashCode()); return result; }</code><technical_language>Please Objects.hash(...) (<LINK_0> instead of manually hash coding everything</technical_language>

Target:
public int hashCode() { return Objects.hash(m_name); }
Source:
<code><START> GenericRecord getBobRecord1(org.apache.avro.Schema avroOutputSchema) { <END> return new GenericRecordBuilder(avroOutputSchema) .set("film_id", "1") .set("film_name", "matrix") .set("renamed_category", "thriller") .set("renamed_actor", "bob") .build(); }</code><technical_language>constants right? do need new instances of for some reason</technical_language>

Target:
private GenericRecord getBobRecord1(org.apache.avro.Schema avroOutputSchema) { return new GenericRecordBuilder(avroOutputSchema) .set("film_id", "1") .set("film_name", "matrix") .set("renamed_category", "thriller") .set("renamed_actor", "bob") .build(); }
Source:
<code>public List<AdverseEventType> getAllAdverseEventTypes() { TypedQuery<AdverseEventType> query; <START> query = entityManager.createQuery("SELECT a from AdverseEventType a", AdverseEventType.class); <END> return query.getResultList(); }</code><technical_language>@lauravignoli reason split declaration initialisation of query variable separate lines? I style methods above, personal preference I leave you</technical_language>

Target:
public List<AdverseEventType> getAllAdverseEventTypes() { return entityManager.createQuery("SELECT a from AdverseEventType a", AdverseEventType.class).getResultList(); }
Source:
<code>static LogicalPlan.Builder create(LogicalPlan.Builder source, List<WindowFunction> windowFunctions) { if (windowFunctions.isEmpty()) { return source; } return (tableStats, hints, usedBeforeNextFetch) -> { HashSet<Symbol> allUsedColumns = new HashSet<>(extractColumns(usedBeforeNextFetch)); Set<Symbol> columnsUsedInFunctions = extractColumns(windowFunctions); LinkedHashMap<WindowDefinition, ArrayList<WindowFunction>> groupedFunctions = new LinkedHashMap<>(); for (WindowFunction windowFunction : windowFunctions) { WindowDefinition windowDefinition = windowFunction.windowDefinition(); if (windowFunction.filter() != null) { <START> columnsUsedInFunctions.add(windowFunction.filter()); <END> } OrderBy orderBy = windowDefinition.orderBy(); if (orderBy != null) { columnsUsedInFunctions.addAll(extractColumns(orderBy.orderBySymbols())); } columnsUsedInFunctions.addAll(extractColumns(windowDefinition.partitions())); ArrayList<WindowFunction> functions = groupedFunctions.computeIfAbsent(windowDefinition, w -> new ArrayList<>()); functions.add(windowFunction); } allUsedColumns.addAll(columnsUsedInFunctions); LogicalPlan sourcePlan = source.build(tableStats, hints, allUsedColumns); LogicalPlan lastWindowAgg = sourcePlan; for (Map.Entry<WindowDefinition, ArrayList<WindowFunction>> entry : groupedFunctions.entrySet()) { lastWindowAgg = new WindowAgg(lastWindowAgg, entry.getKey(), entry.getValue(), lastWindowAgg.outputs()); } return lastWindowAgg; }; }</code><technical_language>not? If filter a function, InputColumns create right Function/InputColumn structure</technical_language>

Target:
static LogicalPlan.Builder create(LogicalPlan.Builder source, List<WindowFunction> windowFunctions) { if (windowFunctions.isEmpty()) { return source; } return (tableStats, hints, usedBeforeNextFetch) -> { HashSet<Symbol> allUsedColumns = new HashSet<>(extractColumns(usedBeforeNextFetch)); Set<Symbol> columnsUsedInFunctions = extractColumns(windowFunctions); LinkedHashMap<WindowDefinition, ArrayList<WindowFunction>> groupedFunctions = new LinkedHashMap<>(); for (WindowFunction windowFunction : windowFunctions) { WindowDefinition windowDefinition = windowFunction.windowDefinition(); if (windowFunction.filter() != null) { columnsUsedInFunctions.addAll(extractColumns(windowFunction.filter())); } OrderBy orderBy = windowDefinition.orderBy(); if (orderBy != null) { columnsUsedInFunctions.addAll(extractColumns(orderBy.orderBySymbols())); } columnsUsedInFunctions.addAll(extractColumns(windowDefinition.partitions())); ArrayList<WindowFunction> functions = groupedFunctions.computeIfAbsent(windowDefinition, w -> new ArrayList<>()); functions.add(windowFunction); } allUsedColumns.addAll(columnsUsedInFunctions); LogicalPlan sourcePlan = source.build(tableStats, hints, allUsedColumns); LogicalPlan lastWindowAgg = sourcePlan; for (Map.Entry<WindowDefinition, ArrayList<WindowFunction>> entry : groupedFunctions.entrySet()) { lastWindowAgg = new WindowAgg(lastWindowAgg, entry.getKey(), entry.getValue(), lastWindowAgg.outputs()); } return lastWindowAgg; }; }
Source:
<code>@Override public void setup(Context.OperatorContext context) { super.setup(context); fields = new ArrayList<Field>(); String[] field_info = fieldInfo.split(","); for ( int i=0 ; i < field_info.length ; i++ ) { String[] field_tuple = field_info[i].split(":"); Field field = new Field(); field.setName(field_tuple[0]); <START> String[] type_format = field_tuple[1].split("\\|"); <END> field.setType(type_format[0].toUpperCase()); if ( type_format.length > 1 ) { field.setFormat(type_format[1]); } getFields().add(field); } preference = new CsvPreference.Builder('"', fieldDelimiter, lineDelimiter).build(); int countKeyValue = getFields().size(); nameMapping = new String[countKeyValue]; processors = new CellProcessor[countKeyValue]; initialise(nameMapping, processors); }</code><technical_language>Inconsistent variable naming</technical_language>

Target:
public void setup(Context.OperatorContext context) { super.setup(context); fields = new ArrayList<Field>(); String[] fieldInfoTuple = fieldInfo.split(","); for (int i = 0; i < fieldInfoTuple.length; i++) { String[] fieldTuple = fieldInfoTuple[i].split(":"); Field field = new Field(); field.setName(fieldTuple[0]); String[] typeFormat = fieldTuple[1].split("\\|"); field.setType(typeFormat[0].toUpperCase()); if (typeFormat.length > 1) { field.setFormat(typeFormat[1]); } getFields().add(field); } preference = new CsvPreference.Builder('"', fieldDelimiter, lineDelimiter).build(); int countKeyValue = getFields().size(); nameMapping = new String[countKeyValue]; processors = new CellProcessor[countKeyValue]; initialise(nameMapping, processors); }
Source:
<code>public Optional<Type> elementType(Type containerType) { <START> return findGenericParameter(containerType, getErasedType(containerType)); <END> }</code><technical_language>hardcoded EnumSet.class, getErasedType(containerType)</technical_language>

Target:
public Optional<Type> elementType(Type containerType) { return findGenericParameter(containerType, EnumSet.class); }
Source:
<code>public static int getInt(String str, int defaultVal) { <START> try { return Integer.parseInt(str); } catch (NumberFormatException e) { return defaultVal; } <END> }</code><technical_language>ewwww, abusing try/catch for this is unideal... a Pattern for Numerics know</technical_language>

Target:
public static int getInt(String str, int defaultVal) { if (PatternUtils.NUMERIC.matcher(str).matches()) return Integer.parseInt(str); return defaultVal; }
Source:
<code>public double getMeanTaskRunningTime(String jobId) { final long id = Long.parseLong(jobId); Double result = executeReadOnlyTransaction(session -> { Query jobQuery = session.getNamedQuery("checkJobExistence").setParameter("id", id); if (jobQuery.uniqueResult() == null) { return null; } Query query = session.getNamedQuery("getMeanTaskRunningTime").setParameter("id", id); Double result1 = (Double) query.uniqueResult(); <START> return result1 == null ? 0 : result1; <END> }); return checkResult(id, result); }</code><technical_language>'0d'</technical_language>

Target:
public double getMeanTaskRunningTime(String jobId) { final long id = Long.parseLong(jobId); Double result = executeReadOnlyTransaction(session -> { Query jobQuery = session.getNamedQuery("checkJobExistence").setParameter("id", id); if (jobQuery.uniqueResult() == null) { return null; } Query query = session.getNamedQuery("getMeanTaskRunningTime").setParameter("id", id); Double uniqueResult = (Double) query.uniqueResult(); return uniqueResult == null ? 0.0d : uniqueResult; }); return checkResult(id, result); }
Source:
<code>public static void main(String[] args) { if (args.length == 0) { printUsage(System.err, "You must provide a properties file"); System.exit(1); } MultiLangDaemonConfig config = null; try { config = new MultiLangDaemonConfig(args[0]); } catch (IOException e) { printUsage(System.err, "You must provide a properties file"); System.exit(1); } catch (IllegalArgumentException e) { printUsage(System.err, e.getMessage()); System.exit(1); } ExecutorService executorService = config.getExecutorService(); final MultiLangDaemon daemon = new MultiLangDaemon( config.getKinesisClientLibConfiguration(), config.getRecordProcessorFactory(), executorService); Runtime.getRuntime().addShutdownHook(new Thread() <START> { <END> @Override public void run() { LOG.info("Process terminanted, will initiate shutdown."); try { Future<Void> fut = daemon.worker.requestShutdown(); fut.get(); LOG.info("Process shutdown is complete."); } catch (InterruptedException | ExecutionException e) { LOG.error("Encountered an error during shutdown.", e); } } }); Future<Integer> future = executorService.submit(daemon); try { System.exit(future.get()); } catch (InterruptedException | ExecutionException e) { LOG.error("Encountered an error while running daemon", e); } System.exit(1); }</code><technical_language>please match existing style curly brace line</technical_language>

Target:
public static void main(String[] args) { if (args.length == 0) { printUsage(System.err, "You must provide a properties file"); System.exit(1); } MultiLangDaemonConfig config = null; try { config = new MultiLangDaemonConfig(args[0]); } catch (IOException e) { printUsage(System.err, "You must provide a properties file"); System.exit(1); } catch (IllegalArgumentException e) { printUsage(System.err, e.getMessage()); System.exit(1); } ExecutorService executorService = config.getExecutorService(); final MultiLangDaemon daemon = new MultiLangDaemon( config.getKinesisClientLibConfiguration(), config.getRecordProcessorFactory(), executorService); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { LOG.info("Process terminanted, will initiate shutdown."); try { Future<Void> fut = daemon.worker.requestShutdown(); fut.get(5000, TimeUnit.MILLISECONDS); LOG.info("Process shutdown is complete."); } catch (InterruptedException | ExecutionException | TimeoutException e) { LOG.error("Encountered an error during shutdown.", e); } } }); Future<Integer> future = executorService.submit(daemon); try { System.exit(future.get()); } catch (InterruptedException | ExecutionException e) { LOG.error("Encountered an error while running daemon", e); } System.exit(1); }
Source:
<code>public final Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable { boolean releaseRemote = false; try { if (command.hasFlag(Flag.FORCE_WRITE_LOCK) && ctx.isInTxScope()) { boolean skipLocking = hasSkipLocking(command); if (!skipLocking) { releaseRemote = true; acquireRemoteIfNeeded(ctx, command, cdl.localNodeIsPrimaryOwner(command.getKey())); } long lockTimeout = getLockAcquisitionTimeout(command, skipLocking); lockKeyAndCheckOwnership(ctx, command.getKey(), lockTimeout, skipLocking); } return invokeNextInterceptor(ctx, command); } catch (Throwable t) { releaseRemote = false; releaseLocksOnFailureBeforePrepare(ctx); throw t; } finally { if (!ctx.isInTxScope()) lockManager.unlockAll(ctx); <START> if(releaseRemote) releaseRemoteIfNeeded(ctx, command, cdl.localNodeIsPrimaryOwner(command.getKey())); <END> } }</code><technical_language>This wrong, locks released commit/rollback. If release lock immediately reading it, lock all, do FORCE_WRITE_LOCK flag used</technical_language>

Target:
public final Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable { try { if (command.hasFlag(Flag.FORCE_WRITE_LOCK) && ctx.isInTxScope()) { boolean skipLocking = hasSkipLocking(command); if (!skipLocking) { acquireRemoteIfNeeded(ctx, command, cdl.localNodeIsPrimaryOwner(command.getKey())); } long lockTimeout = getLockAcquisitionTimeout(command, skipLocking); lockKeyAndCheckOwnership(ctx, command.getKey(), lockTimeout, skipLocking); } return invokeNextInterceptor(ctx, command); } catch (Throwable t) { releaseLocksOnFailureBeforePrepare(ctx); throw t; } finally { if (!ctx.isInTxScope()) lockManager.unlockAll(ctx); } }
Source:
<code>public boolean isCameraFlashAvailable() { <START> return (frontCameraInformation.flashAvailable || backCameraInformation.flashAvailable); <END> }</code><technical_language>If a device 2 cameras run a NPE here, frontCameraInformation / backCameraInformation initialized in CameraManager constructor. (Happened emulated device camera)</technical_language>

Target:
public boolean isCameraFlashAvailable() { return (hasBackCameraFlash() || hasFrontCameraFlash()); }
Source:
<code>public void signs() throws IOException { MatcherAssert.assertThat( new String( new SiHmac( "key", SiHmac.HMAC256 <START> ).sign( <END> "The quick brown fox jumps over the lazy dog".getBytes() ) ), Matchers.equalTo( "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8" ) ); }</code><technical_language>@fanifieiev above</technical_language>

Target:
public void signs() throws IOException { new Assertion<>( "Must have proper signature", new String( new SiHmac("key", SiHmac.HMAC256).sign( "The quick brown fox jumps over the lazy dog".getBytes() ) ), new IsEqual<>( "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8" ) ).affirm(); }